-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
Add Flock notification platform #14533
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
Conversation
payload = {'text': message} | ||
|
||
_LOGGER.debug("Attempting to call Flock at %s", self._url) | ||
session = async_get_clientsession(self._hass) |
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.
I think it's better to do this once in get_service
and pass the session and the loop instead of hass to the service instance.
self._hass = hass | ||
self._url = url | ||
|
||
@asyncio.coroutine |
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 Python 3.5 async syntax, async def
.
|
||
try: | ||
with async_timeout.timeout(10, loop=self._hass.loop): | ||
response = yield from session.post(self._url, json=payload) |
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 await
.
* Add Flock notification platform * Use async syntax and move session and loop
* Add Flock notification platform * Use async syntax and move session and loop
Description:
Add support for sending notifications from home Assistant to Flock.
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#5395
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:
.coveragerc
.