mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Move imports to top for sensehat (#29259)
This commit is contained in:
parent
f2b06d9abd
commit
93150f6f94
@ -1,18 +1,19 @@
|
|||||||
"""Support for Sense Hat LEDs."""
|
"""Support for Sense Hat LEDs."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from sense_hat import SenseHat
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.helpers.config_validation as cv
|
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS,
|
ATTR_BRIGHTNESS,
|
||||||
SUPPORT_BRIGHTNESS,
|
|
||||||
ATTR_HS_COLOR,
|
ATTR_HS_COLOR,
|
||||||
|
PLATFORM_SCHEMA,
|
||||||
|
SUPPORT_BRIGHTNESS,
|
||||||
SUPPORT_COLOR,
|
SUPPORT_COLOR,
|
||||||
Light,
|
Light,
|
||||||
PLATFORM_SCHEMA,
|
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_NAME
|
from homeassistant.const import CONF_NAME
|
||||||
|
import homeassistant.helpers.config_validation as cv
|
||||||
import homeassistant.util.color as color_util
|
import homeassistant.util.color as color_util
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
@ -28,7 +29,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 Sense Hat Light platform."""
|
"""Set up the Sense Hat Light platform."""
|
||||||
from sense_hat import SenseHat
|
|
||||||
|
|
||||||
sensehat = SenseHat()
|
sensehat = SenseHat()
|
||||||
|
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
"""Support for Sense HAT sensors."""
|
"""Support for Sense HAT sensors."""
|
||||||
import os
|
|
||||||
import logging
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
|
|
||||||
|
from sense_hat import SenseHat
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
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
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
@ -117,7 +118,6 @@ class SenseHatData:
|
|||||||
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Get the latest data from Sense HAT."""
|
"""Get the latest data from Sense HAT."""
|
||||||
from sense_hat import SenseHat
|
|
||||||
|
|
||||||
sense = SenseHat()
|
sense = SenseHat()
|
||||||
temp_from_h = sense.get_temperature_from_humidity()
|
temp_from_h = sense.get_temperature_from_humidity()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user