Advertisement
MiAutomations

ZN2SRS3EDH.js

Apr 8th, 2024
518
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 3.46 KB | Software | 0 0
  1. const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
  2. const tz = require('zigbee-herdsman-converters/converters/toZigbee');
  3. const exposes = require('zigbee-herdsman-converters/lib/exposes');
  4. const reporting = require('zigbee-herdsman-converters/lib/reporting');
  5. const e = exposes.presets;
  6. const ea = exposes.access;
  7. const tuya = require('zigbee-herdsman-converters/lib/tuya');
  8.  
  9. const definition = {
  10.     // Since a lot of TuYa devices use the same modelID, but use different datapoints
  11.     // it's necessary to provide a fingerprint instead of a zigbeeModel
  12.     fingerprint: [
  13.         {
  14.             // The model ID from: Device with modelID 'TS0601' is not supported
  15.             // You may need to add \u0000 at the end of the name in some cases
  16.             modelID: 'TS0601',
  17.             // The manufacturer name from: Device with modelID 'TS0601' is not supported.
  18.             manufacturerName: '_TZE204_znvwzxkq',
  19.         },
  20.     ],
  21.     model: 'TS0601',
  22.     vendor: '_TZE204_znvwzxkq',
  23.     description: 'Smart Dimming 3 Gang Switch (3 Gang)',
  24.     fromZigbee: [tuya.fz.datapoints],
  25.     toZigbee: [tuya.tz.datapoints],
  26.     //onEvent: tuya.onEventSetTime, // Add this if you are getting no converter for 'commandMcuSyncTime'
  27.     configure: tuya.configureMagicPacket,
  28.     exposes: [
  29.         tuya.exposes.lightBrightnessWithMinMax().withEndpoint('l1'),
  30.         tuya.exposes.lightBrightnessWithMinMax().withEndpoint('l2'),
  31.         tuya.exposes.lightBrightnessWithMinMax().withEndpoint('l3'),
  32.         tuya.exposes.countdown().withEndpoint('l1'),
  33.         tuya.exposes.countdown().withEndpoint('l2'),
  34.         tuya.exposes.countdown().withEndpoint('l3'),
  35.         tuya.exposes.lightType().withEndpoint('l1'),
  36.         tuya.exposes.lightType().withEndpoint('l2'),
  37.         tuya.exposes.lightType().withEndpoint('l3'),
  38.  
  39.     ],
  40.     meta: {
  41.         multiEndpoint: true,
  42.         tuyaDatapoints: [
  43.             [1, 'state_l1', tuya.valueConverter.onOff, {skip: tuya.skip.stateOnAndBrightnessPresent}],
  44.             [2, 'brightness_l1', tuya.valueConverter.scale0_254to0_1000],
  45.             [3, 'min_brightness_l1', tuya.valueConverter.scale0_254to0_1000],
  46.             [4, 'light_type_l1', tuya.valueConverter.lightType],
  47.             [5, 'max_brightness_l1', tuya.valueConverter.scale0_254to0_1000],
  48.             [6, 'countdown_l1', tuya.valueConverter.countdown],
  49.             //
  50.             [7, 'state_l2', tuya.valueConverter.onOff, {skip: tuya.skip.stateOnAndBrightnessPresent}],
  51.             [8, 'brightness_l2', tuya.valueConverter.scale0_254to0_1000],
  52.             [9, 'min_brightness_l2', tuya.valueConverter.scale0_254to0_1000],
  53.             [10, 'light_type_l2', tuya.valueConverter.lightType],        
  54.             [11, 'max_brightness_l2', tuya.valueConverter.scale0_254to0_1000],
  55.             [12, 'countdown_l2', tuya.valueConverter.countdown],        
  56.             //
  57.             [15, 'state_l3', tuya.valueConverter.onOff, {skip: tuya.skip.stateOnAndBrightnessPresent}],
  58.             [16, 'brightness_l3', tuya.valueConverter.scale0_254to0_1000],
  59.             [17, 'min_brightness_l3', tuya.valueConverter.scale0_254to0_1000],
  60.             [18, 'light_type_l3', tuya.valueConverter.lightType],        
  61.             [19, 'max_brightness_l3', tuya.valueConverter.scale0_254to0_1000],
  62.             [12, 'countdown_l3', tuya.valueConverter.countdown],
  63.         ],
  64.     },
  65.     endpoint: (device) => {
  66.         return {'l1': 1, 'l2': 1, 'l3': 1};
  67.     },
  68. };
  69.  
  70. module.exports = definition;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement