AlexxIT / XiaomiGateway3

Home Assistant custom component for control Xiaomi Multimode Gateway (aka Gateway 3), Xiaomi Multimode Gateway 2, Aqara Hub E1 on default firmwares over LAN
https://github.com/AlexxIT/Blog
MIT License
2.47k stars 348 forks source link

Request support for loock.lock.t2v1 #1341

Open hzonz opened 7 months ago

hzonz commented 7 months ago

Based on the debug logs, I refer to #1324

# XiaoMi Lock M20

from custom_components.xiaomi_gateway3.core.devices import *

DEVICES = [{
    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}), 
    ],
}] + DEVICES

action is normal. binary_sensor nothing has changed.

Here is the debug log

2024-04-27 12:13:39.951 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.10.10.12.15] {'topic': 'central/report', 'data': b'{"id":2146938240,"_to":128,"method":"_async.ble_event","params":{"dev":{"did":"1058685304","mac":"D8:76:70:C0:8D:2D","pdid":8154},"evt":[{"eid":11,"edata":"2000000180777B2C66"}],"frmCnt":22,"gwts":1714191225}}'}
2024-04-27 12:13:39.951 DEBUG (MainThread) [custom_components.xiaomi_gateway3.gate.10.10.12.15] {'uid': 'd87670c08d2d', 'did': '1058685304', 'msg': 'on_report', 'data': {'action': 'lock', 'action_id': 0, 'method_id': 2, 'message': 'Unlock outside the door', 'method': 'biological', 'key_id': 0, 'error': None, 'timestamp': '2024-04-27T12:13:43'}}

2024-04-27 12:13:40.421 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.10.10.12.15] {'topic': 'miio/report', 'data': b'{"id":648494669,"method":"_async.ble_event","params":{"dev":{"did":"1058685304","mac":"D8:76:70:C0:8D:2D","pdid":8154},"evt":[{"eid":11,"edata":"2000000180777b2c66"}],"frmCnt":22,"gwts":1714191225}}'}
2024-04-27 12:13:40.481 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.10.10.12.15] {'topic': 'miio/report_ack', 'data': b'{"id":648494669,"result":"ok"}'}

2024-04-27 12:13:47.900 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.10.10.12.15] {'topic': 'central/report', 'data': b'{"id":954523255,"_to":128,"method":"_async.ble_event","params":{"dev":{"did":"1058685304","mac":"D8:76:70:C0:8D:2D","pdid":8154},"evt":[{"eid":7,"edata":"017F7B2C66"}],"frmCnt":23,"gwts":1714191233}}'}
2024-04-27 12:13:47.900 DEBUG (MainThread) [custom_components.xiaomi_gateway3.gate.10.10.12.15] {'uid': 'd87670c08d2d', 'did': '1058685304', 'msg': 'on_report', 'data': {'contact': False, 'action': 'door', 'action_id': 1, 'message': 'Door is closed', 'timestamp': '2024-04-27T12:13:51'}}

2024-04-27 12:13:48.071 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.10.10.12.15] {'topic': 'miio/report', 'data': b'{"id":919243681,"method":"_async.ble_event","params":{"dev":{"did":"1058685304","mac":"D8:76:70:C0:8D:2D","pdid":8154},"evt":[{"eid":7,"edata":"017f7b2c66"}],"frmCnt":23,"gwts":1714191233}}'}
2024-04-27 12:13:48.121 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.10.10.12.15] {'topic': 'miio/report_ack', 'data': b'{"id":919243681,"result":"ok"}'}

2024-04-27 12:14:24.220 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.10.10.12.15] {'topic': 'miio/report', 'data': b'{"id":1848067709,"method":"_sync.ble_query_prod","params":{"pdid":8154}}'}
2024-04-27 12:14:24.301 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.10.10.12.15] {'topic': 'miio/report_ack', 'data': b'{"id":1848067709,"result":{"operation":"query_prod","pdid":8154,"ttl":1800,"thr":-40,"upRule":[{"delta":0,"eid":6,"intvl":0},{"delta":0,"eid":11,"intvl":0},{"delta":0,"eid":8,"intvl":0},{"delta":0,"eid":7,"intvl":0},{"delta":0,"eid":4106,"intvl":600},{"delta":0,"eid":4110,"intvl":60},{"delta":0,"eid":4111,"intvl":60}]}}'}

2024-04-27 12:14:32.377 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.10.10.12.15] {'topic': 'central/report', 'data': b'{"id":48084324,"_to":128,"method":"_async.ble_event","params":{"dev":{"did":"1058685304","mac":"D8:76:70:C0:8D:2D","pdid":8154},"evt":[{"eid":4111,"edata":"01"}],"frmCnt":24,"gwts":1714191278}}'}
2024-04-27 12:14:32.377 DEBUG (MainThread) [custom_components.xiaomi_gateway3.gate.10.10.12.15] {'uid': 'd87670c08d2d', 'did': '1058685304', 'msg': 'on_report', 'data': {'door': False}}
2024-04-27 12:14:32.879 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.10.10.12.15] {'topic': 'miio/report', 'data': b'{"id":194134712,"method":"_async.ble_event","params":{"dev":{"did":"1058685304","mac":"D8:76:70:C0:8D:2D","pdid":8154},"evt":[{"eid":4111,"edata":"01"}],"frmCnt":24,"gwts":1714191278}}'}
2024-04-27 12:14:32.939 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.10.10.12.15] {'topic': 'miio/report_ack', 'data': b'{"id":194134712,"result":"ok"}'}