iobroker.openknx 0.4.0 → 0.4.2

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/README.md CHANGED
@@ -153,10 +153,11 @@ The whole name including path is used to check for similarity.
153
153
 
154
154
  ## migrate Influx
155
155
 
156
- - login to your IOBroker server with command influx
156
+ - login via SSH to your IOBroker and run command influx
157
157
  - use iobroker (or your specific database listed via command show databases)
158
158
  - list entries with: show measurements
159
159
  - copy tables with command: select \* into "entry_new" from "entry_old";
160
+ where entry_new points to the old adapter object path and entry_new the openknx adapter instance
160
161
  - set influx enabled for new object entry_new
161
162
 
162
163
  # howto use the adapter & basic concept
@@ -375,6 +376,15 @@ Data is sent to Iobroker Sentry server hosted in Germany. If you have allowed io
375
376
  * .... -> this is used by script to generate a new entry, copy after a new release
376
377
  * npm run release major/minor/patch major.minor.patch
377
378
  -->
379
+ ### 0.4.2 (2022-12-18)
380
+
381
+ - bugfix: swap value for dpt 1 for enums
382
+
383
+ ### 0.4.1 (2022-12-17)
384
+
385
+ - bugfix: fix statup issue
386
+ - feature: add support for more datatypes
387
+
378
388
  ### 0.4.0 (2022-12-15)
379
389
 
380
390
  - feature: support for Free and Two Level Group Address Style in addition to the existing Three Level support #320
