Help understanding piston design


#1

I’m looking for help understanding what the best type of piston design is. Here is an example scenario…
Devices:
-Hallway Lower Motion Sensor
-Hallway Upper Motion Sensor
-Hallway Light

Conditions:
-Time
-Location Mode

My initial piston design was something like the following:
If Mode = Night
And Hallway Lower Motion = Active
Or Hallway Upper Motion = Active
Then
Turn On Hallway Light
Set Level To 60%

If Mode = Sleep
And Hallway Lower Motion = Active
Or Hallway Upper Motion = Active
Then
Turn On Hallway Light
Set Level To 5%

If Hallway Lower Motion = Inactive
And Hallway Upper Motion = Inactive
Then
Wait 2 Min
Turn Off Hallway Light

But then I noticed that there were ways to restrict actions based on time, location mode, etc. So then I thought that this would be a better design:
If Hallway Lower Motion = Active
Or Hallway Upper Motion = Active
Then
Turn On Hallway Light (Only When Location Mode = Night)
Set Level To 60% (Only When Location Mode = Night)

If Hallway Lower Motion = Active
Or Hallway Upper Motion = Active
Then
Turn On Hallway Light (Only When Location Mode = Sleep)
Set Level To 5% (Only When Location Mode = Sleep)

If Hallway Lower Motion = Inactive
And Hallway Upper Motion = Inactive
And Hallway Light Is On
Then
Wait 2 Min
Turn Off Hallway Light

THEN I discovered the “Is Between” condition and thought that this might be even better:
If Hallway Lower Motion = Active
Or Hallway Upper Motion = Active
Then
Turn On Hallway Light (Location Mode = Night or Sleep)
Set Level To 5% (Is Between Sunset&10PM = 60%, 10PM&Sunrise = 5%)

If Hallway Lower Motion = Inactive
And Hallway Upper Motion = Inactive
And Hallway Light Is On
Then
Wait 2 Min
Turn Off Hallway Light

So, three different ways to go about this and all seem like they would work, but is there a “best practice” with this type of thing? I want my pistons to be as stable as possible, but I think I’m trying to make them too complex.


#2

best practice is whatever works for you. :slight_smile:

everyone has different preferences for how the lights should work, what the levels should be, what colors look nicer at what time of day and so on. i wouldnt be concerned about making it too complex if it works just right for you its simple enough. :smile: