Help with converting this automation to Node Red? (variable in data template)

Hi all. I’m new to NR, so still learning.

How can I convert this automation to Node Red?

I can’t find a way to define sensor.wakeuptimer_house_sunrise_parents_duration, which is created in HassIO by {{ states('input_number.wakeuptimer_house_sunrise_minute')|int * 60 }}

Here’s two different ways you could do it.

Using the HA get template node to retrieve the wakeup timer

[{"id":"3ee68246.155b6e","type":"api-render-template","z":"75a5ba8.f1c5d44","name":"Get wakeup timer","server":"73b62ee3.62986","template":"{{ states('input_number.wakeuptimer_house_sunrise_minute')|int * 60 }}","x":465,"y":475,"wires":[["2cd67a16.379b56"]]},{"id":"27fab26d.3c167e","type":"switch","z":"75a5ba8.f1c5d44","name":"Click Left","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":285,"y":475,"wires":[["3ee68246.155b6e"]]},{"id":"2cd67a16.379b56","type":"template","z":"75a5ba8.f1c5d44","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\n    \"data\": {\n        \"entity_id\": \"light.hue_ambiance_candle_2\",\n        \"brightness_pct\": 30,\n        \"transitiion\": {{payload}}\n    }\n}","output":"str","x":635,"y":475,"wires":[[]]}]

or you could use a current state node to retrieve the value of sensor.wakeuptimer_…

[{"id":"2f2f77bb.dd7ff8","type":"switch","z":"75a5ba8.f1c5d44","name":"Click Left","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":185,"y":575,"wires":[["77fc7b88.116ca4"]]},{"id":"7051e4ee.a6d4ac","type":"template","z":"75a5ba8.f1c5d44","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\n    \"data\": {\n        \"entity_id\": \"light.hue_ambiance_candle_2\",\n        \"brightness_pct\": 30,\n        \"transitiion\": {{payload}}\n    }\n}","output":"str","x":535,"y":575,"wires":[[]]},{"id":"77fc7b88.116ca4","type":"api-current-state","z":"75a5ba8.f1c5d44","name":"Get wakeup timer","server":"73b62ee3.62986","halt_if":"","override_topic":true,"override_payload":true,"entity_id":"sensor.wakeuptimer_house_sunrise_parents_duration","x":365,"y":575,"wires":[["7051e4ee.a6d4ac"]]}]
1 Like

Yes, thanks for the time and the explanation!

If somebody needs this too, there is a spelling error (“transitiion”)