zigbee-herdsman-converters 14.0.491 → 14.0.492

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.
@@ -34,19 +34,111 @@ const fzLocal = {
34
34
  const ret = {};
35
35
 
36
36
  switch (commandID) {
37
- case 0xA1:
38
- Object.entries(msg.data.commandFrame.attributes).forEach(([attr, val]) => {
39
- switch (attr) {
40
- case 'totalActivePower':
41
- ret['power'] = val;
42
- break;
43
- case 'currentSummDelivered':
44
- ret['energy'] = ((parseInt(val[0]) << 32) + parseInt(val[1])) / 1000.0;
45
- break;
37
+ case 0xA1: {
38
+ const attr = msg.data.commandFrame.attributes;
39
+ const clusterID = msg.data.commandFrame.clusterID;
40
+
41
+ switch (clusterID) {
42
+ case 2820: { // haElectricalMeasurement
43
+ const acCurrentDivisor = attr['acCurrentDivisor'];
44
+ const acVoltageDivisor = attr['acVoltageDivisor'];
45
+ const acFrequencyDivisor = attr['acFrequencyDivisor'];
46
+ const powerDivisor = attr['powerDivisor'];
47
+
48
+ if (attr.hasOwnProperty('rmsVoltage')) {
49
+ ret['voltage_phase_a'] = attr['rmsVoltage'] / acVoltageDivisor;
50
+ }
51
+
52
+ if (attr.hasOwnProperty('rmsVoltagePhB')) {
53
+ ret['voltage_phase_b'] = attr['rmsVoltagePhB'] / acVoltageDivisor;
54
+ }
55
+
56
+ if (attr.hasOwnProperty('rmsVoltagePhC')) {
57
+ ret['voltage_phase_c'] = attr['rmsVoltagePhC'] / acVoltageDivisor;
58
+ }
59
+
60
+ if (attr.hasOwnProperty('19200')) {
61
+ ret['voltage_phase_ab'] = attr['19200'] / acVoltageDivisor;
62
+ }
63
+
64
+ if (attr.hasOwnProperty('19456')) {
65
+ ret['voltage_phase_bc'] = attr['19456'] / acVoltageDivisor;
66
+ }
67
+
68
+ if (attr.hasOwnProperty('19712')) {
69
+ ret['voltage_phase_ca'] = attr['19712'] / acVoltageDivisor;
70
+ }
71
+
72
+ if (attr.hasOwnProperty('rmsCurrent')) {
73
+ ret['current_phase_a'] = attr['rmsCurrent'] / acCurrentDivisor;
74
+ }
75
+
76
+ if (attr.hasOwnProperty('rmsCurrentPhB')) {
77
+ ret['current_phase_b'] = attr['rmsCurrentPhB'] / acCurrentDivisor;
78
+ }
79
+
80
+ if (attr.hasOwnProperty('rmsCurrentPhC')) {
81
+ ret['current_phase_c'] = attr['rmsCurrentPhC'] / acCurrentDivisor;
82
+ }
83
+
84
+ if (attr.hasOwnProperty('totalActivePower')) {
85
+ ret['power'] = attr['totalActivePower'] * 1000 / powerDivisor;
86
+ }
87
+
88
+ if (attr.hasOwnProperty('totalApparentPower')) {
89
+ ret['power_apparent'] = attr['totalApparentPower'] * 1000 / powerDivisor;
46
90
  }
47
- });
91
+
92
+ if (attr.hasOwnProperty('acFrequency')) {
93
+ ret['ac_frequency'] = attr['acFrequency'] / acFrequencyDivisor;
94
+ }
95
+
96
+ if (attr.hasOwnProperty('activePower')) {
97
+ ret['power_phase_a'] = attr['activePower'] * 1000 / powerDivisor;
98
+ }
99
+
100
+ if (attr.hasOwnProperty('activePowerPhB')) {
101
+ ret['power_phase_b'] = attr['activePowerPhB'] * 1000 / powerDivisor;
102
+ }
103
+
104
+ if (attr.hasOwnProperty('activePowerPhC')) {
105
+ ret['power_phase_c'] = attr['activePowerPhC'] * 1000 / powerDivisor;
106
+ }
107
+ break;
108
+ }
109
+ case 1794: { // seMetering
110
+ const divisor = attr['divisor'];
111
+
112
+ if (attr.hasOwnProperty('currentSummDelivered')) {
113
+ const val = attr['currentSummDelivered'];
114
+ ret['energy'] = ((parseInt(val[0]) << 32) + parseInt(val[1])) / divisor;
115
+ }
116
+
117
+ if (attr.hasOwnProperty('16652')) {
118
+ const val = attr['16652'];
119
+ ret['energy_phase_a'] = ((parseInt(val[0]) << 32) + parseInt(val[1])) / divisor;
120
+ }
121
+
122
+ if (attr.hasOwnProperty('16908')) {
123
+ const val = attr['16908'];
124
+ ret['energy_phase_b'] = ((parseInt(val[0]) << 32) + parseInt(val[1])) / divisor;
125
+ }
126
+
127
+ if (attr.hasOwnProperty('17164')) {
128
+ const val = attr['17164'];
129
+ ret['energy_phase_c'] = ((parseInt(val[0]) << 32) + parseInt(val[1])) / divisor;
130
+ }
131
+
132
+ if (attr.hasOwnProperty('powerFactor')) {
133
+ ret['power_factor'] = attr['powerFactor'];
134
+ }
135
+
136
+ break;
137
+ }
138
+ }
48
139
 
49
140
  break;
141
+ }
50
142
  case 0xA3:
51
143
  // Should handle this cluster as well
52
144
  break;
@@ -792,6 +884,33 @@ module.exports = [
792
884
  description: 'PowerTag power sensor',
793
885
  fromZigbee: [fzLocal.schneider_powertag],
794
886
  toZigbee: [],
795
- exposes: [e.power(), e.energy()],
887
+ exposes: [
888
+ e.power(),
889
+ e.power_apparent(),
890
+ exposes.numeric('power_phase_a', ea.STATE).withUnit('W').withDescription('Instantaneous measured power on phase A'),
891
+ exposes.numeric('power_phase_b', ea.STATE).withUnit('W').withDescription('Instantaneous measured power on phase B'),
892
+ exposes.numeric('power_phase_c', ea.STATE).withUnit('W').withDescription('Instantaneous measured power on phase C'),
893
+ e.power_factor(),
894
+ e.energy(),
895
+ exposes.numeric('energy_phase_a', ea.STATE).withUnit('kWh').withDescription('Sum of consumed energy on phase A'),
896
+ exposes.numeric('energy_phase_b', ea.STATE).withUnit('kWh').withDescription('Sum of consumed energy on phase B'),
897
+ exposes.numeric('energy_phase_c', ea.STATE).withUnit('kWh').withDescription('Sum of consumed energy on phase C'),
898
+ e.ac_frequency(),
899
+ exposes.numeric('voltage_phase_a', ea.STATE).withUnit('V').withDescription('Measured electrical potential value on phase A'),
900
+ exposes.numeric('voltage_phase_b', ea.STATE).withUnit('V').withDescription('Measured electrical potential value on phase B'),
901
+ exposes.numeric('voltage_phase_c', ea.STATE).withUnit('V').withDescription('Measured electrical potential value on phase C'),
902
+ exposes.numeric('voltage_phase_ab', ea.STATE)
903
+ .withUnit('V').withDescription('Measured electrical potential value between phase A and B'),
904
+ exposes.numeric('voltage_phase_bc', ea.STATE)
905
+ .withUnit('V').withDescription('Measured electrical potential value between phase B and C'),
906
+ exposes.numeric('voltage_phase_ca', ea.STATE)
907
+ .withUnit('V').withDescription('Measured electrical potential value between phase C and A'),
908
+ exposes.numeric('current_phase_a', ea.STATE)
909
+ .withUnit('A').withDescription('Instantaneous measured electrical current on phase A'),
910
+ exposes.numeric('current_phase_b', ea.STATE)
911
+ .withUnit('A').withDescription('Instantaneous measured electrical current on phase B'),
912
+ exposes.numeric('current_phase_c', ea.STATE)
913
+ .withUnit('A').withDescription('Instantaneous measured electrical current on phase C'),
914
+ ],
796
915
  },
797
916
  ];
package/lib/exposes.js CHANGED
@@ -588,6 +588,8 @@ module.exports = {
588
588
  pm25: () => new Numeric('pm25', access.STATE).withUnit('µg/m³').withDescription('Measured PM2.5 (particulate matter) concentration'),
589
589
  position: () => new Numeric('position', access.STATE).withUnit('%').withDescription('Position'),
590
590
  power: () => new Numeric('power', access.STATE).withUnit('W').withDescription('Instantaneous measured power'),
591
+ power_factor: () => new Numeric('power_factor', access.STATE).withUnit('%').withDescription('Instantaneous measured power factor'),
592
+ power_apparent: () => new Numeric('power_apparent', access.STATE).withUnit('VA').withDescription('Instantaneous measured apparent power'),
591
593
  power_on_behavior: () => new Enum('power_on_behavior', access.ALL, ['off', 'previous', 'on']).withDescription('Controls the behavior when the device is powered on'),
592
594
  power_outage_count: (resetsWhenPairing = true) => new Numeric('power_outage_count', access.STATE).withDescription('Number of power outages' + (resetsWhenPairing ? ' (since last pairing)' : '')),
593
595
  power_outage_memory: () => new Binary('power_outage_memory', access.ALL, true, false).withDescription('Enable/disable the power outage memory, this recovers the on/off mode after power failure'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zigbee-herdsman-converters",
3
- "version": "14.0.491",
3
+ "version": "14.0.492",
4
4
  "description": "Collection of device converters to be used with zigbee-herdsman",
5
5
  "main": "index.js",
6
6
  "files": [