How to use the zigbee2mqtt/node_modules/zigbee-herdsman-converters.devices function in zigbee2mqtt

To help you get started, we’ve selected a few zigbee2mqtt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Koenkk / zigbee2mqtt.io / docgen / device_page.js View on Github external
/**
 * 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);
                    }
                }
            }
        };
github Koenkk / zigbee2mqtt.io / docgen / supported-devices.js View on Github external
/**
 * 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>