frenck / spook

A scary 👻 powerful toolbox 🧰 for Home Assistant 🏡
https://spook.boo
MIT License
381 stars 36 forks source link

Repair: Available entities are announced as unavailable. #627

Closed HaraldGithub closed 1 month ago

HaraldGithub commented 2 months ago

What version of Spook are you using?

2.2.2 (latest)

What version of Home Assistant are you using?

2024.2.2

The problem

Hi @frenck Since the last Update of spook I've a similar issue: I got this repair announcement about an unknown entity:

image

but in developper tools this entity is known:

image

and in "Overview" it is also available:

image

I've received this message after restart from update from 2024.2.1 to 2024.2.2.

In former times, and also before last spook-update, I've received this message, too, but it was gone some seconds after restart of HA. On restart of HA, an automation will also restart the samba-addon, so for few seconds it might be possible, that spook recognize this entity as unavailable. But after the restart of the add-on it's available (as you can see in screen shots above). I think it's a bug in the last spook-update.

Anything in the logs? Paste it here!

About this issue, there aren't any logs.
berendhaan commented 2 months ago

I'm having the same issue, spook doesn't seem to clean-up issues after a sensor becomes available again.

I don't think posting a screenshot will help, are there some hints in the log you could use?

HaraldGithub commented 2 months ago

are there some hints in the log you could use?

See above, there are no hints in the log's. ;-)

bkbartk commented 2 months ago

same here, an entity got a new name, changed this in the automation but the message keeps showing the old sensor which isn't used anymore. the messages for dashboard however got cleaned up.

AlexKusnezov commented 2 months ago

same here, a sensor, which was used in several automatiions, was for couple of seconds unavailable due to reboot. Now it's avsilable and updating since four hours. Repairs are still there...

dxmnkd316 commented 2 months ago

Not sure if this is related, I can open a separate issue if necessary.

I have the same problem where the repairs notifications are no longer updating. I have the additional problem of Spook not reloading properly. All Spook entities are unavailable and none of reloading the integration, restarting HA, or rebooting the system has any effect.

I do have some info from the logs:

Logger: homeassistant.config_entries
Source: config_entries.py:603
First occurred: 9:03:53 AM (8 occurrences)
Last logged: 9:03:53 AM

Error unloading entry Not your homie for number
Error unloading entry Not your homie for select
Error unloading entry Not your homie for sensor
Error unloading entry Not your homie for switch
Error unloading entry Not your homie for time
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 603, in async_unload
    result = await component.async_unload_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/binary_sensor/__init__.py", line 244, in async_unload_entry
    return await component.async_unload_entry(entry)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 198, in async_unload_entry
    raise ValueError("Config entry was never loaded!")
ValueError: Config entry was never loaded!
Logger: homeassistant.config_entries
Source: config_entries.py:611
First occurred: February 22, 2024 at 5:25:01 PM (1 occurrences)
Last logged: February 22, 2024 at 5:25:01 PM

Error unloading entry Not your homie for binary_sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 611, in async_unload
    await self._async_process_on_unload(hass)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 753, in _async_process_on_unload
    if job := self._on_unload.pop()():
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/spook/templating.py", line 161, in async_on_unload
    for function in self._template_functions:
