Time_Pattern Automations Not Formed Correctly from UI Automations Editor

Not sure how one submits a bug report for HA. If this is not the right place please point me in the right direction.

HA 86.4
python 3.6.3

Attempting to use an Automation to turn on a light every 2 minutes. The example is an simplified one to show the error.
Using the Configuration -> Automations takes me to the Automations Editor
Click on the + to create a new Automation and give it a name
Select Time Pattern from the Trigger drop down
Enter /2 in Minutes
Under Action select Service and light.turn_on
In my case I enter { “entity_id”: “light.cabin_night_light” } in Service Data
Click on Save (no errors, it is saved)
That produces the following in automations.yaml

- id: '1551065815347'
  alias: A time test
  trigger:
  - hours: ''
    minutes: /2
    platform: time_pattern
    seconds: ''
  condition: []
  action:
  - data:
      entity_id: light.cabin_night_light
    service: light.turn_on

Which produces the following errors:
Feb 24 18:10:50 XXXXXXXX homeassistant-start.sh[32077]: File “/home/homeassistant/.pyenv/versions/3.6.3/lib/python3.6/asyncio/events.py”, li
ne 127, in _run
Feb 24 18:10:50 XXXXXXXX homeassistant-start.sh[32077]: self._callback(*self._args)
Feb 24 18:10:50 XXXXXXXX homeassistant-start.sh[32077]: File “/home/homeassistant/.pyenv/versions/3.6.3/envs/homeassistant-3.6.3/lib/python3
.6/site-packages/homeassistant/helpers/event.py”, line 368, in pattern_time_change_listener
Feb 24 18:10:50 XXXXXXXX homeassistant-start.sh[32077]: calculate_next(now)
Feb 24 18:10:50 XXXXXXXX homeassistant-start.sh[32077]: File “/home/homeassistant/.pyenv/versions/3.6.3/envs/homeassistant-3.6.3/lib/python3
.6/site-packages/homeassistant/helpers/event.py”, line 353, in calculate_next
Feb 24 18:10:50 XXXXXXXX homeassistant-start.sh[32077]: matching_hours)
Feb 24 18:10:50 XXXXXXXX homeassistant-start.sh[32077]: File “/home/homeassistant/.pyenv/versions/3.6.3/envs/homeassistant-3.6.3/lib/python3
.6/site-packages/homeassistant/util/dt.py”, line 256, in find_next_time_expression_time
Feb 24 18:10:50 XXXXXXXX homeassistant-start.sh[32077]: raise ValueError("Cannot find a next time: Time expression never "
Feb 24 18:10:50 XXXXXXXX homeassistant-start.sh[32077]: ValueError: Cannot find a next time: Time expression never matches!

Changing the automation to the following resolves the issue:
- id: ‘1551065815347’
alias: A time test
trigger:
- platform: time_pattern
minutes: ‘/2’
condition: []
action:
- data:
entity_id: light.cabin_night_light
service: light.turn_on

The Automations editor should format the automation correctly but does not and due to the formatting issues the automation fails to run and throws errors in the log.

You need to use quotes around the input

  - minutes: '/2'
    platform: time_pattern

EDIT: To have it format properly, use /'/2/' inside automation editor. It’s a drawback of using the automation editor.

If you want to have it fixed, write up an issue on github. This issue is present just about everywhere you need a string.

1 Like

For anyone else who arrived here via a search, /2 now works directly in the automation UI editor.

this worked for me