Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/**
* This script generates a device page
*/
const utils = require('./utils');
const notes = require('./device_page_notes');
const YAML = require('json2yaml');
const HomeassistantExtension = require('zigbee2mqtt/lib/extension/homeassistant');
const homeassistant = new HomeassistantExtension(null, null, null, null);
const assert = require('assert');
const devices = require('zigbee2mqtt/node_modules/zigbee-herdsman-converters').devices;
function generate(device) {
// verify that all model and notModel exist;
for (const note of notes) {
const check = (attr) => {
if (note[attr]) {
if (typeof note[attr] === 'string') {
assert(devices.find((d) => d.model === note[attr]), note[attr]);
} else {
for (const m of note[attr]) {
assert(devices.find((d) => d.model === m), m);
}
}
}
};
/**
* This script generates the supported devices page.
*/
const devices = require('zigbee2mqtt/node_modules/zigbee-herdsman-converters').devices;
const utils = require('./utils');
function onlyUnique(value, index, self) {
return self.indexOf(value) === index;
}
const vendorsCount = devices.map((d) => d.vendor).filter(onlyUnique).length;
let template = `---
---
# Supported devices
<style type="text/css">
.main-content table {
table-layout: fixed;
display: table !important;</style>