『瀚思彼岸』» 智能家居技术论坛

标题: zigbee2mqtt接anthouse配置文件 [打印本页]

作者: fenny96    时间: 2024-12-13 00:21
标题: zigbee2mqtt接anthouse配置文件
本帖最后由 fenny96 于 2024-12-13 00:24 编辑

入坑不久,但是入坑很深,是我日日夜夜(只有夜,白天要上班)翻源码,试方法一个一个试出来,可能不完美但是应该能满足日常使用。不管怎么样,如果帮到你了,请对我说声谢谢,本人小区是武汉的,本小区的可以联系我一起交流

先来一个单路通断器的js文件
  1. const tuya = require('zigbee-herdsman-converters/lib/tuya');
  2. const exposes = require('zigbee-herdsman-converters/lib/exposes');
  3. const e = exposes.presets;
  4. const reporting = require('zigbee-herdsman-converters/lib/reporting');

  5. const definition = {
  6.     fingerprint: [
  7.         {modelID: 'LightPanel1_ZM211-TLW', manufacturerName: 'anthouse'},
  8.     ],
  9.     model: 'LightPanel1_ZM211-TLW',
  10.     vendor: 'anthouse',
  11.     description: '1 gang switch',
  12.     whiteLabel: [{vendor: 'Larkkey', model: 'PS580'}],
  13.     extend: [tuya.modernExtend.tuyaOnOff()],
  14.     meta: {disableDefaultResponse: true},
  15.     configure: async (device, coordinatorEndpoint) => {
  16.         await tuya.configureMagicPacket(device, coordinatorEndpoint);
  17.         const endpoint = device.getEndpoint(1);
  18.         await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff']);
  19.         await reporting.onOff(endpoint);
  20.     },
  21.    
  22. };

  23. module.exports = definition;
复制代码
同时感谢https://bbs.hassbian.com/thread-26642-1-1.html这篇文章的作者,偶然看到他帖子说用涂鸦网关接入过这个品牌的电机,一下子思路就打开了。一头扎到tuya的js文件中,然后就解决了

其他东西我成功接入后都会发上来

作者: wbdownn    时间: 2024-12-13 17:24
写代码的都是高手,我也有一个zigbee,不会接
作者: fenny96    时间: 2024-12-15 23:18
双路通断器
  1. onst tuya = require('zigbee-herdsman-converters/lib/tuya');
  2. const exposes = require('zigbee-herdsman-converters/lib/exposes');
  3. const e = exposes.presets;
  4. const reporting = require('zigbee-herdsman-converters/lib/reporting');

  5. const definition = {
  6.     fingerprint: [
  7.         {modelID: 'LightPanel2_ZM221-TLW', manufacturerName: 'anthouse'},
  8.     ],
  9.     model: 'LightPanel2_ZM221-TLW',
  10.     vendor: 'anthouse',
  11.     description: '2 gang switch',
  12.     whiteLabel: [{vendor: 'Larkkey', model: 'PS580'}],
  13.     extend: [tuya.modernExtend.tuyaOnOff()],
  14.     exposes: [e.switch().withEndpoint('l1'), e.switch().withEndpoint('l2')],
  15.     endpoint: (device) => {
  16.         return {l1: 1, l2: 2};
  17.     },
  18.     meta: {multiEndpoint: true, disableDefaultResponse: true},
  19.     configure: async (device, coordinatorEndpoint) => {
  20.         await tuya.configureMagicPacket(device, coordinatorEndpoint);
  21.         const endpoint = device.getEndpoint(1);
  22.         await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff']);
  23.         await reporting.onOff(endpoint);
  24.         const endpoint2 = device.getEndpoint(2);
  25.         await reporting.bind(endpoint2, coordinatorEndpoint, ['genOnOff']);
  26.         await reporting.onOff(endpoint2);
  27.     },

  28. };

  29. module.exports = definition;
复制代码

