All automations turn off and become uneditable

I think the easiest way is to restart HA to clear out the old log entries and if the automations come back as disabled/uneditable then look at that point.

It’s true I may have edited the automations.yaml. I was trying a lot of things, so it’s hard to say. I copied the text in the file to my notepad to make it easier to reproduce the automations, and then deleted everything in the automations.yaml and saved it, hoping I could just start over and create all new automations. Unfortunately, whenever I create them in the automation editor now, they don’t show up in the list (of automations). I click save and it just disappears into the ether. But they are getting written to the automations.yaml file, even though they don’t work. How do I get out of this?

Can you post a couple of the automations here (correctly formatted) so that we can see the form that they are in from the file you saved?

I removed all of the automations and cleared the automations.yaml file, so there aren’t any left at this point. I’m hoping to find a way to just start over and create new automations via the automation editor, but whenever I create one and hit save, it won’t show up on the list, even though it does get written to the yaml file. None of them work though, when triggered.

Did you also do an automations reload when you cleared that file manually?

Sure, here are the first two, as written to the automations.yaml file from the automation editor: (sorry about that!)

- id: '1611154306723'
  alias: Kitchen Pantry Light Switch on
  description: Switch will turn on with motion
  trigger:
  - type: turned_on
    platform: device
    device_id: 18e3f6fa3118924a1061ff1a7a7444de
    entity_id: binary_sensor.wink_unknown_type_0101_id_0001_sensor
    domain: binary_sensor
  condition: []
  action:
  - type: turn_on
    device_id: fda29f270f5469c9eff8495f698338f2
    entity_id: switch.pantry_light_switch_switch
    domain: switch
  mode: restart
- id: '1611156529885'
  alias: Kitchen Pantry Light Switch off
  description: light turns off after 1 minute of inactivity
  trigger:
  - type: turned_off
    platform: device
    device_id: 18e3f6fa3118924a1061ff1a7a7444de
    entity_id: binary_sensor.wink_unknown_type_0101_id_0001_sensor
    domain: binary_sensor
    for:
      hours: 0
      minutes: 1
      seconds: 0
  condition: []
  action:
  - type: turn_off
    device_id: fda29f270f5469c9eff8495f698338f2
    entity_id: switch.pantry_light_switch_switch
    domain: switch
  mode: single

Yes, I’ve reloaded the automations as well as restarting Home Assistant. Multiple times. :frowning:

edit your post and put three back ticks (```) on the line before and then again on the line after your code block.

OK, let’s recap…

right now you have a completely empty automations.yaml file?

And you have no automations at all listed in the automations GUI editor page?

And you have an entry in your configurations.yaml file for including the automations.yaml file?

automation: !include automations.yaml

and you have restarted HA and have no errors in the log file?

Ahh…I do NOT have that line in my congurations.yaml file. I did at one point, but took it out thinking maybe that’s what was causing the problem. Let me see what that does.

yes, you definitely need it.

Apparently I did, THANK YOU! My automations are showing up now and they also work when triggered. I’ll go ahead and rebuild them and stay away from the automations file from now on. Thank you thank you thank you! I’ve been struggling with this forever (okay, maybe just 2 days but it feels like forever)! One last question, I remember taking 3 lines out of my configuration.yaml. What would the other two have been? Scripts and scenes?

1 Like

Well…I wasn’t there… :wink:…but if you are missing those too then I would say yes those are probably it. :slightly_smiling_face:

I don’t use the editors for anything but I know you need the include for scripts.yaml and I’m pretty sure that you need the include for scenes.yaml (which i don’t use at all even in yaml so I don’t know much about what’s needed for those).

Haha…fair enough. They were three very similar lines, so I guess I need to put the other two back in. Thanks so much for your help!

1 Like

I believe this is no longer true. I’ve created ALL of my automations via UltraStudio and can edit all of them in the UI today. It’s been a year since your comment, so perhaps the UI editing has been improved.

Technically exactly what I said is no longer true. But in practice it is generally still true.

you can only edit manually created automations via the UI editor if you have added an “id:” line in the automation config AND they are stored in the automations.yaml folder.

I only add id’s to any automations that I have trouble with so I can troubleshoot using the automation trace so only a few of my automations contain them.

And I don’t store my automations in that folder since all comments are wiped out and the order of keys gets changed.

So in practice I can’t edit mine thru the UI.

Agreed. This all came up in a lively discussion on Discord yesterday. At that point, I figured out (remembered, actually) that the reason all of my hand-edited automations are editable is that I have an id: on each one. I don’t edit them with the UI ever, though, since like you say, it would wipe out my comments.

I may at some point separate them into two files so that I may use the UI, but atm I just use it to show me the basic YAML if I’m having trouble with format.

i believe tho (and may be wrong) that just having any automation stored in the automations.yaml file will also automatically wipe out comments even if you never edit them thru the UI.

I think…maybe…

I think there was a “PSA” by Taras a while back in which he was caught out by this and the end result wasn’t a very happy surprise. I’ll see if I can find it since I may be misremembering the issue he had.

Here it is:

and it seems as if the issue happened when he edited a single automation via the UI editor and when he saved that one automation HA reformatted the hole file and wiped out every comment.

So if you never save an automation via the editor you should be OK.

So beware of even trying it.

This.

I highly recommend separating manually created automations from the ones composed using the Automation Editor.

If I recall correctly, I was helping someone and wanted to try an experiment with the Automation Editor. One thoughtless click of the Save button and everything that had been commented out was toast (and my automations were reformatted into the Automation Editor’s preferred style).

2 Likes

Excellent points, and I think I did somehow know that, because I’ve never even really built an automation using the UI, because of fear of corruption. But as Taras points out, perhaps it’s time to move mine to another file, just to be safe. It’s one line of YAML to change, a renamed file, and a restart. Worth it. Cheers.

1 Like