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

Centralize wemo exception handling #46705

Merged
merged 1 commit into from
Feb 17, 2021

Conversation

esev
Copy link
Contributor

@esev esev commented Feb 17, 2021

Proposed change

There are a few common steps that happen, to set self._available, during exception handling for calls to pywemo. The same boilerplate is copied several times across the platform code. This PR centralizes that logic inside the base WemoEntity class. After this PR all updates to self._available are encapsulated within the base class.

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:

Copy link
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Nice!

@MartinHjelmare MartinHjelmare merged commit 8bee3cd into home-assistant:dev Feb 17, 2021
@esev esev deleted the wemo_refactor_update branch February 17, 2021 23:33
williamobrien added a commit to williamobrien/core that referenced this pull request Feb 18, 2021
* Update zha to use new fan entity model (home-assistant#45758)

* Update zha to use new fan entity model

* fixes

* tweaks for zha

* pylint

* augment test cover

* Centralize wemo exception handling (home-assistant#46705)

* Perform wemo state update quickly after a timeout (home-assistant#46702)

* Perform state update quickly after a timeout

* with async_timeout.timeout(...) -> async with async_timeout.timeout(...)

* [ci skip] Translation update

* Bump pylutron 0.2.7 (home-assistant#46717)

* Switch ssdp to be async by using async_upnp_client for scanning (home-assistant#46554)

SSDP scans no longer runs in the executor

This is an interim step that converts the async_upnp_client
response to netdisco's object to ensure fully backwards
compatibility

* Add selectors to Input * service definitions (home-assistant#46652)

* Add selectors to Alert service definitions (home-assistant#46627)

* Add selectors to Camera service definitions (home-assistant#46630)

* Add selectors to Switch service definitions (home-assistant#46635)

* Add selectors to Downloader service definitions (home-assistant#46638)

* Add selectors to Fan service definitions (home-assistant#46639)

* Add selectors to Cover service definitions (home-assistant#46634)

Co-authored-by: Tobias Sauerwein <cgtobi@users.noreply.github.com>

* Add selectors to Automation service definitions (home-assistant#46629)

* Add selectors to Climate service definitions (home-assistant#46632)

* Add selectors to Alarm Control Panel service definitions (home-assistant#46626)

* Upgrade and constrain httplib2>=0.19.0 (home-assistant#46725)

* ubus: switch to pypi library (home-assistant#46690)

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>

* Add selectors to Counter service definitions (home-assistant#46633)

* Add advanced service parameter flag (home-assistant#46727)

* Add discontinuity support to HLS streams and fix nest expiring stream urls (home-assistant#46683)

* Support HLS stream discontinuity.

* Clarify discontinuity comments

* Signal a stream discontinuity on restart due to stream error

* Apply suggestions from code review

Co-authored-by: uvjustin <46082645+uvjustin@users.noreply.github.com>

* Simplify stream discontinuity logic

* Add selectors to Scene service definitions (home-assistant#46729)

* Fix missing color switch specific device class for Z-Wave JS driver >6.3 (home-assistant#46718)

* Add selectors to Netatmo services (home-assistant#46574)

* Add selectors

* Fix schedul selector

* Update homeassistant/components/netatmo/services.yaml

Co-authored-by: Bram Kragten <mail@bramkragten.nl>

* Update homeassistant/components/netatmo/services.yaml

Co-authored-by: Bram Kragten <mail@bramkragten.nl>

* Update services.yaml

* Added required field

Co-authored-by: Bram Kragten <mail@bramkragten.nl>

* Add test for biannually cycle in utility_meter component

Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: Eric Severance <esev@esev.com>
Co-authored-by: HomeAssistant Azure <hello@home-assistant.io>
Co-authored-by: uvjustin <46082645+uvjustin@users.noreply.github.com>
Co-authored-by: Franck Nijhof <git@frenck.dev>
Co-authored-by: Tobias Sauerwein <cgtobi@users.noreply.github.com>
Co-authored-by: Álvaro Fernández Rojas <noltari@gmail.com>
Co-authored-by: Allen Porter <allen@thebends.org>
Co-authored-by: Jesse Campbell <hikeit@gmail.com>
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
@github-actions github-actions bot locked and limited conversation to collaborators Feb 19, 2021
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.

3 participants