Intermittent pistons/ light doesn't change back to 100%


#1

1) Give a description of the problem
So i have been reading many posts and trying different things to get this piston working right. Overall all of my pistons that turn lights on and off are intermittent. When i had simple automations for the light set up in smart things they worked everytime. Now that they are pistons they work half the time. But to just focus on this particular situation the issue is at night i have it set to turn on to 10% brightness during a set time. Now that the time period is over the lights are still on 10%. Also when i set a certain time for the light to turn off it is also intermittent. But now that i have it turning off when there is no motion it works more often. But still not as desired.
2) What is the expected behaviour?
The way i would like for this to work is everytime there is motion the light turns on. If there is no motion for 5 minutes the light turns off. Between the hours of 3 am -7 am if any motion the light turns on at 10% and should turn off after 3 minutes of no motion.
3) What is happening/not happening?
The light turns on about 50% of the time when i walk past the motion sensor. Also now that it is during the regular daylight hours the light is still turning on to only 10%. It didn’t reset back to 100%.
**4) Post a Green Snapshot of the piston![image|45x37]

5) Attach logs after turning logging level to Full
It says the logs are empty after i changed the level to full.

REMOVE BELOW AFTER READING
If a solution is found for your question then please mark the post as the solution.


#2

Lights don’t default to a particular level. They use whatever level you last set. So if you want your lights to come on at 100% during the day you need to tell them to.


#3

You have two of the same trigger doing different things. This is better accomplished with nested if statements. The 2nd and 4th if statements look identical so not sure how you are achieving the 3 min vs 5 min off time. They are not even triggers so I can’t tell what turns your lights back off but it would seem like that would be the motion changing to inactive which is usually much shorter than 3-5 min.

I would suggest something like

If motion changes to active
  If time is between 3 and 7
       Turn on at 10%
  Else
        Turn on ant 100%
  End if
End if
If motion stays inactive for 3 min
      And
   Time is between 3 and 7
      Turn off
End if
If motion stays inactive for 5 min
    Turn off
End if

#4

I tried the piston u suggested. Now my lights don’t do anything. When i walk past the motion detector i see the green light on motion detector light up but the smart lights don’t turn on…or off. I am pasting a few of my last logs to see if you guys see anything there that could help. thx

Logs

9/14/2021, 2:01:09 AM +154ms
+0ms â•”Received event [My home].time = 1631599243221 with a delay of 25932ms
+83ms â•‘RunTime Analysis CS > 52ms > PS > 5ms > PE > 26ms > CE
+85ms â•‘Runtime (39906 bytes) successfully initialized in 5ms (v0.3.113.20210203) (84ms)
+86ms â•‘â•”Execution stage started
+103ms ║║Cancelling condition #14’s schedules…
+104ms â•‘â•‘Condition #14 evaluated true (1ms)
+105ms ║║Cancelling condition #13’s schedules…
+105ms â•‘â•‘Condition group #13 evaluated true (state changed) (3ms)
+107ms ║║Cancelling statement #15’s schedules…
+126ms â•‘â•‘Skipped execution of physical command [left 2].off([]) because it would make no change to the device. (15ms)
+127ms â•‘â•‘Executed [left 2].off (16ms)
+147ms â•‘â•‘Skipped execution of physical command [left light 1].off([]) because it would make no change to the device. (16ms)
+147ms â•‘â•‘Executed [left light 1].off (18ms)
+161ms â•‘â•‘Skipped execution of physical command [right 2].off([]) because it would make no change to the device. (11ms)
+162ms â•‘â•‘Executed [right 2].off (13ms)
+184ms â•‘â•‘Skipped execution of physical command [right light 1].off([]) because it would make no change to the device. (20ms)
+185ms â•‘â•‘Executed [right light 1].off (20ms)
+187ms â•‘â•šExecution stage complete. (101ms)
+193ms â•šEvent processed successfully (192ms)
9/14/2021, 1:58:42 AM +113ms
+0ms â•”Received event [My home].time = 1631599123209 with a delay of -1097ms
+60ms â•‘RunTime Analysis CS > 17ms > PS > 5ms > PE > 39ms > CE
+63ms â•‘Runtime (39907 bytes) successfully initialized in 5ms (v0.3.113.20210203) (61ms)
+64ms â•‘â•”Execution stage started
+79ms ║║Cancelling condition #9’s schedules…
+80ms â•‘â•‘Condition #9 evaluated true (2ms)
+90ms ║║Comparison (time) 7122194 is_between (time) 10800000 … (time) 25200000 = false (7ms)
+92ms â•‘â•‘Condition #10 evaluated false (11ms)
+93ms â•‘â•‘Condition group #8 evaluated false (state did not change) (15ms)
+110ms â•‘â•‘Comparison (enum) inactive stays (string) inactive = true (1ms)
+113ms â•‘â•‘Condition #14 evaluated false (16ms)
+114ms â•‘â•‘Condition group #13 evaluated false (state did not change) (18ms)
+116ms â•‘â•šExecution stage complete. (53ms)
+117ms â•‘Setting up scheduled job for Tue, Sep 14 2021 @ 2:00:43 AM EDT (in 120s)
+127ms â•šEvent processed successfully (127ms)

