Skip to content

Commit

Permalink
feat(add): ZS-TYG3-SM-61Z, ZS-TYG3-SM-21Z, ZS-TYG3-SM-31Z, ZS-TYG3-SM…
Browse files Browse the repository at this point in the history
…-41Z (#5935)

* Update terncy.ts

Added Terncy CL001 support

* Update terncy.ts

Fixed linting issues

* Update tuya.ts

added support for tuya G3 smart 4 gang switch with 2 scene controller

* Update tuya.ts

Changed model name

* Update tuya.ts

fix typo

* Update terncy.ts

* Update tuya.ts

Adds support for tuya 4gang + 2 scene switch with backlight.
Power on behavior is still WIP.
master_switch requires Koenkk/zigbee2mqtt#18157 to work

* Update tuya.ts

fixed linting errors

* Update tuya.ts

Moved _TZE200_wunufsil to an individual device with switch countdown timer, power on behavior, backlight control, and master switch functions.

* Update tuya.ts

Changed model name to reflect 2 gang control

* Update tuya.ts

_TZE200_0j5jma9b :
  fixed description
  fixed master switch
_TZE200_wunufsil:
  removed extra endpoints

* Update tuya.ts

Added TS0601_3gang switch with backlight

* Update tuya.ts

Fixed duplicate _TZE200_vhy3iakz (new code supports countdown, backlight mode, and main switch)  and changed some formatting

* Update tuya.ts

fix duplicates and format

* Update tuya.ts

Changed _TZE200_k6jhsr0q to support additional features

* Update tuya.ts

Update device names per request

* Update tuya.ts

Updated model names

* Update tuya.ts

Changed

* Update tuya.ts

Fixed power on behavior
Fixed backlightModeOffOn get

* Update tuya.ts

---------

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
  • Loading branch information
Qianli-Ma and Koenkk authored Jul 9, 2023
1 parent 34f1d2d commit fa5e2b9
Showing 1 changed file with 165 additions and 3 deletions.
168 changes: 165 additions & 3 deletions src/devices/tuya.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1340,8 +1340,6 @@ const definitions: Definition[] = [
{
zigbeeModel: ['qnazj70', 'kjintbl'],
fingerprint: [
{modelID: 'TS0601', manufacturerName: '_TZE200_wunufsil'},
{modelID: 'TS0601', manufacturerName: '_TZE200_vhy3iakz'},
{modelID: 'TS0601', manufacturerName: '_TZE200_oisqyl4o'},
{modelID: 'TS0601', manufacturerName: '_TZ3000_uim07oem'},
{modelID: 'TS0601', manufacturerName: '_TZE200_js3mgbjb'},
Expand Down Expand Up @@ -1375,7 +1373,7 @@ const definitions: Definition[] = [
},
},
{
fingerprint: tuya.fingerprint('TS0601', ['_TZE200_aqnazj70', '_TZE200_k6jhsr0q', '_TZE200_di3tfv5b', '_TZE200_mexisfik', '_TZE204_6wi2mope']),
fingerprint: tuya.fingerprint('TS0601', ['_TZE200_aqnazj70', '_TZE200_di3tfv5b', '_TZE200_mexisfik', '_TZE204_6wi2mope']),
model: 'TS0601_switch_4_gang',
vendor: 'TuYa',
description: '4 gang switch',
Expand Down Expand Up @@ -5145,6 +5143,170 @@ const definitions: Definition[] = [
],
},
},
{
fingerprint: [{modelID: 'TS0601', manufacturerName: '_TZE200_0j5jma9b'}],
model: 'ZS-TYG3-SM-61Z',
vendor: 'TuYa',
description: 'Smart switch (4 gang + 2 scene) with backlight and neutral wire',
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
configure: tuya.configureMagicPacket,
exposes: [
tuya.exposes.switch().withDescription('All Switches'),
tuya.exposes.switch().withEndpoint('l1'),
tuya.exposes.switch().withEndpoint('l2'),
tuya.exposes.switch().withEndpoint('l3'),
tuya.exposes.switch().withEndpoint('l4'),
tuya.exposes.switch().withEndpoint('l5'),
tuya.exposes.switch().withEndpoint('l6'),
tuya.exposes.backlightModeOffOn().withAccess(ea.STATE_SET),
tuya.exposes.countdown().withEndpoint('l1'),
tuya.exposes.countdown().withEndpoint('l2'),
tuya.exposes.countdown().withEndpoint('l3'),
tuya.exposes.countdown().withEndpoint('l4'),
tuya.exposes.countdown().withEndpoint('l5'),
tuya.exposes.countdown().withEndpoint('l6'),
e.power_on_behavior().withAccess(ea.STATE_SET),
],
onEvent: tuya.onEventSetTime,
endpoint: (device) => {
return {'l1': 1, 'l2': 1, 'l3': 1, 'l4': 1, 'l5': 1, 'l6': 1, 'state': 1, 'backlight': 1};
},
meta: {
multiEndpoint: true,
tuyaDatapoints: [
[1, 'state_l1', tuya.valueConverter.onOff],
[2, 'state_l2', tuya.valueConverter.onOff],
[3, 'state_l3', tuya.valueConverter.onOff],
[4, 'state_l4', tuya.valueConverter.onOff],
[5, 'state_l5', tuya.valueConverter.onOff],
[6, 'state_l6', tuya.valueConverter.onOff],
[7, 'countdown_l1', tuya.valueConverter.countdown],
[8, 'countdown_l2', tuya.valueConverter.countdown],
[9, 'countdown_l3', tuya.valueConverter.countdown],
[10, 'countdown_l4', tuya.valueConverter.countdown],
[11, 'countdown_l5', tuya.valueConverter.countdown],
[12, 'countdown_l6', tuya.valueConverter.countdown],
[13, 'state', tuya.valueConverter.onOff],
[14, 'power_on_behavior', tuya.valueConverterBasic.lookup({'off': tuya.enum(0), 'on': tuya.enum(1), 'previous': tuya.enum(2)})],
[16, 'backlight_mode', tuya.valueConverter.onOff],
],
},
},
{
fingerprint: [{modelID: 'TS0601', manufacturerName: '_TZE200_wunufsil'}],
model: 'ZS-TYG3-SM-21Z',
vendor: 'TuYa',
description: '2 gang smart switch with backlight and neutral wire',
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
configure: tuya.configureMagicPacket,
exposes: [
tuya.exposes.switch().withDescription('All Switches'),
tuya.exposes.switch().withEndpoint('l1'),
tuya.exposes.switch().withEndpoint('l2'),
tuya.exposes.backlightModeOffOn().withAccess(ea.STATE_SET),
tuya.exposes.countdown().withEndpoint('l1'),
tuya.exposes.countdown().withEndpoint('l2'),
e.power_on_behavior().withAccess(ea.STATE_SET),
],
onEvent: tuya.onEventSetTime,
endpoint: (device) => {
return {'l1': 1, 'l2': 1, 'state': 1, 'backlight': 1};
},
meta: {
multiEndpoint: true,
tuyaDatapoints: [
[1, 'state_l1', tuya.valueConverter.onOff],
[2, 'state_l2', tuya.valueConverter.onOff],
[7, 'countdown_l1', tuya.valueConverter.countdown],
[8, 'countdown_l2', tuya.valueConverter.countdown],
[13, 'state', tuya.valueConverter.onOff],
[14, 'power_on_behavior', tuya.valueConverterBasic.lookup({'off': tuya.enum(0), 'on': tuya.enum(1), 'previous': tuya.enum(2)})],
[16, 'backlight_mode', tuya.valueConverter.onOff],
],
},
},
{
fingerprint: [{modelID: 'TS0601', manufacturerName: '_TZE200_vhy3iakz'}],
model: 'ZS-TYG3-SM-31Z',
vendor: 'TuYa',
description: '3 gang smart switch with backlight and neutral wire',
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
configure: tuya.configureMagicPacket,
exposes: [
tuya.exposes.switch().withDescription('All Switches'),
tuya.exposes.switch().withEndpoint('l1'),
tuya.exposes.switch().withEndpoint('l2'),
tuya.exposes.switch().withEndpoint('l3'),
tuya.exposes.backlightModeOffOn().withAccess(ea.STATE_SET),
tuya.exposes.countdown().withEndpoint('l1'),
tuya.exposes.countdown().withEndpoint('l2'),
tuya.exposes.countdown().withEndpoint('l3'),
e.power_on_behavior(['off', 'on', 'previous']).withAccess(ea.STATE_SET),
],
onEvent: tuya.onEventSetTime,
endpoint: (device) => {
return {'l1': 1, 'l2': 1, 'l3': 1, 'state': 1, 'backlight': 1};
},
meta: {
multiEndpoint: true,
tuyaDatapoints: [
[1, 'state_l1', tuya.valueConverter.onOff],
[2, 'state_l2', tuya.valueConverter.onOff],
[3, 'state_l3', tuya.valueConverter.onOff],
[7, 'countdown_l1', tuya.valueConverter.countdown],
[8, 'countdown_l2', tuya.valueConverter.countdown],
[9, 'countdown_l3', tuya.valueConverter.countdown],
[13, 'state', tuya.valueConverter.onOff],
[14, 'power_on_behavior', tuya.valueConverterBasic.lookup({'off': tuya.enum(0), 'on': tuya.enum(1), 'previous': tuya.enum(2)})],
[16, 'backlight_mode', tuya.valueConverter.onOff],
],
},
},
{
fingerprint: [{modelID: 'TS0601', manufacturerName: '_TZE200_k6jhsr0q'}],
model: 'ZS-TYG3-SM-41Z',
vendor: 'TuYa',
description: '4 gang smart switch with backlight and neutral wire',
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
configure: tuya.configureMagicPacket,
exposes: [
tuya.exposes.switch().withDescription('All Switches'),
tuya.exposes.switch().withEndpoint('l1'),
tuya.exposes.switch().withEndpoint('l2'),
tuya.exposes.switch().withEndpoint('l3'),
tuya.exposes.switch().withEndpoint('l4'),
tuya.exposes.backlightModeOffOn().withAccess(ea.STATE_SET),
tuya.exposes.countdown().withEndpoint('l1'),
tuya.exposes.countdown().withEndpoint('l2'),
tuya.exposes.countdown().withEndpoint('l3'),
tuya.exposes.countdown().withEndpoint('l4'),
e.power_on_behavior(['off', 'on', 'previous']).withAccess(ea.STATE_SET),
],
onEvent: tuya.onEventSetTime,
endpoint: (device) => {
return {'l1': 1, 'l2': 1, 'l3': 1, 'l4': 1, 'state': 1, 'backlight': 1};
},
meta: {
multiEndpoint: true,
tuyaDatapoints: [
[1, 'state_l1', tuya.valueConverter.onOff],
[2, 'state_l2', tuya.valueConverter.onOff],
[3, 'state_l3', tuya.valueConverter.onOff],
[4, 'state_l4', tuya.valueConverter.onOff],
[7, 'countdown_l1', tuya.valueConverter.countdown],
[8, 'countdown_l2', tuya.valueConverter.countdown],
[9, 'countdown_l3', tuya.valueConverter.countdown],
[10, 'countdown_l4', tuya.valueConverter.countdown],
[13, 'state', tuya.valueConverter.onOff],
[14, 'power_on_behavior', tuya.valueConverterBasic.lookup({'off': tuya.enum(0), 'on': tuya.enum(1), 'previous': tuya.enum(2)})],
[16, 'backlight_mode', tuya.valueConverter.onOff],
],
},
},
];

module.exports = definitions;

0 comments on commit fa5e2b9

Please sign in to comment.