Add home assistant MQTT discovery for missing devices. #9

This commit is contained in:
Koen Kanters
2018-04-21 23:05:53 +02:00
parent f584b5dcca
commit 8109bf68e7
2 changed files with 14 additions and 14 deletions
+3
View File
@@ -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
View File
@@ -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);