How to keep motion sensor active


#1

1) Give a description of the problem
Motion sensor will see motion initially but it does not keep continuous motion active.

2) What is the expected behavior?
Lights should turn off once motion has stopped not 60 seconds after initial trigger

3) What is happening/not happening?
The motion detector is getting triggered on initial motion detection but then will turn off 60 seconds after even though there is still motion. It will then be off for a few seconds and turn back on again for another 60 seconds. I am not sure if this is something with the motion detector (Xiaomi motion sensor) or with my piston?

**4)

**5)
9/9/2018, 6:05:44 PM +91ms
+0ms ╔Received event [Master Bathroom Motion Sensor].motion = inactive with a delay of 100ms
+109ms ║RunTime Analysis CS > 58ms > PS > 30ms > PE > 21ms > CE
+124ms ║Runtime (48180 bytes) successfully initialized in 30ms (v0.3.107.20180806) (123ms)
+125ms ║╔Execution stage started
+129ms ║║Comparison (enum) inactive changes_to (string) active = false (0ms)
+130ms ║║Cancelling condition #2’s schedules…
+130ms ║║Condition #2 evaluated false (3ms)
+131ms ║║Condition group #1 evaluated false (state did not change) (4ms)
+159ms ║║Comparison (time) 65144223 is_between (time) 1536487500000 … (time) 79140000 = true (2ms)
+159ms ║║Time restriction check passed
+160ms ║║Condition #9 evaluated true (28ms)
+161ms ║║Condition group #8 evaluated true (state did not change) (28ms)
+162ms ║║Cancelling statement #10’s schedules…
+6630ms ║║Executed physical command [Bathroom Light].setColor([[hex: #F3F6F7, hue:52, saturation:19, level:96]]) (6458ms)
+6631ms ║║Executed [Bathroom Light].setColor (6464ms)
+9916ms ║║Executed physical command [Bathroom Light].setLevel([100]) (3279ms)
+9917ms ║║Executed [Bathroom Light].setLevel (3280ms)
+9931ms ║║Skipped execution of physical command [Bathroom Light].on([]) because it would make no change to the device. (5ms)
+9932ms ║║Executed [Bathroom Light].on (8ms)
+9938ms ║║Comparison (enum) inactive is (string) inactive = true (1ms)
+9939ms ║║Cancelling condition #15’s schedules…
+9940ms ║║Condition #15 evaluated true (6ms)
+9941ms ║║Cancelling condition #14’s schedules…
+9942ms ║║Condition group #14 evaluated true (state changed) (8ms)
+9944ms ║║Cancelling statement #16’s schedules…
+12465ms ║║Executed physical command [Bathroom Light].off() (2513ms)
+12466ms ║║Executed [Bathroom Light].off (2515ms)
+12469ms ║╚Execution stage complete. (12343ms)
+12501ms ╚Event processed successfully (12501ms)
9/9/2018, 6:04:43 PM +111ms
+1ms ╔Received event [Master Bathroom Motion Sensor].motion = active with a delay of 110ms
+110ms ║RunTime Analysis CS > 59ms > PS > 30ms > PE > 21ms > CE
+122ms ║Runtime (48176 bytes) successfully initialized in 30ms (v0.3.107.20180806) (121ms)
+123ms ║╔Execution stage started
+126ms ║║Comparison (enum) active changes_to (string) active = true (0ms)
+127ms ║║Cancelling condition #2’s schedules…
+128ms ║║Condition #2 evaluated true (3ms)
+155ms ║║Comparison (time) 65083239 is_between (time) 79200000 … (time) 1536445500000 = false (2ms)
+156ms ║║Condition #5 evaluated false (28ms)
+157ms ║║Condition group #1 evaluated false (state did not change) (33ms)
+160ms ║║Comparison (time) 65083269 is_between (time) 1536487500000 … (time) 79140000 = true (1ms)
+161ms ║║Time restriction check passed
+162ms ║║Condition #9 evaluated true (3ms)
+162ms ║║Condition group #8 evaluated true (state did not change) (5ms)
+163ms ║║Cancelling statement #10’s schedules…
+6816ms ║║Executed physical command [Bathroom Light].setColor([[hex: #F3F6F7, hue:52, saturation:19, level:96]]) (6647ms)
+6817ms ║║Executed [Bathroom Light].setColor (6649ms)
+10125ms ║║Executed physical command [Bathroom Light].setLevel([100]) (3297ms)
+10126ms ║║Executed [Bathroom Light].setLevel (3298ms)
+10140ms ║║Skipped execution of physical command [Bathroom Light].on([]) because it would make no change to the device. (5ms)


#2

For starters, try adding a Wait XX seconds before the Turn off in the very last IF statement. It will wait the allotted time before it send the off command and the timer will cancel if motion resumes.


#3

It sounds like a problem with your motion sensor. What type of sensor are you using. You may have to change a setting in the DTH to have continuous trigger instead of single trigger. If you are still moving in front of the sensor, it should not report INACTIVE as long as it supports continuous triggering.


#4

Yeah I had a 1 min wait timer to it but seemed like still a bit off as went off still a few times. The one I have is the Xiaomi one, but might pick up a philips hue or aeotec one and see how that goes.


#5

Before you spend any money, try importing this piston.

And of course, pause your current piston before testing this one


Changes I made:

  • Inverted the first time so it does not span midnight (sometimes causes issues)
  • Moved the ELSE IF into it’s own IF block (less chance of strange behavior)
  • Added one minute to the 2nd time (or it would occasionally not work as expected)
  • Removed the Turn ON commands (since setting the level does that)
  • Moved the color commands down a line (so it happens once the lights are already on)
    (Many/most bulbs cannot act upon a color change unless the light is already on. YMMV)
  • Added “STAYS INACTIVE” to the final block (to prevent the hiccups mentioned in this thread)

#6

Thank you so much for taking time out to do this mate! If anything, I think helped with another side problem that was annoying me how when it turns on full then changes the level. I did not know could just turn it on with level command. So thanks for that!

I will give this a crach when I get home from work and let you know how it goes.


#7

The set level command will still turn the light on first and then set the level. You will still get the lights on at the old setting first. That’s just the nature of the way that the devices receive commands.


#8

Ah well :stuck_out_tongue: