All my automations stopped working (and being editable) suddely after editing a script

All of a sudden, I can’t edit any Automations (and none of them works anymore)

According to the UI the reason is

“only automations in automations.yaml are editable”

If I recall it correctly, it happened while I was editing an Automation in the UI, while at the same time changing a Script.

Once I saved the script, automation went bananas.
Scripts works just fine and I can edit them
Restarted everything, reloaded configs, reloaded scripts, and automations. no luck.

If I press the “info” icon, I get this message:

From my config/configuration.yaml

automation: !include automations.yaml
script: !include scripts.yaml

and config/configuration.yaml LGTM and to the File Editor extension

full automations.yaml available here → https://pastebin.com/UF7aEeAC

EDIT: I also tried creating a new Automation from the GUI using the button

Screenshot 2021-03-25 at 12.41.27

I created a simple automation, saved it, went back to http://****/config/automation/dashboard and the newly created automation doesn’t show up.
However, it does get created in the ‘config/automations.yaml’ file

EDIT2:
If I SSH into my system, I can see how the configurations files are stored under /usr/share/hassio/homeassistant directly, and I can’t see any /config subdirectory here.

total 4299028
drwxr-xr-x 10 root root       4096 Mar 25 11:49 .
drwxr-xr-x 12 root root       4096 Mar 25 09:59 ..
-rw-r--r--  1 root root          8 Mar 12 14:56 .HA_VERSION
drwxr-xr-x  2 root root       4096 Oct  6 09:32 .cloud
drwxr-xr-x  2 root root       4096 Mar 25 11:43 .storage
-rw-r--r--  1 root root        519 Mar 24 19:48 aircast.xml
-rw-r--r--  1 root root       8735 Mar 25 11:44 automations.yaml
drwxr-xr-x  3 root root       4096 Jan 11 22:33 blueprints
-rw-r--r--  1 root root       3993 Mar 22 23:28 configuration.yaml
-rw-r--r--  1 root root       1826 Dec  8 17:30 configuration.yaml.save
-rw-r--r--  1 root root       3228 Mar 12 07:13 configuration.yaml.save.1
-rw-r--r--  1 root root         64 Mar 12 06:36 customize.yaml
drwxr-xr-x  2 root root       4096 Oct  6 09:32 deps
-rw-r--r--  1 root root        120 Dec  8 14:59 groups.yaml
-rw-r--r--  1 root root    2008983 Mar 25 11:49 home-assistant.log
-rw-r--r--  1 root root 4399886336 Mar 25 11:49 home-assistant_v2.db
drwxr-xr-x  6 root root       4096 Oct  6 13:35 image
drwxr-xr-x  5 root root       4096 Oct 31 08:57 node-red
-rw-r--r--  1 root root          0 Oct  6 09:32 scenes.yaml
-rw-r--r--  1 root root      16890 Mar 25 11:27 scripts.yaml
-rw-r--r--  1 root root        937 Mar 12 21:31 secrets.yaml
-rw-r--r--  1 root root       7576 Dec  8 15:04 themes.yaml
-rw-------  1 root root       7576 Dec  8 17:30 themes.yaml.save
drwxr-xr-x  2 root root       4096 Mar 12 21:57 tts
drwxr-xr-x  2 root root       4096 Mar 12 06:52 www
-rw-r--r--  1 root root      94208 Mar 25 11:49 zigbee.db

EDIT3: I tried emptying out completely the automations.yaml file using the File Editor, and “Reload Automations” .

Nothing changes and I can still see all the un-usable automations loading up in the GUI, like if nothing happened. Where is it taking the automations from now that I deleted all of them and reloaded them?

I think I am missing something here

Check the logs, must be an error somewhere.
Dont you have a snapshot to restore?

nice tip.

I’ve found this
homeassistant.components.device_automation.exceptions.InvalidDeviceAutomationConfig: Integration '' not found

full log

Copy to clipboard

