zachowj / node-red-contrib-home-assistant-websocket

Node-RED integration with Home Assistant
https://zachowj.github.io/node-red-contrib-home-assistant-websocket/
MIT License
490 stars 89 forks source link

Wait until node don't work with list #585

Closed landaisbenj closed 2 years ago

landaisbenj commented 2 years ago

Describe the bug

"Wait until" node work with exact entity, but don't work with list of entites. I try to make a flow, who wait my couple of windows was closed (if they was open). So "until my windows was off, wait...", with check against current state.

Flow never pass the node if it was in list, even one or more entities was listed. But, work fine with just 1 of this binary_sensor in one exact entity... And by the way, « check against current state » box disappear only in list mode.

To Reproduce

Try with this node with 1 exact sensor, and try with 1 sensor or more but in list. Like this: image

Expected behavior

I have 2 windows. So i try "wait until" node with list of 2 binary_sensor. I would like the flow pass the node if that 2 binary_sensor was off, or wait until all them was off.

Screenshots

This work :

image

This don’t :

image

And so this don’t too :

image

Note "check against current box" disappear in the 2 last pict.

Example Flow

[{"id":"729015cc64df886d","type":"inject","z":"2b156957.368d96","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":300,"y":1650,"wires":[["0f90ac620793800b"]]},{"id":"a38fe30d82567cb5","type":"debug","z":"2b156957.368d96","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":720,"y":1650,"wires":[]},{"id":"0f90ac620793800b","type":"ha-wait-until","z":"2b156957.368d96","name":"","server":"9641f53.6d3d808","version":1,"outputs":1,"entityId":["binary_sensor.door_window_sensor_158d00051e24d3","binary_sensor.door_window_sensor_158d0001dbccf9"],"entityIdFilterType":"list","property":"state","comparator":"is","value":"off","valueType":"str","timeout":"0","timeoutType":"num","timeoutUnits":"seconds","entityLocation":"data","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":510,"y":1650,"wires":[["a38fe30d82567cb5"]]},{"id":"9641f53.6d3d808","type":"server","name":"Home Assistant Freebox","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]

This package's version (not the Home Assistant add-on verison)

0.42.4

Is Node-RED running in Docker?

Home Assistant add-on

Node-RED version

2.2.0

Node.js version

11.0.2

Additional context

Open issue after this https://github.com/hassio-addons/addon-node-red/issues/1292#issuecomment-1040993961

It was hard to get all version because i don't know where to find them in home assistant... So maybe "Node.js version" is not the right.

And there was a mistake here :)

This package's version (not the Home Assistant add-on verison)

zachowj commented 2 years ago

I can't reproduce this. chrome_LGUDPxsN22

[{"id":"06c74fec4292287c","type":"inject","z":"a38123c1.2fd3f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":276,"y":928,"wires":[["a857a32b2a13ee0e","a857a32b2a13ee0e"]]},{"id":"a857a32b2a13ee0e","type":"ha-wait-until","z":"a38123c1.2fd3f","name":"","server":"","version":1,"outputs":1,"entityId":["input_boolean.test"],"entityIdFilterType":"list","property":"state","comparator":"is","value":"on","valueType":"str","timeout":"0","timeoutType":"num","timeoutUnits":"seconds","entityLocation":"data","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":444,"y":928,"wires":[[]]},{"id":"bb21eac84fa14c3a","type":"api-call-service","z":"a38123c1.2fd3f","name":"","server":"","version":5,"debugenabled":true,"domain":"input_boolean","service":"toggle","areaId":[],"deviceId":[],"entityId":["input_boolean.test"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":484,"y":880,"wires":[[]]},{"id":"dbe4e945e0f26410","type":"inject","z":"a38123c1.2fd3f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":276,"y":880,"wires":[["bb21eac84fa14c3a","bb21eac84fa14c3a"]]},{"id":"62957779e02182c4","type":"server-state-changed","z":"a38123c1.2fd3f","name":"","server":"","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_boolean.test","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","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":340,"y":832,"wires":[[]]}]
landaisbenj commented 2 years ago

Oh ok thanks for the try. You confirmed the issue. You click twice on input_boolean.test… I want the same, but with « check against current state » selected. Did you understand what that mean ? With this box selected, « wait until » wouldn’t have waited when you click in the first input time stamp.

To wait, input_boolean.test must be on « off » before you click on input timestamp of wait until.

I ca try to make a gif to show you.

zachowj commented 2 years ago

Do you want to be able to "Check against current state" when it's set to list? If that is the case it's currently not a feature of the wait-until node. That's why the checkbox disappears when it is not set to exact.

landaisbenj commented 2 years ago

Yes it’s all I want 😊 ok, thanks for info 😕

zachowj commented 2 years ago

You can currently do this with a get-entities node, set it to return count, and then a switch node to check if the count is greater than zero. If it is then one of the entities is already active and then do stuff. If the count is zero then send it to the wait-until node.