diff --git a/src/govee_ble/parser.py b/src/govee_ble/parser.py index faa1d73..9987a6c 100644 --- a/src/govee_ble/parser.py +++ b/src/govee_ble/parser.py @@ -181,7 +181,10 @@ def _start_update(self, service_info: BluetoothServiceInfo) -> None: @property def device_type(self) -> str: """Return the device type.""" - return self._device_id_to_type[None] + # Primary device first + return self._device_id_to_type.get( + None, next(iter(self._device_id_to_type.values())).partition("-")[0] + ) @property def button_count(self) -> int: diff --git a/tests/test_parser.py b/tests/test_parser.py index c994286..b4b9fa9 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -3236,6 +3236,7 @@ def test_gvh5178(): parser = GoveeBluetoothDeviceData() service_info = GVH5178_SERVICE_INFO result = parser.update(service_info) + assert parser.device_type == "H5178" assert result == SensorUpdate( title="B51782BC8", devices={