openble-sonicare 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- openble/sonicare/__init__.py +5 -0
- openble/sonicare/identify.py +23 -0
- openble/sonicare/uuids.py +62 -0
- openble_sonicare-0.1.0.dist-info/METADATA +53 -0
- openble_sonicare-0.1.0.dist-info/RECORD +7 -0
- openble_sonicare-0.1.0.dist-info/WHEEL +4 -0
- openble_sonicare-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""Match an advertisement to a Sonicare toothbrush."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from openble.sonicare.uuids import CONDOR_SCAN_SERVICE, SONICARE_SCAN_SERVICE
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def classify(name: str, service_uuids: list[str]) -> tuple[list[str], list[str]]:
|
|
9
|
+
"""Return the kinds (``toothbrush``, ``toothbrush-condor``) and the reasons."""
|
|
10
|
+
kinds: list[str] = []
|
|
11
|
+
reasons: list[str] = []
|
|
12
|
+
lowered = {item.lower() for item in service_uuids}
|
|
13
|
+
if SONICARE_SCAN_SERVICE in lowered:
|
|
14
|
+
kinds.append("toothbrush")
|
|
15
|
+
reasons.append("service 477ea600-…0001")
|
|
16
|
+
if "philips sonicare" in name.lower():
|
|
17
|
+
if "toothbrush" not in kinds:
|
|
18
|
+
kinds.append("toothbrush")
|
|
19
|
+
reasons.append("name Philips Sonicare")
|
|
20
|
+
if CONDOR_SCAN_SERVICE in lowered:
|
|
21
|
+
kinds.append("toothbrush-condor")
|
|
22
|
+
reasons.append("service e50ba3c0-…")
|
|
23
|
+
return kinds, reasons
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""UUIDs named in the Sonicare protocol manual.
|
|
2
|
+
|
|
3
|
+
Sonicare suffixes are the last four hex digits of
|
|
4
|
+
477ea600-a260-11e4-ae37-0002a5d5. Comparison is case-insensitive.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
CBT_PREFIX = "477ea600-a260-11e4-ae37-0002a5d5"
|
|
10
|
+
|
|
11
|
+
SONICARE_SCAN_SERVICE = CBT_PREFIX + "0001"
|
|
12
|
+
CONDOR_SCAN_SERVICE = "e50ba3c0-af04-4564-92ad-fef019489de6"
|
|
13
|
+
|
|
14
|
+
# suffix -> (name, value kind). Kinds: hex, int, utf8.
|
|
15
|
+
# int means the manual says the app parses an integer. Endianness is not recorded.
|
|
16
|
+
CBT_CHARS = {
|
|
17
|
+
"4010": ("handle state", "hex"),
|
|
18
|
+
"4050": ("handle time", "int"),
|
|
19
|
+
"4020": ("available brushing routines", "hex"),
|
|
20
|
+
"4022": ("routine ids", "hex"),
|
|
21
|
+
"4040": ("cumulative motor runtime", "hex"),
|
|
22
|
+
"4090": ("brushing time", "hex"),
|
|
23
|
+
"4080": ("routine id", "hex"),
|
|
24
|
+
"4091": ("routine length", "hex"),
|
|
25
|
+
"4070": ("current session id", "hex"),
|
|
26
|
+
"40b0": ("intensity", "hex"),
|
|
27
|
+
"4082": ("routine state", "hex"),
|
|
28
|
+
"40d0": ("latest session id", "int"),
|
|
29
|
+
"40d5": ("session type", "hex"),
|
|
30
|
+
"40e0": ("active session id", "hex"),
|
|
31
|
+
"4110": ("sacp", "hex"),
|
|
32
|
+
"4100": ("session data", "hex"),
|
|
33
|
+
"40d2": ("available session count", "hex"),
|
|
34
|
+
"4130": ("sensor notification", "hex"),
|
|
35
|
+
"4120": ("selected sensor data", "hex"),
|
|
36
|
+
"4210": ("brush head 4210", "hex"),
|
|
37
|
+
"4230": ("brush head serial or nfc tag version", "hex"),
|
|
38
|
+
"4220": ("factory mode", "hex"),
|
|
39
|
+
"4280": ("lifetime limit", "hex"),
|
|
40
|
+
"4290": ("lifetime usage", "hex"),
|
|
41
|
+
"42c0": ("ring id", "hex"),
|
|
42
|
+
"4310": ("error value persistent", "hex"),
|
|
43
|
+
"4320": ("error value volatile", "hex"),
|
|
44
|
+
"4330": ("proximity", "hex"),
|
|
45
|
+
"4340": ("external flash", "hex"),
|
|
46
|
+
"4350": ("pressure sensor", "hex"),
|
|
47
|
+
"4360": ("invalid charger count", "hex"),
|
|
48
|
+
"4370": ("debug information", "hex"),
|
|
49
|
+
"4420": ("handle settings", "hex"),
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def cbt(suffix: str) -> str:
|
|
54
|
+
return CBT_PREFIX + suffix.lower()
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def cbt_suffix(uuid: str) -> str | None:
|
|
58
|
+
"""Return the four-digit Sonicare suffix, or None for any other uuid."""
|
|
59
|
+
text = uuid.lower()
|
|
60
|
+
if text.startswith(CBT_PREFIX):
|
|
61
|
+
return text[-4:]
|
|
62
|
+
return None
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: openble-sonicare
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Philips Sonicare toothbrush GATT map and advertisement matching.
|
|
5
|
+
Project-URL: Source, https://github.com/kadima-tech/openble/tree/main/packages/openble-sonicare
|
|
6
|
+
Project-URL: Issues, https://github.com/kadima-tech/openble/issues
|
|
7
|
+
Author: Kadima Tech
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: ble,bluetooth,philips,sonicare,toothbrush
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Topic :: Home Automation
|
|
17
|
+
Classifier: Topic :: System :: Hardware
|
|
18
|
+
Requires-Python: >=3.11
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
|
|
21
|
+
# openble-sonicare
|
|
22
|
+
|
|
23
|
+
The Philips Sonicare toothbrush GATT map, read from the Sonicare app's bytecode.
|
|
24
|
+
|
|
25
|
+
- `openble.sonicare.uuids`: the `477ea600-…` service and characteristic ids, each with the name and value kind the app uses.
|
|
26
|
+
- `openble.sonicare.identify`: matches advertisements to a Sonicare handle (`toothbrush`) or the second plugin family (`toothbrush-condor`).
|
|
27
|
+
|
|
28
|
+
Pure Python 3.11+ with no dependencies. Most byte layouts, and the SACP writes, are still open. The protocol manual records what is known and what is not.
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
pip install openble-sonicare
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from openble.sonicare.identify import classify
|
|
36
|
+
from openble.sonicare.uuids import CBT_CHARS, cbt, cbt_suffix
|
|
37
|
+
|
|
38
|
+
classify("Philips Sonicare", [cbt("0001")])
|
|
39
|
+
# (['toothbrush'], ['service 477ea600-…0001', 'name Philips Sonicare'])
|
|
40
|
+
|
|
41
|
+
CBT_CHARS[cbt_suffix(cbt("4050"))]
|
|
42
|
+
# ('handle time', 'int')
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Protocol notes
|
|
46
|
+
|
|
47
|
+
[docs/sonicare-toothbrush-protocol.md](https://github.com/kadima-tech/openble/blob/main/packages/openble-sonicare/docs/sonicare-toothbrush-protocol.md): discovery, connect, bonding and the GATT catalog.
|
|
48
|
+
|
|
49
|
+
Not affiliated with Philips. The names identify the devices this interoperates with.
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
|
|
53
|
+
[MIT License](https://github.com/kadima-tech/openble/blob/main/packages/openble-sonicare/LICENSE), copyright 2026 Kadima Tech.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
openble/sonicare/__init__.py,sha256=j_ux20FfXgjahsP1gtNu66hNpmNBAIqval4bh6uwRBk,214
|
|
2
|
+
openble/sonicare/identify.py,sha256=BE1kSFeyO8C7e2py-kdQ7s04N9uOBGJUBr_x_-g_yME,896
|
|
3
|
+
openble/sonicare/uuids.py,sha256=2FH38AVgdatmDvYiJvkrF-uRyJC3lWzxPJXkMVGaHqM,2148
|
|
4
|
+
openble_sonicare-0.1.0.dist-info/METADATA,sha256=zEsRLHKZVHl47w83Xd2ukLziCH6oZvhg4LhrWd89WUw,2108
|
|
5
|
+
openble_sonicare-0.1.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
6
|
+
openble_sonicare-0.1.0.dist-info/licenses/LICENSE,sha256=2ADkKbgMDodZbkCMTH4VqSEweX3QaN52awlDvRoMPWQ,1068
|
|
7
|
+
openble_sonicare-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kadima Tech
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|