Hello, I have created some template sensors to re-format the date/time of the sun.sun attribute to only hh:mmAM/PM as below.
The next step I want to do is to use node-red to compare the current time with the above sensors. If both time matches then change the time of day helper. The inject node below trigger every 5 seconds (For now it is just in dev so i use pushover instead of changing helper state)
Time Convert node does it job. The time format matches the template sensors mentioned above.
The problem is the Switch node, I want to compare the msg.payload parsed from previous “Time Convert” node with sensor.nextdawn for example. If matched then go out from output1 etc.
The JSONata expression is as follow:
payload=$number($globalContext(‘homeassistant’).HomeAssistant).state.“sensor.nextdawn”.state
When both msg.payload (current time) and sensor.nextdawn.state matches, eg: 6:11AM for dawn, I do not receive any pushover notification.
The function nodes are just format the pushover message , no issue there.
Does the above JSONata expression i create correct? The name of HA in my node-red setup is called HomeAssistant, and I have checked “Enable Global Context Store”.
Really appreciate if anyone can shed some lights on this. Thanks!!!