Update notify to expect a list of string targets instead of a single … (#3548)
* Update notify to expect a list of string targets instead of a single string * Actually do the thing I set out to do * Fix notify.group test to expect an array of targets * REST platform will only use the first target in the list * Update notify platforms to expect a list of targets * Update notify services.yaml
This commit is contained in:
1 parent
c189c05676
commit
646eaccd4d
13 files changed
+33
-47
No files matched your search
@@ -61,13 +61,15 @@ class PushoverNotificationService(BaseNotificationService):
|
||||
|
||||
data['title'] = kwargs.get(ATTR_TITLE, ATTR_TITLE_DEFAULT)
|
||||
|
||||
target = kwargs.get(ATTR_TARGET)
|
||||
if target is not None:
|
||||
data['device'] = target
|
||||
targets = kwargs.get(ATTR_TARGET)
|
||||
|
||||
try:
|
||||
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')
|
||||
for target in targets:
|
||||
if target is not None:
|
||||
data['device'] = target
|
||||
|
||||
try:
|
||||
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')
|
||||
Reference in new issue
Block a user