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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Switchmate dependency to 0.5.1 #75163

Merged
merged 4 commits into from Jul 26, 2022

Conversation

qiz-li
Copy link

@qiz-li qiz-li commented Jul 14, 2022

Proposed change

Bump pySwitchmate library. Moved from bluepy to bleak to fix breaking changes in 2022.7

Full changelog:
Danielhiversen/pySwitchmate@0.4.6...0.5.1

Release notes:
https://github.com/Danielhiversen/pySwitchmate/releases/tag/0.5.1
https://github.com/Danielhiversen/pySwitchmate/releases/tag/0.5.0

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)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

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.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • 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:

@probot-home-assistant
Copy link

Hey there @Danielhiversen, mind taking a look at this pull request as it has been labeled with an integration (switchmate) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@project-bot project-bot bot added this to Needs review in Dev Jul 14, 2022
@frenck frenck added the smash Indicator this PR is close to finish for merging or closing label Jul 14, 2022
@bdraco bdraco self-requested a review July 25, 2022 23:56
@@ -17,7 +17,7 @@
CONF_FLIP_ON_OFF = "flip_on_off"
DEFAULT_NAME = "Switchmate"

SCAN_INTERVAL = timedelta(minutes=30)
SCAN_INTERVAL = timedelta(seconds=10)
Copy link
Member

@bdraco bdraco Jul 26, 2022

Choose a reason for hiding this comment

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

Thats a pretty significant scan interval change for a device which polls. Do these devices advertise their state? If so we can listen for advertisements with https://developers.home-assistant.io/docs/network_discovery?_highlight=discovery#subscribing-to-bluetooth-discoveries and change this to be push

Also please see https://developers.home-assistant.io/docs/network_discovery?_highlight=discovery#best-practices-for-library-authors

Copy link
Member

Choose a reason for hiding this comment

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

Check the switchbot integration for an example of push updates

@@ -49,7 +49,7 @@ def __init__(self, mac, name, flip_on_off) -> None:

self._mac = mac
self._name = name
self._device = switchmate.Switchmate(mac=mac, flip_on_off=flip_on_off)
self._device = Switchmate(mac=mac, flip_on_off=flip_on_off)
Copy link
Member

Choose a reason for hiding this comment

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

Bleak doesn't use mac addresses on all platforms so at some point this should switch to be an address instead

Copy link
Member

@bdraco bdraco left a comment

Choose a reason for hiding this comment

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

This looks fine except for the scan interval. 10s is too frequent for polling since a bluetooth connection can take up to 10s to establish.

Dev automation moved this from Needs review to Review in progress Jul 26, 2022
@bdraco
Copy link
Member

bdraco commented Jul 26, 2022

I suggest leaving the scan interval as it was so we can get this merged working again and making additional changes in a followup PR

@qiz-li
Copy link
Author

qiz-li commented Jul 26, 2022

Sounds good! I am not very familiar with Bluetooth and Home Assistant development, but I will try to make some updates. I will also be glad to test with my Switchmate devices if anyone else also wants to move this forward. Thanks.

Dev automation moved this from Review in progress to Reviewer approved Jul 26, 2022
Copy link
Member

@bdraco bdraco left a comment

Choose a reason for hiding this comment

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

Thanks @qiz-li

The issues I noted above are existing problem and can be addressed in a followup PR. Let's get this merged since it will unbreak the integration 馃憤

@bdraco bdraco merged commit 1f73a55 into home-assistant:dev Jul 26, 2022
Dev automation moved this from Reviewer approved to Done Jul 26, 2022
@qiz-li qiz-li deleted the switchmate-deps-bump branch July 26, 2022 03:12
@github-actions github-actions bot locked and limited conversation to collaborators Jul 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed dependency integration: switchmate small-pr PRs with less than 30 lines. smash Indicator this PR is close to finish for merging or closing
Projects
Dev
  
Done
Development

Successfully merging this pull request may close these issues.

Platform error: switch - Requirements for switchmate not found: ['pySwitchmate==0.4.6']
5 participants