Input_number with node-red and condition

I have this card in Home Assistant and also have an automation in node-red to trigger the humidifier when the humidity is > 65 but I want to use the input_number slider in node-red but this doesn’t works.

I’m using the global variable to check the condition.
I’ve tried with:

homeAssistant.states.input_number.humidity.state
homeAssistant.states.input_number.humidity
homeassistant.homeAssistant.states.input_number.humidity.state
homeassistant.homeAssistant.states.input_number.humidity

but no success.

Any idea?

1 Like

trigger:state-node is more useful for these cases

1 Like

Thanks, It´s already solved. The problem was that the input_number was a string I just convert the string to number and problem solved

Hi jandrop
This is a really simple question, but I’ve wasted hours on it. How did you convert the string to a number? I’ve experimented and keep getting error messages whenever i try and use a pipe operator.

Post it as a new question and add some more details so that we can help you.

Integer.ParseInt(mystring)

You can multiply by 1.

[{"id":"9e22e122c4dd057b","type":"function","z":"3d343940.cf7566","name":"","func":"var number = msg.payload*1;\nmsg.payload = number;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":670,"y":440,"wires":[["43c9f22f.1bf1d4"]]}]

Or a change node

[{"id":"84fc0ce695db7d96","type":"change","z":"3d343940.cf7566","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$number(msg.payload)\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":535,"y":380,"wires":[["43c9f22f.1bf1d4"]],"l":false}]