Fix incorrect device class in goodwe (#83917)
Fix device class in goodwe
This commit is contained in:
parent
534d343f67
commit
fc43fb17a9
1 changed files with 11 additions and 11 deletions
|
@ -17,13 +17,13 @@ from homeassistant.components.sensor import (
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ELECTRIC_POTENTIAL_VOLT,
|
|
||||||
ENERGY_KILO_WATT_HOUR,
|
|
||||||
FREQUENCY_HERTZ,
|
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
POWER_WATT,
|
|
||||||
TEMP_CELSIUS,
|
|
||||||
UnitOfElectricCurrent,
|
UnitOfElectricCurrent,
|
||||||
|
UnitOfElectricPotential,
|
||||||
|
UnitOfEnergy,
|
||||||
|
UnitOfFrequency,
|
||||||
|
UnitOfPower,
|
||||||
|
UnitOfTemperature,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.entity import DeviceInfo, EntityCategory
|
from homeassistant.helpers.entity import DeviceInfo, EntityCategory
|
||||||
|
@ -92,19 +92,19 @@ _DESCRIPTIONS: dict[str, GoodweSensorEntityDescription] = {
|
||||||
key="V",
|
key="V",
|
||||||
device_class=SensorDeviceClass.VOLTAGE,
|
device_class=SensorDeviceClass.VOLTAGE,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=ELECTRIC_POTENTIAL_VOLT,
|
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
|
||||||
),
|
),
|
||||||
"W": GoodweSensorEntityDescription(
|
"W": GoodweSensorEntityDescription(
|
||||||
key="W",
|
key="W",
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
),
|
),
|
||||||
"kWh": GoodweSensorEntityDescription(
|
"kWh": GoodweSensorEntityDescription(
|
||||||
key="kWh",
|
key="kWh",
|
||||||
device_class=SensorDeviceClass.ENERGY,
|
device_class=SensorDeviceClass.ENERGY,
|
||||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||||
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
|
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||||
value=lambda prev, val: prev if not val else val,
|
value=lambda prev, val: prev if not val else val,
|
||||||
available=lambda entity: entity.coordinator.data is not None,
|
available=lambda entity: entity.coordinator.data is not None,
|
||||||
),
|
),
|
||||||
|
@ -112,13 +112,13 @@ _DESCRIPTIONS: dict[str, GoodweSensorEntityDescription] = {
|
||||||
key="C",
|
key="C",
|
||||||
device_class=SensorDeviceClass.TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=TEMP_CELSIUS,
|
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||||
),
|
),
|
||||||
"Hz": GoodweSensorEntityDescription(
|
"Hz": GoodweSensorEntityDescription(
|
||||||
key="Hz",
|
key="Hz",
|
||||||
device_class=SensorDeviceClass.VOLTAGE,
|
device_class=SensorDeviceClass.FREQUENCY,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=FREQUENCY_HERTZ,
|
native_unit_of_measurement=UnitOfFrequency.HERTZ,
|
||||||
),
|
),
|
||||||
"%": GoodweSensorEntityDescription(
|
"%": GoodweSensorEntityDescription(
|
||||||
key="%",
|
key="%",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue