I’ve been using HA for a while, currently on 0.100, and since around 0.70 I’ve found some of my automations to be unreliable. I’m not sure how to troubleshoot as I haven’t found any relevant logs.
Some automations just stop working. They do work at first, then stop. I’ve confirmed that the required thresholds are met, but the automation isn’t triggered… Or maybe it is triggered but is stopped due to a condition. I haven’t found any logs that show the automation process. But all the criteria are being met.
The thing is, if I go in to the HA web interface, go to automations, and turn the broken automation off and on, it start working again… For a while…
This doesn’t seem to happen with all automations, it’s mostly ones that have numeric triggers or conditions that are referencing temperatures, and conditions based on climate states. Not sure if any of those are relevant.
Is this something other people have run in to? Are there some logs somewhere that might show some details of what’s going wrong?
If you post one of the automations you’re having trouble with we may be able to comment on why it might not be working as you expect.
Regarding logs, have you looked in home-assistant.log? There should be enough detail there to give you some clues. If not, you can try enabling some additional debug information with:
logger:
default: info
logs:
homeassistant.core: debug
Automations with numeric_state in the trigger will only trigger if the state goes below or above the threshold you’ve defined. If it’s already above or below, it won’t trigger. That might be relevant to the issue.
But yes, as Phil said, please post one of the automations.
I have checked home-assistant.log but it doesn’t include any events related to these automations. I’ll add the config to enable debug logging and see if that changes.
This is an example of an automation that breaks, I have a suspicion that the more conditions I add the more likely it is to break, but that’s hard to confirm as I can’t reproduce it intentionally.
- id: '1519218765208'
alias: Bedroom AC Off
trigger:
- below: '21'
entity_id: sensor.bom_brisbane_feels_like_c
platform: numeric_state
condition:
- below: '23'
condition: numeric_state
entity_id: sensor.inside_temperature_bed_room_inside_temperature
- condition: or
conditions:
- condition: state
entity_id: climate.bed_room
state: cool
- condition: state
entity_id: climate.bed_room
state: heat_cool
action:
- data:
entity_id: climate.bed_room
hvac_mode: 'off'
service: climate.set_hvac_mode
- data:
message: ' Outside feels like under 21 and inside is under 23, turning off aircon
at {{now()}}'
title: 'AC Off: Bedroom room'
service: persistent_notification.create
First, are you sure the states of climate.bed_room are still cool and heat_cool? The climate component went through a significant change recently and I’m not sure heat_cool is a valid state. Something to check.
Next, if you enable core debugging, then you may find a script I wrote useful. It will search home-assistant.log for entity state changes and list them out (optionally outputting attributes as well.) I found it a bit easier to use than SQL (not a database guy. ) Let me know if you’re interested.
What used to be just auto is now auto and heat_cool. Although, despite reading the changelog for 0.96 several times, I can’t quite figure out what auto is supposed to be now.
Some notification services (maybe all???) accept templates and process the templates themselves. Which can work fine, unless you want to use the trigger variable, then…
Yeah I’d prefer not to trigger every minute, I’m open to suggestions
I’ve added initial_state: true and changed data to data_template on the persistent notification. Manual trigger worked fine, but I won’t know for a while whether its fixed the issue.
As @Tediore pointed out, the automation will only trigger when sensor.bom_brisbane_feels_like_c changes from a value of 21 or above to below 21, and if at that point the other conditions are met.
Do you want it to trigger whenever all those conditions are met? If so, you could do it with a template trigger:
trigger:
platform: template
value_template: >
{{ states('sensor.bom_brisbane_feels_like_c')|float < 21 and
states('sensor.inside_temperature_bed_room_inside_temperature')|float < 23 and
states('climate.bed_room') in ('cool', 'heat_cool') }}
action:
...
This will trigger whenever the template evaluation changes from False to True.