本帖最后由 zgxman 于 2024-7-25 01:00 编辑
我在PDD上买了几个八键的无线开关,但是HA里并不能正确识别,小米产品库里是有这个产品的,我参考了其他八建无线开关的代码在『xiaomi_gateway3.py』这个文件里添加了代码,日志可以正确显示按键记录,但是自动化里没有相关条件代码如下:
from custom_components.xiaomi_gateway3.core.devices import *
DEVICES = [{
16186: ["Smartfrog", "Wireless Button", "giot.remote.v58kwm"],
"spec": [
BaseConv("action", "sensor"),
MapConv("action", mi="2.e.1012.p.1", 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"}),
MapConv("action", mi="2.e.1013.p.1", 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"}),
MapConv("action", mi="2.e.1014.p.1", 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"}),
],
}] + DEVICES
https://home.mi.com/views/introduction.html?region=cn&pdid=16186&model=giot.remote.v58kwm
|