I have been running emonPi for well over a year monitoring our grid/solar/battery set-up and am very pleased with its flexibility. A couple of months ago I introduced an MQTT feed from a Raspberry P Pico W that is collecting various information covering our boiler, thermal store and solar hot water and that is working well; the MQTT messages consist of a set of name/value pairs, and emoncms handles them well. Handling the data this way allows me to use all of the emoncms data & graphing capabilities. So far, so good!
I have just installed a Hildebrand Glow CAD which can send out actual gas and electricity meter readings in real-time using MQTT. Although the messages are valid JSON, they use a hierarchical data format that requires additional processing to extract individual data items.
If I send the messages directly to an ‘emon/glow’ topic I see 3 new inputs, 1 for the status and 1 for each meter - I cannot see any obvious way of breaking out the actual data. If I send to an intermediate topic and use an external system to pre-process the meter messages I can have a separate device for each of the meters, with a series of inputs numbered from 0 for each. But I can’t see what each of these inputs corresponds to, and the relationship between name and input number is probably not fixed.
Here’s an example of the raw gas meter data to give you an idea of what it looks like:
Topic: “glow/A8032AD79A34/SENSOR/gasmeter” Message: “{“gasmeter”:{“timestamp”:“2024-12-04T17:33:11Z”,“energy”:{“import”:{“cumulative”:38859.805,“day”:81.027,“week”:238.392,“month”:274.998,“units”:“kWh”,“cumulativevol”:3480.870,“cumulativevolunits”:“m3”,“dayvol”:81.027,“weekvol”:238.392,“monthvol”:274.998,“dayweekmonthvolunits”:“kWh”,“mprn”:“9193963605”,“supplier”:”—“,“price”:{“unitrate”:0.06318,“standingcharge”:0.23928}}}}}”
If I pre-process it the message part looks like this and emoncms generates inputs 0 thru 15:
{“gasmeter”: {“energy”: {“import”: {“cumulativevol”: 3480.87, “price”: {“standingcharge”: 0.23928, “unitrate”: 0.06318}, “cumulative”: 38859.8, “dayweekmonthvolunits”: “kWh”, “supplier”: “—”, “units”: “kWh”, “week”: 238.392, “dayvol”: 81.027, “weekvol”: 238.392, “day”: 81.027, “monthvol”: 274.998, “cumulativevolunits”: “m3”, “mprn”: “9193963605”, “month”: 274.998}}, “timestamp”: “2024-12-04T17:33:11Z”}}
So my question is, how can I best process these MQTT messages to extract the data that I wish to see into emoncms? I don’t want to store all of it, just create feeds from certain values.
I would prefer to do this on the emonpi platform, rather than on another system, if possible.
Thanks,
Martin