-
-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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
switchbot #16396
switchbot #16396
Conversation
self._mac = mac | ||
self._device = None | ||
|
||
def _sendpacket(self, key, retry=2) -> bool: |
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 belongs in a standalone library.
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.
Ok, I thought it might be ok since it so few lines.
But I will make a standalone library.
For more details about this platform, please refer to the documentation at | ||
https://home-assistant.io/components/switch.switchbot | ||
""" | ||
import binascii |
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.
'binascii' imported but unused
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.
Nice! Two small comments.
}) | ||
|
||
|
||
def setup_platform(hass, config, add_devices, discovery_info=None): |
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.
Rename add_devices
to add_entities
.
def setup_platform(hass, config, add_devices, discovery_info=None): | ||
"""Perform the setup for Switchbot devices.""" | ||
name = config.get(CONF_NAME) | ||
mac_addr = config.get(CONF_MAC) |
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.
Use dict[key]
for required config keys.
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.
Can be merged when build passes.
Description:
Adds support for https://www.switch-bot.com/
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#6186
Example entry for
configuration.yaml
(if applicable):Checklist:
tox
. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
REQUIREMENTS
variable ([example][ex-requir]).requirements_all.txt
by runningscript/gen_requirements_all.py
..coveragerc
.