Bump bthome to 2.12.0 (#94822)

This commit is contained in:
Ernst Klamer 2023-06-18 22:06:09 +02:00 committed by GitHub
parent 5834d70037
commit 13a217ad89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 81 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.11.3"]
"requirements": ["bthome-ble==2.12.0"]
}

View File

@ -47,6 +47,15 @@ from .coordinator import (
from .device import device_key_to_bluetooth_entity_key
SENSOR_DESCRIPTIONS = {
# Acceleration (m/s²)
(
BTHomeSensorDeviceClass.ACCELERATION,
Units.ACCELERATION_METERS_PER_SQUARE_SECOND,
): SensorEntityDescription(
key=f"{BTHomeSensorDeviceClass.ACCELERATION}_{Units.ACCELERATION_METERS_PER_SQUARE_SECOND}",
native_unit_of_measurement=Units.ACCELERATION_METERS_PER_SQUARE_SECOND,
state_class=SensorStateClass.MEASUREMENT,
),
# Battery (percent)
(BTHomeSensorDeviceClass.BATTERY, Units.PERCENTAGE): SensorEntityDescription(
key=f"{BTHomeSensorDeviceClass.BATTERY}_{Units.PERCENTAGE}",
@ -131,6 +140,15 @@ SENSOR_DESCRIPTIONS = {
native_unit_of_measurement=UnitOfVolume.CUBIC_METERS,
state_class=SensorStateClass.TOTAL,
),
# Gyroscope (°/s)
(
BTHomeSensorDeviceClass.GYROSCOPE,
Units.GYROSCOPE_DEGREES_PER_SECOND,
): SensorEntityDescription(
key=f"{BTHomeSensorDeviceClass.GYROSCOPE}_{Units.GYROSCOPE_DEGREES_PER_SECOND}",
native_unit_of_measurement=Units.GYROSCOPE_DEGREES_PER_SECOND,
state_class=SensorStateClass.MEASUREMENT,
),
# Humidity in (percent)
(BTHomeSensorDeviceClass.HUMIDITY, Units.PERCENTAGE): SensorEntityDescription(
key=f"{BTHomeSensorDeviceClass.HUMIDITY}_{Units.PERCENTAGE}",
@ -242,6 +260,15 @@ SENSOR_DESCRIPTIONS = {
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
state_class=SensorStateClass.MEASUREMENT,
),
# Timestamp (datetime object)
(
BTHomeSensorDeviceClass.TIMESTAMP,
None,
): SensorEntityDescription(
key=f"{BTHomeSensorDeviceClass.TIMESTAMP}",
device_class=SensorDeviceClass.TIMESTAMP,
state_class=SensorStateClass.MEASUREMENT,
),
# UV index (-)
(
BTHomeSensorDeviceClass.UV_INDEX,

View File

@ -568,7 +568,7 @@ brunt==1.2.0
bt-proximity==0.2.1
# homeassistant.components.bthome
bthome-ble==2.11.3
bthome-ble==2.12.0
# homeassistant.components.bt_home_hub_5
bthomehub5-devicelist==0.1.1

View File

@ -472,7 +472,7 @@ brottsplatskartan==0.0.1
brunt==1.2.0
# homeassistant.components.bthome
bthome-ble==2.11.3
bthome-ble==2.12.0
# homeassistant.components.buienradar
buienradar==1.0.5

View File

@ -858,6 +858,57 @@ async def test_v1_sensors(
},
],
),
(
"A4:C1:38:8D:18:B2",
make_bthome_v2_adv(
"A4:C1:38:8D:18:B2",
b"\x44\x50\x5D\x39\x61\x64",
),
None,
[
{
"sensor_entity": "sensor.test_device_18b2_timestamp",
"friendly_name": "Test Device 18B2 Timestamp",
"unit_of_measurement": "s",
"state_class": "measurement",
"expected_state": "2023-05-14T19:41:17+00:00",
},
],
),
(
"A4:C1:38:8D:18:B2",
make_bthome_v2_adv(
"A4:C1:38:8D:18:B2",
b"\x44\x51\x87\x56",
),
None,
[
{
"sensor_entity": "sensor.test_device_18b2_acceleration",
"friendly_name": "Test Device 18B2 Acceleration",
"unit_of_measurement": "m/s²",
"state_class": "measurement",
"expected_state": "22.151",
},
],
),
(
"A4:C1:38:8D:18:B2",
make_bthome_v2_adv(
"A4:C1:38:8D:18:B2",
b"\x44\x52\x87\x56",
),
None,
[
{
"sensor_entity": "sensor.test_device_18b2_gyroscope",
"friendly_name": "Test Device 18B2 Gyroscope",
"unit_of_measurement": "°/s",
"state_class": "measurement",
"expected_state": "22.151",
},
],
),
(
"A4:C1:38:8D:18:B2",
make_bthome_v2_adv(