From f4d832508486ccb1efebef546aa5bba6626b2879 Mon Sep 17 00:00:00 2001 From: Tom Duijf Date: Mon, 16 Nov 2015 00:29:04 +0000 Subject: [PATCH] Pushbullet; code cleanup & better errors on config typos --- homeassistant/components/notify/pushbullet.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/notify/pushbullet.py b/homeassistant/components/notify/pushbullet.py index 4f2a80021a7..9e9b941394e 100644 --- a/homeassistant/components/notify/pushbullet.py +++ b/homeassistant/components/notify/pushbullet.py @@ -93,9 +93,17 @@ class PushBulletNotificationService(BaseNotificationService): _LOGGER.info('Sent notification to self') continue - ttype, tname = target.split('/', 1) + try: + ttype, tname = target.split('/', 1) + except ValueError: + _LOGGER.error('Invalid target syntax: %s', target) + continue - # Refresh if name not found. Poor mans refresh ;) + # Refresh if name not found. While awaiting periodic refresh + # solution in component, poor mans refresh ;) + if ttype not in self.pbtargets: + _LOGGER.error('Invalid target syntax: %s', target) + continue if tname not in self.pbtargets[ttype] and not refreshed: self.refresh() refreshed = True