Modifying Advanced Motion Piston Question


#1

1) Give a description of the problem
I’m trying to modify the Advanced Motion Piston (edsh2) to control two lights, with some time specific light percentages, but I want to define more than 2 time ranges, and more importantly want to specify the brightness for each time period per light switch.

2) What is the expected behaviour?
I can define something like this;

Time Period | Light 1 | Light 2
Sunrise to Sunset | 90% | 100%
Sunset to 11PM | 50%| 40%
11PM to Sunrise | 3% | 10%

3) What is happening/not happening?
My brain function is not happening, I cannot comprehend this yet :slight_smile:

**4) Post a Green Snapshot of the piston!
[Reference] (https://wiki.webcore.co/images/1/15/Advancedmotionv1.png)]


#2

I’m in bed nearly asleep, but my quick response is that you might try breaking those tasks into smaller, individual pistons. It’s much easier to code and debug that way. I will take a closer look tomorrow.


#3

You can change line 27 to point towards “Location” and delete lines 30 & 31…
You can then insert a few additional IF blocks right below that location block.

IF Time is between Sunrise and Sunset
    Set Light1 level to 90%
    Set Light2 level to 100%
END IF

IF Time is between Sunset and 11PM
    Set Light1 level to 50%
    Set Light2 level to 40%
END IF

IF Time is NOT between Sunrise and 11PM
    Set Light1 level to 3%
    Set Light2 level to 10%
END IF

(Notice this last IF is written inverted so as not to span midnight)


#4

Thank you very much for the info! I will give it a try and update the post with my edited example. :wink:


#5

I haven’t tried it yet, but will try this first to see if configuring two devicess time periods with differentiation in light levels works.


#6

I would change line 41 to say IF motion sensor’s motion stays inactive for 4 minutes, then turn off the light.


#7

Agreed. Your wait of 5 minutes may have unintended consequences with your triggers. (See TCP (Task Cancellation Policy)

And just a suggestion…some bulbs will turn on with the Set level command. You might be able to remove the turn on commands - thus avoiding a situation where the lights turn on at an undesired level (very bright in the darkness, etc.). That way your lights may turn on at your desired level. Your mileage may vary…:grinning:


#8

Thanks for the advice! Still trying to learn the UI to figure out how to add an inactivity with duration condition.


#9