Current state compare value against a sensor + 10?

I couldent think of a good title.

Pretty much What I have works, just wondering if it can be simiplied even more.

[{"id":"b03660f50a2f506c","type":"tab","label":"Flow 2","disabled":false,"info":"","env":[]},{"id":"7369c50d5b1bee3b","type":"inject","z":"b03660f50a2f506c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"60","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":280,"y":510,"wires":[["240520d25b44e3c6"]]},{"id":"240520d25b44e3c6","type":"api-current-state","z":"b03660f50a2f506c","name":"Humidity too high?","server":"ab3e2c53.e3491","version":3,"outputs":2,"halt_if":"master_bathroom_humidity_value","halt_if_type":"global","halt_if_compare":"gt","entity_id":"sensor.master_bathroom_shower_humidity","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":490,"y":510,"wires":[[],[]]},{"id":"8df848497c692ba7","type":"inject","z":"b03660f50a2f506c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":270,"y":360,"wires":[["553fba65d5c9ac3d"]]},{"id":"553fba65d5c9ac3d","type":"api-current-state","z":"b03660f50a2f506c","name":"","server":"ab3e2c53.e3491","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.thermostat_t6_humidity","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":520,"y":360,"wires":[["ca0eacbdcbb3ab06"]]},{"id":"ca0eacbdcbb3ab06","type":"change","z":"b03660f50a2f506c","name":"Set master_bathroom_humidity_value to home humidity + 10","rules":[{"t":"set","p":"master_bathroom_humidity_value","pt":"global","to":"msg.payload+10","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":940,"y":360,"wires":[[]]},{"id":"47dc928af0187982","type":"comment","z":"b03660f50a2f506c","name":"Sets global value to home thermostat humidity + 10","info":"","x":400,"y":315,"wires":[]},{"id":"63238b2a4df6740a","type":"comment","z":"b03660f50a2f506c","name":"Bathroom humidity checked against global value","info":"","x":390,"y":465,"wires":[]},{"id":"ab3e2c53.e3491","type":"server","name":"AvilaSmartHome","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]
  1. I take the humidity from the T6 controller, add 10 to it, and write that value to a global variable.
  2. I then compare the bathroom humidity to that global variable, and do stuff based on the result.

So my question is, can I just use the current state node to check this and delete the global variable logic? I tried this, but it didnt work.

https://zachowj.github.io/node-red-contrib-home-assistant-websocket/guide/jsonata.html#examples

$number($entities("sensor.thermostat_t6_humidity").state) + 10

1 Like

thank you again Kermit; you’re a life saver like always. I know it may seem like I just ask questions but I really do try to find/figure the stuff out on my own first.