Walking stairs direction help


#1

1) Give a description of the problem
Works in both directions Up/Down, however sometimes triggers both at same time, even when I move second trigger to the ELSE section of the first condition.

2) What is the expected behaviour?
If going upstairs, condition one should fire, if going downstairs condition two should fire, not both.
3) What is happening/not happening?
Works in both directions Up/Down, however sometimes triggers both at same time, even when I move second trigger to the ELSE section of the first condition.

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


#2

Forgot to say, basically a motion sensor on bottom and top steps and one midway on stairs.


#3

So 8 at the bottom, 9 in the middle and 10 at the top?

I can imagine how both actions could happen with the piston as it is because both condition groups will always be tested. Not if an else is used though.


#4

You also might be running into cancelation policy due to motion active/inactive running into the very short timers.


#5

This has been bothering me. You have two identical trigger conditions in your piston on lines 18 and 32. They are called triggers because they explicitly indicate to the piston when you require it to automatically be fired. In your case the piston will subscribe to Motion Sensor 9 motion events and run every time it receives one (it doesn’t matter if it is inactive or active, the piston still runs). When the piston runs it will run the piston code line by line starting at the top. The trigger conditions are now just statements to be evaluated in their turn.


#6

So any suggestions on how to fix it, basically someone walking upstairs will trigger sensor DS and then the mid sensor, someone walking down will trigger US then the. I’d, this way the piston should be able to tell if someone walking up or downstairs, whichever is triggered first should prevent the opposite from firing


#7

Are your motion sensors the same brand? Seems I recall a similar problem a few years ago when the sensors were different and the recycle times (active > nonactive) were different. Changes in the state of those sensors may be triggering your piston at unexpected times.


#8

They all Philips hue motion sensors


#9

There is a followed by construct that allows chaining of events but I don’t know how well it works.

I’d be tempted to keep is simple and use a variable. So a piston that does:

if bottom sensor changes to active
  then set variable direction to up
end if
if top sensor changes to active
  then set variable direction to down
end if
if middle sensor changes to active
  then 
    if direction is up
      then set light for up
      else set light for down
    end if
end if

#10

Yeah pretty much what I did in end, used a variable to define which sensor was triggered, and by doing this was able to ditch middle sensor anyway.


#11

See also