Move imports in dweet component (#27976)
This commit is contained in:
parent
9db07b2a41
commit
54a711ca6a
2 changed files with 9 additions and 13 deletions
|
@ -1,18 +1,19 @@
|
|||
"""Support for showing values from Dweet.io."""
|
||||
from datetime import timedelta
|
||||
import json
|
||||
import logging
|
||||
from datetime import timedelta
|
||||
|
||||
import dweepy
|
||||
import voluptuous as vol
|
||||
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.const import (
|
||||
CONF_NAME,
|
||||
CONF_VALUE_TEMPLATE,
|
||||
CONF_UNIT_OF_MEASUREMENT,
|
||||
CONF_DEVICE,
|
||||
CONF_NAME,
|
||||
CONF_UNIT_OF_MEASUREMENT,
|
||||
CONF_VALUE_TEMPLATE,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -33,8 +34,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
"""Set up the Dweet sensor."""
|
||||
import dweepy
|
||||
|
||||
name = config.get(CONF_NAME)
|
||||
device = config.get(CONF_DEVICE)
|
||||
value_template = config.get(CONF_VALUE_TEMPLATE)
|
||||
|
@ -107,8 +106,6 @@ class DweetData:
|
|||
|
||||
def update(self):
|
||||
"""Get the latest data from Dweet.io."""
|
||||
import dweepy
|
||||
|
||||
try:
|
||||
self.data = dweepy.get_latest_dweet_for(self._device)
|
||||
except dweepy.DweepyError:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue