Lovelace: toggle light group in entity-button card doesn't work as expected

Hi.

In Lovelace, i want to display one button that shows the whether 1 or more lights in a group is on (by a yellow bulb icon), or all off (blue bulb icon). When pressing the button in Lovelace, i want the light group to toggle status (so from off to on, or from on to off).

I have the following code:

  - type: entity-button
    entity: light.living_room_central # group.living_room_group
    name: livingroom
    id: livingroomlights
    tap_action: toggle
    hold_action: more-info
    service: homeassistant.turn_on
    service_data: group.living_room_group
    icon: mdi:lightbulb-on

I do get a button with a bulb, the bulb is yellow or blue depending on the state of light.living_room_central . But when i press the button, only that lamp is toggled. Based on the last 2 lines of code, i would expect all bulbs in the group to toggle.

As you can see, i also tried using “group.living_room_group” in the 2nd line of the code: than the group gets toggled, but the button stays blue (so doesn’t show whether a light in the group is on).

when you use toggle as the tap action, the card does not use a service call. If you want to toggle another item, change tap_action to call-service, and then use homeassistant.toggle as the service.

  - type: entity-button
    entity: light.living_room_central
    name: livingroom
    id: livingroomlights
    tap_action: call-service
    hold_action: more-info
    service: homeassistant.toggle
    service_data: group.living_room_group
    icon: mdi:lightbulb-on

Thanks for your reply @petro. Changed the code. I now do have an icon showing the correct status, but upon pressing the button, i see in the UI a call to homeassistant.toggle is made, but the lights in the group don’t change. (Btw, while trying to solve this, i also learned a toggle on a group also means if not all lights are on, the ones that are off, actually will turn on … but leave that for now)

try changing it to group.toggle then.

Sorry, didn’t a notification you replied … still don’t have it working…

Fiddled around some more, and while on 0.84.6, this works for me:

  - type: entity-button
    entity: group.livingroom_lights_group
    name: livingroom
    icon: mdi:toggle-switch 
    tap_action:
      action: toggle 
      service: toggle 
      service_data: group.livingroom_lights_group
2 Likes