Convert Template to Node in Node Red

I’d like to convert an HA template into a Node Red Node (or Nodes). I’m unsure where to begin and could use a little help. The template compares the current temperature (‘sensor.stratford_temperature’) with a set temperature (‘input_number.roof_heat_cable_temp_set_point’) then, if the ‘input_boolean.enable_roof_heating’ is set to ‘on’, outputs a ‘true’ state. Otherwise it output’s ‘false’. The template code is;

platform: template
value_template: >
  {% set max_temp = states('input_number.roof_heat_cable_temp_set_point')|float
  %} {% set temp = states('sensor.stratford_temperature')|float %} {{ temp <=
  max_temp and is_state('input_boolean.enable_roof_heating', 'on') }}

Is this even possible? If so, how would I start?

one way

[{"id":"1fe782c63331b065","type":"api-current-state","z":"7bfa7ff525ace8b1","name":"roof_heat_cable_temp_set_point","server":"","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_number.roof_heat_cable_temp_set_point","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"max_temp","propertyType":"msg","value":"","valueType":"entityState"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":332,"y":256,"wires":[["fadc38404acaf3fd"]]},{"id":"e37ff9189d495d4b","type":"inject","z":"7bfa7ff525ace8b1","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":106,"y":256,"wires":[["1fe782c63331b065"]]},{"id":"fadc38404acaf3fd","type":"api-current-state","z":"7bfa7ff525ace8b1","name":"stratford_temperature","server":"","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.stratford_temperature","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"temp","propertyType":"msg","value":"","valueType":"entityState"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":596,"y":256,"wires":[["30252d2c67bee55f"]]},{"id":"30252d2c67bee55f","type":"api-current-state","z":"7bfa7ff525ace8b1","name":"enable_roof_heating","server":"","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.enable_roof_heating","state_type":"str","blockInputOverrides":false,"outputProperties":[],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":820,"y":256,"wires":[["de7350e27869509f"],["8434fbf69d954a5a"]]},{"id":"8434fbf69d954a5a","type":"debug","z":"7bfa7ff525ace8b1","name":"false","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1138,"y":304,"wires":[]},{"id":"de7350e27869509f","type":"switch","z":"7bfa7ff525ace8b1","name":"","property":"temp","propertyType":"msg","rules":[{"t":"lte","v":"max_temp","vt":"msg"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1010,"y":256,"wires":[["36656b7c88541b10"],["8434fbf69d954a5a"]]},{"id":"36656b7c88541b10","type":"debug","z":"7bfa7ff525ace8b1","name":"true","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1138,"y":256,"wires":[]}]

second way

image

[{"id":"a06ab39bae300f05","type":"inject","z":"7bfa7ff525ace8b1","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":108,"y":384,"wires":[["9e299a3fab7c3090"]]},{"id":"9e299a3fab7c3090","type":"api-current-state","z":"7bfa7ff525ace8b1","name":"roof_heat_cable_temp_set_point","server":"","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_number.roof_heat_cable_temp_set_point","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"(\t    $max_temp := $number($entity().state);\t    $temp := $number($entities(\"sensor.stratford_temperature\").state);\t    $enabled := $entities(\"input_boolean.enable_roof_heating\").state;\t\t    temp <= max_temp and $enabled = \"on\"\t)","valueType":"jsonata"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":332,"y":384,"wires":[["7de3b7886530a1bd"]]},{"id":"7de3b7886530a1bd","type":"debug","z":"7bfa7ff525ace8b1","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":566,"y":384,"wires":[]}]

https://zachowj.github.io/node-red-contrib-home-assistant-websocket/guide/jsonata.html

Thanks @Kermit, These are very helpful examples. The link to jsonata will be very helpful.

With this informaiton, I should be able to automate activation of the roof heating cable based on the weather forecast. With snow in the forecast, turn on the cable. No snow, turn it off.

Regards