How to "factory reset" HA without a complete re-install

I’ve bought HA as an appliance, pre-installed on an Odroid N2+. Initially, HA found my Hue bridge, even though it’s in another LAN, and installed the integration without a problem. However, controlling Hu was not working flawlessly, to put it mildly. So I put the Odroid in the same (V)LAN, after which the Hue integration greyed out the Hue entities (i.e. couldn’t reach it).
Then I removed the Hue integration and tried to re-install it. After that, HA doesn’t automatically ‘see’ the Hue bridge (like it initially did) and manual installation (entering Hue’s IP) ends in “unknown error”. Obviously removing the Hue integration didn’t thoroughly clean up the HA configuration (I also saw that when inspecting various config files).

My question is: which HA-files must I throw away (using the CLI via Telnet) so HA is returned to its “virgin state”, without having to do a full re-installation of both HA and the OS…

Delete the contents of /config and restart. Or rename it to something like /backup to keep it as a fall-back.

2 Likes

Thanks, Tom! Your answer brought me one step further: although I had already tried the /config-cleanout myself, this time I did it after stopping the core, which brought me a seemingly virgin version.

But alas, it didn’t bring me the Hue integration; same problem: HA doesn’t find the Hue bridge and, after submission of the hue linking request, it’s the “unknown error” response again.

However, I found some errors (see below) in the logfile.
One thing that strikes me is that the Supervisor (how do I get to that thing?) uses an odd IP-address (172.30.32.2), usually assigned to devices/processes that did not receive or obtain a proper one…

THE LOGFILE

2022-10-16 23:41:07.622 WARNING (MainThread) [homeassistant.components.http.ban] Login attempt or request with invalid authentication from supervisor (172.30.32.2). Requested URL: ‘/api/config’. (HomeAssistantSupervisor/2022.10.0 aiohttp/3.8.3 Python/3.10)
2022-10-16 23:41:23.613 ERROR (MainThread) [homeassistant.components.homeassistant_alerts] timeout fetching homeassistant_alerts data
2022-10-16 23:43:35.101 ERROR (MainThread) [frontend.js.latest.202210100] :0:0 Script error.
2022-10-16 23:46:21.255 ERROR (MainThread) [aiohttp.server] Error handling request

Traceback (most recent call last):

File “/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py”, line 435, in _handle_request
resp = await request_handler(request)
File “/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py”, line 504, in _handle
resp = await handler(request)
File “/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py”, line 117, in impl
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/security_filter.py”, line 60, in security_filter_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/forwarded.py”, line 100, in forwarded_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/request_context.py”, line 28, in request_context_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/ban.py”, line 82, in ban_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/auth.py”, line 236, in auth_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/view.py”, line 136, in handle
result = await result
File “/usr/src/homeassistant/homeassistant/components/config/config_entries.py”, line 180, in post
return await super().post(request, flow_id)
File “/usr/src/homeassistant/homeassistant/components/http/data_validator.py”, line 73, in wrapper
result = await method(view, request, data, *args, **kwargs)
File “/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py”, line 110, in post
result = await self._flow_mgr.async_configure(flow_id, data)
File “/usr/src/homeassistant/homeassistant/data_entry_flow.py”, line 280, in async_configure
result = await self._async_handle_step(
File “/usr/src/homeassistant/homeassistant/data_entry_flow.py”, line 367, in _async_handle_step
result: FlowResult = await getattr(flow, method)(user_input)
File “/usr/src/homeassistant/homeassistant/components/hue/config_flow.py”, line 163, in async_step_link assert bridge is not None
AssertionError

That is the internal docker container network IP address range.

Thanks, I suspected something like that; but I’m a total newby to Docker.
The remaining question is: which other files/directories outside /config must be restored or temporarily removed to get HA into its ‘virgin’ state, so it loses any previous knowledge about Hue?
As far as I gather from the log, the Supervisor is trying to establish the link with Hue with this IP 172.30.32.2 as it source address and obviously this fails because it is not in the same LAN.

Somehow, in it’s ‘virgin state’, the Supervisor didn’t have this problem so something must have changed outside the /config; what could this possibly be?

the hidden folder called ‘.storage’ Note the dot before ‘storage’.

1 Like

Thanks Dave, but when I removed the /config-contents, I used FileZilla to remove also the hidden directories including .storage and .cloud. So there must be some other folder outside of /config…

No. All the configuration is in there.

If you are still having trouble connecting it must be something else.

Strange, because after this /config cleanout HA automatically detects (and without any problem integrates) my very old Axis camera, that is the “network neighbour” of the Philips Hue (10.73.4.30 and 10.73.4.20 respectively). And the Hue-bridge is fully operational and reachable…

I’m afraid I’ll have to re-install everything on this Odroid N2+, something I hoped to avoid when I ordered the “appliance” pre-installation of HA…

Anyway, thanks for your help!

What did you end up doing? Did you figure out how to clear everything, or were you forced to reflash your odroid?
I’ve got a HA blue and have moved house. Some of my setup has moved with me, but for the most part I’m starting anew. My HA still keeps randomly finding old devices that are no longer setup, so like you I’m finding that there must be files saved elsewhere than config and the hidden folders (either that or they’re being auto restored somehow)

After a couple of years I decided to fire up my Home Assistant Blue again. I did have a not of different integrations back then so I wanted to just reset it. I did try mv /config /backup and reboot but it came back like nothing happened. I do think that a factory reset option in the settings should be there so that new people can try and restart if they screw up. They seem to have that option on the Green manually so why not put it in the settings?

3 Likes

‘A full reset’ option is an essential need in my mind