Skip to content

Commit

Permalink
Add additional Pushover parameters (#2309)
Browse files Browse the repository at this point in the history
* Add additional Pushover parameters

Add support for more Pushover parameters: target (device), sound, url, url_title, priority, timestamp

* Remove data dictionary reference

#2309 (comment)
  • Loading branch information
dale3h authored and balloob committed Jun 20, 2016
1 parent 5efa076 commit 6fa095f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions homeassistant/components/notify/pushover.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import logging

from homeassistant.components.notify import (
ATTR_TITLE, DOMAIN, BaseNotificationService)
ATTR_TITLE, ATTR_TARGET, ATTR_DATA, DOMAIN, BaseNotificationService)
from homeassistant.const import CONF_API_KEY
from homeassistant.helpers import validate_config

Expand Down Expand Up @@ -51,7 +51,17 @@ def send_message(self, message="", **kwargs):
"""Send a message to a user."""
from pushover import RequestError

# Make a copy and use empty dict as default value (thanks @balloob)
data = dict(kwargs.get(ATTR_DATA, {}))

data['title'] = kwargs.get(ATTR_TITLE)
target = kwargs.get(ATTR_TARGET)
if target is not None:
data['device'] = target

try:
self.pushover.send_message(message, title=kwargs.get(ATTR_TITLE))
self.pushover.send_message(message, **data)
except ValueError as val_err:
_LOGGER.error(str(val_err))
except RequestError:
_LOGGER.exception("Could not send pushover notification")

0 comments on commit 6fa095f

Please sign in to comment.