Motion upstairs to downstairs, turn on lights


#1

Hi All,

Im trying to get a motion sensor piston to work. The use case is that I want to use motion sensors to turn lights on. I want to be able to distinguish between someone walking from upstairs to downstairs and vice vera. For example (see piston below), If motion is detected on MS1 or MS2 and then MS3, turn on this light switch. The idea being, I would do the same for the reverse journey. Am I doing something wrong, it doesnt seem to trigger correctly. Its been a while since I have used Webcore so the conditions might not be right


#2

At quick glance the first issue is that your trigger on line 21 will never happen at the same time as the earlier trigger on line 18.

We also like to put exact triggers first and then conditions. So I would make line 21 IF as the main device to act on and then the other devices as conditions to compare. Something along the lines of

IF Motion Sensor 24 motion changes to active
AND Motion Sensors 15, 16, & 17 Motion Was active
THEN turn on dimmer

This way if you have already passed motion sensors 15, 16, & 17 and then also trip 24 it will react.

Lastly move your line 29 IF out of the first IF block. When editing the piston, in the top left corner make sure you have “allow moving of items…” selected. It is the 4th option in the little row of options. From there you can highlight that line 29 IF and drag it outside of the first line 17 IF block.


#3

Just food for thought. Daisy-chaining motion sensors can be tricky. The cycle time of each device may be different. How long will each motion sensor stay “active”…5 seconds, 10 seconds, 30, 2 minutes…? And if the sensor that triggers your piston changes state before items in your code get executed (especially if you have WAITS), then the piston may halt and start from the top again. And now your trigger may be “inactive” and the piston will not execute.


#4

When it comes to stairwells, I recommend using two motion sensors… One at the 3rd step from the top, and one about 3 steps from the bottom. (I often install them ankle or shin height to narrow the scope and reduce false triggers) Ideally, they will be installed in a place that is ONLY triggered when someone actually uses the steps. (not when walking by the landing)

If you can achieve this, the piston is simple:

IF Top's motion changes to active     <-- Trigger
Then
    IF Bottom's motion is inactive    <-- Condition
    Then
        Log to console = 'Going Down'
    END IF
END IF

IF Bottom's motion changes to active  <-- Trigger
Then
    IF Top's motion is inactive       <-- Condition
    Then
        Log to console = 'Going Up'
    END IF
END IF

#5

@WCmore - what does the log console do? How can I use that in my piston? Or do I replace it with this?

In my case I have a dimmer


#6

The Log to console is awesome, but it’s only shown here as a place holder for your real events.
(In your case, turn on or off the Dimmer can be inserted here)


I would pause your current piston, then import and test the one I have shown above.
(assuming your two motion sensors are not triggered from your landings)


#7

Would you then also have two other pistons for hallway lights and landing (as I have separate sensors for these rooms?)

Also I would add in modes for dimmer levels/ turn off lights after no motion etc, so would that be best handled in these separate pistons too? Current they look like this…


#8

Whenever possible, I try to program so each event only triggers one piston…
(IE: One trigger, with many conditions beneath it, directing the flow)


#9

Just to clarify, having two lightning bolts that are both based on Sensor 15’s motion… (whether active or inactive) is the same as having only one trigger. In other words, in piston “ea3a”, I would keep them inside the same piston.

In this case, if you split them into two pistons, then two pistons will execute when that sensor changes at all.