Skip to content

Commit

Permalink
feat: Add brush modes to the parser
Browse files Browse the repository at this point in the history
  • Loading branch information
joostlek committed Feb 18, 2024
1 parent cc4e922 commit ac71864
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/oralb_ble/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,13 @@ def _start_update(self, service_info: BluetoothServiceInfo) -> None:

model = BYTES_TO_MODEL.get(device_bytes, Models.SmartSeries7000)
model_info = DEVICE_TYPES[model]
modes = model_info.modes
self.brush_modes = model_info.modes
self.set_device_type(model_info.device_type)
name = f"{model_info.device_type} {short_address(address)}"
self.set_device_name(name)
self.set_title(name)
tb_state = STATES.get(state, f"unknown state {state}")
tb_mode = modes.get(mode, f"unknown mode {mode}")
tb_mode = self.brush_modes.get(mode, f"unknown mode {mode}")
tb_pressure = PRESSURE.get(pressure, f"unknown pressure {pressure}")
tb_sector = SECTOR_MAP.get(sector, f"unknown sector code {sector}")

Expand Down
3 changes: 2 additions & 1 deletion tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
Units,
)

from oralb_ble.parser import OralBBluetoothDeviceData
from oralb_ble.parser import SMART_SERIES_MODES, OralBBluetoothDeviceData

# 2022-10-24 18:10:10.048 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] 00:E0:43:87:4B:03: 78:DB:2F:C2:48:BE AdvertisementData(manufacturer_data={220: b'\x02\x01\x08\x02 \x00\x00\x01\x01\x00\x04'}, rssi=-64) connectable: True match: set() rssi: -64
# 2022-10-24 18:10:12.604 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] 00:E0:43:87:4B:03: 78:DB:2F:C2:48:BE AdvertisementData(manufacturer_data={220: b'\x02\x01\x08\x03\x00\x00\x00\x01\x01\x00\x04'}, rssi=-56) connectable: True match: set() rssi: -56
Expand Down Expand Up @@ -2759,6 +2759,7 @@ def test_genius_8000_high_pressure():
parser = OralBBluetoothDeviceData()
service_info = GENIUS_8000_HIGH_PRESSURE
result = parser.update(service_info)
assert parser.brush_modes == SMART_SERIES_MODES
assert result == SensorUpdate(
title="Smart Series 8000 48BE",
devices={
Expand Down

0 comments on commit ac71864

Please sign in to comment.