mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Move imports in luftdaten component (#27929)
This commit is contained in:
parent
eb48898687
commit
8c0deeb176
@ -1,6 +1,8 @@
|
||||
"""Support for Luftdaten stations."""
|
||||
import logging
|
||||
|
||||
from luftdaten import Luftdaten
|
||||
from luftdaten.exceptions import LuftdatenError
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.config_entries import SOURCE_IMPORT
|
||||
@ -114,8 +116,6 @@ async def async_setup(hass, config):
|
||||
|
||||
async def async_setup_entry(hass, config_entry):
|
||||
"""Set up Luftdaten as config entry."""
|
||||
from luftdaten import Luftdaten
|
||||
from luftdaten.exceptions import LuftdatenError
|
||||
|
||||
if not isinstance(config_entry.data[CONF_SENSOR_ID], int):
|
||||
_async_fixup_sensor_id(hass, config_entry, config_entry.data[CONF_SENSOR_ID])
|
||||
@ -191,8 +191,6 @@ class LuftDatenData:
|
||||
|
||||
async def async_update(self):
|
||||
"""Update sensor/binary sensor data."""
|
||||
from luftdaten.exceptions import LuftdatenError
|
||||
|
||||
try:
|
||||
await self.client.get_data()
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
"""Config flow to configure the Luftdaten component."""
|
||||
from collections import OrderedDict
|
||||
|
||||
from luftdaten import Luftdaten
|
||||
from luftdaten.exceptions import LuftdatenConnectionError
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant import config_entries
|
||||
@ -60,7 +62,6 @@ class LuftDatenFlowHandler(config_entries.ConfigFlow):
|
||||
|
||||
async def async_step_user(self, user_input=None):
|
||||
"""Handle the start of the config flow."""
|
||||
from luftdaten import Luftdaten, exceptions
|
||||
|
||||
if not user_input:
|
||||
return self._show_form()
|
||||
@ -75,7 +76,7 @@ class LuftDatenFlowHandler(config_entries.ConfigFlow):
|
||||
try:
|
||||
await luftdaten.get_data()
|
||||
valid = await luftdaten.validate_sensor()
|
||||
except exceptions.LuftdatenConnectionError:
|
||||
except LuftdatenConnectionError:
|
||||
return self._show_form({CONF_SENSOR_ID: "communication_error"})
|
||||
|
||||
if not valid:
|
||||
|
Loading…
x
Reference in New Issue
Block a user