Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add state_class to Kostal plenticore sensors #108096

Merged
merged 1 commit into from
Jan 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion homeassistant/components/kostal_plenticore/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class PlenticoreSensorEntityDescription(
name="Home Power from Battery",
native_unit_of_measurement=UnitOfPower.WATT,
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
edenhaus marked this conversation as resolved.
Show resolved Hide resolved
formatter="format_round",
),
PlenticoreSensorEntityDescription(
Expand Down Expand Up @@ -232,7 +233,7 @@ class PlenticoreSensorEntityDescription(
key="Cycles",
name="Battery Cycles",
icon="mdi:recycle",
state_class=SensorStateClass.MEASUREMENT,
edenhaus marked this conversation as resolved.
Show resolved Hide resolved
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_round",
),
PlenticoreSensorEntityDescription(
Expand Down Expand Up @@ -324,6 +325,7 @@ class PlenticoreSensorEntityDescription(
name="Home Consumption Day",
stegm marked this conversation as resolved.
Show resolved Hide resolved
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -332,6 +334,7 @@ class PlenticoreSensorEntityDescription(
name="Home Consumption Month",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -340,6 +343,7 @@ class PlenticoreSensorEntityDescription(
name="Home Consumption Year",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -357,6 +361,7 @@ class PlenticoreSensorEntityDescription(
name="Home Consumption from Battery Day",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -365,6 +370,7 @@ class PlenticoreSensorEntityDescription(
name="Home Consumption from Battery Month",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -373,6 +379,7 @@ class PlenticoreSensorEntityDescription(
name="Home Consumption from Battery Year",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -390,6 +397,7 @@ class PlenticoreSensorEntityDescription(
name="Home Consumption from Grid Day",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -398,6 +406,7 @@ class PlenticoreSensorEntityDescription(
name="Home Consumption from Grid Month",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -406,6 +415,7 @@ class PlenticoreSensorEntityDescription(
name="Home Consumption from Grid Year",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -423,6 +433,7 @@ class PlenticoreSensorEntityDescription(
name="Home Consumption from PV Day",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -431,6 +442,7 @@ class PlenticoreSensorEntityDescription(
name="Home Consumption from PV Month",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -439,6 +451,7 @@ class PlenticoreSensorEntityDescription(
name="Home Consumption from PV Year",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -456,6 +469,7 @@ class PlenticoreSensorEntityDescription(
name="Energy PV1 Day",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -464,6 +478,7 @@ class PlenticoreSensorEntityDescription(
name="Energy PV1 Month",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -472,6 +487,7 @@ class PlenticoreSensorEntityDescription(
name="Energy PV1 Year",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -489,6 +505,7 @@ class PlenticoreSensorEntityDescription(
name="Energy PV2 Day",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -497,6 +514,7 @@ class PlenticoreSensorEntityDescription(
name="Energy PV2 Month",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -505,6 +523,7 @@ class PlenticoreSensorEntityDescription(
name="Energy PV2 Year",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -522,6 +541,7 @@ class PlenticoreSensorEntityDescription(
name="Energy PV3 Day",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -530,6 +550,7 @@ class PlenticoreSensorEntityDescription(
name="Energy PV3 Month",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -538,6 +559,7 @@ class PlenticoreSensorEntityDescription(
name="Energy PV3 Year",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -556,6 +578,7 @@ class PlenticoreSensorEntityDescription(
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
entity_registry_enabled_default=True,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -564,6 +587,7 @@ class PlenticoreSensorEntityDescription(
name="Energy Yield Month",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -572,6 +596,7 @@ class PlenticoreSensorEntityDescription(
name="Energy Yield Year",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -589,6 +614,7 @@ class PlenticoreSensorEntityDescription(
name="Battery Charge from Grid Day",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -597,6 +623,7 @@ class PlenticoreSensorEntityDescription(
name="Battery Charge from Grid Month",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -605,6 +632,7 @@ class PlenticoreSensorEntityDescription(
name="Battery Charge from Grid Year",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -622,6 +650,7 @@ class PlenticoreSensorEntityDescription(
name="Battery Charge from PV Day",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -630,6 +659,7 @@ class PlenticoreSensorEntityDescription(
name="Battery Charge from PV Month",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -638,6 +668,7 @@ class PlenticoreSensorEntityDescription(
name="Battery Charge from PV Year",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -655,6 +686,7 @@ class PlenticoreSensorEntityDescription(
name="Battery Discharge Day",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -663,6 +695,7 @@ class PlenticoreSensorEntityDescription(
name="Battery Discharge Month",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -671,6 +704,7 @@ class PlenticoreSensorEntityDescription(
name="Battery Discharge Year",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -688,6 +722,7 @@ class PlenticoreSensorEntityDescription(
name="Energy Discharge to Grid Day",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -696,6 +731,7 @@ class PlenticoreSensorEntityDescription(
name="Energy Discharge to Grid Month",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand All @@ -704,6 +740,7 @@ class PlenticoreSensorEntityDescription(
name="Energy Discharge to Grid Year",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
formatter="format_energy",
),
PlenticoreSensorEntityDescription(
Expand Down