Troubleshooting a broken HA instance

Hi all, I’m at a complete loss at this point and hoping the kind dwellers of these forums can shine a light on my stupidity.

My instance of HA seems to have had quite the bad time after I was adding a few bits and bobs and I have no clue how to recover.

Currently the logs are showing errors such as:



Logger: homeassistant
Source: core.py:1186
First occurred: 10:23:19 (2 occurrences)
Last logged: 10:23:49
Error doing job: Task exception was never retrieved

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 182, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 330, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 135, in async_update_listeners
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 559, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 676, in _async_write_ha_state
    self.hass.states.async_set(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1537, in async_set
    state = State(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1186, in __init__
    raise InvalidStateError(
homeassistant.exceptions.InvalidStateError: Invalid state encountered for entity ID: sensor.kfsuwi_current_page. State max length is 255 characters.


and

 Logger: zigpy.zcl
Source: runner.py:179
First occurred: 10:23:02 (1 occurrences)
Last logged: 10:23:02
[0x1EAB:1:0x0b04] Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/zigpy/zcl/__init__.py", line 358, in reply return await self._endpoint.reply( File "/usr/local/lib/python3.10/site-packages/zigpy/endpoint.py", line 256, in reply return await self.device.reply( File "/usr/local/lib/python3.10/site-packages/zigpy/device.py", line 384, in reply return await self.request( File "/usr/local/lib/python3.10/site-packages/zigpy/device.py", line 297, in request await self._application.request( File "/usr/local/lib/python3.10/site-packages/zigpy/application.py", line 692, in request await self.send_packet( File "/usr/local/lib/python3.10/site-packages/zigpy_deconz/zigbee/application.py", line 402, in send_packet await self._api.aps_data_request( AttributeError: 'NoneType' object has no attribute 'aps_data_request' 

and a few others… I’m not sure which are relevant and which could be the root cause…

Looking at things via Samba it seemed the sqlite database was corrupted so I spent some time scouring the forums and tried the .recover trick but to no avail.

Anyone willing to help me work out where to go from here? I am completely lost :grinning_face_with_smiling_eyes:

I should add, all of my custom cards integrations, etc can no longer be found when viewing my dashboards if that helps…

Seems you have some errors in your configuration
Check for example the configuration of the sensor sensor.kfsuwi_current_page
And check your configuration in the developer tools

Hey! Thanks for the comment. I’ve tried disabling the kfsuwi (it’s a fully kiosk instance) and even before then the config is showing valid in the dev tools… The overall issue persists when that particular sensor is disabled…

I should’ve also mentioned that some sensors still seem to be fine, while others seem to have failed entirely e.g. my smart meter through the glow mqtt integration.

What did you use to edit the config files and could e.g. line ends in the config file be the cause? e.g. see How are \n and \r handled differently on Linux and Windows? - Super User

Mostly the studio code server add on, though notepad++ once in anger after all this started… It looks like it’s using the windows CR+LF… no warnings using the config checker in developers options though, and removing the CRs results in it also passing the config check with no change to issues :frowning:

Thanks for the idea though!

if you suspect the sql lite database, just rename or delete it (it will build. new one)