Clean up Enphase Envoy const file (#95536)
This commit is contained in:
parent
44803e1177
commit
15c52e67a0
3 changed files with 62 additions and 66 deletions
|
@ -16,7 +16,8 @@ from homeassistant.helpers import device_registry as dr
|
||||||
from homeassistant.helpers.httpx_client import get_async_client
|
from homeassistant.helpers.httpx_client import get_async_client
|
||||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||||
|
|
||||||
from .const import COORDINATOR, DOMAIN, NAME, PLATFORMS, SENSORS
|
from .const import COORDINATOR, DOMAIN, NAME, PLATFORMS
|
||||||
|
from .sensor import SENSORS
|
||||||
|
|
||||||
SCAN_INTERVAL = timedelta(seconds=60)
|
SCAN_INTERVAL = timedelta(seconds=60)
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
"""The enphase_envoy component."""
|
"""The enphase_envoy component."""
|
||||||
from homeassistant.components.sensor import (
|
from homeassistant.const import Platform
|
||||||
SensorDeviceClass,
|
|
||||||
SensorEntityDescription,
|
|
||||||
SensorStateClass,
|
|
||||||
)
|
|
||||||
from homeassistant.const import Platform, UnitOfEnergy, UnitOfPower
|
|
||||||
|
|
||||||
DOMAIN = "enphase_envoy"
|
DOMAIN = "enphase_envoy"
|
||||||
|
|
||||||
|
@ -13,60 +8,3 @@ PLATFORMS = [Platform.SENSOR]
|
||||||
|
|
||||||
COORDINATOR = "coordinator"
|
COORDINATOR = "coordinator"
|
||||||
NAME = "name"
|
NAME = "name"
|
||||||
|
|
||||||
SENSORS = (
|
|
||||||
SensorEntityDescription(
|
|
||||||
key="production",
|
|
||||||
name="Current Power Production",
|
|
||||||
native_unit_of_measurement=UnitOfPower.WATT,
|
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
|
||||||
device_class=SensorDeviceClass.POWER,
|
|
||||||
),
|
|
||||||
SensorEntityDescription(
|
|
||||||
key="daily_production",
|
|
||||||
name="Today's Energy Production",
|
|
||||||
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
|
|
||||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
|
||||||
device_class=SensorDeviceClass.ENERGY,
|
|
||||||
),
|
|
||||||
SensorEntityDescription(
|
|
||||||
key="seven_days_production",
|
|
||||||
name="Last Seven Days Energy Production",
|
|
||||||
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
|
|
||||||
device_class=SensorDeviceClass.ENERGY,
|
|
||||||
),
|
|
||||||
SensorEntityDescription(
|
|
||||||
key="lifetime_production",
|
|
||||||
name="Lifetime Energy Production",
|
|
||||||
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
|
|
||||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
|
||||||
device_class=SensorDeviceClass.ENERGY,
|
|
||||||
),
|
|
||||||
SensorEntityDescription(
|
|
||||||
key="consumption",
|
|
||||||
name="Current Power Consumption",
|
|
||||||
native_unit_of_measurement=UnitOfPower.WATT,
|
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
|
||||||
device_class=SensorDeviceClass.POWER,
|
|
||||||
),
|
|
||||||
SensorEntityDescription(
|
|
||||||
key="daily_consumption",
|
|
||||||
name="Today's Energy Consumption",
|
|
||||||
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
|
|
||||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
|
||||||
device_class=SensorDeviceClass.ENERGY,
|
|
||||||
),
|
|
||||||
SensorEntityDescription(
|
|
||||||
key="seven_days_consumption",
|
|
||||||
name="Last Seven Days Energy Consumption",
|
|
||||||
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
|
|
||||||
device_class=SensorDeviceClass.ENERGY,
|
|
||||||
),
|
|
||||||
SensorEntityDescription(
|
|
||||||
key="lifetime_consumption",
|
|
||||||
name="Lifetime Energy Consumption",
|
|
||||||
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
|
|
||||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
|
||||||
device_class=SensorDeviceClass.ENERGY,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ from homeassistant.components.sensor import (
|
||||||
SensorStateClass,
|
SensorStateClass,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import UnitOfPower
|
from homeassistant.const import UnitOfEnergy, UnitOfPower
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity import DeviceInfo
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
@ -25,7 +25,7 @@ from homeassistant.helpers.update_coordinator import (
|
||||||
)
|
)
|
||||||
from homeassistant.util import dt as dt_util
|
from homeassistant.util import dt as dt_util
|
||||||
|
|
||||||
from .const import COORDINATOR, DOMAIN, NAME, SENSORS
|
from .const import COORDINATOR, DOMAIN, NAME
|
||||||
|
|
||||||
ICON = "mdi:flash"
|
ICON = "mdi:flash"
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
@ -75,6 +75,63 @@ INVERTER_SENSORS = (
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
SENSORS = (
|
||||||
|
SensorEntityDescription(
|
||||||
|
key="production",
|
||||||
|
name="Current Power Production",
|
||||||
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
|
device_class=SensorDeviceClass.POWER,
|
||||||
|
),
|
||||||
|
SensorEntityDescription(
|
||||||
|
key="daily_production",
|
||||||
|
name="Today's Energy Production",
|
||||||
|
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
|
||||||
|
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||||
|
device_class=SensorDeviceClass.ENERGY,
|
||||||
|
),
|
||||||
|
SensorEntityDescription(
|
||||||
|
key="seven_days_production",
|
||||||
|
name="Last Seven Days Energy Production",
|
||||||
|
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
|
||||||
|
device_class=SensorDeviceClass.ENERGY,
|
||||||
|
),
|
||||||
|
SensorEntityDescription(
|
||||||
|
key="lifetime_production",
|
||||||
|
name="Lifetime Energy Production",
|
||||||
|
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
|
||||||
|
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||||
|
device_class=SensorDeviceClass.ENERGY,
|
||||||
|
),
|
||||||
|
SensorEntityDescription(
|
||||||
|
key="consumption",
|
||||||
|
name="Current Power Consumption",
|
||||||
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
|
device_class=SensorDeviceClass.POWER,
|
||||||
|
),
|
||||||
|
SensorEntityDescription(
|
||||||
|
key="daily_consumption",
|
||||||
|
name="Today's Energy Consumption",
|
||||||
|
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
|
||||||
|
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||||
|
device_class=SensorDeviceClass.ENERGY,
|
||||||
|
),
|
||||||
|
SensorEntityDescription(
|
||||||
|
key="seven_days_consumption",
|
||||||
|
name="Last Seven Days Energy Consumption",
|
||||||
|
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
|
||||||
|
device_class=SensorDeviceClass.ENERGY,
|
||||||
|
),
|
||||||
|
SensorEntityDescription(
|
||||||
|
key="lifetime_consumption",
|
||||||
|
name="Lifetime Energy Consumption",
|
||||||
|
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
|
||||||
|
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||||
|
device_class=SensorDeviceClass.ENERGY,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue