diff --git a/lib/devices.js b/lib/devices.js index 12a4cde..21c525f 100644 --- a/lib/devices.js +++ b/lib/devices.js @@ -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', diff --git a/support/docgen.js b/support/docgen.js index e17dd39..bc350d4 100644 --- a/support/docgen.js +++ b/support/docgen.js @@ -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);