Did the behavior of automated schedules change in recent versions of HA? I upgraded to the latest (0.93.1) and since then my scheduled automations no longer seem to work reliably. For instance:
- alias: "School Day Breakfast"
trigger:
platform: time
at: '05:55:00'
condition:
condition: and
conditions:
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
- condition: state
entity_id: input_boolean.sleep_in
state: 'off'
action:
service: homeassistant.turn_on
entity_id:
- switch.coffee_bar_switch
- switch.stove_switch
- alias: "Time For School"
trigger:
platform: time
at: '07:30:00'
condition:
condition: and
conditions:
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
- condition: state
entity_id: input_boolean.sleep_in
state: 'off'
action:
service: homeassistant.turn_off
entity_id:
- switch.coffee_bar_switch
- switch.stove_switch
This worked before but now hasn’t been working for at least a week. I looked to see if maybe it was the input_boolean but that doesn’t seem to be the case. I looked at the docs to see if there might be any changes I missed but didn’t see any. Anyone have any ideas?
I was super confused at first as to what you were referring to but yep that was it!
For others reading this, there is an Automation section under Configuration -> Automation where you can turn the automations selectively on and off. All mine were turned off.
To prevent this from happening again, add initial_state: true to your automations. Automations default to their off state after a reboot of Home Assistant.
That’s not true. They implemented a state saving for automations a few versions back so when you restart home assistant the automations that were off stay off and those that were on return to the on state.
The only time I’ve see issues with the states not saving is when you restart/stop before everything has fully loaded.
Indeed, I was unaware of those changes but actually it’s a nice feature. I previous had a switch in the UI to determine whether or not to skip automation. I’ll probably still keep that but nice to know I have the option to just turn automations off instead.
Also if you run into a situation where all automations are turned off, you can do the service call automation.turn_on without an entity and it will toggle all your automations on.
That used to work in older versions but not any more. You can’t shouldn’t leave the entity_id blank for a service call. If you do, not only will it fail to work, it will log the following warning:
Not passing an entity ID to a service to target all entities is deprecated. Update your call to automation.turn_on to be instead: entity_id: all
EDIT
The old way, leaving entity_id blank, still works but is deprecated (and will probably fail to work in some future release). The new way is to specify all for entity_id.
I tested it and … you’re right. It still works and only issues a warning that the technique is deprecated.
I’ve amended my previous post to reflect this arrangement. Moral of the story is users should adopt the new technique (specify all) as opposed to leaving entity_id blank. However, it still accepts blank.