Add gas sensor to BTHome (#88770)

* Bump bthome

* Add gas sensor
This commit is contained in:
Ernst Klamer 2023-02-27 16:40:08 +01:00 committed by GitHub
parent e95944bf9f
commit 00954dfc1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 3 deletions

View File

@ -20,5 +20,5 @@
"dependencies": ["bluetooth_adapters"],
"documentation": "https://www.home-assistant.io/integrations/bthome",
"iot_class": "local_push",
"requirements": ["bthome-ble==2.5.2"]
"requirements": ["bthome-ble==2.7.0"]
}

View File

@ -119,6 +119,16 @@ SENSOR_DESCRIPTIONS = {
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
state_class=SensorStateClass.TOTAL_INCREASING,
),
# Gas (m3)
(
BTHomeSensorDeviceClass.GAS,
Units.VOLUME_CUBIC_METERS,
): SensorEntityDescription(
key=f"{BTHomeSensorDeviceClass.GAS}_{Units.VOLUME_CUBIC_METERS}",
device_class=SensorDeviceClass.GAS,
native_unit_of_measurement=UnitOfVolume.CUBIC_METERS,
state_class=SensorStateClass.TOTAL_INCREASING,
),
# Humidity in (percent)
(BTHomeSensorDeviceClass.HUMIDITY, Units.PERCENTAGE): SensorEntityDescription(
key=f"{BTHomeSensorDeviceClass.HUMIDITY}_{Units.PERCENTAGE}",

View File

@ -492,7 +492,7 @@ brunt==1.2.0
bt_proximity==0.2.1
# homeassistant.components.bthome
bthome-ble==2.5.2
bthome-ble==2.7.0
# homeassistant.components.bt_home_hub_5
bthomehub5-devicelist==0.1.1

View File

@ -399,7 +399,7 @@ brother==2.2.0
brunt==1.2.0
# homeassistant.components.bthome
bthome-ble==2.5.2
bthome-ble==2.7.0
# homeassistant.components.buienradar
buienradar==1.0.5

View File

@ -844,6 +844,23 @@ async def test_v1_sensors(
},
],
),
(
"A4:C1:38:8D:18:B2",
make_bthome_v2_adv(
"A4:C1:38:8D:18:B2",
b"\x40\x4b\x13\x8a\x14",
),
None,
[
{
"sensor_entity": "sensor.test_device_18b2_gas",
"friendly_name": "Test Device 18B2 Gas",
"unit_of_measurement": "",
"state_class": "total_increasing",
"expected_state": "1346.067",
},
],
),
(
"A4:C1:38:8D:18:B2",
make_bthome_v2_adv(