Hello
I need your help as I am not finding what’s wrong with the following automations. This first one is not giving an error in home-assistant.log while the second one does (if I am commenting the second automation, the error is gone)… I do not know why … Bug in HA 0.117.4 ?
- alias: send_email_temp_unknown_m
initial_state: true
trigger:
- platform: template
value_template: '{{ (as_timestamp(states.sensor.h_temp_piscine_m_corrected.state)) < (((as_timestamp(now())) | int) - 1800) }}'
condition:
- condition: state
entity_id: input_boolean.pool_temp_lost_m
state: 'off'
action:
- service: input_boolean.turn_on
data:
entity_id: input_boolean.pool_temp_lost_m
- service: notify.message_ha
data_template:
message: '{{ now().strftime("%Y-%m-%d %H:%M:%S ") }}**** DM-008.1 Température piscine Montréal inconnue... Sending Email to alarm'
- service: notify.email_to_alarm
data:
title: '** HA - Température Piscine Montréal inconnue **'
message: '**** DM-M001.1 {{ states.sensor.date.state }} {{states.sensor.time.state}} ****'
#=================================================================================================
#
# Automation for MONTREAL
# send Email si temperature piscine de nouveau connue
#
- alias: send_email_temp_known_m
initial_state: true
trigger:
- platform: template
value_template: '{{ (as_timestamp(states.sensor.h_temp_piscine_m_corrected.state)) > (((as_timestamp(now())) | int) - 1800) }}'
condition:
- condition: state
entity_id: input_boolean.pool_temp_lost_m
state: 'on'
action:
- service: input_boolean.turn_off
data:
entity_id: input_boolean.pool_temp_lost_m
- service: notify.message_ha
data_template:
message: '{{ now().strftime("%Y-%m-%d %H:%M:%S ") }}**** DM-009.1 Température piscine Montréal de nouveau connue... Sending Email to alarm'
- service: notify.email_to_alarm
data:
title: '** HA - Température Piscine Montréal de nouveau connue **'
message: '**** DM-M002.1 {{ states.sensor.date.state }} {{states.sensor.time.state}} ****'
Here is the error when HA starts (no error after that):
2020-11-05 13:02:00 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback async_track_utc_time_change..pattern_time_change_listener() at /srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/event.py:1344
Traceback (most recent call last):
File “/usr/local/lib/python3.8/asyncio/events.py”, line 81, in _run
self._context.run(self._callback, *self._args)
File “/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/event.py”, line 1350, in pattern_time_change_listener
hass.async_run_hass_job(job, dt_util.as_local(now) if local else now)
File “/srv/homeassistant/lib/python3.8/site-packages/homeassistant/core.py”, line 434, in async_run_hass_job
hassjob.target(*args)
File “/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/event.py”, line 812, in _refresh_from_time
self._refresh(None, track_templates=track_templates)
File “/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/event.py”, line 961, in _refresh
self.hass.async_run_hass_job(self._job, event, updates)
File “/srv/homeassistant/lib/python3.8/site-packages/homeassistant/core.py”, line 434, in async_run_hass_job
hassjob.target(*args)
File “/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/template/trigger.py”, line 55, in template_listener
entity_id = event.data.get(“entity_id”)
AttributeError: ‘NoneType’ object has no attribute ‘data’