I’m past templating problems but something is amiss with my automation.
I’ve got the template tool in dev tools/template evaluating my statement to TRUE when the temp is >72 and FALSE when it’s less, and the script does exactly what I want it to do (turn on water for 1 minute) but I have 2 problems. The automation never triggers and yes, it is turned on. I can trigger it manually and it runs once. but it won’t trigger by itself and it does not repeat every 4 minutes. This was all created in the automation editor, not by hand.
Copy to clipboard
- id: '1567518945323'
alias: Water on if temp >72
trigger:
- minutes: /4
platform: time_pattern
condition:
- condition: template
value_template: ”{{ state_attr('weather.hopi_house', 'temperature') | int > 72
}}”
action:
- data:
entity_id: switch.water
service: script.1567805755733
I read something about the automation editor malforming these platform automations. Am I running into the same problem? I’m on hassio 0.98.1
I took this screen shot at 3:35pm after manually triggering it. it should have repeated twice by now.
I don’t know if it’s causing the problem, but I always enclose times and time_patterns in quotes. For instance:
- platform: time_pattern
seconds: '/30'
I recommend making a test automation just for the time pattern to make sure that it’s working, and maybe create a persistent notification with the template value in the action to see what it’s evaluating to.
The moment I do that and reload automations, it disappears from the list of available automations which I assume means it’s an error, remove the quotes and it reappears. . I’ve tried both types of quotes ‘ and “
With no quotes, the automation appears again in the list of automations, and then throws this error once per second (not once per min).
Fri Sep 06 2019 19:24:04 GMT-0700 (PDT)
Error doing job: Exception in callback async_track_utc_time_change..pattern_time_change_listener() at /usr/src/homeassistant/homeassistant/helpers/event.py:399
Traceback (most recent call last):
File “/usr/local/lib/python3.7/asyncio/events.py”, line 88, in _run
self._context.run(self._callback, *self._args)
File “/usr/src/homeassistant/homeassistant/helpers/event.py”, line 408, in pattern_time_change_listener
calculate_next(now)
File “/usr/src/homeassistant/homeassistant/helpers/event.py”, line 392, in calculate_next
localized_now, matching_seconds, matching_minutes, matching_hours
File “/usr/src/homeassistant/homeassistant/util/dt.py”, line 264, in find_next_time_expression_time
raise ValueError("Cannot find a next time: Time expression never " “matches!”)
ValueError: Cannot find a next time: Time expression never matches!
Error doing job: Exception in callback async_track_utc_time_change..pattern_time_change_listener() at /usr/src/homeassistant/homeassistant/helpers/event.py:399
Traceback (most recent call last):
File “/usr/local/lib/python3.7/asyncio/events.py”, line 88, in _run
self._context.run(self._callback, *self._args)
File “/usr/src/homeassistant/homeassistant/helpers/event.py”, line 408, in pattern_time_change_listener
calculate_next(now)
File “/usr/src/homeassistant/homeassistant/helpers/event.py”, line 392, in calculate_next
localized_now, matching_seconds, matching_minutes, matching_hours
File “/usr/src/homeassistant/homeassistant/util/dt.py”, line 264, in find_next_time_expression_time
raise ValueError("Cannot find a next time: Time expression never " “matches!”)
ValueError: Cannot find a next time: Time expression never matches!