Community
OpenEnergyMonitor

OpenEnergyMonitor Community

Update to MQTT Interfacer in emonhub

@trystan has today pushed a change to the MQTT interfacer that I developed. It is currently just in master for testing.

The key change is that a data frame can be published as a single JSON payload and is timestamped. (much like an HTTP data frame) rather than each element of the data frame being sent as separate published topics. This follows on from work I did sometime ago for the emoncms API to accept timestamped JSON payloads.

The main advantage of this is that all the data from one frame uses the same timestamp. In extreme conditions, it was possible for one data item of a frame to be registered against one timeseries slot, and the next item of the same data frame to be registered in the next slot.

The other advantage is reduced processing at both ends as a single MQTT topic is now published/subscribed.

To use this feature on an emonpi stop using the nodevar configuration set it to 0 (or comment out) and include a JSON configuration such as

        # emon/emontx/power1 format - use with Emoncms MQTT input
        # http://github.com/emoncms/emoncms/blob/master/docs/RaspberryPi/MQTT.md
        # nodevar_format_enable = 0
        # nodevar_format_basetopic = emon/

        # Single JSON payload published  - use with Emoncms MQTT
        node_JSON_enable = 1
        node_JSON_basetopic = emon/

There is no need to restart emonhub.

Other users of emonhub might need to make other adjustments but it should just work.

Any issues, please let me know. It is in the master branch only, for testing right now.

2 Likes

Thanks for your work on this @borpin

1 Like