本帖最后由 Clark 于 2022-6-14 20:38 编辑
一个四开单火线开关,Z2M添加提示不支持。
商家发给我配置文件。
原先/config/zigbee2mqtt/configuration.yaml 配置如下:
external_converters: []
devices:
- devices.yaml
groups:
- groups.yaml
homeassistant: true
permit_join: false
mqtt:
base_topic: zigbee2mqtt
server: mqtt://core-mosquitto:1883
user: mqtt
password: mqtt
serial:
port: tcp://192.168.1.21:8888
adapter: ezsp
advanced:
log_level: warn
pan_id: 6754
channel: 11
network_key:
- 1
- 3
- 5
- 7
- 9
- 11
- 13
- 15
- 0
- 2
- 4
- 6
- 8
- 10
- 12
- 13
availability_blocklist: []
availability_passlist: []
device_options: {}
blocklist: []
passlist: []
queue: {}
frontend:
port: 8099
experimental: {}
availability: false
现在修改为:
data_path: /config/zigbee2mqtt
external_converters:
- freepad_ext.js
devices:
- devices.yaml
groups:
- groups.yaml
homeassistant: true
permit_join: false
mqtt:
base_topic: zigbee2mqtt
server: mqtt://core-mosquitto:1883
user: mqtt
password: mqtt
serial:
port: tcp://192.168.1.21:8888
adapter: ezsp
advanced:
log_level: debug
pan_id: 6754
channel: 11
network_key:
- 1
- 3
- 5
- 7
- 9
- 11
- 13
- 15
- 0
- 2
- 4
- 6
- 8
- 10
- 12
- 13
availability_blocklist: []
availability_passlist: []
device_options: {}
blocklist: []
passlist: []
queue: {}
frontend:
port: 8099
experimental: {}
availability: false
其中freepad_ext.js为测试文件,从官网下载地址如下: https://github.com/Koenkk/zigbee ... alConvertersExample
freepad_ext.js文件已经放入/config/zigbee2mqtt 这个目录下
这个配置重启Z2M后可以正常运行。
然后尝试将商家发给我的js文件放入/config/zigbee2mqtt目录下
data_path: /config/zigbee2mqtt
external_converters:
- freepad_ext.js
- TS0014.js
devices:
- devices.yaml
groups:
- groups.yaml
homeassistant: true
permit_join: false
mqtt:
base_topic: zigbee2mqtt
server: mqtt://core-mosquitto:1883
user: mqtt
password: mqtt
serial:
port: tcp://192.168.1.21:8888
adapter: ezsp
advanced:
log_level: debug
pan_id: 6754
channel: 11
network_key:
- 1
- 3
- 5
- 7
- 9
- 11
- 13
- 15
- 0
- 2
- 4
- 6
- 8
- 10
- 12
- 13
availability_blocklist: []
availability_passlist: []
device_options: {}
blocklist: []
passlist: []
queue: {}
frontend:
port: 8099
experimental: {}
availability: false
配置文件修改如上所示,这样就导致Z2M的web界面无法打开,报错 502: Bad Gateway
商家发给我的配置文件 ts0014.js 如下所示,我尝试将ts0014.js改成TS0014.js,还是会导致502错误。
const exposes = require('../lib/exposes');
const fz = {...require('../converters/fromZigbee'), legacy: require('../lib/legacy').fromZigbee};
const tz = require('../converters/toZigbee');
const ota = require('../lib/ota');
const tuya = require('../lib/tuya');
const reporting = require('../lib/reporting');
const extend = require('../lib/extend');
const e = exposes.presets;
const ea = exposes.access;
const libColor = require('../lib/color');
const utils = require('../lib/utils');
fingerprint: [{modelID: 'TS0014', manufacturerName: '_TZ3000_jr2atpww'}, {modelID: 'TS0014', manufacturerName: '_TYZB01_dvakyzhd'},
{modelID: 'TS0014', manufacturerName: '_TZ3210_w3hl6rao'}, {modelID: 'TS0014', manufacturerName: '_TYZB01_bagt1e4o'},
{modelID: 'TS0014', manufacturerName: '_TZ3000_r0pmi2p3'}, {modelID: 'TS0014', manufacturerName: '_TZ3000_fxjdcikv'},
{modelID: 'TS0014', manufacturerName: '_TZ3000_q6vxaod1'}],
model: 'TS0014',
vendor: 'TuYa',
description: 'Smart light switch - 4 gang without neutral wire',
extend: extend.switch(),
exposes: [e.switch().withEndpoint('l1'), e.switch().withEndpoint('l2'), e.switch().withEndpoint('l3'),
e.switch().withEndpoint('l4')],
endpoint: (device) => {
return {'l1': 1, 'l2': 2, 'l3': 3, 'l4': 4};
},
whiteLabel: [{vendor: 'TUYATEC', model: 'GDKES-04TZXD'}, {vendor: 'Vizo', model: 'VZ-222S'},
{vendor: 'MakeGood', model: 'MG-ZG04W/B/G'}, {vendor: 'Mercator Ikuü', model: 'SSW04'}],
meta: {multiEndpoint: true},
configure: async (device, coordinatorEndpoint, logger) => {
try {
for (const ID of [1, 2, 3, 4]) {
const endpoint = device.getEndpoint(ID);
await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff']);
}
} catch (e) {
// Fails for some: https://github.com/Koenkk/zigbee2mqtt/issues/4872
}
device.powerSource = 'Mains (single phase)';
device.save();
},
},
module.exports = definition;
|