Skip to content

Fix init for first added shelly device#48411

Merged
frenck merged 1 commit intohome-assistant:devfrom
mib1185:shelly-fix_init
Mar 30, 2021
Merged

Fix init for first added shelly device#48411
frenck merged 1 commit intohome-assistant:devfrom
mib1185:shelly-fix_init

Conversation

@mib1185
Copy link
Copy Markdown
Member

@mib1185 mib1185 commented Mar 27, 2021

Proposed change

This PR should fix 07a2528 in case of first shelly device ever is added.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

To help with the load of incoming pull requests:

@mib1185
Copy link
Copy Markdown
Member Author

mib1185 commented Mar 27, 2021

This error was thrown before, when adding the first shelly device:

2021-03-27 17:58:56 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry shellyplug-s-B4FD74 for shelly
Traceback (most recent call last):
  File "/home/mib85/git/homeassistant-core/homeassistant/config_entries.py", line 248, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/home/mib85/git/homeassistant-core/homeassistant/components/shelly/__init__.py", line 78, in async_setup_entry
    if entry.entry_id not in device_entry.config_entries:
AttributeError: 'NoneType' object has no attribute 'config_entries'

Copy link
Copy Markdown
Member

@bieniu bieniu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed one issue and created another 🤦
LGTM, thanks!

Copy link
Copy Markdown
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally, makes all the difference!

Not joking: I added a Shelly device to my production instance and gave up... This fixes it 😬

@frenck frenck merged commit 309c3a8 into home-assistant:dev Mar 30, 2021
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 31, 2021
@mib1185 mib1185 deleted the shelly-fix_init branch May 11, 2021 17:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants