Multiple Watermeters JSON Format


I’ve got a separate PI receiving and processing telegrams from multiple water meters (it uses wmbusmeters GitHub - weetmuts/wmbusmeters: Read the wireless mbus protocol to acquire utility meter readings.). I’ve managed to get it to MQTT the data across using the following statement in the config shell=/usr/bin/mosquitto_pub -h [emoncms IP] -p 1883 -u [emon username] -P [password] -t emon -m “$METER_JSON”

Sample JSON output:

	"media": "cold water",
	"meter": "multical21",
	"name": "MyTapWater",
	"id": "12345678",
	"total_m3": 6.388,
	"target_m3": 6.377,
	"max_flow_m3h": 0.000,
	"flow_temperature": 8,
	"external_temperature": 23,
	"current_status": "DRY",
	"time_dry": "22-31 days",
	"time_reversed": "",
	"time_leaking": "",
	"time_bursting": "",
	"timestamp": "2018-02-08T09:07:22Z",
	"device": "im871a[1234567]",
	"rssi_dbm": -40

The data received provides the information regarding the meter it has come from (using the example above, either name or od).

Question is… Is it possible for emonhub / emoncms to direct the data to an input / feed based on the data within it, e.g. when the JSON data contains “Meter1” as the meter id, it directs to say node 6, “Meter 2” to node 7 etc…I understand how my emonpi does it for node 5 but that is configured at source.

My emoncms (work to do) currently looks like this

so each receipt of information overwrites the previous meter send


I reformatted the JSON to make it easier to read.

I think you will have to post process the data using something like Node-Red to extract the meter name. Post it onto a different (non emon) topic and then process the JSON. Once you have done that you could post it to a topic emon/meter1.

I suggest you strip out all non-numeric fields as well.

1 Like

Thanks Brian - I’ll go and do some (more) reading. Only just got my head around MQTT this morning :upside_down_face: