mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-07-10 22:11:38 +00:00
32 lines
1.2 KiB
JavaScript
32 lines
1.2 KiB
JavaScript
/**
|
|
* This script generates the supported devices page.
|
|
* Run by executing: npm run docs
|
|
*/
|
|
|
|
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`);
|
|
}
|
|
});
|
|
|
|
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('')
|
|
console.log('| Model | Description | Picture |')
|
|
console.log('| ------------- | ------------- | -------------------------- |')
|
|
Object.values(deviceMapping).forEach((device) => {
|
|
console.log(`| ${device.model} | ${device.description} (${device.supports}) |  |`);
|
|
})
|
|
console.log('=============================')
|