本帖最后由 hyz_ha 于 2020-5-14 13:53 编辑
1.在devices.js里加入
{
zigbeeModel:['lumi.switch.l3acn3'],
model:'QBKG25LM',
vendor:'Xiaomi',
description:'Aqara D1 3 gang smart wall switch',
supports:'on/off',
fromZigbee:[fz.on_off,fz.QBKG25LM_click],
toZigbee:[tz.on_off],
meta:{multiEndpoint:true},
endpoint:(device) =>{
return{'left':1, 'center':2, 'right':3};
},
},
2.在fromzigbee.js里面加入
QBKG25LM_click: {
cluster: 'genMultistateInput',
type: ['attributeReport', 'readResponse'],
convert: (model, msg, publish, options, meta) => {
if ([1, 2].includes(msg.data.presentValue)) {
const mapping = {41: 'left', 42: 'center', 43: 'right'};
const times = {1: 'single', 2: 'double', 3: 'triple', 0: 'hold', 255: 'release'};
const button = mapping[msg.endpoint.ID];
return {click: `${button}_${times[msg.data.presentValue]}`};
}
},
},
3. |