2018-04-11 11:54:22 -07:00
|
|
|
/**
|
|
|
|
* This script generates the supported devices page.
|
|
|
|
* Run by executing: npm run docs
|
|
|
|
*/
|
|
|
|
|
2018-04-13 10:00:17 -07:00
|
|
|
const plannedToSupport = [
|
|
|
|
{
|
|
|
|
model: 'WXKG11LM',
|
|
|
|
description: 'Aqara wireless switch',
|
|
|
|
supports: '-',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
model: 'WSDCGQ11LM',
|
|
|
|
description: 'Aqara temperature & humidity sensor',
|
|
|
|
supports: '-',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
model: 'MCCGQ11LM',
|
|
|
|
description: 'Aqara door & window contact sensor',
|
|
|
|
supports: '-',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
model: 'RTCGQ11LM',
|
|
|
|
description: 'Aqara human body movement and illuminance sensor',
|
|
|
|
supports: '-',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
model: 'SJCGQ11LM',
|
|
|
|
description: 'Aqara water leak sensor',
|
|
|
|
supports: '-',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
model: 'MFKZQ01LM',
|
|
|
|
description: 'Mi magic cube controller',
|
|
|
|
supports: '-',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
model: 'WXKG03LM',
|
|
|
|
description: 'Aqara single key wireless wall switch',
|
|
|
|
supports: '-',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
model: 'WXKG02LM',
|
|
|
|
description: 'Aqara double key wireless wall switch',
|
|
|
|
supports: '-',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
model: 'QBKG11LM',
|
|
|
|
description: 'Aqara single key wired wall switch',
|
|
|
|
supports: '-',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
model: 'QBKG03LM',
|
|
|
|
description: 'Aqara double key wired wall switch',
|
|
|
|
supports: '-',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
model: 'ZNCZ02LM',
|
|
|
|
description: 'Mi power plug ZigBee',
|
|
|
|
supports: '-',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
model: 'QBCZ11LM',
|
|
|
|
description: 'Aqara wall socket',
|
|
|
|
supports: '-',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
model: 'JTYJ-GD-01LM/BW',
|
|
|
|
description: 'MiJia Honeywell smoke detector',
|
|
|
|
supports: '-',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
model: 'KTBL01LM',
|
|
|
|
description: 'Aqara air conditioning companion',
|
|
|
|
supports: '-',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
model: 'KTBL02LM',
|
|
|
|
description: 'Aqara air conditioning companion 2',
|
|
|
|
supports: '-',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2018-04-11 11:54:22 -07:00
|
|
|
const parsers = require('./parsers');
|
|
|
|
const deviceMapping = require('./devices');
|
|
|
|
|
|
|
|
// Sanity check if all supported devices are in deviceMapping
|
|
|
|
const supportedDevices = new Set();
|
|
|
|
parsers.forEach((p) => supportedDevices.add(...p.devices));
|
|
|
|
|
|
|
|
// Check if in deviceMapping.
|
|
|
|
supportedDevices.forEach((s) => {
|
|
|
|
if (!Object.values(deviceMapping).find((d) => d.model === s)) {
|
|
|
|
console.log(`ERROR: ${s} not in deviceMapping`);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-04-13 10:00:17 -07:00
|
|
|
const logDevices = (devices) => {
|
|
|
|
console.log('| Model | Description | Picture |')
|
|
|
|
console.log('| ------------- | ------------- | -------------------------- |')
|
|
|
|
devices.forEach((device) => {
|
2018-04-13 10:29:17 -07:00
|
|
|
console.log(`| ${device.model} | ${device.description} (${device.supports}) | ![${device.model}](images/devices/${device.model.replace('/', '-')}.jpg) |`);
|
2018-04-13 10:00:17 -07:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-04-11 11:54:22 -07:00
|
|
|
console.log('GENERATED')
|
|
|
|
console.log('=============================')
|
|
|
|
console.log('*NOTE: Automatically generated by `npm run docs`*')
|
|
|
|
console.log('')
|
|
|
|
console.log('In case your device is **NOT** listed here, please create an issue at: https://github.com/Koenkk/xiaomi-zb2mqtt/issues');
|
|
|
|
console.log('')
|
2018-04-13 10:00:17 -07:00
|
|
|
logDevices(Object.values(deviceMapping));
|
|
|
|
console.log('');
|
|
|
|
console.log('### Planned to support');
|
|
|
|
console.log('Devices listed below are **NOT** supported but are planned to be.');
|
|
|
|
console.log('')
|
|
|
|
logDevices(plannedToSupport);
|
2018-04-11 11:54:22 -07:00
|
|
|
console.log('=============================')
|