Skip to content

Commit

Permalink
Add support loock.lock.t2v1 #1341
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Dec 27, 2024
1 parent 501835f commit acf7b9e
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
13 changes: 13 additions & 0 deletions custom_components/xiaomi_gateway3/core/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -4155,6 +4155,19 @@
MapConv("battery_status", "sensor", mi="3.p.3", map={0: "Idle", 1: "Adapter", 2: "Solar", 3: "Protected", 4: "Adapter-float"}, entity=ENTITY_DIAGNOSTIC),
MapConv("anti_pinch_sensitivity", "select", mi="4.p.2", map={0: "Very Low", 1: "Low", 2: "Medium", 3: "High"}, entity=ENTITY_CONFIG),
],
}, {
8154: ["Xiaomi", "Door Lock M20", "loock.lock.t2v1"],
"spec": [
BaseConv("action", "sensor"),
BaseConv("contact", "binary_sensor"), # from mi=7
BLEFinger("fingerprint", mi=6),
BLEDoor("door", mi=7),
BLEMapConv("action", mi=8, map={"00": "disarmed", "01": "armed"}),
BLELock("lock", mi=11),
BLEByteConv("battery", "sensor", mi=4106),
BLEMapConv("lock", "binary_sensor", mi=4110, map={"00": True, "01": False}), # reverse
BLEMapConv("door", "binary_sensor", mi=4111, map={"00": True, "01": False}),
],
}, {
"default": "mesh", # default Mesh device
"spec": [
Expand Down
26 changes: 26 additions & 0 deletions tests/test_conv_ble.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,3 +374,29 @@ def test_2691():

p = device.decode({"eid": 4119, "edata": "3C000000"})
assert p == {"idle_time": 60}


def test_8154():
device = XDevice(8154)

p = device.decode({"eid": 11, "edata": "2000000180777B2C66"})
assert p == {
"action": "lock",
"action_id": 0,
"error": None,
"key_id": 0,
"message": "Unlock outside the door",
"method": "biological",
"method_id": 2,
"timestamp": "2024-04-27T07:13:43",
}
p = device.decode({"eid": 7, "edata": "017F7B2C66"})
assert p == {
"action": "door",
"action_id": 1,
"contact": False,
"message": "Door is closed",
"timestamp": "2024-04-27T07:13:51",
}
p = device.decode({"eid": 4111, "edata": "01"})
assert p == {"door": False}

0 comments on commit acf7b9e

Please sign in to comment.