zigbee2mqtt/scripts/generateNewSupportedDevices.js

12 lines
435 B
JavaScript
Raw Normal View History

const fs = require('fs');
const filename = process.argv[2];
const text = fs.readFileSync(filename, 'utf8');
2019-11-09 12:38:47 -07:00
const zigbeeHerdsmanConverters = require('zigbee-herdsman-converters');
for (const line of text.split('\n')) {
2019-11-09 12:38:47 -07:00
const model = zigbeeHerdsmanConverters.devices.find((d) => d.model === line);
2022-03-01 08:50:26 -07:00
if (!model) throw new Error(`${line} does not exist`);
console.log(`- \`${line}\` ${model.vendor} ${model.description}`);
}