node-red-contrib-home-assistant-websocket icon indicating copy to clipboard operation
node-red-contrib-home-assistant-websocket copied to clipboard

wait until - random behaviour

Open elgatho opened this issue 1 year ago • 4 comments

Describe the bug

I have simple flow, find open cover, close cover, and wait until it will be closed, repeat until all covers will be closed. Seems that wait until sometimes doesn't wait for shutter to be closed but just skip to next step. behaviour is random, one shutter is closed, then next 3 (but this is tottally random, can be all closed at once, then last one later)

To Reproduce

N/A

Expected behavior

wait until - should wait for desired state, in this case closed

Screenshots

obraz obraz obraz

Example Flow

`[{"id":"a8cbc5efbc7785a8","type":"ha-get-entities","z":"a6872dce.94f5c","name":"Find closed covers","server":"82ddb5fe.332648","version":1,"rules":[{"condition":"state_object","property":"entity_id","logic":"in_group","value":"cover.rolety_pietro","valueType":"str"},{"condition":"state_object","property":"state","logic":"is","value":"closed","valueType":"str"}],"outputType":"random","outputEmptyResults":false,"outputLocationType":"msg","outputLocation":"payload","outputResultsCount":1,"x":390,"y":2740,"wires":[["14ee1fd7786be595"]]},{"id":"550c37680e580030","type":"ha-wait-until","z":"a6872dce.94f5c","name":"wait until state open","server":"82ddb5fe.332648","version":3,"outputs":2,"entities":{"entity":["{{ payload.entity_id }}"],"substring":[],"regex":[]},"property":"state","comparator":"is","value":"open","valueType":"str","timeout":"90","timeoutType":"num","timeoutUnits":"seconds","checkCurrentState":true,"blockInputOverrides":true,"outputProperties":[{"property":"roleta","propertyType":"msg","value":"","valueType":"entity"}],"x":980,"y":2740,"wires":[["a8cbc5efbc7785a8"],[]]},{"id":"14ee1fd7786be595","type":"api-call-service","z":"a6872dce.94f5c","name":"open cover","server":"82ddb5fe.332648","version":7,"debugenabled":true,"action":"cover.open_cover","floorId":[],"areaId":[],"deviceId":[],"entityId":["{{ payload.entity_id }}"],"labelId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","blockInputOverrides":true,"domain":"cover","service":"open_cover","x":650,"y":2740,"wires":[["550c37680e580030"]]},{"id":"82ddb5fe.332648","type":"server","name":"Home Assistant","version":5,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":true,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]`

Environment Information

Version: 0.74.0

Home Assistant version: 2024.10.1 Companion version: 4.1.1

Node-RED version: 4.0.3 Docker: yes Add-on: no

Node.js version: v20.17.0 x64 linux OS: Linux 5.15.0-119-generic x64

Additional context

No response

elgatho avatar Oct 08 '24 17:10 elgatho

The wait-until node doesn't support running multiple timers simultaneously. If a new input arrives while a timer is active, the existing one is replaced by the new timer.

What you're trying to achieve can be done using a combination of a trigger node and an events state node.

zachowj avatar Oct 08 '24 20:10 zachowj

But if you look at flow, it should be only one input at once. Get entities node returns only one random entity Then wait until is waiting for closed signal and it sends trigger to repeat the flow.

elgatho avatar Oct 08 '24 21:10 elgatho

try it with some extra debug info and post the debug panel

zachowj avatar Oct 08 '24 23:10 zachowj

I have a similar issue and have pinpointed it to the Get Entities node. A simple query with a single entity, takes 2 seconds, while a more complex one with multiple queries or using an "in group" takes up to 10 seconds and causing connectivity issues and tons of Home assistant Disconnects. I rolled back to .65 and these queries are instant. Not sure exactly what version this started at, but my guess is that this is what is causing the majority of the issues that are listed on GitHub (ie disconnect, crashes etc). I will do a little more testing on this as well as open a separate issue highlighting this.

smarthomeaf avatar Oct 15 '24 16:10 smarthomeaf

This issue has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Dec 23 '24 06:12 github-actions[bot]