I have set a Sonoff TH10 with the AM2301 temperature sensor. The flow I have is working well, with one exception. I can not figure out how to convert the celcius that the AM2301 outputs to Fahrenheit. I have a switch node parsing out the temp and humidity. I have the Humidity displaying on a chart and a Gauge.I have the temp also displaying on a chart and a gauge.I have tried a function node with this : var temp=msg.payload. AM2301 .Temperature;
msg.payload = (temp * 9/5 + 32).toFixed(2);
return msg;
I know the formula is correct because it is working in another flow.
Can someone help this newbee?
Have you tried using https://flows.nodered.org/node/node-red-contrib-unit-converter.
It is written by a well known gent who hangs out here (and does some great work as well).
Thanks @BartButenaers
Can we see a debug of the msg before the function node?
If you are using Tasmotta, you can get this directly, you don't need to convert unless you want both measures.
It can also be done using jsonata in a change node.
See example at the end of Working with messages : Node-RED
Thanks Bobo. I installed the convert units node,using the node manager in Node Red.
Took me about two minutes to look it over and set it up. Working just great,
Thanks again.Tom, AD2TM
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.