Skip to content

Commit

Permalink
Merge pull request #1228 from jwxa/master
Browse files Browse the repository at this point in the history
add support for Linptech Wireless Button KS1Pro BLE KS1PBB
  • Loading branch information
AlexxIT authored Dec 3, 2023
2 parents 130b586 + 2d68ab1 commit 0707fc1
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
6 changes: 6 additions & 0 deletions custom_components/xiaomi_gateway3/core/converters/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
45 changes: 44 additions & 1 deletion custom_components/xiaomi_gateway3/core/converters/mibeacon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("<f", data)[0], 2)
elif eid == 0x4808: # 18440
# wireless button KS1PBB
if device.model == 15895:
payload["humidity"] = round(struct.unpack("<f", data)[0], 2)

MiBeacon = MiBeaconConv("mibeacon")

Expand Down

0 comments on commit 0707fc1

Please sign in to comment.