Time_pattern not firing at all

This is a bit long but there is a lot of detail here so please stay with me.

I wrote code in yaml to fire every 30 minutes to evaluate the quality of the daylight outside and then update a sensor to reflect the results. The time pattern did not fire at all but when clicking on the automation and running manually, everything worked as designed.

- id: "House - Update Daylight Status"
  alias: "House - Update Daylight Status"
  description: "House - Update Daylight Status"
  triggers:
    - trigger: time_pattern
      minutes: "/5"
  conditions:
    - "{{ is_state('input_boolean.house_auto_mode', 'on') }}"
    - "{{ is_state('input_boolean.house_auto_outside', 'on') }}"
    - "{{ is_state('input_select.house_status_dropdown', not 'Vacation') }}"
    - condition:
        - or:
            #        - "{{ states('weather.great_ecobee', 'condition') == 'partlycloudy' }}"
            - "{{ states('weather.great_ecobee', 'condition') == 'cloudy' }}"
            - "{{ states('weather.forecast_home', 'cloud_coverage') | int(0) > 78}}"
            - "{{ states('sun.sun', 'below_horizon')}}"
  actions: 
    - action: input_select.select_option
      target:
        entity_id: input_select.daylight_status
      data:
        option: Dark
  mode: single

I then thought that since I already had one automation that was working with time_pattern, I would go back and change the automation to the old way - replacing trigger with platform and actions with action. The exact same script also did not trigger automatically (every 5 mins in this example) but also worked when ran manually.

Finally, I broke down and went to the UI (I know, don’t hate me :slight_smile: )_

The UI wrote the code in what I feel is more verbose way but what the hell, had it had worked, I would have been fine with it, but it also did not fire automatically! However, when I ran it manually, it ran fine. The UI automation below:

- id: "1734547033948"
  alias: House test Every 30
  description: HTest Every 30
  triggers:
    - trigger: time_pattern
      minutes: "/5"
  conditions:
    - condition: state
      entity_id: input_boolean.house_auto_mode
      state: "on"
    - condition: state
      entity_id: input_boolean.house_auto_outside
      state: "on"
    - condition: state
      entity_id: input_select.house_status_dropdown
      state: not 'Vacation'
    - condition: or
      conditions:
        - condition: state
          entity_id: weather.great_ecobee
          state: cloudy
        - condition: state
          entity_id: weather.forecast_home
          state: cloudy
        - condition: state
          entity_id: sun.sun
          state: below_horizon
  actions:
    - action: input_select.select_option
      target:
        entity_id: input_select.daylight_status
      data:
        option: Dark
  mode: single

So now I have three different automatons that work when run manually but will not fire every X mins. In fact, to be clear, they do not fire at all unless manually told to do so.

System Info:

  • Core2024.12.4
  • Supervisor2024.12.0
  • Operating System14.1
  • Frontend20241127.8

The other automation that runs fine starts like the below:

- id: "House - Auto Set Sleep"
  alias: "House - Auto Set Sleep"
  description: "House - Auto Set Sleep"
  triggers:
    - trigger: time
      at: "22:30:00"
    - trigger: time_pattern
      minutes: "/10"
  condition:

I know this worked as of last Sunday as I hosted a party and the shutdown did not happen until 1:30AM which means, it was the time_pattern part of the automation that handled the shutdown as it was was past 22:30.

I have spent a lot of time on this and do not understand why a simple time pattern will not fire when told to do so. Any help will be most appreciated. This is a relatively new install from a few months ago so it is not like it has been running for years like some of my previous installations which underwent many upgrades. This is clean.

Many thanks

Craig

As described in the docs, the Run command skips all the triggers and conditions. Since your automation’s issues are in the Conditions block, they had no effect on the results from a Run command.

Neither the YAML nor Jinja shown above are valid. The states() function does not take attributes as arguments, you need to use state_attr() or is_state_attr() as shown below.

   - condition: or
     conditions:
       # - "{{ is_state_attr('weather.great_ecobee', 'condition', 'partlycloudy') }}"
       - "{{ is_state_attr('weather.great_ecobee', 'condition', 'cloudy') }}"
Another option
   - or:
       # - "{{ is_state_attr('weather.great_ecobee', 'condition', 'partlycloudy') }}"
       - "{{ is_state_attr('weather.great_ecobee', 'condition', 'cloudy') }}"

Nor is the above valid… I think what you are going for is:

{{ not is_state('input_select.house_status_dropdown', 'Vacation') }}

Or maybe you actually do have an option “not ‘Vacation’”…? If you do not the condition above should be:

    - not:
        - condition: state
          entity_id: input_select.house_status_dropdown
          state: Vacation

The latter, except vacation. So, thanks for pointing out the real issue and the fix. It is working now.

I have two questions that you may or may not be able to help with:

1- Why no errors in the logs for the code that I wrote in yaml that was clearly wrong
2 - Why did the GUI not work at all - and why no errors there either?

Much appreciate the fast response and the correct identification of the solution.

Cheers.