Fix Huisbaasje negative periodic gas readings (#103457) (#108090)

This commit is contained in:
Jeroen van Ingen Schenau 2024-01-31 15:13:48 +01:00 committed by GitHub
parent ffdcdaf43b
commit 3bd1162650
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 8 deletions

View file

@ -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,
state_class=SensorStateClass.TOTAL_INCREASING,
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,
state_class=SensorStateClass.TOTAL_INCREASING,
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,
state_class=SensorStateClass.TOTAL_INCREASING,
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,
state_class=SensorStateClass.TOTAL_INCREASING,
icon="mdi:counter",
precision=1,
),

View file

@ -289,7 +289,10 @@ 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
assert (
gas_today.attributes.get(ATTR_STATE_CLASS)
is SensorStateClass.TOTAL_INCREASING
)
assert (
gas_today.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
== UnitOfVolume.CUBIC_METERS
@ -299,7 +302,10 @@ 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
assert (
gas_this_week.attributes.get(ATTR_STATE_CLASS)
is SensorStateClass.TOTAL_INCREASING
)
assert (
gas_this_week.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
== UnitOfVolume.CUBIC_METERS
@ -309,7 +315,10 @@ 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
assert (
gas_this_month.attributes.get(ATTR_STATE_CLASS)
is SensorStateClass.TOTAL_INCREASING
)
assert (
gas_this_month.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
== UnitOfVolume.CUBIC_METERS
@ -319,7 +328,10 @@ 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
assert (
gas_this_year.attributes.get(ATTR_STATE_CLASS)
is SensorStateClass.TOTAL_INCREASING
)
assert (
gas_this_year.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
== UnitOfVolume.CUBIC_METERS