Use new DeviceClass and StateClass in enphase_envoy (#61388)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-12-10 09:12:38 +01:00 committed by GitHub
parent d143aa06e3
commit 45425f118c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,16 +2,11 @@
from homeassistant.components.sensor import ( from homeassistant.components.sensor import (
STATE_CLASS_MEASUREMENT, SensorDeviceClass,
STATE_CLASS_TOTAL_INCREASING,
SensorEntityDescription, SensorEntityDescription,
SensorStateClass,
) )
from homeassistant.const import ( from homeassistant.const import ENERGY_WATT_HOUR, POWER_WATT, Platform
DEVICE_CLASS_ENERGY,
ENERGY_WATT_HOUR,
POWER_WATT,
Platform,
)
DOMAIN = "enphase_envoy" DOMAIN = "enphase_envoy"
@ -26,60 +21,60 @@ SENSORS = (
key="production", key="production",
name="Current Power Production", name="Current Power Production",
native_unit_of_measurement=POWER_WATT, native_unit_of_measurement=POWER_WATT,
state_class=STATE_CLASS_MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key="daily_production", key="daily_production",
name="Today's Energy Production", name="Today's Energy Production",
native_unit_of_measurement=ENERGY_WATT_HOUR, native_unit_of_measurement=ENERGY_WATT_HOUR,
state_class=STATE_CLASS_TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
device_class=DEVICE_CLASS_ENERGY, device_class=SensorDeviceClass.ENERGY,
), ),
SensorEntityDescription( SensorEntityDescription(
key="seven_days_production", key="seven_days_production",
name="Last Seven Days Energy Production", name="Last Seven Days Energy Production",
native_unit_of_measurement=ENERGY_WATT_HOUR, native_unit_of_measurement=ENERGY_WATT_HOUR,
state_class=STATE_CLASS_MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
device_class=DEVICE_CLASS_ENERGY, device_class=SensorDeviceClass.ENERGY,
), ),
SensorEntityDescription( SensorEntityDescription(
key="lifetime_production", key="lifetime_production",
name="Lifetime Energy Production", name="Lifetime Energy Production",
native_unit_of_measurement=ENERGY_WATT_HOUR, native_unit_of_measurement=ENERGY_WATT_HOUR,
state_class=STATE_CLASS_TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
device_class=DEVICE_CLASS_ENERGY, device_class=SensorDeviceClass.ENERGY,
), ),
SensorEntityDescription( SensorEntityDescription(
key="consumption", key="consumption",
name="Current Power Consumption", name="Current Power Consumption",
native_unit_of_measurement=POWER_WATT, native_unit_of_measurement=POWER_WATT,
state_class=STATE_CLASS_MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key="daily_consumption", key="daily_consumption",
name="Today's Energy Consumption", name="Today's Energy Consumption",
native_unit_of_measurement=ENERGY_WATT_HOUR, native_unit_of_measurement=ENERGY_WATT_HOUR,
state_class=STATE_CLASS_MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
device_class=DEVICE_CLASS_ENERGY, device_class=SensorDeviceClass.ENERGY,
), ),
SensorEntityDescription( SensorEntityDescription(
key="seven_days_consumption", key="seven_days_consumption",
name="Last Seven Days Energy Consumption", name="Last Seven Days Energy Consumption",
native_unit_of_measurement=ENERGY_WATT_HOUR, native_unit_of_measurement=ENERGY_WATT_HOUR,
state_class=STATE_CLASS_MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
device_class=DEVICE_CLASS_ENERGY, device_class=SensorDeviceClass.ENERGY,
), ),
SensorEntityDescription( SensorEntityDescription(
key="lifetime_consumption", key="lifetime_consumption",
name="Lifetime Energy Consumption", name="Lifetime Energy Consumption",
native_unit_of_measurement=ENERGY_WATT_HOUR, native_unit_of_measurement=ENERGY_WATT_HOUR,
state_class=STATE_CLASS_TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
device_class=DEVICE_CLASS_ENERGY, device_class=SensorDeviceClass.ENERGY,
), ),
SensorEntityDescription( SensorEntityDescription(
key="inverters", key="inverters",
name="Inverter", name="Inverter",
native_unit_of_measurement=POWER_WATT, native_unit_of_measurement=POWER_WATT,
state_class=STATE_CLASS_MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
) )