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

Switchmate #16395

Merged
merged 16 commits into from
Sep 12, 2018
Merged

Switchmate #16395

merged 16 commits into from
Sep 12, 2018

Conversation

Danielhiversen
Copy link
Member

@Danielhiversen Danielhiversen commented Sep 3, 2018

Description:

Make switchmate a bit more robust

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass

return False
return True

def _sendpacket(self, key, retry=2) -> bool:
Copy link
Member

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.

Copy link
Member Author

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)

Choose a reason for hiding this comment

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

undefined name 'add_devices'

@Danielhiversen Danielhiversen changed the title Switchmate [WIP] Switchmate Sep 11, 2018
@Danielhiversen
Copy link
Member Author

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(':', ''))
Copy link
Member

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.

@Danielhiversen Danielhiversen changed the title [WIP] Switchmate Switchmate Sep 12, 2018
@Danielhiversen
Copy link
Member Author

This works fine locally.

@MartinHjelmare MartinHjelmare merged commit cb542a9 into dev Sep 12, 2018
@ghost ghost removed the in progress label Sep 12, 2018
@Danielhiversen Danielhiversen deleted the switchmate branch September 12, 2018 19:27
@balloob balloob mentioned this pull request Sep 28, 2018
@home-assistant home-assistant locked and limited conversation to collaborators Feb 5, 2019
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.

4 participants