Problem with "wait until" checking value "less than"

Hi,
i have just started exploring possibilites of node red.

I’m using node red addon version 3.1.1 in hassio 0.92

I would like to turn my water heater off in the evening, but only if it’s not heating water, then wait for some time and finally shut down the power socket. Turn it on again in the morning.

I have this flow

[{"id":"741b909d.b6c8d","type":"tab","label":"TUV test","disabled":true,"info":""},{"id":"cb248321.02fa2","type":"timeswitch","z":"741b909d.b6c8d","name":"","mytopic":"","lat":"","lon":"","starttime":"480","endtime":"1140","duskoff":"0","dawnoff":"0","sun":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"jan":true,"feb":true,"mar":true,"apr":true,"may":true,"jun":true,"jul":true,"aug":true,"sep":true,"oct":true,"nov":true,"dec":true,"x":120,"y":200,"wires":[["2774a6c2.8a26ba"]]},{"id":"2774a6c2.8a26ba","type":"switch","z":"741b909d.b6c8d","name":"check on/off","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":290,"y":200,"wires":[["fcec32cc.e11ab"],["2b64cb4a.a6dd64"]]},{"id":"cbb5da.37007a28","type":"api-call-service","z":"741b909d.b6c8d","name":"","server":"dcf02f05.b9371","service_domain":"switch","service":"turn_on","data":"{\"entity_id\":\"switch.neo_coolcam_unknown_type_0200_id_1027_switch\"}","mergecontext":"","output_location":"","output_location_type":"none","x":770,"y":100,"wires":[[]]},{"id":"2bd9ac19.a18004","type":"api-call-service","z":"741b909d.b6c8d","name":"","server":"dcf02f05.b9371","service_domain":"notify","service":"jabber_libor","data":"{\"message\":\"zapnuto TUV\"}","mergecontext":"","output_location":"","output_location_type":"none","x":780,"y":160,"wires":[[]]},{"id":"e9e2e385.f7fca","type":"api-call-service","z":"741b909d.b6c8d","name":"","server":"dcf02f05.b9371","service_domain":"switch","service":"turn_off","data":"{\"entity_id\":\"switch.neo_coolcam_unknown_type_0200_id_1027_switch\"}","mergecontext":"","output_location":"","output_location_type":"none","x":1110,"y":220,"wires":[[]]},{"id":"73619f63.42021","type":"api-call-service","z":"741b909d.b6c8d","name":"","server":"dcf02f05.b9371","service_domain":"notify","service":"jabber_libor","data":"{\"message\":\"vypnuto TUV\"}","mergecontext":"","output_location":"","output_location_type":"none","x":1120,"y":280,"wires":[[]]},{"id":"fcec32cc.e11ab","type":"api-current-state","z":"741b909d.b6c8d","name":"is on?","server":"dcf02f05.b9371","outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"switch.neo_coolcam_unknown_type_0200_id_1027_switch","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":450,"y":160,"wires":[["cbb5da.37007a28","2bd9ac19.a18004"],[]]},{"id":"2b64cb4a.a6dd64","type":"api-current-state","z":"741b909d.b6c8d","name":"is off?","server":"dcf02f05.b9371","outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"switch.neo_coolcam_unknown_type_0200_id_1027_switch","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":450,"y":280,"wires":[["10f7bae.0ec4445","3f108c99.cad3b4"],[]]},{"id":"10f7bae.0ec4445","type":"api-call-service","z":"741b909d.b6c8d","name":"","server":"dcf02f05.b9371","service_domain":"notify","service":"jabber_libor","data":"{\"message\":\"waiting TUV\"}","mergecontext":"","output_location":"","output_location_type":"none","x":780,"y":340,"wires":[[]]},{"id":"2dfbb60f.f22bfa","type":"stoptimer","z":"741b909d.b6c8d","duration":"10","units":"Second","payloadtype":"num","payloadval":"0","name":"","x":870,"y":240,"wires":[["e9e2e385.f7fca","73619f63.42021"],[]]},{"id":"3f108c99.cad3b4","type":"ha-wait-until","z":"741b909d.b6c8d","name":"","server":"dcf02f05.b9371","outputs":2,"entityId":"sensor.neo_coolcam_unknown_type_0200_id_1027_power","property":"","comparator":"lt","value":"200","valueType":"num","timeout":"3600","timeoutUnits":"seconds","entityLocation":"","entityLocationType":"none","checkCurrentState":true,"x":640,"y":240,"wires":[["2dfbb60f.f22bfa"],[]]},{"id":"dcf02f05.b9371","type":"server","z":"","name":"Home Assistant"}]

But it was sitting there for an hour, waiting for timeout.
I guess, problem is, that value from sensor is of type text, not number?

I changed my flow, so it’s converted to number and stored to flow variable.

