Logic Problems with two switches and two buttons

I have two switches - see image…

I need two buttons, one for SW1 (Btn1) and one for SW2 (Btn2). When I click Btn1 it should toggle SW1 on/off. So far easy!

When I click Btn2: -

If SW2 is off - SW1 and SW2 should be turned on
If SW2 is on - SW1 and SW2 should be turned off

I have over thought this, so now I am lost in circles. Can anyone point me in to the right solution?

I tried a Group, but when in a Group I can’t turn on/off SW1 without also turning SW2 on or off

Have the action of Btn2 call a script:

sequence:
  - action: switch.turn_{{ 'on' if is_state('switch.sw2', 'off') else 'off'}}
    target:
      entity_id:
        - switch.sw1
        - switch.sw2

Hmm, when saving the script I get - Message malformed: expected a dictionary for dictionary value @ data[‘sequence’][0][‘target’]

Any ideas?

I was apparently a little overzealous with the hyphens… I’ve corrected it above.

Got you :smile: So easy when you know how :rofl:

Many thanks