Home Assistant Keep Losing Integrations after restart server

I have a strange issue with losing integrations everytime.

For example: my Brother Printer is detected automaticly and added as integration. After a restart of Hassio, the integration entities are missing and the printer is detected again for integration. The Brother printer is a standard integration of hassio. No hacs.

This is not only happening with the printer, but also with other integrations, but not all of them!
Working on latest Hassio release (2021.9.2)

Anyone who has an idea how to solve?

Core log:
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 382, in async_add_entities
await asyncio.gather(*tasks)
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 587, in _async_add_entity
await entity.add_to_platform_finish()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 698, in add_to_platform_finish
self.async_write_ha_state()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 464, in async_write_ha_state
self._async_write_ha_state()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 498, in _async_write_ha_state
state = self._stringify_state()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 468, in _stringify_state
if not self.available:
File “/usr/src/homeassistant/homeassistant/components/upnp/sensor.py”, line 118, in available
return super().available and self.coordinator.data.get(
AttributeError: ‘NoneType’ object has no attribute ‘get’
2021-09-04 11:53:01 ERROR (MainThread) [homeassistant.components.binary_sensor] Error while setting up upnp platform for binary_sensor
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 257, in _async_setup_platform
await asyncio.gather(*pending)
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 382, in async_add_entities
await asyncio.gather(*tasks)
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 587, in _async_add_entity
await entity.add_to_platform_finish()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 698, in add_to_platform_finish
self.async_write_ha_state()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 464, in async_write_ha_state
self._async_write_ha_state()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 498, in _async_write_ha_state
state = self._stringify_state()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 468, in _stringify_state
if not self.available:
File “/usr/src/homeassistant/homeassistant/components/upnp/binary_sensor.py”, line 49, in available
return super().available and self.coordinator.data.get(WANSTATUS)
AttributeError: ‘NoneType’ object has no attribute ‘get’
2021-09-04 11:53:01 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up upnp platform for sensor
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 257, in _async_setup_platform
await asyncio.gather(*pending)
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 382, in async_add_entities
await asyncio.gather(*tasks)
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 587, in _async_add_entity
await entity.add_to_platform_finish()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 698, in add_to_platform_finish
self.async_write_ha_state()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 464, in async_write_ha_state
self._async_write_ha_state()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 498, in _async_write_ha_state
state = self._stringify_state()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 468, in _stringify_state
if not self.available:
File “/usr/src/homeassistant/homeassistant/components/upnp/sensor.py”, line 118, in available
return super().available and self.coordinator.data.get(
AttributeError: ‘NoneType’ object has no attribute ‘get’
2021-09-04 11:53:01 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry P7 for binary_sensor
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 304, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File “/usr/src/homeassistant/homeassistant/components/binary_sensor/init.py”, line 148, in async_setup_entry
return await component.async_setup_entry(entry)
File “/usr/src/homeassistant/homeassistant/helpers/entity_component.py”, line 164, in async_setup_entry
raise ValueError(“Config entry has already been setup!”)
ValueError: Config entry has already been setup!
2021-09-04 11:53:01 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry P7 for sensor
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 304, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File “/usr/src/homeassistant/homeassistant/components/sensor/init.py”, line 121, in async_setup_entry
return await component.async_setup_entry(entry)
File “/usr/src/homeassistant/homeassistant/helpers/entity_component.py”, line 164, in async_setup_entry
raise ValueError(“Config entry has already been setup!”)
ValueError: Config entry has already been setup!
2021-09-04 11:53:02 ERROR (SyncWorker_1) [homeassistant.util.json] Failed to serialize to JSON: /config/.storage/core.config_entries. Bad data at $.data.entries[9].data.scan_interval=0:00:01(<class ‘datetime.timedelta’>
2021-09-04 11:53:02 ERROR (MainThread) [homeassistant.helpers.storage] Error writing config for core.config_entries: Failed to serialize to JSON: /config/.storage/core.config_entries. Bad data at $.data.entries[9].data.scan_interval=0:00:01(<class ‘datetime.timedelta’>
2021-09-04 11:54:01 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry P7 for binary_sensor
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 443, in async_unload
result = await component.async_unload_entry(hass, self) # type: ignore
File “/usr/src/homeassistant/homeassistant/components/binary_sensor/init.py”, line 154, in async_unload_entry
return await component.async_unload_entry(entry)
File “/usr/src/homeassistant/homeassistant/helpers/entity_component.py”, line 181, in async_unload_entry
raise ValueError(“Config entry was never loaded!”)
ValueError: Config entry was never loaded!
2021-09-04 11:54:01 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry P7 for sensor
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 443, in async_unload
result = await component.async_unload_entry(hass, self) # type: ignore
File “/usr/src/homeassistant/homeassistant/components/sensor/init.py”, line 127, in async_unload_entry
return await component.async_unload_entry(entry)
File “/usr/src/homeassistant/homeassistant/helpers/entity_component.py”, line 181, in async_unload_entry
raise ValueError(“Config entry was never loaded!”)
ValueError: Config entry was never loaded!
2021-09-04 11:54:02 ERROR (SyncWorker_4) [homeassistant.util.json] Failed to serialize to JSON: /config/.storage/core.config_entries. Bad data at $.data.entries[9].data.scan_interval=0:00:01(<class ‘datetime.timedelta’>
2021-09-04 11:54:02 ERROR (MainThread) [homeassistant.helpers.storage] Error writing config for core.config_entries: Failed to serialize to JSON: /config/.storage/core.config_entries. Bad data at $.data.entries[9].data.scan_interval=0:00:01(<class ‘datetime.timedelta’>
2021-09-04 11:55:02 ERROR (SyncWorker_5) [homeassistant.util.json] Failed to serialize to JSON: /config/.storage/core.config_entries. Bad data at $.data.entries[9].data.scan_interval=0:00:01(<class ‘datetime.timedelta’>
2021-09-04 11:55:02 ERROR (MainThread) [homeassistant.helpers.storage] Error writing config for core.config_entries: Failed to serialize to JSON: /config/.storage/core.config_entries. Bad data at $.data.entries[9].data.scan_interval=0:00:01(<class ‘datetime.timedelta’>
2021-09-04 11:56:02 ERROR (SyncWorker_3) [homeassistant.util.json] Failed to serialize to JSON: /config/.storage/core.config_entries. Bad data at $.data.entries[9].data.scan_interval=0:00:01(<class ‘datetime.timedelta’>
2021-09-04 11:56:02 ERROR (MainThread) [homeassistant.helpers.storage] Error writing config for core.config_entries: Failed to serialize to JSON: /config/.storage/core.config_entries. Bad data at $.data.entries[9].data.scan_interval=0:00:01(<class ‘datetime.timedelta’>
2021-09-04 11:57:02 ERROR (SyncWorker_5) [homeassistant.util.json] Failed to serialize to JSON: /config/.storage/core.config_entries. Bad data at $.data.entries[9].data.scan_interval=0:00:01(<class ‘datetime.timedelta’>
2021-09-04 11:57:02 ERROR (MainThread) [homeassistant.helpers.storage] Error writing config for core.config_entries: Failed to serialize to JSON: /config/.storage/core.config_entries. Bad data at $.data.entries[9].data.scan_interval=0:00:01(<class ‘datetime.timedelta’>

Did you find out what the issue was? I am having a similar problem!

Same. My guess is we have to delete the appropriate .storage files? Anyone any ideas?

I’m having this same issue with a new install of Home Assistant Core.

I have this same issue. I do a restart once a day at 3AM. About every 7-10 times, a number of integrations will fail to load after the restart. That is, on a day when 1 will fail, several will fail. On most days they all work however. When it fails, I typically lose Honeywell, ring, yolink, lacrosse at the same time.

I have ended up writing automations that check each integration entity for “unavailable” status and then attempt to reload it. I run these “check and repair” automations every 15 minutes - so I know they are only getting triggered after a restart.