External Converter - Zigbee2MQTT
unknown
javascript
8 months ago
4.1 kB
12
Indexable
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 tuya = require('zigbee-herdsman-converters/lib/tuya');
const e = exposes.presets;
const ea = exposes.access;
const definition = {
fingerprint: [
{
modelID: 'TS0601',
manufacturerName: '_TZE200_0kihjsys',
},
],
model: 'TS0601_5gang_decoupler',
vendor: 'Tuya',
description: '5-gang smart decoupler switch with timer and restart settings',
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
onEvent: tuya.onEventSetTime,
configure: tuya.configureMagicPacket,
exposes: [
e.switch().withEndpoint('switch_1').withDescription('Switch 1'),
e.switch().withEndpoint('switch_2').withDescription('Switch 2'),
e.switch().withEndpoint('switch_3').withDescription('Switch 3'),
e.switch().withEndpoint('switch_4').withDescription('Switch 4'),
e.switch().withEndpoint('switch_5').withDescription('Switch 5'),
e.numeric('timer_1', ea.STATE_SET).withUnit('s').withDescription('Countdown timer for Switch 1'),
e.numeric('timer_2', ea.STATE_SET).withUnit('s').withDescription('Countdown timer for Switch 2'),
e.numeric('timer_3', ea.STATE_SET).withUnit('s').withDescription('Countdown timer for Switch 3'),
e.numeric('timer_4', ea.STATE_SET).withUnit('s').withDescription('Countdown timer for Switch 4'),
e.numeric('timer_5', ea.STATE_SET).withUnit('s').withDescription('Countdown timer for Switch 5'),
e.binary('restart_status', ea.STATE_SET, 'ON', 'OFF').withDescription('Overall restart status'),
e.enum('indicator_mode', ea.STATE_SET, ['off', 'on', 'previous']).withDescription('Indicator light mode (use "previous" for decoupling mode)'),
e.enum('restart_status_1', ea.STATE_SET, ['off', 'on', 'previous']).withDescription('Power on behavior for Switch 1'),
e.enum('restart_status_2', ea.STATE_SET, ['off', 'on', 'previous']).withDescription('Power on behavior for Switch 2'),
e.enum('restart_status_3', ea.STATE_SET, ['off', 'on', 'previous']).withDescription('Power on behavior for Switch 3'),
e.enum('restart_status_4', ea.STATE_SET, ['off', 'on', 'previous']).withDescription('Power on behavior for Switch 4'),
e.enum('restart_status_5', ea.STATE_SET, ['off', 'on', 'previous']).withDescription('Power on behavior for Switch 5'),
],
endpoint: (device) => {
return {
switch_1: 1,
switch_2: 1,
switch_3: 1,
switch_4: 1,
switch_5: 1,
};
},
meta: {
multiEndpoint: true,
tuyaDatapoints: [
[1, 'state_switch_1', tuya.valueConverter.onOff],
[2, 'state_switch_2', tuya.valueConverter.onOff],
[3, 'state_switch_3', tuya.valueConverter.onOff],
[4, 'state_switch_4', tuya.valueConverter.onOff],
[5, 'state_switch_5', tuya.valueConverter.onOff],
[7, 'timer_1', tuya.valueConverter.countdown],
[8, 'timer_2', tuya.valueConverter.countdown],
[9, 'timer_3', tuya.valueConverter.countdown],
[10, 'timer_4', tuya.valueConverter.countdown],
[11, 'timer_5', tuya.valueConverter.countdown],
[14, 'restart_status', tuya.valueConverter.onOff],
[15, 'indicator_mode', tuya.valueConverter.powerOnBehaviorEnum],
[29, 'restart_status_1', tuya.valueConverter.powerOnBehaviorEnum],
[30, 'restart_status_2', tuya.valueConverter.powerOnBehaviorEnum],
[31, 'restart_status_3', tuya.valueConverter.powerOnBehaviorEnum],
[32, 'restart_status_4', tuya.valueConverter.powerOnBehaviorEnum],
[33, 'restart_status_5', tuya.valueConverter.powerOnBehaviorEnum],
],
},
};
module.exports = definition;Editor is loading...
Leave a Comment