本帖最后由 没内涵 于 2023-12-30 21:02 编辑
目前gateway3接入只能显示成单键,xiaomi miot auto接入轮询的响应又不够快,所以可以根据gateway3里的方法自己添加 在config文件夹下新建一个文件,取名为xiaomi_gateway3.py 然后按照模板添加,我是用别的四键的模板改的 不过四键开关的无线功能只能识别到按键1单击,不管按哪个键识别出来都是按键1单击,因为我四键不需要转无线所以就没再研究了,有兴趣的可以研究下
from custom_components.xiaomi_gateway3.core.converters.devices import *
DEVICES = [{
15658: ["Linptech", "one key Wall Switch", "linp.switch.qt1db1"],
"spec": [
Converter("switch", "switch", mi="2.p.1"),
MapConv("mode", "select", mi="2.p.2", map={0: "wired", 1: "wireless"}),
Action,
ButtonMIConv("button", mi="3.e.1", value=1),
],
}] + [{
15659: ["Linptech", "Two key Wall Switch", "linp.switch.qt1db2"],
"spec": [
Converter("switch_1", "switch", mi="2.p.1"),
Converter("switch_2", "switch", mi="3.p.1"),
MapConv("mode_1", "select", mi="2.p.2", map={0: "wired", 1: "wireless"}),
MapConv("mode_2", "select", mi="3.p.2", map={0: "wired", 1: "wireless"}),
Action,
ButtonMIConv("button_1", mi="4.e.1", value=1),
ButtonMIConv("button_2", mi="5.e.1", value=1),
],
}] + [{
15660: ["Linptech", "Three key Wall Switch", "linp.switch.qt1db3"],
"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"),
MapConv("mode_1", "select", mi="2.p.2", map={0: "wired", 1: "wireless"}),
MapConv("mode_2", "select", mi="3.p.2", map={0: "wired", 1: "wireless"}),
MapConv("mode_3", "select", mi="4.p.2", map={0: "wired", 1: "wireless"}),
Action,
ButtonMIConv("button_1", mi="5.e.1", value=1),
ButtonMIConv("button_2", mi="6.e.1", value=1),
ButtonMIConv("button_3", mi="7.e.1", value=1),
],
}] + [{
15661: ["Linptech", "four key Wall Switch", "linp.switch.qt1db4"],
"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="5.p.1"),
MapConv("mode_1", "select", mi="2.p.2", map={0: "wired", 1: "wireless"}),
MapConv("mode_2", "select", mi="3.p.2", map={0: "wired", 1: "wireless"}),
MapConv("mode_3", "select", mi="4.p.2", map={0: "wired", 1: "wireless"}),
MapConv("mode_4", "select", mi="5.p.2", map={0: "wired", 1: "wireless"}),
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
|