bleparser 3.7.3__tar.gz → 4.0.1__tar.gz

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.
Files changed (74) hide show
  1. {bleparser-3.7.3 → bleparser-4.0.1}/LICENSE +1 -0
  2. {bleparser-3.7.3/package/bleparser.egg-info → bleparser-4.0.1}/PKG-INFO +57 -3
  3. bleparser-3.7.3/PKG-INFO → bleparser-4.0.1/README.md +50 -18
  4. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser/__init__.py +313 -83
  5. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser/acconeer.py +29 -38
  6. bleparser-4.0.1/package/bleparser/airmentor.py +142 -0
  7. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser/almendo.py +16 -22
  8. bleparser-4.0.1/package/bleparser/altbeacon.py +52 -0
  9. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser/amazfit.py +38 -23
  10. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser/atc.py +8 -15
  11. bleparser-4.0.1/package/bleparser/beckett.py +246 -0
  12. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser/bluemaestro.py +20 -17
  13. bleparser-4.0.1/package/bleparser/blustream.py +42 -0
  14. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser/bparasite.py +9 -20
  15. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser/bthome.py +93 -40
  16. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser/bthome_const.py +105 -10
  17. bleparser-4.0.1/package/bleparser/chefiq.py +69 -0
  18. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser/const.py +6 -2
  19. bleparser-4.0.1/package/bleparser/eddystone_tlm.py +66 -0
  20. bleparser-4.0.1/package/bleparser/govee.py +305 -0
  21. bleparser-4.0.1/package/bleparser/grundfos.py +58 -0
  22. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser/helpers.py +3 -3
  23. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser/hhcc.py +10 -31
  24. bleparser-4.0.1/package/bleparser/holyiot.py +101 -0
  25. bleparser-4.0.1/package/bleparser/hormann.py +63 -0
  26. bleparser-4.0.1/package/bleparser/ibeacon.py +51 -0
  27. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser/inkbird.py +9 -20
  28. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser/inode.py +11 -22
  29. bleparser-4.0.1/package/bleparser/jaalee.py +71 -0
  30. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser/jinou.py +5 -16
  31. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser/kegtron.py +5 -15
  32. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser/kkm.py +11 -23
  33. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser/laica.py +5 -8
  34. bleparser-4.0.1/package/bleparser/michelin.py +71 -0
  35. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser/mikrotik.py +11 -15
  36. bleparser-4.0.1/package/bleparser/minew.py +47 -0
  37. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser/miscale.py +20 -26
  38. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser/moat.py +6 -16
  39. bleparser-4.0.1/package/bleparser/mocreo.py +142 -0
  40. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser/oral_b.py +5 -16
  41. bleparser-4.0.1/package/bleparser/oras.py +96 -0
  42. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser/qingping.py +16 -21
  43. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser/relsib.py +26 -24
  44. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser/ruuvitag.py +28 -32
  45. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser/sensirion.py +9 -21
  46. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser/sensorpush.py +5 -16
  47. bleparser-4.0.1/package/bleparser/senssun.py +50 -0
  48. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser/smartdry.py +21 -27
  49. bleparser-4.0.1/package/bleparser/sonoff.py +129 -0
  50. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser/switchbot.py +5 -16
  51. bleparser-4.0.1/package/bleparser/teltonika.py +129 -0
  52. bleparser-4.0.1/package/bleparser/thermobeacon.py +82 -0
  53. bleparser-4.0.1/package/bleparser/thermopro.py +43 -0
  54. bleparser-4.0.1/package/bleparser/thermosafer.py +26 -0
  55. bleparser-4.0.1/package/bleparser/tilt.py +49 -0
  56. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser/xiaogui.py +7 -15
  57. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser/xiaomi.py +714 -133
  58. bleparser-3.7.3/README.md → bleparser-4.0.1/package/bleparser.egg-info/PKG-INFO +72 -1
  59. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser.egg-info/SOURCES.txt +15 -0
  60. {bleparser-3.7.3 → bleparser-4.0.1}/setup.cfg +7 -2
  61. bleparser-3.7.3/package/bleparser/airmentor.py +0 -83
  62. bleparser-3.7.3/package/bleparser/altbeacon.py +0 -79
  63. bleparser-3.7.3/package/bleparser/govee.py +0 -147
  64. bleparser-3.7.3/package/bleparser/ibeacon.py +0 -76
  65. bleparser-3.7.3/package/bleparser/jaalee.py +0 -60
  66. bleparser-3.7.3/package/bleparser/teltonika.py +0 -75
  67. bleparser-3.7.3/package/bleparser/thermopro.py +0 -55
  68. bleparser-3.7.3/package/bleparser/tilt.py +0 -75
  69. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser/brifit.py +0 -0
  70. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser/thermoplus.py +0 -0
  71. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser.egg-info/dependency_links.txt +0 -0
  72. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser.egg-info/requires.txt +0 -0
  73. {bleparser-3.7.3 → bleparser-4.0.1}/package/bleparser.egg-info/top_level.txt +0 -0
  74. {bleparser-3.7.3 → bleparser-4.0.1}/pyproject.toml +0 -0
