Trigger does not get initialized if "initial_state" is configured (or deleted later)

Hi everyone,

i seem to have a little issue with my automations and i can’t figure out why.

Short description:
I have a deconz gateway which is only responsible for 3rd party zigbee switches and sensors.
In my case they’re all from xiaomi.
Now i configured a bunch of automations for those xiaomi switches, but sometimes they simply don’t get initialized.
I’ve been able to break it down to a really strange behaviour.

My steps for reproducing:

  1. Config: https://pastebin.com/raw/ujLwU3dD
  2. Hass initialized automations correctly
    3: Logs

Mar 10 16:59:30 hass hass[19673]: 2019-03-10 16:59:30 INFO (MainThread) [homeassistant.components.automation] Initialized trigger Turn Kitchen Light on Xiaomi
Mar 10 16:59:30 hass hass[19673]: 2019-03-10 16:59:30 INFO (MainThread) [homeassistant.components.automation] Initialized trigger Turn Kitchen Light off Xiaomi

  1. Apply initial_state like here: https://pastebin.com/raw/aRWTzMkB
  2. Only first automation will be loaded (initialized)
    6:

Mar 10 17:03:41 hass hass[19857]: 2019-03-10 17:03:41 INFO (MainThread) [homeassistant.components.automation] Initialized trigger Turn Kitchen Light on Xiaomi

7: revert to first config and restart
8: Only first automation will be loaded (still)
9:

Mar 10 17:04:41 hass hass[19903]: 2019-03-10 17:04:41 INFO (MainThread) [homeassistant.components.automation] Initialized trigger Turn Kitchen Light on Xiaomi

10: Change names of automations by at least one character
11: Gets initialized correctly
12:

Mar 10 17:05:56 hass hass[19950]: 2019-03-10 17:05:56 INFO (MainThread) [homeassistant.components.automation] Initialized trigger Turn Kitchen Light on Xiaomi Button 1
Mar 10 17:05:56 hass hass[19950]: 2019-03-10 17:05:56 INFO (MainThread) [homeassistant.components.automation] Initialized trigger Turn Kitchen Light off Xiaomi Button 2

If i’m setting “initial_state” for this now, only the first automation will be loaded until i change the name.
Changing the name if “initial_state” is present does not make a difference. Only one automation gets loaded.

Both automations only get loaded if don’t set initial_state and change the name if initial_state was configured for the automations name before.

My Goal was to just use one button for turning a group of lights on and off, which i thought shouldn’t be that hard.

I hope i described it clear enought to understand and would appreciate any help…

If more logs are needed please poke me for it and i will provide them.

Thanks in advance,
Kedakai.


EDIT:

Okay, i seem to have misinterpreted the “initial_state” variable quite a bit.
homeassistant.toggle as an action solved my issue.

However it is strange that the automation doesn’t get initialized after initial_state has been deconfigured and the name of the automation hasn’t changed. Seems more like a bug to me.