Move imports to top for sensehat (#29259)
This commit is contained in:
parent
f2b06d9abd
commit
93150f6f94
2 changed files with 8 additions and 8 deletions
|
@ -1,18 +1,19 @@
|
|||
"""Support for Sense Hat LEDs."""
|
||||
import logging
|
||||
|
||||
from sense_hat import SenseHat
|
||||
import voluptuous as vol
|
||||
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.components.light import (
|
||||
ATTR_BRIGHTNESS,
|
||||
SUPPORT_BRIGHTNESS,
|
||||
ATTR_HS_COLOR,
|
||||
PLATFORM_SCHEMA,
|
||||
SUPPORT_BRIGHTNESS,
|
||||
SUPPORT_COLOR,
|
||||
Light,
|
||||
PLATFORM_SCHEMA,
|
||||
)
|
||||
from homeassistant.const import CONF_NAME
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
import homeassistant.util.color as color_util
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -28,7 +29,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
"""Set up the Sense Hat Light platform."""
|
||||
from sense_hat import SenseHat
|
||||
|
||||
sensehat = SenseHat()
|
||||
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
"""Support for Sense HAT sensors."""
|
||||
import os
|
||||
import logging
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
import os
|
||||
|
||||
from sense_hat import SenseHat
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.const import TEMP_CELSIUS, CONF_DISPLAY_OPTIONS, CONF_NAME
|
||||
from homeassistant.const import CONF_DISPLAY_OPTIONS, CONF_NAME, TEMP_CELSIUS
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
|
@ -117,7 +118,6 @@ class SenseHatData:
|
|||
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
||||
def update(self):
|
||||
"""Get the latest data from Sense HAT."""
|
||||
from sense_hat import SenseHat
|
||||
|
||||
sense = SenseHat()
|
||||
temp_from_h = sense.get_temperature_from_humidity()
|
||||
|
|
Loading…
Add table
Reference in a new issue