Conversion Fahrenheit to Celsius - Radio thermostat set temperature


I have a radio thermostat CT80. Its curl commands work in Fahrenheit but I want to input Celsius via a chat bot to set the temp.
Anyone know the process for doing this?

I think the input will need a template node to convert C to F....
Then the converted F result will be sent to the curl command.

Hi, have you actually tried it yet? Conversions from c to f, and f to c for that matter, follow simple formulas. You can use just about any node you like for that, from a function node to a change node (payload.temp_celsius * 1.8 + 32 as JSONata expression for example). You said you use curl for communication, so that means you can use the exec node with a curl command, or the http request node if you use an http protocol within curl.

1 Like

I've used a node flow from someone else for the ct80.
All I need to do is inject the F in numerical value into a node.
So whatever does the conversion needs to output a number ie: 72
Will have a play later!
Thank you :ok_hand:

Or use the range mode to rescale the numbers appropriately


Ooh, one I wouldn’t have thought of. Thanks Dave for reminding that it exists :slight_smile:

1 Like

You can also try to use my node-red-contrib-unit-converter, which supports a.o. following temperature conversions:


Good luck!


Worked a treat! Thank you

Now all i need to do is work out how to trigger the temperature till a certain time via chat bot..

Loving node red :grinning:

1 Like

I'm looking at implementing your method too. I've injected a number (19) in via a payload string.
Have used a function node with:

payload.temp_celsius * 1.8 + 32;
return msg;

Getting error:

"ReferenceError: payload is not defined (line 1, col 1)"

On the debug node....

I'm really green with this atm. Any tips would be useful!

Try adding ‘msg.’ before payload

1 Like

Close, but that won't fix it yet:

msg.payload = msg.payload.temp_celsius * 1.8 + 32;
return msg;

Or if you want to keep the original:

msg.payload.temp_fahrenheit = msg.payload.temp_celcius * 1.8 + 32;
return msg;
1 Like

Test flow:

Have tried the first one:

msg.payload = msg.payload.temp_celsius * 1.8 + 32;
return msg;

Got this in debug:
Screenshot 2020-01-04 at 23.25.39

I may have (wrongly) assumed Working with Messages was known information. What you are inserting as payload appears to be a numeric 19 value. In that case the contents of msg.payload in the function node becomes simply 19 and the description changes to msg.payload = msg.payload * 1.8 + 32;

1 Like

That worked!

Will look at Working With Messages

Thanks Afelix :ok_hand:

The modern way to convert C to F or F to C is to use a range node.

C to F

-40 100
-40 212

F to C

-40 212
-40 100

[{"id":"b39e3a0a.9b8048","type":"range","z":"205d0e6a.aaefc2","minin":"-40","maxin":"100","minout":"-40","maxout":"212","action":"scale","round":false,"property":"payload","name":"C to F","x":730,"y":1100,"wires":[["6ea851ef.91e08"]]}]