@@ -1,6 +1,7 @@
1
1
  MIT License
2
2
 
3
3
  Copyright (c) 2022 Ernst Klamer
4
+ Copyright (c) 2025 Custom components for Home Assistant
4
5
 
5
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
7
  of this software and associated documentation files (the "Software"), to deal
@@ -1,15 +1,20 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bleparser
3
- Version: 3.7.3
3
+ Version: 4.0.1
4
4
  Summary: Parser for passive BLE advertisements
5
5
  Home-page: https://github.com/Ernst79/bleparser
6
6
  Author: Ernst79
7
7
  Author-email: e.klamer@gmail.com
8
8
  Project-URL: Bug Tracker, https://github.com/Ernst79/bleparser/issues
9
9
  Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: Programming Language :: Python :: 3.14
14
+ Classifier: Programming Language :: Python :: 3.15
10
15
  Classifier: License :: OSI Approved :: MIT License
11
16
  Classifier: Operating System :: OS Independent
12
- Requires-Python: >=3.8
17
+ Requires-Python: >=3.11
13
18
  Description-Content-Type: text/markdown
14
19
  License-File: LICENSE
15
20
  Requires-Dist: pycryptodomex
@@ -25,6 +30,11 @@ This pypi package is parsing BLE advertisements to readable data for several sen
25
30
  pip install bleparser
26
31
  ```
27
32
 
33
+ The passive parsers and parser fixtures are synchronized with
34
+ [`custom-components/ble_monitor` at `51bf13b994a1`](https://github.com/custom-components/ble_monitor/commit/51bf13b994a1f9c8b72c345401f48d81dd96f984).
35
+ Home Assistant integration code and active Bluetooth key-retrieval tools are not
36
+ included. The package remains standalone and supports Python 3.11 through 3.15.
37
+
28
38
  ## Supported sensors
29
39
 
30
40
  Supported sensor brands
@@ -33,31 +43,47 @@ Supported sensor brands
33
43
  - Air Mentor
34
44
  - Amazfit
35
45
  - ATC (custom firmware for Xiaomi/Qingping sensors)
46
+ - Beckett
36
47
  - BlueMaestro
48
+ - Blustream
37
49
  - Brifit
38
50
  - BTHome
39
51
  - b-parasite
52
+ - Chef iQ
53
+ - Eddystone-TLM
40
54
  - Govee
55
+ - Grundfos
41
56
  - HHCC
57
+ - HolyIOT
58
+ - Hormann
42
59
  - Inkbird
43
60
  - iNode
44
61
  - Jaalee
45
62
  - Jinou
46
63
  - Kegtron
47
64
  - KKM
65
+ - Laica
66
+ - Michelin
48
67
  - Mikrotik
68
+ - Minew
49
69
  - Moat
70
+ - Mocreo
50
71
  - Oral-B
72
+ - Oras
51
73
  - Qingping
52
74
  - Relsib
53
75
  - Ruuvitag
54
76
  - Sensirion
55
77
  - SensorPush
78
+ - Senssun
56
79
  - SmartDry
80
+ - Sonoff
57
81
  - Switchbot
58
82
  - Teltonika
83
+ - Thermobeacon (including Brifit and Thermoplus)
59
84
  - Thermoplus
60
85
  - Thermopro
86
+ - Thermosafer
61
87
  - Tilt
62
88
  - Xiaogui (Scale)
63
89
  - Xiaomi (MiBeacon)
@@ -74,6 +100,19 @@ ble_parser = BleParser()
74
100
  sensor_msg, tracker_msg = ble_parser.parse_raw_data(data)
75
101
  ```
