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

 找回密码
 立即注册
查看: 2017|回复: 10

[求助] ha只识别到一个开关。米家8键复合开关,4路继电器和4键场...

[复制链接]

4

主题

101

帖子

482

积分

中级会员

Rank: 3Rank: 3

积分
482
金钱
381
HASS币
0
发表于 2024-2-29 19:41:14 | 显示全部楼层 |阅读模式
本帖最后由 louwu 于 2024-3-1 19:46 编辑

买了米家的两个八键开关,4路继电器+4路情景开关;

4路继电器和4路场景面板

4路继电器和4路场景面板

手机端都能控制。

米家app

米家app

[size=10.5000pt]
[size=10.5000pt]ha里只显示一个switch,不知道怎么回事

ha的XiaomiGateway3集成

ha的XiaomiGateway3集成

实体

实体

nodered监测也只看到一个开关,

nodered

nodered

求大神帮助





回复

使用道具 举报

13

主题

540

帖子

5634

积分

论坛元老

Rank: 8Rank: 8

积分
5634
金钱
5094
HASS币
10
发表于 2024-2-29 20:00:12 | 显示全部楼层
回复

使用道具 举报

64

主题

481

帖子

2152

积分

金牌会员

Rank: 6Rank: 6

积分
2152
金钱
1666
HASS币
0
发表于 2024-2-29 20:50:35 | 显示全部楼层
得自己添加,我就是自己添加的
回复

使用道具 举报

4

主题

101

帖子

482

积分

中级会员

Rank: 3Rank: 3

积分
482
金钱
381
HASS币
0
 楼主| 发表于 2024-3-1 18:59:16 | 显示全部楼层
本帖最后由 louwu 于 2024-3-1 19:00 编辑
mars.z 发表于 2024-2-29 20:00
[基础教程] Xiaomi Gateway 3添加不在支持列表中的设备

感谢大佬指点,摸索了一阵,上排的4个继电器按键解决了,下排的4个情景按键就找不到了,求指点
找到一个极其类似的开关,但只显示4个开关
微信图片_20240301185249.png
这是复制的代码
from custom_components.xiaomi_gateway3.core.converters.devices import * 

