From 92d5820aeae6c386cc86a7edddd4cdb1b315ec2d Mon Sep 17 00:00:00 2001 From: Ernst Klamer Date: Sat, 23 Mar 2024 17:23:08 +0100 Subject: [PATCH] Use autosensors for acconeer --- .../ble_monitor/ble_parser/acconeer.py | 38 +++---------------- custom_components/ble_monitor/const.py | 8 +--- 2 files changed, 8 insertions(+), 38 deletions(-) diff --git a/custom_components/ble_monitor/ble_parser/acconeer.py b/custom_components/ble_monitor/ble_parser/acconeer.py index ad1ef9f9..0dc522c5 100644 --- a/custom_components/ble_monitor/ble_parser/acconeer.py +++ b/custom_components/ble_monitor/ble_parser/acconeer.py @@ -8,16 +8,10 @@ ACCONEER_SENSOR_IDS = { 0x80: "Acconeer XM122", - 0x90: "Acconeer XM126 Distance", + 0x90: "Acconeer XM126", 0x91: "Acconeer XM126", } -MEASUREMENTS = { - 0x80: ["presence", "temperature"], - 0x90: ["distance_mm", "temperature"], - 0x91: ["presence", "temperature"], -} - def parse_acconeer(self, data: bytes, mac: str): """Acconeer parser""" @@ -31,48 +25,28 @@ def parse_acconeer(self, data: bytes, mac: str): # Acconeer Sensors device_type = ACCONEER_SENSOR_IDS[device_id] - if "Distance" in device_type: - measurements = MEASUREMENTS[device_id] + if device_id == 0x90: ( battery_level, temperature, distance_mm, reserved2 ) = unpack("