找回密码
 立即注册

微信扫码登录

搜索
查看: 68|回复: 0

[经验分享] 狄耐克DNAKE设备接入zigbee2mqtt外部转换器JS

[复制链接]

1

主题

0

回帖

117

积分

注册会员

积分
117
金钱
116
HASS币
0
发表于 3 天前 | 显示全部楼层 |阅读模式
狄耐克DNAKE设备接入zigbee2mqtt外部转换器JS,自己摸索写出来的,有些功能报错,应该是窗帘位置信息获取问题,不影响使用。

接入只有开关设备,情景开关,窗帘三种设备,zigbee网关识别到设备名称后修改对应的js文件名和js里面的设备名,使用zigbee2mqtt版本是1.42.0,更新的版本js文件位置和支持的函数不一样,应该不能用,没有去研究。需要zigbee-herdsman-converters,文件较大附上下载链接
const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
// const extend = require('zigbee-herdsman-converters/lib/extend');
const e = exposes.presets;
const ea = exposes.access;

const definition = {
    zigbeeModel: ['HA-CTN-C30A'],
    model: 'HA-CTN-C30A',
    vendor: 'DNAKE',
    description: '智能窗帘开关',
        fromZigbee: [fz.cover_position_tilt],
        toZigbee: [tz.cover_state, tz.cover_position_tilt],
        exposes: [e.cover_position().withEndpoint('l1'), e.cover_position().withEndpoint('l2')],
        //extend: preset.switch(),
        meta: {configureKey: 1, coverInverted: true},
        configure: async (device, coordinatorEndpoint, logger) => {
            for (const ID of [1, 2]) {
            await reporting.bind(endpoint, coordinatorEndpoint, ['closuresWindowCovering']);
            //await reporting.currentPositionLiftPercentage(endpoint);
            }
        },
        endpoint: (device) => {
            return {'l1': 1, 'l2': 2};
        },
};

module.exports = definition;
const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
// const extend = require('zigbee-herdsman-converters/lib/extend');
const e = exposes.presets;
const ea = exposes.access;

const definition = {
    zigbeeModel: ['HA-LGT-C30A'],
    model: 'HA-LGT-C30A',
    vendor: 'DNAKE',
    description: '智能触摸开关',
    fromZigbee: [fz.on_off, fz.command_on, fz.command_off],
    toZigbee: [tz.on_off],
        exposes: [e.switch().withEndpoint('l1'), e.switch().withEndpoint('l2'), e.switch().withEndpoint('l3'), e.switch().withEndpoint('l4')],
        //extend: preset.switch(),
        meta: {configureKey: 1, multiEndpoint: true},
        configure: async (device, coordinatorEndpoint, logger) => {
            for (const ID of [1, 2, 3, 4]) {
                await reporting.bind(device.getEndpoint(ID), coordinatorEndpoint, ['genOnOff', 'genIdentify']);
            }
        },
        endpoint: (device) => {
            return {'l1': 1, 'l2': 2, 'l3': 3, 'l4': 4};
        },
};

module.exports = definition;
zigbee-herdsman-converters下载[url]https://pan.baidu.com/s/1TSil-RLo_P_ABuXMRrPDVg?pwd=gyse 提取码: gyse[/url]
屏幕截图 2025-08-13 115314.png

dnake外部转换器.rar

2.97 KB, 下载次数: 2

js文件

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian ( 晋ICP备17001384号-1 )

GMT+8, 2025-8-16 15:39 , Processed in 0.140461 second(s), 13 queries , MemCached On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表