Correct total state_class of huisbaasje sensors (#102945)

* Change all cumulative-interval sensors to TOTAL
This commit is contained in:
Bouwe Westerdijk 2023-10-29 09:17:57 +01:00 committed by GitHub
parent af851b6c2b
commit 9cc7012d32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 34 deletions

View File

@ -146,7 +146,7 @@ SENSORS_INFO = [
translation_key="energy_today",
device_class=SensorDeviceClass.ENERGY,
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
state_class=SensorStateClass.TOTAL_INCREASING,
state_class=SensorStateClass.TOTAL,
key=SOURCE_TYPE_ELECTRICITY,
sensor_type=SENSOR_TYPE_THIS_DAY,
precision=1,
@ -156,7 +156,7 @@ SENSORS_INFO = [
translation_key="energy_week",
device_class=SensorDeviceClass.ENERGY,
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
state_class=SensorStateClass.TOTAL_INCREASING,
state_class=SensorStateClass.TOTAL,
key=SOURCE_TYPE_ELECTRICITY,
sensor_type=SENSOR_TYPE_THIS_WEEK,
precision=1,
@ -166,7 +166,7 @@ SENSORS_INFO = [
translation_key="energy_month",
device_class=SensorDeviceClass.ENERGY,
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
state_class=SensorStateClass.TOTAL_INCREASING,
state_class=SensorStateClass.TOTAL,
key=SOURCE_TYPE_ELECTRICITY,
sensor_type=SENSOR_TYPE_THIS_MONTH,
precision=1,
@ -176,7 +176,7 @@ SENSORS_INFO = [
translation_key="energy_year",
device_class=SensorDeviceClass.ENERGY,
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
state_class=SensorStateClass.TOTAL_INCREASING,
state_class=SensorStateClass.TOTAL,
key=SOURCE_TYPE_ELECTRICITY,
sensor_type=SENSOR_TYPE_THIS_YEAR,
precision=1,
@ -197,7 +197,7 @@ SENSORS_INFO = [
native_unit_of_measurement=UnitOfVolume.CUBIC_METERS,
key=SOURCE_TYPE_GAS,
sensor_type=SENSOR_TYPE_THIS_DAY,
state_class=SensorStateClass.TOTAL_INCREASING,
state_class=SensorStateClass.TOTAL,
icon="mdi:counter",
precision=1,
),
@ -207,7 +207,7 @@ SENSORS_INFO = [
native_unit_of_measurement=UnitOfVolume.CUBIC_METERS,
key=SOURCE_TYPE_GAS,
sensor_type=SENSOR_TYPE_THIS_WEEK,
state_class=SensorStateClass.TOTAL_INCREASING,
state_class=SensorStateClass.TOTAL,
icon="mdi:counter",
precision=1,
),
@ -217,7 +217,7 @@ SENSORS_INFO = [
native_unit_of_measurement=UnitOfVolume.CUBIC_METERS,
key=SOURCE_TYPE_GAS,
sensor_type=SENSOR_TYPE_THIS_MONTH,
state_class=SensorStateClass.TOTAL_INCREASING,
state_class=SensorStateClass.TOTAL,
icon="mdi:counter",
precision=1,
),
@ -227,7 +227,7 @@ SENSORS_INFO = [
native_unit_of_measurement=UnitOfVolume.CUBIC_METERS,
key=SOURCE_TYPE_GAS,
sensor_type=SENSOR_TYPE_THIS_YEAR,
state_class=SensorStateClass.TOTAL_INCREASING,
state_class=SensorStateClass.TOTAL,
icon="mdi:counter",
precision=1,
),

View File

@ -222,10 +222,7 @@ async def test_setup_entry(hass: HomeAssistant) -> None:
energy_today.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.ENERGY
)
assert energy_today.attributes.get(ATTR_ICON) == "mdi:lightning-bolt"
assert (
energy_today.attributes.get(ATTR_STATE_CLASS)
is SensorStateClass.TOTAL_INCREASING
)
assert energy_today.attributes.get(ATTR_STATE_CLASS) is SensorStateClass.TOTAL
assert (
energy_today.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
== UnitOfEnergy.KILO_WATT_HOUR
@ -239,8 +236,7 @@ async def test_setup_entry(hass: HomeAssistant) -> None:
)
assert energy_this_week.attributes.get(ATTR_ICON) == "mdi:lightning-bolt"
assert (
energy_this_week.attributes.get(ATTR_STATE_CLASS)
is SensorStateClass.TOTAL_INCREASING
energy_this_week.attributes.get(ATTR_STATE_CLASS) is SensorStateClass.TOTAL
)
assert (
energy_this_week.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
@ -255,8 +251,7 @@ async def test_setup_entry(hass: HomeAssistant) -> None:
)
assert energy_this_month.attributes.get(ATTR_ICON) == "mdi:lightning-bolt"
assert (
energy_this_month.attributes.get(ATTR_STATE_CLASS)
is SensorStateClass.TOTAL_INCREASING
energy_this_month.attributes.get(ATTR_STATE_CLASS) is SensorStateClass.TOTAL
)
assert (
energy_this_month.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
@ -271,8 +266,7 @@ async def test_setup_entry(hass: HomeAssistant) -> None:
)
assert energy_this_year.attributes.get(ATTR_ICON) == "mdi:lightning-bolt"
assert (
energy_this_year.attributes.get(ATTR_STATE_CLASS)
is SensorStateClass.TOTAL_INCREASING
energy_this_year.attributes.get(ATTR_STATE_CLASS) is SensorStateClass.TOTAL
)
assert (
energy_this_year.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
@ -295,10 +289,7 @@ async def test_setup_entry(hass: HomeAssistant) -> None:
assert gas_today.state == "1.1"
assert gas_today.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.GAS
assert gas_today.attributes.get(ATTR_ICON) == "mdi:counter"
assert (
gas_today.attributes.get(ATTR_STATE_CLASS)
is SensorStateClass.TOTAL_INCREASING
)
assert gas_today.attributes.get(ATTR_STATE_CLASS) is SensorStateClass.TOTAL
assert (
gas_today.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
== UnitOfVolume.CUBIC_METERS
@ -308,10 +299,7 @@ async def test_setup_entry(hass: HomeAssistant) -> None:
assert gas_this_week.state == "5.6"
assert gas_this_week.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.GAS
assert gas_this_week.attributes.get(ATTR_ICON) == "mdi:counter"
assert (
gas_this_week.attributes.get(ATTR_STATE_CLASS)
is SensorStateClass.TOTAL_INCREASING
)
assert gas_this_week.attributes.get(ATTR_STATE_CLASS) is SensorStateClass.TOTAL
assert (
gas_this_week.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
== UnitOfVolume.CUBIC_METERS
@ -321,10 +309,7 @@ async def test_setup_entry(hass: HomeAssistant) -> None:
assert gas_this_month.state == "39.1"
assert gas_this_month.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.GAS
assert gas_this_month.attributes.get(ATTR_ICON) == "mdi:counter"
assert (
gas_this_month.attributes.get(ATTR_STATE_CLASS)
is SensorStateClass.TOTAL_INCREASING
)
assert gas_this_month.attributes.get(ATTR_STATE_CLASS) is SensorStateClass.TOTAL
assert (
gas_this_month.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
== UnitOfVolume.CUBIC_METERS
@ -334,10 +319,7 @@ async def test_setup_entry(hass: HomeAssistant) -> None:
assert gas_this_year.state == "116.7"
assert gas_this_year.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.GAS
assert gas_this_year.attributes.get(ATTR_ICON) == "mdi:counter"
assert (
gas_this_year.attributes.get(ATTR_STATE_CLASS)
is SensorStateClass.TOTAL_INCREASING
)
assert gas_this_year.attributes.get(ATTR_STATE_CLASS) is SensorStateClass.TOTAL
assert (
gas_this_year.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
== UnitOfVolume.CUBIC_METERS