-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
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
Switchmate #16395
Switchmate #16395
Conversation
return False | ||
return True | ||
|
||
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 is what we regularly ask to be 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.
mac_addr = config.get(CONF_MAC) | ||
add_entities([Switchmate(mac_addr, name)], True) | ||
mac_addr = config[CONF_MAC] | ||
add_devices([Switchmate(mac_addr, name)], True) |
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.
undefined name 'add_devices'
I am not finished testing this locally |
|
||
@property | ||
def unique_id(self) -> str: | ||
"""Return a unique, HASS-friendly identifier for this entity.""" | ||
return self._mac.replace(':', '') | ||
return '{0}'.format(self._mac.replace(':', '')) |
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.
String formatting doesn't seem to be needed.
This works fine locally. |
Description:
Make switchmate a bit more robust
Checklist:
tox
. Your PR cannot be merged unless tests pass