Current State vs entity state of input number

I can’t seem to get the current state of temperature sensor to compare against an input number when placed in a “Current State” node.
My input number is negative but I have also tried positive numbers.

Longer version

[{"id":"7a5160c6.fb304","type":"inject","z":"6cd0b2f8.4bb6fc","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":330,"y":1620,"wires":[["8b8a812d.34cdf"]]},{"id":"8b8a812d.34cdf","type":"api-current-state","z":"6cd0b2f8.4bb6fc","name":"GET input state","server":"9405c3fe.d0a6c","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"input_number.fridge","state_type":"num","state_location":"inputState","override_payload":"msg","entity_location":"","override_data":"none","blockInputOverrides":true,"x":500,"y":1620,"wires":[["d790cc57.b1c0b"]]},{"id":"d790cc57.b1c0b","type":"api-current-state","z":"6cd0b2f8.4bb6fc","name":"Fridge temp <= input ?","server":"9405c3fe.d0a6c","version":1,"outputs":2,"halt_if":"inputState","halt_if_type":"msg","halt_if_compare":"lte","override_topic":false,"entity_id":"sensor.fridge_temperature","state_type":"num","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":700,"y":1620,"wires":[[],[]]},{"id":"9405c3fe.d0a6c","type":"server","name":"Home Assistant","addon":true}]

More compact version:

[{"id":"ac03d6d6.477ba8","type":"api-current-state","z":"6cd0b2f8.4bb6fc","name":"Fridge temp <= input ?","server":"9405c3fe.d0a6c","version":1,"outputs":2,"halt_if":"$round($number($globalContext(\"homeassistant.homeAssistant.states['input_number.fridge'].state\")))","halt_if_type":"jsonata","halt_if_compare":"lte","override_topic":false,"entity_id":"sensor.fridge_temperature","state_type":"num","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":560,"y":1800,"wires":[[],[]]},{"id":"d78f85f1.0b8268","type":"inject","z":"6cd0b2f8.4bb6fc","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":370,"y":1800,"wires":[["ac03d6d6.477ba8"]]},{"id":"9405c3fe.d0a6c","type":"server","name":"Home Assistant","addon":true}]

Thanks for the quick reply. I figured out that the state had to be a number.

This was my solution. I set the state to number in the State nodes.

Screen Shot 2021-06-06 at 9.57.12 AM

[{"id":"263d4af.7ba21b6","type":"server-state-changed","z":"dac01a89.2b1d98","name":"Fridge Temp","server":"486a9a08.4ce2d4","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.fridge_temperature","entityidfiltertype":"exact","outputinitially":true,"state_type":"num","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":190,"y":640,"wires":[["610d5d8b.704634"]]},{"id":"610d5d8b.704634","type":"api-current-state","z":"dac01a89.2b1d98","name":"Fridge Setpoint","server":"486a9a08.4ce2d4","version":2,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_number.fridge","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"setpoint","propertyType":"msg","value":"","valueType":"entityState"}],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":380,"y":640,"wires":[["eef003b9.739b8"]]},{"id":"eef003b9.739b8","type":"switch","z":"dac01a89.2b1d98","name":">=","property":"payload","propertyType":"msg","rules":[{"t":"gte","v":"setpoint","vt":"msg"}],"checkall":"true","repair":false,"outputs":1,"x":530,"y":640,"wires":[["228db40d.447d1c"]]},{"id":"486a9a08.4ce2d4","type":"server","name":"Home Assistant","version":1,"legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":true}]

1 Like