package/io-package.json CHANGED
@@ -1,8 +1,34 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "openknx",
4
- "version": "0.4.0",
4
+ "version": "0.4.2",
5
5
  "news": {
6
+ "0.4.2": {
7
+ "en": "bugfix: swap value for dpt 1 for enums",
8
+ "de": "bugfix: swap-wert für dpt 1 für enums",
9
+ "ru": "bugfix: swap значение для dpt 1 для enums",
10
+ "pt": "bugfix: valor de swap para dpt 1 para enums",
11
+ "nl": "verwisselingswaarde voor dup 1",
12
+ "fr": "bugfix: valeur de swap pour dpt 1 pour enums",
13
+ "it": "bugfix: valore swap per dpt 1 per enums",
14
+ "es": "bugfix: cambio de valor para dpt 1 para enums",
15
+ "pl": "trąbka: zmienna dla dpt 1 dla enum",
16
+ "uk": "виправлення помилок: значення swap для dpt 1 для enums",
17
+ "zh-cn": "b ugfix:配量1"
18
+ },
19
+ "0.4.1": {
20
+ "en": "bugfix: fix statup issue\nfeature: add support for more datatypes",
21
+ "de": "bugfix: statup problem beheben\nfeature: unterstützung für weitere datentypen hinzufügen",
22
+ "ru": "bugfix: исправить проблему статупа\nфункция: добавить поддержку для больше типов данных",
23
+ "pt": "bugfix: corrigir problema legal\nrecurso: adicionar suporte para mais tipos de dados",
24
+ "nl": "vertaling:\nvertaling:",
25
+ "fr": "bugfix: fix statup issue\nfonction: ajouter le support pour plus de types de données",
26
+ "it": "bugfix: risolvere problema di statup\nfunzione: aggiungere supporto per più tipi di dati",
27
+ "es": "bugfix: solucionar el problema de statup\nfunción: añadir soporte para más tipos de datos",
28
+ "pl": "trąbka\nfunkcja: dodanie wsparcia dla większej liczby typów danych",
29
+ "uk": "виправлення помилок\nфункція: додавати підтримку більше типів даних",
30
+ "zh-cn": "bugfix:固定统计问题\n特点:增加对更多的数据类型的支持"
31
+ },
6
32
  "0.4.0": {
7
33
  "en": "feature: support for Free and Two Level Group Address Style in addition to the existing Three Level support #320\nfeature: map knx datapoint type enconding to object common.states #313\ndebug message for send queue size",
8
34
  "de": "feature: Unterstützung für Free und Two Level Group Address Style zusätzlich zur vorhandenen Three Level Unterstützung #320\nmerkmal: map knx datapoint type enconding to object common. staaten #313\ndebug-nachricht zum senden von warteschlangengröße",
@@ -481,7 +481,7 @@ module.exports = machina.Fsm.extend({
481
481
  if (this.useTunneling)
482
482
  this.sentTunnRequests[datagram.cemi.dest_addr] = datagram;
483
483
  this.lastSentTime = Date.now();
484
- this.log.warn( //test was debug
484
+ this.log.debug(
485
485
  '(%s):\t>>>>>>> successfully sent seqnum: %d',
486
486
  this.compositeState(),
487
487
  this.seqnum
@@ -542,7 +542,7 @@ module.exports = machina.Fsm.extend({
542
542
  clearTimeout(this.tunnelingAckTimer);
543
543
  },
544
544
  inbound_TUNNELING_ACK(datagram) {
545
- this.log.warn( //todo was debug
545
+ this.log.debug(
546
546
  util.format(
547
547
  '===== datagram %d acknowledged by the Gateway',
548
548
  datagram.tunnstate.seqnum
@@ -7,9 +7,9 @@ const log = require('log-driver').logger;
7
7
 
8
8
  const custom_truthiness = (value) => {
9
9
  const f = parseFloat(value);
10
- return !isNaN(f) && isFinite(f) ? // numeric values (in native and string form) are truthy if NOT zero
11
- f !== 1.0 : // non-numeric value truthiness is Boolean true or the string 'true'.
12
- value === true || value === 'true';
10
+ return !isNaN(f) && isFinite(f) ?
11
+ f == 1.0 : // numeric values (in native and string form) are truthy if NOT zero
12
+ value === true || value === 'true';// non-numeric value truthiness is Boolean true or the string 'true'.
13
13
  };
14
14
 
15
15
  exports.formatAPDU = (value) => Buffer.from([custom_truthiness(value)]);
@@ -32,7 +32,6 @@ exports.basetype = {
32
32
 
33
33
  // DPT subtypes info hash
34
34
  exports.subtypes = {
35
- // 1.001 on/off
36
35
  '001': {
37
36
  use: 'G',
38
37
  name: 'DPT_Switch',
@@ -40,7 +39,6 @@ exports.subtypes = {
40
39
  enc: { 0: 'Off', 1: 'On' },
41
40
  },
42
41
 
43
- // 1.002 boolean
44
42
  '002': {
45
43
  use: 'G',
46
44
  name: 'DPT_Bool',
@@ -48,7 +46,6 @@ exports.subtypes = {
48
46
  enc: { 0: 'False', 1: 'True' },
49
47
  },
50
48
 
51
- // 1.003 enable
52
49
  '003': {
53
50
  use: 'G',
54
51
  name: 'DPT_Enable',
@@ -56,7 +53,6 @@ exports.subtypes = {
56
53
  enc: { 0: 'Disable', 1: 'Enable' },
57
54
  },
58
55
 
59
- // 1.004 ramp
60
56
  '004': {
61
57
  use: 'FB',
62
58
  name: 'DPT_Ramp',
@@ -64,7 +60,6 @@ exports.subtypes = {
64
60
  enc: { 0: 'No ramp', 1: 'Ramp' },
65
61
  },
66
62
 
67
- // 1.005 alarm
68
63
  '005': {
69
64
  use: 'FB',
70
65
  name: 'DPT_Alarm',
@@ -72,7 +67,6 @@ exports.subtypes = {
72
67
  enc: { 0: 'No alarm', 1: 'Alarm' },
73
68
  },
74
69
 
75
- // 1.006 binary value
76
70
  '006': {
77
71
  use: 'FB',
78
72
  name: 'DPT_BinaryValue',
@@ -80,7 +74,6 @@ exports.subtypes = {
80
74
  enc: { 0: 'Low', 1: 'High' },
81
75
  },
82
76
 
83
- // 1.007 step
84
77
  '007': {
85
78
  use: 'FB',
86
79
  name: 'DPT_Step',
@@ -88,7 +81,6 @@ exports.subtypes = {
88
81
  enc: { 0: 'Decrease', 1: 'Increase' },
89
82
  },
90
83
 
91
- // 1.008 up/down
92
84
  '008': {
93
85
  use: 'G',
94
86
  name: 'DPT_UpDown',
@@ -96,7 +88,6 @@ exports.subtypes = {
96
88
  enc: { 0: 'Up', 1: 'Down' },
97
89
  },
98
90
 
99
- // 1.009 open/close
100
91
  '009': {
101
92
  use: 'G',
102
93
  name: 'DPT_OpenClose',
@@ -104,7 +95,6 @@ exports.subtypes = {
104
95
  enc: { 0: 'Open', 1: 'Close' },
105
96
  },
106
97
 
107
- // 1.010 start/stop
108
98
  '010': {
109
99
  use: 'G',
110
100
  name: 'DPT_Start',
@@ -112,7 +102,6 @@ exports.subtypes = {
112
102
  enc: { 0: 'Stop', 1: 'Start' },
113
103
  },
114
104
 
115
- // 1.011 state
116
105
  '011': {
117
106
  use: 'FB',
118
107
  name: 'DPT_State',
@@ -120,7 +109,6 @@ exports.subtypes = {
120
109
  enc: { 0: 'Inactive', 1: 'Active' },
121
110
  },
122
111
 
123
- // 1.012 invert
124
112
  '012': {
125
113
  use: 'FB',
126
114
  name: 'DPT_Invert',
@@ -128,7 +116,6 @@ exports.subtypes = {
128
116
  enc: { 0: 'Not inverted', 1: 'Inverted' },
129
117
  },
130
118
 
131
- // 1.013 dim send style
132
119
  '013': {
133
120
  use: 'FB',
134
121
  name: 'DPT_DimSendStyle',
@@ -136,7 +123,6 @@ exports.subtypes = {
136
123
  enc: { 0: 'Start/stop', 1: 'Cyclically' },
137
124
  },
138
125
 
139
- // 1.014 input source
140
126
  '014': {
141
127
  use: 'FB',
142
128
  name: 'DPT_InputSource',
@@ -144,7 +130,6 @@ exports.subtypes = {
144
130
  enc: { 0: 'Fixed', 1: 'Calculated' },
145
131
  },
146
132
 
147
- // 1.015 reset
148
133
  '015': {
149
134
  use: 'G',
150
135
  name: 'DPT_Reset',
@@ -152,7 +137,6 @@ exports.subtypes = {
152
137
  enc: { 0: 'no action(dummy)', 1: 'reset command(trigger)' },
153
138
  },
154
139
 
155
- // 1.016 acknowledge
156
140
  '016': {
157
141
  use: 'G',
158
142
  name: 'DPT_Ack',
@@ -160,7 +144,6 @@ exports.subtypes = {
160
144
  enc: { 0: 'no action(dummy)', 1: 'acknowledge command(trigger)' },
161
145
  },
162
146
 
163
- // 1.017 trigger
164
147
  '017': {
165
148
  use: 'G',
166
149
  name: 'DPT_Trigger',
@@ -168,7 +151,6 @@ exports.subtypes = {
168
151
  enc: { 0: 'trigger', 1: 'trigger' },
169
152
  },
170
153
 
171
- // 1.018 occupied
172
154
  '018': {
173
155
  use: 'G',
174
156
  name: 'DPT_Occupancy',
@@ -176,7 +158,6 @@ exports.subtypes = {
176
158
  enc: { 0: 'not occupied', 1: 'occupied' },
177
159
  },
178
160
 
179
- // 1.019 open window or door
180
161
  '019': {
181
162
  use: 'G',
182
163
  name: 'DPT_WindowDoor',
@@ -184,7 +165,6 @@ exports.subtypes = {
184
165
  enc: { 0: 'closed', 1: 'open' },
185
166
  },
186
167
 
187
- // 1.021 and/or
188
168
  '021': {
189
169
  use: 'FB',
190
170
  name: 'DPT_LogicalFunction',
@@ -192,7 +172,6 @@ exports.subtypes = {
192
172
  enc: { 0: 'logical function OR', 1: 'logical function AND' },
193
173
  },
194
174
 
195
- // 1.022 scene A/B
196
175
  '022': {
197
176
  use: 'FB',
198
177
  name: 'DPT_Scene_AB',
@@ -200,7 +179,6 @@ exports.subtypes = {
200
179
  enc: { 0: 'scene A', 1: 'scene B' },
201
180
  },
202
181
 
203
- // 1.023 shutter/blinds mode
204
182
  '023': {
205
183
  use: 'FB',
206
184
  name: 'DPT_ShutterBlinds_Mode',
@@ -211,7 +189,6 @@ exports.subtypes = {
211
189
  },
212
190
  },
213
191
 
214
- // 1.024 DPT_DayNight
215
192
  '024': {
216
193
  use: 'G',
217
194
  name: 'DPT_DayNight',
@@ -36,235 +36,570 @@ exports.basetype = {
36
36
 
37
37
  // DPT14 subtypes info
38
38
  exports.subtypes = {
39
- // TODO
40
- '007': {
41
- name: 'DPT_Value_AngleDeg°',
42
- desc: 'angle, degree',
39
+ '000': { //ID
40
+ use: 'G', //Use
41
+ name: 'DPT_Value_Acceleration', //Name
42
+ desc: 'acceleration', //Encoding field1
43
+ unit: 'ms-2',
44
+ },
45
+
46
+ '001': { //ID
47
+ use: 'G', //Use
48
+ name: 'DPT_Value_Acceleration_Angular', //Name
49
+ desc: 'acceleration, angular', //Encoding field1
50
+ unit: 'rad s^-2',
51
+ },
52
+
53
+ '002': { //ID
54
+ use: 'G', //Use
55
+ name: 'DPT_Value_Activation_Energy', //Name
56
+ desc: 'activation energy', //Encoding field1
57
+ unit: 'J mol^-1',
58
+ },
59
+
60
+ '003': { //ID
61
+ use: 'G', //Use
62
+ name: 'DPT_Value_Activity', //Name
63
+ desc: 'activity (radioactive)', //Encoding field1
64
+ unit: 's^-1',
65
+ },
66
+
67
+ '004': { //ID
68
+ use: 'G', //Use
69
+ name: 'DPT_Value_Mol', //Name
70
+ desc: 'amount of substance', //Encoding field1
71
+ unit: 'mol',
72
+ },
73
+
74
+ '005': { //ID
75
+ use: 'G', //Use
76
+ name: 'DPT_Value_Amplitude', //Name
77
+ desc: 'amplitude (unit as appropriate)', //Encoding field1
78
+ unit: '',
79
+ },
80
+
81
+ '006': { //ID
82
+ use: 'G', //Use
83
+ name: 'DPT_Value_AngleRad', //Name
84
+ desc: 'angle, radiant', //Encoding field1
85
+ unit: 'rad',
86
+ },
87
+
88
+ '007': { //ID
89
+ use: 'G', //Use
90
+ name: 'DPT_Value_AngleDeg', //Name
91
+ desc: 'angle, degree', //Encoding field1
43
92
  unit: '°',
44
93
  },
45
94
 
46
- '019': {
47
- name: 'DPT_Value_Electric_Current',
48
- desc: 'electric current',
95
+ '008': { //ID
96
+ use: 'G', //Use
97
+ name: 'DPT_Value_Angular_Momentum', //Name
98
+ desc: 'angular momentum', //Encoding field1
99
+ unit: 'J s',
100
+ },
101
+
102
+ '009': { //ID
103
+ use: 'G', //Use
104
+ name: 'DPT_Value_Angular_Velocity', //Name
105
+ desc: 'angular velocity', //Encoding field1
106
+ unit: 'rad s-1',
107
+ },
108
+
109
+ '010': { //ID
110
+ use: 'G', //Use
111
+ name: 'DPT_Value_Area', //Name
112
+ desc: 'acceleration', //Encoding field1
113
+ unit: 'm^2',
114
+ },
115
+
116
+ '011': { //ID
117
+ use: 'G', //Use
118
+ name: 'DPT_Value_Capacitance', //Name
119
+ desc: 'capacitance', //Encoding field1
120
+ unit: 'F',
121
+ },
122
+
123
+ '0012': { //ID
124
+ use: 'G', //Use
125
+ name: 'DPT_Value_Charge_DensitySurface', //Name
126
+ desc: 'charge density (surface)', //Encoding field1
127
+ unit: 'C m^-2',
128
+ },
129
+
130
+ '013': { //ID
131
+ use: 'G', //Use
132
+ name: 'DPT_Value_Charge_DensityVolume', //Name
133
+ desc: 'charge density (volume)', //Encoding field1
134
+ unit: 'C m^-3',
135
+ },
136
+
137
+ '014': { //ID
138
+ use: 'G', //Use
139
+ name: 'DPT_Value_Compressibility', //Name
140
+ desc: 'compressibility', //Encoding field1
141
+ unit: 'm2 N^-1',
142
+ },
143
+
144
+ '015': { //ID
145
+ use: 'G', //Use
146
+ name: 'DPT_Value_Conductance', //Name
147
+ desc: 'conductance', //Encoding field1
148
+ unit: 'S = Ω^-1',
149
+ },
150
+
151
+ '016': { //ID
152
+ use: 'G', //Use
153
+ name: 'DPT_Value_Electrical_Conductivity', //Name
154
+ desc: 'conductivity, electrical', //Encoding field1
155
+ unit: 'S m^-1',
156
+ },
157
+
158
+ '017': { //ID
159
+ use: 'G', //Use
160
+ name: 'DPT_Value_Density', //Name
161
+ desc: 'density', //Encoding field1
162
+ unit: 'kg m^-3',
163
+ },
164
+
165
+ '018': { //ID
166
+ use: 'G', //Use
167
+ name: 'DPT_Value_Electric_Charge', //Name
168
+ desc: 'electric charge', //Encoding field1
169
+ unit: 'C',
170
+ },
171
+
172
+ '019': { //ID
173
+ use: 'G', //Use
174
+ name: 'DPT_Value_Electric_Current', //Name
175
+ desc: 'electric current', //Encoding field1
49
176
  unit: 'A',
50
177
  },
178
+
179
+ '020': { //ID
180
+ use: 'G', //Use
181
+ name: 'DPT_Value_Electric_CurrentDensity', //Name
182
+ desc: 'electric current density', //Encoding field1
183
+ unit: 'A m^-2',
184
+ },
185
+
186
+ '021': { //ID
187
+ use: 'G', //Use
188
+ name: 'DPT_Value_Electric_DipoleMoment', //Name
189
+ desc: 'electric dipole moment', //Encoding field1
190
+ unit: 'C m',
191
+ },
192
+
193
+ '022': { //ID
194
+ use: 'G', //Use
195
+ name: 'DPT_Value_Electric_Displacement', //Name
196
+ desc: '2 electric displacement', //Encoding field1
197
+ unit: 'C m^-2',
198
+ },
199
+
200
+ '023': { //ID
201
+ use: 'G', //Use
202
+ name: 'DPT_Value_Electric_FieldStrength', //Name
203
+ desc: 'electric field strength', //Encoding field1
204
+ unit: 'V m^-1',
205
+ },
206
+
207
+ '024': { //ID
208
+ use: 'G', //Use
209
+ name: 'DPT_Value_Electric_Flux', //Name
210
+ desc: 'electric flux', //Encoding field1
211
+ unit: 'c',
212
+ },
213
+
214
+ '025': { //ID
215
+ use: 'G', //Use
216
+ name: 'DPT_Value_Electric_FluxDensity', //Name
217
+ desc: 'electric flux density', //Encoding field1
218
+ unit: 'C m^-2',
219
+ },
220
+
221
+ '026': { //ID
222
+ use: 'G', //Use
223
+ name: 'DPT_Value_Electric_Polarization', //Name
224
+ desc: 'electric polarization', //Encoding field1
225
+ unit: 'C m^-2',
226
+ },
51
227
 
52
- '027': {
53
- name: 'DPT_Value_Electric_Potential',
54
- desc: 'electric potential',
228
+ '027': { //ID
229
+ use: 'G', //Use
230
+ name: 'DPT_Value_Electric_Potential', //Name
231
+ desc: 'electric potential', //Encoding field1
55
232
  unit: 'V',
56
233
  },
57
234
 
58
- '028': {
59
- name: 'DPT_Value_Electric_PotentialDifference',
60
- desc: 'electric potential difference',
235
+ '028': { //ID
236
+ use: 'G', //Use
237
+ name: 'DPT_Value_Electric_PotentialDifference', //Name
238
+ desc: 'electric potential difference', //Encoding field1
61
239
  unit: 'V',
62
240
  },
63
241
 
64
- '031': {
65
- name: 'DPT_Value_Energ',
66
- desc: 'energy',
242
+ '029': { //ID
243
+ use: 'G', //Use
244
+ name: 'DPT_Value_ElectromagneticMoment', //Name
245
+ desc: 'electromagnetic moment', //Encoding field1
246
+ unit: 'A m^2',
247
+ },
248
+
249
+ '030': { //ID
250
+ use: 'G', //Use
251
+ name: 'DPT_Value_Electromotive_Force', //Name
252
+ desc: 'electromotive force', //Encoding field1
253
+ unit: 'V',
254
+ },
255
+
256
+ '031': { //ID
257
+ use: 'G', //Use
258
+ name: 'DPT_Value_Energy', //Name
259
+ desc: 'energy', //Encoding field1
67
260
  unit: 'J',
68
261
  },
69
262
 
70
- '032': {
71
- name: 'DPT_Value_Force',
72
- desc: 'force',
263
+ '032': { //ID
264
+ use: 'G', //Use
265
+ name: 'DPT_Value_Force', //Name
266
+ desc: 'force', //Encoding field1
73
267
  unit: 'N',
74
268
  },
75
269
 
76
- '033': {
77
- name: 'DPT_Value_Frequency',
78
- desc: 'frequency',
79
- unit: 'Hz',
270
+ '033': { //ID
271
+ use: 'G', //Use
272
+ name: 'DPT_Value_Frequency', //Name
273
+ desc: 'frequency', //Encoding field1
274
+ unit: 'Hz = s^-1',
275
+ },
276
+
277
+ '034': { //ID
278
+ use: 'G', //Use
279
+ name: 'DPT_Value_Angular_Frequency', //Name
280
+ desc: 'frequency, angular (pulsatance)', //Encoding field1
281
+ unit: 'rad s^-1',
282
+ },
283
+
284
+ '035': { //ID
285
+ use: 'G', //Use
286
+ name: 'DPT_Value_Heat_Capacity', //Name
287
+ desc: 'heat capacity', //Encoding field1
288
+ unit: 'J K^-1',
80
289
  },
81
290
 
82
- '036': {
83
- name: 'DPT_Value_Heat_FlowRate',
84
- desc: 'heat flow rate',
291
+ '036': { //ID
292
+ use: 'G', //Use
293
+ name: 'DPT_Value_Heat_FlowRate', //Name
294
+ desc: 'heat flow rate', //Encoding field1
85
295
  unit: 'W',
86
296
  },
87
297
 
88
- '037': {
89
- name: 'DPT_Value_Heat_Quantity',
90
- desc: 'heat, quantity of',
298
+ '037': { //ID
299
+ use: 'G', //Use
300
+ name: 'DPT_Value_Heat_Quantity', //Name
301
+ desc: 'heat, quantity of', //Encoding field1
91
302
  unit: 'J',
92
303
  },
93
304
 
94
- '038': {
95
- name: 'DPT_Value_Impedance',
96
- desc: 'impedance',
305
+ '038': { //ID
306
+ use: 'G', //Use
307
+ name: 'DPT_Value_Impedance', //Name
308
+ desc: 'impedance', //Encoding field1
97
309
  unit: 'Ω',
98
310
  },
99
311
 
100
- '039': {
101
- name: 'DPT_Value_Length',
102
- desc: 'length',
312
+ '039': { //ID
313
+ use: 'G', //Use
314
+ name: 'DPT_Value_Length', //Name
315
+ desc: 'length', //Encoding field1
103
316
  unit: 'm',
104
317
  },
105
318
 
106
- '051': {
107
- name: 'DPT_Value_Mass',
108
- desc: 'mass',
319
+ '040': { //ID
320
+ use: 'G', //Use
321
+ name: 'DPT_Value_Light_Quantity', //Name
322
+ desc: 'light, quantity of', //Encoding field1
323
+ unit: 'J or lm s',
324
+ },
325
+
326
+ '041': { //ID
327
+ use: 'G', //Use
328
+ name: 'DPT_Value_Luminance', //Name
329
+ desc: 'luminance', //Encoding field1
330
+ unit: 'cd m^-2',
331
+ },
332
+
333
+ '042': { //ID
334
+ use: 'G', //Use
335
+ name: 'DPT_Value_Luminous_Flux', //Name
336
+ desc: 'luminous flux', //Encoding field1
337
+ unit: 'lm',
338
+ },
339
+
340
+ '043': { //ID
341
+ use: 'G', //Use
342
+ name: 'DPT_Value_Luminous_Intensity', //Name
343
+ desc: 'luminous intensity', //Encoding field1
344
+ unit: 'cd',
345
+ },
346
+
347
+ '044': { //ID
348
+ use: 'G', //Use
349
+ name: 'DPT_Value_Magnetic_FieldStrength', //Name
350
+ desc: 'magnetic field strength', //Encoding field1
351
+ unit: 'A m^-1',
352
+ },
353
+
354
+ '045': { //ID
355
+ use: 'G', //Use
356
+ name: 'DPT_Value_Magnetic_Flux', //Name
357
+ desc: 'magnetic flux', //Encoding field1
358
+ unit: 'Wb',
359
+ },
360
+
361
+ '046': { //ID
362
+ use: 'G', //Use
363
+ name: 'DPT_Value_Magnetic_FluxDensity', //Name
364
+ desc: 'magnetic flux density', //Encoding field1
365
+ unit: 'T',
366
+ },
367
+
368
+ '047': { //ID
369
+ use: 'G', //Use
370
+ name: 'DPT_Value_Magnetic_Moment', //Name
371
+ desc: 'magnetic moment', //Encoding field1
372
+ unit: 'A m^2',
373
+ },
374
+
375
+ '048': { //ID
376
+ use: 'G', //Use
377
+ name: 'DPT_Value_Magnetic_Polarization', //Name
378
+ desc: 'magnetic polarization', //Encoding field1
379
+ unit: 'T',
380
+ },
381
+
382
+ '049': { //ID
383
+ use: 'G', //Use
384
+ name: 'DPT_Value_Magnetization', //Name
385
+ desc: 'magnetization', //Encoding field1
386
+ unit: 'A m^-1',
387
+ },
388
+
389
+ '050': { //ID
390
+ use: 'G', //Use
391
+ name: 'DPT_Value_MagnetomotiveForce', //Name
392
+ desc: 'magneto motive force', //Encoding field1
393
+ unit: 'A',
394
+ },
395
+
396
+ '051': { //ID
397
+ use: 'G', //Use
398
+ name: 'DPT_Value_Mass', //Name
399
+ desc: 'mass', //Encoding field1
109
400
  unit: 'kg',
110
401
  },
111
402
 
112
- '056': {
113
- name: 'DPT_Value_Power',
114
- desc: 'power',
403
+ '052': { //ID
404
+ use: 'G', //Use
405
+ name: 'DPT_Value_MassFlux', //Name
406
+ desc: 'mass flux', //Encoding field1
407
+ unit: 'kg s^-1',
408
+ },
409
+
410
+ '053': { //ID
411
+ use: 'G', //Use
412
+ name: 'DPT_Value_Momentum', //Name
413
+ desc: 'momentum', //Encoding field1
414
+ unit: 'N s^-1',
415
+ },
416
+
417
+ '054': { //ID
418
+ use: 'G', //Use
419
+ name: 'DPT_Value_Phase_AngleRad', //Name
420
+ desc: 'phase angle, radiant', //Encoding field1
421
+ unit: 'rad',
422
+ },
423
+
424
+ '055': { //ID
425
+ use: 'G', //Use
426
+ name: 'DPT_Value_Phase_AngleDeg', //Name
427
+ desc: 'phase angle, degrees', //Encoding field1
428
+ unit: '°',
429
+ },
430
+
431
+ '056': { //ID
432
+ use: 'G', //Use
433
+ name: 'DPT_Value_Power', //Name
434
+ desc: 'power', //Encoding field1
115
435
  unit: 'W',
116
436
  },
117
-
118
- "057": {
119
- "desc": "DPT_Value_Power_Factor",
120
- "name": "Power factor",
121
- "unit": "cos Φ"
437
+
438
+ '057': { //ID
439
+ use: 'G', //Use
440
+ name: 'DPT_Value_Power_Factor', //Name
441
+ desc: 'power factor', //Encoding field1
442
+ unit: '',
122
443
  },
123
-
124
- "058": {
125
- "desc": "DPT_Value_Pressure",
126
- "name": "Pressure (Pa)",
127
- "unit": "Pa"
444
+
445
+ '058': { //ID
446
+ use: 'G', //Use
447
+ name: 'DPT_Value_Pressure', //Name
448
+ desc: 'pressure', //Encoding field1
449
+ unit: 'Pa = N m^-2',
128
450
  },
129
-
130
- '065': {
131
- name: 'DPT_Value_Speed',
132
- desc: 'speed',
133
- unit: 'm/s',
451
+
452
+ '059': { //ID
453
+ use: 'G', //Use
454
+ name: 'DPT_Value_Reactance', //Name
455
+ desc: 'reactance', //Encoding field1
456
+ unit: 'Ω',
457
+ },
458
+
459
+ '060': { //ID
460
+ use: 'G', //Use
461
+ name: 'DPT_Value_Resistance', //Name
462
+ desc: 'resistance', //Encoding field1
463
+ unit: 'Ω',
134
464
  },
135
465
 
136
- '066': {
137
- name: 'DPT_Value_Stress',
138
- desc: 'stress',
139
- unit: 'Pa',
466
+ '061': { //ID
467
+ use: 'G', //Use
468
+ name: 'DPT_Value_Resistivity', //Name
469
+ desc: 'resistivity', //Encoding field1
470
+ unit: 'Ωm',
140
471
  },
141
472
 
142
- '067': {
143
- name: 'DPT_Value_Surface_Tension',
144
- desc: 'surface tension',
145
- unit: '1/Nm',
473
+ '062': { //ID
474
+ use: 'G', //Use
475
+ name: 'DPT_Value_SelfInductance', //Name
476
+ desc: 'self inductance', //Encoding field1
477
+ unit: 'H',
146
478
  },
147
479
 
148
- '068': {
149
- name: 'DPT_Value_Common_Temperature',
150
- desc: 'temperature, common',
480
+ '063': { //ID
481
+ use: 'G', //Use
482
+ name: 'DPT_Value_SolidAngle', //Name
483
+ desc: 'solid angle', //Encoding field1
484
+ unit: 'sr',
485
+ },
486
+
487
+ '064': { //ID
488
+ use: 'G', //Use
489
+ name: 'DPT_Value_Sound_Intensity', //Name
490
+ desc: 'sound intensity', //Encoding field1
491
+ unit: 'W m^-2',
492
+ },
493
+
494
+ '065': { //ID
495
+ use: 'G', //Use
496
+ name: 'DPT_Value_Speed', //Name
497
+ desc: 'speed', //Encoding field1
498
+ unit: 'm s^-1',
499
+ },
500
+
501
+ '066': { //ID
502
+ use: 'G', //Use
503
+ name: 'DPT_Value_Stress', //Name
504
+ desc: 'stress', //Encoding field1
505
+ unit: 'Pa = N m^-2',
506
+ },
507
+
508
+ '067': { //ID
509
+ use: 'G', //Use
510
+ name: 'DPT_Value_Surface_Tension', //Name
511
+ desc: 'surface tension', //Encoding field1
512
+ unit: 'Nm^-1',
513
+ },
514
+
515
+ '068': { //ID
516
+ use: 'G', //Use
517
+ name: 'DPT_Value_Common_Temperature', //Name
518
+ desc: 'emperature, common', //Encoding field1
151
519
  unit: '°C',
152
520
  },
153
521
 
154
- '069': {
155
- name: 'DPT_Value_Absolute_Temperature',
156
- desc: 'temperature (absolute)',
522
+ '069': { //ID
523
+ use: 'G', //Use
524
+ name: 'DPT_Value_Absolute_Temperature', //Name
525
+ desc: 'temperature (absolute)', //Encoding field1
157
526
  unit: 'K',
158
527
  },
159
528
 
160
- '070': {
161
- name: 'DPT_Value_TemperatureDifference',
162
- desc: 'temperature difference',
529
+ '070': { //ID
530
+ use: 'G', //Use
531
+ name: 'DPT_Value_TemperatureDifference', //Name
532
+ desc: 'temperature difference', //Encoding field1
163
533
  unit: 'K',
164
534
  },
165
535
 
166
- '078': {
167
- name: 'DPT_Value_Weight',
168
- desc: 'weight',
169
- unit: 'N',
536
+ '071': { //ID
537
+ use: 'G', //Use
538
+ name: 'DPT_Value_Thermal_Capacity', //Name
539
+ desc: 'thermal capacity', //Encoding field1
540
+ unit: 'JK^-1',
170
541
  },
171
-
172
- '076': {
173
- 'desc': 'DPT_Value_Volume',
174
- 'name': 'Volume',
175
- 'unit': 'm3'
542
+
543
+ '072': { //ID
544
+ use: 'G', //Use
545
+ name: 'DPT_Value_Thermal_Conductivity', //Name
546
+ desc: 'thermal conductivity', //Encoding field1
547
+ unit: 'W m^-1 K^-1',
176
548
  },
177
-
178
- '078': {
179
- 'desc': 'DPT_Value_Weight',
180
- 'name': 'Weight',
181
- 'unit': 'N'
549
+
550
+ '073': { //ID
551
+ use: 'G', //Use
552
+ name: 'DPT_Value_ThermoelectricPower', //Name
553
+ desc: 'thermoelectric power', //Encoding field1
554
+ unit: 'V K^-1',
182
555
  },
183
-
184
- '079': {
185
- name: 'DPT_Value_Work',
186
- desc: 'work',
556
+
557
+ '074': { //ID
558
+ use: 'G', //Use
559
+ name: 'DPT_Value_Time', //Name
560
+ desc: 'time', //Encoding field1
561
+ unit: 's',
562
+ },
563
+
564
+ '075': { //ID
565
+ use: 'G', //Use
566
+ name: 'DPT_Value_Torque', //Name
567
+ desc: 'torque', //Encoding field1
568
+ unit: 'Nm',
569
+ },
570
+
571
+ '076': { //ID
572
+ use: 'G', //Use
573
+ name: 'DPT_Value_Volume', //Name
574
+ desc: 'volume', //Encoding field1
575
+ unit: 'm^3',
576
+ },
577
+
578
+ '077': { //ID
579
+ use: 'G', //Use
580
+ name: 'DPT_Value_Volume_Flux', //Name
581
+ desc: 'volume flux', //Encoding field1
582
+ unit: 'm3 s^-1',
583
+ },
584
+
585
+ '078': { //ID
586
+ use: 'G', //Use
587
+ name: 'DPT_Value_Weight', //Name
588
+ desc: 'weight', //Encoding field1
589
+ unit: 'N',
590
+ },
591
+
592
+ '079': { //ID
593
+ use: 'G', //Use
594
+ name: 'DPT_Value_Work', //Name
595
+ desc: 'work', //Encoding field1
187
596
  unit: 'J',
597
+ },
598
+
599
+ '080': { //ID
600
+ use: 'G', //Use
601
+ name: 'DPT_Value_ApparentPower', //Name
602
+ desc: 'Apparent power', //Encoding field1
603
+ unit: 'VA',
188
604
  }
189
605
  };
190
-
191
- /*
192
- todo
193
- 14.000 F32 DPT_Value_Acceleration
194
- 14.001 F32 DPT_Value_Acceleration_Angular
195
- 14.002 F32 DPT_Value_Activation_Energy
196
- 14.003 F32 DPT_Value_Activity
197
- 14.004 F32 DPT_Value_Mol
198
- 14.005 F32 DPT_Value_Amplitude
199
- 14.006 F32 DPT_Value_AngleRad
200
- 14.007 F32 DPT_Value_AngleDeg
201
- 14.008 F32 DPT_Value_Angular_Momentum
202
- 14.009 F32 DPT_Value_Angular_Velocity
203
- 14.010 F32 DPT_Value_Area
204
- 14.011 F32 DPT_Value_Capacitance
205
- 14.012 F32 DPT_Value_Charge_DensitySurface
206
- 14.013 F32 DPT_Value_Charge_DensityVolume
207
- 14.014 F32 DPT_Value_Compressibility
208
- 14.015 F32 DPT_Value_Conductance
209
- 14.016 F32 DPT_Value_Electrical_Conductivity
210
- 14.017 F32 DPT_Value_Density
211
- 14.018 F32 DPT_Value_Electric_Charge
212
- 14.019 F32 DPT_Value_Electric_Current
213
- 14.020 F32 DPT_Value_Electric_CurrentDensity
214
- 14.021 F32 DPT_Value_Electric_DipoleMoment
215
- 14.022 F32 DPT_Value_Electric_Displacement
216
- 14.023 F32 DPT_Value_Electric_FieldStrength
217
- 14.024 F32 DPT_Value_Electric_Flux
218
- 14.025 F32 DPT_Value_Electric_FluxDensity
219
- 14.026 F32 DPT_Value_Electric_Polarization
220
- 14.027 F32 DPT_Value_Electric_Potential
221
- 14.028 F32 DPT_Value_Electric_PotentialDifference
222
- 14.029 F32 DPT_Value_ElectromagneticMoment
223
- 14.030 F32 DPT_Value_Electromotive_Force
224
- 14.031 F32 DPT_Value_Energy
225
- 14.032 F32 DPT_Value_Force
226
- 14.033 F32 DPT_Value_Frequency
227
- 14.034 F32 DPT_Value_Angular_Frequency
228
- 14.035 F32 DPT_Value_Heat_Capacity
229
- 14.036 F32 DPT_Value_Heat_FlowRate
230
- 14.037 F32 DPT_Value_Heat_Quantity
231
- 14.038 F32 DPT_Value_Impedance
232
- 14.039 F32 DPT_Value_Length
233
- 14.040 F32 DPT_Value_Light_Quantity
234
- 14.041 F32 DPT_Value_Luminance
235
- 14.042 F32 DPT_Value_Luminous_Flux
236
- 14.043 F32 DPT_Value_Luminous_Intensity
237
- 14.044 F32 DPT_Value_Magnetic_FieldStrength
238
- 14.045 F32 DPT_Value_Magnetic_Flux
239
- 14.046 F32 DPT_Value_Magnetic_FluxDensity
240
- 14.047 F32 DPT_Value_Magnetic_Moment
241
- 14.048 F32 DPT_Value_Magnetic_Polarization
242
- 14.049 F32 DPT_Value_Magnetization
243
- 14.050 F32 DPT_Value_MagnetomotiveForce
244
- 14.051 F32 DPT_Value_Mass
245
- 14.052 F32 DPT_Value_MassFlux
246
- 14.053 F32 DPT_Value_Momentum
247
- 14.054 F32 DPT_Value_Phase_AngleRad
248
- 14.055 F32 DPT_Value_Phase_AngleDeg
249
- 14.056 F32 DPT_Value_Power
250
- 14.057 F32 DPT_Value_Power_Factor
251
- 14.058 F32 DPT_Value_Pressure
252
- 14.059 F32 DPT_Value_Reactance
253
- 14.060 F32 DPT_Value_Resistance
254
- 14.061 F32 DPT_Value_Resistivity
255
- 14.062 F32 DPT_Value_SelfInductance
256
- 14.063 F32 DPT_Value_SolidAngle
257
- 14.064 F32 DPT_Value_Sound_Intensity
258
- 14.065 F32 DPT_Value_Speed
259
- 14.066 F32 DPT_Value_Stress
260
- 14.067 F32 DPT_Value_Surface_Tension
261
- 14.068 F32 DPT_Value_Common_Temperature
262
- 14.069 F32 DPT_Value_Absolute_Temperature
263
- 14.070 F32 DPT_Value_TemperatureDifference
264
- 14.071 F32 DPT_Value_Thermal_Capacity
265
- 14.072 F32 DPT_Value_Thermal_Conductivity
266
- 14.073 F32 DPT_Value_ThermoelectricPower
267
- 14.074 F32 DPT_Value_Time
268
- 14.075 F32 DPT_Value_Torque
269
- 14.076 F32 DPT_Value_Volume
270
- */
@@ -36,7 +36,7 @@ exports.fromBuffer = (buf) => {
36
36
  // DPT basetype info hash
37
37
  exports.basetype = {
38
38
  bitlength: 2,
39
- valuetype: 'composite',
39
+ valuetype: 'basic',
40
40
  desc: '1-bit value with priority',
41
41
  };
42
42
 
@@ -113,26 +113,26 @@ exports.subtypes = {
113
113
  },
114
114
 
115
115
  // 2.010 start control
116
- '001': {
116
+ '010': {
117
117
  use: 'FB',
118
118
  name: 'DPT_Start_Control',
119
119
  desc: 'start with priority',
120
- enc: { 0: 'No control', 1: 'No control', 2: 'Off', 3: 'On' },
120
+ enc: { 0: 'Off', 1: 'On' },
121
121
  },
122
122
 
123
123
  // 2.011 state control
124
- '001': {
124
+ '011': {
125
125
  use: 'FB',
126
- name: 'DPT_Switch_Control',
126
+ name: 'DPT_State_Control',
127
127
  desc: 'switch',
128
- enc: { 0: 'No control', 1: 'No control', 2: 'Off', 3: 'On' },
128
+ enc: { 0: 'Off', 1: 'On' },
129
129
  },
130
130
 
131
131
  // 2.012 invert control
132
- '001': {
132
+ '012': {
133
133
  use: 'FB',
134
- name: 'DPT_Switch_Control',
134
+ name: 'DPT_Invert_Control',
135
135
  desc: 'switch',
136
- enc: { 0: 'No control', 1: 'No control', 2: 'Off', 3: 'On' },
136
+ enc: { 0: 'Off', 1: 'On' },
137
137
  },
138
138
  };
@@ -51,28 +51,3 @@ exports.subtypes = {
51
51
  desc: 'blinds control',
52
52
  },
53
53
  };
54
-
55
- /*
56
- 2.6.3.5 Behavior
57
- Status
58
- off dimming actuator switched off
59
- on dimming actuator switched on, constant brightness, at least
60
- minimal brightness dimming
61
- dimming actuator switched on, moving from actual value in direction of
62
- set value
63
- Events
64
- position = 0 off command
65
- position = 1 on command
66
- control = up dX command, dX more bright dimming
67
- control = down dX command, dX less bright dimming
68
- control = stop stop command
69
- value = 0 dimming value = off
70
- value = x% dimming value = x% (not zero)
71
- value_reached actual value reached set value
72
-
73
- The step size dX for up and down dimming may be 1/1, 1/2, 1/4, 1/8, 1/16, 1/32 and 1/64 of
74
- the full dimming range (0 - FFh).
75
-
76
- 3.007 dimming control
77
- 3.008 blind control
78
- */
@@ -5,7 +5,7 @@
5
5
 
6
6
  "use strict";
7
7
 
8
- const DPTLib = require(__dirname + "/knx/src/dptlib"); //todo copy for the moment
8
+ const DPTLib = require(__dirname + "/knx/src/dptlib");
9
9
  const select = require("xpath");
10
10
  const dom = require("xmldom").DOMParser;
11
11
  const tools = require("./tools.js");
@@ -167,14 +167,14 @@ module.exports = {
167
167
 
168
168
  function identifyRangeRoleType(dptObj, range, dpt, type, role) {
169
169
  // is there a scalar range? eg. DPT5.003 angle degrees (0=0, ff=360)
170
- if (!!dptObj && dptObj.subtype && dptObj.subtype.scalar_range) {
170
+ if (dptObj?.subtype?.scalar_range) {
171
171
  range = dptObj.subtype.scalar_range;
172
- } else if (!!dptObj && dptObj.scalar_range) {
172
+ } else if (dptObj?.scalar_range) {
173
173
  range = dptObj.scalar_range;
174
- } else if (!!dptObj && dptObj.subtype && dptObj.subtype.range) {
174
+ } else if (dptObj?.subtype?.range) {
175
175
  // just a plain numeric value, only check if within bounds
176
176
  range = dptObj.subtype.range;
177
- } else if (!!dptObj && dptObj.basetype && dptObj.basetype.range) {
177
+ } else if (dptObj?.basetype?.range) {
178
178
  // just a plain numeric value, only check if within bounds
179
179
  range = dptObj.basetype.range;
180
180
  } else if (!!dptObj && !tools.isEmptyObject(dptObj)) {
@@ -184,6 +184,7 @@ module.exports = {
184
184
  //unknown dpt, range unknown
185
185
  range = [];
186
186
  }
187
+ if (dptObj?.subtype?.enc) type = "enum";
187
188
 
188
189
  //correct range, set type and role based on dpt
189
190
  //obj.common.min is only allowed on obj.common.type "number" or "mixed"
@@ -191,6 +192,7 @@ module.exports = {
191
192
  // we convert knx date types in javascript Date with different size
192
193
  range[0] = undefined;
193
194
  range[1] = undefined;
195
+ console.assert(type == "", "number " + type);
194
196
  type = "number";
195
197
  role = "date";
196
198
  } else if (
@@ -199,15 +201,17 @@ module.exports = {
199
201
  dptObj.basetype &&
200
202
  dptObj.basetype.valuetype == "composite"
201
203
  ) {
204
+ console.assert(type == "", "object " + type);
202
205
  type = "object";
203
206
  } else if (!!dptObj && !tools.isEmptyObject(dptObj) && dptObj.basetype && dptObj.basetype.bitlength == 1) {
204
- type = "boolean";
207
+ if (type != "enum") type = "boolean";
205
208
  role = "switch";
206
209
  range[0] = false;
207
210
  range[1] = true;
208
211
  } else if (tools.isStringDPT(dpt)) {
209
212
  range[0] = undefined;
210
213
  range[1] = undefined;
214
+ console.assert(type == "", "string " + type);
211
215
  type = "string";
212
216
  role = "text";
213
217
  } else if (tools.isFloatDPT(dpt)) {
package/main.js CHANGED
@@ -79,7 +79,7 @@ class openknx extends utils.Adapter {
79
79
  async onReady() {
80
80
  // adapter initialization
81
81
 
82
- this.getSentry()?.Sentry.init({
82
+ this.getSentry()?.Sentry?.init({
83
83
  //"development" or "production"
84
84
  //environment: "production",
85
85
  });
@@ -383,14 +383,15 @@ class openknx extends utils.Adapter {
383
383
  //plausibilize against configured datatype
384
384
  if (this.gaList.getDataById(id).common && this.gaList.getDataById(id).common.type == "boolean") {
385
385
  knxVal = knxVal ? true : false;
386
- } else if (this.gaList.getDataById(id).common && this.gaList.getDataById(id).common.type == "number") {
386
+ } else if (
387
+ this.gaList?.getDataById(id)?.common?.type == "number" ||
388
+ this.gaList?.getDataById(id)?.common?.type == "enum"
389
+ ) {
387
390
  if (isNaN(Number(knxVal))) {
388
391
  this.log.warn("Value " + knxVal + " for " + id + " is not a number");
389
392
  }
390
393
  // else take plain value
391
- }
392
- //convert val into object for certain dpts
393
- else if (tools.isDateDPT(dpt)) {
394
+ } else if (tools.isDateDPT(dpt)) {
394
395
  //before composite check, date is possibly composite
395
396
  knxVal = new Date(knxVal);
396
397
  } else if (this.gaList.getDataById(id).native.valuetype == "composite") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.openknx",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "ioBroker knx Adapter",
5
5
  "author": "boellner",
6
6
  "homepage": "https://github.com/iobroker-community-adapters/ioBroker.openknx.git",