Just wanted to provide an example of the new “group_all_on” attribute for scenes/groups:
I have a scene “All Kitchen Lights” which shows as on when any light in the kitchen is on. I would like a quick way to turn on ALL of the kitchen lights, even if some are already on. The Lovelace yaml below will add a Custom Button Card that when pressed, will turn on all of the kitchen lights, even if some are on. If they’re all on, then tapping the button will turn them all off again. Long-pressing the button will turn them off regardless of the current state.
- type: custom:button-card
entity: switch.all_kitchen_lights
name: All Kitchen
show_label: true
label: >
[[[
if (entity.state === "on") {
if (entity.attributes.group_all_on === "on")
return "All On";
else
return "Some On";
}
else
return "All Off";
]]]
tap_action:
action: call-service
service: >
[[[
if (entity.attributes.group_all_on === "on")
return "switch.turn_off";
else
return "switch.turn_on";
]]]
service_data:
entity_id: switch.all_kitchen_lights
hold_action:
action: call-service
service: switch.turn_off
service_data:
entity_id: switch.all_kitchen_lights
styles:
label:
- font-size: small