Wondering if someone could point me in the right direction. I would like to set up the heatpump app on emoncms. I have a emon tx with a current clamp measuring the power input.
Today I flashed a ESP8266 node mcu and connected 3 of the DS18b20 temp sensors to the flow in and out and one underneathe the unit for ambient.
Ive knocked up this simple flow for now. Im trying to set the message payload to temperature for the DS18B20-1 and its just return the whole message payload.
I think you should specifiy the temperature MQTT topics and simply publish them again.
You topic on the left side would probably be:
tele/heatpump/SENSOR/DS18B20-1/Temperature
Easiest way to get this topic would be to copy the path from the nodered debug panel.
An example topic for the emoncms would be:
emon/heatpump/flow_temperature
You also have to make sure, that the MQTT output topic for emoncms is published on the MQTT broker of the emonpi or on the broker configured on the emonpi.
Following is an example of mine from a Shelly device:
It does depend how you have setup the Tasmota messages (if starting out, set them up for HomeAssistant as you will likely use it eventually and changing it over is a PITA). You just need to adjust the incoming payload part of the function below.
Assuming you are going to send these to the MQTT Broker your Emoncms instance talks to, to get as an input you just need to use the base topic emon/ and it will pull them in. In this case I use the topic emon/Tank.
If you have correctly setup the Tasmota for time (I suggest using an Epoch integer), you can use that time rather than the Emoncms received time.
I use a function which gets data from 2 Tasmota devices (you can only have 8 temp sensors on one ESP8266/Tasmota). The advantage is I can add sensors and they get automatically decoded.
You can also set up Tasmota to send the temperature at a specified frequency (I use 10s).
So put this in a NR Function;
var newmsg ={};
var data = msg.payload;
var dataout = {};
newmsg.time = msg.payload.Time;
for (var key in data){
if (key.search("DS18B20") === 0) {
dataout[data[key]['Id']] = data[key]['Temperature'];
}
}
dataout['time'] = msg.payload.Time;
newmsg.payload = dataout;
return newmsg;
I rate limit the messages to Emoncms, although I’m not sure this is still needed and is just a hang over from when I sent each message individually (and emoncms could not keep up).
NR object (you could set the message topic in the function - I set it in the MQTT node).
It is far more efficient to read and send the values in one go (so read shellies/balh/blah/emeter/#) then pull out the bits you need, then send to emoncms as a single JSON object. If you send messages too quickly to emoncms via MQTT, it can miss them.
I did try copying the link for one temp sensor but it kept outputting the whole message for some reason? @bekesizl thats exactly what I wanted to do. For some reason I could not extract just the temperature readings from the json string.
So @borbin gave me an idea. Because I use HA and have alot of data inputting to HA and running automations, I have the node red plug in running. I decided add the sensors to the HA sensor yaml file. Then using node red plug in, I ping the current state of the sensors then output the message payload to my emonpi broker.
Try this one with an MQTT publish node with the topic “emon/heatpumptemps”
var temp1 = msg.payload.SENSOR.DS18B20-1.Temperature; //try copy path for this part
var temp2 = msg.payload.SENSOR.DS18B20-2.Temperature;
var temp3 = msg.payload.SENSOR.DS18B20-3.Temperature;
var temps= {"T1": temp1,
"T2": temp2,
"T3": temp3,
};
var msgout = { payload : temps};
msgout.topic='Temperatures';
return msgout;