From 493353e4deaa8f74234d5a6fff171e3c73d66b88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20H=C3=B8yer=20Iversen?= Date: Sat, 26 Aug 2017 18:12:51 +0200 Subject: [PATCH] bug fix pushbullet (#9139) --- homeassistant/components/notify/pushbullet.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/notify/pushbullet.py b/homeassistant/components/notify/pushbullet.py index 353e833ae51..0d596fb41ba 100644 --- a/homeassistant/components/notify/pushbullet.py +++ b/homeassistant/components/notify/pushbullet.py @@ -133,9 +133,13 @@ class PushBulletNotificationService(BaseNotificationService): def _push_data(self, filepath, message, title, url, pusher, tname=None): from pushbullet import PushError + from pushbullet import Device try: if url: - pusher.push_link(title, url, body=message, email=tname) + if isinstance(pusher, Device): + pusher.push_link(title, url, body=message) + else: + pusher.push_link(title, url, body=message, email=tname) elif filepath and self.hass.config.is_allowed_path(filepath): with open(filepath, "rb") as fileh: filedata = self.pushbullet.upload_file(fileh, filepath) @@ -144,7 +148,9 @@ class PushBulletNotificationService(BaseNotificationService): return pusher.push_file(title=title, body=message, **filedata) else: - pusher.push_note(title, message, email=tname) - + if isinstance(pusher, Device): + pusher.push_note(title, message) + else: + pusher.push_note(title, message, email=tname) except PushError as err: _LOGGER.error("Notify failed: %s", err)