MQTT to emonhub to (local) emoncms

Can someone share the magic config to republish incoming MQTT data (from nodered in this case) to emoncms via emonhub on an emonpi?

I have the data visible in the emonpi under a node called nodered (sub from emon/nodered/...) but I cannot figure out the config to push this out via HTTP?

I saw in the note about:


  nodename =

  A text string, for your benefit in identifying each node. This field is optional.

  MQTT: The nodename can be used with the MQTT interfacer to send topics of the form nodes/nodename/variablename.

I tried creating a new numbered node and setting nodename = nodered and an [[[rx]]] section with names = vars, but nothing.

But I can see no examples anywhere, here in the forum or on github or in the source.


Peter Galbavy's picture

Re: MQTT to emonhub to (local) emoncms

I've been looking at the code, realizing quite how much I hate python - php being perl-ish I can stomach - and I think I am not going to get anywhere.

From what I can see mqtt input happens in two places; phpmqtt_input.php and also (what appears to be a legacy) in - on_message() watches for stuff in "node_format_basetopic"/tx/NNN/values. Now I'm still not sure but the new mqtt input goes into the system but is not visible in the output path anywhere and so is never puiblished back out, while in the latter I don't see how the nodeid is created/selected and just seems to be hardwired.

The little playing I did got me logged input but it didn't go any further.

So, what I'm saying, is Help! :)

glyn.hudson's picture

Re: MQTT to emonhub to (local) emoncms

Hi Peter,

The nodes module has been deprecated in favor of using mqtt_input. Are you using a pre-built emonPi/emonBase image or are you running your own setup. 

mqtt_input has been adopted as default on the latest pre built emonSD image.

Once running mqtt_input will post all MQTT traffic on the base topics (default 'emon',  - set in settings.php) to Emoncms Inputs.  

See documentation here for how to setup:

Peter Galbavy's picture

Re: MQTT to emonhub to (local) emoncms

Yes,and that all works great. What I now want to do is forward my local emonpi collected MQTT data to my emoncms instanc on Linux where all my historical data is - or for others, to That bit I cannot work out. I have read every readme and file I can find.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.