Not loading automations from packages/automations.yaml


#1

I’m hoping somebody can verify this for me, because I thought i was absolutely going crazy. I have been reorganizing my YAML into packages, and while I used to have a giant file of automations called ‘automations.yaml’, I have been slowing moving each automation into various categorized files where they make sense. However, all the automations that I haven’t moved yet still live in ‘automations.yaml’, which I just moved wholesale into the ‘packages’ folder.

After doing this I had started to notice that some of my automations weren’t even showing up in the dev-states view anymore, and it turns out they were all of the automations in the ‘packages/automations.yaml’ file. I could not figure out why they wouldn’t be loading. The check config button still showed errors in that file, but none of those automations showed up. The “Initialized trigger” line in the log file didn’t show up for any of those particular automations.

Finally, on a whim, I renamed that file to something else, and all the automations in the file showed up again!

Please verify my sanity or lack thereof :slight_smile:


#2

without further code we can’t judge anything much, but you do have a header for automation: in your package?


#3

Yeah I did. I literally just renamed the file. Changed none of the contents.


#4

depending on the way you included your automation.yaml that might be off, can’t just rename it to package. In automation.yaml there wouldn’t have been a header automation: since that is in your configuration.yaml. that included file would only have listed automations.

the package however needs the header automation: since it is in the packages folder (pointed to in configuration,yaml) and can contain any domain, so needs the domain name.


#5

Yep. Totally understood, and I did / do have the “automaton:” header in that file both before and after I renamed it. For the record, all my other packages are working exactly as expected.

I’ll post the entire file here. I’ve renamed it from “automations.yaml” to “general_automations.yaml”. Just ones I didn’t find a better, less general place for yet.

automation:
  - id: homeassistant_upgrade_available
    alias: homeassistant_upgrade_available
    trigger:
      - platform: state
        entity_id: updater.updater
    action:
      - service: persistent_notification.create
        data_template:
          title: 'Home Assistant'
          message: >
            An upgrade to Home Assistant is available (v{{ trigger.to_state.state }}).
            Read the release notes here: {{ trigger.to_state.attributes.release_notes }}

  - id: ifttt
    alias: ifttt
    trigger:
      platform: event
      event_type: ifttt_webhook_received
      event_data:
        action: call_service
    action:
      service_template: '{{ trigger.event.data.service }}'
      data_template:
        entity_id: '{{ trigger.event.data.entity_id }}'
        value: '{{ trigger.event.data.value }}'

  - id: weekday_morning
    alias: weekday_morning
    trigger:
      - platform: time
        at: '06:00:00'
    condition:
      - condition: time
        weekday:
          - mon
          - tue
          - wed
          - thu
          - fri
    action:
      - condition: template
        value_template: >
          {% set temp = state_attr('weather.dark_sky', 'temperature') %}
          {{ (temp > 24) or (temp < 10) }}
      - service: script.turn_on
        data_template:
          entity_id: >
            {%- set temp = state_attr('weather.dark_sky', 'temperature') -%}
            {%- if (temp > 24) -%}script.upstairs_cool
            {%- elif (temp < 5) -%}script.upstairs_heat,script.downstairs_heat
            {%- elif (temp < 10) -%}script.upstairs_heat
            {%- endif -%}

  - id: weekend_morning
    alias: weekend_morning
    trigger:
    - platform: time
      at: '06:30:00'
    condition:
      - condition: time
        weekday:
          - sat
          - sun
    action:
      - condition: template
        value_template: >
          {% set temp = state_attr('weather.dark_sky', 'temperature') %}
          {{ (temp > 24) or (temp < 10) }}
      - service: script.turn_on
        data_template:
          entity_id: >
            {%- set temp = state_attr('weather.dark_sky', 'temperature') -%}
            {%- if (temp > 24) -%}script.upstairs_cool
            {%- elif (temp < 5) -%}script.upstairs_heat,script.downstairs_heat
            {%- elif (temp < 10) -%}script.upstairs_heat
            {%- endif -%}

  - id: christmas_light_6_hour_bump
    alias: christmas_light_6_hour_bump
    initial_state: 'ON'
    # The christmas laser lights will automatically turn off after 6 hours
    # of being on, so this automation will turn them off and back on again
    # after 6 hours.
    trigger:
      - platform: state
        entity_id: switch.outdoor_switch
        to: 'on'
        for: '05:59:00'
    condition:
      - condition: template
        value_template: >
          {{ (now().month == 12) or (now().month == 1) }}
    action:
      - service: switch.turn_off
        data:
          entity_id: switch.outdoor_switch
      - delay: "00:00:01"
      - service: switch.turn_on
        data:
          entity_id: switch.outdoor_switch