Gate opens alone after HA start

Hey guys,

I have a Zigbee switch that allows us to open the garage gate through ha.
I created a simple automation that basically opens and closes the gate through a physical switch.
The problem is:
If I restart HA, the garage gate is opening alone, without driving the switch or something.

Automation follows:

alias: Garage gate open and close by switches
description: >-
  Opens or closes the garage gate through the garage switches and the Lower corridor.
triggers:
  - type: changed_states
    device_id: e5b7a26b9c3325bee2a07c0ff2e039ae
    entity_id: 5ef4c453ebe9f6c8476594d25ffe0959
    domain: switch
    trigger: device
    id: Interruptor Garagem
  - type: changed_states
    device_id: d83e155b84f5f73964c84b21fa0cd8ff
    entity_id: be15c51b748a48eed47f33a13f7e3bf4
    domain: switch
    trigger: device
    id: Interruptor Corredor Inferior
  - trigger: homeassistant
    event: start
    id: HA Start
conditions:
  - condition: state
    entity_id: input_select.status_automacao_apos_inicio_ha
    state: "sucesso: Automações liberadas"
actions:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - Interruptor Garagem
              - Interruptor Corredor Inferior
        sequence:
          - type: toggle
            device_id: 9614b3b769c8d6d2f54625b513044bbb
            entity_id: c2fe224ec7266544a2edb6816548d631
            domain: switch
      - conditions:
          - condition: trigger
            id:
              - HA Start
        sequence:
          - action: persistent_notification.create
            metadata: {}
            data:
              message: Hart and Script of the Ignored Switch Gate
mode: single

https://community.home-assistant.io/t/why-and-how-to-avoid-device-ids-in-automations-and-scripts/605517

changed_states

The above trigger is your problem. You set it to trigger on any state change. When HA restarts, it goes to “unavailable”, which triggers your automation.