Skip to content

Commit

Permalink
test: add more 5105 tests (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Apr 25, 2024
1 parent 1ad0347 commit 94bfe57
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 94bfe57

Please sign in to comment.