I have all up to v.0.85.0 been able to use the following automation, but after upgrading to 0.85.0, Im not able to trigger this anymore.
I dont get anything in the log (I have set all relevant component loggings to debug), and the individual triggers like input_boolean and switc works.
I really have noe idea how this could happen.
# Activate Stue Normal mode
- alias: 'Stue Scene Normal'
trigger:
- platform: state
entity_id: switch.stue_mode_normal_mem
from: 'off'
to: 'on'
- platform: state
entity_id: input_boolean.enable_stue_normal
from: 'off'
to: 'on'
action:
# Notify
- service: script.google_home_say
data:
google_home_entity: media_player.stue
volume: 0.2
message: 'Normal modus aktiveres.'
# Activate Light scenes
- service: scene.turn_on
entity_id: scene.stue_normal
# Reset (modeflags in Dimmer 2)
- service: homeassistant.turn_off
entity_id: switch.stue_mode_normal_mem
# Reset UI switch
- service: input_boolean.turn_off
data:
entity_id: input_boolean.enable_stue_normal
# Log
- service: script.logbook_entry
data:
entry_name: 'Stue mode:'
entry_message: 'Normalmode is activated'
You shouldnât need to do initial_state to on, I donât have that on any of my automations.
Do you see the automation on/off switch on the front end? Is it turned on after reboot? It should be, if it was turned on before the reboot, even without initial_state being set.
If itâs on, but not triggering, then itâs probably not initial_state.
Iâd look to see if any recent breaking changes affected something. But not all are always decremented - I just had an automation break because the IMAP component changed naming policy, didnât see that documented anywhere.
I did a quick test now, and set the automation to âonâ.
This solved my problem!
I have nnever needed to turn them on before, so I didnt realize that this was expected.
This has hapened after the upgrade to 0.85.0.
I guess I have to set the initial state to on, as @Klagio
Thanks for the help!
You missed the Breaking Changes on 0.84.0. Simply call service âautomation.turn_onâ without an entity once. That will bring them back on, even after HA restarts.
@m0wlheld Haha funnyâŚI skipped 0.84.0 since the telldus and volvooncall had bugs in them, so I didnt pay to much attention to that release.
Wish I had seen your post earlier, I just finishe settings initial_state: âonâ on all 30 automationâŚ
Thanks for the tip
And you really shouldnât unless you really want them all to be turned every single time you restart HA.
Letâs say for example that you have an automation that you only want on under certain conditions. Sometimes you might turn it off for some reason. (I have some of those right now). Then the next time you restart HA or reload your automations the automation will automatically be turned back on. This could be undesirable.
If you leave out the initial state then the automation state will be remembered across restarts and after the restart it will still be in the same state that it was in before restarting.
I wish the documentation was better at explaining this so people would stop advising others to do the wrong thing.
Yep but once a change was made, it was a better option to turn them all off rather than turn them all to on. No developer wants to be responsible for a house burning down because a heater came on because a default changed,
Anway now there are three perfectly sensible options:
initial_state: on - automation will be on when HA starts - you are right, this is probably what most people want.
initial_state: off - automation will be off when HA starts - you are also right, I am not sure why you would want this, but some people may be trialling stuff and not actually want some testing version to be on by default.
no initial_state defined - automation on/off state is preserved across reboots. This in fact what most people want, they just donât know it!
I use this for some notification automation because on a HA restart I was getting notified in error since the devices hadnât initialized completely. It was easier to have those off initially and have another automation turn them on 5 minutes later than to create a more complex trigger/condition template for a bunch of automations.
And I think you are exactly right on this.
And thanks for nudging me to make the change to the docs for this. I submitted the change request and it`s been incorporated already. It was way easier this time.