RuntimeError: Set changed size during iteration
Logger: homeassistant
Source: custom_components/spook/repairs.py:113
Integration: Spook ([documentation](https://spook.boo/), [issues](https://github.com/frenck/spook/issues))
First occurred: February 22, 2024 at 5:25:02 PM (1 occurrences)
Last logged: February 22, 2024 at 5:25:02 PM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/spook/repairs.py", line 292, in async_on_unload
    await repair.async_deactivate()
  File "/config/custom_components/spook/repairs.py", line 229, in async_deactivate
    await super().async_deactivate()
  File "/config/custom_components/spook/repairs.py", line 113, in async_deactivate
    for issue_id in self.issue_ids:
RuntimeError: Set changed size during iteration
Logger: homeassistant.core
Source: core.py:1389
First occurred: February 22, 2024 at 5:25:01 PM (41 occurrences)
Last logged: February 22, 2024 at 5:25:02 PM

Unable to remove unknown job listener (<Job onetime listen homeassistant_started <function HomeAssistantSpookSensorEntity.async_added_to_hass.<locals>._update_state at 0xcbe0f488> HassJobType.Callback <bound method _OneTimeListener.async_call of _OneTimeListener(hass=<HomeAssistant RUNNING>, listener=<function HomeAssistantSpookSensorEntity.async_added_to_hass.<locals>._update_state at 0xcbe0f488>, remove=None)>>, None, False)
Unable to remove unknown job listener (<Job onetime listen homeassistant_started <function HomeAssistantSpookSensorEntity.async_added_to_hass.<locals>._update_state at 0xcbe0f5c8> HassJobType.Callback <bound method _OneTimeListener.async_call of _OneTimeListener(hass=<HomeAssistant RUNNING>, listener=<function HomeAssistantSpookSensorEntity.async_added_to_hass.<locals>._update_state at 0xcbe0f5c8>, remove=None)>>, None, False)
Unable to remove unknown job listener (<Job onetime listen homeassistant_started <function HomeAssistantSpookSensorEntity.async_added_to_hass.<locals>._update_state at 0xcbe0f708> HassJobType.Callback <bound method _OneTimeListener.async_call of _OneTimeListener(hass=<HomeAssistant RUNNING>, listener=<function HomeAssistantSpookSensorEntity.async_added_to_hass.<locals>._update_state at 0xcbe0f708>, remove=None)>>, None, False)
Unable to remove unknown job listener (<Job onetime listen homeassistant_started <function HomeAssistantSpookSensorEntity.async_added_to_hass.<locals>._update_state at 0xcbe0f848> HassJobType.Callback <bound method _OneTimeListener.async_call of _OneTimeListener(hass=<HomeAssistant RUNNING>, listener=<function HomeAssistantSpookSensorEntity.async_added_to_hass.<locals>._update_state at 0xcbe0f848>, remove=None)>>, None, False)
Unable to remove unknown job listener (<Job onetime listen homeassistant_started <function HomeAssistantSpookSensorEntity.async_added_to_hass.<locals>._update_state at 0xcbe0f988> HassJobType.Callback <bound method _OneTimeListener.async_call of _OneTimeListener(hass=<HomeAssistant RUNNING>, listener=<function HomeAssistantSpookSensorEntity.async_added_to_hass.<locals>._update_state at 0xcbe0f988>, remove=None)>>, None, False)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/core.py", line 1389, in _async_remove_listener
    self._listeners[event_type].remove(filterable_job)
ValueError: list.remove(x): x not in list

Not sure if any of that is helpful in context but i'm happy to pull additional info if requested.

dxmnkd316 commented 2 months ago

oddly enough this morning I had a hard reboot due to another issue that popped up and the entities are now working again. not sure what was different this time.

jokerigno commented 2 months ago

same issue..repairs are not removed when fixed

pvmil commented 1 month ago

I really like spook, it helped me resolve several issues. I do however have the same issue (as reported in the initial message) with the sensor.samba_backup, can I provide additional information on this?

frenck commented 1 month ago

Which integration provides sensor.samba_backup?

../Frenck

pvmil commented 1 month ago

Which integration provides sensor.samba_backup?

../Frenck

https://github.com/thomasmauerer/hassio-addons/tree/master/samba-backup

frenck commented 1 month ago

That is an add-on, which integration is it using for entities?

frenck commented 1 month ago

Aaah it isn't using an integration...

https://github.com/thomasmauerer/hassio-addons/blob/master/samba-backup/rootfs/scripts/sensor.sh

That is an upstream issue, as this is not the proper way to integrate with Home Assistant.

Closing on this end.