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:
parent
86da3fb334
commit
6b92dbe209
2 changed files with 7 additions and 7 deletions
|
@ -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 = {}
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Add table
Reference in a new issue