zigbee2mqtt/support/docgen.js

134 lines
3.7 KiB
JavaScript
Raw Normal View History

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: '-',
2018-04-18 09:25:40 -07:00
vendor: 'Xiaomi',
2018-04-13 10:00:17 -07:00
},
{
model: 'WSDCGQ11LM',
description: 'Aqara temperature & humidity sensor',
supports: '-',
2018-04-18 09:25:40 -07:00
vendor: 'Xiaomi',
2018-04-13 10:00:17 -07:00
},
{
model: 'MCCGQ11LM',
description: 'Aqara door & window contact sensor',
supports: '-',
2018-04-18 09:25:40 -07:00
vendor: 'Xiaomi',
2018-04-13 10:00:17 -07:00
},
{
model: 'RTCGQ11LM',
description: 'Aqara human body movement and illuminance sensor',
supports: '-',
2018-04-18 09:25:40 -07:00
vendor: 'Xiaomi',
2018-04-13 10:00:17 -07:00
},
{
model: 'SJCGQ11LM',
description: 'Aqara water leak sensor',
supports: '-',
2018-04-18 09:25:40 -07:00
vendor: 'Xiaomi',
2018-04-13 10:00:17 -07:00
},
{
model: 'MFKZQ01LM',
description: 'Mi magic cube controller',
supports: '-',
2018-04-18 09:25:40 -07:00
vendor: 'Xiaomi',
2018-04-13 10:00:17 -07:00
},
{
model: 'WXKG03LM',
description: 'Aqara single key wireless wall switch',
supports: '-',
2018-04-18 09:25:40 -07:00
vendor: 'Xiaomi',
2018-04-13 10:00:17 -07:00
},
{
model: 'WXKG02LM',
description: 'Aqara double key wireless wall switch',
supports: '-',
2018-04-18 09:25:40 -07:00
vendor: 'Xiaomi',
2018-04-13 10:00:17 -07:00
},
{
model: 'QBKG11LM',
description: 'Aqara single key wired wall switch',
supports: '-',
2018-04-18 09:25:40 -07:00
vendor: 'Xiaomi',
2018-04-13 10:00:17 -07:00
},
{
model: 'QBKG03LM',
description: 'Aqara double key wired wall switch',
supports: '-',
2018-04-18 09:25:40 -07:00
vendor: 'Xiaomi',
2018-04-13 10:00:17 -07:00
},
{
model: 'ZNCZ02LM',
description: 'Mi power plug ZigBee',
supports: '-',
2018-04-18 09:25:40 -07:00
vendor: 'Xiaomi',
2018-04-13 10:00:17 -07:00
},
{
model: 'QBCZ11LM',
description: 'Aqara wall socket',
supports: '-',
2018-04-18 09:25:40 -07:00
vendor: 'Xiaomi',
2018-04-13 10:00:17 -07:00
},
{
model: 'JTYJ-GD-01LM/BW',
description: 'MiJia Honeywell smoke detector',
supports: '-',
2018-04-18 09:25:40 -07:00
vendor: 'Xiaomi',
2018-04-13 10:00:17 -07:00
},
{
model: 'KTBL01LM',
description: 'Aqara air conditioning companion',
supports: '-',
2018-04-18 09:25:40 -07:00
vendor: 'Xiaomi',
2018-04-13 10:00:17 -07:00
},
{
model: 'KTBL02LM',
description: 'Aqara air conditioning companion 2',
supports: '-',
2018-04-18 09:25:40 -07:00
vendor: 'Xiaomi',
2018-04-13 10:00:17 -07:00
},
];
2018-04-18 09:25:40 -07:00
const zigbee2mqtt = require('../lib/converters/zigbee2mqtt');
const deviceMapping = require('../lib/devices');
2018-04-11 11:54:22 -07:00
// Sanity check if all supported devices are in deviceMapping
const supportedDevices = new Set();
2018-04-18 09:25:40 -07:00
zigbee2mqtt.forEach((p) => supportedDevices.add(...p.devices));
2018-04-11 11:54:22 -07:00
// 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-18 09:25:40 -07:00
console.log(`| ${device.model} | ${device.vendor} ${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('=============================')
2018-04-18 09:25:40 -07:00
console.log('*NOTE: Automatically generated by `npm run docgen`*')
2018-04-11 11:54:22 -07:00
console.log('')
2018-04-18 09:25:40 -07:00
console.log('In case your device is **NOT** listed here, please create an issue at: https://github.com/Koenkk/zigbee2mqtt/issues');
2018-04-11 11:54:22 -07:00
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('=============================')