Using Home assistant's input_number in a "change node" to send data to "hourglass node"

I have a question about the "change node" module fron node red in Home Assistant.

Is it possible to call an input_number?

I use "change node" to send data to the "hourglass node."
I have an input_number where I enter the number of seconds it takes for the "hourglass node" to trigger an alarm.
I would like to use the input_number and send it to the "hourglass node" via "change node" as:
SET msg payload to the value PT5S.

Where the 5 is stored in the input_number.

Thanks in advance, Hansje

First check if home assistant's globals are enabled. Open any ha node at the top where it shows the server, click the pencil to the right to go to the server settings. Select config settings to expand the panel. If globals are not checked, check it, update, deploy and restart the addon.

then in the change node choose global

image

and use

homeassistant.homeAssistant.states["input_number.number"].state

Now that is going to get you the state but with home assistant all numbers are stored as strings. It will likely need to be cast to a number. In that case J expression can be used.

$globalContext("homeassistant").homeAssistant.states.`input_number.number`.state  ~> $number()

Edit changed the formatting to show backticks in the global context example.

Hello mikefila

Thank you. This solved my problem.

Greetings Hansjeu