zigbee-herdsman-converters 14.0.607 → 14.0.608
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/converters/fromZigbee.js +4 -3
- package/devices/moes.js +87 -2
- package/devices/tuya.js +4 -5
- package/package.json +1 -1
package/converters/fromZigbee.js
CHANGED
|
@@ -1540,14 +1540,15 @@ const converters = {
|
|
|
1540
1540
|
// HomeAssistant etc. work the other way round.
|
|
1541
1541
|
// For zigbee-herdsman-converters: open = 100, close = 0
|
|
1542
1542
|
// ubisys J1 will report 255 if lift or tilt positions are not known, so skip that.
|
|
1543
|
-
const
|
|
1543
|
+
const metaInvert = model.meta && model.meta.coverInverted;
|
|
1544
|
+
const invert = metaInvert ? !options.invert_cover : options.invert_cover;
|
|
1544
1545
|
const coverStateFromTilt = model.meta && model.meta.coverStateFromTilt;
|
|
1545
1546
|
if (msg.data.hasOwnProperty('currentPositionLiftPercentage') && msg.data['currentPositionLiftPercentage'] <= 100) {
|
|
1546
1547
|
const value = msg.data['currentPositionLiftPercentage'];
|
|
1547
1548
|
result[postfixWithEndpointName('position', msg, model, meta)] = invert ? value : 100 - value;
|
|
1548
1549
|
if (!coverStateFromTilt) {
|
|
1549
1550
|
result[postfixWithEndpointName('state', msg, model, meta)] =
|
|
1550
|
-
|
|
1551
|
+
metaInvert ? (value === 0 ? 'CLOSE' : 'OPEN') : (value === 100 ? 'CLOSE' : 'OPEN');
|
|
1551
1552
|
}
|
|
1552
1553
|
}
|
|
1553
1554
|
if (msg.data.hasOwnProperty('currentPositionTiltPercentage') && msg.data['currentPositionTiltPercentage'] <= 100) {
|
|
@@ -1555,7 +1556,7 @@ const converters = {
|
|
|
1555
1556
|
result[postfixWithEndpointName('tilt', msg, model, meta)] = invert ? value : 100 - value;
|
|
1556
1557
|
if (coverStateFromTilt) {
|
|
1557
1558
|
result[postfixWithEndpointName('state', msg, model, meta)] =
|
|
1558
|
-
|
|
1559
|
+
metaInvert ? (value === 100 ? 'OPEN' : 'CLOSE') : (value === 0 ? 'OPEN' : 'CLOSE');
|
|
1559
1560
|
}
|
|
1560
1561
|
}
|
|
1561
1562
|
return result;
|
package/devices/moes.js
CHANGED
|
@@ -8,10 +8,78 @@ const extend = require('../lib/extend');
|
|
|
8
8
|
const e = exposes.presets;
|
|
9
9
|
const ea = exposes.access;
|
|
10
10
|
const zosung = require('../lib/zosung');
|
|
11
|
+
const utils = require('../lib/utils');
|
|
11
12
|
const fzZosung = zosung.fzZosung;
|
|
12
13
|
const tzZosung = zosung.tzZosung;
|
|
13
14
|
const ez = zosung.presetsZosung;
|
|
14
15
|
|
|
16
|
+
const fzLocal = {
|
|
17
|
+
ZSEUD: {
|
|
18
|
+
cluster: 'manuSpecificTuya',
|
|
19
|
+
type: ['commandDataResponse', 'commandDataReport'],
|
|
20
|
+
convert: async (model, msg, publish, options, meta) => {
|
|
21
|
+
const result = {};
|
|
22
|
+
for (const dpValue of msg.data.dpValues) {
|
|
23
|
+
const dp = dpValue.dp;
|
|
24
|
+
const value = tuya.getDataValue(dpValue);
|
|
25
|
+
switch (dp) {
|
|
26
|
+
case 1:
|
|
27
|
+
result.state_l1 = value ? 'ON' : 'OFF';
|
|
28
|
+
break;
|
|
29
|
+
case 2:
|
|
30
|
+
result.brightness_l1 = utils.mapNumberRange(value, 0, 1000, 0, 254);
|
|
31
|
+
break;
|
|
32
|
+
case 7:
|
|
33
|
+
result.state_l2 = value ? 'ON' : 'OFF';
|
|
34
|
+
break;
|
|
35
|
+
case 8:
|
|
36
|
+
result.brightness_l2 = utils.mapNumberRange(value, 0, 1000, 0, 254);
|
|
37
|
+
break;
|
|
38
|
+
default:
|
|
39
|
+
meta.logger.warn(`zigbee-herdsman-converters:ZSEUD: NOT RECOGNIZED DP #${dp} with data ${JSON.stringify(dpValue)}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return result;
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const tzLocal = {
|
|
48
|
+
ZSEUD_state: {
|
|
49
|
+
key: ['state'],
|
|
50
|
+
convertSet: async (entity, key, value, meta) => {
|
|
51
|
+
const lookup = {l1: 1, l2: 7};
|
|
52
|
+
const dp = lookup[meta.endpoint_name];
|
|
53
|
+
await tuya.sendDataPointBool(entity, dp, value === 'ON');
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
ZSEUD_brightness: {
|
|
57
|
+
key: ['brightness'],
|
|
58
|
+
convertSet: async (entity, key, value, meta) => {
|
|
59
|
+
const lookup = {l1: 2, l2: 8};
|
|
60
|
+
const dp = lookup[meta.endpoint_name];
|
|
61
|
+
|
|
62
|
+
if (key == 'brightness') {
|
|
63
|
+
// upscale to 1000
|
|
64
|
+
if (value >= 0 && value <= 254) {
|
|
65
|
+
const newValue = utils.mapNumberRange(value, 0, 254, 0, 1000);
|
|
66
|
+
// Always use same transid as tuya_dimmer_state (https://github.com/Koenkk/zigbee2mqtt/issues/6366)
|
|
67
|
+
if (meta.state[`state_${meta.endpoint_name}`] === 'ON') {
|
|
68
|
+
await tuya.sendDataPointValue(entity, dp, newValue, 'dataRequest', 1);
|
|
69
|
+
} else {
|
|
70
|
+
await tuya.sendDataPoints(entity, [tuya.dpValueFromBool(dp-1, true), tuya.dpValueFromIntValue(dp, newValue)],
|
|
71
|
+
'dataRequest', 1);
|
|
72
|
+
}
|
|
73
|
+
} else {
|
|
74
|
+
throw new Error('Dimmer brightness is out of range 0..254');
|
|
75
|
+
}
|
|
76
|
+
} else {
|
|
77
|
+
meta.logger.warn(`ZSEUD TZ unsupported key=${key} value=${value}`);
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
|
|
15
83
|
module.exports = [
|
|
16
84
|
{
|
|
17
85
|
fingerprint: [{modelID: 'TS011F', manufacturerName: '_TZ3000_cymsnfvf'},
|
|
@@ -285,8 +353,25 @@ module.exports = [
|
|
|
285
353
|
exposes: [e.light_brightness().setAccess('state', ea.STATE_SET).setAccess('brightness', ea.STATE_SET)],
|
|
286
354
|
},
|
|
287
355
|
{
|
|
288
|
-
fingerprint: [{modelID: 'TS0601', manufacturerName: '
|
|
289
|
-
|
|
356
|
+
fingerprint: [{modelID: 'TS0601', manufacturerName: '_TZE200_fjjbhx9d'}],
|
|
357
|
+
model: 'ZS-EUD',
|
|
358
|
+
vendor: 'Moes',
|
|
359
|
+
description: '2 gang light dimmer switch',
|
|
360
|
+
fromZigbee: [fzLocal.ZSEUD, fz.ignore_basic_report],
|
|
361
|
+
toZigbee: [tzLocal.ZSEUD_brightness, tzLocal.ZSEUD_state],
|
|
362
|
+
meta: {turnsOffAtBrightness1: true, multiEndpoint: true},
|
|
363
|
+
configure: async (device, coordinatorEndpoint, logger) => {
|
|
364
|
+
await reporting.bind(device.getEndpoint(1), coordinatorEndpoint, ['genOnOff', 'genLevelCtrl']);
|
|
365
|
+
if (device.getEndpoint(2)) await reporting.bind(device.getEndpoint(2), coordinatorEndpoint, ['genOnOff']);
|
|
366
|
+
},
|
|
367
|
+
exposes: [e.light_brightness().withEndpoint('l1').setAccess('state', ea.STATE_SET).setAccess('brightness', ea.STATE_SET),
|
|
368
|
+
e.light_brightness().withEndpoint('l2').setAccess('state', ea.STATE_SET).setAccess('brightness', ea.STATE_SET)],
|
|
369
|
+
endpoint: (device) => {
|
|
370
|
+
return {'l1': 1, 'l2': 1};
|
|
371
|
+
},
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
fingerprint: [{modelID: 'TS0601', manufacturerName: '_TZE200_e3oitdyu'}],
|
|
290
375
|
model: 'MS-105B',
|
|
291
376
|
vendor: 'Moes',
|
|
292
377
|
description: 'Smart dimmer module (2 gang)',
|
package/devices/tuya.js
CHANGED
|
@@ -26,9 +26,7 @@ const tzLocal = {
|
|
|
26
26
|
hpsz: {
|
|
27
27
|
key: ['led_state'],
|
|
28
28
|
convertSet: async (entity, key, value, meta) => {
|
|
29
|
-
|
|
30
|
-
await tuya.sendDataPointBool(entity, tuya.dataPoints.HPSZLEDState, ledState);
|
|
31
|
-
return {led_state: value};
|
|
29
|
+
await tuya.sendDataPointBool(entity, tuya.dataPoints.HPSZLEDState, value);
|
|
32
30
|
},
|
|
33
31
|
},
|
|
34
32
|
TS0504B_color: {
|
|
@@ -888,7 +886,8 @@ module.exports = [
|
|
|
888
886
|
{modelID: 'TS0501B', manufacturerName: '_TZ3210_nehayyhx'},
|
|
889
887
|
{modelID: 'TS0501B', manufacturerName: '_TZ3210_wuheofsg'},
|
|
890
888
|
{modelID: 'TS0501B', manufacturerName: '_TZ3210_e5t9bfdv'},
|
|
891
|
-
{modelID: 'TS0501B', manufacturerName: '_TZ3210_19qb27da'}
|
|
889
|
+
{modelID: 'TS0501B', manufacturerName: '_TZ3210_19qb27da'},
|
|
890
|
+
{modelID: 'TS0501B', manufacturerName: '_TZ3210_4zinq6io'}],
|
|
892
891
|
model: 'TS0501B',
|
|
893
892
|
description: 'Zigbee light',
|
|
894
893
|
vendor: 'TuYa',
|
|
@@ -3133,7 +3132,7 @@ module.exports = [
|
|
|
3133
3132
|
.withDescription('Shows the presence duration in minutes'),
|
|
3134
3133
|
exposes.numeric('duration_of_absence', ea.STATE).withUnit('minutes')
|
|
3135
3134
|
.withDescription('Shows the duration of the absence in minutes'),
|
|
3136
|
-
exposes.
|
|
3135
|
+
exposes.binary('led_state', ea.STATE_SET, true, false)
|
|
3137
3136
|
.withDescription('Turns the onboard LED on or off'),
|
|
3138
3137
|
],
|
|
3139
3138
|
},
|