mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-08-28 05:24:29 +00:00
Add home assistant MQTT discovery for missing devices. #9
This commit is contained in:
@@ -99,6 +99,7 @@ const devices = {
|
||||
vendor: 'Xiaomi',
|
||||
description: 'MiJia wireless switch',
|
||||
supports: 'single, double, triple, quadruple, many and long click',
|
||||
homeassistant: [homeassistant.sensor_button]
|
||||
},
|
||||
'lumi.sensor_switch.aq2': {
|
||||
model: 'WXKG11LM',
|
||||
@@ -119,6 +120,7 @@ const devices = {
|
||||
vendor: 'Xiaomi',
|
||||
description: 'MiJia temperature & humidity sensor ',
|
||||
supports: 'temperature and humidity',
|
||||
homeassistant: [homeassistant.sensor_temperature, homeassistant.sensor_humidity]
|
||||
},
|
||||
'lumi.weather': {
|
||||
model: 'WSDCGQ11LM',
|
||||
@@ -146,6 +148,7 @@ const devices = {
|
||||
vendor: 'Xiaomi',
|
||||
description: 'MiJia door & window contact sensor',
|
||||
supports: 'open and closed state',
|
||||
homeassistant: [homeassistant.binary_sensor_state]
|
||||
},
|
||||
'lumi.sensor_magnet.aq2': {
|
||||
model: 'MCCGQ11LM',
|
||||
|
||||
+11
-14
@@ -166,20 +166,17 @@ const homeassistantConfig = (device) => {
|
||||
}
|
||||
|
||||
Object.values(deviceMapping).forEach((device) => {
|
||||
if (device.homeassistant) {
|
||||
//console.log(device);
|
||||
text += `### ${device.model}\n`;
|
||||
text += '```yaml\n'
|
||||
|
||||
device.homeassistant.forEach((d, i) => {
|
||||
text += homeassistantConfig(d);
|
||||
if (device.homeassistant.length > 1 && i < device.homeassistant.length - 1) {
|
||||
text += '\n';
|
||||
}
|
||||
})
|
||||
|
||||
text += '```\n\n';
|
||||
}
|
||||
text += `### ${device.model}\n`;
|
||||
text += '```yaml\n'
|
||||
|
||||
device.homeassistant.forEach((d, i) => {
|
||||
text += homeassistantConfig(d);
|
||||
if (device.homeassistant.length > 1 && i < device.homeassistant.length - 1) {
|
||||
text += '\n';
|
||||
}
|
||||
})
|
||||
|
||||
text += '```\n\n';
|
||||
});
|
||||
|
||||
fs.writeFileSync(outputdir + '/' + file, text);
|
||||
|
||||
Reference in New Issue
Block a user