Not all light switches turning on or off when triggered together


#1

1) Give a description of the problem

I have a simple piston that turns 2 sets of outside lights on at sunset and then off at midnight. This morning when I got up, one of the 2 sets was still on. When I got home tonight, the other set didn’t come on.

2) What is the expected behavior?
Both switches should turn on and off together

3) What is happening/not happening?
Only 1 light is turning on or off (different each time)

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

execute
if Time is between {$sunset} and 12:00:00 AM then
with Front Door Lights and Garage Door Lights do
Set level to 100%;
else
withFront Door Lights and Garage Door Lightsdo
Turn off;
end with;
end if;
end execute;

5) Attach any logs (From ST IDE and by turning logging level to Full)


#2

Depending on network traffic in my house (downloading or streaming videos etc) occasionally if ST tries to send a command to multiple devices at the same moment, one may get lost along the way. By splitting up the devices into it’s own block of code, there is a few milliseconds delay between the commands, and my success rate is much higher.

The way I code this is:

Every day at sunset
    With Front Door Lights
        Set level to 100%
    End with
    With Garage Door Lights
        Set level to 100%
    End with
End every

Every day at midnight
    With Front Door Lights
        Turn off
    End with
    With Garage Door Lights
        Turn off
    End with
End every

Both blocks can be in the same piston, just make sure the first block closes with the END EVERY before beginning the ‘midnight’ block of code.


On really STUBBORN lights, I have occasionally been known to do a little trick like this:

With Garage Door Lights
    Turn off
    Wait 1 second
    Turn off
End with

Overkill, perhaps, but it helps make sure the signal goes thru.
(especially on devices far from the modem/router/hub/mesh network)