Change automation state

Hello, i have an automation like:

    automation:
      - alias: Door alarm
        hide_entity: True
        initial_state: 'off'
        trigger:
          - platform: state
      ...

How can I change the state from a script or another automation? It’s possible? Thanks!

Hi @josepgarcia, if you mean the initial_state of the automation

service: automation.turn_on # or turn_off
entity_id: automation.your_automation
1 Like

Thanks! my final code:

    automation:
      - alias: Door alarm
        id: door_alarm
        hide_entity: True
        initial_state: 'off'
        trigger:
          - platform: state
        .........

scripts.yaml

door_alarm_on:
  alias: 'Door alarm on'
  sequence:
     - service: automation.turn_on
       entity_id: automation.door_alarm