mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
Move imports to top for enphase_envoy (#29450)
This commit is contained in:
parent
0158f29e4e
commit
10759b7ca6
@ -1,19 +1,19 @@
|
|||||||
"""Support for Enphase Envoy solar energy monitor."""
|
"""Support for Enphase Envoy solar energy monitor."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from envoy_reader.envoy_reader import EnvoyReader
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||||
import homeassistant.helpers.config_validation as cv
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_IP_ADDRESS,
|
CONF_IP_ADDRESS,
|
||||||
CONF_MONITORED_CONDITIONS,
|
CONF_MONITORED_CONDITIONS,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
POWER_WATT,
|
|
||||||
ENERGY_WATT_HOUR,
|
ENERGY_WATT_HOUR,
|
||||||
|
POWER_WATT,
|
||||||
)
|
)
|
||||||
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
from homeassistant.helpers.entity import Entity
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -52,7 +52,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 Enphase Envoy sensor."""
|
"""Set up the Enphase Envoy sensor."""
|
||||||
from envoy_reader.envoy_reader import EnvoyReader
|
|
||||||
|
|
||||||
ip_address = config[CONF_IP_ADDRESS]
|
ip_address = config[CONF_IP_ADDRESS]
|
||||||
monitored_conditions = config[CONF_MONITORED_CONDITIONS]
|
monitored_conditions = config[CONF_MONITORED_CONDITIONS]
|
||||||
@ -118,7 +117,6 @@ class Envoy(Entity):
|
|||||||
|
|
||||||
async def async_update(self):
|
async def async_update(self):
|
||||||
"""Get the energy production data from the Enphase Envoy."""
|
"""Get the energy production data from the Enphase Envoy."""
|
||||||
from envoy_reader.envoy_reader import EnvoyReader
|
|
||||||
|
|
||||||
if self._type != "inverters":
|
if self._type != "inverters":
|
||||||
_state = await getattr(EnvoyReader(self._ip_address), self._type)()
|
_state = await getattr(EnvoyReader(self._ip_address), self._type)()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user