Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change attribute lookup from has_key to in #10

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

trancefam
Copy link

@trancefam trancefam commented Jan 30, 2021

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 trancefam marked this pull request as draft January 30, 2021 20:09
@trancefam trancefam marked this pull request as ready for review January 30, 2021 20:24
@trancefam trancefam changed the title fix syntax error change attribute lookup from has_key to in Jan 30, 2021
@trancefam
Copy link
Author

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?)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error when adding devices
1 participant