frenck / spook

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

AttributeError: 'list' object has no attribute 'get' #192

Closed holdestmade closed 11 months ago

holdestmade commented 11 months ago

Sorry Frenck, another one, getting this on v0.13.131315. This one repeats

Logger: custom_components.spook Source: custom_components/spook/repairs/lovelace_unknown_entity_references.py:254 Integration: Spook (documentation, issues) First occurred: 09:29:35 (5 occurrences) Last logged: 09:30:34

Unexpected exception from <function AbstractSpookRepair.async_activate.._async_inspect at 0xffff4c76dbd0> 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 213, in async_extract_entities_from_card 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: 'list' object has no attribute 'get'

frenck commented 11 months ago

Don't be sorry! It really helps!

There are so many cards and stuff out, that it is impossible for me to pre-think/catch them all. So these reports allow me to iteratively improve it šŸ‘

../Frenck

frenck commented 11 months ago

It looks like you have a YAML list on a key that is either tap_action:, hold_action:, double_tap_action:, or subtitle_tap_action:.

How do those look in your configuration?

../Frenck

holdestmade commented 11 months ago

Is this what you mean ?

Now I look at it, I can combine them and there is a risk they might go out of sync, I'll adjust

            tap_action:
              - action: call-service
                service: homeassistant.toggle
                data:
                  entity_id:
                    - automation.immersion_heater_schedule_off
              - action: call-service
                service: homeassistant.toggle
                data:
                  entity_id:
                    - automation.immersion_heater_schedule_on
frenck commented 11 months ago

Hmm tap actions in HA can be a list? šŸ˜±

holdestmade commented 11 months ago

Seems to work ok, but I will redo it

frenck commented 11 months ago

On which card are you using that tap_action?

holdestmade commented 11 months ago

Mushroom Template Card

holdestmade commented 11 months ago

Actually, just tested again and it doesn't work, no errors though. I've removed it now

frenck commented 11 months ago

Indeed, was just looking at the mushroom codebase, but they seem to re-use HA parts, which doesn't work with lists.

But thanks for all the info and details! That means I can make it more robust (but don't have to take into account potentially new configuration structures).

šŸ‘

../Frenck

holdestmade commented 11 months ago

I have removed it but still getting this error in the logs

frenck commented 11 months ago

Should be solved with #198

holdestmade commented 11 months ago

Brilliant, nothing in logs now

frenck commented 11 months ago

Awesome! Thanks for all of that šŸ‘