mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Move imports to top for volkszaehler (#29025)
This commit is contained in:
parent
94f8e634b2
commit
ce8e0e5489
@ -2,6 +2,8 @@
|
|||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from volkszaehler import Volkszaehler
|
||||||
|
from volkszaehler.exceptions import VolkszaehlerApiConnectionError
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||||
@ -51,7 +53,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|||||||
|
|
||||||
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
||||||
"""Set up the Volkszaehler sensors."""
|
"""Set up the Volkszaehler sensors."""
|
||||||
from volkszaehler import Volkszaehler
|
|
||||||
|
|
||||||
host = config[CONF_HOST]
|
host = config[CONF_HOST]
|
||||||
name = config[CONF_NAME]
|
name = config[CONF_NAME]
|
||||||
@ -130,7 +131,6 @@ class VolkszaehlerData:
|
|||||||
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
||||||
async def async_update(self):
|
async def async_update(self):
|
||||||
"""Get the latest data from the Volkszaehler REST API."""
|
"""Get the latest data from the Volkszaehler REST API."""
|
||||||
from volkszaehler.exceptions import VolkszaehlerApiConnectionError
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await self.api.get_data()
|
await self.api.get_data()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user