diff --git a/homeassistant/components/pushbullet/notify.py b/homeassistant/components/pushbullet/notify.py index 70738965340..76c1e14e5a5 100644 --- a/homeassistant/components/pushbullet/notify.py +++ b/homeassistant/components/pushbullet/notify.py @@ -2,6 +2,9 @@ import logging import mimetypes +from pushbullet import PushBullet +from pushbullet import InvalidKeyError +from pushbullet import PushError import voluptuous as vol from homeassistant.const import CONF_API_KEY @@ -28,8 +31,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({vol.Required(CONF_API_KEY): cv.string} def get_service(hass, config, discovery_info=None): """Get the Pushbullet notification service.""" - from pushbullet import PushBullet - from pushbullet import InvalidKeyError try: pushbullet = PushBullet(config[CONF_API_KEY]) @@ -124,7 +125,6 @@ class PushBulletNotificationService(BaseNotificationService): def _push_data(self, message, title, data, pusher, email=None): """Create the message content.""" - from pushbullet import PushError if data is None: data = {} diff --git a/homeassistant/components/pushbullet/sensor.py b/homeassistant/components/pushbullet/sensor.py index 3ed53fb01f6..600b38b6eaf 100644 --- a/homeassistant/components/pushbullet/sensor.py +++ b/homeassistant/components/pushbullet/sensor.py @@ -1,6 +1,10 @@ """Pushbullet platform for sensor component.""" import logging +import threading +from pushbullet import PushBullet +from pushbullet import InvalidKeyError +from pushbullet import Listener import voluptuous as vol from homeassistant.const import CONF_API_KEY, CONF_MONITORED_CONDITIONS @@ -35,8 +39,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Pushbullet Sensor platform.""" - from pushbullet import PushBullet - from pushbullet import InvalidKeyError try: pushbullet = PushBullet(config.get(CONF_API_KEY)) @@ -95,7 +97,6 @@ class PushBulletNotificationProvider: def __init__(self, pb): """Start to retrieve pushes from the given Pushbullet instance.""" - import threading self.pushbullet = pb self._data = None @@ -123,7 +124,6 @@ class PushBulletNotificationProvider: Spawn a new Listener and links it to self.on_push. """ - from pushbullet import Listener self.listener = Listener(account=self.pushbullet, on_push=self.on_push) _LOGGER.debug("Getting pushes")