zigbee-herdsman-converters 14.0.670 → 14.0.671
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.
- package/devices/namron.js +5 -3
- package/devices/sunricher.js +9 -3
- package/devices/ubisys.js +1 -1
- package/devices/xiaomi.js +196 -0
- package/lib/exposes.js +6 -4
- package/lib/reporting.js +1 -1
- package/package.json +1 -1
package/devices/namron.js
CHANGED
|
@@ -280,9 +280,11 @@ module.exports = [
|
|
|
280
280
|
vendor: 'Namron',
|
|
281
281
|
description: 'Remote control',
|
|
282
282
|
fromZigbee: [fz.command_on, fz.command_off, fz.command_step, fz.command_step_color_temperature, fz.command_recall,
|
|
283
|
-
fz.command_move_to_color_temp, fz.battery],
|
|
284
|
-
exposes: [e.battery(), e.action([
|
|
285
|
-
'
|
|
283
|
+
fz.command_move_to_color_temp, fz.battery, fz.command_move_to_hue],
|
|
284
|
+
exposes: [e.battery(), e.action([
|
|
285
|
+
'on', 'off', 'brightness_step_up', 'brightness_step_down', 'color_temperature_step_up',
|
|
286
|
+
'color_temperature_step_down', 'recall_*', 'color_temperature_move',
|
|
287
|
+
'move_to_hue_l1', 'move_to_hue_l2', 'move_to_hue_l3', 'move_to_hue_l4'])],
|
|
286
288
|
toZigbee: [],
|
|
287
289
|
meta: {multiEndpoint: true},
|
|
288
290
|
endpoint: (device) => {
|
package/devices/sunricher.js
CHANGED
|
@@ -41,11 +41,11 @@ const fzLocal = {
|
|
|
41
41
|
},
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
function syncTime(endpoint) {
|
|
44
|
+
async function syncTime(endpoint) {
|
|
45
45
|
try {
|
|
46
46
|
const time = Math.round(((new Date()).getTime() - constants.OneJanuary2000) / 1000 + ((new Date()).getTimezoneOffset() * -1) * 60);
|
|
47
47
|
const values = {time: time};
|
|
48
|
-
endpoint.write('genTime', values);
|
|
48
|
+
await endpoint.write('genTime', values);
|
|
49
49
|
} catch (error) {/* Do nothing*/}
|
|
50
50
|
}
|
|
51
51
|
|
|
@@ -462,7 +462,13 @@ module.exports = [
|
|
|
462
462
|
await reporting.thermostatTemperature(endpoint);
|
|
463
463
|
await reporting.thermostatOccupiedHeatingSetpoint(endpoint);
|
|
464
464
|
await reporting.thermostatUnoccupiedHeatingSetpoint(endpoint);
|
|
465
|
-
|
|
465
|
+
try {
|
|
466
|
+
await reporting.thermostatKeypadLockMode(endpoint);
|
|
467
|
+
} catch (error) {
|
|
468
|
+
// Fails for some
|
|
469
|
+
// https://github.com/Koenkk/zigbee2mqtt/issues/15025
|
|
470
|
+
logger.debug(`Failed to setup keypadLockout reporting`);
|
|
471
|
+
}
|
|
466
472
|
|
|
467
473
|
await endpoint.configureReporting('hvacThermostat', [{
|
|
468
474
|
attribute: 'occupancy',
|
package/devices/ubisys.js
CHANGED
|
@@ -825,7 +825,7 @@ module.exports = [
|
|
|
825
825
|
await reporting.thermostatOccupiedHeatingSetpoint(endpoint,
|
|
826
826
|
{min: 0, max: constants.repInterval.HOUR, change: 50});
|
|
827
827
|
await reporting.thermostatPIHeatingDemand(endpoint);
|
|
828
|
-
await reporting.
|
|
828
|
+
await reporting.thermostatOccupancy(endpoint);
|
|
829
829
|
await reporting.batteryPercentageRemaining(endpoint,
|
|
830
830
|
{min: constants.repInterval.HOUR, max: 43200, change: 1});
|
|
831
831
|
|
package/devices/xiaomi.js
CHANGED
|
@@ -9,6 +9,7 @@ const e = exposes.presets;
|
|
|
9
9
|
const ea = exposes.access;
|
|
10
10
|
const globalStore = require('../lib/store');
|
|
11
11
|
const xiaomi = require('../lib/xiaomi');
|
|
12
|
+
const utils = require('../lib/utils');
|
|
12
13
|
|
|
13
14
|
const xiaomiExtend = {
|
|
14
15
|
light_onoff_brightness_colortemp: (options={disableColorTempStartup: true}) => ({
|
|
@@ -40,6 +41,21 @@ const preventReset = async (type, data, device) => {
|
|
|
40
41
|
await device.getEndpoint(1).write('genBasic', payload, options);
|
|
41
42
|
};
|
|
42
43
|
|
|
44
|
+
const daysLookup = {
|
|
45
|
+
0x7f: 'everyday',
|
|
46
|
+
0x1f: 'workdays',
|
|
47
|
+
0x60: 'weekend',
|
|
48
|
+
0x01: 'mon',
|
|
49
|
+
0x02: 'tue',
|
|
50
|
+
0x04: 'wed',
|
|
51
|
+
0x08: 'thu',
|
|
52
|
+
0x10: 'fri',
|
|
53
|
+
0x20: 'sat',
|
|
54
|
+
0x40: 'sun',
|
|
55
|
+
0x55: 'mon-wed-fri-sun',
|
|
56
|
+
0x2a: 'tue-thu-sat',
|
|
57
|
+
};
|
|
58
|
+
|
|
43
59
|
|
|
44
60
|
const fzLocal = {
|
|
45
61
|
aqara_trv: {
|
|
@@ -98,6 +114,87 @@ const fzLocal = {
|
|
|
98
114
|
return result;
|
|
99
115
|
},
|
|
100
116
|
},
|
|
117
|
+
aqara_feeder: {
|
|
118
|
+
cluster: 'aqaraOpple',
|
|
119
|
+
type: ['attributeReport', 'readResponse'],
|
|
120
|
+
convert: (model, msg, publish, options, meta) => {
|
|
121
|
+
const result = {};
|
|
122
|
+
Object.entries(msg.data).forEach(([key, value]) => {
|
|
123
|
+
switch (parseInt(key)) {
|
|
124
|
+
case 0xfff1: {
|
|
125
|
+
const attr = value.slice(3, 7);
|
|
126
|
+
const len = value.slice(7, 8).readUInt8();
|
|
127
|
+
const val = value.slice(8, 8 + len);
|
|
128
|
+
switch (attr.readInt32BE()) {
|
|
129
|
+
case 0x04150055: // feeding
|
|
130
|
+
result['feed'] = '';
|
|
131
|
+
break;
|
|
132
|
+
case 0x041502bc: { // feeding report
|
|
133
|
+
const report = val.toString();
|
|
134
|
+
result['feeding_source'] = {1: 'manual', 2: 'remote'}[parseInt(report.slice(0, 2))];
|
|
135
|
+
result['feeding_size'] = parseInt(report.slice(3, 4));
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
case 0x0d680055: // portions per day
|
|
139
|
+
result['portions_per_day'] = val.readUInt16BE();
|
|
140
|
+
break;
|
|
141
|
+
case 0x0d690055: // weight per day
|
|
142
|
+
result['weight_per_day'] = val.readUInt32BE();
|
|
143
|
+
break;
|
|
144
|
+
case 0x0d0b0055: // error ?
|
|
145
|
+
result['error'] = {1: true, 0: false}[val.readUInt8()];
|
|
146
|
+
break;
|
|
147
|
+
case 0x080008c8: { // schedule string
|
|
148
|
+
const schlist = val.toString().split(',');
|
|
149
|
+
const schedule = [];
|
|
150
|
+
schlist.forEach((str) => { // 7f13000100
|
|
151
|
+
const feedtime = Buffer.from(str, 'hex');
|
|
152
|
+
schedule.push({
|
|
153
|
+
'days': daysLookup[feedtime[0]],
|
|
154
|
+
'hour': feedtime[1],
|
|
155
|
+
'minute': feedtime[2],
|
|
156
|
+
'size': feedtime[3],
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
result['schedule'] = schedule;
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
case 0x04170055: // indicator
|
|
163
|
+
result['led_indicator'] = {1: 'ON', 0: 'OFF'}[val.readUInt8()];
|
|
164
|
+
break;
|
|
165
|
+
case 0x04160055: // child lock
|
|
166
|
+
result['child_lock'] = {1: 'LOCK', 0: 'UNLOCK'}[val.readUInt8()];
|
|
167
|
+
break;
|
|
168
|
+
case 0x04180055: // mode
|
|
169
|
+
result['mode'] = {1: 'schedule', 0: 'manual'}[val.readUInt8()];
|
|
170
|
+
break;
|
|
171
|
+
case 0x0e5c0055: // serving size
|
|
172
|
+
result['serving_size'] = val.readUInt8();
|
|
173
|
+
break;
|
|
174
|
+
case 0x0e5f0055: // portion weight
|
|
175
|
+
result['portion_weight'] = val.readUInt8();
|
|
176
|
+
break;
|
|
177
|
+
case 0x080007d1: // ? 64
|
|
178
|
+
case 0x0d090055: // ? 00
|
|
179
|
+
meta.logger.warn(`zigbee-herdsman-converters:aqara_feeder: Unhandled attribute ${attr} = ${val}`);
|
|
180
|
+
break;
|
|
181
|
+
default:
|
|
182
|
+
meta.logger.warn(`zigbee-herdsman-converters:aqara_feeder: Unknown attribute ${attr} = ${val}`);
|
|
183
|
+
}
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
case 0x00ff: // 80:13:58:91:24:33:20:24:58:53:44:07:05:97:75:17
|
|
187
|
+
case 0x0007: // 00:00:00:00:1d:b5:a6:ed
|
|
188
|
+
case 0x00f7: // 05:21:14:00:0d:23:21:25:00:00:09:21:00:01
|
|
189
|
+
meta.logger.debug(`zigbee-herdsman-converters:aqara_feeder: Unhandled key ${key} = ${value}`);
|
|
190
|
+
break;
|
|
191
|
+
default:
|
|
192
|
+
meta.logger.warn(`zigbee-herdsman-converters:aqara_feeder: Unknown key ${key} = ${value}`);
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
return result;
|
|
196
|
+
},
|
|
197
|
+
},
|
|
101
198
|
};
|
|
102
199
|
|
|
103
200
|
const tzLocal = {
|
|
@@ -235,6 +332,73 @@ const tzLocal = {
|
|
|
235
332
|
await entity.read('aqaraOpple', [0x0114], {manufacturerCode: 0x115F, disableDefaultResponse: true});
|
|
236
333
|
},
|
|
237
334
|
},
|
|
335
|
+
aqara_feeder: {
|
|
336
|
+
key: ['feed', 'schedule', 'led_indicator', 'child_lock', 'mode', 'serving_size', 'portion_weight'],
|
|
337
|
+
convertSet: async (entity, key, value, meta) => {
|
|
338
|
+
const sendAttr = async (attrCode, value, length) => {
|
|
339
|
+
entity.sendSeq = ((entity.sendSeq || 0)+1) % 256;
|
|
340
|
+
const val = Buffer.from([0x00, 0x02, entity.sendSeq, 0, 0, 0, 0, 0]);
|
|
341
|
+
entity.sendSeq += 1;
|
|
342
|
+
val.writeInt32BE(attrCode, 3);
|
|
343
|
+
val.writeUInt8(length, 7);
|
|
344
|
+
let v = Buffer.alloc(length);
|
|
345
|
+
switch (length) {
|
|
346
|
+
case 1:
|
|
347
|
+
v.writeUInt8(value);
|
|
348
|
+
break;
|
|
349
|
+
case 2:
|
|
350
|
+
v.writeUInt16BE(value);
|
|
351
|
+
break;
|
|
352
|
+
case 4:
|
|
353
|
+
v.writeUInt32BE(value);
|
|
354
|
+
break;
|
|
355
|
+
default:
|
|
356
|
+
v = value;
|
|
357
|
+
}
|
|
358
|
+
await entity.write('aqaraOpple', {0xfff1: {value: Buffer.concat([val, v]), type: 0x41}},
|
|
359
|
+
{manufacturerCode: 0x115f});
|
|
360
|
+
};
|
|
361
|
+
switch (key) {
|
|
362
|
+
case 'feed':
|
|
363
|
+
sendAttr(0x04150055, 1, 1);
|
|
364
|
+
break;
|
|
365
|
+
case 'schedule': {
|
|
366
|
+
const schedule = [];
|
|
367
|
+
value.forEach((item) => {
|
|
368
|
+
const schedItem = Buffer.from([
|
|
369
|
+
utils.getKey(daysLookup, item.days, 0x7f),
|
|
370
|
+
item.hour,
|
|
371
|
+
item.minute,
|
|
372
|
+
item.size,
|
|
373
|
+
0,
|
|
374
|
+
]);
|
|
375
|
+
schedule.push(schedItem.toString('hex'));
|
|
376
|
+
});
|
|
377
|
+
const val = Buffer.concat([Buffer.from(schedule.join(',')), Buffer.from([0])]);
|
|
378
|
+
sendAttr(0x080008c8, val, val.length);
|
|
379
|
+
break;
|
|
380
|
+
}
|
|
381
|
+
case 'led_indicator':
|
|
382
|
+
sendAttr(0x04170055, {'OFF': 0, 'ON': 1}[value], 1);
|
|
383
|
+
break;
|
|
384
|
+
case 'child_lock':
|
|
385
|
+
sendAttr(0x04160055, {'UNLOCK': 0, 'LOCK': 1}[value], 1);
|
|
386
|
+
break;
|
|
387
|
+
case 'mode':
|
|
388
|
+
sendAttr(0x04180055, {'manual': 0, 'schedule': 1}[value], 1);
|
|
389
|
+
break;
|
|
390
|
+
case 'serving_size':
|
|
391
|
+
sendAttr(0x0e5c0055, value, 4);
|
|
392
|
+
break;
|
|
393
|
+
case 'portion_weight':
|
|
394
|
+
sendAttr(0x0e5f0055, value, 4);
|
|
395
|
+
break;
|
|
396
|
+
default: // Unknown key
|
|
397
|
+
meta.logger.warn(`zigbee-herdsman-converters:aqara_feeder: Unhandled key ${key}`);
|
|
398
|
+
}
|
|
399
|
+
return {state: {[key]: value}};
|
|
400
|
+
},
|
|
401
|
+
},
|
|
238
402
|
};
|
|
239
403
|
|
|
240
404
|
module.exports = [
|
|
@@ -2409,6 +2573,38 @@ module.exports = [
|
|
|
2409
2573
|
await endpoint.read('aqaraOpple', [0x040a], {manufacturerCode: 0x115f});
|
|
2410
2574
|
},
|
|
2411
2575
|
},
|
|
2576
|
+
{
|
|
2577
|
+
zigbeeModel: ['aqara.feeder.acn001'],
|
|
2578
|
+
model: 'ZNCWWSQ01LM',
|
|
2579
|
+
vendor: 'Xiaomi',
|
|
2580
|
+
description: 'Aqara pet feeder C1',
|
|
2581
|
+
fromZigbee: [fzLocal.aqara_feeder],
|
|
2582
|
+
toZigbee: [tzLocal.aqara_feeder],
|
|
2583
|
+
exposes: [
|
|
2584
|
+
exposes.enum('feed', ea.STATE_SET, ['START']).withDescription('Start feeding'),
|
|
2585
|
+
exposes.enum('feeding_source', ea.STATE, ['manual', 'remote']).withDescription('Feeding source'),
|
|
2586
|
+
exposes.numeric('feeding_size', ea.STATE).withDescription('Feeding size').withUnit('portion'),
|
|
2587
|
+
exposes.numeric('portions_per_day', ea.STATE).withDescription('Portions per day'),
|
|
2588
|
+
exposes.numeric('weight_per_day', ea.STATE).withDescription('Weight per day').withUnit('g'),
|
|
2589
|
+
exposes.binary('error', ea.STATE, true, false)
|
|
2590
|
+
.withDescription('Indicates wether there is an error with the feeder'),
|
|
2591
|
+
exposes.list('schedule', ea.STATE_SET, exposes.composite('dayTime', exposes.access.STATE_SET)
|
|
2592
|
+
.withFeature(exposes.enum('days', exposes.access.STATE_SET, [
|
|
2593
|
+
'everyday', 'workdays', 'weekend', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun',
|
|
2594
|
+
'mon-wed-fri-sun', 'tue-thu-sat']))
|
|
2595
|
+
.withFeature(exposes.numeric('hour', exposes.access.STATE_SET))
|
|
2596
|
+
.withFeature(exposes.numeric('minute', exposes.access.STATE_SET))
|
|
2597
|
+
.withFeature(exposes.numeric('size', exposes.access.STATE_SET)),
|
|
2598
|
+
).withDescription('Feeding schedule'),
|
|
2599
|
+
exposes.switch().withState('led_indicator', true, 'Led indicator', ea.STATE_SET, 'ON', 'OFF'),
|
|
2600
|
+
e.child_lock(),
|
|
2601
|
+
exposes.enum('mode', ea.STATE_SET, ['schedule', 'manual']).withDescription('Feeding mode'),
|
|
2602
|
+
exposes.numeric('serving_size', ea.STATE_SET).withValueMin(1).withValueMax(10).withDescription('One serving size')
|
|
2603
|
+
.withUnit('portion'),
|
|
2604
|
+
exposes.numeric('portion_weight', ea.STATE_SET).withValueMin(1).withValueMax(20).withDescription('Portion weight')
|
|
2605
|
+
.withUnit('g'),
|
|
2606
|
+
],
|
|
2607
|
+
},
|
|
2412
2608
|
{
|
|
2413
2609
|
zigbeeModel: ['lumi.remote.acn007'],
|
|
2414
2610
|
model: 'WXKG20LM',
|
package/lib/exposes.js
CHANGED
|
@@ -115,13 +115,14 @@ class Binary extends Base {
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
class List extends Base {
|
|
118
|
-
constructor(name, access) {
|
|
118
|
+
constructor(name, access, itemType) {
|
|
119
119
|
super();
|
|
120
120
|
this.type = 'list';
|
|
121
121
|
this.name = name;
|
|
122
122
|
this.property = name;
|
|
123
123
|
this.access = access;
|
|
124
|
-
this.item_type =
|
|
124
|
+
this.item_type = itemType;
|
|
125
|
+
delete this.item_type.property;
|
|
125
126
|
}
|
|
126
127
|
}
|
|
127
128
|
|
|
@@ -487,6 +488,7 @@ module.exports = {
|
|
|
487
488
|
numeric: (name, access) => new Numeric(name, access),
|
|
488
489
|
switch: () => new Switch(),
|
|
489
490
|
text: (name, access) => new Text(name, access),
|
|
491
|
+
list: (name, access, itemType) => new List(name, access, itemType),
|
|
490
492
|
options: {
|
|
491
493
|
calibration: (name, type='absolute') => new Numeric(`${name}_calibration`, access.SET).withDescription(`Calibrates the ${name} value (${type} offset), takes into effect on next report of device.`),
|
|
492
494
|
precision: (name) => new Numeric(`${name}_precision`, access.SET).withValueMin(0).withValueMax(3).withDescription(`Number of digits after decimal point for ${name}, takes into effect on next report of device.`),
|
|
@@ -501,8 +503,8 @@ module.exports = {
|
|
|
501
503
|
.withDescription(`Simulate a brightness value. If this device provides a brightness_move_up or brightness_move_down action it is possible to specify the update interval and delta. The action_brightness_delta indicates the delta for each interval. ${extraNote}`)
|
|
502
504
|
.withFeature(new Numeric('delta', access.SET).withValueMin(0).withDescription('Delta per interval, 20 by default'))
|
|
503
505
|
.withFeature(new Numeric('interval', access.SET).withValueMin(0).withUnit('ms').withDescription('Interval duration')),
|
|
504
|
-
no_occupancy_since_true: () => new List(`no_occupancy_since`, access.SET).withDescription('Sends a message the last time occupancy (occupancy: true) was detected. When setting this for example to [10, 60] a `{"no_occupancy_since": 10}` will be send after 10 seconds and a `{"no_occupancy_since": 60}` after 60 seconds.'),
|
|
505
|
-
no_occupancy_since_false: () => new List(`no_occupancy_since`, access.SET).withDescription('Sends a message after the last time no occupancy (occupancy: false) was detected. When setting this for example to [10, 60] a `{"no_occupancy_since": 10}` will be send after 10 seconds and a `{"no_occupancy_since": 60}` after 60 seconds.'),
|
|
506
|
+
no_occupancy_since_true: () => new List(`no_occupancy_since`, access.SET, new Numeric('time', access.STATE_SET)).withDescription('Sends a message the last time occupancy (occupancy: true) was detected. When setting this for example to [10, 60] a `{"no_occupancy_since": 10}` will be send after 10 seconds and a `{"no_occupancy_since": 60}` after 60 seconds.'),
|
|
507
|
+
no_occupancy_since_false: () => new List(`no_occupancy_since`, access.SET, new Numeric('time', access.STATE_SET)).withDescription('Sends a message after the last time no occupancy (occupancy: false) was detected. When setting this for example to [10, 60] a `{"no_occupancy_since": 10}` will be send after 10 seconds and a `{"no_occupancy_since": 60}` after 60 seconds.'),
|
|
506
508
|
presence_timeout: () => new Numeric(`presence_timeout`).withValueMin(0).withDescription('Time in seconds after which presence is cleared after detecting it (default 100 seconds).'),
|
|
507
509
|
no_position_support: () => new Binary('no_position_support', access.SET, true, false).withDescription('Set to true when your device only reports position 0, 100 and 50 (in this case your device has an older firmware) (default false).'),
|
|
508
510
|
transition: () => new Numeric(`transition`, access.SET).withValueMin(0).withDescription('Controls the transition time (in seconds) of on/off, brightness, color temperature (if applicable) and color (if applicable) changes. Defaults to `0` (no transition).'),
|
package/lib/reporting.js
CHANGED
|
@@ -178,7 +178,7 @@ module.exports = {
|
|
|
178
178
|
const p = payload('runningMode', 10, repInterval.HOUR, null, overrides);
|
|
179
179
|
await endpoint.configureReporting('hvacThermostat', p);
|
|
180
180
|
},
|
|
181
|
-
|
|
181
|
+
thermostatOccupancy: async (endpoint, overrides) => {
|
|
182
182
|
const p = payload('occupancy', 0, repInterval.HOUR, 0, overrides);
|
|
183
183
|
await endpoint.configureReporting('hvacThermostat', p);
|
|
184
184
|
},
|