76
102
 
103
+ For an HCI event containing multiple legacy or extended advertisement reports,
104
+ use `parse_raw_data_reports` to receive all recognized reports:
105
+
106
+ ```python
107
+ for sensor_msg, tracker_msg in ble_parser.parse_raw_data_reports(data):
108
+ print(sensor_msg, tracker_msg)
109
+ ```
110
+
111
+ `parse_raw_data` continues to return one `(sensor_msg, tracker_msg)` pair (the
112
+ first recognized report), or `(None, None)` when nothing is recognized.
113
+ Truncated reports are ignored, and malformed reports are logged at debug level
114
+ without discarding other complete reports in the event.
115
+
77
116
  You can set optional parameters, the example below shows all possible input parameters with default values.
78
117
 
79
118
  ```python
@@ -107,7 +146,13 @@ sensor_data, tracker_data = self.parse_advertisement(
107
146
 
108
147
  **report_unknown**
109
148
 
110
- Report unknown sensors. Can be set to `Acconeer`, `Air Mentor`, `Amazfit`, `ATC`, `b-parasite`, `BlueMaestro`, `Brifit`, `BTHome`, `Govee`, `HHCC`, `Inkbird`, `iNode`, `Jaalee`, `Jinou`, `Kegtron`, `KKM`, `Mikrotik`, `Moat`, `Mi Scale`, `Oral-B`, `Qingping`, `Relsib`, `Ruuvitag`, `SensorPush`, `Sensirion`, `SmartDry`, `Switchbot`, `Teltonika`, `Thermoplus`, `Thermopro`, `Tilt`, `Xiaogui` or `Xiaomi` to report unknown sensors of a specific brand to the logger. You can set it to `Other` to report all unknown advertisements to the logger. Default: `False`
149
+ Report unknown sensors. Can be set to `Acconeer`, `Air Mentor`, `Amazfit`, `ATC`, `b-parasite`, `BlueMaestro`, `BTHome`, `Govee`, `HHCC`, `Inkbird`, `iNode`, `Jaalee`, `Jinou`, `Kegtron`, `KKM`, `Mikrotik`, `Moat`, `Mi Scale`, `Oral-B`, `Qingping`, `Relsib`, `Ruuvitag`, `SensorPush`, `Sensirion`, `SmartDry`, `Switchbot`, `Teltonika`, `Thermopro`, `Tilt`, `Xiaogui` or `Xiaomi` to report unknown sensors of a specific brand to the logger. You can set it to `Other` to report all unknown advertisements to the logger. Default: `False`
150
+
151
+ Additional `report_unknown` names are `Beckett`, `Blustream`, `Chef iQ`,
152
+ `Eddystone`, `Grundfos`, `HolyIOT`, `Hormann`, `Minew`, `Sonoff`,
153
+ `Thermobeacon`, and `Thermosafer`. Brifit and Thermoplus
154
+ advertisements now use the upstream `Thermobeacon` firmware name; use
155
+ `report_unknown="Thermobeacon"` for these devices.
111
156
 
112
157
  **discovery**
113
158
 
@@ -126,6 +171,10 @@ The MAC addresses should be in bytes.
126
171
  sensor_whitelist=[bytes.fromhex("A4:C1:38:56:53:84".replace(":", ""))],
127
172
  ```
128
173
 
174
+ For iBeacon, AltBeacon, and Tilt sensor data, whitelist the beacon UUID as
175
+ bytes rather than only its MAC address. A whitelisted UUID also allows devices
176
+ whose MAC address changes.
177
+
129
178
  **tracker_whitelist**
130
179
 
131
180
  List with devices (MAC addresses or UUIDs) to track. Default: `[]`
@@ -166,6 +215,11 @@ The output of `sensor_msg` is:
166
215
 
167
216
  If the advertisements can be parsed, it will always show the `rssi`, `mac`, `type`, `packet`, `firmware` and `data` fields. Additional fields with the measurements, like `temperature` and `humidity` will be available depending on the sensor type.
168
217
 
218
+ Sensor and tracker results now also include `local_name` (an empty string when
219
+ the advertisement has no valid UTF-8 local name). Measurement names and values
220
+ follow the pinned upstream parser, including newer BTHome measurements and
221
+ device-specific corrections.
222
+
169
223
  ### Parsing tracker data
