mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Move imports to top for sht31 (#29260)
This commit is contained in:
parent
221db3a2dd
commit
f2b06d9abd
@ -4,17 +4,21 @@ from datetime import timedelta
|
|||||||
import logging
|
import logging
|
||||||
import math
|
import math
|
||||||
|
|
||||||
|
from Adafruit_SHT31 import SHT31
|
||||||
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_NAME, CONF_MONITORED_CONDITIONS
|
from homeassistant.const import (
|
||||||
|
CONF_MONITORED_CONDITIONS,
|
||||||
|
CONF_NAME,
|
||||||
|
PRECISION_TENTHS,
|
||||||
|
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.helpers.temperature import display_temp
|
from homeassistant.helpers.temperature import display_temp
|
||||||
from homeassistant.const import PRECISION_TENTHS
|
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
CONF_I2C_ADDRESS = "i2c_address"
|
CONF_I2C_ADDRESS = "i2c_address"
|
||||||
@ -43,7 +47,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 sensor platform."""
|
"""Set up the sensor platform."""
|
||||||
from Adafruit_SHT31 import SHT31
|
|
||||||
|
|
||||||
i2c_address = config.get(CONF_I2C_ADDRESS)
|
i2c_address = config.get(CONF_I2C_ADDRESS)
|
||||||
sensor = SHT31(address=i2c_address)
|
sensor = SHT31(address=i2c_address)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user