Upgrade seems to pick up parts of old config despite config folder being deleted

I was running HA 0.65.0 in a Docker container a Lubuntu 18.04 VM. I wanted to dry run an upgrade to the latest HA release, so cloned the VM and assigned a different IP address to the new VM. I then removed the HA Docker container in the new VM, and moved the existing config files in the host file system to a subfolder - effectively “deleting” the config prior to installing the new HA release.
I then pulled the latest HA release and created the Docker container using this command:

sudo docker run -d --name="home-assistant" -v ~/homeassistant:/config -v /etc/localtime:/etc/localtime:ro --net=host homeassistant/home-assistant

I started up HA, and was surprised to see that it had “remembered” some elements of my “deleted” config, even though I had moved all of the original config files to a new location. For example, the following were included on my Lovelace UI from my previous config:

  • Input booleans
  • Automations
  • Account details for some integrations - e.g. Life360, Hive, Logitech Media Server

None of the above are listed in the .yaml files in the config folder however, so I’m confused as to:

  • how these details could have been “remembered” from my previous config when I had effectively deleted all of my config files before installing the new Docker HA contained
  • why none of these details can be seen in my .yaml files, despite the fact that they are on my Lovelace homepage
  • why other elements of my previous config were NOT remembered (e.g. switches).

Could anyone explain what might have happened here??

The largest part of the runtime configuration is in a hidden .storage folder in /config
If you only moved the content of the folder, the leftovers very likely come from there.

The proper way to start anew is to re-create a new ~/homeassistant folder after moving the old one.

Ah - OK I can see it - thanks! It’s actually quite handy that some of my previous config has been retained, as it will save me time adding these items manually, but…
If the input booleans, automations, etc, which I can see in Lovelace are not in any of my new .yaml files (all of which are empty/default content), can I assume that they have not been set up correctly in HA - i.e. should I delete them and re-create them manually in my new (empty) .yaml files?

No necessarily.

Basically anything that is or can be done through UI ends up in .storage, whether you intially defined them in YAML or not. In those case, whatever you do in YAML after being picked up is actually ignored (or creates a new entity if you changed the name).

I’ve just noticed that when I look at many of my entities/automations in the Configuration area of the UI they say:

This entity is currently unavailable and is an orphan to a removed, changed or dysfunctional integration or device. If the entity is no longer in use, you can clean it up by removing it.

Presumably I need to remote these and re-create them manually?