From 15503ec2a8e899fa1acc5b4ac851bf9b4f38bf55 Mon Sep 17 00:00:00 2001 From: Alex X Date: Sun, 20 Oct 2024 18:15:31 +0300 Subject: [PATCH] Add support 090615.remote.btsw1 on old gateway firmwares #1463 --- custom_components/xiaomi_gateway3/core/devices.py | 5 +++++ tests/test_conv_ble.py | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/custom_components/xiaomi_gateway3/core/devices.py b/custom_components/xiaomi_gateway3/core/devices.py index 8f57a540..b36e3452 100644 --- a/custom_components/xiaomi_gateway3/core/devices.py +++ b/custom_components/xiaomi_gateway3/core/devices.py @@ -1978,6 +1978,11 @@ 14523: ["PTX", "BLE Wireless Switch", "090615.remote.btsw1"], "spec": [ BaseConv("action", "sensor"), + # mibeacon2 spec + ConstConv("action", mi=18956, value=BUTTON_SINGLE), + ConstConv("action", mi=18957, value=BUTTON_DOUBLE), + ConstConv("action", mi=18958, value=BUTTON_HOLD), + # miot spec ConstConv("action", mi="2.e.1012", value=BUTTON_SINGLE), ConstConv("action", mi="2.e.1013", value=BUTTON_DOUBLE), ConstConv("action", mi="2.e.1014", value=BUTTON_HOLD), diff --git a/tests/test_conv_ble.py b/tests/test_conv_ble.py index f49a5160..a379178e 100644 --- a/tests/test_conv_ble.py +++ b/tests/test_conv_ble.py @@ -321,3 +321,10 @@ def test_10249(): {"siid": 6, "eiid": 1006, "arguments": [{"piid": 1, "value": 1681029598}]} ) assert p == {"action": "doorbell", "timestamp": 1681029598} + + +def test_14523(): + device = XDevice(14523) + + p = device.decode({"eid": 18956, "edata": ""}) + assert p == {"action": "single"}