mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 10:17:09 +00:00
bug fix pushbullet (#9139)
This commit is contained in:
parent
f4d464c008
commit
493353e4de
@ -133,8 +133,12 @@ class PushBulletNotificationService(BaseNotificationService):
|
|||||||
|
|
||||||
def _push_data(self, filepath, message, title, url, pusher, tname=None):
|
def _push_data(self, filepath, message, title, url, pusher, tname=None):
|
||||||
from pushbullet import PushError
|
from pushbullet import PushError
|
||||||
|
from pushbullet import Device
|
||||||
try:
|
try:
|
||||||
if url:
|
if url:
|
||||||
|
if isinstance(pusher, Device):
|
||||||
|
pusher.push_link(title, url, body=message)
|
||||||
|
else:
|
||||||
pusher.push_link(title, url, body=message, email=tname)
|
pusher.push_link(title, url, body=message, email=tname)
|
||||||
elif filepath and self.hass.config.is_allowed_path(filepath):
|
elif filepath and self.hass.config.is_allowed_path(filepath):
|
||||||
with open(filepath, "rb") as fileh:
|
with open(filepath, "rb") as fileh:
|
||||||
@ -143,8 +147,10 @@ class PushBulletNotificationService(BaseNotificationService):
|
|||||||
_LOGGER.error("Failed to send an empty file.")
|
_LOGGER.error("Failed to send an empty file.")
|
||||||
return
|
return
|
||||||
pusher.push_file(title=title, body=message, **filedata)
|
pusher.push_file(title=title, body=message, **filedata)
|
||||||
|
else:
|
||||||
|
if isinstance(pusher, Device):
|
||||||
|
pusher.push_note(title, message)
|
||||||
else:
|
else:
|
||||||
pusher.push_note(title, message, email=tname)
|
pusher.push_note(title, message, email=tname)
|
||||||
|
|
||||||
except PushError as err:
|
except PushError as err:
|
||||||
_LOGGER.error("Notify failed: %s", err)
|
_LOGGER.error("Notify failed: %s", err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user