diff --git a/custom_components/ble_monitor/ble_parser/__init__.py b/custom_components/ble_monitor/ble_parser/__init__.py index 2ff652de..1ceb0bf4 100644 --- a/custom_components/ble_monitor/ble_parser/__init__.py +++ b/custom_components/ble_monitor/ble_parser/__init__.py @@ -29,6 +29,7 @@ from .kegtron import parse_kegtron from .kkm import parse_kkm from .laica import parse_laica +from .michelin import parse_michelin_tms from .mikrotik import parse_mikrotik from .miscale import parse_miscale from .moat import parse_moat @@ -297,6 +298,10 @@ def parse_advertisement( comp_id = (man_spec_data[3] << 8) | man_spec_data[2] data_len = man_spec_data[0] # Filter on Company Identifier + if comp_id == 0x0828: + # Michelin TMS + sensor_data = parse_michelin_tms(self, man_spec_data, mac) + break if comp_id == 0x0001 and data_len in [0x09, 0x0C, 0x22, 0x25]: # Govee H5101/H5102/H5106/H5177 sensor_data = parse_govee(self, man_spec_data, service_class_uuid16, local_name, mac) diff --git a/custom_components/ble_monitor/ble_parser/michelin.py b/custom_components/ble_monitor/ble_parser/michelin.py new file mode 100644 index 00000000..7d7c4986 --- /dev/null +++ b/custom_components/ble_monitor/ble_parser/michelin.py @@ -0,0 +1,50 @@ +"""Parser for Michelin TMS BLE advertisements.""" +import logging +from struct import unpack + +from .helpers import to_mac, to_unformatted_mac + +_LOGGER = logging.getLogger(__name__) + + +def parse_michelin_tms(self, data: bytes, mac: bytes): + """Parser for Michelin TMS.""" + msg_length = len(data) + device_type = "TMS" + firmware = "TMS" + result = {"firmware": firmware} + frame_type = data[5] + if frame_type in [0x03, 0x04]: + if msg_length != 18: + _LOGGER.error("Found %s bytes from sensor: %s", msg_length, to_mac(mac)) + return + (raw_temp, raw_volt, absolute_pressure_bar, tyre_id, steps, frame_counter) = unpack( + "