Trigger automation every 30 minutes

Strangely I could not find someone else running an automation every 30 minutes, especially now that the time and time_pattern have been split. The below automation gives me an error that the expression never matches. Can anyone tell me the impossibly easy fix for this?

- id: '1566013161054'
  alias: Aquarium Powerhead Timer
  trigger:
  - hours: ''
    minutes: '/30'
    platform: time_pattern
    seconds: ''
  condition: []
  action:
  - data:
      entity_id: switch.aquarium_powerhead_switch
    service: switch.toggle
Error doing job: Exception in callback <function async_track_utc_time_change.<locals>.pattern_time_change_listener at 0x7fde805deea0>
Traceback (most recent call last):
  File "uvloop/cbhandles.pyx", line 68, in uvloop.loop.Handle._run
  File "/usr/src/app/homeassistant/helpers/event.py", line 395, in pattern_time_change_listener
    calculate_next(now)
  File "/usr/src/app/homeassistant/helpers/event.py", line 380, in calculate_next
    matching_hours)
  File "/usr/src/app/homeassistant/util/dt.py", line 256, in find_next_time_expression_time
    raise ValueError("Cannot find a next time: Time expression never "
ValueError: Cannot find a next time: Time expression never matches!

Drop the lines for hour and seconds, or replace those empty values with '*' - see the docs.

I appreciate the response, but two things. That didn’t work, I tried deleting and using ‘*’. Also I used the automation editor in the GUI and that’s the code it spit out in the automation.yaml file. So if HA isn’t outputting the correct YAML, then that’s a bug.

I just remembered that I don’t have the latest version. I have 95.4. Has Time Pattern been changed/fixed since then?

EDIT: scratch this, removing the lines did get it working.

The search facility on the forum is here for a reason.

I wouldn’t have known to search that the time pattern automation isn’t formed correctly from the UI if I didn’t know that was a possible issue.

1 Like

Actually I think I messed something up the first time I removed the lines, because now it seems to be working, when I enabled the automation this time, I didn’t get an error message. Thank you!

Actually I just searched on that.

EDIT, pleased you got it working, perhaps post your working config in case anyone has a similar problem :slight_smile:

Definitely a bug in the way the GUI forms the automation in automations.yaml. Removing the hours and seconds line worked. Note that ‘*’ does not work, only removing the lines completely worked.

- id: '1566013161054'
  alias: Aquarium Powerhead Timer
  trigger:
  - minutes: /30
    platform: time_pattern
  condition: []
  action:
  - data:
      entity_id: switch.aquarium_powerhead_switch
    service: switch.toggle
7 Likes

Yep, just stumbled on this on as well. Thanks!

Hi !
Is it possible put a variable (input.number) in place of “/ 30” ?