iobroker.openknx 0.1.19 → 0.1.22
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 +16 -1
- package/admin/index_m.html +3 -5
- package/io-package.json +2 -2
- package/lib/knx/src/dptlib/dpt12.js +35 -9
- package/lib/knx/src/dptlib/dpt14.js +206 -126
- package/lib/knx/src/dptlib/dpt3.js +1 -1
- package/lib/knx/src/dptlib/dpt8.js +3 -3
- package/lib/knx/src/dptlib/index.js +2 -2
- package/lib/projectImport.js +16 -16
- package/lib/projectImport.test.js +17 -9
- package/main.js +62 -50
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -305,7 +305,22 @@ Data is sent to Iobroker Sentry server hosted in Germany. If you have allowed io
|
|
|
305
305
|
- only IPv4 supported
|
|
306
306
|
|
|
307
307
|
## Changelog
|
|
308
|
-
### 0.1.
|
|
308
|
+
### 0.1.22 (2022-02-26)
|
|
309
|
+
* bufix: repair reception error
|
|
310
|
+
|
|
311
|
+
### 0.1.21 (2022-02-25)
|
|
312
|
+
* feature: dont sent ack request in ldata.ind, this is disturbing clients if not filtered out by gateway
|
|
313
|
+
* bugfix: reinit if event received before connection established to avoid deadlock
|
|
314
|
+
* dependency:adapter core must be 2.6.0 or higher
|
|
315
|
+
|
|
316
|
+
### 0.1.20 (2022-02-19)
|
|
317
|
+
* feature: add more dpts
|
|
318
|
+
* bugfix: corrected some min max values
|
|
319
|
+
* bugfix: some unhandeled dpts could not be received
|
|
320
|
+
* bugfix: fix import
|
|
321
|
+
* bugfix: min max values
|
|
322
|
+
|
|
323
|
+
### 0.1.19 (2022-02-11)
|
|
309
324
|
* feature: allow usage of same KNX GAs in multiple objects
|
|
310
325
|
* bugfix: less warnings in alias generation
|
|
311
326
|
* bugfix: adapter reset after project import
|
package/admin/index_m.html
CHANGED
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
if (settings.gwipport === undefined) settings.gwipport = 3671;
|
|
79
79
|
if (settings.minimumDelay === undefined) settings.minimumDelay = 50;
|
|
80
80
|
if (settings.eibadr === undefined) settings.eibadr = "1.1.1";
|
|
81
|
-
|
|
81
|
+
|
|
82
82
|
if (settings.onlyAddNewObjects === undefined) settings.onlyAddNewObjects = false;
|
|
83
83
|
if (settings.localInterface === undefined) settings.localInterface = "";
|
|
84
84
|
|
|
@@ -236,13 +236,11 @@
|
|
|
236
236
|
message = `Extracted ${result.count} states successfully<br/><br/>\n${result.error}`
|
|
237
237
|
}
|
|
238
238
|
showMessage(_(message));
|
|
239
|
-
sendTo(null, "restart", null);
|
|
240
|
-
showToast(null, _("Restarting adapter"), null, 10000);
|
|
241
239
|
} else {
|
|
242
240
|
showMessage(_("Extracted %s states successfully", result.count));
|
|
243
|
-
sendTo(null, "restart", null);
|
|
244
|
-
showToast(null, _("Restarting adapter"), null, 10000);
|
|
245
241
|
}
|
|
242
|
+
sendTo(null, "restart", null);
|
|
243
|
+
showToast(null, _("Restarting adapter"), null, 10000);
|
|
246
244
|
window.isProcessingRequest = false;
|
|
247
245
|
});
|
|
248
246
|
});
|
package/io-package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* knx.js - a KNX protocol stack in pure Javascript
|
|
3
|
-
* (C) 2016-2018 Elias Karakoulakis
|
|
4
|
-
*/
|
|
2
|
+
* knx.js - a KNX protocol stack in pure Javascript
|
|
3
|
+
* (C) 2016-2018 Elias Karakoulakis
|
|
4
|
+
*/
|
|
5
5
|
|
|
6
6
|
//
|
|
7
7
|
// DPT12.*: 4-byte unsigned value
|
|
@@ -10,16 +10,42 @@
|
|
|
10
10
|
|
|
11
11
|
// DPT12 base type info
|
|
12
12
|
exports.basetype = {
|
|
13
|
-
bitlength
|
|
13
|
+
bitlength: 32,
|
|
14
14
|
signedness: "unsigned",
|
|
15
|
-
valuetype
|
|
16
|
-
desc
|
|
15
|
+
valuetype: "basic",
|
|
16
|
+
desc: "4-byte unsigned value"
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
// DPT12 subtype info
|
|
20
20
|
exports.subtypes = {
|
|
21
21
|
// 12.001 counter pulses
|
|
22
|
-
"001"
|
|
23
|
-
"name"
|
|
22
|
+
"001": {
|
|
23
|
+
"name": "DPT_Value_4_Ucount",
|
|
24
|
+
"desc": "Counter pulses",
|
|
25
|
+
},
|
|
26
|
+
"100": {
|
|
27
|
+
"name": "DPT_LongTimePeriod_Sec",
|
|
28
|
+
"desc": "Counter timesec (s)",
|
|
29
|
+
"unit" : "s"
|
|
30
|
+
},
|
|
31
|
+
"101": {
|
|
32
|
+
"name": "DPT_LongTimePeriod_Min",
|
|
33
|
+
"desc": "Counter timemin (min)",
|
|
34
|
+
"unit" : "min"
|
|
35
|
+
},
|
|
36
|
+
"102": {
|
|
37
|
+
"name": "DPT_LongTimePeriod_Hrs",
|
|
38
|
+
"desc": "Counter timehrs (h)",
|
|
39
|
+
"unit" : "h"
|
|
40
|
+
},
|
|
41
|
+
"1200": {
|
|
42
|
+
"name": "DPT_VolumeLiquid_Litre",
|
|
43
|
+
"desc": "Volume liquid (l)",
|
|
44
|
+
"unit" : "l"
|
|
45
|
+
},
|
|
46
|
+
"1201": {
|
|
47
|
+
"name": "DPT_Volume_m3",
|
|
48
|
+
"desc": "Volume m3",
|
|
49
|
+
"unit" : "m3"
|
|
24
50
|
}
|
|
25
|
-
}
|
|
51
|
+
}
|
|
@@ -36,130 +36,210 @@ exports.basetype = {
|
|
|
36
36
|
|
|
37
37
|
// DPT14 subtypes info
|
|
38
38
|
exports.subtypes = {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
name:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
desc:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
unit:
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
name:
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
desc:
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
unit:
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
name:
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
desc:
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
unit:
|
|
128
|
-
},
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
name:
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
desc:
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
unit:
|
|
158
|
-
},
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
name:
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
},
|
|
39
|
+
"007": {
|
|
40
|
+
"desc": "DPT_Value_AngleDeg°",
|
|
41
|
+
"name": "Angle, degree",
|
|
42
|
+
"unit": "°"
|
|
43
|
+
},
|
|
44
|
+
"019": {
|
|
45
|
+
"desc": "DPT_Value_Electric_Current",
|
|
46
|
+
"name": "Electric current",
|
|
47
|
+
"unit": "A"
|
|
48
|
+
},
|
|
49
|
+
"027": {
|
|
50
|
+
"desc": "DPT_Value_Electric_Potential",
|
|
51
|
+
"name": "Electric potential",
|
|
52
|
+
"unit": "V"
|
|
53
|
+
},
|
|
54
|
+
"028": {
|
|
55
|
+
"desc": "DPT_Value_Electric_PotentialDifference",
|
|
56
|
+
"name": "Electric potential difference",
|
|
57
|
+
"unit": "V"
|
|
58
|
+
},
|
|
59
|
+
"031": {
|
|
60
|
+
"desc": "DPT_Value_Energ",
|
|
61
|
+
"name": "Energy",
|
|
62
|
+
"unit": "J"
|
|
63
|
+
},
|
|
64
|
+
"032": {
|
|
65
|
+
"desc": "DPT_Value_Force",
|
|
66
|
+
"name": "Force",
|
|
67
|
+
"unit": "N"
|
|
68
|
+
},
|
|
69
|
+
"033": {
|
|
70
|
+
"desc": "DPT_Value_Frequency",
|
|
71
|
+
"name": "Frequency",
|
|
72
|
+
"unit": "Hz"
|
|
73
|
+
},
|
|
74
|
+
"036": {
|
|
75
|
+
"desc": "DPT_Value_Heat_FlowRate",
|
|
76
|
+
"name": "Heat flow rate",
|
|
77
|
+
"unit": "W"
|
|
78
|
+
},
|
|
79
|
+
"037": {
|
|
80
|
+
"desc": "DPT_Value_Heat_Quantity",
|
|
81
|
+
"name": "Heat, quantity of",
|
|
82
|
+
"unit": "J"
|
|
83
|
+
},
|
|
84
|
+
"038": {
|
|
85
|
+
"desc": "DPT_Value_Impedance",
|
|
86
|
+
"name": "Impedance",
|
|
87
|
+
"unit": "Ω"
|
|
88
|
+
},
|
|
89
|
+
"039": {
|
|
90
|
+
"desc": "DPT_Value_Length",
|
|
91
|
+
"name": "Length",
|
|
92
|
+
"unit": "m"
|
|
93
|
+
},
|
|
94
|
+
"051": {
|
|
95
|
+
"desc": "DPT_Value_Mass",
|
|
96
|
+
"name": "Mass",
|
|
97
|
+
"unit": "kg"
|
|
98
|
+
},
|
|
99
|
+
"056": {
|
|
100
|
+
"desc": "DPT_Value_Power",
|
|
101
|
+
"name": "Power",
|
|
102
|
+
"unit": "W"
|
|
103
|
+
},
|
|
104
|
+
"057": {
|
|
105
|
+
"desc": "DPT_Value_Power_Factor",
|
|
106
|
+
"name": "Power factor",
|
|
107
|
+
"unit": "cos Φ"
|
|
108
|
+
},
|
|
109
|
+
"058": {
|
|
110
|
+
"desc": "DPT_Value_Pressure",
|
|
111
|
+
"name": "Pressure (Pa)",
|
|
112
|
+
"unit": "Pa"
|
|
113
|
+
},
|
|
114
|
+
"065": {
|
|
115
|
+
"desc": "DPT_Value_Speed",
|
|
116
|
+
"name": "Speed",
|
|
117
|
+
"unit": "m/s"
|
|
118
|
+
},
|
|
119
|
+
"066": {
|
|
120
|
+
"desc": "DPT_Value_Stress",
|
|
121
|
+
"name": "Stress",
|
|
122
|
+
"unit": "Pa"
|
|
123
|
+
},
|
|
124
|
+
"067": {
|
|
125
|
+
"desc": "DPT_Value_Surface_Tension",
|
|
126
|
+
"name": "Surface tension",
|
|
127
|
+
"unit": "1/Nm"
|
|
128
|
+
},
|
|
129
|
+
"068": {
|
|
130
|
+
"desc": "DPT_Value_Common_Temperature",
|
|
131
|
+
"name": "Temperature, common",
|
|
132
|
+
"unit": "°C"
|
|
133
|
+
},
|
|
134
|
+
"069": {
|
|
135
|
+
"desc": "DPT_Value_Absolute_Temperature",
|
|
136
|
+
"name": "Temperature (absolute)",
|
|
137
|
+
"unit": "K"
|
|
138
|
+
},
|
|
139
|
+
"070": {
|
|
140
|
+
"desc": "DPT_Value_TemperatureDifference",
|
|
141
|
+
"name": "Temperature difference",
|
|
142
|
+
"unit": "K"
|
|
143
|
+
},
|
|
144
|
+
"074": {
|
|
145
|
+
"desc": "DDPT_Value_Time",
|
|
146
|
+
"name": "Time",
|
|
147
|
+
"unit": "s"
|
|
148
|
+
},
|
|
149
|
+
"076": {
|
|
150
|
+
"desc": "DPT_Value_Volume",
|
|
151
|
+
"name": "Volume",
|
|
152
|
+
"unit": "m3"
|
|
153
|
+
},
|
|
154
|
+
"078": {
|
|
155
|
+
"desc": "DPT_Value_Weight",
|
|
156
|
+
"name": "Weight",
|
|
157
|
+
"unit": "N"
|
|
158
|
+
},
|
|
159
|
+
"079": {
|
|
160
|
+
"desc": "DPT_Value_Work",
|
|
161
|
+
"name": "Work",
|
|
162
|
+
"unit": "J"
|
|
163
|
+
}
|
|
165
164
|
};
|
|
165
|
+
|
|
166
|
+
/*
|
|
167
|
+
todo
|
|
168
|
+
14.000 F32 DPT_Value_Acceleration
|
|
169
|
+
14.001 F32 DPT_Value_Acceleration_Angular
|
|
170
|
+
14.002 F32 DPT_Value_Activation_Energy
|
|
171
|
+
14.003 F32 DPT_Value_Activity
|
|
172
|
+
14.004 F32 DPT_Value_Mol
|
|
173
|
+
14.005 F32 DPT_Value_Amplitude
|
|
174
|
+
14.006 F32 DPT_Value_AngleRad
|
|
175
|
+
14.007 F32 DPT_Value_AngleDeg
|
|
176
|
+
14.008 F32 DPT_Value_Angular_Momentum
|
|
177
|
+
14.009 F32 DPT_Value_Angular_Velocity
|
|
178
|
+
14.010 F32 DPT_Value_Area
|
|
179
|
+
14.011 F32 DPT_Value_Capacitance
|
|
180
|
+
14.012 F32 DPT_Value_Charge_DensitySurface
|
|
181
|
+
14.013 F32 DPT_Value_Charge_DensityVolume
|
|
182
|
+
14.014 F32 DPT_Value_Compressibility
|
|
183
|
+
14.015 F32 DPT_Value_Conductance
|
|
184
|
+
14.016 F32 DPT_Value_Electrical_Conductivity
|
|
185
|
+
14.017 F32 DPT_Value_Density
|
|
186
|
+
14.018 F32 DPT_Value_Electric_Charge
|
|
187
|
+
14.019 F32 DPT_Value_Electric_Current
|
|
188
|
+
14.020 F32 DPT_Value_Electric_CurrentDensity
|
|
189
|
+
14.021 F32 DPT_Value_Electric_DipoleMoment
|
|
190
|
+
14.022 F32 DPT_Value_Electric_Displacement
|
|
191
|
+
14.023 F32 DPT_Value_Electric_FieldStrength
|
|
192
|
+
14.024 F32 DPT_Value_Electric_Flux
|
|
193
|
+
14.025 F32 DPT_Value_Electric_FluxDensity
|
|
194
|
+
14.026 F32 DPT_Value_Electric_Polarization
|
|
195
|
+
14.027 F32 DPT_Value_Electric_Potential
|
|
196
|
+
14.028 F32 DPT_Value_Electric_PotentialDifference
|
|
197
|
+
14.029 F32 DPT_Value_ElectromagneticMoment
|
|
198
|
+
14.030 F32 DPT_Value_Electromotive_Force
|
|
199
|
+
14.031 F32 DPT_Value_Energy
|
|
200
|
+
14.032 F32 DPT_Value_Force
|
|
201
|
+
14.033 F32 DPT_Value_Frequency
|
|
202
|
+
14.034 F32 DPT_Value_Angular_Frequency
|
|
203
|
+
14.035 F32 DPT_Value_Heat_Capacity
|
|
204
|
+
14.036 F32 DPT_Value_Heat_FlowRate
|
|
205
|
+
14.037 F32 DPT_Value_Heat_Quantity
|
|
206
|
+
14.038 F32 DPT_Value_Impedance
|
|
207
|
+
14.039 F32 DPT_Value_Length
|
|
208
|
+
14.040 F32 DPT_Value_Light_Quantity
|
|
209
|
+
14.041 F32 DPT_Value_Luminance
|
|
210
|
+
14.042 F32 DPT_Value_Luminous_Flux
|
|
211
|
+
14.043 F32 DPT_Value_Luminous_Intensity
|
|
212
|
+
14.044 F32 DPT_Value_Magnetic_FieldStrength
|
|
213
|
+
14.045 F32 DPT_Value_Magnetic_Flux
|
|
214
|
+
14.046 F32 DPT_Value_Magnetic_FluxDensity
|
|
215
|
+
14.047 F32 DPT_Value_Magnetic_Moment
|
|
216
|
+
14.048 F32 DPT_Value_Magnetic_Polarization
|
|
217
|
+
14.049 F32 DPT_Value_Magnetization
|
|
218
|
+
14.050 F32 DPT_Value_MagnetomotiveForce
|
|
219
|
+
14.051 F32 DPT_Value_Mass
|
|
220
|
+
14.052 F32 DPT_Value_MassFlux
|
|
221
|
+
14.053 F32 DPT_Value_Momentum
|
|
222
|
+
14.054 F32 DPT_Value_Phase_AngleRad
|
|
223
|
+
14.055 F32 DPT_Value_Phase_AngleDeg
|
|
224
|
+
14.056 F32 DPT_Value_Power
|
|
225
|
+
14.057 F32 DPT_Value_Power_Factor
|
|
226
|
+
14.058 F32 DPT_Value_Pressure
|
|
227
|
+
14.059 F32 DPT_Value_Reactance
|
|
228
|
+
14.060 F32 DPT_Value_Resistance
|
|
229
|
+
14.061 F32 DPT_Value_Resistivity
|
|
230
|
+
14.062 F32 DPT_Value_SelfInductance
|
|
231
|
+
14.063 F32 DPT_Value_SolidAngle
|
|
232
|
+
14.064 F32 DPT_Value_Sound_Intensity
|
|
233
|
+
14.065 F32 DPT_Value_Speed
|
|
234
|
+
14.066 F32 DPT_Value_Stress
|
|
235
|
+
14.067 F32 DPT_Value_Surface_Tension
|
|
236
|
+
14.068 F32 DPT_Value_Common_Temperature
|
|
237
|
+
14.069 F32 DPT_Value_Absolute_Temperature
|
|
238
|
+
14.070 F32 DPT_Value_TemperatureDifference
|
|
239
|
+
14.071 F32 DPT_Value_Thermal_Capacity
|
|
240
|
+
14.072 F32 DPT_Value_Thermal_Conductivity
|
|
241
|
+
14.073 F32 DPT_Value_ThermoelectricPower
|
|
242
|
+
14.074 F32 DPT_Value_Time
|
|
243
|
+
14.075 F32 DPT_Value_Torque
|
|
244
|
+
14.076 F32 DPT_Value_Volume
|
|
245
|
+
*/
|
|
@@ -18,7 +18,7 @@ exports.formatAPDU = (value) => {
|
|
|
18
18
|
)
|
|
19
19
|
return Buffer.from([(value.decr_incr << 3) + (value.data & 0b00000111)]);
|
|
20
20
|
|
|
21
|
-
log.error('Must supply a value object of {decr_incr, data}');
|
|
21
|
+
log.error('DPT3: Must supply a value object of {decr_incr, data}');
|
|
22
22
|
// FIXME: should this return zero buffer when error? Or nothing?
|
|
23
23
|
return Buffer.from([0]);
|
|
24
24
|
};
|
|
@@ -50,21 +50,21 @@ exports.subtypes = {
|
|
|
50
50
|
"005" : {
|
|
51
51
|
"name" : "DPT_DeltaTimeSec",
|
|
52
52
|
"desc" : "time lag(s)",
|
|
53
|
-
"unit" : "
|
|
53
|
+
"unit" : "s"
|
|
54
54
|
},
|
|
55
55
|
|
|
56
56
|
// 8.006 time lag (min)
|
|
57
57
|
"006" : {
|
|
58
58
|
"name" : "DPT_DeltaTimeMin",
|
|
59
59
|
"desc" : "time lag(min)",
|
|
60
|
-
"unit" : "
|
|
60
|
+
"unit" : "min"
|
|
61
61
|
},
|
|
62
62
|
|
|
63
63
|
// 8.007 time lag (hour)
|
|
64
64
|
"007" : {
|
|
65
65
|
"name" : "DPT_DeltaTimeHrs",
|
|
66
66
|
"desc" : "time lag(hrs)",
|
|
67
|
-
"unit" : "
|
|
67
|
+
"unit" : "h"
|
|
68
68
|
},
|
|
69
69
|
|
|
70
70
|
// 8.010 percentage difference (%)
|
|
@@ -181,8 +181,8 @@ dpts.fromBuffer = (buf, dpt) => {
|
|
|
181
181
|
|
|
182
182
|
// log.trace(' ../knx/src/index.js : DPT : ' + JSON.stringify(dpt)); // for exploring dpt and implementing description
|
|
183
183
|
if (
|
|
184
|
-
dpt.
|
|
185
|
-
dpt.subtype.
|
|
184
|
+
dpt.subtype != undefined &&
|
|
185
|
+
dpt.subtype.scalar_range != undefined
|
|
186
186
|
) {
|
|
187
187
|
const [r_min, r_max] = dpt.basetype.hasOwnProperty('range') ?
|
|
188
188
|
dpt.basetype.range :
|
package/lib/projectImport.js
CHANGED
|
@@ -82,7 +82,7 @@ module.exports = {
|
|
|
82
82
|
range,
|
|
83
83
|
type,
|
|
84
84
|
role
|
|
85
|
-
} =
|
|
85
|
+
} = identifyRangeRoleType(dptObj, range, dpt, type, role));
|
|
86
86
|
|
|
87
87
|
//if dpt is for sure not a status, remove from autoread
|
|
88
88
|
autoread = !tools.isTriggerDPT(dpt);
|
|
@@ -97,8 +97,8 @@ module.exports = {
|
|
|
97
97
|
"raw value" :
|
|
98
98
|
dptObj.basetype.desc +
|
|
99
99
|
(Object.prototype.hasOwnProperty.call(dptObj, "subtype") && Object.prototype.hasOwnProperty.call(dptObj, "desc") ? ", Subtype: " + dptObj.subtype.desc : "")),
|
|
100
|
-
min: range[0],
|
|
101
|
-
max: range[1],
|
|
100
|
+
...(range[0] != null && { min: range[0] }),
|
|
101
|
+
...(range[1] != null && { max: range[1] }),
|
|
102
102
|
name: gaName,
|
|
103
103
|
read: true,
|
|
104
104
|
role: role, //description: https://github.com/ioBroker/ioBroker/blob/master/doc/STATE_ROLES.md#state-roles
|
|
@@ -115,17 +115,17 @@ module.exports = {
|
|
|
115
115
|
dpt: dpt,
|
|
116
116
|
encoding:
|
|
117
117
|
!!dptObj && Object.prototype.hasOwnProperty.call(dptObj, "subtype") ?
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
Object.prototype.hasOwnProperty.call(dptObj, "enc") ?
|
|
119
|
+
dptObj.subtype.enc :
|
|
120
|
+
dptObj.basetype.enc : undefined, //informative
|
|
121
121
|
force_encoding:
|
|
122
122
|
!!dptObj && Object.prototype.hasOwnProperty.call(dptObj, "subtype") && Object.prototype.hasOwnProperty.call(dptObj, "subtype") && dptObj.subtype ?
|
|
123
|
-
|
|
123
|
+
dptObj.subtype.force_encoding : undefined, //DPT16
|
|
124
124
|
signedness:
|
|
125
125
|
!!dptObj && !tools.isEmptyObject(dptObj) ?
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
Object.prototype.hasOwnProperty.call(dptObj, "signedness") && dptObj.basetype ?
|
|
127
|
+
dptObj.basetype.signedness :
|
|
128
|
+
undefined : undefined, //signed or unsigned or empty
|
|
129
129
|
valuetype: !dptObj || tools.isEmptyObject(dptObj) ? undefined : dptObj.basetype.valuetype, //informative: composite or basic
|
|
130
130
|
},
|
|
131
131
|
};
|
|
@@ -154,7 +154,7 @@ module.exports = {
|
|
|
154
154
|
return fullPath;
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
function
|
|
157
|
+
function identifyRangeRoleType(dptObj, range, dpt, type, role) {
|
|
158
158
|
// is there a scalar range? eg. DPT5.003 angle degrees (0=0, ff=360)
|
|
159
159
|
if (!!dptObj && dptObj.subtype && dptObj.subtype.scalar_range) {
|
|
160
160
|
range = dptObj.subtype.scalar_range;
|
|
@@ -171,9 +171,11 @@ module.exports = {
|
|
|
171
171
|
range = [0, Math.pow(2, dptObj.basetype.bitlength) - 1];
|
|
172
172
|
} else {
|
|
173
173
|
//unknown dpt, range unknown
|
|
174
|
+
range = [];
|
|
174
175
|
}
|
|
175
176
|
|
|
176
177
|
//correct range, set type and role based on dpt
|
|
178
|
+
//obj.common.min is only allowed on obj.common.type "number" or "mixed"
|
|
177
179
|
if (tools.isDateDPT(dpt)) {
|
|
178
180
|
// we convert knx date types in javascript Date with different size
|
|
179
181
|
range[0] = undefined;
|
|
@@ -181,14 +183,12 @@ module.exports = {
|
|
|
181
183
|
type = "number";
|
|
182
184
|
role = "date";
|
|
183
185
|
} else if (!!dptObj && !tools.isEmptyObject(dptObj) && dptObj.basetype && dptObj.basetype.valuetype == "composite") {
|
|
184
|
-
range[0] = undefined;
|
|
185
|
-
range[1] = undefined;
|
|
186
186
|
type = "object";
|
|
187
187
|
} else if (!!dptObj && !tools.isEmptyObject(dptObj) && dptObj.basetype && dptObj.basetype.bitlength == 1) {
|
|
188
188
|
type = "boolean";
|
|
189
189
|
role = "switch";
|
|
190
|
-
range[0] =
|
|
191
|
-
range[1] =
|
|
190
|
+
range[0] = false;
|
|
191
|
+
range[1] = true;
|
|
192
192
|
} else if (tools.isStringDPT(dpt)) {
|
|
193
193
|
range[0] = undefined;
|
|
194
194
|
range[1] = undefined;
|
|
@@ -253,7 +253,7 @@ module.exports = {
|
|
|
253
253
|
const statusDpt = gaList.getDataById(statusElement).native.dpt;
|
|
254
254
|
const nonStatusDpt = gaList.getDataById(nonStatusElement).native.dpt;
|
|
255
255
|
|
|
256
|
-
if ((statusDpt != nonStatusDpt) &&
|
|
256
|
+
if ((statusDpt != nonStatusDpt) && (nonStatusDpt.split(".")[0] != "DPT1" || statusDpt.split(".")[0] != "DPT1")) {
|
|
257
257
|
//if both are dpt1 treat as equal
|
|
258
258
|
const text = "create aliases: " + gaList.getDataById(statusElement).native.dpt + " does not match " + gaList.getDataById(nonStatusElement).native.dpt + ", consider defining a conversion function in the alias object if needed";
|
|
259
259
|
adapter.log.info(text);
|