Switch group entity would not always turn all members off

Hi all,

I’m struggling with an issue I can’t seem to wrap my head around, hoping someone here can add some pointers.

I have a group G. It is made of 3 switch entities, call them S1 S2 S3. All three are Shelly Gen2 devices if that matters (2pm+), controlling my yard lights.

I have a simple automation that turns the entire group on (service Switch Turn On) and off (similar) upon sun set/rise. This works well, normally.

Now, S2 is physically located near our back door. At times, when we walk in at night(!), we flip its physical switch (not button) from its usual off state to on - by mistake, meaning to switch the inhouse lights on (adjacent switch). No harm, S2 remains on, all good. BUT, the next morning, the automation that turns off the lights at sunrise, seems to turn off only S1 and S3, leaving S2 on. (Remember the automation turns off a group helper). Logbook shows exactly that - entities S1 and S3 are turned off on that morning, nothing wrt S2. Trace of automation shows the right thing happening in terms of logic (quite simple), ending with the service call to turn off group G.

Now the weirdest bit - this happens almost every time we make that error (i.e. certainly not a one-off), and the S2 light remains on, BUT I cannot for the life of me reproduce the problem manually. I just, again, tried to do: (1) switch the group ON (2) turn the S2 physical switch from off to on (3) switch the group OFF (by calling the service). Lo and behold, seems to do the right thing (all off). Time and again. Ugh.

Help? Any insights or directions would be gratefully accepted!

HA at 2023.10.5.

What mode do you have the S2 switch set to in the Shelly device?

Switch mode is “Follow”. Input mode is “Switch”. @tom_l

Try setting the button type to “Edge”. As your physical switch is essentially in a two-way switch set up with home assistant.