From 94bfe57af1d134805aede008459b7dfeb78e0597 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 25 Apr 2024 17:03:34 +0200 Subject: [PATCH] test: add more 5105 tests (#84) --- tests/test_parser.py | 71 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/tests/test_parser.py b/tests/test_parser.py index 06e0ed8..a664f82 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -508,6 +508,15 @@ source="local", rssi=-45, ) +GVH5105_SERVICE_INFO_2 = BluetoothServiceInfo( + name="GVH5105_7336", + address="D7:35:33:33:73:36", + manufacturer_data={1: b"\x01\x01\x032^d"}, + service_uuids=["0000ec88-0000-1000-8000-00805f9b34fb"], + service_data={}, + rssi=-73, + source="local", +) GVH5100_SERVICE_INFO = BluetoothServiceInfo( @@ -1219,6 +1228,68 @@ def test_gvh5105(): ) +def test_gvh5105_2(): + parser = GoveeBluetoothDeviceData() + service_info = GVH5105_SERVICE_INFO_2 + result = parser.update(service_info) + assert result == SensorUpdate( + title=None, + devices={ + None: SensorDeviceInfo( + name="H5105 7336", + model="H5105", + manufacturer="Govee", + sw_version=None, + hw_version=None, + ) + }, + entity_descriptions={ + DeviceKey(key="temperature", device_id=None): SensorDescription( + device_key=DeviceKey(key="temperature", device_id=None), + device_class=DeviceClass.TEMPERATURE, + native_unit_of_measurement=Units.TEMP_CELSIUS, + ), + DeviceKey(key="humidity", device_id=None): SensorDescription( + device_key=DeviceKey(key="humidity", device_id=None), + device_class=DeviceClass.HUMIDITY, + native_unit_of_measurement=Units.PERCENTAGE, + ), + DeviceKey(key="battery", device_id=None): SensorDescription( + device_key=DeviceKey(key="battery", device_id=None), + device_class=DeviceClass.BATTERY, + native_unit_of_measurement=Units.PERCENTAGE, + ), + DeviceKey(key="signal_strength", device_id=None): SensorDescription( + device_key=DeviceKey(key="signal_strength", device_id=None), + device_class=DeviceClass.SIGNAL_STRENGTH, + native_unit_of_measurement=Units.SIGNAL_STRENGTH_DECIBELS_MILLIWATT, + ), + }, + entity_values={ + DeviceKey(key="temperature", device_id=None): SensorValue( + device_key=DeviceKey(key="temperature", device_id=None), + name="Temperature", + native_value=20.9, + ), + DeviceKey(key="humidity", device_id=None): SensorValue( + device_key=DeviceKey(key="humidity", device_id=None), + name="Humidity", + native_value=50.2, + ), + DeviceKey(key="battery", device_id=None): SensorValue( + device_key=DeviceKey(key="battery", device_id=None), + name="Battery", + native_value=100, + ), + DeviceKey(key="signal_strength", device_id=None): SensorValue( + device_key=DeviceKey(key="signal_strength", device_id=None), + name="Signal Strength", + native_value=-73, + ), + }, + ) + + def test_gvh5100(): parser = GoveeBluetoothDeviceData() service_info = GVH5100_SERVICE_INFO