Use POWER device class in enphase_envoy (#83811)

This commit is contained in:
epenet 2022-12-12 11:49:02 +01:00 committed by GitHub
parent 4fe025b297
commit 1667b4b19e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 13 deletions

View file

@ -14,7 +14,7 @@ from homeassistant.components.sensor import (
SensorStateClass,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import POWER_WATT
from homeassistant.const import UnitOfPower
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -60,8 +60,9 @@ def _inverter_last_report_time(
INVERTER_SENSORS = (
EnvoySensorEntityDescription(
key=INVERTERS_KEY,
native_unit_of_measurement=POWER_WATT,
native_unit_of_measurement=UnitOfPower.WATT,
state_class=SensorStateClass.MEASUREMENT,
device_class=SensorDeviceClass.POWER,
value_fn=lambda watt_report_time: watt_report_time[0],
),
EnvoySensorEntityDescription(