Skip to content

Commit

Permalink
feat: additional mappings for io series models (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Oct 28, 2022
1 parent eaab93e commit 32690dc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
21 changes: 16 additions & 5 deletions src/oralb_ble/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class OralBBinarySensor(StrEnum):

class Models(Enum):

IOSeries7 = auto()
IOSeries78 = auto()
IOSeries4 = auto()
SmartSeries7000 = auto()
SmartSeries9000 = auto()
Expand Down Expand Up @@ -68,13 +68,14 @@ class ModelDescription:
2: "gum care",
3: "whiten",
4: "intense",
5: "super sensitive",
8: "settings",
}


DEVICE_TYPES = {
Models.IOSeries7: ModelDescription(
device_type="IO Series 7",
Models.IOSeries78: ModelDescription(
device_type="IO Series 7/8",
modes=IO_SERIES_MODES,
),
Models.IOSeries4: ModelDescription(
Expand Down Expand Up @@ -108,14 +109,24 @@ class ModelDescription:
116: "transport",
}

PRESSURE = {114: "normal", 118: "button pressed", 178: "high"}
PRESSURE = {
114: "normal",
82: "normal",
90: "power button pressed",
86: "button pressed",
56: "power button pressed",
118: "button pressed",
178: "high",
146: "high",
240: "high",
}


ORALB_MANUFACTURER = 0x00DC


BYTES_TO_MODEL = {
b"\x062k": Models.IOSeries7,
b"\x062k": Models.IOSeries78,
b"\x074\x0c": Models.IOSeries4,
b"\x03!\x0c": Models.SmartSeries9000,
}
Expand Down
8 changes: 4 additions & 4 deletions tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,11 +551,11 @@ def test_io_series_7():
service_info = ORALB_IO_SERIES_7
result = parser.update(service_info)
assert result == SensorUpdate(
title="IO Series 7 48BE",
title="IO Series 7/8 48BE",
devices={
None: SensorDeviceInfo(
name="IO Series 7 48BE",
model="IO Series 7",
name="IO Series 7/8 48BE",
model="IO Series 7/8",
manufacturer="Oral-B",
sw_version=None,
hw_version=None,
Expand Down Expand Up @@ -757,7 +757,7 @@ def test_io_series_4():
DeviceKey(key="pressure", device_id=None): SensorValue(
device_key=DeviceKey(key="pressure", device_id=None),
name="Pressure",
native_value="unknown " "pressure " "56",
native_value="power button pressed",
),
},
binary_entity_descriptions={
Expand Down

0 comments on commit 32690dc

Please sign in to comment.