DEVICES = [{
    8553: ["LianXun", "Smart Switch 8-key Mesh", "lxun.switch.sw08"],
    "spec": [
        Converter("switch_1", "switch", mi="2.p.1"),
        Converter("switch_2", "switch", mi="3.p.1"),
        Converter("switch_3", "switch", mi="4.p.1"),
        Converter("switch_4", "switch", mi="12.p.1"),
        MapConv("backlight", "select", mi="5.p.1", map={0: "off", 1: "on"}),
        MapConv("backlight_1", "select", mi="9.p.1", map={1: "reverse", 2: "open", 3: "close", 4: "flash"}),
        MapConv("backlight_2", "select", mi="9.p.2", map={1: "reverse", 2: "open", 3: "close", 4: "flash"}),
        MapConv("backlight_3", "select", mi="9.p.3", map={1: "reverse", 2: "open", 3: "close", 4: "flash"}),
        MapConv("backlight_4", "select", mi="9.p.4", map={1: "reverse", 2: "open", 3: "close", 4: "flash"}),
        MapConv("backlight_5", "select", mi="9.p.5", map={1: "reverse", 2: "open", 3: "close", 4: "flash"}),
        MapConv("backlight_6", "select", mi="9.p.6", map={1: "reverse", 2: "open", 3: "close", 4: "flash"}),
        MapConv("backlight_7", "select", mi="9.p.7", map={1: "reverse", 2: "open", 3: "close", 4: "flash"}),
        MapConv("backlight_8", "select", mi="9.p.8", map={1: "reverse", 2: "open", 3: "close", 4: "flash"}),
        MapConv("mode_1", "select", mi="10.p.1", map={1: "normal", 2: "scene", 3: "flex"}),
        MapConv("mode_2", "select", mi="10.p.2", map={1: "normal", 2: "scene", 3: "flex"}),
        MapConv("mode_3", "select", mi="10.p.3", map={1: "normal", 2: "scene", 3: "flex"}),
        MapConv("mode_4", "select", mi="10.p.4", map={1: "normal", 2: "scene", 3: "flex"}),
        Action,
        ButtonMIConv("button_1", mi="11.e.1", value=1),
        ButtonMIConv("button_2", mi="11.e.2", value=1),
        ButtonMIConv("button_3", mi="11.e.3", value=1),
        ButtonMIConv("button_4", mi="11.e.4", value=1),
        ButtonMIConv("button_1", mi="11.e.5", value=2),
        ButtonMIConv("button_2", mi="11.e.6", value=2),
        ButtonMIConv("button_3", mi="11.e.7", value=2),
        ButtonMIConv("button_4", mi="11.e.8", value=2),
        ButtonMIConv("button_1", mi="11.e.9", value=16),
        ButtonMIConv("button_2", mi="11.e.10", value=16),
        ButtonMIConv("button_3", mi="11.e.11", value=16),
        ButtonMIConv("button_4", mi="11.e.12", value=16),
        ButtonMIConv("button_5", mi="11.e.13", value=1),
        ButtonMIConv("button_6", mi="11.e.14", value=1),
        ButtonMIConv("button_7", mi="11.e.15", value=1),
        ButtonMIConv("button_8", mi="11.e.16", value=1),
        ButtonMIConv("button_5", mi="11.e.17", value=2),
        ButtonMIConv("button_6", mi="11.e.18", value=2),
        ButtonMIConv("button_7", mi="11.e.19", value=2),
        ButtonMIConv("button_8", mi="11.e.20", value=2),
        ButtonMIConv("button_5", mi="11.e.21", value=16),
        ButtonMIConv("button_6", mi="11.e.22", value=16),
        ButtonMIConv("button_7", mi="11.e.23", value=16),
        ButtonMIConv("button_8", mi="11.e.24", value=16),
    ]
}] + DEVICES
下排四个开关无法显示出来,也不知道哪里出问题了
微信图片_20240301185255.png
回复

使用道具 举报

4

主题

101

帖子

482

积分

中级会员

Rank: 3Rank: 3

积分
482
金钱
381
HASS币
0
 楼主| 发表于 2024-3-1 19:07:07 | 显示全部楼层
本帖最后由 louwu 于 2024-3-1 19:12 编辑
lichao622 发表于 2024-2-29 20:50
得自己添加,我就是自己添加的

