To stupid to get simple automation

hey i am not understanding this i am trying to make an automation to lock my doors when i turn my alarm on i have created this automation in automations yamil

alias: lock secure
description: secure home when leaving
trigger:

  • platform: state
    entity_id: alarm_control_panel.alarm
    from: ‘disarmed’
    to: ‘armed_away’
    condition: []
    action:
  • action:
    • service: lock.lock
      entity_id: lock.kwikset_spectrum_brands_unknown_type_0003_id_0541_locked
      from: ‘unlocked’
      to: ‘locked’
      but this does nothing it does not show up in ui nor does it lock the doors can anyone help. I am too stupid to figure this out

First off, be sure to post your code properly, see item 11 in the link below.

Next you possibly have some indentation issues (hard to tell with out the formatted code as noted above) and you have some missteps in the required entries.

The below will trigger when your alarm control panel goes from disarmed to armed_away. Note if your alarm control panel has any other states, it will not trigger this automation if going from say home_armed to armed_away. If you want this automation to trigger any time you put the alarm in armed_away then you should remove the from line.

Next, I removed the condition line as it is not needed if you don’t want to specify any conditions.

After that, you had a duplicate key for your action section. Also, note that trigger, action and condition should be at the same indentation level.

Next, you are calling the service lock.lock and the specifying the entity_id. You do not need to add the from/to section.

  - alias: lock secure
    description: secure home when leaving
    trigger:
      - platform: state
        entity_id: alarm_control_panel.alarm
        from: ‘disarmed’
        to: ‘armed_away’
    action:
      - service: lock.lock
        entity_id: lock.kwikset_spectrum_brands_unknown_type_0003_id_0541_locked

Once you get a few automations and learn a few YAML rules, it gets much easier. Also there is a UI for creating automations with makes things much easier and can help you avoid YAML mistakes and other issues.

so i took out the (from) like you suggested copied and pasted your code exactly as is still same result nothing happens and it does not show up in the ui at all and should there be something in action like
from: unlocked
to: locked
again i am not a programmer
just a fool trying to wrap my head around this

Are you reloading automations after changing things?

Anything in the logs?

Are you seeing a automation.lock_secure in your states tab?

yes i reloaded automation
no i do not see automation.lock_secure in states tab
and i see nothing about it in log file
i have also tried in the ui but it will not save it

my automations.yamil file now looks like this

  • alias: lock secure
    description: secure home when leaving
    trigger:
    • platform: state
      entity_id: alarm_control_panel.alarm
      to: ‘armed_away’
      action:
    • service: lock.lock
      entity_id: lock.kwikset_spectrum_brands_unknown_type_0003_id_0541_locked
      id: f69be8ca2bea4202a30d553cc89f0c2f

but still nothing i just dont understand
i have also tried this;

  • alias: “Alarm - Armed”
    trigger:
    • platform: state
      entity_id: alarm_control_panel.alarm
      from: “disarmed”
      to: “armed_away”
      action:
    • service: lock.lock
      entity_id: lock.kwikset_spectrum_brands_unknown_type_0003_id_0541_locked
      from: “unlocked”
      to: “locked”

Could you please re-format. If using code outside a code marker, indentation and quote characters get fu… altered.

Please learn how to format your post. Use this video as a guide.

Edit your post and follow the video.

solved
it ended up i needed to put
automation: !include automations.yaml
in my config file