Currently all MQTT messages posted to emon/<node-name>/<key-name> MQTT topic in the emonPi appear as local Emoncms Inputs with the sub topic used as the Emoncms node name e.g.
Data coming in via emonhub can easily be posted to Emoncms.org or any other remote emoncms server.
However, if the MQTT messages are not coming via emonhub (i.e posted directly to emonPi MQTT server by another servie or device like the WiFi MQTT relay thermostat) there is currently no way to forward this data to emoncms.org. I’ve just written a simple nodeRED flow to do just this
I found a solution: (i was mistaken: the solution above will create multiple nodes in the target emoncms based on the nodenome from the mqtt and not group it under one node. I changed it to push multiple values and mqtt nodenames to one “node” in emoncms.
Create a “publish to MQTT” per output you want to share in your emoncms (base).
Change the “nodename from MQTT sub-topic” to:
var topic = msg.topic
var arr = topic.split("/");
var length2 = arr.length;
node = arr[length2-1];
var waarde = msg.payload;
msg.payload = node + ":" + waarde;
return msg;
And fill in the Node name in “Emoncms” where you want it to show up in the other emoncms.
You should be able to use Valid JSON rather than Legacy Processing.
I am surprised this works as the JSON is not a ‘flat’ JSON (as per the info panel for the node).
You have the same error as your other thread in not just sending the payload.ENERGY portion of the original message.
You should be able to put the time element into a msg.time part of the msg (again as per the info panel on the node).
IIRC, the time format sonoff uses is not parsed correctly by javascript as it is not a valid time format (or I might be remembering that incorrectly). If you check your logs you may see a message about whether a valid time has been used or not (Set log to INFO level).
So as in the post 2 above, write a flow to subscribe to the topic, and use a debug node so you can see how the data appears.
I suspect you can simply subscribe to the individual topics such as emon/heatpumptemps/T3 and send that to emoncms.org using the emoncms flow. This is the simplest route.
5 MQTT subscribe nodes, not pretty, but it should work.
Specific Node-RED questions should go onto the NR Forum as it isn’t specific to emoncms.