本帖最后由 fuxy1999 于 2022-10-7 13:45 编辑
给楼主个优化意见,可以给aqara的开关添加功率检测,实现每个开关所属用电器的功率监测。
{
# 智能插座 (国标)
'lumi.plug.v1': ["Xiaomi", "Plug", "ZNCZ02LM"],
# 智能插座 (国标)
'lumi.plug.aq1': ["Xiaomi", "Plug", ""],
# 智能插座T1 (国标)
'lumi.plug.macn01': ["Aqara", "Plug T1", ""],
# 智能墙壁插座 X1(USB版)
'lumi.plug.acn003': ["Aqara", "Smart Wall Outlet X1(USB)", ""],
# 智能墙壁插座 H1(USB版)
'lumi.plug.sacn03': ["Aqara", "Smart Wall Outlet H1(USB)", "QBCZWG11LM"],
# 智能墙壁插座 H1
'lumi.plug.sacn02': ["Aqara", "Smart Wall Outlet H1", "QBCZWG11LM"],
'params': [
{
"switch": {
MK_INIT_PARAMS: {
MK_HASS_NAME: "switch"
},
MK_RESOURCES: {
"toggle": ("4.1.85", "_attr_is_on"),
"power": ("0.12.85", "_attr_current_power_w"),
"energy": ("0.13.85", "_attr_today_energy_kwh"),
"zigbee_lqi": ("8.0.2007", "_attr_zigbee_lqi"),
}
}
}, {
"sensor": {
MK_INIT_PARAMS: {
MK_HASS_NAME: "power",
"device_class": DEVICE_CLASS_POWER,
"state_class": "measurement",
"unit_of_measurement": POWER_WATT},
MK_RESOURCES: {"power": ("0.12.85", "_attr_native_value")}
}
}, {
"sensor": {
MK_INIT_PARAMS: {
MK_HASS_NAME: "energy",
"device_class": DEVICE_CLASS_ENERGY,
"state_class": "total_increasing",
"unit_of_measurement": ENERGY_KILO_WATT_HOUR},
MK_RESOURCES: {"energy": ("0.13.85", "_attr_native_value")},
}
}
]
}
这是我的方法
|