diff --git a/custom_components/xiaomi_gateway3/core/converters/devices.py b/custom_components/xiaomi_gateway3/core/converters/devices.py index 7b0e2a72..969c3123 100644 --- a/custom_components/xiaomi_gateway3/core/converters/devices.py +++ b/custom_components/xiaomi_gateway3/core/converters/devices.py @@ -1281,6 +1281,12 @@ BLEEvent("action", mi="3.e.1012", map={1: SINGLE, 8: HOLD, 15: DOUBLE}), ], "ttl": "6h" # battery every 6 hours +}, { + 15895: ["Linptech", "Wireless Button KS1Pro", "KS1PBB"], + "spec": [ + MiBeacon, BLEAction, BLEHumidity, BLETemperature, BLEBattery + ], + "ttl": "6h" # battery every 6 hours }, { # lumi.remote.mcn001 9095: ["Xiaomi", "Wireless Button", "XMWXKG01LM"], diff --git a/custom_components/xiaomi_gateway3/core/converters/mibeacon.py b/custom_components/xiaomi_gateway3/core/converters/mibeacon.py index 7a025019..d08e0231 100644 --- a/custom_components/xiaomi_gateway3/core/converters/mibeacon.py +++ b/custom_components/xiaomi_gateway3/core/converters/mibeacon.py @@ -546,7 +546,50 @@ def decode(self, device: "XDevice", payload: dict, value: dict): if error_id not in BLE_SPEC_LOCK_ERROR: return payload["error"] = BLE_SPEC_LOCK_ERROR[error_id] - + elif eid == 0x560C: # 22028 + # wireless button KS1PBB + if device.model == 15895: + value = int.from_bytes(data, "little") + if value == 1: + payload.update({"action": "button_1_single"}) + if value == 2: + payload.update({"action": "button_2_single"}) + if value == 3: + payload.update({"action": "button_3_single"}) + if value == 4: + payload.update({"action": "button_4_single"}) + elif eid == 0x560D: # 22029 + # wireless button KS1PBB + if device.model == 15895: + value = int.from_bytes(data, "little") + if value == 1: + payload.update({"action": "button_1_double"}) + if value == 2: + payload.update({"action": "button_2_double"}) + if value == 3: + payload.update({"action": "button_3_double"}) + if value == 4: + payload.update({"action": "button_4_double"}) + elif eid == 0x560E: # 22030 + # wireless button KS1PBB + if device.model == 15895: + value = int.from_bytes(data, "little") + if value == 1: + payload.update({"action": "button_1_hold"}) + if value == 2: + payload.update({"action": "button_2_hold"}) + if value == 3: + payload.update({"action": "button_3_hold"}) + if value == 4: + payload.update({"action": "button_4_hold"}) + elif eid == 0x4801: # 18433 + # wireless button KS1PBB + if device.model == 15895: + payload["temperature"] = round(struct.unpack("