Comparison of entity readings

I have the following data:

  • input_number.humidity_max (manually entered maximum humidity)
  • sensor.0x00158d0004657cc6_humidity (humidity sensor readings)
  • switch.sonoff_10008c77a0_2 (exhaust switch)
    How to implement in NODE-RED so that when the humidity sensor crosses the threshold specified in input_number.humidity_max, the hood turns on.
    I would be grateful for your help

image

[{"id":"216030a1480de42d","type":"server-state-changed","z":"ffbd7f06.4a014","name":"","server":"","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.0x00158d0004657cc6_humidity","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"$entities(\"input_number.humidity_max\").state","halt_if_type":"jsonata","halt_if_compare":"gt","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[],"x":294,"y":1088,"wires":[["421dd84c90969637"],[]]},{"id":"421dd84c90969637","type":"api-call-service","z":"ffbd7f06.4a014","name":"","server":"","version":3,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.sonoff_10008c77a0_2","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":618,"y":1088,"wires":[[]]}]
1 Like

Thanks, I guessed about JSONata, but did not know how it works. It’s simple if kind people suggest)

Unfortunately, this circuit is triggered by any change in the temperature sensor, regardless of the temperature threshold (higher or lower)

Sorry, everything works, I made a mistake, thanks again for the help

Help with JSONata, can’t find exact documentation anywhere.
I need to compare the expression with another sensor, but I think this expression is wrong, the temperature should be +2.
$ entity ("sensor.temperature_158d00045c2ea8"). condition + 2
Thanks in advance