[notify.pushover] Fix 'NoneType' error on data retrieval (#2352)
* Fix 'NoneType' error on data retrieval * Reduce code for empty dict as the default
This commit is contained in:
parent
a564fe8286
commit
d7b006600e
1 changed files with 3 additions and 2 deletions
|
@ -51,10 +51,11 @@ class PushoverNotificationService(BaseNotificationService):
|
|||
"""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, {}))
|
||||
# Make a copy and use empty dict if necessary
|
||||
data = dict(kwargs.get(ATTR_DATA) or {})
|
||||
|
||||
data['title'] = kwargs.get(ATTR_TITLE)
|
||||
|
||||
target = kwargs.get(ATTR_TARGET)
|
||||
if target is not None:
|
||||
data['device'] = target
|
||||
|
|
Loading…
Add table
Reference in a new issue