Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add brush modes to the parser #48

Merged
merged 1 commit into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading