Skip to content

Commit

Permalink
fix: handle remote discovered first
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco committed Jul 16, 2024
1 parent 8ade209 commit da63a48
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/govee_ble/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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={
Expand Down

0 comments on commit da63a48

Please sign in to comment.