『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 2414|回复: 24

[基础教程] 鹿客V5Max通过xiaomigateway3插件接入homeassistant

[复制链接]

1

主题

23

帖子

159

积分

注册会员

Rank: 2

积分
159
金钱
136
HASS币
0
发表于 2024-5-27 19:54:10 | 显示全部楼层 |阅读模式
前提:需要有个xiaomigateway3支持的小米多模网关,我是小米多模网关1代,安装好ha插件xiaomigateway3项目地址:https://github.com/AlexxIT/XiaomiGateway3

步骤:
在ha的config目录下新建[backcolor=rgba(175, 184, 193, 0.2)]xiaomi_gateway3.py

导入以下代码:
from custom_components.xiaomi_gateway3.core.devices import *

DEVICES = [{
    9877: ["Loock", "Loock Smart Lock V5 Max", "FCL201"],
    "spec": [
        BaseConv("action", "sensor"),
        BaseConv("key_id", mi="2.e.1020.p.4"),
        MapConv("method", "sensor", mi="2.e.1020.p.2", map={
            1: "mobile", 2: "fingerprint", 3: "password", 4: "nfc", 5: "face", 6: "Finger Vein", 
            7: "Palm Print", 8: "key", 9: "one_time_password", 10: "periodic_password", 
            11: "Homekit", 12: "coerce", 13: "Two Step Verification", 14: "Turntable", 
            15: "manual", 16: "auto"
        }),
        MapConv("lock_action", "sensor", mi="2.e.1020.p.3", map={
            1: "lock", 2: "unlock", 3: "lock_outside", 4: "lock_inside",
            5: "unlock_inside", 6: "enable_child_lock", 7: "disable_child_lock",
            8: "enable_away", 9: "disable_away"
        }),
        MapConv("door_state", "sensor", mi="3.p.1021", map={
            16: 'Locked',
            20: 'Locked',
            24: 'Locked',
            28: 'Locked',
            32: 'Unlocked',
            36: 'Unlocked',
            40: 'Unlocked',
            44: 'Unlocked',
            48: 'Leaving The Door Open Timed Out',
            52: 'Leaving The Door Open Timed Out',
            56: 'Leaving The Door Open Timed Out',
            60: 'Leaving The Door Open Timed Out',
            64: 'Door Was Ajar',
            68: 'Door Was Ajar',
            72: 'Door Was Ajar',
            76: 'Door Was Ajar'
        }),
        MapConv("abnormal_type", "sensor", mi="2.e.1020.p.6", map={
            1: "Frequent Unlocking Failed By Multiple Methods", 
            2: "Frequent Unlocking Failed By Password", 
            3: "Frequent Unlocking Failed By Fingerprint", 
            4: "Frequent Unlocking Failed By NFC", 
            5: "Frequent Unlocking Failed By Face", 
            6: "Frequent Unlocking Failed By Palmprint", 
            7: "Frequent Unlocking Failed By Finger Vein", 
            8: "Frequent Unlocking Failed By Key", 
            9: "Door Lock Was Damaged", 
            10: "Locked Unsuccessfully", 
            11: "Unlock From Inside After Leaving Home", 
            12: "Door Lock Was Reset", 
            13: "Foreign Object Detected In The Keyhole", 
            14: "Key Was Not Removed", 
            15: "Door Lock Fingerprint Sensor Error", 
            16: "Door Lock Mechanical Failure", 
            17: "Door Lock Main Part Failure", 
            18: "The Lithium Battery Temperature Is Too High", 
            19: "Large Batteries Are Low", 
            20: "Small Batteries Are Low", 
            21: "Large And Small Batteries Are Low", 
            22: "Large And Small Deplete", 
            23: "Leaving The Door Open Timed Out", 
            24: "Door Was Ajar", 
            25: "Door Was Opened Forcefully", 
            26: "Small Batteries Are Nearly Depleted", 
            27: "Small Batteries Are Nearly Depleted And Large Batteries Low", 
            28: "Large Batteries Are Nearly Depleted", 
            29: "Large Batteries Are Nearly Depleted And Small Batteries Low", 
            30: "Large Batteries Are Removed", 
            31: "Large Batteries Are Inserted", 
            32: "Small Batteries Are Removed", 
            33: "Small Batteries Are Inserted", 
            34: "Battery Low The Cat Eye Function And The Door Screen Are Suspended", 
            35: "Ultrasonic Sensitivity Decreased"
        }),
        MapConv("position", "sensor", mi="2.e.1020.p.1", map={
            1: "indoor", 2: "outdoor", 3: "not tell indoor or outdoor"
        }),
        BaseConv("lock_timestamp", "sensor", mi="2.e.1020.p.5"),  # lock timestamp
        
        # doorbell
        ConstConv("action", mi="5.e.1006", value="doorbell"),
        BaseConv("doorbell_timestamp", "sensor", mi="5.e.1006.p.1"),  # doorbell timestamp

        # battery sensor
        BaseConv("battery", "sensor", mi="4.p.1003"),
        BaseConv("changing", "sensor", mi="4.p.1034"),
    ],
}] + DEVICES


