Skip to content

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

Merged
merged 2 commits into from
May 31, 2018
Merged

Add Flock notification platform #14533

merged 2 commits into from
May 31, 2018

Conversation

fabaff
Copy link
Member

@fabaff fabaff commented May 18, 2018

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):

notify:
  - platform: flock
    name: flock
    access_token: a3c1d25c-b9e4-40d2-9b0e-ea3de17ccef8

Checklist:

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

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • New files were added to .coveragerc.

payload = {'text': message}

_LOGGER.debug("Attempting to call Flock at %s", self._url)
session = async_get_clientsession(self._hass)
Copy link
Member

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
Copy link
Member

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)
Copy link
Member

Choose a reason for hiding this comment

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

Use await.

@fabaff fabaff merged commit 14ee617 into dev May 31, 2018
@fabaff fabaff deleted the flock-notify branch May 31, 2018 21:07
PhilRW pushed a commit to PhilRW/home-assistant that referenced this pull request Jun 1, 2018
* Add Flock notification platform

* Use async syntax and move session and loop
@balloob balloob mentioned this pull request Jun 8, 2018
girlpunk pushed a commit to girlpunk/home-assistant that referenced this pull request Sep 4, 2018
* Add Flock notification platform

* Use async syntax and move session and loop
@home-assistant home-assistant locked and limited conversation to collaborators Sep 5, 2018
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.

3 participants