While loop not working as a while loop?


#1

1) Give a description of the problem
My while loops doesn’t work, or they don’t work as I think?
As a developer I find the while loop not working as intended :open_mouth:

2) What is the expected behaviour?
The while loops should wait for my door to be opened, then wait for it to close

3) What is happening/not happening?
The piston is executing and completes in couple ms without iterating the while loops
The routine #5 is executing

**4) Post a Green Snapshot of the piston

5) Attach logs after turning logging level to Full
|+0ms|╔Received event [Hemma].time/recovery = 1569957190038 with a delay of 0ms|
|—|---|
|+81ms|║RunTime Analysis CS > 14ms > PS > 50ms > PE > 17ms > CE|
|+84ms|║Runtime (45118 bytes) successfully initialized in 50ms (v0.3.10f.20190822) (83ms)|
|+85ms|║╔Execution stage started|
|+86ms|║╚Execution stage complete. (1ms)|
|+87ms|╚Event processed successfully (87ms)|


#2

First thing I’d get rid of is the trigger inside a loop line 33 and 41, use conditions only.


#3

I see your point; if the loop is iterating it will get in the IF without the trigger.
Changed it to is open/closed

Did not change my result though


#4

Updated piston pic?


#5

Well, problem found, but not solved.

The problem seems to be with having nested conditions/loops with the status of same device as conditions…

If I change the conditions to other switches(virtual test switches) it works as intended… Is this a bug/problem in webcore? This gonna be tougher to solve with that approach…

Anyone solved this in a piston?
Scenario I want:

  • I come home (mobile presense)
  • Door unlocks, security disarmed, some lamp changes (for all this i’m calling a ST classic Routine)
  • I open door (contact sensor)
  • Google home welcoming me with voice (web request to my assistant-relay)
  • I close door (contact sensor)
  • Google home telling me she is putting security back on (web request to assistant-relay)
  • Door locks, security armed/stay (another ST classic Routine)