170
224
 
171
225
  A minimal example for tracking BLE devices is shown below. To prevent tracking of all devices that pass by, you will have to specify a whitelist with devices that you want to track. This needs to be a list with MAC addresses in lower case, without `:`.
@@ -1,20 +1,3 @@
1
- Metadata-Version: 2.4
2
- Name: bleparser
3
- Version: 3.7.3
4
- Summary: Parser for passive BLE advertisements
5
- Home-page: https://github.com/Ernst79/bleparser
6
- Author: Ernst79
7
- Author-email: e.klamer@gmail.com
8
- Project-URL: Bug Tracker, https://github.com/Ernst79/bleparser/issues
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: License :: OSI Approved :: MIT License
11
- Classifier: Operating System :: OS Independent
12
- Requires-Python: >=3.8
13
- Description-Content-Type: text/markdown
14
- License-File: LICENSE
15
- Requires-Dist: pycryptodomex
16
- Dynamic: license-file
17
-
18
1
  # BLE parser for passive BLE advertisements
19
2
 
20
3
  This pypi package is parsing BLE advertisements to readable data for several sensors and can be used for device tracking (by (fixed) MAC address or by UUID). The parser was originally developed as part of the [BLE monitor custom component for Home Assistant](https://github.com/custom-components/ble_monitor), but can now be used for other implementations. The package does NOT take care of the data collecting of the BLE advertisements, you can use other packages like [aioblescan](https://github.com/frawau/aioblescan) or [bleson](https://bleson.readthedocs.io/en/latest/index.html) to do that part. An example is given in the [examples folder](https://github.com/Ernst79/bleparser/tree/master/examples).
@@ -25,6 +8,11 @@ This pypi package is parsing BLE advertisements to readable data for several sen
25
8
  pip install bleparser
26
9
  ```
27
10
 
11
+ The passive parsers and parser fixtures are synchronized with
12
+ [`custom-components/ble_monitor` at `51bf13b994a1`](https://github.com/custom-components/ble_monitor/commit/51bf13b994a1f9c8b72c345401f48d81dd96f984).
13
+ Home Assistant integration code and active Bluetooth key-retrieval tools are not
14
+ included. The package remains standalone and supports Python 3.11 through 3.15.
15
+
28
16
  ## Supported sensors
29
17
 
30
18
  Supported sensor brands
@@ -33,31 +21,47 @@ Supported sensor brands
33
21
  - Air Mentor
34
22
  - Amazfit
35
23
  - ATC (custom firmware for Xiaomi/Qingping sensors)
24
+ - Beckett
36
25
  - BlueMaestro
26
+ - Blustream
37
27
  - Brifit
38
28
  - BTHome
39
29
  - b-parasite
30
+ - Chef iQ
31
+ - Eddystone-TLM
40
32
  - Govee
33
+ - Grundfos
41
34
  - HHCC
35
+ - HolyIOT
36
+ - Hormann
42
37
  - Inkbird
43
38
  - iNode
44
39
  - Jaalee
45
40
  - Jinou
46
41
  - Kegtron
47
42
  - KKM
43
+ - Laica
44
+ - Michelin
48
45
  - Mikrotik
46
+ - Minew
49
47
  - Moat
48
+ - Mocreo
50
49
  - Oral-B
50
+ - Oras
51
51
  - Qingping
52
52
  - Relsib
53
53
  - Ruuvitag
54
54
  - Sensirion
55
55
  - SensorPush
56
+ - Senssun
56
57
  - SmartDry
58
+ - Sonoff
57
59
  - Switchbot
58
60
  - Teltonika
61
+ - Thermobeacon (including Brifit and Thermoplus)
59
62
  - Thermoplus
60
63
  - Thermopro
64
+ - Thermosafer
61
65
  - Tilt
62
66
  - Xiaogui (Scale)
63
67
  - Xiaomi (MiBeacon)
@@ -74,6 +78,19 @@ ble_parser = BleParser()
74
78
  sensor_msg, tracker_msg = ble_parser.parse_raw_data(data)
75
79
  ```
76
80
 
81
+ For an HCI event containing multiple legacy or extended advertisement reports,
82
+ use `parse_raw_data_reports` to receive all recognized reports:
83
+
84
+ ```python
85
+ for sensor_msg, tracker_msg in ble_parser.parse_raw_data_reports(data):
86
+ print(sensor_msg, tracker_msg)
87
+ ```
88
+
89
+ `parse_raw_data` continues to return one `(sensor_msg, tracker_msg)` pair (the
90
+ first recognized report), or `(None, None)` when nothing is recognized.
91
+ Truncated reports are ignored, and malformed reports are logged at debug level
92
+ without discarding other complete reports in the event.
93
+
77
94
  You can set optional parameters, the example below shows all possible input parameters with default values.
78
95
 
79
96
  ```python
@@ -107,7 +124,13 @@ sensor_data, tracker_data = self.parse_advertisement(
107
124
 
108
125
  **report_unknown**
109
126
 
110
- Report unknown sensors. Can be set to `Acconeer`, `Air Mentor`, `Amazfit`, `ATC`, `b-parasite`, `BlueMaestro`, `Brifit`, `BTHome`, `Govee`, `HHCC`, `Inkbird`, `iNode`, `Jaalee`, `Jinou`, `Kegtron`, `KKM`, `Mikrotik`, `Moat`, `Mi Scale`, `Oral-B`, `Qingping`, `Relsib`, `Ruuvitag`, `SensorPush`, `Sensirion`, `SmartDry`, `Switchbot`, `Teltonika`, `Thermoplus`, `Thermopro`, `Tilt`, `Xiaogui` or `Xiaomi` to report unknown sensors of a specific brand to the logger. You can set it to `Other` to report all unknown advertisements to the logger. Default: `False`
127
+ Report unknown sensors. Can be set to `Acconeer`, `Air Mentor`, `Amazfit`, `ATC`, `b-parasite`, `BlueMaestro`, `BTHome`, `Govee`, `HHCC`, `Inkbird`, `iNode`, `Jaalee`, `Jinou`, `Kegtron`, `KKM`, `Mikrotik`, `Moat`, `Mi Scale`, `Oral-B`, `Qingping`, `Relsib`, `Ruuvitag`, `SensorPush`, `Sensirion`, `SmartDry`, `Switchbot`, `Teltonika`, `Thermopro`, `Tilt`, `Xiaogui` or `Xiaomi` to report unknown sensors of a specific brand to the logger. You can set it to `Other` to report all unknown advertisements to the logger. Default: `False`
128
+
129
+ Additional `report_unknown` names are `Beckett`, `Blustream`, `Chef iQ`,
130
+ `Eddystone`, `Grundfos`, `HolyIOT`, `Hormann`, `Minew`, `Sonoff`,
131
+ `Thermobeacon`, and `Thermosafer`. Brifit and Thermoplus
132
+ advertisements now use the upstream `Thermobeacon` firmware name; use
133
+ `report_unknown="Thermobeacon"` for these devices.
111
134
 
112
135
  **discovery**
113
136
 
@@ -126,6 +149,10 @@ The MAC addresses should be in bytes.
126
149
  sensor_whitelist=[bytes.fromhex("A4:C1:38:56:53:84".replace(":", ""))],
127
150
  ```
128
151
 
152
+ For iBeacon, AltBeacon, and Tilt sensor data, whitelist the beacon UUID as
153
+ bytes rather than only its MAC address. A whitelisted UUID also allows devices
154
+ whose MAC address changes.
155
+
129
156
  **tracker_whitelist**
130
157
 
131
158
  List with devices (MAC addresses or UUIDs) to track. Default: `[]`
@@ -166,6 +193,11 @@ The output of `sensor_msg` is:
166
193
 
167
194
  If the advertisements can be parsed, it will always show the `rssi`, `mac`, `type`, `packet`, `firmware` and `data` fields. Additional fields with the measurements, like `temperature` and `humidity` will be available depending on the sensor type.
168
195
 
196
+ Sensor and tracker results now also include `local_name` (an empty string when
197
+ the advertisement has no valid UTF-8 local name). Measurement names and values
198
+ follow the pinned upstream parser, including newer BTHome measurements and
199
+ device-specific corrections.
200
+
169
201
  ### Parsing tracker data
170
202
 
171
203
  A minimal example for tracking BLE devices is shown below. To prevent tracking of all devices that pass by, you will have to specify a whitelist with devices that you want to track. This needs to be a list with MAC addresses in lower case, without `:`.