Skip to content

Commit

Permalink
feat(add): MG-ZG01W, MG-ZG02W, MG-ZG03W (#5939)
Browse files Browse the repository at this point in the history
* Added support for 1 gang, 2 gang and 3 gang switchs

* updated the model number for the new 1 gang, 2 gang and 3 gang TuYa switches

* resolved the lint issues

* linter issues

* converted the legacy code based on feedback

* Update tuya.ts

* Fixed the issues identified in review

- Fixed code based on review comments

---------

Co-authored-by: Krishna Chytanya Koripella <krishna.koripella@dhhs.vic.gov.au>
  • Loading branch information
krishnachytanya and Krishna Chytanya Koripella authored Jul 7, 2023
1 parent ee9a7ab commit 9a375a9
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions src/devices/tuya.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1467,6 +1467,24 @@ const definitions: Definition[] = [
await reporting.bind(device.getEndpoint(1), coordinatorEndpoint, ['genOnOff']);
},
},
{
fingerprint: tuya.fingerprint('TS0601', ['_TZE200_gbagoilo']),
model: 'MG-ZG01W ',
vendor: 'TuYa',
description: '1 gang switch',
exposes: [e.switch().withEndpoint('l1').setAccess('state', ea.STATE_SET)],
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
configure: tuya.configureMagicPacket,
meta: {
tuyaDatapoints: [
[1, 'state', tuya.valueConverter.onOff],
],
},
endpoint: (device) => {
return {'l1': 1};
},
},
{
fingerprint: [
{modelID: 'TS0601', manufacturerName: '_TZE200_nkjintbl'},
Expand All @@ -1491,6 +1509,29 @@ const definitions: Definition[] = [
return {'l1': 1, 'l2': 1};
},
},
{
fingerprint: tuya.fingerprint('TS0601', ['_TZE200_nh9m9emk']),
model: 'MG-ZG02W',
vendor: 'TuYa',
description: '2 gang switch',
exposes: [
e.switch().withEndpoint('l1').setAccess('state', ea.STATE_SET),
e.switch().withEndpoint('l2').setAccess('state', ea.STATE_SET),
],
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
configure: tuya.configureMagicPacket,
meta: {
multiEndpoint: true,
tuyaDatapoints: [
[1, 'state_l1', tuya.valueConverter.onOff],
[2, 'state_l2', tuya.valueConverter.onOff],
],
},
endpoint: (device) => {
return {'l1': 1, 'l2': 1};
},
},
{
fingerprint: [{modelID: 'TS0601', manufacturerName: '_TZE200_kyfqmmyl'},
{modelID: 'TS0601', manufacturerName: '_TZE200_2hf7x9n3'},
Expand All @@ -1517,6 +1558,31 @@ const definitions: Definition[] = [
return {'l1': 1, 'l2': 1, 'l3': 1};
},
},
{
fingerprint: tuya.fingerprint('TS0601', ['_TZE200_go3tvswy']),
model: 'MG-ZG03W',
vendor: 'TuYa',
description: '3 gang switch',
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
configure: tuya.configureMagicPacket,
exposes: [
e.switch().withEndpoint('l1').setAccess('state', ea.STATE_SET),
e.switch().withEndpoint('l2').setAccess('state', ea.STATE_SET),
e.switch().withEndpoint('l3').setAccess('state', ea.STATE_SET),
],
meta: {
multiEndpoint: true,
tuyaDatapoints: [
[1, 'state_l1', tuya.valueConverter.onOff],
[2, 'state_l2', tuya.valueConverter.onOff],
[3, 'state_l3', tuya.valueConverter.onOff],
],
},
endpoint: (device) => {
return {'l1': 1, 'l2': 1, 'l3': 1};
},
},
{
fingerprint: tuya.fingerprint('TS0215A', ['_TZ3000_4fsgukof', '_TZ3000_wr2ucaj9', '_TZ3000_zsh6uat3', '_TZ3000_tj4pwzzm',
'_TZ3000_2izubafb', '_TZ3000_pkfazisv']),
Expand Down

0 comments on commit 9a375a9

Please sign in to comment.