frenck / spook

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

Unexpected exception #182

Closed jprasm closed 11 months ago

jprasm commented 11 months ago

Hi, i'm relatively new at reporting issues, so I apologize if I'm omitting some information. I'm getting this message in the logs (I believe this occurs on startup):

This error originated from a custom integration.

Logger: custom_components.spook
Source: custom_components/spook/repairs/lovelace_unknown_entity_references.py:217
Integration: Spook (documentation, issues)
First occurred: 07:02:37 (2 occurrences)
Last logged: 07:04:22

Unexpected exception from <function AbstractSpookRepair.async_activate.<locals>._async_inspect at 0x7f1fff6dec20>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/debounce.py", line 117, in _handle_timer_finish
    await task
  File "/config/custom_components/spook/repairs/__init__.py", line 130, in _async_inspect
    await self.async_inspect()
  File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 108, in async_inspect
    for entity_id in self.__async_extract_entities(config)
  File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 156, in __async_extract_entities
    entities.update(self.__async_extract_entities_from_card(card))
  File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 218, in __async_extract_entities_from_card
    entities.update(self.__async_extract_entities_from_card(card))
  File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 218, in __async_extract_entities_from_card
    entities.update(self.__async_extract_entities_from_card(card))
  File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 218, in __async_extract_entities_from_card
    entities.update(self.__async_extract_entities_from_card(card))
  File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 217, in __async_extract_entities_from_card
    for card in config.get("cards", []):
TypeError: 'NoneType' object is not iterable
emufan commented 11 months ago

I can add for same "unknown_entity_references"-check-part of startup

Logger: custom_components.spook
Source: custom_components/spook/repairs/lovelace_unknown_entity_references.py:200
Integration: Spook ([documentation](https://github.com/frenck/spook), [issues](https://github.com/frenck/spook/issues))
First occurred: 08:32:37 (12 occurrences)
Last logged: 08:45:02

Unexpected exception from <function AbstractSpookRepair.async_activate.<locals>._async_inspect at 0xffff8f11e3b0>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/debounce.py", line 117, in _handle_timer_finish
    await task
  File "/config/custom_components/spook/repairs/__init__.py", line 130, in _async_inspect
    await self.async_inspect()
  File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 108, in async_inspect
    for entity_id in self.__async_extract_entities(config)
  File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 154, in __async_extract_entities
    entities.update(self.__async_extract_entities_from_badge(badge))
  File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 200, in __async_extract_entities_from_badge
    return set(config["entities"])
TypeError: unhashable type: 'dict'
frenck commented 11 months ago

Thanks for reporting those!

I've prepared a small change to make Spook more resilient against unexpected configuration formats.

../Frenck

emufan commented 11 months ago

@frenck This one is closed now but I still get these error. Should I open a new one?

2023-06-01 18:59:52.372 DEBUG (MainThread) [custom_components.spook] Spook is inspecting: script_unknown_entity_references
2023-06-01 18:59:52.385 DEBUG (MainThread) [custom_components.spook] Spook is inspecting: automation_unknown_device_references
2023-06-01 18:59:53.172 DEBUG (MainThread) [custom_components.spook] Spook is inspecting: automation_unknown_area_references
2023-06-01 18:59:53.177 DEBUG (MainThread) [custom_components.spook] Spook is inspecting: switch_as_x_unknown_source
2023-06-01 18:59:53.184 DEBUG (MainThread) [custom_components.spook] Spook is inspecting: automation_unknown_entity_references
2023-06-01 18:59:54.844 DEBUG (MainThread) [custom_components.spook] Spook is inspecting: integration_unknown_source
2023-06-01 18:59:54.850 DEBUG (MainThread) [custom_components.spook] Spook is inspecting: lovelace_unknown_entity_references
2023-06-01 18:59:54.853 DEBUG (MainThread) [custom_components.spook] Config for dashboard lovelace not found, skipping
2023-06-01 18:59:54.853 ERROR (MainThread) [custom_components.spook] Unexpected exception from <function AbstractSpookRepair.async_activate.<locals>._async_inspect at 0xffff8ec57eb0>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/debounce.py", line 117, in _handle_timer_finish
await task
File "/config/custom_components/spook/repairs/__init__.py", line 130, in _async_inspect
await self.async_inspect()
File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 108, in async_inspect
for entity_id in self.__async_extract_entities(config)
File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 159, in __async_extract_entities
entities.update(self.__async_extract_entities_from_card(card))
File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 230, in __async_extract_entities_from_card
self.__async_extract_entities_from_header_footer(header_footer),
File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 308, in __async_extract_entities_from_header_footer
entities.update(self.__async_extract_entities_from_actions(config))
File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 254, in __async_extract_entities_from_actions
if action := config.get(key):
AttributeError: 'str' object has no attribute 'get'
2023-06-01 18:59:54.861 DEBUG (MainThread) [custom_components.spook] Spook is inspecting: group_unknown_members
2023-06-01 18:59:54.865 DEBUG (MainThread) [custom_components.spook] Spook is inspecting: script_unknown_device_references
2023-06-01 18:59:54.868 DEBUG (MainThread) [custom_components.spook] Spook is inspecting: script_unknown_area_references
2023-06-01 19:00:02.382 DEBUG (MainThread) [custom_components.spook] Spook is inspecting: script_unknown_entity_references
2023-06-01 19:00:03.200 DEBUG (MainThread) [custom_components.spook] Spook is inspecting: automation_unknown_entity_references
2023-06-01 19:00:04.862 DEBUG (MainThread) [custom_components.spook] Spook is inspecting: lovelace_unknown_entity_references
2023-06-01 19:00:04.865 DEBUG (MainThread) [custom_components.spook] Config for dashboard lovelace not found, skipping
2023-06-01 19:00:04.866 ERROR (MainThread) [custom_components.spook] Unexpected exception from <function AbstractSpookRepair.async_activate.<locals>._async_inspect at 0xffff8ec57eb0>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/debounce.py", line 117, in _handle_timer_finish
await task
File "/config/custom_components/spook/repairs/__init__.py", line 130, in _async_inspect
await self.async_inspect()
File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 108, in async_inspect
for entity_id in self.__async_extract_entities(config)
File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 159, in __async_extract_entities
entities.update(self.__async_extract_entities_from_card(card))
File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 230, in __async_extract_entities_from_card
self.__async_extract_entities_from_header_footer(header_footer),
File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 308, in __async_extract_entities_from_header_footer
entities.update(self.__async_extract_entities_from_actions(config))
File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 254, in __async_extract_entities_from_actions
if action := config.get(key):
AttributeError: 'str' object has no attribute 'get'
2023-06-01 19:00:29.030 DEBUG (MainThread) [custom_components.spook] Spook is inspecting: script_unknown_entity_references
2023-06-01 19:00:29.034 DEBUG (MainThread) [custom_components.spook] Spook is inspecting: automation_unknown_entity_references
2023-06-01 19:00:29.039 DEBUG (MainThread) [custom_components.spook] Spook is inspecting: lovelace_unknown_entity_references
2023-06-01 19:00:29.042 DEBUG (MainThread) [custom_components.spook] Config for dashboard lovelace not found, skipping
2023-06-01 19:00:29.042 ERROR (MainThread) [custom_components.spook] Unexpected exception from <function AbstractSpookRepair.async_activate.<locals>._async_inspect at 0xffff8ec57eb0>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/debounce.py", line 117, in _handle_timer_finish
await task
File "/config/custom_components/spook/repairs/__init__.py", line 130, in _async_inspect
await self.async_inspect()
File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 108, in async_inspect
for entity_id in self.__async_extract_entities(config)
File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 159, in __async_extract_entities
entities.update(self.__async_extract_entities_from_card(card))
File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 230, in __async_extract_entities_from_card
self.__async_extract_entities_from_header_footer(header_footer),
File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 308, in __async_extract_entities_from_header_footer
entities.update(self.__async_extract_entities_from_actions(config))
File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 254, in __async_extract_entities_from_actions
if action := config.get(key):
AttributeError: 'str' object has no attribute 'get'
2023-06-01 19:01:10.959 DEBUG (MainThread) [custom_components.spook] Spook is inspecting: script_unknown_entity_references
2023-06-01 19:01:10.970 DEBUG (MainThread) [custom_components.spook] Spook is inspecting: automation_unknown_entity_references
2023-06-01 19:01:10.981 DEBUG (MainThread) [custom_components.spook] Spook is inspecting: lovelace_unknown_entity_references
2023-06-01 19:01:10.990 DEBUG (MainThread) [custom_components.spook] Config for dashboard lovelace not found, skipping
2023-06-01 19:01:10.991 ERROR (MainThread) [custom_components.spook] Unexpected exception from <function AbstractSpookRepair.async_activate.<locals>._async_inspect at 0xffff8ec57eb0>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/debounce.py", line 117, in _handle_timer_finish
await task
File "/config/custom_components/spook/repairs/__init__.py", line 130, in _async_inspect
await self.async_inspect()
File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 108, in async_inspect
for entity_id in self.__async_extract_entities(config)
File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 159, in __async_extract_entities
entities.update(self.__async_extract_entities_from_card(card))
File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 230, in __async_extract_entities_from_card
self.__async_extract_entities_from_header_footer(header_footer),
File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 308, in __async_extract_entities_from_header_footer
entities.update(self.__async_extract_entities_from_actions(config))
File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 254, in __async_extract_entities_from_actions
if action := config.get(key):
AttributeError: 'str' object has no attribute 'get'
2023-06-01 19:02:35.815 DEBUG (MainThread) [custom_components.spook] Spook is inspecting: script_unknown_entity_references
2023-06-01 19:02:35.818 DEBUG (MainThread) [custom_components.spook] Spook is inspecting: automation_unknown_entity_references
2023-06-01 19:02:35.823 DEBUG (MainThread) [custom_components.spook] Spook is inspecting: lovelace_unknown_entity_references
2023-06-01 19:02:35.826 DEBUG (MainThread) [custom_components.spook] Config for dashboard lovelace not found, skipping
2023-06-01 19:02:35.827 ERROR (MainThread) [custom_components.spook] Unexpected exception from <function AbstractSpookRepair.async_activate.<locals>._async_inspect at 0xffff8ec57eb0>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/debounce.py", line 117, in _handle_timer_finish
await task
File "/config/custom_components/spook/repairs/__init__.py", line 130, in _async_inspect
await self.async_inspect()
File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 108, in async_inspect
for entity_id in self.__async_extract_entities(config)
File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 159, in __async_extract_entities
entities.update(self.__async_extract_entities_from_card(card))
File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 230, in __async_extract_entities_from_card
self.__async_extract_entities_from_header_footer(header_footer),
File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 308, in __async_extract_entities_from_header_footer
entities.update(self.__async_extract_entities_from_actions(config))
File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 254, in __async_extract_entities_from_actions
if action := config.get(key):
AttributeError: 'str' object has no attribute 'get'
2023-06-01 19:03:59.036 DEBUG (MainThread) [custom_components.spook] Spook is inspecting: script_unknown_entity_references
2023-06-01 19:03:59.040 DEBUG (MainThread) [custom_components.spook] Spook is inspecting: automation_unknown_entity_references
2023-06-01 19:03:59.045 DEBUG (MainThread) [custom_components.spook] Spook is inspecting: lovelace_unknown_entity_references
2023-06-01 19:03:59.048 DEBUG (MainThread) [custom_components.spook] Config for dashboard lovelace not found, skipping
2023-06-01 19:03:59.048 ERROR (MainThread) [custom_components.spook] Unexpected exception from <function AbstractSpookRepair.async_activate.<locals>._async_inspect at 0xffff8ec57eb0>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/debounce.py", line 117, in _handle_timer_finish
await task
File "/config/custom_components/spook/repairs/__init__.py", line 130, in _async_inspect
await self.async_inspect()
File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 108, in async_inspect
for entity_id in self.__async_extract_entities(config)
File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 159, in __async_extract_entities
entities.update(self.__async_extract_entities_from_card(card))
File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 230, in __async_extract_entities_from_card
self.__async_extract_entities_from_header_footer(header_footer),
File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 308, in __async_extract_entities_from_header_footer
entities.update(self.__async_extract_entities_from_actions(config))
File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 254, in __async_extract_entities_from_actions
if action := config.get(key):
AttributeError: 'str' object has no attribute 'get'
frenck commented 11 months ago

@emufan yes, as this is closed... and you have a new one... new issue = new issue :)