9/14/2021, 1:55:43 AM +32ms
+1ms â•”Received event [Master bedroom Motion Sensor].motion = inactive with a delay of 75ms
+61ms â•‘RunTime Analysis CS > 19ms > PS > 5ms > PE > 38ms > CE
+63ms â•‘Runtime (39919 bytes) successfully initialized in 5ms (v0.3.113.20210203) (61ms)
+64ms â•‘â•”Execution stage started
+71ms â•‘â•‘Comparison (enum) inactive changes_to (string) active = false (0ms)
+73ms ║║Cancelling condition #2’s schedules…
+74ms â•‘â•‘Condition #2 evaluated false (5ms)
+75ms â•‘â•‘Condition group #1 evaluated false (state did not change) (6ms)
+77ms ║║Cancelling statement #6’s schedules…
+104ms â•‘â•‘Executed physical command [left 2].setLevel([100]) (21ms)
+105ms â•‘â•‘Executed [left 2].setLevel (22ms)
+126ms â•‘â•‘Executed physical command [left light 1].setLevel([100]) (16ms)
+126ms â•‘â•‘Executed [left light 1].setLevel (18ms)
+146ms â•‘â•‘Executed physical command [right 2].setLevel([100]) (15ms)
+147ms â•‘â•‘Executed [right 2].setLevel (17ms)
+166ms â•‘â•‘Executed physical command [right light 1].setLevel([100]) (15ms)
+167ms â•‘â•‘Executed [right light 1].setLevel (17ms)
+174ms â•‘â•‘Comparison (enum) inactive stays (string) inactive = true (1ms)
+176ms â•‘â•‘Adding a timed trigger schedule for condition 9
+178ms â•‘â•‘Condition #9 evaluated false (8ms)
+179ms â•‘â•‘Condition group #8 evaluated false (state did not change) (10ms)
+186ms â•‘â•‘Comparison (enum) inactive stays (string) inactive = true (1ms)
+188ms â•‘â•‘Adding a timed trigger schedule for condition 14
+190ms â•‘â•‘Condition #14 evaluated false (8ms)
+191ms â•‘â•‘Condition group #13 evaluated false (state did not change) (10ms)
+194ms â•‘â•šExecution stage complete. (129ms)
+195ms â•‘Setting up scheduled job for Tue, Sep 14 2021 @ 1:58:43 AM EDT (in 179s), with 1 more job pending
+202ms â•šEvent processed successfully (202ms)

