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
Conversation
Hey there @Danielhiversen, mind taking a look at this pull request as it has been labeled with an integration ( |
2cce257
to
7145789
Compare
@@ -17,7 +17,7 @@ | |||
CONF_FLIP_ON_OFF = "flip_on_off" | |||
DEFAULT_NAME = "Switchmate" | |||
|
|||
SCAN_INTERVAL = timedelta(minutes=30) | |||
SCAN_INTERVAL = timedelta(seconds=10) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
There was a problem hiding this 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.
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 |
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. |
There was a problem hiding this 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 馃憤
Proposed change
Bump
pySwitchmate
library. Moved frombluepy
tobleak
to fix breaking changes in 2022.7Full 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
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: