Trigger Off Template?

New to Node-RED. Got a lot working already, but not this! Here’s how the template appears in HA, which works:

{{now().strftime("%a %h %d %H:%M %Z %Y") == (((state_attr('sensor.pixel_5_next_alarm', 'Time in Milliseconds') | int / 1000) + 0*60 ) | timestamp_custom('%a %h %d %H:%M %Z %Y'))}}

This returns true when the current time equals the time when I set my alarm.

How would you set this up in Node-RED? I’ve tried the template node but it doesn’t seem to output “true.” I also tried connecting the template node to a switch, but that didn’t work either.

Any help is appreciated!

Have a look at this:
https://zachowj.github.io/node-red-contrib-home-assistant-websocket/cookbook/using-date-and-time-entities-to-trigger-flows.html#home-assistant-companion-app-next-alarm-sensor

The template node returns “True” as a string, not as a boolean. The T capital.

Do you want to start a flow at the given time?
If that is the case, then the time node from the Homa Assistant palette just does that…

1 Like

Well! Apparently I was overcomplicating things! Turned out to be that easy, @greengolfer. Thank you!

1 Like