9/14/2021, 1:51:55 AM +528ms
+0ms â•”Received event [Master bedroom Motion Sensor].motion = active with a delay of 158ms
+53ms â•‘RunTime Analysis CS > 17ms > PS > 5ms > PE > 32ms > CE
+56ms â•‘Runtime (39915 bytes) successfully initialized in 5ms (v0.3.113.20210203) (55ms)
+57ms â•‘â•”Execution stage started
+65ms â•‘â•‘Comparison (enum) active changes_to (string) active = true (0ms)
+66ms ║║Cancelling condition #2’s schedules…
+67ms â•‘â•‘Condition #2 evaluated true (6ms)
+78ms ║║Comparison (time) 6715596 is_between (time) 10800000 … (time) 25200000 = false (8ms)
+80ms â•‘â•‘Condition #5 evaluated false (11ms)
+81ms â•‘â•‘Condition group #1 evaluated false (state did not change) (19ms)
+83ms ║║Cancelling statement #6’s schedules…
+101ms â•‘â•‘Executed physical command [left 2].setLevel([100]) (12ms)
+102ms â•‘â•‘Executed [left 2].setLevel (13ms)
+113ms â•‘â•‘Executed physical command [left light 1].setLevel([100]) (9ms)
+114ms â•‘â•‘Executed [left light 1].setLevel (11ms)
+126ms â•‘â•‘Executed physical command [right 2].setLevel([100]) (9ms)
+127ms â•‘â•‘Executed [right 2].setLevel (11ms)
+139ms â•‘â•‘Executed physical command [right light 1].setLevel([100]) (10ms)
+140ms â•‘â•‘Executed [right light 1].setLevel (11ms)
+148ms â•‘â•‘Comparison (enum) active stays (string) inactive = false (2ms)
+150ms â•‘â•‘Cancelling any timed trigger schedules for condition 9
+151ms ║║Cancelling statement #9’s schedules…
+152ms ║║Cancelling condition #9’s schedules…
+153ms â•‘â•‘Condition #9 evaluated false (9ms)
+154ms â•‘â•‘Condition group #8 evaluated false (state did not change) (11ms)
+161ms â•‘â•‘Comparison (enum) active stays (string) inactive = false (2ms)
+163ms â•‘â•‘Cancelling any timed trigger schedules for condition 14
+164ms ║║Cancelling statement #14’s schedules…
+165ms ║║Cancelling condition #14’s schedules…
+166ms â•‘â•‘Condition #14 evaluated false (10ms)
+167ms ║║Cancelling condition #13’s schedules…
+168ms â•‘â•‘Condition group #13 evaluated false (state changed) (12ms)
+170ms â•‘â•šExecution stage complete. (114ms)
+171ms â•šEvent processed successfully (172ms)


#5

Flying a little blind without the actual piston, but let’s see what the logs suggest:

1:51:55am

  • Motion sensor goes active.
  • Looks like a group if with two conditions combined with an and. The first is returning true for a change to active and then the second false for a time range. That should take us into an else block. So this isn’t the same as @guxdude suggested as that would have tested for the change to active in an outer if block, then tested the time range in a nested if ... then ... else within the then.
  • Four lights are set to a level of 100%. I’ve never used dimmers so whether that also turns on the lights may be device specific. This is probably of interest.
  • Two stays conditions have nothing to do and just return false.

1:55:43am

  • Motion sensor goes inactive.
  • Change to active returns false so the if group returns false which should take us into the else again. You probably do need to look at the piston structure. You don’t want the level being set to 100% when motion goes inactive.
  • Four lights are set to 100% again.
  • Two stays timers are set up, the first one for three minutes.

1:58:42am

  • A timer has fired. That should be the stays timer for being inactive for three minutes. As the timer wasn’t cancelled we’d expect that to fast forward to the first stays and then return true.
  • Indeed it does.
  • Looks like there is a time condition which is part of an and with the stays which isn’t being met.
  • The piston visits the second stays condition which still has two minutes to run.

2:01:09am

  • A timer has fired. That should be the stays timer for being inactive for five minutes. We’d expect that to jump to the second stays and return true.
  • It does, and in the absence of any other conditions we should enter a then.
  • This one is trying to turn off four lights but failing because they are already off.

OK, my conclusion would be that you probably need an explicit on command after setting the level to 100%. However the structure isn’t quite there.