custom-components / ble_monitor

BLE monitor for passive BLE sensors
https://community.home-assistant.io/t/passive-ble-monitor-integration/
MIT License
1.93k stars 248 forks source link

Linptech KS1Pro Button Support #1369

Closed alexreddy78 closed 4 months ago

alexreddy78 commented 4 months ago

Sensor Description

Button with Temp and Humidity sensor

Additional information

https://home.miot-spec.com/spec?type=urn:miot-spec-v2:device:temperature-humidity-sensor:0000A00A:linp-ks1bp:1

BLE advertisements

Button is supported in Xiaomi Gateway 3 intergation as flw:

    15895: ["Linptech", "Wireless Button KS1Pro", "KS1PBB"],
    "spec": [
        MiBeacon, BLEAction, BLEHumidity, BLETemperature, BLEBattery,
        MathConv("temperature", mi="2.p.1001", min=-30, max=100, round=1),
        MathConv("humidity", mi="2.p.1008", min=0, max=100, round=1),
        Converter("battery", mi="4.p.1003"),
        BLEEvent("action", mi="5.e.1012", map={
            1: "button_1_single", 2: "button_2_single", 3: "button_3_single", 4: "button_4_single"
        }),
        BLEEvent("action", mi="5.e.1013", map={
            1: "button_1_double", 2: "button_2_double", 3: "button_3_double", 4: "button_4_double"
        }),
        BLEEvent("action", mi="5.e.1014", map={
            1: "button_1_hold", 2: "button_2_hold", 3: "button_3_hold", 4: "button_4_hold"
        }),
    ],
    "ttl": "6h"  # battery every 6 hours
}, {
Ernst79 commented 4 months ago

Added in 12.12.3-beta to test. Can't verify it, as I don't have this button. If someone can confirm it works OK, I'll add it in the final version.

alexreddy78 commented 4 months ago

Added in 12.12.3-beta to test. Can't verify it, as I don't have this button. If someone can confirm it works OK, I'll add it in the final version.

Dear Ernst,

Temp, Humidity, RSSI is OK, but the rest is unknown state

image

Plus flw error in debug mode

Источник: custom_components/ble_monitor/ble_parser/xiaomi.py:1483 интеграция: Passive BLE monitor (документация, проблемы) Первое сообщение: 16:22:24 (2 сообщений) Последнее сообщение: 16:24:29

Error doing job: Fatal error: protocol.data_received() call failed. (None) Traceback (most recent call last): File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 1017, in _read_readydata_received self._protocol.data_received(data) File "/usr/local/lib/python3.12/site-packages/aioblescan/aioblescan.py", line 1855, in data_received self.process(packet) File "/config/custom_components/ble_monitor/init.py", line 586, in process_hci_events sensor_msg, tracker_msg = self.ble_parser.parse_raw_data(data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/ble_monitor/ble_parser/init.py", line 166, in parse_raw_data sensor_data, tracker_data = self.parse_advertisement( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/ble_monitor/ble_parser/init__.py", line 251, in parse_advertisement sensor_data = parse_xiaomi(self, service_data, mac) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/ble_monitor/ble_parser/xiaomi.py", line 1483, in parse_xiaomi result.update(resfunc(dobject)) ^^^^^^^^^^^^^^^^ TypeError: obj560c() missing 1 required positional argument: 'device_type'

Ernst79 commented 4 months ago

Thanks for testing. Should be fixed in 12.12.5-beta (Note. 12.12.4 is the same as master, do not use that version for testing, my mistake, took the wrong branch)

alexreddy78 commented 4 months ago

Thanks for testing. Should be fixed in 12.12.5-beta (Note. 12.12.4 is the same as master, do not use that version for testing, my mistake, took the wrong branch)

Dear Ernst!

Fantastic! Can confirm all OK and can be included in next release.

image

BRGDS