1 push buttton for toggle lights

So I have a push button and a couple of lights smart lights in my room. i want those to turn on and off with one single button. but i don’t want to use toggle lights. Why? Well if i turn 1 light off (there are 6 in my room) via google home or so and i push the button all 5 other lights go off and the one i turned off goes back on.

How would you guy’s fix this i know this is probably a stupid question but id would help so much :smiley:

Thanks already

So you need to decide if ‘any lights on’ means on or if ‘any lights on’ means off. Personally, I go with the ‘any lights on means on’ route.

service_template: >
  {% set lights_on = states.light | selectattr('entity_id', 'in', expand('group.my_lights')) | selectattr('state','eq','on') | list | count > 0 %}
  light.turn_{{ 'off' if lights_on else 'on' }}
data_template:
  entity_id: >
    {{ expand('group.my_lights') | join(', ') }}
1 Like