Automations switched back on after clicking on "Reload Automation"

Hi,

I made a group with a few of my automations to disable and enable them. For Christmas Lights or similar.

The Problem is, if I change an automation and click in the HA UI on “Reload Automation”, the disabled automation turned back on by its own.

Restarting, rebooting HA or changing with the automation Editor, holds the state of the automation. Its only the Reload Button.

What can I do?

Set the initial state of the automations you don’t want to be on by default to ‘off’. Then you can turn them on as you desire. Then whenever you restart they will go back to the initial state.

thx for reply.

I already did this for one automation. Its not working, too.

automation.alarm_ausgeloest:
  initial_state: 'off'

The correct way is:

initial_state: false

its not working, too.
Anyway. Its not a real solution I think. If its always off. I have to enable it, if its needed. Why it cant hold the state?

Try with capital F:

initial_state: False

Still not working :frowning:

After “Reload Automation” all switches are back on…

this works for me:

initial_state: 'off'

if it’s not working then maybe there is some other issue.

Is this code within the automation or in the customise section ?

This works great for me (within the automation itself)

- alias: "doors"
  initial_state: False

Its in the customize section.

It needs to be part of the automation itself like @flamingm0e has above

ok thanks this is working.
I did this before in the customize section because the initial_state is shown in the customization tab in the HA UI.

But I think its unfavorable to do this in a configuration file. What I want to use are this switches in the Group. If this switches are not keep there state, they are completely useless.
Maybe I will open an issue on github.

I dont have mine in the customikze section.

it’s directly in the automation and works perfectly fine.

- id: diningroom_lights_on_with_movement
  alias: Turn on diningroom light when there is movement
  initial_state: 'off'
  trigger:
    platform: state
    entity_id: sensor.diningroom_camera_motion
    to: 'on'
  action:
    service: homeassistant.turn_on
    entity_id:
      - light.zw_light_2

yes, it only works for me directly in the automation, too.