Move imports for pushbullet component (#27460)

* Move imports in dht component

* remove empty line

* Move imports for pushbullet component

* revert unwanted changes

* Move imports for pushbullet component

* remove dht change from that branch

* remove dht changes from this branch
This commit is contained in:
Sébastien RAMAGE 2019-10-12 22:05:36 +02:00 committed by Paulus Schoutsen
parent 86da3fb334
commit 6b92dbe209
2 changed files with 7 additions and 7 deletions

View file

@ -2,6 +2,9 @@
import logging import logging
import mimetypes import mimetypes
from pushbullet import PushBullet
from pushbullet import InvalidKeyError
from pushbullet import PushError
import voluptuous as vol import voluptuous as vol
from homeassistant.const import CONF_API_KEY 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): def get_service(hass, config, discovery_info=None):
"""Get the Pushbullet notification service.""" """Get the Pushbullet notification service."""
from pushbullet import PushBullet
from pushbullet import InvalidKeyError
try: try:
pushbullet = PushBullet(config[CONF_API_KEY]) pushbullet = PushBullet(config[CONF_API_KEY])
@ -124,7 +125,6 @@ class PushBulletNotificationService(BaseNotificationService):
def _push_data(self, message, title, data, pusher, email=None): def _push_data(self, message, title, data, pusher, email=None):
"""Create the message content.""" """Create the message content."""
from pushbullet import PushError
if data is None: if data is None:
data = {} data = {}

View file

@ -1,6 +1,10 @@
"""Pushbullet platform for sensor component.""" """Pushbullet platform for sensor component."""
import logging import logging
import threading
from pushbullet import PushBullet
from pushbullet import InvalidKeyError
from pushbullet import Listener
import voluptuous as vol import voluptuous as vol
from homeassistant.const import CONF_API_KEY, CONF_MONITORED_CONDITIONS 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): def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Pushbullet Sensor platform.""" """Set up the Pushbullet Sensor platform."""
from pushbullet import PushBullet
from pushbullet import InvalidKeyError
try: try:
pushbullet = PushBullet(config.get(CONF_API_KEY)) pushbullet = PushBullet(config.get(CONF_API_KEY))
@ -95,7 +97,6 @@ class PushBulletNotificationProvider:
def __init__(self, pb): def __init__(self, pb):
"""Start to retrieve pushes from the given Pushbullet instance.""" """Start to retrieve pushes from the given Pushbullet instance."""
import threading
self.pushbullet = pb self.pushbullet = pb
self._data = None self._data = None
@ -123,7 +124,6 @@ class PushBulletNotificationProvider:
Spawn a new Listener and links it to self.on_push. 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) self.listener = Listener(account=self.pushbullet, on_push=self.on_push)
_LOGGER.debug("Getting pushes") _LOGGER.debug("Getting pushes")