YeonV / ledfxrm

Custom Integration for Home Assistant to control a any (local/remote) LedFX-server - State: beta
MIT License
32 stars 6 forks source link

change attribute lookup from has_key to in #10

Open trancefam opened 3 years ago

trancefam commented 3 years ago

fixes #6

I received this error

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 316, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 427, in _async_add_entity
    original_icon=entity.icon,
  File "/config/custom_components/ledfxrm/light.py", line 185, in icon
    if self.deviceconfig.has_key("icon_name"):
AttributeError: 'dict' object has no attribute 'has_key'

It seems has_key was removed in python 3: https://stackoverflow.com/a/33727186

So use the in operator instead seemed to work in my testing, although I do not have a custom icon (I think) so was unable to test inside the if statement.

trancefam commented 3 years ago

I noticed the HACS Action is failing with the error ❌ manifest.json file missing key 'version' (more-info: https://hacs.xyz/docs/publish/include#check-manifest ). When looking at the docs I see that "For core integrations, this should be omitted.". Is there a way to disable this check (this is a core integration right?)?