How to use the zigbee-herdsman-converters.toZigbeeConverters function in zigbee-herdsman-converters

To help you get started, we’ve selected a few zigbee-herdsman-converters 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 / lib / extension / entityPublish.js View on Github external
const settings = require('../util/settings');
const zigbeeHerdsmanConverters = require('zigbee-herdsman-converters');
const logger = require('../util/logger');
const utils = require('../util/utils');
const assert = require('assert');
const BaseExtension = require('./baseExtension');

const postfixes = utils.getPostfixes();
const topicRegex = new RegExp(`^(.+?)(?:/(${postfixes.join('|')}))?/(get|set)(?:/(.+))?`);

const groupConverters = [
    zigbeeHerdsmanConverters.toZigbeeConverters.light_onoff_brightness,
    zigbeeHerdsmanConverters.toZigbeeConverters.light_colortemp,
    zigbeeHerdsmanConverters.toZigbeeConverters.light_color,
    zigbeeHerdsmanConverters.toZigbeeConverters.light_alert,
    zigbeeHerdsmanConverters.toZigbeeConverters.ignore_transition,
];

class EntityPublish extends BaseExtension {
    onMQTTConnected() {
        // Subscribe to topics.
        const baseTopic = settings.get().mqtt.base_topic;
        for (let step = 1; step < 20; step++) {
            const topic = `${baseTopic}/${'+/'.repeat(step)}`;
            this.mqtt.subscribe(`${topic}set`);
            this.mqtt.subscribe(`${topic}set/+`);
            this.mqtt.subscribe(`${topic}get`);
            this.mqtt.subscribe(`${topic}get/+`);
        }
github Koenkk / zigbee2mqtt / lib / extension / entityPublish.js View on Github external
const settings = require('../util/settings');
const zigbeeHerdsmanConverters = require('zigbee-herdsman-converters');
const logger = require('../util/logger');
const utils = require('../util/utils');
const assert = require('assert');
const BaseExtension = require('./baseExtension');

const postfixes = utils.getPostfixes();
const topicRegex = new RegExp(`^(.+?)(?:/(${postfixes.join('|')}))?/(get|set)(?:/(.+))?`);

const groupConverters = [
    zigbeeHerdsmanConverters.toZigbeeConverters.light_onoff_brightness,
    zigbeeHerdsmanConverters.toZigbeeConverters.light_colortemp,
    zigbeeHerdsmanConverters.toZigbeeConverters.light_color,
    zigbeeHerdsmanConverters.toZigbeeConverters.light_alert,
    zigbeeHerdsmanConverters.toZigbeeConverters.ignore_transition,
];

class EntityPublish extends BaseExtension {
    onMQTTConnected() {
        // Subscribe to topics.
        const baseTopic = settings.get().mqtt.base_topic;
        for (let step = 1; step < 20; step++) {
            const topic = `${baseTopic}/${'+/'.repeat(step)}`;
            this.mqtt.subscribe(`${topic}set`);
            this.mqtt.subscribe(`${topic}set/+`);
            this.mqtt.subscribe(`${topic}get`);
            this.mqtt.subscribe(`${topic}get/+`);
github hobbyquaker / node-red-contrib-zigbee / nodes / converter.js View on Github external
if (!shepherdNode) {
                this.error('missing herdsman');
                return;
            }

            this.models = new Map();
            this.herdsman = shepherdNode.herdsman;
            this.ieeeAddresses = {};
            this.names = {};

            const groupConverters = [
                herdsmanConverters.toZigbeeConverters.light_onoff_brightness,
                herdsmanConverters.toZigbeeConverters.light_colortemp,
                herdsmanConverters.toZigbeeConverters.light_color,
                herdsmanConverters.toZigbeeConverters.light_alert,
                herdsmanConverters.toZigbeeConverters.ignore_transition
            ];

            const getDevices = () => {
                this.debug('getDevices');
                const devices = this.herdsman.getDevices();
                devices.forEach(device => {
                    this.ieeeAddresses[device.ieeeAddr] = device;
                    this.names[device.meta.name] = device;
                });
                this.groups = this.herdsman.getGroups();
                this.gotDevices = true;
            };

            const readyHandler = () => {
                this.debug('readyHandler');
                if (!this.gotDevices) {
github hobbyquaker / node-red-contrib-zigbee / nodes / converter.js View on Github external
RED.nodes.createNode(this, config);

            const shepherdNode = RED.nodes.getNode(config.shepherd);

            if (!shepherdNode) {
                this.error('missing herdsman');
                return;
            }

            this.models = new Map();
            this.herdsman = shepherdNode.herdsman;
            this.ieeeAddresses = {};
            this.names = {};

            const groupConverters = [
                herdsmanConverters.toZigbeeConverters.light_onoff_brightness,
                herdsmanConverters.toZigbeeConverters.light_colortemp,
                herdsmanConverters.toZigbeeConverters.light_color,
                herdsmanConverters.toZigbeeConverters.light_alert,
                herdsmanConverters.toZigbeeConverters.ignore_transition
            ];

            const getDevices = () => {
                this.debug('getDevices');
                const devices = this.herdsman.getDevices();
                devices.forEach(device => {
                    this.ieeeAddresses[device.ieeeAddr] = device;
                    this.names[device.meta.name] = device;
                });
                this.groups = this.herdsman.getGroups();
                this.gotDevices = true;
            };

zigbee-herdsman-converters

Collection of device converters to be used with zigbee-herdsman

MIT
Latest version published 22 hours ago

Package Health Score

81 / 100
Full package analysis