Basic Home Automation not Working

I’ve tried to get the most basic automation to work without any luck. The objective was to get one switch to turn off at a particular time or after a lapse of time. When I add an automation using the UI it never shows up in the UI but does create an automation entry in automation.yaml. I reload the automation and even restart the system without any luck. I pared down my configuration.yaml to the most basic thing which is:

   # comment...
   default_config:
      group:  !include groups.yaml
      automation:  !include automations.yaml
      script:  !include scripts.yaml
      scene:  !include scenes.yaml

The automations.yaml that was created through the UI is:

- id: '163923846521'
   alias:  Test Hallway Off
   trigger:
   - platform: time_pattern
     minutes: '2'
   condition: []
   action:
   - service:  Light.turn_off
     target: 
       device_id: a2feccad70ebec7d2fe403e174162207
   mode: single
 -id: '1639239730138'
  alias: hallway light off at 15:37
  description: 'test'
  trigger:
  - platform: time
    at: 15:37
  condition: []
  action:
  - service: Light.turn_off
    target:
       device_id: a2feccad70ebec7d2fe403e174162207
  mode: single

I am using a raspberry pi4 with HA Supervised installed if that helps.

Any help would be greatly appreciated.

Thanks

   trigger:
   - platform: time_pattern
     minutes: '2'

will only trigger 2 mins past the Hour

if you are new to this have 1 automation for one job until you get you head around the logic

You missed the space between the dash and id here:

Also your indentaion is inconsistent. One space in the first automation, two in the second. Use two spaces everywhere.

A better trigger for the off automation would would be:

 - id: '163923846521'
   alias:  Test Hallway Off
   trigger:
     - platform: state
       entity_id: light.your_halway_light_here # change this
       from: 'off'
       to: 'on'
       for:
         minutes: '2'

Sure that would be great!

Thanks, I didn’t do a copy/paste but rather hand typed it and made a mistake. Good eye!

It’s always better to copy/paste exactly what you have so that we are all working from the same initial conditions as what is in your code.

Sorry about not doing a copy/paste but my primary computer is Windows based while HA is on the PI. In any event the automations.yaml is computer generated through info I put in the UI. The real questions are why is the UI entry not showing up in HA and more importantly why isn’t the automations.yaml being executed. Thanks again for everyone’s help.

The problem is that can’t answer the “real question” if we don’t have an accurate copy of your configuration.

If you are using the UI, there is a yaml mode you can switch to and copy from. You can then switch back.