Logger: homeassistant.setup
Source: components/device_automation/__init__.py:84
First occurred: March 24, 2021, 5:12:41 PM (1 occurrences)
Last logged: March 24, 2021, 5:12:41 PM

Error during setup of component automation
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/device_automation/__init__.py", line 81, in async_get_device_automation_platform
    integration = await async_get_integration_with_requirements(hass, domain)
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 50, in async_get_integration_with_requirements
    integration = await async_get_integration(hass, domain)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 567, in async_get_integration
    raise IntegrationNotFound(domain)
homeassistant.loader.IntegrationNotFound: Integration '' not found.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 213, in _async_setup_component
    result = await task
  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 175, in async_setup
    if not await _async_process_config(hass, config, component):
  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 537, in _async_process_config
    await async_validate_config_item(
  File "/usr/src/homeassistant/homeassistant/components/automation/config.py", line 75, in async_validate_config_item
    config[CONF_ACTION] = await script.async_validate_actions_config(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 144, in async_validate_actions_config
    return await asyncio.gather(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 188, in async_validate_action_config
    choose_conf[CONF_SEQUENCE] = await async_validate_actions_config(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 144, in async_validate_actions_config
    return await asyncio.gather(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 159, in async_validate_action_config
    platform = await device_automation.async_get_device_automation_platform(
  File "/usr/src/homeassistant/homeassistant/components/device_automation/__init__.py", line 84, in async_get_device_automation_platform
    raise InvalidDeviceAutomationConfig(
homeassistant.components.device_automation.exceptions.InvalidDeviceAutomationConfig: Integration '' not found

now that I think about it, this very same message showed up in the GUI when I was trying to save the script or automation, just before the disaster. However I am not able to find any “integration” by searching in the yamls

I have periodically had this issue since the last HA update, I have found that reloading the page will then allow me to edit and save. Probably one of the most annoying things is that mine will allow me to edit but not allow me to save sometimes.

Did you add any blueprint?

Take a look here:

https://community.home-assistant.io/t/upgraded-hass-and-lost-automations/269176

And:

https://community.home-assistant.io/t/error-during-setup-of-component-automation/255701

Their errors are very similar to yours.

Has anyone found a solution to the above?

I’m having the exact same issue, except it appears to occur for my automations, scripts and scenes!

I’m not getting any errors in my log files and I have tried deleting automations.yaml completely but I still cant seem to be able to create any automations (they go into the yaml file, but won’t appear in the Home Assistant Automations UI).

I fixed it after searching a bit in github. sorry for not getting back earlier.

This happens when you add a new action to an automation from the GUI, and save it right away without editing the recently-addedd action. (Most likely happens when you create an automation from a blueprint)
Or script, or scene sometimes.
This will create an entry in your YAML file with an empty id. Check out automations.yaml and look for

- id: ''

or some other important empty fields

Hmm sorry not sure I understand how you fixed it?

I’ve completed deleted my automation.yaml and have been trying to start fresh. Whenever I create a new automation in the UI, It disappears from the UI, but it appears in the newly created automation.yaml file. For example in the new one, I only have one automation and that’s the below:

- id: '1617692050498'
  alias: New Automation5
  description: ''
  trigger:
  - type: motion
    platform: device
    device_id: 3b0vd6a9d9d43875ay460ad58fb3hea7
    entity_id: binary_sensor.living_sensor_multisensor_6_home_security_motion_detection_2
    domain: binary_sensor
  condition: []
  action:
  - service: notify.mobile_app_jeremys_iphone
    data:
      message: test
  - device_id: 08ba2a3834c4b4f6gg45a7975a6c189
    domain: mobile_app
    type: notify
    title: 'fgfhdfgh'
    message: test
  mode: single

Any thoughts?

All good, seem like I have a different issue than you. After multiple hours of investigating it appears somehow my ‘default_config:’ in my config.yaml isn’t working anymore

I’ve added in ‘automation: !include automations.yaml’ and they have begun to appear back again.