Piston will not resume from paused state after set time


#38

Here :slight_smile:
https://www.gearbest.com/aqara-_gear/
But look around, you can get these dirt cheap, prices change often
Device handlers can be found here

Using these for over a year with great success.


#39

Hmmm, looks like there is another problem
If you leave the bathroom before the Auto light pistons resumes, then after it does resume without anyone there the light will never turn off until someone enters the bathroom and triggers the motion sensor, only after that the count down delay starts again to turn the light off.


#40

I wonder if you could switch around your “Bathroom Basement Auto Light” piston like this:

IF Motion sensor is inactive
THEN WITH Bulb
DO Wait 90 seconds
Turn off
END With
ELSE WITH Bulb
DO Set level to 28%

I have not tried this inverted logic, but it looks like it would work


#41

Will give it a try
Thanks!

EDIT:
No difference :frowning:

Logs

‎4‎/‎2‎/‎2018‎ ‎1‎:‎00‎:‎38‎ ‎PM +636ms
+1ms
╔Starting piston… (v0.3.104.20180323)
+293ms
║╔Subscribing to devices…
+458ms
║║Subscribing to Basement Bath Motion.motion…
+835ms
║║Subscribing to Bath Basement Light…
+836ms
║╚Finished subscribing (560ms)
+902ms
║Comparison (enum) inactive is (string) inactive = true (10ms)
+907ms
║Cancelling condition #9’s schedules…
+909ms
║Cancelling condition #1’s schedules…
+924ms
║Comparison (enum) inactive is (string) active = false (2ms)
+926ms
║Cancelling condition #5’s schedules…
+927ms
║Cancelling condition #2’s schedules…
+940ms
╚Piston successfully started (938ms)
‎4‎/‎2‎/‎2018‎ ‎12‎:‎56‎:‎38‎ ‎PM +882ms
+107ms
╔Stopping piston…
+203ms
╚Piston successfully stopped (96ms)
4‎/‎2‎/‎2018‎ ‎12‎:‎56‎:‎34‎ ‎PM +91ms
+1ms
╔Received event [Basement Bath Motion].motion = active with a delay of 124ms
+113ms
║RunTime Analysis CS > 14ms > PS > 36ms > PE > 63ms > CE
+115ms
║Runtime (37399 bytes) successfully initialized in 36ms (v0.3.104.20180323) (113ms)
+116ms
║╔Execution stage started
+127ms
║║Comparison (enum) active is (string) inactive = false (2ms)
+129ms
║║Cancelling condition #9’s schedules…
+129ms
║║Condition #9 evaluated false (7ms)
+130ms
║║Cancelling condition #1’s schedules…
+131ms
║║Condition group #1 evaluated false (state changed) (9ms)
+138ms
║║Comparison (enum) active is (string) active = true (2ms)
+140ms
║║Cancelling condition #5’s schedules…
+140ms
║║Condition #5 evaluated true (6ms)
+141ms
║║Cancelling condition #2’s schedules…
+142ms
║║Condition group #2 evaluated true (state changed) (9ms)
+145ms
║║Cancelling statement #3’s schedules…
+159ms
║║Executed physical command [Bath Basement Light].setLevel([25]) (8ms)
+160ms
║║Executed [Bath Basement Light].setLevel (10ms)
+165ms
║╚Execution stage complete. (49ms)
+166ms
╚Event processed successfully (166ms)


#42

Would it make sense to ad turning off the light if there is no motion just after the lin where it resumes the auto light piston, or this would later override rules in that piston?


#43

I was originally thinking something like that, but I didn’t suggest it because your piston “Bath Basement Light 100% override” ends with the light at 28%… We might have to rethink our entire logic.

Although, before starting over, I would love it if you tried my suggestion in post #40 above. You added an extra IF statement that might be messing with it.

Here is my test for “Bath Basement Auto Light”

IF Motion sensor is inactive
THEN WITH Bulb
DO Wait 90 seconds
Turn off
END With
ELSE WITH Bulb
DO Set level to 28%

Notice the only IF is at the beginning. In the ELSE section is is simply:
WITH Bulb
DO Set level to 28%

It is not a guarantee, but I do the inverted version of this all the time, and it works like a charm.


#44

Am I correct in the assumption that there is no shower in this bathroom downstairs? (a shower curtain would hide motion from the sensor)

If there is no shower, it would be an easy fix if “Bath Basement Light 100% override” ended with:
Turn off Bulb
Resume other piston

