Help with a Poll state node

!'m trying to do a test from a temperature sensor, comparing it to a slider number input from the Home assistant UI.

The UI sets the max temperature desired in a slider, entity: input_number.office_max_temperature
The room temperature is gathered from a Sonoff sensor as sensor.office_temperature

Is it possible to do what I want, it doesnt seem to work for now.
Thanks

I’m assuming it gets the state of the input number as a string. You could split it up into two nodes.

  1. poll your sensor and push it out as payload
  2. get current state of input_number and push it out if input_number <= msg.payload

I don’t know, would it be a string? Its coming from a slider, and I had thought that as it was called an input_number type, it would be numeric.

But am happy to give your suggestion a try.

If you look into the context data of NR (top right database symbol) you can see that everything is a string there:

image

Edit: I guess the value comes from there, as you also don’t get entity suggestions while typing into the “compare” field

That’s awesome, many thanks, its working nicely now.

For some reason most of the values are reported as strings in nodered. You can also use JSONata to call an entity inside a node and it will return a number. Rather than entity you would choose J: expression.

$number($entities("input_number.office_max_temperature").state)

1 Like