mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Move imports in bme680 component (#27506)
* moved imports to top level * fixed pylint error * moved imports to top level * fixed import error
This commit is contained in:
parent
5b1f44ba19
commit
16c18d303f
@ -1,14 +1,15 @@
|
||||
"""Support for BME680 Sensor over SMBus."""
|
||||
import importlib
|
||||
import logging
|
||||
import threading
|
||||
from time import sleep, time
|
||||
|
||||
from time import time, sleep
|
||||
|
||||
from smbus import SMBus # pylint: disable=import-error
|
||||
import bme680 # pylint: disable=import-error
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.const import CONF_MONITORED_CONDITIONS, CONF_NAME, TEMP_FAHRENHEIT
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.const import TEMP_FAHRENHEIT, CONF_NAME, CONF_MONITORED_CONDITIONS
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util.temperature import celsius_to_fahrenheit
|
||||
|
||||
@ -121,9 +122,6 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||
|
||||
def _setup_bme680(config):
|
||||
"""Set up and configure the BME680 sensor."""
|
||||
from smbus import SMBus # pylint: disable=import-error
|
||||
|
||||
bme680 = importlib.import_module("bme680")
|
||||
|
||||
sensor_handler = None
|
||||
sensor = None
|
||||
@ -224,7 +222,6 @@ class BME680Handler:
|
||||
self._gas_baseline = None
|
||||
|
||||
if gas_measurement:
|
||||
import threading
|
||||
|
||||
threading.Thread(
|
||||
target=self._run_gas_sensor,
|
||||
|
Loading…
x
Reference in New Issue
Block a user