zigbee-herdsman-converters 15.0.69 → 15.0.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,44 @@
1
+ const fz = require('../converters/fromZigbee');
2
+ const tz = require('../converters/toZigbee');
3
+ const exposes = require('../lib/exposes');
4
+ const reporting = require('../lib/reporting');
5
+ const tuya = require('../lib/tuya');
6
+ const e = exposes.presets;
7
+
8
+ module.exports = [
9
+ {
10
+ fingerprint: tuya.fingerprint('TS011F', ['_TZ3000_j0ktmul1']),
11
+ model: 'AUT000069',
12
+ vendor: 'AutomatOn',
13
+ description: 'Underfloor heating controller - 5 zones',
14
+ fromZigbee: [fz.on_off, fz.ignore_basic_report, tuya.fz.power_on_behavior_2, tuya.fz.child_lock],
15
+ toZigbee: [tz.on_off, tuya.tz.power_on_behavior_2, tuya.tz.child_lock],
16
+ exposes: [
17
+ e.child_lock(),
18
+ e.switch().withEndpoint('l1'),
19
+ e.switch().withEndpoint('l2'),
20
+ e.switch().withEndpoint('l3'),
21
+ e.switch().withEndpoint('l4'),
22
+ e.switch().withEndpoint('l5'),
23
+ e.power_on_behavior().withEndpoint('l1'),
24
+ e.power_on_behavior().withEndpoint('l2'),
25
+ e.power_on_behavior().withEndpoint('l3'),
26
+ e.power_on_behavior().withEndpoint('l4'),
27
+ e.power_on_behavior().withEndpoint('l5'),
28
+ ],
29
+ endpoint: (device) => {
30
+ return {'l1': 1, 'l2': 2, 'l3': 3, 'l4': 4, 'l5': 5};
31
+ },
32
+ meta: {multiEndpoint: true},
33
+ configure: async (device, coordinatorEndpoint, logger) => {
34
+ await tuya.configureMagicPacket(device, coordinatorEndpoint, logger);
35
+ await reporting.bind(device.getEndpoint(1), coordinatorEndpoint, ['genOnOff']);
36
+ await reporting.bind(device.getEndpoint(2), coordinatorEndpoint, ['genOnOff']);
37
+ await reporting.bind(device.getEndpoint(3), coordinatorEndpoint, ['genOnOff']);
38
+ await reporting.bind(device.getEndpoint(4), coordinatorEndpoint, ['genOnOff']);
39
+ await reporting.bind(device.getEndpoint(5), coordinatorEndpoint, ['genOnOff']);
40
+ device.powerSource = 'Mains (single phase)';
41
+ device.save();
42
+ },
43
+ },
44
+ ];
package/devices/casaia.js CHANGED
@@ -39,6 +39,7 @@ module.exports = [
39
39
  fromZigbee: [fz.electrical_measurement, fz.metering, fz.on_off],
40
40
  toZigbee: [tz.on_off],
41
41
  exposes: [e.switch(), e.power(), e.energy()],
42
+ meta: {publishDuplicateTransaction: true},
42
43
  configure: async (device, coordinatorEndpoint, logger) => {
43
44
  const endpoint = device.getEndpoint(1);
44
45
  await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff', 'haElectricalMeasurement', 'seMetering']);
package/devices/giex.js CHANGED
@@ -1,135 +1,222 @@
1
1
  const exposes = require('../lib/exposes');
2
2
  const tuya = require('../lib/tuya');
3
- const e = exposes.presets;
4
- const ea = exposes.access;
3
+
4
+ const {presets: ep, access: ea} = exposes;
5
+
6
+ const CAPACITY = 'capacity';
7
+ const DURATION = 'duration';
8
+ const MINUTES_IN_A_DAY = 1440;
9
+ const OFF = 'OFF';
10
+ const ON = 'ON';
11
+ const SAFETY_MIN_SECS = 10;
12
+ const SECONDS_IN_12_HOURS = 43200;
13
+
14
+ const toLocalTime = (time, timezone) => {
15
+ if (time === '--:--:--') {
16
+ return time;
17
+ }
18
+
19
+ const local = new Date(`2000-01-01T${time}.000${timezone}`); // Using 1970 instead produces edge cases
20
+ return local.toTimeString().split(' ').shift();
21
+ };
22
+
23
+ const keys = {
24
+ giexWaterValve: {
25
+ battery: 'battery',
26
+ currentTemperature: 'current_temperature',
27
+ cycleIrrigationInterval: 'cycle_irrigation_interval',
28
+ cycleIrrigationNumTimes: 'cycle_irrigation_num_times',
29
+ irrigationEndTime: 'irrigation_end_time',
30
+ irrigationStartTime: 'irrigation_start_time',
31
+ irrigationTarget: 'irrigation_target',
32
+ lastIrrigationDuration: 'last_irrigation_duration',
33
+ mode: 'mode',
34
+ state: 'state',
35
+ waterConsumed: 'water_consumed',
36
+ },
37
+ };
5
38
 
6
39
  const dataPoints = {
7
- // GIEX Water Valve
8
- giexWaterValveState: 2,
9
- giexWaterValveMode: 1,
10
- giexWaterValveIrrigationTarget: 104,
11
- giexWaterValveWaterConsumed: 111,
12
- giexWaterValveIrrigationStartTime: 101,
13
- giexWaterValveIrrigationEndTime: 102,
14
- giexWaterValveLastIrrigationDuration: 114,
15
- giexWaterValveBattery: 108,
16
- giexWaterValveCycleIrrigationNumTimes: 103,
17
- giexWaterValveCycleIrrigationInterval: 105,
18
- giexWaterValveCurrentTempurature: 106,
40
+ giexWaterValve: {
41
+ battery: 108,
42
+ currentTemperature: 106,
43
+ cycleIrrigationInterval: 105,
44
+ cycleIrrigationNumTimes: 103,
45
+ irrigationEndTime: 102,
46
+ irrigationStartTime: 101,
47
+ irrigationTarget: 104,
48
+ lastIrrigationDuration: 114,
49
+ mode: 1,
50
+ state: 2,
51
+ waterConsumed: 111,
52
+ },
53
+ };
54
+
55
+ const fzModelConverters = {
56
+ QT06_1: {
57
+ // _TZE200_sh1btabb timezone is GMT+8
58
+ time: (value) => toLocalTime(value, '+08:00'),
59
+ },
19
60
  };
20
61
 
21
62
  const fzLocal = {
22
- giex_water_valve:
23
- {
63
+ giexWaterValve: {
24
64
  cluster: 'manuSpecificTuya',
25
65
  type: ['commandDataResponse', 'commandDataReport'],
26
66
  convert: (model, msg, publish, options, meta) => {
67
+ const modelConverters = fzModelConverters[model.model] || {};
27
68
  for (const dpValue of msg.data.dpValues) {
28
69
  const value = tuya.getDataValue(dpValue);
29
- const dp = dpValue.dp;
70
+ const {dp} = dpValue;
30
71
  switch (dp) {
31
- case dataPoints.giexWaterValveState: {
32
- return {state: value ? 'ON': 'OFF'};
33
- }
34
- case dataPoints.giexWaterValveMode: {
35
- return {mode: value ? 'capacity': 'duration'};
36
- }
37
- case dataPoints.giexWaterValveIrrigationTarget: {
38
- return {irrigation_target: value};
39
- }
40
- case dataPoints.giexWaterValveCycleIrrigationNumTimes: {
41
- return {cycle_irrigation_num_times: value};
42
- }
43
- case dataPoints.giexWaterValveCycleIrrigationInterval: {
44
- return {cycle_irrigation_interval: value};
45
- }
46
- case dataPoints.giexWaterValveWaterConsumed: {
47
- return {water_consumed: value};
48
- }
49
- case dataPoints.giexWaterValveIrrigationStartTime: {
50
- return {irrigation_start_time: value};
51
- }
52
- case dataPoints.giexWaterValveIrrigationEndTime: {
53
- return {irrigation_end_time: value};
54
- }
55
- case dataPoints.giexWaterValveLastIrrigationDuration: {
56
- return {last_irrigation_duration: value};
57
- }
58
- case dataPoints.giexWaterValveBattery: {
59
- return {battery: value};
60
- }
61
- case dataPoints.giexWaterValveCurrentTempurature: {
62
- return; // Do Nothing - value ignored because isn't a valid tempurature reading. Misdocumented and usage unclear
63
- }
64
- default: {
65
- meta.logger.warn(`fz:giex_water_valve: NOT RECOGNIZED DP #${dp} with VALUE = ${value}`);
66
- }
72
+ case dataPoints.giexWaterValve.state:
73
+ return {[keys.giexWaterValve.state]: value ? ON: OFF};
74
+ case dataPoints.giexWaterValve.mode:
75
+ return {[keys.giexWaterValve.mode]: value ? CAPACITY: DURATION};
76
+ case dataPoints.giexWaterValve.irrigationTarget:
77
+ return {[keys.giexWaterValve.irrigationTarget]: value};
78
+ case dataPoints.giexWaterValve.cycleIrrigationNumTimes:
79
+ return {[keys.giexWaterValve.cycleIrrigationNumTimes]: value};
80
+ case dataPoints.giexWaterValve.cycleIrrigationInterval:
81
+ return {[keys.giexWaterValve.cycleIrrigationInterval]: value};
82
+ case dataPoints.giexWaterValve.waterConsumed:
83
+ return {[keys.giexWaterValve.waterConsumed]: value};
84
+ case dataPoints.giexWaterValve.irrigationStartTime:
85
+ return {[keys.giexWaterValve.irrigationStartTime]: modelConverters.time?.(value) || value};
86
+ case dataPoints.giexWaterValve.irrigationEndTime:
87
+ return {[keys.giexWaterValve.irrigationEndTime]: modelConverters.time?.(value) || value};
88
+ case dataPoints.giexWaterValve.lastIrrigationDuration:
89
+ return {[keys.giexWaterValve.lastIrrigationDuration]: value.split(',').shift()}; // Remove meaningless ,0 suffix
90
+ case dataPoints.giexWaterValve.battery:
91
+ return {[keys.giexWaterValve.battery]: value};
92
+ case dataPoints.giexWaterValve.currentTemperature:
93
+ return; // Do Nothing - value ignored because it isn't a valid temperature reading (misdocumented and usage unclear)
94
+ default: // Unknown data point warning
95
+ meta.logger.warn(`fzLocal.giexWaterValve: Unrecognized DP #${dp} with VALUE = ${value}`);
67
96
  }
68
97
  }
69
98
  },
70
99
  },
71
100
  };
72
101
 
102
+ const tzModelConverters = {
103
+ QT06_2: {
104
+ // _TZE200_a7sghmms irrigation time should not be less than 10 secs as per GiEX advice
105
+ irrigationTarget: (value, mode) => value > 0 && value < SAFETY_MIN_SECS && mode === DURATION ? SAFETY_MIN_SECS : value,
106
+ },
107
+ };
108
+
73
109
  const tzLocal = {
74
- giex_water_valve:
110
+ giexWaterValve:
75
111
  {
76
- key: ['mode', 'irrigation_target', 'state', 'cycle_irrigation_num_times', 'cycle_irrigation_interval'],
112
+ key: [
113
+ keys.giexWaterValve.mode,
114
+ keys.giexWaterValve.irrigationTarget,
115
+ keys.giexWaterValve.state,
116
+ keys.giexWaterValve.cycleIrrigationNumTimes,
117
+ keys.giexWaterValve.cycleIrrigationInterval,
118
+ ],
77
119
  convertSet: async (entity, key, value, meta) => {
120
+ const modelConverters = tzModelConverters[meta.mapped?.model] || {};
78
121
  switch (key) {
79
- case 'mode': {
80
- let mode = 0;
81
- if (value === 'duration') mode = 0;
82
- else if (value === 'capacity') mode = 1;
83
- await tuya.sendDataPointBool(entity, dataPoints.giexWaterValveMode, mode);
84
- return {state: {mode: value}};
85
- }
86
- case 'irrigation_target':
87
- await tuya.sendDataPointValue(entity, dataPoints.giexWaterValveIrrigationTarget, value);
88
- return {state: {irrigation_target: value}};
89
- case 'state':
90
- await tuya.sendDataPointBool(entity, dataPoints.giexWaterValveState, value === 'ON');
122
+ case keys.giexWaterValve.state:
123
+ await tuya.sendDataPointBool(entity, dataPoints.giexWaterValve.state, value === ON);
91
124
  break;
92
- case 'cycle_irrigation_num_times':
93
- await tuya.sendDataPointValue(entity, dataPoints.giexWaterValveCycleIrrigationNumTimes, value);
94
- return {state: {cycle_irrigation_num_times: value}};
95
- case 'cycle_irrigation_interval':
96
- await tuya.sendDataPointValue(entity, dataPoints.giexWaterValveCycleIrrigationInterval, value);
97
- return {state: {cycle_irrigation_interval: value}};
125
+ case keys.giexWaterValve.mode:
126
+ await tuya.sendDataPointBool(entity, dataPoints.giexWaterValve.mode, value === CAPACITY);
127
+ return {state: {[keys.giexWaterValve.mode]: value}};
128
+ case keys.giexWaterValve.irrigationTarget: {
129
+ const mode = meta.state?.[keys.giexWaterValve.mode];
130
+ const sanitizedValue = modelConverters.irrigationTarget?.(value, mode) || value;
131
+ await tuya.sendDataPointValue(entity, dataPoints.giexWaterValve.irrigationTarget, sanitizedValue);
132
+ return {state: {[keys.giexWaterValve.irrigationTarget]: sanitizedValue}};
133
+ }
134
+ case keys.giexWaterValve.cycleIrrigationNumTimes:
135
+ await tuya.sendDataPointValue(entity, dataPoints.giexWaterValve.cycleIrrigationNumTimes, value);
136
+ return {state: {[keys.giexWaterValve.cycleIrrigationNumTimes]: value}};
137
+ case keys.giexWaterValve.cycleIrrigationInterval:
138
+ await tuya.sendDataPointValue(entity, dataPoints.giexWaterValve.cycleIrrigationInterval, value);
139
+ return {state: {[keys.giexWaterValve.cycleIrrigationInterval]: value}};
98
140
  default: // Unknown key warning
99
- meta.logger.warn(`tz.GIEX_water_valve: Unhandled key ${key}`);
141
+ meta.logger.warn(`tzLocal.giexWaterValve: Unhandled KEY ${key}`);
100
142
  }
101
143
  },
102
144
  },
103
145
  };
104
146
 
147
+ const exportTemplates = {
148
+ giexWaterValve: {
149
+ vendor: 'GiEX',
150
+ description: 'Water irrigation valve',
151
+ onEvent: tuya.onEventSetLocalTime,
152
+ fromZigbee: [fzLocal.giexWaterValve],
153
+ toZigbee: [tzLocal.giexWaterValve],
154
+ exposes: [
155
+ ep.battery(),
156
+ exposes.binary(keys.giexWaterValve.state, ea.STATE_SET, ON, OFF)
157
+ .withDescription('State'),
158
+ exposes.enum(keys.giexWaterValve.mode, ea.STATE_SET, [DURATION, CAPACITY])
159
+ .withDescription('Irrigation mode'),
160
+ exposes.numeric(keys.giexWaterValve.cycleIrrigationNumTimes, ea.STATE_SET)
161
+ .withValueMin(0)
162
+ .withValueMax(100)
163
+ .withDescription('Number of cycle irrigation times, set to 0 for single cycle'),
164
+ exposes.numeric(keys.giexWaterValve.irrigationStartTime, ea.STATE)
165
+ .withDescription('Last irrigation start time'),
166
+ exposes.numeric(keys.giexWaterValve.irrigationEndTime, ea.STATE)
167
+ .withDescription('Last irrigation end time'),
168
+ exposes.numeric(keys.giexWaterValve.lastIrrigationDuration, ea.STATE)
169
+ .withDescription('Last irrigation duration'),
170
+ exposes.numeric(keys.giexWaterValve.waterConsumed, ea.STATE)
171
+ .withUnit('L')
172
+ .withDescription('Last irrigation water consumption'),
173
+ ],
174
+ },
175
+ };
176
+
105
177
  module.exports = [
178
+ // _TZE200_sh1btabb uses minutes, timezone is GMT+8
106
179
  {
180
+ ...exportTemplates.giexWaterValve,
181
+ model: 'QT06_1',
107
182
  fingerprint: [
108
183
  {modelID: 'TS0601', manufacturerName: '_TZE200_sh1btabb'},
184
+ ],
185
+ exposes: [
186
+ ...exportTemplates.giexWaterValve.exposes,
187
+ exposes.numeric(keys.giexWaterValve.irrigationTarget, ea.STATE_SET)
188
+ .withValueMin(0)
189
+ .withValueMax(MINUTES_IN_A_DAY)
190
+ .withUnit('minutes or litres')
191
+ .withDescription('Irrigation target, duration in minutes or capacity in litres (depending on mode)'),
192
+ exposes.numeric(keys.giexWaterValve.cycleIrrigationInterval, ea.STATE_SET)
193
+ .withValueMin(0)
194
+ .withValueMax(MINUTES_IN_A_DAY)
195
+ .withUnit('min')
196
+ .withDescription('Cycle irrigation interval'),
197
+ ],
198
+ },
199
+ // _TZE200_a7sghmms uses seconds, timezone is local
200
+ {
201
+ ...exportTemplates.giexWaterValve,
202
+ model: 'QT06_2',
203
+ fingerprint: [
109
204
  {modelID: 'TS0601', manufacturerName: '_TZE200_a7sghmms'},
110
205
  ],
111
- model: 'QT06',
112
- vendor: 'GiEX',
113
- description: 'Water irrigation valve',
114
- onEvent: tuya.onEventSetLocalTime,
115
- fromZigbee: [fzLocal.giex_water_valve],
116
- toZigbee: [tzLocal.giex_water_valve],
117
206
  exposes: [
118
- e.battery(),
119
- exposes.binary('state', ea.STATE_SET, 'ON', 'OFF').withDescription('State'),
120
- exposes.enum('mode', ea.STATE_SET, ['duration', 'capacity']).withDescription('Irrigation mode'),
121
- exposes.numeric('irrigation_target', exposes.access.STATE_SET).withValueMin(0).withValueMax(3600).withUnit('seconds or litres')
122
- .withDescription('Irrigation target, duration in seconds or capacity in litres (depending on mode)'),
123
- exposes.numeric('cycle_irrigation_num_times', exposes.access.STATE_SET).withValueMin(0).withValueMax(100)
124
- .withDescription('Number of cycle irrigation times, set to 0 for single cycle'),
125
- exposes.numeric('cycle_irrigation_interval', exposes.access.STATE_SET).withValueMin(0).withValueMax(3600).withUnit('sec')
207
+ ...exportTemplates.giexWaterValve.exposes,
208
+ exposes.numeric(keys.giexWaterValve.irrigationTarget, ea.STATE_SET)
209
+ .withValueMin(0)
210
+ .withValueMax(SECONDS_IN_12_HOURS)
211
+ .withUnit('seconds or litres')
212
+ .withDescription('Irrigation target, duration in seconds or capacity in litres (depending on mode), ' +
213
+ 'set to 0 to leave the valve on indefinitely, ' +
214
+ 'for safety reasons the target will be forced to a minimum of 10 seconds in duration mode'),
215
+ exposes.numeric(keys.giexWaterValve.cycleIrrigationInterval, ea.STATE_SET)
216
+ .withValueMin(0)
217
+ .withValueMax(SECONDS_IN_12_HOURS)
218
+ .withUnit('sec')
126
219
  .withDescription('Cycle irrigation interval'),
127
- exposes.numeric('irrigation_start_time', ea.STATE).withDescription('Last irrigation start time (GMT)'),
128
- exposes.numeric('irrigation_end_time', ea.STATE).withDescription('Last irrigation end time (GMT)'),
129
- exposes.numeric('last_irrigation_duration', exposes.access.STATE)
130
- .withDescription('Last irrigation duration'),
131
- exposes.numeric('water_consumed', exposes.access.STATE).withUnit('L')
132
- .withDescription('Last irrigation water consumption'),
133
220
  ],
134
221
  },
135
222
  ];
package/devices/girier.js CHANGED
@@ -6,6 +6,7 @@ module.exports = [
6
6
  fingerprint: [
7
7
  {modelID: 'TS0001', manufacturerName: '_TZ3000_majwnphg'},
8
8
  {modelID: 'TS0001', manufacturerName: '_TZ3000_6axxqqi2'},
9
+ {modelID: 'TS0001', manufacturerName: '_TZ3000_zw7yf6yk'},
9
10
  ],
10
11
  model: 'JR-ZDS01',
11
12
  vendor: 'Girier',
package/devices/hzc.js ADDED
@@ -0,0 +1,21 @@
1
+ const fz = require('../converters/fromZigbee');
2
+ const exposes = require('../lib/exposes');
3
+ const reporting = require('../lib/reporting');
4
+ const e = exposes.presets;
5
+
6
+ module.exports = [
7
+ {
8
+ zigbeeModel: ['WaterLeakageSensor-ZB3.0'],
9
+ model: 'S900W-ZG',
10
+ vendor: 'HZC',
11
+ description: 'Water leak sensor',
12
+ fromZigbee: [fz.ias_water_leak_alarm_1, fz.battery],
13
+ toZigbee: [],
14
+ exposes: [e.water_leak(), e.battery_low(), e.battery()],
15
+ configure: async (device, coordinatorEndpoint, logger) => {
16
+ const endpoint = device.getEndpoint(1);
17
+ await reporting.bind(endpoint, coordinatorEndpoint, ['genPowerCfg']);
18
+ await reporting.batteryPercentageRemaining(endpoint);
19
+ },
20
+ },
21
+ ];
package/devices/lellki.js CHANGED
@@ -121,7 +121,7 @@ module.exports = [
121
121
  extend: extend.switch(),
122
122
  fromZigbee: [fz.on_off_force_multiendpoint, fz.electrical_measurement, fz.metering, fz.ignore_basic_report,
123
123
  tuya.fz.power_outage_memory],
124
- toZigbee: [tz.on_off, tuya.tz.power_on_behavior],
124
+ toZigbee: [tz.on_off, tuya.tz.power_on_behavior_1],
125
125
  configure: async (device, coordinatorEndpoint, logger) => {
126
126
  const endpoint = device.getEndpoint(1);
127
127
  await tuya.configureMagicPacket(device, coordinatorEndpoint, logger);
package/devices/owon.js CHANGED
@@ -241,6 +241,7 @@ module.exports = [
241
241
  device.save();
242
242
  }
243
243
  },
244
+ meta: {publishDuplicateTransaction: true},
244
245
  exposes: [e.energy(),
245
246
  exposes.numeric('voltage_l1', ea.STATE).withUnit('V').withDescription('Phase 1 voltage'),
246
247
  exposes.numeric('voltage_l2', ea.STATE).withUnit('V').withDescription('Phase 2 voltage'),
package/devices/tuya.js CHANGED
@@ -133,20 +133,6 @@ const tzLocal = {
133
133
  return {state: {[key]: value}};
134
134
  },
135
135
  },
136
- power_on_behavior: {
137
- key: ['power_on_behavior'],
138
- convertSet: async (entity, key, value, meta) => {
139
- value = value.toLowerCase();
140
- const lookup = {'off': 0, 'on': 1, 'previous': 2};
141
- utils.validateValue(value, Object.keys(lookup));
142
- const pState = lookup[value];
143
- await entity.write('manuSpecificTuya_3', {'powerOnBehavior': pState}, {disableDefaultResponse: true});
144
- return {state: {power_on_behavior: value}};
145
- },
146
- convertGet: async (entity, key, meta) => {
147
- await entity.read('manuSpecificTuya_3', ['powerOnBehavior']);
148
- },
149
- },
150
136
  zb_sm_cover: {
151
137
  key: ['state', 'position', 'reverse_direction', 'top_limit', 'bottom_limit', 'favorite_position', 'goto_positon', 'report'],
152
138
  convertSet: async (entity, key, value, meta) => {
@@ -540,19 +526,6 @@ const fzLocal = {
540
526
  }
541
527
  },
542
528
  },
543
- power_on_behavior: {
544
- cluster: 'manuSpecificTuya_3',
545
- type: ['attributeReport', 'readResponse'],
546
- convert: (model, msg, publish, options, meta) => {
547
- const attribute = 'powerOnBehavior';
548
- const lookup = {0: 'off', 1: 'on', 2: 'previous'};
549
-
550
- if (msg.data.hasOwnProperty(attribute)) {
551
- const property = utils.postfixWithEndpointName('power_on_behavior', msg, model, meta);
552
- return {[property]: lookup[msg.data[attribute]]};
553
- }
554
- },
555
- },
556
529
  zb_sm_cover: {
557
530
  cluster: 'manuSpecificTuya',
558
531
  type: ['commandDataReport', 'commandDataResponse'],
@@ -814,6 +787,7 @@ module.exports = [
814
787
  fingerprint: [{modelID: 'TS0601', manufacturerName: '_TZE200_bq5c8xfe'},
815
788
  {modelID: 'TS0601', manufacturerName: '_TZE200_bjawzodf'},
816
789
  {modelID: 'TS0601', manufacturerName: '_TZE200_qyflbnbj'},
790
+ {modelID: 'TS0601', manufacturerName: '_TZE200_9yapgbuv'},
817
791
  {modelID: 'TS0601', manufacturerName: '_TZE200_zl1kmjqx'}],
818
792
  model: 'TS0601_temperature_humidity_sensor',
819
793
  vendor: 'TuYa',
@@ -1719,7 +1693,6 @@ module.exports = [
1719
1693
  {modelID: 'TS0201', manufacturerName: '_TZ3000_yd2e749y'},
1720
1694
  {modelID: 'TS0201', manufacturerName: '_TZ3000_6uzkisv2'},
1721
1695
  {modelID: 'TS0201', manufacturerName: '_TZ3000_xr3htd96'},
1722
- {modelID: 'TS0601', manufacturerName: '_TZE200_9yapgbuv'},
1723
1696
  ],
1724
1697
  model: 'WSD500A',
1725
1698
  vendor: 'TuYa',
@@ -1918,7 +1891,7 @@ module.exports = [
1918
1891
  vendor: 'TuYa',
1919
1892
  fromZigbee: [fz.on_off, fz.electrical_measurement, fz.metering, fz.ignore_basic_report,
1920
1893
  tuya.fz.power_outage_memory, tuya.fz.switch_type],
1921
- toZigbee: [tz.on_off, tuya.tz.power_on_behavior, tuya.tz.switch_type],
1894
+ toZigbee: [tz.on_off, tuya.tz.power_on_behavior_1, tuya.tz.switch_type],
1922
1895
  configure: async (device, coordinatorEndpoint, logger) => {
1923
1896
  await tuya.configureMagicPacket(device, coordinatorEndpoint, logger);
1924
1897
  const endpoint = device.getEndpoint(1);
@@ -1963,9 +1936,9 @@ module.exports = [
1963
1936
  model: 'TS000F_power',
1964
1937
  description: 'Switch with power monitoring',
1965
1938
  vendor: 'TuYa',
1966
- fromZigbee: [fz.on_off, fz.electrical_measurement, fz.metering, fz.ignore_basic_report, tuya.fz.power_on_behavior,
1939
+ fromZigbee: [fz.on_off, fz.electrical_measurement, fz.metering, fz.ignore_basic_report, tuya.fz.power_on_behavior_1,
1967
1940
  tuya.fz.switch_type],
1968
- toZigbee: [tz.on_off, tuya.tz.power_on_behavior, tuya.tz.switch_type],
1941
+ toZigbee: [tz.on_off, tuya.tz.power_on_behavior_1, tuya.tz.switch_type],
1969
1942
  configure: async (device, coordinatorEndpoint, logger) => {
1970
1943
  const endpoint = device.getEndpoint(1);
1971
1944
  await tuya.configureMagicPacket(device, coordinatorEndpoint, logger);
@@ -2593,7 +2566,7 @@ module.exports = [
2593
2566
  vendor: 'TuYa',
2594
2567
  fromZigbee: [fz.on_off, fz.electrical_measurement, fz.metering, fz.ignore_basic_report, tuya.fz.power_outage_memory,
2595
2568
  tuya.fz.indicator_mode],
2596
- toZigbee: [tz.on_off, tuya.tz.power_on_behavior, tuya.tz.backlight_indicator_mode_1],
2569
+ toZigbee: [tz.on_off, tuya.tz.power_on_behavior_1, tuya.tz.backlight_indicator_mode_1],
2597
2570
  configure: async (device, coordinatorEndpoint, logger) => {
2598
2571
  const endpoint = device.getEndpoint(1);
2599
2572
  await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff', 'haElectricalMeasurement', 'seMetering']);
@@ -3208,8 +3181,8 @@ module.exports = [
3208
3181
  model: 'TS0004',
3209
3182
  vendor: 'TuYa',
3210
3183
  description: 'Smart light switch - 4 gang with neutral wire',
3211
- fromZigbee: [fz.on_off, fzLocal.power_on_behavior, fz.ignore_basic_report],
3212
- toZigbee: [tz.on_off, tzLocal.power_on_behavior],
3184
+ fromZigbee: [fz.on_off, tuya.fz.power_on_behavior_2, fz.ignore_basic_report],
3185
+ toZigbee: [tz.on_off, tuya.tz.power_on_behavior_2],
3213
3186
  exposes: [e.switch().withEndpoint('l1'), e.power_on_behavior().withEndpoint('l1'), e.switch().withEndpoint('l2'),
3214
3187
  e.power_on_behavior().withEndpoint('l2'), e.switch().withEndpoint('l3'), e.power_on_behavior().withEndpoint('l3'),
3215
3188
  e.switch().withEndpoint('l4'), e.power_on_behavior().withEndpoint('l4')],
@@ -3414,7 +3387,7 @@ module.exports = [
3414
3387
  vendor: 'TuYa',
3415
3388
  fromZigbee: [fz.on_off, fz.electrical_measurement, fz.metering, fz.ignore_basic_report, tuya.fz.power_outage_memory,
3416
3389
  fz.tuya_relay_din_led_indicator],
3417
- toZigbee: [tz.on_off, tuya.tz.power_on_behavior, tz.tuya_relay_din_led_indicator],
3390
+ toZigbee: [tz.on_off, tuya.tz.power_on_behavior_1, tz.tuya_relay_din_led_indicator],
3418
3391
  whiteLabel: [{vendor: 'MatSee Plus', model: 'ATMS1602Z'}, {vendor: 'Tongou', model: 'TO-Q-SY1-JZT'}],
3419
3392
  ota: ota.zigbeeOTA,
3420
3393
  configure: async (device, coordinatorEndpoint, logger) => {
@@ -3440,7 +3413,7 @@ module.exports = [
3440
3413
  description: 'Din smart relay (without power monitoring)',
3441
3414
  vendor: 'TuYa',
3442
3415
  fromZigbee: [fz.on_off, fz.ignore_basic_report, tuya.fz.power_outage_memory, fz.tuya_relay_din_led_indicator],
3443
- toZigbee: [tz.on_off, tuya.tz.power_on_behavior, tz.tuya_relay_din_led_indicator],
3416
+ toZigbee: [tz.on_off, tuya.tz.power_on_behavior_1, tz.tuya_relay_din_led_indicator],
3444
3417
  configure: async (device, coordinatorEndpoint, logger) => {
3445
3418
  const endpoint = device.getEndpoint(1);
3446
3419
  await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff']);
@@ -3989,10 +3962,10 @@ module.exports = [
3989
3962
  vendor: 'TuYa',
3990
3963
  description: '1 channel dimmer',
3991
3964
  fromZigbee: extend.light_onoff_brightness({disablePowerOnBehavior: true, disableMoveStep: true, disableTransition: true})
3992
- .fromZigbee.concat([tuya.fz.power_on_behavior, fzLocal.TS110E_switch_type, fzLocal.TS110E]),
3965
+ .fromZigbee.concat([tuya.fz.power_on_behavior_1, fzLocal.TS110E_switch_type, fzLocal.TS110E]),
3993
3966
  toZigbee: utils.replaceInArray(
3994
3967
  extend.light_onoff_brightness({disablePowerOnBehavior: true, disableMoveStep: true, disableTransition: true})
3995
- .toZigbee.concat([tuya.tz.power_on_behavior, tzLocal.TS110E_options]),
3968
+ .toZigbee.concat([tuya.tz.power_on_behavior_1, tzLocal.TS110E_options]),
3996
3969
  [tz.light_onoff_brightness],
3997
3970
  [tzLocal.TS110E_light_onoff_brightness],
3998
3971
  ),
@@ -4009,8 +3982,8 @@ module.exports = [
4009
3982
  vendor: 'TuYa',
4010
3983
  description: '1 channel dimmer',
4011
3984
  whiteLabel: [{vendor: 'RTX', model: 'QS-Zigbee-D02-TRIAC-LN'}],
4012
- fromZigbee: [fzLocal.TS110E, fzLocal.TS110E_light_type, tuya.fz.power_on_behavior, fz.on_off],
4013
- toZigbee: [tzLocal.TS110E_onoff_brightness, tzLocal.TS110E_options, tuya.tz.power_on_behavior, tz.light_brightness_move],
3985
+ fromZigbee: [fzLocal.TS110E, fzLocal.TS110E_light_type, tuya.fz.power_on_behavior_1, fz.on_off],
3986
+ toZigbee: [tzLocal.TS110E_onoff_brightness, tzLocal.TS110E_options, tuya.tz.power_on_behavior_1, tz.light_brightness_move],
4014
3987
  exposes: [
4015
3988
  e.light_brightness().withMinBrightness().withMaxBrightness(),
4016
3989
  tuya.exposes.lightType().withAccess(ea.ALL), e.power_on_behavior().withAccess(ea.ALL)],
@@ -4027,10 +4000,10 @@ module.exports = [
4027
4000
  vendor: 'TuYa',
4028
4001
  description: '2 channel dimmer',
4029
4002
  fromZigbee: extend.light_onoff_brightness({disablePowerOnBehavior: true, disableMoveStep: true, disableTransition: true})
4030
- .fromZigbee.concat([tuya.fz.power_on_behavior, fzLocal.TS110E_switch_type, fzLocal.TS110E]),
4003
+ .fromZigbee.concat([tuya.fz.power_on_behavior_1, fzLocal.TS110E_switch_type, fzLocal.TS110E]),
4031
4004
  toZigbee: utils.replaceInArray(
4032
4005
  extend.light_onoff_brightness({disablePowerOnBehavior: true, disableMoveStep: true, disableTransition: true})
4033
- .toZigbee.concat([tuya.tz.power_on_behavior, tzLocal.TS110E_options]),
4006
+ .toZigbee.concat([tuya.tz.power_on_behavior_1, tzLocal.TS110E_options]),
4034
4007
  [tz.light_onoff_brightness],
4035
4008
  [tzLocal.TS110E_light_onoff_brightness],
4036
4009
  ),
@@ -4057,8 +4030,8 @@ module.exports = [
4057
4030
  model: 'TS110E_2gang_2',
4058
4031
  vendor: 'TuYa',
4059
4032
  description: '2 channel dimmer',
4060
- fromZigbee: [fzLocal.TS110E, fzLocal.TS110E_light_type, tuya.fz.power_on_behavior, fz.on_off],
4061
- toZigbee: [tzLocal.TS110E_onoff_brightness, tzLocal.TS110E_options, tuya.tz.power_on_behavior, tz.light_brightness_move],
4033
+ fromZigbee: [fzLocal.TS110E, fzLocal.TS110E_light_type, tuya.fz.power_on_behavior_1, fz.on_off],
4034
+ toZigbee: [tzLocal.TS110E_onoff_brightness, tzLocal.TS110E_options, tuya.tz.power_on_behavior_1, tz.light_brightness_move],
4062
4035
  meta: {multiEndpoint: true},
4063
4036
  exposes: [
4064
4037
  e.light_brightness().withMinBrightness().withMaxBrightness().withEndpoint('l1'),
@@ -76,4 +76,44 @@ module.exports = [
76
76
  }
77
77
  },
78
78
  },
79
+ {
80
+ zigbeeModel: ['H34450BA00-00007'],
81
+ model: 'UEHK2AZ0',
82
+ vendor: 'Universal Electronics Inc',
83
+ description: 'Xfinity security keypad',
84
+ meta: {battery: {voltageToPercentage: '3V_2100'}},
85
+ fromZigbee: [
86
+ fz.command_arm_with_transaction, fz.temperature, fz.battery, fz.ias_occupancy_alarm_1,
87
+ fz.identify, fz.ias_contact_alarm_1, fz.ias_ace_occupancy_with_timeout,
88
+ ],
89
+ toZigbee: [tz.arm_mode],
90
+ exposes: [
91
+ e.battery(), e.battery_voltage(), e.occupancy(), e.battery_low(),
92
+ e.tamper(), e.presence(), e.contact(), e.temperature(),
93
+ exposes.numeric('action_code', ea.STATE).withDescription('Pin code introduced.'),
94
+ exposes.numeric('action_transaction', ea.STATE).withDescription('Last action transaction number.'),
95
+ exposes.text('action_zone', ea.STATE).withDescription('Alarm zone. Default value 0'),
96
+ e.action([
97
+ 'disarm', 'arm_day_zones', 'identify', 'arm_night_zones', 'arm_all_zones', 'exit_delay', 'emergency',
98
+ ])],
99
+ configure: async (device, coordinatorEndpoint) => {
100
+ const endpoint = device.getEndpoint(1);
101
+ const clusters = ['msTemperatureMeasurement', 'genPowerCfg', 'ssIasZone', 'ssIasAce', 'genBasic', 'genIdentify'];
102
+ await reporting.bind(endpoint, coordinatorEndpoint, clusters);
103
+ await reporting.temperature(endpoint);
104
+ await reporting.batteryVoltage(endpoint);
105
+ },
106
+ onEvent: async (type, data, device) => {
107
+ if (type === 'message' && data.type === 'commandGetPanelStatus' && data.cluster === 'ssIasAce' &&
108
+ globalStore.hasValue(device.getEndpoint(1), 'panelStatus')) {
109
+ const payload = {
110
+ panelstatus: globalStore.getValue(device.getEndpoint(1), 'panelStatus'),
111
+ secondsremain: 0x00, audiblenotif: 0x00, alarmstatus: 0x00,
112
+ };
113
+ await device.getEndpoint(1).commandResponse(
114
+ 'ssIasAce', 'getPanelStatusRsp', payload, {}, data.meta.zclTransactionSequenceNumber,
115
+ );
116
+ }
117
+ },
118
+ },
79
119
  ];
package/lib/tuya.js CHANGED
@@ -1519,7 +1519,7 @@ const valueConverter = {
1519
1519
  };
1520
1520
 
1521
1521
  const tuyaTz = {
1522
- power_on_behavior: {
1522
+ power_on_behavior_1: {
1523
1523
  key: ['power_on_behavior', 'power_outage_memory'],
1524
1524
  convertSet: async (entity, key, value, meta) => {
1525
1525
  // Legacy: remove power_outage_memory
@@ -1534,6 +1534,20 @@ const tuyaTz = {
1534
1534
  await entity.read('genOnOff', ['moesStartUpOnOff']);
1535
1535
  },
1536
1536
  },
1537
+ power_on_behavior_2: {
1538
+ key: ['power_on_behavior'],
1539
+ convertSet: async (entity, key, value, meta) => {
1540
+ value = value.toLowerCase();
1541
+ const lookup = {'off': 0, 'on': 1, 'previous': 2};
1542
+ utils.validateValue(value, Object.keys(lookup));
1543
+ const pState = lookup[value];
1544
+ await entity.write('manuSpecificTuya_3', {'powerOnBehavior': pState});
1545
+ return {state: {power_on_behavior: value}};
1546
+ },
1547
+ convertGet: async (entity, key, meta) => {
1548
+ await entity.read('manuSpecificTuya_3', ['powerOnBehavior']);
1549
+ },
1550
+ },
1537
1551
  switch_type: {
1538
1552
  key: ['switch_type'],
1539
1553
  convertSet: async (entity, key, value, meta) => {
@@ -1675,7 +1689,7 @@ const tuyaFz = {
1675
1689
  await msg.endpoint.command('manuSpecificTuya', 'mcuGatewayConnectionStatus', payload, {});
1676
1690
  },
1677
1691
  },
1678
- power_on_behavior: {
1692
+ power_on_behavior_1: {
1679
1693
  cluster: 'genOnOff',
1680
1694
  type: ['attributeReport', 'readResponse'],
1681
1695
  convert: (model, msg, publish, options, meta) => {
@@ -1686,6 +1700,18 @@ const tuyaFz = {
1686
1700
  }
1687
1701
  },
1688
1702
  },
1703
+ power_on_behavior_2: {
1704
+ cluster: 'manuSpecificTuya_3',
1705
+ type: ['attributeReport', 'readResponse'],
1706
+ convert: (model, msg, publish, options, meta) => {
1707
+ const attribute = 'powerOnBehavior';
1708
+ const lookup = {0: 'off', 1: 'on', 2: 'previous'};
1709
+ if (msg.data.hasOwnProperty(attribute)) {
1710
+ const property = utils.postfixWithEndpointName('power_on_behavior', msg, model, meta);
1711
+ return {[property]: lookup[msg.data[attribute]]};
1712
+ }
1713
+ },
1714
+ },
1689
1715
  power_outage_memory: {
1690
1716
  cluster: 'genOnOff',
1691
1717
  type: ['attributeReport', 'readResponse'],
@@ -1830,11 +1856,11 @@ const tuyaExtend = {
1830
1856
  if (options.powerOutageMemory) {
1831
1857
  // Legacy, powerOnBehavior is preferred
1832
1858
  fromZigbee.push(tuyaFz.power_outage_memory);
1833
- toZigbee.push(tuyaTz.power_on_behavior);
1859
+ toZigbee.push(tuyaTz.power_on_behavior_1);
1834
1860
  exposes.push(tuyaExposes.powerOutageMemory());
1835
1861
  } else {
1836
- fromZigbee.push(tuyaFz.power_on_behavior);
1837
- toZigbee.push(tuyaTz.power_on_behavior);
1862
+ fromZigbee.push(tuyaFz.power_on_behavior_1);
1863
+ toZigbee.push(tuyaTz.power_on_behavior_1);
1838
1864
  exposes.push(e.power_on_behavior());
1839
1865
  }
1840
1866
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zigbee-herdsman-converters",
3
- "version": "15.0.69",
3
+ "version": "15.0.71",
4
4
  "description": "Collection of device converters to be used with zigbee-herdsman",
5
5
  "main": "index.js",
6
6
  "files": [