保存后重启ha就可以了。
在集成里添加好xiaomigateway3,增加网关后会自动识别连接到该网关蓝牙的v5max

效果图
334057147-a81b0822-fda8-47da-9818-dfffe37ebb5b.png

类似方法可以尝试自己写代码来支持其他蓝牙锁

方法:
1. 在这里https://home.miot-spec.com/,找到你米家支持的设备
2. 我在网上搜到的设备号9877, 这个具体怎么获得目前不太清楚。
3. 后面是根据miot-spec内的内容修改spec, 同一家厂商的话内容基本上是差不多的。
4. 后面就是不断试错了。
回复

使用道具 举报

20

主题

216

帖子

1458

积分

论坛DIY达人

积分
1458
金钱
1217
HASS币
100
发表于 2024-5-27 20:38:07 | 显示全部楼层
PIC20240527203559001.png 这个不是本身就支持吗?
miot
回复

使用道具 举报

20

主题

351

帖子

1943

积分

金牌会员

Rank: 6Rank: 6

积分
1943
金钱
1592
HASS币
0
发表于 2024-5-27 20:53:05 | 显示全部楼层
前两天刚问,太好了,非诚感谢!
回复

使用道具 举报

20

主题

351

帖子

1943

积分

金牌会员

Rank: 6Rank: 6

积分
1943
金钱
1592
HASS币
0
发表于 2024-5-27 20:54:40 | 显示全部楼层
zro22 发表于 2024-5-27 20:38
这个不是本身就支持吗?
miot

miot走的不是本地,响应不太及时
回复

使用道具 举报

1

主题

23

帖子

159

积分

注册会员

Rank: 2

积分
159
金钱
136
HASS币
0
 楼主| 发表于 2024-5-27 21:11:16 | 显示全部楼层
zro22 发表于 2024-5-27 20:38
这个不是本身就支持吗?
miot

miot上的不及时且不太准确。对于需要依赖ha来做联动的来说非常不方便。本地蓝牙目前我还没有完整测试,部分情况下也存在延迟情况,暂不清楚原因。action sensor目前也只识别出doorbell,还有很多需要做。
回复

使用道具 举报

8

主题

870

帖子

5218

积分

论坛元老

Rank: 8Rank: 8

积分
5218
金钱
4348
HASS币
0
发表于 2024-5-28 20:42:28 | 显示全部楼层
学习了,谢谢分享。赞
回复

使用道具 举报

2

主题

107

帖子

838

积分

高级会员

Rank: 4

积分
838
金钱
731
HASS币
0
发表于 2024-5-30 23:37:33 | 显示全部楼层
这款锁有两块电池,如何再XMGW3中实现识别两个电池呢?
回复

使用道具 举报

4

主题

34

帖子

488

积分

论坛分享达人

积分
488
金钱
454
HASS币
0
QQ
发表于 2024-7-7 08:56:56 | 显示全部楼层
它的监控能接入到ha吗
回复

使用道具 举报

20

主题

351

帖子

1943

积分

金牌会员

Rank: 6Rank: 6

积分
1943
金钱
1592
HASS币
0
发表于 2024-9-15 15:52:48 | 显示全部楼层
你好请问这个action里面会有信息么
回复

使用道具 举报

23

主题

329

帖子

1396

积分

金牌会员

Rank: 6Rank: 6

积分
1396
金钱
1067
HASS币
10
发表于 2024-9-15 20:22:23 | 显示全部楼层
我的鹿客X3-H,要修改哪些东西呢?
之前有个帖子也说接入鹿客,但问了没人回答
在小程序里显示型号YD-D3NF
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-21 21:16 , Processed in 0.924783 second(s), 35 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表