Trigger action when 2 Input Boolean switches are on?

I want an automation to trigger when 2 input boolean switches are on.

I’m wondering if threre’s some way of doing it like ‘if switch 1 AND switch 2 are on then trigger an action’ (maybe even if a sensor shows both switches as on then it could trigger the action?)

I know a way of doing it with 2 automations below, but wondering if it can be done with one automation?

- alias: "Switch 1 on - Turn on Switch 3"
  trigger:
  - platform: state
    entity_id: input_boolean.switch_one
    to: 'on'
  condition:
  - condition: state
    entity_id: input_boolean.switch_two
    state: 'on'
  action:
    - service: input_boolean.turn_on
      entity_id: input_boolean.switch_three

- alias: "Switch 2 on - Turn on Switch 3"
  trigger:
  - platform: state
    entity_id: input_boolean.switch_two
    to: 'on'
  condition:
  - condition: state
    entity_id: input_boolean.switch_one
    state: 'on'
  action:
    - service: input_boolean.turn_on
      entity_id: input_boolean.switch_three
- alias: "both on do something"
  trigger:
    - platform: state
      entity_id: input_boolean.switch_one
      to: 'on'
    - platform:state
      entity_id: input_boolean.switch_two
      to: 'on' 
  condition:
    condition: and
    conditions:
      - condition: state 
        entity_id: input_boolean.switch_two
        state: 'on'
      - condition: state 
        entity_id: input_boolean.switch_one
        state: 'on' 
  action:
      [do something]
2 Likes

Ah, that’s it!

Never thought to just put them all into one. Thanks!

1 Like