Add water sensor to bthome (#89595)

* Add water sensor to bthome

* Use TOTAL state class for gas water and energy
This commit is contained in:
Ernst Klamer
2023-03-14 19:26:05 +01:00
committed by GitHub
parent 71dc98a39c
commit d1969fd0c2
5 changed files with 35 additions and 8 deletions
+20 -3
View File
@@ -188,7 +188,7 @@ _LOGGER = logging.getLogger(__name__)
"sensor_entity": "sensor.test_device_18b2_energy",
"friendly_name": "Test Device 18B2 Energy",
"unit_of_measurement": "kWh",
"state_class": "total_increasing",
"state_class": "total",
"expected_state": "1346.067",
},
],
@@ -542,7 +542,7 @@ async def test_v1_sensors(
"sensor_entity": "sensor.test_device_18b2_energy",
"friendly_name": "Test Device 18B2 Energy",
"unit_of_measurement": "kWh",
"state_class": "total_increasing",
"state_class": "total",
"expected_state": "1346.067",
},
],
@@ -856,11 +856,28 @@ async def test_v1_sensors(
"sensor_entity": "sensor.test_device_18b2_gas",
"friendly_name": "Test Device 18B2 Gas",
"unit_of_measurement": "m³",
"state_class": "total_increasing",
"state_class": "total",
"expected_state": "1346.067",
},
],
),
(
"A4:C1:38:8D:18:B2",
make_bthome_v2_adv(
"A4:C1:38:8D:18:B2",
b"\x40\x4f\x87\x56\x2a\x01",
),
None,
[
{
"sensor_entity": "sensor.test_device_18b2_water",
"friendly_name": "Test Device 18B2 Water",
"unit_of_measurement": "L",
"state_class": "total",
"expected_state": "19551.879",
},
],
),
(
"A4:C1:38:8D:18:B2",
make_bthome_v2_adv(