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

 找回密码
 立即注册
12
返回列表 发新帖
楼主: louwu

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

[复制链接]

4

主题

101

帖子

482

积分

中级会员

Rank: 3Rank: 3

积分
482
金钱
381
HASS币
0
 楼主| 发表于 2024-5-11 09:58:38 | 显示全部楼层

暂时改成这样了,中间的MapConv还没改好

本帖最后由 louwu 于 2024-5-11 09:59 编辑
from custom_components.xiaomi_gateway3.core.devices import * 

DEVICES = [{
    8553: ["LianXun", "Smart Switch 8-key Mesh", "lxun.switch.sw08"],
    "spec": [
        BaseConv("switch_1", "switch", mi="2.p.1"),
        BaseConv("switch_2", "switch", mi="3.p.1"),
        BaseConv("switch_3", "switch", mi="4.p.1"),
        BaseConv("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"}),
        BaseConv("action", "sensor"),
        ConstConv("action", mi="13.e.1", value=BUTTON_1_SINGLE),
        ConstConv("action", mi="14.e.1", value=BUTTON_2_SINGLE),
        ConstConv("action", mi="15.e.1", value=BUTTON_3_SINGLE),
        ConstConv("action", mi="16.e.1", value=BUTTON_4_SINGLE),
        ConstConv("action", mi="13.e.2", value=BUTTON_1_DOUBLE),
        ConstConv("action", mi="14.e.2", value=BUTTON_2_DOUBLE),
        ConstConv("action", mi="15.e.2", value=BUTTON_3_DOUBLE),
        ConstConv("action", mi="16.e.2", value=BUTTON_4_DOUBLE),
        ConstConv("action", mi="13.e.3", value=BUTTON_1_HOLD),
        ConstConv("action", mi="14.e.3", value=BUTTON_2_HOLD),
        ConstConv("action", mi="15.e.3", value=BUTTON_3_HOLD),
        ConstConv("action", mi="16.e.3", value=BUTTON_4_HOLD),
        ConstConv("action", mi="17.e.1", value="button_5_single"),
        ConstConv("action", mi="18.e.1", value="button_6_single"),
        ConstConv("action", mi="19.e.1", value="button_7_single"),
        ConstConv("action", mi="20.e.1", value="button_8_single"),
        ConstConv("action", mi="17.e.2", value="button_5_double"),
        ConstConv("action", mi="18.e.2", value="button_6_double"),
        ConstConv("action", mi="19.e.2", value="button_7_double"),
        ConstConv("action", mi="20.e.2", value="button_8_double"),
        ConstConv("action", mi="17.e.3", value="button_5_hold"),
        ConstConv("action", mi="18.e.3", value="button_6_hold"),
        ConstConv("action", mi="19.e.3", value="button_7_hold"),
        ConstConv("action", mi="20.e.3", value="button_8_hold"),
    ],
}] + DEVICES
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-23 13:21 , Processed in 0.091843 second(s), 21 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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