在device.js中添加下面这个
{
zigbeeModel: ['MINIONS123_TEMP'],
model: 'MINIONS123_TEMP',
vendor: 'MINIONS123',
description: 'TEMPERATURE ILLUMINANCE SENSOR',
supports: 'temperature,brightness',
fromZigbee: [fz.MINIONS123_temperature,fz.MINIONS123_humidity,fz.MINIONS123_illuminance],
},
在fromZigbee.js中添加下面这个
MINIONS123_temperature: {
cluster: 'msTemperatureMeasurement',
type: ['attributeReport', 'readResponse'],
convert: (model, msg, publish, options, meta) => {
const temperature = parseFloat(msg.data['measuredValue']) ;
return {temperature: precisionRound(temperature, 2)};
},
},
MINIONS123_humidity: {
cluster: 'msRelativeHumidity',
type: ['attributeReport', 'readResponse'],
convert: (model, msg, publish, options, meta) => {
const humidity = parseFloat(msg.data['measuredValue']);
if (humidity >= 0 && humidity <= 100) {
return {humidity: precisionRound(humidity, 2)};
}
},
},
MINIONS123_illuminance: {
cluster: 'msIlluminanceMeasurement',
type: ['attributeReport', 'readResponse'],
convert: (model, msg, publish, options, meta) => {
const illuminance = parseFloat(msg.data['measuredValue']);
return {illuminance: precisionRound(illuminance, 0)};
},
},
注意格式,要不然zigbee2mqtt不启动 |