Binary variable to switch multiple lights

Hello everybody,
ich hab using some smart light bulbs and Zigbee switches in my living room. At the moment I can turn the light on with a single klick and off with a double klick.
I tried to use ‘toggle’ of the light but run in trouble when one light did not turn on and I pressed the button again --> I toggled some lights off and some on and needed to repair it from my mobile.

I have the idea to set a binary variable that will be flipped by the switch and triggers the light to be on or off. I am not yet that familiar with HA and its variables and I am looking for some example where I could learn from or a blueprint.

I also searched the comunity but it was realy hard for me to decide if the solutions I have seed might solve my problem.

Best
F

Create an input_boolean helper (e.g. input_boolean.lights_on) and integrate it in the action: part of your current automations

action:
  - service: input_boolean.turn_on
    entity_id: input_boolean.lights_on

or

action:
  - service: input_boolean.turn_off
    entity_id: input_boolean.lights_on

Take this input_boolean as trigger in another automation, controlling the lights:

trigger:
  - platform: state
    entity_id: input_boolean.lights_on
condition: []
action:
  - service: lights.turn_{{ trigger.to_state.state }}
    entity_id: light.living_room_light

thank you soo mutch, that helped a lot :slight_smile: