From ef394b8af7083772e124b4506890f56f8f09ac0d Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sat, 28 Nov 2015 15:41:30 -0800 Subject: [PATCH] Pushbullet tweaks --- homeassistant/components/notify/pushbullet.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/notify/pushbullet.py b/homeassistant/components/notify/pushbullet.py index 5dc97a399b5..941a78ac709 100644 --- a/homeassistant/components/notify/pushbullet.py +++ b/homeassistant/components/notify/pushbullet.py @@ -100,7 +100,7 @@ class PushBulletNotificationService(BaseNotificationService): # This also seems works to send to all devices in own account if ttype == 'email': self.pushbullet.push_note(title, message, email=tname) - _LOGGER.info('Sent notification to self') + _LOGGER.info('Sent notification to email %s', tname) continue # Refresh if name not found. While awaiting periodic refresh @@ -108,18 +108,21 @@ class PushBulletNotificationService(BaseNotificationService): if ttype not in self.pbtargets: _LOGGER.error('Invalid target syntax: %s', target) continue - if tname.lower() not in self.pbtargets[ttype] and not refreshed: + + tname = tname.lower() + + if tname not in self.pbtargets[ttype] and not refreshed: self.refresh() refreshed = True # Attempt push_note on a dict value. Keys are types & target # name. Dict pbtargets has all *actual* targets. try: - self.pbtargets[ttype][tname.lower()].push_note(title, message) + self.pbtargets[ttype][tname].push_note(title, message) + _LOGGER.info('Sent notification to %s/%s', ttype, tname) except KeyError: _LOGGER.error('No such target: %s/%s', ttype, tname) continue except self.pushbullet.errors.PushError: _LOGGER.error('Notify failed to: %s/%s', ttype, tname) continue - _LOGGER.info('Sent notification to %s/%s', ttype, tname)