mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
[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
@ -51,10 +51,11 @@ class PushoverNotificationService(BaseNotificationService):
|
|||||||
"""Send a message to a user."""
|
"""Send a message to a user."""
|
||||||
from pushover import RequestError
|
from pushover import RequestError
|
||||||
|
|
||||||
# Make a copy and use empty dict as default value (thanks @balloob)
|
# Make a copy and use empty dict if necessary
|
||||||
data = dict(kwargs.get(ATTR_DATA, {}))
|
data = dict(kwargs.get(ATTR_DATA) or {})
|
||||||
|
|
||||||
data['title'] = kwargs.get(ATTR_TITLE)
|
data['title'] = kwargs.get(ATTR_TITLE)
|
||||||
|
|
||||||
target = kwargs.get(ATTR_TARGET)
|
target = kwargs.get(ATTR_TARGET)
|
||||||
if target is not None:
|
if target is not None:
|
||||||
data['device'] = target
|
data['device'] = target
|
||||||
|
Loading…
x
Reference in New Issue
Block a user