Lights don't turn off after x minutes of no motion


#1

1) Give a description of the problem
Lights don’t turn off after x minutes of inactivity

2) What is the expected behaviour?
after x minutes of inactivity (no motion) lights should turn off.

3) What is happening/not happening?
I dont see a counter in webcore(?) Lights do turn off when i click ‘test’ in the overview of the piston.

**4) Post a Green Snapshot of the piston![image|45x37]

5) Attach logs after turning logging level to Full
3-12-2019 16:47:07 +803ms
+1ms ╔Starting piston… (v0.2.0e1.20170728)
+369ms ║╔Subscribing to devices…
+436ms ║║Subscribing to Hue Motion Sensor Living room.motion…
+446ms ║║Subscribing to Receiver.switch…
+561ms ║║Subscribing to Ledstrip…
+562ms ║║Subscribing to Lightstander…
+563ms ║║Subscribing to Stairs…
+564ms ║║Subscribing to Tablelight…
+566ms ║║Subscribing to Tablelight 2…
+566ms ║║Subscribing to Window light…
+567ms ║╚Finished subscribing (208ms)
+610ms ║Comparison (enum) inactive did_not_change = true (21ms)
+618ms ║Comparison (enum) off is (string) off = true (2ms)
+641ms ╚Piston successfully started (640ms)
3-12-2019 16:45:54 +531ms
+1ms ╔Received event [Sanctuary].test = 1575387954521 with a delay of 9ms
+120ms ║RunTime Analysis CS > 25ms > PS > 46ms > PE > 50ms > CE
+131ms ║Runtime (36415 bytes) successfully initialized in 46ms (v0.2.0e1.20170728) (127ms)
+133ms ║╔Execution stage started
+184ms ║║Comparison (enum) inactive did_not_change = true (37ms)
+186ms ║║Condition #6 evaluated true (47ms)
+193ms ║║Comparison (enum) off is (string) off = true (2ms)
+195ms ║║Condition #7 evaluated true (9ms)
+197ms ║║Condition group #5 evaluated true (state did not change) (58ms)
+200ms ║║Condition group #8 evaluated true (state did not change) (0ms)
+202ms ║║Cancelling statement #9’s schedules…
+238ms ║║Executed physical command [Ledstrip].off() (20ms)
+239ms ║║Executed [Ledstrip].off (22ms)
+262ms ║║Executed physical command [Lightstander].off() (20ms)
+263ms ║║Executed [Lightstander].off (22ms)
+287ms ║║Executed physical command [Stairs].off() (20ms)
+288ms ║║Executed [Stairs].off (22ms)
+312ms ║║Executed physical command [Tablelight].off() (20ms)
+312ms ║║Executed [Tablelight].off (22ms)
+339ms ║║Executed physical command [Tablelight 2].off() (22ms)
+340ms ║║Executed [Tablelight 2].off (24ms)
+409ms ║║Executed physical command [Window light].off() (66ms)
+410ms ║║Executed [Window light].off (68ms)
+440ms ║║Executed virtual command [Ledstrip, Lightstander, Stairs, Tablelight, Tablelight 2, Window light].sendPushNotification (26ms)
+450ms ║╚Execution stage complete. (317ms)
+457ms ╚Event processed successfully (457ms)
3-12-2019 16:39:32 +137ms
+1ms ╔Starting piston… (v0.2.0e1.20170728)
+335ms ║╔Subscribing to devices…
+341ms ║║Subscribing to Hue Motion Sensor Living room.motion…
+354ms ║║Subscribing to Receiver.switch…
+472ms ║║Subscribing to Ledstrip…
+473ms ║║Subscribing to Lightstander…
+474ms ║║Subscribing to Stairs…
+474ms ║║Subscribing to Tablelight…
+475ms ║║Subscribing to Tablelight 2…
+476ms ║║Subscribing to Window light…
+477ms ║╚Finished subscribing (154ms)
+545ms ║Comparison (enum) inactive did_not_change = true (38ms)
+546ms ║Cancelling condition #6’s schedules…
+554ms ║Comparison (enum) off is (string) off = true (1ms)
+556ms ║Cancelling condition #5’s schedules…
+572ms ╚Piston successfully started (571ms)
3-12-2019 16:14:35 +573ms
+2ms ╔Received event [Sanctuary].test = 1575386075567 with a delay of 5ms
+85ms ║RunTime Analysis CS > 23ms > PS > 36ms > PE > 27ms > CE
+95ms ║Runtime (36423 bytes) successfully initialized in 36ms (v0.2.0e1.20170728) (91ms)
+96ms ║╔Execution stage started
+144ms ║║Comparison (enum) inactive did_not_change = false (35ms)
+145ms ║║Condition #6 evaluated false (43ms)
+146ms ║║Condition group #5 evaluated false (state did not change) (44ms)
+156ms ║╚Execution stage complete. (60ms)
+162ms ╚Event processed successfully (162ms)


#2

Remove your second IF-THEN and put your WITH under the first THEN.


#3

Thanks for your help mate. But at this moment it doesnt seem to affect the piston.


#4

Remove the subscription for line 20.


#5

The receiver mmmm? I would like to keep it as condition, is that really necessary?


#6

Just tried this, also doesn’t seem to work :frowning:


#7

The two lightning bolts on the side indicates triggers. As it is, you have two triggers required to happen at the same exact time, not going to happen… or maybe it can but not in my lifetime :smiley:

If you remove the lightning bolt, it will still be a condition.


#8

I prefer using one trigger, and then (unlimited) conditions beneath… Maybe something like this:

IF Sensor's motion stays inactive for 20 min  <-- Trigger
Then
    IF Music Player's switch is off           <-- Condition
        Then do stuff
    END IF
END IF

#9

You piston is subscribing to two events that will cause the piston to fire: the motion sensor motion changing, and the music player switch changing.

I haven’t checked what ‘did not change in the last 20 minutes’ actually does, but you could easily imagine that if the piston has been triggered by the motion changing then the motion has changed in the last 20 minutes. In any case you haven’t differentiated between it being active or inactive.

All of which is irrelevant really as there is no timer in there.

You could simply do:

if
    Motion Sensor 1's motion is inactive
    and
    Music Player 1's switch is off
then
    with
        ... all those lights ...
        do
        wait 20 minutes
        turn off
    end with
end if

The wait would get cancelled if the motion changed to active or the switch changed to on. The inactivity count wouldn’t actually start until both conditions are true in this case. Using a trigger such as ‘changes to inactive’ would perhaps be more efficient.


#10

How about doing it this way

If sensor x stays inactive 20 minutes
And
If switch y is off
Then
With light bulbs do turn off


#11

Hey guys, thanks for all the help. I never really payed alot of attention to what was mentioned about the triggers and conditions. Ill give it a shot tonight! ill report back in here.


#12

Many here have struggled with triggers and conditions. A good place to start is : Conditions and Triggers: The difference?


#13

You can also use the “followed by” function for the music player.