请教一下如何写,我按前面的代码补充了4个开关,显示倒是有8个开关了, 微信图片_20240301185255.png
结果下排的情景开关无效,这些字符串各代表什么啊
    "spec": [
        Converter("switch_1", "switch", mi="2.p.1"),
        Converter("switch_2", "switch", mi="3.p.1"),
        Converter("switch_3", "switch", mi="4.p.1"),
        Converter("switch_4", "switch", mi="12.p.1"),
改成8键了
from custom_components.xiaomi_gateway3.core.converters.devices import * 

DEVICES = [{
    8553: ["LianXun", "Smart Switch 8-key Mesh", "lxun.switch.sw08"],
    "spec": [
        Converter("switch_1", "switch", mi="2.p.1"),
        Converter("switch_2", "switch", mi="3.p.1"),
        Converter("switch_3", "switch", mi="4.p.1"),
        Converter("switch_4", "switch", mi="12.p.1"),
        Converter("switch_5", "switch", mi="5.p.1"),
        Converter("switch_6", "switch", mi="6.p.1"),
        Converter("switch_7", "switch", mi="7.p.1"),
        Converter("switch_8", "switch", mi="8.p.1"),
        MapConv("backlight", "select", mi="5.p.1", map={0: "off", 1: "on"}),
        MapConv("backlight_1", "select", mi="9.p.1", map={1: "reverse", 2: "open", 3: "close", 4: "flash"}),
        MapConv("backlight_2", "select", mi="9.p.2", map={1: "reverse", 2: "open", 3: "close", 4: "flash"}),
        MapConv("backlight_3", "select", mi="9.p.3", map={1: "reverse", 2: "open", 3: "close", 4: "flash"}),
        MapConv("backlight_4", "select", mi="9.p.4", map={1: "reverse", 2: "open", 3: "close", 4: "flash"}),
        MapConv("backlight_5", "select", mi="9.p.5", map={1: "reverse", 2: "open", 3: "close", 4: "flash"}),
        MapConv("backlight_6", "select", mi="9.p.6", map={1: "reverse", 2: "open", 3: "close", 4: "flash"}),
        MapConv("backlight_7", "select", mi="9.p.7", map={1: "reverse", 2: "open", 3: "close", 4: "flash"}),
        MapConv("backlight_8", "select", mi="9.p.8", map={1: "reverse", 2: "open", 3: "close", 4: "flash"}),
        MapConv("mode_1", "select", mi="10.p.1", map={1: "normal", 2: "scene", 3: "flex"}),
        MapConv("mode_2", "select", mi="10.p.2", map={1: "normal", 2: "scene", 3: "flex"}),
        MapConv("mode_3", "select", mi="10.p.3", map={1: "normal", 2: "scene", 3: "flex"}),
        MapConv("mode_4", "select", mi="10.p.4", map={1: "normal", 2: "scene", 3: "flex"}),
        Action,
        ButtonMIConv("button_1", mi="11.e.1", value=1),
        ButtonMIConv("button_2", mi="11.e.2", value=1),
        ButtonMIConv("button_3", mi="11.e.3", value=1),
        ButtonMIConv("button_4", mi="11.e.4", value=1),
        ButtonMIConv("button_1", mi="11.e.5", value=2),
        ButtonMIConv("button_2", mi="11.e.6", value=2),
        ButtonMIConv("button_3", mi="11.e.7", value=2),
        ButtonMIConv("button_4", mi="11.e.8", value=2),
        ButtonMIConv("button_1", mi="11.e.9", value=16),
        ButtonMIConv("button_2", mi="11.e.10", value=16),
        ButtonMIConv("button_3", mi="11.e.11", value=16),
        ButtonMIConv("button_4", mi="11.e.12", value=16),
        ButtonMIConv("button_5", mi="11.e.13", value=1),
        ButtonMIConv("button_6", mi="11.e.14", value=1),
        ButtonMIConv("button_7", mi="11.e.15", value=1),
        ButtonMIConv("button_8", mi="11.e.16", value=1),
        ButtonMIConv("button_5", mi="11.e.17", value=2),
        ButtonMIConv("button_6", mi="11.e.18", value=2),
        ButtonMIConv("button_7", mi="11.e.19", value=2),
        ButtonMIConv("button_8", mi="11.e.20", value=2),
        ButtonMIConv("button_5", mi="11.e.21", value=16),
        ButtonMIConv("button_6", mi="11.e.22", value=16),
        ButtonMIConv("button_7", mi="11.e.23", value=16),
        ButtonMIConv("button_8", mi="11.e.24", value=16),
    ]
}] + DEVICES




回复

使用道具 举报

4

主题

101

帖子

482

积分

中级会员

Rank: 3Rank: 3

积分
482
金钱
381
HASS币
0
 楼主| 发表于 2024-3-1 19:32:00 | 显示全部楼层
还找到另外一个无线的8键开关,感觉代码结构都不一样,无法结合。
    6742: ["Le", "Wireless Button", "lemesh.remote.ts1"],
    "spec": [
        MiBeacon, BLEAction, Button,
        BLEEvent("action", mi="2.e.1012", map={
            1: "button_1_single", 2: "button_2_single", 3: "button_3_single",
            4: "button_4_single", 5: "button_5_single", 6: "button_6_single",
            7: "button_7_single", 8: "button_8_single"
        }),
        BLEEvent("action", mi="2.e.1013", map={
            1: "button_1_double", 2: "button_2_double", 3: "button_3_double",
            4: "button_4_double", 5: "button_5_double", 6: "button_6_double",
            7: "button_7_double", 8: "button_8_double"
        }),
        BLEEvent("action", mi="2.e.1014", map={
            1: "button_1_hold", 2: "button_2_hold", 3: "button_3_hold",
            4: "button_4_hold", 5: "button_5_hold", 6: "button_6_hold",
            7: "button_7_hold", 8: "button_8_hold"
        }),
    ]
}, {
回复

使用道具 举报

13

主题

540

帖子

5634

积分

论坛元老

Rank: 8Rank: 8

积分
5634
金钱
5094
HASS币
10
发表于 2024-3-1 23:30:56 | 显示全部楼层
本帖最后由 mars.z 于 2024-3-2 00:13 编辑
louwu 发表于 2024-3-1 18:59
感谢大佬指点,摸索了一阵,上排的4个继电器按键解决了,下排的4个情景按键就找不到了,求指点
...
from custom_components.xiaomi_gateway3.core.converters.devices import *

DEVICES = [{
    10147: ["bean", "Four buttons Mesh switch", "(bean.switch.bln04)"],
    "spec": [
        Converter("按键1", "switch", mi="2.p.1"),
        Converter("按键2", "switch", mi="3.p.1"),
        Converter("按键3", "switch", mi="4.p.1"),
        Converter("按键4", "switch", mi="5.p.1"),
        Converter("关闭状态下的背光", "switch", mi="10.p.1"),
        Converter("常通电指示灯是否关闭", "switch", mi="10.p.2"),
        MapConv("按键1_模式", "select", mi="2.p.2", map={
            0: "关闭转换", 1: "转无线开关功能", 2: "转凌动开关功能", 3: "转场景开关功能"
        }, enabled=True),
        MapConv("按键2_模式", "select", mi="3.p.2", map={
            0: "关闭转换", 1: "转无线开关功能", 2: "转凌动开关功能", 3: "转场景开关功能"
        }, enabled=True),
        MapConv("按键3_模式", "select", mi="4.p.2", map={
            0: "关闭转换", 1: "转无线开关功能", 2: "转凌动开关功能", 3: "转场景开关功能"
        }, enabled=True),
        MapConv("按键4_模式", "select", mi="5.p.2", map={
            0: "关闭转换", 1: "转无线开关功能", 2: "转凌动开关功能", 3: "转场景开关功能"
        }, enabled=True),
        MapConv("按键1_无线双控功能", "select", mi="11.p.1", map={
            16: "配对", 32: "退出", 48: "清除"
        }, enabled=True),
        MapConv("按键2_无线双控功能", "select", mi="11.p.1", map={
            17: "配对", 33: "退出", 49: "清除"
        }, enabled=True),
        MapConv("按键3_无线双控功能", "select", mi="11.p.1", map={
            18: "配对", 34: "退出", 50: "清除"
        }, enabled=True),
        MapConv("按键4_无线双控功能", "select", mi="11.p.1", map={
            19: "配对", 35: "退出", 51: "清除"
        }, enabled=True),
        Action,
        ButtonMIConv("button_1", mi="6.e.1", value=1),
        ButtonMIConv("button_2", mi="7.e.1", value=1),
        ButtonMIConv("button_3", mi="8.e.1", value=1),
        ButtonMIConv("button_4", mi="9.e.1", value=1),
    ],
}] + DEVICES



微信截图_20240301232955.png https://home.miot-spec.com/spec/bean.switch.bln04
类似开关,你可以参考下,另外你的这个开关id是8553,应该是https://home.miot-spec.com/spec/lemesh.switch.sw8a01这个,需要根据实际的siid 和 piid 自己改,照搬其他设备的可能无效



另外如果用ButtonMIConv转换的miot属性的话,好像不会在ha中生成实体,只会在对应的这个设备生成一个event,在创建自动化的时候能看到
微信截图_20240301233344.png



回复

使用道具 举报

4

主题

101

帖子

482

积分

中级会员

Rank: 3Rank: 3

积分
482
金钱
381
HASS币
0
 楼主| 发表于 2024-3-2 21:02:32 | 显示全部楼层
mars.z 发表于 2024-3-1 23:30
https://home.miot-spec.com/spec/bean.switch.bln04
类似开关,你可以参考下,另外你的这个开关id是8 ...

非常感谢大佬的这么详尽的指点[抱拳]
我先详细消化一下,siid piid竟然是这么用的,感谢感谢
回复

使用道具 举报

3

主题

41

帖子

387

积分

中级会员

Rank: 3Rank: 3

积分
387
金钱
346
HASS币
0
发表于 2024-3-13 21:32:34 | 显示全部楼层
    8553: ["LeMesh", "Mesh Four-Key Wall Switch", "lemesh.switch.sw8a01"],
    "spec": [
        Converter("channel_1", "switch", mi="2.p.1"),
        Converter("channel_2", "switch", mi="3.p.1"),
        Converter("channel_3", "switch", mi="4.p.1"),
        Converter("channel_4", "switch", mi="12.p.1"),
        Action,
        ButtonMIConv("button_1", mi="13.e.1", value=0),
        ButtonMIConv("button_1", mi="13.e.2", value=0),
        ButtonMIConv("button_1", mi="13.e.3", value=0),
        ButtonMIConv("button_2", mi="14.e.1", value=0),
        ButtonMIConv("button_2", mi="14.e.2", value=0),
        ButtonMIConv("button_2", mi="14.e.3", value=0),
        ButtonMIConv("button_3", mi="15.e.1", value=0),
        ButtonMIConv("button_3", mi="15.e.2", value=0),
        ButtonMIConv("button_3", mi="15.e.3", value=0),
        ButtonMIConv("button_4", mi="16.e.1", value=0),
        ButtonMIConv("button_4", mi="16.e.2", value=0),
        ButtonMIConv("button_4", mi="16.e.3", value=0),
        ButtonMIConv("button_5", mi="17.e.1", value=0),
        ButtonMIConv("button_5", mi="17.e.2", value=0),
        ButtonMIConv("button_5", mi="17.e.3", value=0),
        ButtonMIConv("button_6", mi="18.e.1", value=0),
        ButtonMIConv("button_6", mi="18.e.2", value=0),
        ButtonMIConv("button_6", mi="18.e.3", value=0),
        ButtonMIConv("button_7", mi="19.e.1", value=0),
        ButtonMIConv("button_7", mi="19.e.2", value=0),
        ButtonMIConv("button_7", mi="19.e.3", value=0),
        ButtonMIConv("button_8", mi="20.e.1", value=0),
        ButtonMIConv("button_8", mi="20.e.2", value=0),
        ButtonMIConv("button_8", mi="20.e.3", value=0),
回复

使用道具 举报

4

主题

101

帖子

482

积分

中级会员

Rank: 3Rank: 3

积分
482
金钱
381
HASS币
0
 楼主| 发表于 2024-4-21 21:01:22 | 显示全部楼层
tangyuan 发表于 2024-3-13 21:32
8553: ["LeMesh", "Mesh Four-Key Wall Switch", "lemesh.switch.sw8a01"],
    "spec": [
        Con ...

感谢大佬,刚好更新了小米插件,搞不清楚了,等过段时间再向您请教
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-23 13:20 , Processed in 0.063962 second(s), 34 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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