Add Solar Edge entity device and state class (#55902)

This commit is contained in:
terminet85 2021-10-27 16:42:56 +02:00 committed by GitHub
parent 41e14c4871
commit 0111b28a67
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 6 deletions

View file

@ -2,7 +2,11 @@
from datetime import timedelta
import logging
from homeassistant.components.sensor import STATE_CLASS_MEASUREMENT, STATE_CLASS_TOTAL
from homeassistant.components.sensor import (
STATE_CLASS_MEASUREMENT,
STATE_CLASS_TOTAL,
STATE_CLASS_TOTAL_INCREASING,
)
from homeassistant.const import (
DEVICE_CLASS_ENERGY,
DEVICE_CLASS_POWER,
@ -147,35 +151,45 @@ SENSOR_TYPES = [
json_key="Purchased",
name="Imported Power",
entity_registry_enabled_default=False,
icon="mdi:flash",
state_class=STATE_CLASS_TOTAL_INCREASING,
native_unit_of_measurement=ENERGY_WATT_HOUR,
device_class=DEVICE_CLASS_ENERGY,
),
SolarEdgeSensorEntityDescription(
key="production_power",
json_key="Production",
name="Production Power",
entity_registry_enabled_default=False,
icon="mdi:flash",
state_class=STATE_CLASS_TOTAL_INCREASING,
native_unit_of_measurement=ENERGY_WATT_HOUR,
device_class=DEVICE_CLASS_ENERGY,
),
SolarEdgeSensorEntityDescription(
key="consumption_power",
json_key="Consumption",
name="Consumption Power",
entity_registry_enabled_default=False,
icon="mdi:flash",
state_class=STATE_CLASS_TOTAL_INCREASING,
native_unit_of_measurement=ENERGY_WATT_HOUR,
device_class=DEVICE_CLASS_ENERGY,
),
SolarEdgeSensorEntityDescription(
key="selfconsumption_power",
json_key="SelfConsumption",
name="SelfConsumption Power",
entity_registry_enabled_default=False,
icon="mdi:flash",
state_class=STATE_CLASS_TOTAL_INCREASING,
native_unit_of_measurement=ENERGY_WATT_HOUR,
device_class=DEVICE_CLASS_ENERGY,
),
SolarEdgeSensorEntityDescription(
key="feedin_power",
json_key="FeedIn",
name="Exported Power",
entity_registry_enabled_default=False,
icon="mdi:flash",
state_class=STATE_CLASS_TOTAL_INCREASING,
native_unit_of_measurement=ENERGY_WATT_HOUR,
device_class=DEVICE_CLASS_ENERGY,
),
SolarEdgeSensorEntityDescription(
key="storage_level",