frenck / spook

A scary šŸ‘» powerful toolbox šŸ§° for Home Assistant šŸ”
https://spook.boo
MIT License
381 stars 36 forks source link

AttributeError: 'str' object has no attribute 'get' #188

Closed holdestmade closed 11 months ago

holdestmade commented 11 months ago

Getting this on v0.13.131314

Logger: custom_components.spook Source: custom_components/spook/repairs/lovelace_unknown_entity_references.py:264 Integration: Spook (documentation, issues) First occurred: 16:32:14 (8 occurrences) Last logged: 16:34:12

Unexpected exception from <function AbstractSpookRepair.async_activate.._async_inspect at 0xffff5adcbd00> 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 225, 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 235, in async_extract_entities_from_card entities.update(self.async_extract_entities_from_element(element)) File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 288, in async_extract_entities_from_element entities.update(self.async_extract_entities_from_actions(config)) File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 255, in async_extract_entities_from_actions entities.update(self.async_extract_entities_from_action(action)) File "/config/custom_components/spook/repairs/lovelace_unknown_entity_references.py", line 264, in async_extract_entities_from_action (target := config.get(key)) AttributeError: 'str' object has no attribute 'get'

frenck commented 11 months ago

Do you have any action: in your YAML dashboards that have a string as a value?

holdestmade commented 11 months ago

The only action: I can see is navigate, toggle, call-service and none. I did have a few null but have replaced them with none.

I do have a few action: double_tap but they are for custom restriction card

frenck commented 11 months ago

I do have a few action: double_tap but they are for custom restriction card

That is the source šŸ‘

Thanks!

../Frenck

Mariusthvdb commented 11 months ago

dont want to be daft, but what is the solution to this? Does Spook need to exclude those in the scan, or do we need to do anything in the action yaml...

not much we can do about correct config like:

action_default:
  tap_action:
    action: toggle
    haptic: light
  hold_action:
    action: more-info
    haptic: success
frenck commented 11 months ago

No, this can be handled by Spook. I wasn't able to take into account all the custom stuff out there writing this šŸ˜‰

Will maybe pick it up tomorrow (or something).

Mariusthvdb commented 11 months ago

a, great, would be nice! thx