Advertisement
bdnstn

mg-zg04w.mjs

Jun 12th, 2025
821
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // This converter is based on converters MG-ZG01W, MG-ZG02W, MG-ZG03W
  2. // for the one, two and three gang switches which work with those
  3. // switches from the same supplier.
  4. // I copied the fingerprint from Zigbee Model and Manufacturer
  5. // found by Z2M in unsupported device.
  6.  
  7. import * as tuya from 'zigbee-herdsman-converters/lib/tuya';
  8. const e = exposes.presets;
  9.  
  10. export default {
  11.     fingerprint: tuya.fingerprint('TS0601', ['_TZE204_mexisfik']),
  12.     model: 'MG-ZG04W',
  13.     vendor: 'TuYa',
  14.     description: '4 gang switch',
  15.     fromZigbee: [tuya.fz.datapoints],
  16.     toZigbee: [tuya.tz.datapoints],
  17.     configure: tuya.configureMagicPacket,
  18.     exposes: [
  19.         e.switch().withEndpoint('l1').setAccess('state', ea.STATE_SET),
  20.         e.switch().withEndpoint('l2').setAccess('state', ea.STATE_SET),
  21.         e.switch().withEndpoint('l3').setAccess('state', ea.STATE_SET),
  22.         e.switch().withEndpoint('l4').setAccess('state', ea.STATE_SET),
  23.     ],
  24.     meta: {
  25.         multiEndpoint: true,
  26.         tuyaDatapoints: [
  27.             [1, 'state_l1', tuya.valueConverter.onOff],
  28.             [2, 'state_l2', tuya.valueConverter.onOff],
  29.             [3, 'state_l3', tuya.valueConverter.onOff],
  30.             [4, 'state_l4', tuya.valueConverter.onOff],
  31.         ],
  32.     },
  33.     endpoint: (device) => {
  34.         return {'l1': 1, 'l2': 1, 'l3': 1, 'l4': 1};
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement