WTH doesn't toggling > 1 item sync their states

Taken from balloob’s tweet from the main post

Toggling two lights should put them all in the same state. So if 1 light is on and 1 off, toggling them together should make them both on, then next toggle turn both off. (balloob’s twitter)

So in your example, which state should it pick? Random? First entity in the list? Last entity?

Which ever the ‘safe’ state is. For lights on, locks - locked, covers - closed etc etc. I think for most binary states, IIRC HA has already made a judgement on which of the two states is ‘safe’ and ‘unsafe’.

Ok, so this is the current state:

  • light.one: On
  • light.two: Off
  • light.three: Off

When calling toggle on those entities at the same time (in a single service call) right now, it would result in:

  • light.one: Off
  • light.two: On
  • light.three: On

It toggles each one individually. The suggestion by Paulus is to make toggle aware of each other, to get them in sync.

Start:

  • light.one: Off
  • light.two: On
  • light.three: On

After first toggle:

  • light.one: On
  • light.two: On
  • light.three: On

After second toggle:

  • light.one: Off
  • light.two: Off
  • light.three: Off

To sum up: When toggling multiple at the same time, if any of in the group is “on”, turn them all on, otherwise toggle all their states.

…/Frenck

2 Likes

I solved this with template entities as I wanted the behavior that @HarvsG desires. The only way I handle this is that the state of the light is on if any light is on. The turn on and turn off service only turn on all entities or turn off all entities. So when toggle is called, it always turns on or turns off all entities. IIRC this is how light groups or switch groups work, however my configuration predates those and I haven’t bothered switching.

personally, I would not want this.

Why would I want toggle to turn on a missing light when 2 lights are already on? In the 6 or 7 years i’ve been dealing with this, i’ve never once thought: Hey I want to turn on that one light that’s missing, let me just toggle the switch.

Id expect toggle with that state to turn off, and i’d “sync” the lights myself by doing a turn on (on all the entities) for the missing light.

1 Like

Another workaround it putting the lights into a light group and calling the service on the group. Depending on how you define the all parameter will affect if it does off or on first.

But still a workaround.

3 Likes

I have had this problem many times.

I use shortcut buttons as additional light switches for lights that contain multiple lights, by the bed, by the sofa etc so I can toggle lights easily. They work great, however if for some reason not all lights are on or off… Lets just say its a big WAF problem. I have actually heard her shout “WTH”!

Hence why I found my workaround above. However that itself created more problems because now each light entity exists twice and I have automations that call services against all lights that are on which has resulted in duplication and the odd loop… resulting in yet more shouts of “WTH”

Yes, that’s why I said

1 Like

I have the same for every room

if i don’t feel like using voice commands

By ‘shortcut buttons’ I mean these TRÅDFRI Shortcut button, white - IKEA

ah, how long does the battery last on those?

Been 1 year and the lowest is on 74% battery

That’s a pretty good deal for $11, is the battery replaceable?

It is!, Button batteries.

Seems like that integration is local polling though, not push? Are the buttons instant? What integration are you using.

Direct zigbee pairing with ZHA, then firmware update and then this blueprint I edited

https://community.home-assistant.io/t/zha-ikea-tradfri-shortcut-button-firmware-2-3-075-or-greater/402565/3

2 Likes

Ah, ZHA. :+1:

This is exactly how lights groups behave. Create a group with the lights you want to toggle in sync and send the toggle command to this new light entity (the group).

No way!
If I call the toggle service for two independent entities I would expect that each entity toggle independently.
The behaviour you are asking for is already available when using lights/switches groups.