I like to set the offset time inside a time node via a global variabel.
The goal is to be able to set a global variable via a actionable notification that pops up in the evening with the question how far (-10, -15 or -20 min) the time offset needs to be from the morning alarm. The time node is then used to start a wake up light routine with a negative offset from the wake up alarm.
I’m able to set the global variable from the notification via a function node with : global.set (“WakeupLightTime”,“1”);
But i can not figure out the right expression in the offset field of a time node. I have now: global.get (“WakeupLightTime”)
If you change the global context variable after deploying the time flow. It won’t use the updated offset. You’re better off using a number entity and setting that from the actionable notification.
You can access the number entity with
$entities("number.offset").state
The context variable doesn’t work after deployment because Node-RED doesn’t fire an event when context variables are changed. This leaves the time node not knowing if/when the variable was ever changed. It is then unable to update its timer to account for the new offset.