[{"id":"ba0a532c.12806","type":"tab","label":"TUV","disabled":false,"info":""},{"id":"f219a95.54c6d58","type":"timeswitch","z":"ba0a532c.12806","name":"","mytopic":"","lat":"","lon":"","starttime":"480","endtime":"1140","duskoff":"0","dawnoff":"0","sun":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"jan":true,"feb":true,"mar":true,"apr":true,"may":true,"jun":true,"jul":true,"aug":true,"sep":true,"oct":true,"nov":true,"dec":true,"x":180,"y":240,"wires":[["62b6662f.da9358"]]},{"id":"62b6662f.da9358","type":"switch","z":"ba0a532c.12806","name":"check on/off","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":350,"y":240,"wires":[["4b57b258.f95f6c"],["1cb97de6.7a4882"]]},{"id":"bd66f33.4f4951","type":"api-call-service","z":"ba0a532c.12806","name":"","server":"dcf02f05.b9371","service_domain":"switch","service":"turn_on","data":"{\"entity_id\":\"switch.neo_coolcam_unknown_type_0200_id_1027_switch\"}","mergecontext":"","output_location":"","output_location_type":"none","x":830,"y":140,"wires":[[]]},{"id":"65c17f6b.01627","type":"api-call-service","z":"ba0a532c.12806","name":"","server":"dcf02f05.b9371","service_domain":"notify","service":"jabber_libor","data":"{\"message\":\"zapnuto TUV\"}","mergecontext":"","output_location":"","output_location_type":"none","x":840,"y":200,"wires":[[]]},{"id":"54c05678.607df8","type":"api-call-service","z":"ba0a532c.12806","name":"","server":"dcf02f05.b9371","service_domain":"switch","service":"turn_off","data":"{\"entity_id\":\"switch.neo_coolcam_unknown_type_0200_id_1027_switch\"}","mergecontext":"","output_location":"","output_location_type":"none","x":1170,"y":260,"wires":[[]]},{"id":"4aeb328b.37eadc","type":"api-call-service","z":"ba0a532c.12806","name":"","server":"dcf02f05.b9371","service_domain":"notify","service":"jabber_libor","data":"{\"message\":\"vypnuto TUV\"}","mergecontext":"","output_location":"","output_location_type":"none","x":1180,"y":320,"wires":[[]]},{"id":"4b57b258.f95f6c","type":"api-current-state","z":"ba0a532c.12806","name":"is on?","server":"dcf02f05.b9371","outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"switch.neo_coolcam_unknown_type_0200_id_1027_switch","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":510,"y":200,"wires":[["bd66f33.4f4951","65c17f6b.01627"],[]]},{"id":"1cb97de6.7a4882","type":"api-current-state","z":"ba0a532c.12806","name":"is off?","server":"dcf02f05.b9371","outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"switch.neo_coolcam_unknown_type_0200_id_1027_switch","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":510,"y":320,"wires":[["eb3823d5.24865","3b40076.c9a49f8"],[]]},{"id":"eb3823d5.24865","type":"api-call-service","z":"ba0a532c.12806","name":"","server":"dcf02f05.b9371","service_domain":"notify","service":"jabber_libor","data":"{\"message\":\"waiting TUV\"}","mergecontext":"","output_location":"","output_location_type":"none","x":840,"y":380,"wires":[[]]},{"id":"aaa9dee8.6f991","type":"stoptimer","z":"ba0a532c.12806","duration":"10","units":"Second","payloadtype":"num","payloadval":"0","name":"","x":930,"y":280,"wires":[["54c05678.607df8","4aeb328b.37eadc"],[]]},{"id":"cc3b7f5a.2c55","type":"function","z":"ba0a532c.12806","name":"toNum","func":"msg.payload = Number(msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":740,"y":560,"wires":[["913d1598.77dbe8","5daa0ffe.1b2bd"]]},{"id":"913d1598.77dbe8","type":"change","z":"ba0a532c.12806","name":"","rules":[{"t":"set","p":"powerState","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":970,"y":560,"wires":[[]]},{"id":"3b40076.c9a49f8","type":"switch","z":"ba0a532c.12806","name":"check flow.powerState","property":"powerState","propertyType":"flow","rules":[{"t":"lt","v":"200","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":700,"y":280,"wires":[["aaa9dee8.6f991"]]},{"id":"5daa0ffe.1b2bd","type":"debug","z":"ba0a532c.12806","name":"","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"payload","targetType":"msg","x":960,"y":620,"wires":[]},{"id":"902766b9.c3b138","type":"server-state-changed","z":"ba0a532c.12806","name":"","server":"dcf02f05.b9371","entityidfilter":"sensor.neo_coolcam_unknown_type_0200_id_1027_power","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":340,"y":560,"wires":[["cc3b7f5a.2c55","5daa0ffe.1b2bd"]]},{"id":"dcf02f05.b9371","type":"server","z":"","name":"Home Assistant"}]

This works ok, but i would like to use first version, if possible.
Is the first flow correct and problem is only in text versus number value?

Thanks,
Libor

You don’t have the property value of the wait-until node set. So it doesn’t know what to compare the 200 to.

Hi,
i did not notice that before, it works now, thank you very much

I don’t get what you would set the property to for wait until on a binary sensor. I just want to wait until the state changes.

You said it right there, state.

Having same issues, unable to get the wait until node to hit. keeps sitting on waiting.

Hello,
Not sure you have the same problem as I have (Wait until strange behaviour).
My workaround is to put the “details” in a change node before calling the wait until. Not sure why this works and not the “normal” way.

1 Like

Any reason you wouldn’t use a current state node or trigger: state node instead of wait until? I typically end up using the wait until node when i have another node triggering some action first

Because I need to wait for the temperature to drop, which could take 30 seconds , could take ten minutes.

Exactly this case. I am using “wait until” for my Velux. I close the window and wait until it closed to close the blind. In this type of situation, the wait until is really useful.
GV

you could still use the trigger node with a previous state < 45 and current state >=45, depending on where in your flow you’re calling it.

This is to turn off a plug when the phone battery hits 100%

This look right ? It will wait till temp is below 45?

This should trigger it if it drops below 45

previous state >=45
current state < 45

It works thanks for all your help!