Skip to content

Commit

Permalink
feat: add support for H5108 with external probe (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Jan 31, 2024
1 parent 35a0c2d commit 46bccd8
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,18 @@
rssi=-45,
)

GVH5108_WITH_PROBE_SERVICE_INFO = BluetoothServiceInfo(
name="GV51080C25",
address="CC:38:30:34:0C:25",
manufacturer_data={
1: b"\x01\x01\x03FHd\x00\x00L\x00\x02\x15INTELLI_ROCKS_HWPu\xf2\xff\x0c"
},
service_uuids=["0000ec88-0000-1000-8000-00805f9b34fb"],
service_data={},
source="local",
rssi=-45,
)


def test_can_create():
GoveeBluetoothDeviceData()
Expand Down Expand Up @@ -1197,6 +1209,68 @@ def test_gvh5100():
)


def test_gvh5108_with_external_probe():
parser = GoveeBluetoothDeviceData()
service_info = GVH5108_WITH_PROBE_SERVICE_INFO
result = parser.update(service_info)
assert result == SensorUpdate(
title=None,
devices={
None: SensorDeviceInfo(
name="51080C25",
model="H5108",
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=21.4,
),
DeviceKey(key="humidity", device_id=None): SensorValue(
device_key=DeviceKey(key="humidity", device_id=None),
name="Humidity",
native_value=60.0,
),
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=-45,
),
},
)


def test_gvh5184_packet_type_1():
parser = GoveeBluetoothDeviceData()
result = parser.update(GVH5184_SERVICE_INFO_1)
Expand Down

0 comments on commit 46bccd8

Please sign in to comment.