Help! My Automations and Scripts have gone! :C

Hi, I recently added some custom entity images in my config file using (primarily) Home Assistant Core Integration - Home Assistant and Home Assistant Core Integration - Home Assistant

The problem is that after a reboot, my automations and scripts are gone!

The extra yaml in config is [was]:

homeassistant:
    customize:
       sensor.example_sensor:
            entity_picture: /local/myimage.png

(please note, I used ‘tabs’ in the actual yaml)

The weird thing is the Automations and Scripts YAML files are still there, and are full of info (I copied them both to external plain text files for backup). I’ve restarted the whole machine, so I’m not sure why HA is not ‘seeing’ my YAML files full of info…

Has anyone come across this?

I have backups, but I’d rather not restore, unless I have too as I’ve done a load of work and would need to manually back up other stuff.

I suspect it could be from the configuration change I made, but I used dev tools to check and there was no issue, and even after I removed the changes, there was still an issue (after full reboot).

Other than some custom stuff that has had no issues, my config looks like this :


from the Configuration.yaml - Home Assistant page

Here it is:

# Loads default set of integrations. Do not remove.
default_config:
    logger:
      default: critical
      logs:
        # log level for HA core
        homeassistant.core: fatal
        # log level for MQTT integration
        homeassistant.components.mqtt: debug
    
    automation: !include automations.yaml
    script: !include scripts.yaml
    scene: !include scenes.yaml
    
    # Load frontend themes from the themes folder
    frontend:
      themes: !include_dir_merge_named themes
      extra_module_url:
        - /local/card-mod.js

I’m not sure about the logger, I don’t remember it and I don’t think I added it. Is there a way I can get ‘JUST’ my config file from a backup?

N.B. I’m still on 15.9 as there was an issue in 16.1 with something (I forget what) and I rolled back, but I don’t think that’s part of the issue as that was maybe a week ago…

Thank you for your help/ advice :slight_smile:

Automation, script and scene should not be indented.
Mine are all the way to the left.

It seems as of you have indented stuff, not only the above, that shouldn’t be indented

“Automation, script and scene should not be indented.”

I tried this, I noticed it in the config image.

But when I do, the dev tools (and the file editor) tell me HA won’t start if its like that :frowning:

Also, I’m pretty sure they were always tabbed in. I didn’t change that.

I’m wondering if adding homeassistant: to the config (now removed) has upset something?

The image shows clearly that it should not be indented.
So just remove the indents.

And frankly, you shouldn’t be messing with the config if you have no clue what you are doing and are as careless as you are.

Edit:
Ok I guess you deleted the image again…

I’ve been using HA for years, probably over a decade, I know what I’m doing (to a certain extent), I’ve done a lot of troubleshooting, thank you very much
I just don’t touch the config that often, so I forgot those should not be indented.

Also… I did not indent those lines, and I think what had happened is that the sensors were also indented and giving the dev tools an error.

On another note; I’d like to try and work out how this happened.
I’m assuming adding homeassistant: indented them…?

Oki Doki!

Just a quick thing though:

Second line is indented four spaces.
Next is seven, and the last one 12.

Interesting, I just found that sometimes you have to tab, then space, is that normal?

I thought it was ‘just’ tabs. I’m sure I saw it written somewhere that you shouldn’t use spaces in yaml?

Anyway, thanks.

Never use tabs. They are not valid in YAML. Look in your log file and you will likely see found illegal character 't' errors.

Only use spaces.

Some editors can be set up to convert tabs to spaces automatically, but you should get out of the habit of using them.

1 Like

So in HA’s File Editor, when I press tab, it’s adding spaces?

Or should I be using spaces(?) - even though the tab indents things 4 spaces, which is technically the width of the ‘space’ between each vertical section.

So far I don’t think I’ve had any issues due to that, I’ve even used shift + tab to move things back.

It feels like there is a nuance about the number of spaces for each sub item?

Thanks.

Your editor is converting tabs to spaces.