作者: fenny96    时间: 2024-12-15 23:25
三路通断器
  1. const tuya = require('zigbee-herdsman-converters/lib/tuya');
  2. const exposes = require('zigbee-herdsman-converters/lib/exposes');
  3. const e = exposes.presets;
  4. const reporting = require('zigbee-herdsman-converters/lib/reporting');

  5. const definition = {
  6.     fingerprint: [
  7.         {modelID: 'LightPanel3_ZM231-TLW', manufacturerName: 'anthouse'},
  8.     ],
  9.     model: 'LightPanel3_ZM231-TLW',
  10.     vendor: 'anthouse',
  11.     description: '3 gang switch',
  12.     whiteLabel: [{vendor: 'Larkkey', model: 'PS580'}],
  13.     extend: [tuya.modernExtend.tuyaOnOff()],
  14.     exposes: [e.switch().withEndpoint('l1'), e.switch().withEndpoint('l2'), e.switch().withEndpoint('l3')],
  15.     endpoint: (device) => {
  16.         return {l1: 1, l2: 2, l3: 3};
  17.     },
  18.     meta: {multiEndpoint: true, disableDefaultResponse: true},
  19.     configure: async (device, coordinatorEndpoint) => {
  20.         await tuya.configureMagicPacket(device, coordinatorEndpoint);
  21.         const endpoint = device.getEndpoint(1);
  22.         await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff']);
  23.         await reporting.onOff(endpoint);
  24.         const endpoint2 = device.getEndpoint(2);
  25.         await reporting.bind(endpoint2, coordinatorEndpoint, ['genOnOff']);
  26.         await reporting.onOff(endpoint2);
  27.         const endpoint3 = device.getEndpoint(3);
  28.         await reporting.bind(endpoint3, coordinatorEndpoint, ['genOnOff']);
  29.         await reporting.onOff(endpoint3);
  30.     },

  31. };

  32. module.exports = definition;
复制代码

作者: fenny96    时间: 2024-12-15 23:27
窗帘电机,有点小瑕疵,使用完全没问题
  1. const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
  2. const tz = require('zigbee-herdsman-converters/converters/toZigbee');
  3. const exposes = require('zigbee-herdsman-converters/lib/exposes');
  4. const reporting = require('zigbee-herdsman-converters/lib/reporting');
  5. const modernExtend = require('zigbee-herdsman-converters/lib/modernExtend');
  6. const e = exposes.presets;
  7. const ea = exposes.access;
  8. const tuya = require('zigbee-herdsman-converters/lib/tuya');

  9. const definition = {
  10.     fingerprint: [{modelID: 'Curtain_ZC004_TLW', manufacturerName: 'anthouse'}],
  11.     model: 'MS-108ZR',
  12.     vendor: 'Moes',
  13.     description: 'Zigbee + RF curtain switch module',
  14.     meta: {coverInverted: true},
  15.     whiteLabel: [tuya.whitelabel('QA', 'QACZ1', 'Curtain switch', ['_TZ3210_xbpt8ewc'])],
  16.     fromZigbee: [fz.tuya_cover_options, fz.cover_position_tilt],
  17.     toZigbee: [tz.cover_state, tz.moes_cover_calibration, tz.cover_position_tilt, tz.tuya_cover_reversal],
  18.     exposes: [
  19.         e.cover_position(),
  20.         e.numeric('calibration_time', ea.ALL).withValueMin(0).withValueMax(100),
  21.         e.enum('moving', ea.STATE, ['UP', 'STOP', 'DOWN']),
  22.         e.binary('motor_reversal', ea.ALL, 'ON', 'OFF'),
  23.     ],
  24. };

  25. module.exports = definition;
复制代码

作者: fenny96    时间: 2024-12-16 00:24
wbdownn 发表于 2024-12-13 17:24
写代码的都是高手,我也有一个zigbee,不会接

找类似设备直接抄,基本能搞定
作者: ramy    时间: 2024-12-30 10:29
楼主可以加个联系方式吗,家里也是anthouse,说的开发商跑了,现在想把这东西用小爱同学控制
作者: fenny96    时间: 2025-1-21 12:22
ramy 发表于 2024-12-30 10:29
楼主可以加个联系方式吗,家里也是anthouse,说的开发商跑了,现在想把这东西用小爱同学控制 ...

WeChat:a194201800




欢迎光临 『瀚思彼岸』» 智能家居技术论坛 (https://bbs.hassbian.com/) Powered by Discuz! X3.5