(not the other way around)

This way, the light would ALWAYS get shut off after X minutes of a manual override, but motion would trigger it back on in case someone was lingering beyond your timer.


#45

Yes, there is shower with door, and another piston takes care of that and is working perfect.

https://community.webcore.co/uploads/default/original/2X/6/685baa96e9de16dfeabf3f5ef714dff0b2ede3ff.png

If I end the 100% override piston with Off that would tun Off the light if there is someone in the bathroom …no?
Or the resumed motion light piston has somehow priority?


#46

Will try that when I get home
Thanks!


#47

Corrected but it still wouldn’t turn the light OFF without presence in the bathroom :frowning:

Adding Turn OFF bulb before resuming the piston caused the light to go OFF even when there is presence in the bathroom, and it took long time before it turned back on again ( I guess blind period by the motion sensor)

To be continue tomorrow :slight_smile:


#48

I give up, perhaps the concept is flawed, tried countless combinations but no joy :frowning:
Deleted the piston for now and will try again later with clear mind.


#49

I have a couple of double shifts coming up, but I will continue brain storming…
I have a few good ideas, I just need to iron out the kinks in my mind


#50

You are very kind :slight_smile:
Don’t work too hard :wink:

Thanks


#51

Hmmm. I have an idea… What if your “100% override” piston kept the light on until the motion was inactive (instead of forcing 3 minutes). Something like this:

IF Keypad button gets pushed
THEN WITH Bulb 2
DO Pause other piston
Set level to 100%
Set boolean variable ‘Override’ to true
End IF

If Motion sensor is inactive
-AND-
Variable ‘Override’ is true
THEN WITH Bulb
Wait 2 minutes
turn off
Set variable 'Override" to false
Resume other piston
End IF

This method will keep the lights on at 100% until 2 minutes after the motion stops. At which point, the light will turn off completely, and the normal piston will resume.

The only issue I forsee is what if someone wants 100% light, then hops in the shower… (where the motion cannot detect them) The light would turn off in 2 minutes. (unless your shower piston takes that into account) I haven’t seen your shower piston though, so I am really just guessing on that angle


#52

Thank you, will try that
The shower piston should take care of that or I can just ad line to cancel the override piston


#53

Sorry I’m late to the party, but here is an explanation I posted in another thread with similar issues. The reason your original piston didn’t work as you thought is the same reasoning:

In your case, when your piston wakes up 3 minutes later, the “Keypad 8’s button gets pushed” condition evaluates false, therefore nothing further in your “THEN” statement is executed. Anything you had in “ELSE” would have been, though. A wait doesn’t resume piston execution where it left off.

Hope this helps! Once you understand how the piston flows, you can go back to writing something more ‘natural’ to you.


#54

Well, that explains a lot Thanks :slight_smile:
So there is no way to “continue” from the point where the piston was paused instead of executing it all over from the top of the sequence? That would solve my problems.


#55

There are a few different ways you can still make the piston behave the way you want… you just have to make sure the IF statement at the top won’t prevent your following actions from being completed. Here are two samples:

In the above, the wait and subsequent code isn’t dependent on any IF evaluation. This can be good or bad… meaning if the piston is triggered for another reason, the last 3 lines are executed. You’d have to decide if this is a good implementation since you know your system, what other inputs could make your piston execute, etc.

Another method that is less likely to cause “hmm, wasn’t expected that to happen” scenarios is to use a variable:

In this case, since your IF condition would still evaluate TRUE, you piston will jump in and resume execution from the WAIT command.

First run:
Button is pushed evaluates true
Sets variable
THEN pauses piston and sets light level to 100%
Sets wake-up timer for 3 minutes from now

Second run, 3 minutes later:
Variable evaluates true
THEN sets level to 28% and resumes piston, and sets variable back to false

Coming out of a WAIT command, the conditions are re-evaulated but no every step in your THEN/DO is repeated, otherwise you’d hit the same WAIT command and never get past it.


#56

Thanks for the detailed explanation, I’m true amateur when I see all the options possible :joy:

I will experiment with all of it, it’s a great learning lesson!


#57

So, finished testing the first version, it works fine till the point where it dims back and resumes the “bath autolight” piston but if the person left the bathroom before the end of the 3 min override the light will stay on untill someone walks in and will trigger once the motion sensor (we had this problem above as well)

EDIT:
Version 2 working perfect, I just have to comprehend it :innocent: