iobroker-ucl 1.3.1 → 1.3.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/homematicFunctions.js +2 -0
- package/homematicFunctions.ts +47 -45
- package/html.js +10 -10
- package/html.ts +29 -29
- package/package.json +1 -1
- package/shellyClasses.ts +16 -16
- package/shellyFunctions.js +7 -0
- package/shellyFunctions.ts +49 -42
- package/zigbeeClasses.ts +28 -28
- package/zigbeeFunctions.js +4 -0
- package/zigbeeFunctions.ts +56 -52
package/zigbeeClasses.ts
CHANGED
@@ -56,9 +56,9 @@ export abstract class AbstractZigbee {
|
|
56
56
|
}
|
57
57
|
|
58
58
|
public getType(): string {
|
59
|
-
|
60
|
-
|
61
|
-
|
59
|
+
let result = "";
|
60
|
+
let m1 = this.adapter.getObject(this.baseState).native.manufacturername;
|
61
|
+
let m2 = this.adapter.getObject(this.baseState).native.modelid;
|
62
62
|
if (m1 != undefined && m2 != undefined) {
|
63
63
|
result += m1;
|
64
64
|
}
|
@@ -86,7 +86,7 @@ export abstract class AbstractZigbee {
|
|
86
86
|
|
87
87
|
// Level:
|
88
88
|
// ----------------------------------------------------------------------------------
|
89
|
-
|
89
|
+
let alexaLampeLevel = "0_userdata.0.alexa." + smartName + ".level";
|
90
90
|
this.adapter.createState(alexaLampeLevel, 0, {
|
91
91
|
name: alexaLampeLevel,
|
92
92
|
desc: alexaLampeLevel,
|
@@ -115,7 +115,7 @@ export abstract class AbstractZigbee {
|
|
115
115
|
|
116
116
|
// HUE:
|
117
117
|
// ----------------------------------------------------------------------------------
|
118
|
-
|
118
|
+
let alexaLampeHue = "0_userdata.0.alexa." + smartName + ".hue";
|
119
119
|
this.adapter.createState(alexaLampeHue, 0, {
|
120
120
|
name: alexaLampeHue,
|
121
121
|
desc: alexaLampeHue,
|
@@ -141,7 +141,7 @@ export abstract class AbstractZigbee {
|
|
141
141
|
|
142
142
|
// SAT:
|
143
143
|
// ----------------------------------------------------------------------------------
|
144
|
-
|
144
|
+
let alexaLampeSat = "0_userdata.0.alexa." + smartName + ".sat";
|
145
145
|
this.adapter.createState(alexaLampeSat, 0, {
|
146
146
|
name: alexaLampeSat,
|
147
147
|
desc: alexaLampeSat,
|
@@ -167,7 +167,7 @@ export abstract class AbstractZigbee {
|
|
167
167
|
|
168
168
|
// CT:
|
169
169
|
// ----------------------------------------------------------------------------------
|
170
|
-
|
170
|
+
let alexaLampeCT = "0_userdata.0.alexa." + smartName + ".ct";
|
171
171
|
this.adapter.createState(alexaLampeCT, 0, {
|
172
172
|
name: alexaLampeCT,
|
173
173
|
desc: alexaLampeCT,
|
@@ -353,7 +353,7 @@ export class ZigbeeLampeRGB extends AbstractZigbee {
|
|
353
353
|
if (this.isGroup_ == false) {
|
354
354
|
this.createAlias(this.getBaseState() + ".reachable", "alias.0.rgb." + this.getDeviceId() + ".reachable");
|
355
355
|
} else {
|
356
|
-
|
356
|
+
let groupReachable = "0_userdata.0.rgb." + this.getDeviceId() + ".reachable";
|
357
357
|
this.adapter.createState(groupReachable, true, {
|
358
358
|
name: groupReachable,
|
359
359
|
desc: groupReachable,
|
@@ -400,7 +400,7 @@ export class ZigbeeLampeRGB extends AbstractZigbee {
|
|
400
400
|
}
|
401
401
|
|
402
402
|
private createState(key_in) {
|
403
|
-
|
403
|
+
let jarvisDatenpunkt = key_in;//.replace(/\./g,'_'); // wegen Wohnzimmer T.V.
|
404
404
|
//log(">>> CREATE STATE: " + jarvisDatenpunkt);
|
405
405
|
this.adapter.createState(jarvisDatenpunkt, false, {
|
406
406
|
name: jarvisDatenpunkt,
|
@@ -462,7 +462,7 @@ export class ZigbeeLampeRGB extends AbstractZigbee {
|
|
462
462
|
}
|
463
463
|
|
464
464
|
public getAlexaNamesForOnAsString(): string {
|
465
|
-
|
465
|
+
let result = "";
|
466
466
|
|
467
467
|
this.alexaSmartNamesForOn.forEach(alexaOnName => {
|
468
468
|
if (result == "") {
|
@@ -483,7 +483,7 @@ export class ZigbeeLampeRGB extends AbstractZigbee {
|
|
483
483
|
}
|
484
484
|
|
485
485
|
public getAlexaNamesForOffAsString(): string {
|
486
|
-
|
486
|
+
let result = "";
|
487
487
|
|
488
488
|
this.alexaSmartNamesForOff.forEach(alexaOffName => {
|
489
489
|
if (result == "") {
|
@@ -725,7 +725,7 @@ export class ZigbeeLampeWeiss extends AbstractZigbee {
|
|
725
725
|
}
|
726
726
|
|
727
727
|
public getAlexaNamesForOnAsString(): string {
|
728
|
-
|
728
|
+
let result = "";
|
729
729
|
|
730
730
|
this.alexaSmartNamesForOn.forEach(alexaOnName => {
|
731
731
|
if (result == "") {
|
@@ -746,7 +746,7 @@ export class ZigbeeLampeWeiss extends AbstractZigbee {
|
|
746
746
|
}
|
747
747
|
|
748
748
|
public getAlexaNamesForOffAsString(): string {
|
749
|
-
|
749
|
+
let result = "";
|
750
750
|
|
751
751
|
this.alexaSmartNamesForOff.forEach(alexaOffName => {
|
752
752
|
if (result == "") {
|
@@ -776,7 +776,7 @@ export class ZigbeeLampeWeiss extends AbstractZigbee {
|
|
776
776
|
}
|
777
777
|
|
778
778
|
private createState(key_in) {
|
779
|
-
|
779
|
+
let jarvisDatenpunkt = key_in;//.replace(/\./g,'_'); // wegen Wohnzimmer T.V.
|
780
780
|
//log(">>> CREATE STATE: " + jarvisDatenpunkt);
|
781
781
|
this.adapter.createState(jarvisDatenpunkt, false, {
|
782
782
|
name: jarvisDatenpunkt,
|
@@ -850,7 +850,7 @@ export class ZigbeeLampeWeiss extends AbstractZigbee {
|
|
850
850
|
|
851
851
|
export class ColorConverter {
|
852
852
|
public convertXY2HSL(x, y) {
|
853
|
-
|
853
|
+
let bri = 254;
|
854
854
|
let xy = {
|
855
855
|
x: x,
|
856
856
|
y: y
|
@@ -860,17 +860,17 @@ export class ColorConverter {
|
|
860
860
|
let Y = bri / 255;
|
861
861
|
let X = (Y / xy.y) * xy.x;
|
862
862
|
let Z = (Y / xy.y) * z;
|
863
|
-
|
864
|
-
|
865
|
-
|
863
|
+
let r = X * 1.656492 - Y * 0.354851 - Z * 0.255038;
|
864
|
+
let g = -X * 0.707196 + Y * 1.655397 + Z * 0.036152;
|
865
|
+
let b = X * 0.051713 - Y * 0.121364 + Z * 1.011530;
|
866
866
|
|
867
867
|
r = r <= 0.0031308 ? 12.92 * r : (1.0 + 0.055) * Math.pow(r, (1.0 / 2.4)) - 0.055;
|
868
868
|
g = g <= 0.0031308 ? 12.92 * g : (1.0 + 0.055) * Math.pow(g, (1.0 / 2.4)) - 0.055;
|
869
869
|
b = b <= 0.0031308 ? 12.92 * b : (1.0 + 0.055) * Math.pow(b, (1.0 / 2.4)) - 0.055;
|
870
870
|
|
871
|
-
|
872
|
-
|
873
|
-
|
871
|
+
let r_new = (r * 255).toString();
|
872
|
+
let g_new = (g * 255).toString();
|
873
|
+
let b_new = (b * 255).toString();
|
874
874
|
|
875
875
|
let red = parseInt(r_new) > 255 ? 255 : parseInt(r_new);
|
876
876
|
let green = parseInt(g_new) > 255 ? 255 : parseInt(g_new);
|
@@ -879,7 +879,7 @@ export class ColorConverter {
|
|
879
879
|
red = Math.abs(red);
|
880
880
|
green = Math.abs(green);
|
881
881
|
blue = Math.abs(blue);
|
882
|
-
|
882
|
+
let
|
883
883
|
min = Math.min(r, g, b),
|
884
884
|
max = Math.max(r, g, b),
|
885
885
|
delta = max - min,
|
@@ -907,7 +907,7 @@ export class ColorConverter {
|
|
907
907
|
}
|
908
908
|
|
909
909
|
public convertHSL2XY(h, s) {
|
910
|
-
|
910
|
+
let l = 50;
|
911
911
|
// Must be fractions of 1
|
912
912
|
s /= 100;
|
913
913
|
l /= 100;
|
@@ -1005,7 +1005,7 @@ export class ZigbeeSteckdose extends AbstractZigbee {
|
|
1005
1005
|
}
|
1006
1006
|
|
1007
1007
|
private createState(key_in) {
|
1008
|
-
|
1008
|
+
let jarvisDatenpunkt = key_in;//.replace(/\./g,'_'); // wegen Wohnzimmer T.V.
|
1009
1009
|
this.adapter.createState(jarvisDatenpunkt, false, {
|
1010
1010
|
name: jarvisDatenpunkt,
|
1011
1011
|
desc: jarvisDatenpunkt,
|
@@ -1055,7 +1055,7 @@ export class ZigbeeSteckdose extends AbstractZigbee {
|
|
1055
1055
|
}
|
1056
1056
|
|
1057
1057
|
public getAlexaNamesForOnAsString() : string {
|
1058
|
-
|
1058
|
+
let result = "";
|
1059
1059
|
|
1060
1060
|
this.alexaSmartNamesForOn.forEach(alexaOnName => {
|
1061
1061
|
if (result == "") {
|
@@ -1076,7 +1076,7 @@ export class ZigbeeSteckdose extends AbstractZigbee {
|
|
1076
1076
|
}
|
1077
1077
|
|
1078
1078
|
public getAlexaNamesForOffAsString() : string {
|
1079
|
-
|
1079
|
+
let result = "";
|
1080
1080
|
|
1081
1081
|
this.alexaSmartNamesForOff.forEach(alexaOffName => {
|
1082
1082
|
if (result == "") {
|
@@ -1133,7 +1133,7 @@ export class ZigbeeFenstersensor extends AbstractZigbee {
|
|
1133
1133
|
}
|
1134
1134
|
|
1135
1135
|
public isStatusReachable() : boolean {
|
1136
|
-
|
1136
|
+
let reachable = this.adapter.getState(this.baseState + ".reachable").val; // hue.0.Steckdose_Backstube.reachable
|
1137
1137
|
return reachable;
|
1138
1138
|
}
|
1139
1139
|
|
@@ -1160,7 +1160,7 @@ export class ZigbeeRauchmelder extends AbstractZigbee {
|
|
1160
1160
|
}
|
1161
1161
|
|
1162
1162
|
public isStatusReachable() : boolean {
|
1163
|
-
|
1163
|
+
let reachable = this.adapter.getState(this.baseState + ".reachable").val; // hue.0.Steckdose_Backstube.reachable
|
1164
1164
|
return reachable;
|
1165
1165
|
}
|
1166
1166
|
|
package/zigbeeFunctions.js
CHANGED
@@ -119,6 +119,7 @@ function createZigbeeDevice(adapter, rawId, baseState, etage, raum, device, cate
|
|
119
119
|
createDatenpunktSingle(adapter, rawId, attributeTypeString, attributeEtage, etage, category);
|
120
120
|
createDatenpunktSingle(adapter, rawId, attributeTypeString, attributeRaum, raum, category);
|
121
121
|
createDatenpunktSingle(adapter, rawId, attributeTypeString, attributeDevice, device, category);
|
122
|
+
this.clearZigbeeCaches();
|
122
123
|
}
|
123
124
|
exports.createZigbeeDevice = createZigbeeDevice;
|
124
125
|
// Dosenrelais:
|
@@ -222,6 +223,7 @@ function createZigbeeSteckdose(adapter, rawId, baseState, etage, raum, device, a
|
|
222
223
|
}
|
223
224
|
});
|
224
225
|
createDatenpunktSingle(adapter, rawId, attributeTypeString, attribute_TasterBooleanOff, db_additionalStates4TurnOff, deviceZigbeeSteckdose);
|
226
|
+
this.clearZigbeeCaches();
|
225
227
|
}
|
226
228
|
exports.createZigbeeSteckdose = createZigbeeSteckdose;
|
227
229
|
// LampeWeiss:
|
@@ -416,6 +418,7 @@ function createZigbeeLampeWeiss(adapter, rawId, baseState, etage, raum, device,
|
|
416
418
|
createDatenpunktSingle(adapter, rawId, attributeTypeNumber, attributeLampWeiss_ColorSchemes_Weiss4_level, null, deviceZigbeeLampeWeiss);
|
417
419
|
createDatenpunktSingle(adapter, rawId, attributeTypeNumber, attributeLampWeiss_ColorSchemes_Weiss4_ct, null, deviceZigbeeLampeWeiss);*/
|
418
420
|
}
|
421
|
+
this.clearZigbeeCaches();
|
419
422
|
}
|
420
423
|
exports.createZigbeeLampeWeiss = createZigbeeLampeWeiss;
|
421
424
|
// LampeRGB:
|
@@ -658,6 +661,7 @@ function createZigbeeLampeRGB(adapter, rawId, baseState, etage, raum, device, is
|
|
658
661
|
createDatenpunktSingle(adapter, rawId, attributeTypeNumber, attributeRGBLamp_ColorSchemes_Weiss4_level, null, category);
|
659
662
|
createDatenpunktSingle(adapter, rawId, attributeTypeNumber, attributeRGBLamp_ColorSchemes_Weiss4_ct, null, category);*/
|
660
663
|
}
|
664
|
+
this.clearZigbeeCaches();
|
661
665
|
}
|
662
666
|
exports.createZigbeeLampeRGB = createZigbeeLampeRGB;
|
663
667
|
function createDatenpunktSingle(adapter, deviceRawId, attributeType, attributeName, attributeValue, category) {
|
package/zigbeeFunctions.ts
CHANGED
@@ -142,6 +142,7 @@ export function createZigbeeDevice(adapter:any, rawId: number, baseState: string
|
|
142
142
|
createDatenpunktSingle(adapter, rawId, attributeTypeString, attributeEtage, etage, category);
|
143
143
|
createDatenpunktSingle(adapter, rawId, attributeTypeString, attributeRaum, raum, category);
|
144
144
|
createDatenpunktSingle(adapter, rawId, attributeTypeString, attributeDevice, device, category);
|
145
|
+
this.clearZigbeeCaches();
|
145
146
|
}
|
146
147
|
|
147
148
|
// Dosenrelais:
|
@@ -151,7 +152,7 @@ export function createZigbeeDosenrelais(adapter:any, rawId: number, baseState: s
|
|
151
152
|
createZigbeeDevice(adapter, rawId, baseState, etage, raum, device, deviceZigbeeDosenrelais);
|
152
153
|
|
153
154
|
// Spezifisch:
|
154
|
-
|
155
|
+
let db_smartNames = null;
|
155
156
|
smartNames.forEach(value => {
|
156
157
|
if (db_smartNames == null) {
|
157
158
|
// @ts-ignore
|
@@ -172,7 +173,7 @@ export function createZigbeeSteckdose(adapter:any, rawId: number, baseState: str
|
|
172
173
|
createZigbeeDevice(adapter, rawId, baseState, etage, raum, device, deviceZigbeeSteckdose);
|
173
174
|
|
174
175
|
// alexaSmartNamesForOn:string[]
|
175
|
-
|
176
|
+
let db_alexaSmartNamesForOn = null;
|
176
177
|
alexaSmartNamesForOn.forEach(value => {
|
177
178
|
if (db_alexaSmartNamesForOn == null) {
|
178
179
|
// @ts-ignore
|
@@ -185,7 +186,7 @@ export function createZigbeeSteckdose(adapter:any, rawId: number, baseState: str
|
|
185
186
|
createDatenpunktSingle(adapter, rawId, attributeTypeString, attribute_AlexaSmartNamesForOn, db_alexaSmartNamesForOn, deviceZigbeeSteckdose);
|
186
187
|
|
187
188
|
// alexaActionNamesForOn:string[]
|
188
|
-
|
189
|
+
let db_alexaActionNamesForOn = null;
|
189
190
|
alexaActionNamesForOn.forEach(value => {
|
190
191
|
if (db_alexaActionNamesForOn == null) {
|
191
192
|
// @ts-ignore
|
@@ -198,7 +199,7 @@ export function createZigbeeSteckdose(adapter:any, rawId: number, baseState: str
|
|
198
199
|
createDatenpunktSingle(adapter, rawId, attributeTypeString, attribute_AlexaActionNamesForOn, db_alexaActionNamesForOn, deviceZigbeeSteckdose);
|
199
200
|
|
200
201
|
// alexaSmartNamesForOff:string[]
|
201
|
-
|
202
|
+
let db_alexaSmartNamesForOff = null;
|
202
203
|
alexaSmartNamesForOff.forEach(value => {
|
203
204
|
if (db_alexaSmartNamesForOff == null) {
|
204
205
|
// @ts-ignore
|
@@ -211,7 +212,7 @@ export function createZigbeeSteckdose(adapter:any, rawId: number, baseState: str
|
|
211
212
|
createDatenpunktSingle(adapter, rawId, attributeTypeString, attribute_AlexaSmartNamesForOff, db_alexaSmartNamesForOff, deviceZigbeeSteckdose);
|
212
213
|
|
213
214
|
// alexaActionNamesForOff:string[]
|
214
|
-
|
215
|
+
let db_alexaActionNamesForOff = null;
|
215
216
|
alexaActionNamesForOff.forEach(value => {
|
216
217
|
if (db_alexaActionNamesForOff == null) {
|
217
218
|
// @ts-ignore
|
@@ -224,7 +225,7 @@ export function createZigbeeSteckdose(adapter:any, rawId: number, baseState: str
|
|
224
225
|
createDatenpunktSingle(adapter, rawId, attributeTypeString, attribute_AlexaActionNamesForOff, db_alexaActionNamesForOff, deviceZigbeeSteckdose);
|
225
226
|
|
226
227
|
// additionalStates4TurnOn: string[]
|
227
|
-
|
228
|
+
let db_additionalStates4TurnOn = null;
|
228
229
|
additionalStates4TurnOn.forEach(value => {
|
229
230
|
if (db_additionalStates4TurnOn == null) {
|
230
231
|
// @ts-ignore
|
@@ -237,7 +238,7 @@ export function createZigbeeSteckdose(adapter:any, rawId: number, baseState: str
|
|
237
238
|
createDatenpunktSingle(adapter, rawId, attributeTypeString, attribute_TasterBooleanOn, db_additionalStates4TurnOn, deviceZigbeeSteckdose);
|
238
239
|
|
239
240
|
// additionalStates4TurnOff: string[]
|
240
|
-
|
241
|
+
let db_additionalStates4TurnOff = null;
|
241
242
|
additionalStates4TurnOff.forEach(value => {
|
242
243
|
if (db_additionalStates4TurnOff == null) {
|
243
244
|
// @ts-ignore
|
@@ -248,6 +249,7 @@ export function createZigbeeSteckdose(adapter:any, rawId: number, baseState: str
|
|
248
249
|
}
|
249
250
|
});
|
250
251
|
createDatenpunktSingle(adapter, rawId, attributeTypeString, attribute_TasterBooleanOff, db_additionalStates4TurnOff, deviceZigbeeSteckdose);
|
252
|
+
this.clearZigbeeCaches();
|
251
253
|
}
|
252
254
|
|
253
255
|
// LampeWeiss:
|
@@ -263,7 +265,7 @@ export function createZigbeeLampeWeiss(adapter:any, rawId: number, baseState: st
|
|
263
265
|
createZigbeeDevice(adapter, rawId, baseState, etage, raum, device, deviceZigbeeLampeWeiss);
|
264
266
|
|
265
267
|
// alexaSmartNamesForOn:string[]
|
266
|
-
|
268
|
+
let db_alexaSmartNamesForOn = null;
|
267
269
|
alexaSmartNamesForOn.forEach(value => {
|
268
270
|
if (db_alexaSmartNamesForOn == null) {
|
269
271
|
// @ts-ignore
|
@@ -276,7 +278,7 @@ export function createZigbeeLampeWeiss(adapter:any, rawId: number, baseState: st
|
|
276
278
|
createDatenpunktSingle(adapter, rawId, attributeTypeString, attribute_AlexaSmartNamesForOn, db_alexaSmartNamesForOn, deviceZigbeeLampeWeiss);
|
277
279
|
|
278
280
|
// alexaActionNamesForOn:string[]
|
279
|
-
|
281
|
+
let db_alexaActionNamesForOn = null;
|
280
282
|
alexaActionNamesForOn.forEach(value => {
|
281
283
|
if (db_alexaActionNamesForOn == null) {
|
282
284
|
// @ts-ignore
|
@@ -289,7 +291,7 @@ export function createZigbeeLampeWeiss(adapter:any, rawId: number, baseState: st
|
|
289
291
|
createDatenpunktSingle(adapter, rawId, attributeTypeString, attribute_AlexaActionNamesForOn, db_alexaActionNamesForOn, deviceZigbeeLampeWeiss);
|
290
292
|
|
291
293
|
// alexaSmartNamesForOff:string[]
|
292
|
-
|
294
|
+
let db_alexaSmartNamesForOff = null;
|
293
295
|
alexaSmartNamesForOff.forEach(value => {
|
294
296
|
if (db_alexaSmartNamesForOff == null) {
|
295
297
|
// @ts-ignore
|
@@ -302,7 +304,7 @@ export function createZigbeeLampeWeiss(adapter:any, rawId: number, baseState: st
|
|
302
304
|
createDatenpunktSingle(adapter, rawId, attributeTypeString, attribute_AlexaSmartNamesForOff, db_alexaSmartNamesForOff, deviceZigbeeLampeWeiss);
|
303
305
|
|
304
306
|
// alexaActionNamesForOff:string[]
|
305
|
-
|
307
|
+
let db_alexaActionNamesForOff = null;
|
306
308
|
alexaActionNamesForOff.forEach(value => {
|
307
309
|
if (db_alexaActionNamesForOff == null) {
|
308
310
|
// @ts-ignore
|
@@ -367,7 +369,7 @@ export function createZigbeeLampeWeiss(adapter:any, rawId: number, baseState: st
|
|
367
369
|
}
|
368
370
|
|
369
371
|
// tasterBooleanOff: string[]
|
370
|
-
|
372
|
+
let db_tasterBooleanOff = null;
|
371
373
|
tasterBooleanOff.forEach(value => {
|
372
374
|
if (db_tasterBooleanOff == null) {
|
373
375
|
// @ts-ignore
|
@@ -451,6 +453,7 @@ export function createZigbeeLampeWeiss(adapter:any, rawId: number, baseState: st
|
|
451
453
|
createDatenpunktSingle(adapter, rawId, attributeTypeNumber, attributeLampWeiss_ColorSchemes_Weiss4_level, null, deviceZigbeeLampeWeiss);
|
452
454
|
createDatenpunktSingle(adapter, rawId, attributeTypeNumber, attributeLampWeiss_ColorSchemes_Weiss4_ct, null, deviceZigbeeLampeWeiss);*/
|
453
455
|
}
|
456
|
+
this.clearZigbeeCaches();
|
454
457
|
}
|
455
458
|
|
456
459
|
// LampeRGB:
|
@@ -461,7 +464,7 @@ export function createZigbeeLampeRGB(adapter:any, rawId: number, baseState: stri
|
|
461
464
|
tasterBooleanOn: string[], tasterBooleanOff: string[],nachtbeleuchtung:boolean, turnOffExitHouseSummer:boolean, turnOffExitHouseWinter:boolean,
|
462
465
|
turnOnEnterHouseSummer:boolean, turnOnEnterHouseWinter:boolean) {
|
463
466
|
|
464
|
-
|
467
|
+
let category: string = deviceZigbeeLampeRGB;
|
465
468
|
|
466
469
|
// Allgemein:
|
467
470
|
createZigbeeDevice(adapter, rawId, baseState, etage, raum, device, deviceZigbeeLampeRGB);
|
@@ -470,7 +473,7 @@ export function createZigbeeLampeRGB(adapter:any, rawId: number, baseState: stri
|
|
470
473
|
createDatenpunktSingle(adapter, rawId, attributeTypeBoolean, attributeRGBLamp_Group, isGroup, category);
|
471
474
|
|
472
475
|
// groupMembers:string[]
|
473
|
-
|
476
|
+
let db_groupMembers = null;
|
474
477
|
groupMembers.forEach(value => {
|
475
478
|
if (db_groupMembers == null) {
|
476
479
|
// @ts-ignore
|
@@ -483,7 +486,7 @@ export function createZigbeeLampeRGB(adapter:any, rawId: number, baseState: stri
|
|
483
486
|
createDatenpunktSingle(adapter, rawId, attributeTypeString, attributeRGBLamp_Groupmembers, db_groupMembers, category);
|
484
487
|
|
485
488
|
// alexaSmartNamesForOn:string[]
|
486
|
-
|
489
|
+
let db_alexaSmartNamesForOn = null;
|
487
490
|
alexaSmartNamesForOn.forEach(value => {
|
488
491
|
if (db_alexaSmartNamesForOn == null) {
|
489
492
|
// @ts-ignore
|
@@ -496,7 +499,7 @@ export function createZigbeeLampeRGB(adapter:any, rawId: number, baseState: stri
|
|
496
499
|
createDatenpunktSingle(adapter, rawId, attributeTypeString, attribute_AlexaSmartNamesForOn, db_alexaSmartNamesForOn, category);
|
497
500
|
|
498
501
|
// alexaActionNamesForOn:string[]
|
499
|
-
|
502
|
+
let db_alexaActionNamesForOn = null;
|
500
503
|
alexaActionNamesForOn.forEach(value => {
|
501
504
|
if (db_alexaActionNamesForOn == null) {
|
502
505
|
// @ts-ignore
|
@@ -509,7 +512,7 @@ export function createZigbeeLampeRGB(adapter:any, rawId: number, baseState: stri
|
|
509
512
|
createDatenpunktSingle(adapter, rawId, attributeTypeString, attribute_AlexaActionNamesForOn, db_alexaActionNamesForOn, category);
|
510
513
|
|
511
514
|
// alexaSmartNamesForOff:string[]
|
512
|
-
|
515
|
+
let db_alexaSmartNamesForOff = null;
|
513
516
|
alexaSmartNamesForOff.forEach(value => {
|
514
517
|
if (db_alexaSmartNamesForOff == null) {
|
515
518
|
// @ts-ignore
|
@@ -522,7 +525,7 @@ export function createZigbeeLampeRGB(adapter:any, rawId: number, baseState: stri
|
|
522
525
|
createDatenpunktSingle(adapter, rawId, attributeTypeString, attribute_AlexaSmartNamesForOff, db_alexaSmartNamesForOff, category);
|
523
526
|
|
524
527
|
// alexaActionNamesForOff:string[]
|
525
|
-
|
528
|
+
let db_alexaActionNamesForOff = null;
|
526
529
|
alexaActionNamesForOff.forEach(value => {
|
527
530
|
if (db_alexaActionNamesForOff == null) {
|
528
531
|
// @ts-ignore
|
@@ -535,7 +538,7 @@ export function createZigbeeLampeRGB(adapter:any, rawId: number, baseState: stri
|
|
535
538
|
createDatenpunktSingle(adapter, rawId, attributeTypeString, attribute_AlexaActionNamesForOff, db_alexaActionNamesForOff, category);
|
536
539
|
|
537
540
|
// tasterBooleanOn: string[]
|
538
|
-
|
541
|
+
let db_tasterBooleanOn = null;
|
539
542
|
tasterBooleanOn.forEach(value => {
|
540
543
|
if (db_tasterBooleanOn == null) {
|
541
544
|
// @ts-ignore
|
@@ -548,7 +551,7 @@ export function createZigbeeLampeRGB(adapter:any, rawId: number, baseState: stri
|
|
548
551
|
createDatenpunktSingle(adapter, rawId, attributeTypeString, attribute_TasterBooleanOn, db_tasterBooleanOn, category);
|
549
552
|
|
550
553
|
// tasterBooleanOff: string[]
|
551
|
-
|
554
|
+
let db_tasterBooleanOff = null;
|
552
555
|
tasterBooleanOff.forEach(value => {
|
553
556
|
if (db_tasterBooleanOff == null) {
|
554
557
|
// @ts-ignore
|
@@ -703,10 +706,11 @@ export function createZigbeeLampeRGB(adapter:any, rawId: number, baseState: stri
|
|
703
706
|
createDatenpunktSingle(adapter, rawId, attributeTypeNumber, attributeRGBLamp_ColorSchemes_Weiss4_level, null, category);
|
704
707
|
createDatenpunktSingle(adapter, rawId, attributeTypeNumber, attributeRGBLamp_ColorSchemes_Weiss4_ct, null, category);*/
|
705
708
|
}
|
709
|
+
this.clearZigbeeCaches();
|
706
710
|
}
|
707
711
|
|
708
712
|
function createDatenpunktSingle(adapter:any, deviceRawId, attributeType, attributeName, attributeValue, category:string) {
|
709
|
-
|
713
|
+
let stateDatenpunkt = "0_userdata.0.devices.zigbee." + category + "." + deviceRawId + "." + attributeName;
|
710
714
|
adapter.createState(stateDatenpunkt, attributeValue, {
|
711
715
|
name: "Z" + deviceRawId.toString().padStart(3, '0'),
|
712
716
|
desc: "",
|
@@ -720,7 +724,7 @@ function createDatenpunktSingle(adapter:any, deviceRawId, attributeType, attribu
|
|
720
724
|
}
|
721
725
|
|
722
726
|
function toStringArray(databaseValue) { // z.B. "Werkbank|Arbeiten|Keller"
|
723
|
-
|
727
|
+
let stringArray = [];
|
724
728
|
if (databaseValue == null) {
|
725
729
|
return stringArray;
|
726
730
|
} else {
|
@@ -736,7 +740,7 @@ export function loadZigbeeSteckdosen(adapter: any) {
|
|
736
740
|
// @ts-ignore
|
737
741
|
cacheSteckdosenArray = [];
|
738
742
|
adapter.$('state[id=0_userdata.0.devices.zigbee.*.*.category]').each(datenpunktKey => { // 0_userdata.0.devices.zigbee.Steckdose.30.category;
|
739
|
-
|
743
|
+
let datenpunktPraefix = datenpunktKey.replaceAll(".category", "");
|
740
744
|
if (adapter.getState(datenpunktKey).val == deviceZigbeeSteckdose) {
|
741
745
|
// @ts-ignore
|
742
746
|
cacheSteckdosenArray.push(new ZigbeeSteckdose(adapter,
|
@@ -766,7 +770,7 @@ export function loadZigbeeBewegungsmelder(adapter: any) {
|
|
766
770
|
// @ts-ignore
|
767
771
|
cacheBewegungsmelderArray = [];
|
768
772
|
adapter.$('state[id=0_userdata.0.devices.zigbee.*.*.category]').each(datenpunktKey => { // 0_userdata.0.devices.zigbee.Steckdose.30.category;
|
769
|
-
|
773
|
+
let datenpunktPraefix = datenpunktKey.replaceAll(".category", "");
|
770
774
|
if (adapter.getState(datenpunktKey).val == deviceZigbeeBewegungsmelder) {
|
771
775
|
// @ts-ignore
|
772
776
|
cacheBewegungsmelderArray.push(new ZigbeeBewegungsmelder(adapter,
|
@@ -790,11 +794,11 @@ export function loadZigbeeLampenRGB(adapter: any) {
|
|
790
794
|
// @ts-ignore
|
791
795
|
cacheLampenRGBArray = [];
|
792
796
|
adapter.$('state[id=0_userdata.0.devices.zigbee.*.*.category]').each(datenpunktKey => { // 0_userdata.0.devices.zigbee.Steckdose.30.category;
|
793
|
-
|
797
|
+
let datenpunktPraefix = datenpunktKey.replaceAll(".category", "");
|
794
798
|
if (adapter.getState(datenpunktKey).val == deviceZigbeeLampeRGB) {
|
795
799
|
|
796
800
|
// Einschalt-Scheme:
|
797
|
-
|
801
|
+
let alexaOnScheme = null;
|
798
802
|
if (adapter.getState(datenpunktPraefix + "." + attributeRGBLamp_AlexaColorSchemeForOn_Farbe_aktiv).val == true) {
|
799
803
|
alexaOnScheme = new RGBColorScheme(null,
|
800
804
|
adapter.getState(datenpunktPraefix + "." + attributeRGBLamp_AlexaColorSchemeForOn_Farbe_level).val,
|
@@ -809,7 +813,7 @@ export function loadZigbeeLampenRGB(adapter: any) {
|
|
809
813
|
}
|
810
814
|
|
811
815
|
// Weitere Schemes als Array:
|
812
|
-
|
816
|
+
let schemeArray = [];
|
813
817
|
|
814
818
|
// RGBColorScheme1:
|
815
819
|
if (adapter.getState(datenpunktPraefix + "." + attributeRGBLamp_ColorSchemes_Farbe1_aktiv).val == true) {
|
@@ -932,10 +936,10 @@ export function loadZigbeeLampenWeiss(adapter: any) {
|
|
932
936
|
// @ts-ignore
|
933
937
|
cacheLampenWeissArray = [];
|
934
938
|
adapter.$('state[id=0_userdata.0.devices.zigbee.*.*.category]').each(datenpunktKey => { // 0_userdata.0.devices.zigbee.Steckdose.30.category;
|
935
|
-
|
939
|
+
let datenpunktPraefix = datenpunktKey.replaceAll(".category", "");
|
936
940
|
if (adapter.getState(datenpunktKey).val == deviceZigbeeLampeWeiss) {
|
937
941
|
// Einschalt-Scheme:
|
938
|
-
|
942
|
+
let alexaOnScheme = null;
|
939
943
|
if (adapter.getState(datenpunktPraefix + "." + attributeLampWeiss_AlexaColorSchemeForOn_Weiss_aktiv).val == true) {
|
940
944
|
// @ts-ignore
|
941
945
|
alexaOnScheme = new LampeWeissAlexaScheme(null,
|
@@ -945,7 +949,7 @@ export function loadZigbeeLampenWeiss(adapter: any) {
|
|
945
949
|
}
|
946
950
|
|
947
951
|
// Weitere Schemes als Array:
|
948
|
-
|
952
|
+
let schemeArray = [];
|
949
953
|
|
950
954
|
// WhiteColorScheme1:
|
951
955
|
if (adapter.getState(datenpunktPraefix + "." + attributeLampWeiss_ColorSchemes_Weiss1_aktiv).val == true) {
|
@@ -988,7 +992,7 @@ export function loadZigbeeLampenWeiss(adapter: any) {
|
|
988
992
|
}
|
989
993
|
|
990
994
|
// Taster Boolean On Schemes:
|
991
|
-
|
995
|
+
let tasterOnBoolschemeArray = [];
|
992
996
|
|
993
997
|
// LampeWeissTasterScheme1:
|
994
998
|
//constructor(tasterBooleanOn: string, level: number, ct: number) {
|
@@ -1067,7 +1071,7 @@ export function loadZigbeeRauchmelder(adapter: any) {
|
|
1067
1071
|
// @ts-ignore
|
1068
1072
|
cacheRauchmelderArray = [];
|
1069
1073
|
adapter.$('state[id=0_userdata.0.devices.zigbee.*.*.category]').each(datenpunktKey => { // 0_userdata.0.devices.zigbee.Steckdose.30.category;
|
1070
|
-
|
1074
|
+
let datenpunktPraefix = datenpunktKey.replaceAll(".category", "");
|
1071
1075
|
if (adapter.getState(datenpunktKey).val == deviceZigbeeRauchmelder) {
|
1072
1076
|
// @ts-ignore
|
1073
1077
|
cacheRauchmelderArray.push(new ZigbeeRauchmelder(adapter,
|
@@ -1091,7 +1095,7 @@ export function loadZigbeeWandtaster(adapter: any) {
|
|
1091
1095
|
// @ts-ignore
|
1092
1096
|
cacheWandtasterArray = [];
|
1093
1097
|
adapter.$('state[id=0_userdata.0.devices.zigbee.*.*.category]').each(datenpunktKey => { // 0_userdata.0.devices.zigbee.Steckdose.30.category;
|
1094
|
-
|
1098
|
+
let datenpunktPraefix = datenpunktKey.replaceAll(".category", "");
|
1095
1099
|
if (adapter.getState(datenpunktKey).val == deviceZigbeeWandtaster) {
|
1096
1100
|
// @ts-ignore
|
1097
1101
|
cacheWandtasterArray.push(new ZigbeeWandtaster(adapter,
|
@@ -1115,7 +1119,7 @@ export function loadZigbeeDosenrelais(adapter: any) {
|
|
1115
1119
|
// @ts-ignore
|
1116
1120
|
cacheDosenrelaisArray = [];
|
1117
1121
|
adapter.$('state[id=0_userdata.0.devices.zigbee.*.*.category]').each(datenpunktKey => { // 0_userdata.0.devices.zigbee.Steckdose.30.category;
|
1118
|
-
|
1122
|
+
let datenpunktPraefix = datenpunktKey.replaceAll(".category", "");
|
1119
1123
|
if (adapter.getState(datenpunktKey).val == deviceZigbeeDosenrelais) {
|
1120
1124
|
// @ts-ignore
|
1121
1125
|
cacheDosenrelaisArray.push(new ZigbeeDosenrelais(adapter,
|
@@ -1140,7 +1144,7 @@ export function loadZigbeeSchalter(adapter: any) {
|
|
1140
1144
|
// @ts-ignore
|
1141
1145
|
cacheSchalterArray = [];
|
1142
1146
|
adapter.$('state[id=0_userdata.0.devices.zigbee.*.*.category]').each(datenpunktKey => { // 0_userdata.0.devices.zigbee.Steckdose.30.category;
|
1143
|
-
|
1147
|
+
let datenpunktPraefix = datenpunktKey.replaceAll(".category", "");
|
1144
1148
|
if (adapter.getState(datenpunktKey).val == deviceZigbeeSchalter) {
|
1145
1149
|
// @ts-ignore
|
1146
1150
|
cacheSchalterArray.push(new ZigbeeSchalter(adapter,
|
@@ -1164,7 +1168,7 @@ export function loadZigbeeRepeater(adapter: any) {
|
|
1164
1168
|
// @ts-ignore
|
1165
1169
|
cacheRepeaterArray = [];
|
1166
1170
|
adapter.$('state[id=0_userdata.0.devices.zigbee.*.*.category]').each(datenpunktKey => { // 0_userdata.0.devices.zigbee.Steckdose.30.category;
|
1167
|
-
|
1171
|
+
let datenpunktPraefix = datenpunktKey.replaceAll(".category", "");
|
1168
1172
|
if (adapter.getState(datenpunktKey).val == deviceZigbeeRepeater) {
|
1169
1173
|
// @ts-ignore
|
1170
1174
|
cacheRepeaterArray.push(new ZigbeeRepeater(adapter,
|
@@ -1188,7 +1192,7 @@ export function loadZigbeeFenstersensor(adapter: any) {
|
|
1188
1192
|
// @ts-ignore
|
1189
1193
|
cacheFenstersensorenArray = [];
|
1190
1194
|
adapter.$('state[id=0_userdata.0.devices.zigbee.*.*.category]').each(datenpunktKey => { // 0_userdata.0.devices.zigbee.Steckdose.30.category;
|
1191
|
-
|
1195
|
+
let datenpunktPraefix = datenpunktKey.replaceAll(".category", "");
|
1192
1196
|
if (adapter.getState(datenpunktKey).val == deviceZigbeeFenstersensor) {
|
1193
1197
|
// @ts-ignore
|
1194
1198
|
cacheFenstersensorenArray.push(new ZigbeeFenstersensor(adapter,
|
@@ -1212,7 +1216,7 @@ export function loadZigbeeDevicesAll(adapter: any) {
|
|
1212
1216
|
}*/
|
1213
1217
|
|
1214
1218
|
// @ts-ignore
|
1215
|
-
|
1219
|
+
let zigbeeAllArray = [];
|
1216
1220
|
adapter.loadZigbeeSteckdosen(adapter).forEach(zigbee => {
|
1217
1221
|
// @ts-ignore
|
1218
1222
|
zigbeeAllArray.push(zigbee);
|
@@ -1274,34 +1278,34 @@ function clearZigbeeCaches(adapter: any) {
|
|
1274
1278
|
|
1275
1279
|
function sortArray(inputArray) {
|
1276
1280
|
inputArray.sort((a,b) => {
|
1277
|
-
|
1278
|
-
|
1281
|
+
let elementA = a;
|
1282
|
+
let elementB = b;
|
1279
1283
|
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1284
|
+
let etageA = elementA.getEtage();
|
1285
|
+
let etageB = elementB.getEtage();
|
1286
|
+
let compareEtage = getEtageSortIndex(etageA).localeCompare(getEtageSortIndex(etageB));
|
1283
1287
|
if (compareEtage != 0) {
|
1284
1288
|
return compareEtage;
|
1285
1289
|
}
|
1286
1290
|
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1291
|
+
let typA = elementA.getCategory();
|
1292
|
+
let typB = elementB.getCategory();
|
1293
|
+
let compareTyp = typA.localeCompare(typB);
|
1290
1294
|
if (compareTyp != 0) {
|
1291
1295
|
return compareTyp;
|
1292
1296
|
}
|
1293
1297
|
|
1294
1298
|
|
1295
|
-
|
1296
|
-
|
1297
|
-
|
1299
|
+
let raumA = elementA.getRaum();
|
1300
|
+
let raumB = elementB.getRaum();
|
1301
|
+
let compareRaum = raumA.localeCompare(raumB);
|
1298
1302
|
if (compareRaum != 0) {
|
1299
1303
|
return compareRaum;
|
1300
1304
|
}
|
1301
1305
|
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1306
|
+
let deviceA = elementA.getDevice();
|
1307
|
+
let deviceB = elementB.getDevice();
|
1308
|
+
let compareDevice = deviceA.localeCompare(deviceB);
|
1305
1309
|
if (compareDevice != 0) {
|
1306
1310
|
return compareDevice;
|
1307
1311
|
}
|