|
发表于 2024-5-8 17:42:35
|
显示全部楼层
在Config目录下新建一个xiaomi_gateway3.py文件
里面内容格式如下,里面的设备代码会替换默认的,优先执行:
from custom_components.xiaomi_gateway3.core.devices import *
DEVICES = [
{
17885: ["Xiaomi", "Xiaomi Smart Wall Outlet Pro", "XMZNCZ03LM", "xiaomi.plug.mcn003"],
"spec": [
BaseConv("outlet", "switch", mi="2.p.1"),
MapConv("power_on_state", "select", mi="2.p.2", map={0: "default", 1: "off", 2: "on"}),
MapConv("fault", "sensor", mi="2.p.3", map={0: "No Faults", 1: "Over Temperature", 2: "Overload", 3: "Overload And Overheat"}),
MathConv("power", "sensor", mi="3.p.6", round=1),
MathConv("power consumption", "sensor", mi="3.p.1"),
BaseConv("led", "switch", mi="4.p.1"),
],
}
] + DEVICES |
|