Use slider/input_number HA entity as Node-red if state value

Have a slider in my HA dashboard. When I change the slider the value appears in Node-Red as output of a events node state:

I’d like to use this value (payload) in a current state node.
Here 55 is used as a fixe value but I’d like to use the sliders value

Thanks for your help!

You can use jsonata to return the value.

$number($entities('input_number.my_number').state)

$number() casts the value to a number. $entities() brings the value of the entity.

image

Thanks!

Have entered the json data.
I suspect it will work but will let you know after a test.

Many thanks!

JSON is not the same as jsonata/J expression. JSON is not an option for that particular field. It is an option in the data section where jsonata can also be used.

https://zachowj.github.io/node-red-contrib-home-assistant-websocket/guide/jsonata/#examples-of-using-jsonata-in-the-home-assistant-nodes