Help combining two pistons


#1

I have one piston which turns a light on at full brightness when motion detected early evening, and one which turns it on at minimum brightness if current mode is either dinner party or night.

As the trigger and light is the same for each, for neatness I’d like to combine both into one piston but im a newb and not sure how to do this without it breaking.


#2

If they are working…I try to keep things simple.

You can however copy each If portion and paste it in the other Piston.

As long as you have separate If sections, then they will be evaluated. Be careful with the timers and know the difference between conditions and triggers.

Also be mindful of asynchronous vs synchronous. Async is evaluated regardless of where it’s at. Synchronous goes in order so if there is a wait in an If section and the next If section is synchronous, then it has to wait for the wait period in the above If section.


#3

Pick one of the pistons to edit. Delete the other.

Click on the set level command. You can add an option of of only during this mode. So add both set levels and let the modes determine which one it sets. Like below

image


#4

Thanks @c1arkbar . That wont work as I dont have a mode for the early evening time portion (and dont want to create/use one)


#5

You could break things up into time.
For example.
IF
Motion detected
AND
Lux below 30

THEN
IF
Time is between 0800 an 1000
WITH
Light
DO
Set Level 50
Wait 2 mins
Turn off
IF
Time is between 1000 an 2000
WITH
Light
DO
Set Level 100
Wait 2 mins
Turn off
IF
Time is between 2000 an 0800
WITH
Light
DO
Set Level 20
Wait 1 min
Turn off

Get the idea.


#6

Thanks @rontalley i couldnt see how to paste (copied fine but no paste option when right clicking)

I just reinput it all manually.

Is this right???


#7

If you put the command you don’t have the mode for first and then the one that you do have the modes for second it would work and cut your code base in half