I am using a countdown timer to control the time for a light to turn off in node red. I have a slider Entity value from home assistant already set up. I need to figure out how to send that data into the count down timer set time. I read the documentation but its a bit over my head. Any ideas?
The countdown node you refer to has the following in the documentation
Input
The node evaluates the following input msg types:
Input msg with a msg.payload contents of false (boolean) or 0 (number).
This msg type stops resp. finishes the timer. The Timer Off payload is emitted also in this case.
Input msg with a msg.topic set to “control” and a msg.payload set to an arbitrary number value. This reloads the timer with the desired msg.payload value immediately and works at a running countdown as well as a non started or elapsed countdown timer.
All other input msg do start/restart the timer if it is stopped.
You therefore require:
msg.payload = (state value from input_number entity, as a number)
msg.topic = “control”
in the same messge
Using an ‘Events: state’ node for the input_number you are probably using will start a flow every time the input_number value is changed in Home Assistant.
Setting the state type to a number (not a string) will send the new value out on msg.payload
Setting msg.topic to ‘control’ is all that is required to set the new input-number value as the countdown timer value
Note that the settings in the countdown node are important here, and you will need to decide if you want a ‘control’ change message to update an already-running counter and/or start a new countdown.
Set time to new duration if control message is received while running
Start countdown if control message is received while not running
The other settings in the Events: state node can be useful too, since you may wish to Output on connect (update the setting value when Node-RED restarts) and ignore certain state change events, such as any previous state or current state being unknown/unavailable.