iobroker-ucl 1.0.47 → 1.0.48
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 +1 -1
- package/homematicFunctions.ts +10 -10
- package/main.js +30 -1
- package/main.ts +6 -1
- package/package.json +1 -1
- package/zigbeeClasses.js +1229 -0
- package/zigbeeClasses.ts +1346 -0
package/zigbeeClasses.js
ADDED
@@ -0,0 +1,1229 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
3
|
+
var extendStatics = function (d, b) {
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
7
|
+
return extendStatics(d, b);
|
8
|
+
};
|
9
|
+
return function (d, b) {
|
10
|
+
if (typeof b !== "function" && b !== null)
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
12
|
+
extendStatics(d, b);
|
13
|
+
function __() { this.constructor = d; }
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15
|
+
};
|
16
|
+
})();
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
18
|
+
exports.AlexaInputConverter = exports.ZigbeeDosenrelais = exports.ZigbeeWandtaster = exports.ZigbeeBewegungsmelder = exports.ZigbeeRauchmelder = exports.ZigbeeFenstersensor = exports.ZigbeeRepeater = exports.ZigbeeSchalter = exports.ZigbeeSteckdose = exports.ZigbeeLampeWeiss = exports.LampeWeissAlexaScheme = exports.LampeWeissTasterScheme = exports.ZigbeeLampeRGB = exports.WhiteColorScheme = exports.RGBColorScheme = exports.ColorScheme = exports.AbstractZigbee = void 0;
|
19
|
+
// https://stackoverflow.com/questions/8595509/how-do-you-share-constants-in-nodejs-modules
|
20
|
+
var deviceZigbeeSteckdose = "Steckdose";
|
21
|
+
var deviceZigbeeBewegungsmelder = "Bewegungsmelder";
|
22
|
+
var deviceZigbeeLampeRGB = "LampeRGB";
|
23
|
+
var deviceZigbeeLampeWeiss = "LampeWeiss";
|
24
|
+
var deviceZigbeeRauchmelder = "Rauchmelder";
|
25
|
+
var deviceZigbeeWandtaster = "Wandtaster";
|
26
|
+
var deviceZigbeeDosenrelais = "Dosenrelais";
|
27
|
+
var deviceZigbeeSchalter = "Schalter";
|
28
|
+
var deviceZigbeeRepeater = "Repeater";
|
29
|
+
var deviceZigbeeFenstersensor = "Fenstersensor";
|
30
|
+
var AbstractZigbee = /** @class */ (function () {
|
31
|
+
function AbstractZigbee(adapter, id, baseState, etage, raum, device) {
|
32
|
+
this.adapter = adapter;
|
33
|
+
this.id = id;
|
34
|
+
this.baseState = baseState;
|
35
|
+
this.etage = etage;
|
36
|
+
this.raum = raum;
|
37
|
+
this.device = device;
|
38
|
+
}
|
39
|
+
AbstractZigbee.prototype.getDeviceId = function () {
|
40
|
+
return "Z" + this.id.toString().padStart(3, '0');
|
41
|
+
};
|
42
|
+
AbstractZigbee.prototype.getOriginalDeviceName = function () {
|
43
|
+
return this.adapter.getObject(this.baseState).common.name;
|
44
|
+
};
|
45
|
+
AbstractZigbee.prototype.getDeviceIdAsRawNumber = function () {
|
46
|
+
return this.id;
|
47
|
+
};
|
48
|
+
AbstractZigbee.prototype.getEtage = function () {
|
49
|
+
return this.etage;
|
50
|
+
};
|
51
|
+
AbstractZigbee.prototype.getRaum = function () {
|
52
|
+
return this.raum;
|
53
|
+
};
|
54
|
+
AbstractZigbee.prototype.getDevice = function () {
|
55
|
+
return this.device;
|
56
|
+
};
|
57
|
+
AbstractZigbee.prototype.getBaseState = function () {
|
58
|
+
return this.baseState;
|
59
|
+
};
|
60
|
+
AbstractZigbee.prototype.getType = function () {
|
61
|
+
var result = "";
|
62
|
+
var m1 = this.adapter.getObject(this.baseState).native.manufacturername;
|
63
|
+
var m2 = this.adapter.getObject(this.baseState).native.modelid;
|
64
|
+
if (m1 != undefined && m2 != undefined) {
|
65
|
+
result += m1;
|
66
|
+
}
|
67
|
+
if (m2 != null) {
|
68
|
+
if (result != "") {
|
69
|
+
result += " (" + m2 + ")";
|
70
|
+
}
|
71
|
+
else {
|
72
|
+
result += m2;
|
73
|
+
}
|
74
|
+
}
|
75
|
+
return result;
|
76
|
+
};
|
77
|
+
AbstractZigbee.prototype.isStatusTotal = function () {
|
78
|
+
return this.isStatusReachable();
|
79
|
+
};
|
80
|
+
AbstractZigbee.prototype.isStatusReachable = function () {
|
81
|
+
return this.adapter.getState(this.baseState + ".reachable").val; // hue.0.Steckdose_Backstube.reachable
|
82
|
+
};
|
83
|
+
AbstractZigbee.prototype.createIOTAdapterSmartDevices = function (smartName) {
|
84
|
+
// Level:
|
85
|
+
// ----------------------------------------------------------------------------------
|
86
|
+
var alexaLampeLevel = "0_userdata.0.alexa." + smartName + ".level";
|
87
|
+
this.adapter.createState(alexaLampeLevel, 0, {
|
88
|
+
name: alexaLampeLevel,
|
89
|
+
desc: alexaLampeLevel,
|
90
|
+
type: 'number',
|
91
|
+
read: true,
|
92
|
+
write: true
|
93
|
+
});
|
94
|
+
// @ts-ignore
|
95
|
+
var objLevel = this.adapter.getObject(alexaLampeLevel);
|
96
|
+
objLevel.common = {
|
97
|
+
"type": "number",
|
98
|
+
"name": alexaLampeLevel,
|
99
|
+
"read": true,
|
100
|
+
"write": true,
|
101
|
+
"role": "level.dimmer",
|
102
|
+
"min": 0,
|
103
|
+
"max": 100,
|
104
|
+
"def": 0,
|
105
|
+
"smartName": {
|
106
|
+
"de": smartName,
|
107
|
+
"smartType": "LIGHT"
|
108
|
+
}
|
109
|
+
};
|
110
|
+
this.adapter.setObject(alexaLampeLevel, objLevel);
|
111
|
+
// HUE:
|
112
|
+
// ----------------------------------------------------------------------------------
|
113
|
+
var alexaLampeHue = "0_userdata.0.alexa." + smartName + ".hue";
|
114
|
+
this.adapter.createState(alexaLampeHue, 0, {
|
115
|
+
name: alexaLampeHue,
|
116
|
+
desc: alexaLampeHue,
|
117
|
+
type: 'number',
|
118
|
+
read: true,
|
119
|
+
write: true
|
120
|
+
});
|
121
|
+
// @ts-ignore
|
122
|
+
var objHue = this.adapter.getObject(alexaLampeHue);
|
123
|
+
objHue.common = {
|
124
|
+
"name": alexaLampeHue,
|
125
|
+
"desc": alexaLampeHue,
|
126
|
+
"type": "number",
|
127
|
+
"read": true,
|
128
|
+
"write": true,
|
129
|
+
"role": "level.color.hue",
|
130
|
+
"smartName": {
|
131
|
+
"de": smartName,
|
132
|
+
"smartType": "LIGHT"
|
133
|
+
}
|
134
|
+
};
|
135
|
+
this.adapter.setObject(alexaLampeHue, objHue);
|
136
|
+
// SAT:
|
137
|
+
// ----------------------------------------------------------------------------------
|
138
|
+
var alexaLampeSat = "0_userdata.0.alexa." + smartName + ".sat";
|
139
|
+
this.adapter.createState(alexaLampeSat, 0, {
|
140
|
+
name: alexaLampeSat,
|
141
|
+
desc: alexaLampeSat,
|
142
|
+
type: 'number',
|
143
|
+
read: true,
|
144
|
+
write: true
|
145
|
+
});
|
146
|
+
// @ts-ignore
|
147
|
+
var obSat = this.adapter.getObject(alexaLampeSat);
|
148
|
+
obSat.common = {
|
149
|
+
"name": alexaLampeSat,
|
150
|
+
"desc": alexaLampeSat,
|
151
|
+
"type": "number",
|
152
|
+
"read": true,
|
153
|
+
"write": true,
|
154
|
+
"role": "level.color.saturation",
|
155
|
+
"smartName": {
|
156
|
+
"de": smartName,
|
157
|
+
"smartType": "LIGHT"
|
158
|
+
}
|
159
|
+
};
|
160
|
+
this.adapter.setObject(alexaLampeSat, obSat);
|
161
|
+
// CT:
|
162
|
+
// ----------------------------------------------------------------------------------
|
163
|
+
var alexaLampeCT = "0_userdata.0.alexa." + smartName + ".ct";
|
164
|
+
this.adapter.createState(alexaLampeCT, 0, {
|
165
|
+
name: alexaLampeCT,
|
166
|
+
desc: alexaLampeCT,
|
167
|
+
type: 'number',
|
168
|
+
read: true,
|
169
|
+
write: true
|
170
|
+
});
|
171
|
+
// @ts-ignore
|
172
|
+
var objCT = this.adapter.getObject(alexaLampeCT);
|
173
|
+
objCT.common = {
|
174
|
+
"type": "number",
|
175
|
+
"name": alexaLampeCT,
|
176
|
+
"read": true,
|
177
|
+
"write": true,
|
178
|
+
"role": "level.color.temperature",
|
179
|
+
"smartName": {
|
180
|
+
"de": smartName,
|
181
|
+
"smartType": "LIGHT"
|
182
|
+
}
|
183
|
+
};
|
184
|
+
this.adapter.setObject(alexaLampeCT, objCT);
|
185
|
+
};
|
186
|
+
return AbstractZigbee;
|
187
|
+
}());
|
188
|
+
exports.AbstractZigbee = AbstractZigbee;
|
189
|
+
var ColorScheme = /** @class */ (function () {
|
190
|
+
function ColorScheme(alexaName, level) {
|
191
|
+
this.alexaName = alexaName;
|
192
|
+
this.level = level;
|
193
|
+
}
|
194
|
+
ColorScheme.prototype.getAlexaName = function () {
|
195
|
+
return this.alexaName;
|
196
|
+
};
|
197
|
+
ColorScheme.prototype.getLevel = function () {
|
198
|
+
return this.level;
|
199
|
+
};
|
200
|
+
ColorScheme.prototype.setDevice = function (device) {
|
201
|
+
this.device = device;
|
202
|
+
};
|
203
|
+
ColorScheme.prototype.getDevice = function () {
|
204
|
+
return this.device;
|
205
|
+
};
|
206
|
+
return ColorScheme;
|
207
|
+
}());
|
208
|
+
exports.ColorScheme = ColorScheme;
|
209
|
+
var RGBColorScheme = /** @class */ (function (_super) {
|
210
|
+
__extends(RGBColorScheme, _super);
|
211
|
+
function RGBColorScheme(alexaName, level, hue, sat) {
|
212
|
+
var _this = _super.call(this, alexaName, level) || this;
|
213
|
+
_this.hue = hue;
|
214
|
+
_this.sat = sat;
|
215
|
+
return _this;
|
216
|
+
}
|
217
|
+
RGBColorScheme.prototype.getHue = function () {
|
218
|
+
return this.hue;
|
219
|
+
};
|
220
|
+
RGBColorScheme.prototype.getSat = function () {
|
221
|
+
return this.sat;
|
222
|
+
};
|
223
|
+
return RGBColorScheme;
|
224
|
+
}(ColorScheme));
|
225
|
+
exports.RGBColorScheme = RGBColorScheme;
|
226
|
+
var WhiteColorScheme = /** @class */ (function (_super) {
|
227
|
+
__extends(WhiteColorScheme, _super);
|
228
|
+
function WhiteColorScheme(alexaName, level, ct) {
|
229
|
+
var _this = _super.call(this, alexaName, level) || this;
|
230
|
+
_this.ct = ct;
|
231
|
+
return _this;
|
232
|
+
}
|
233
|
+
WhiteColorScheme.prototype.getCt = function () {
|
234
|
+
return this.ct;
|
235
|
+
};
|
236
|
+
return WhiteColorScheme;
|
237
|
+
}(ColorScheme));
|
238
|
+
exports.WhiteColorScheme = WhiteColorScheme;
|
239
|
+
var ZigbeeLampeRGB = /** @class */ (function (_super) {
|
240
|
+
__extends(ZigbeeLampeRGB, _super);
|
241
|
+
function ZigbeeLampeRGB(adapter, id, baseState, etage, raum, device, isGroup, groupMembers, alexaSmartNamesForOn, alexaActionNamesForOn, alexaColorSchemeForOn, alexaSmartNamesForOff, alexaActionNamesForOff, colorSchemes, tasterBooleanOn, tasterBooleanOff, nachtbeleuchtung, turnOffExitHouseSummer, turnOffExitHouseWinter, turnOnEnterHouseSummer, turnOnEnterHouseWinter) {
|
242
|
+
var _this = _super.call(this, adapter, id, baseState, etage, raum, device) || this;
|
243
|
+
_this.adapter = adapter;
|
244
|
+
_this.isGroup_ = isGroup;
|
245
|
+
_this.groupMembers = groupMembers;
|
246
|
+
_this.alexaSmartNamesForOn = alexaSmartNamesForOn;
|
247
|
+
_this.alexaSmartNamesForOff = alexaSmartNamesForOff;
|
248
|
+
_this.alexaActionNamesForOn = alexaActionNamesForOn;
|
249
|
+
_this.alexaActionNamesForOff = alexaActionNamesForOff;
|
250
|
+
_this.nachtbeleuchtung = nachtbeleuchtung;
|
251
|
+
_this.turnOffExitHouseSummer = turnOffExitHouseSummer;
|
252
|
+
_this.turnOffExitHouseWinter = turnOffExitHouseWinter;
|
253
|
+
_this.turnOnEnterHouseSummer = turnOnEnterHouseSummer;
|
254
|
+
_this.turnOnEnterHouseWinter = turnOnEnterHouseWinter;
|
255
|
+
_this.alexaColorSchemeForOn = alexaColorSchemeForOn;
|
256
|
+
_this.colorSchemes = colorSchemes;
|
257
|
+
_this.colorConverter = new ColorConverter();
|
258
|
+
_this.tasterBooleanOn = tasterBooleanOn;
|
259
|
+
_this.tasterBooleanOff = tasterBooleanOff;
|
260
|
+
_this.tasterBooleanOn.forEach(function (booleanOnObj) {
|
261
|
+
_this.createState(booleanOnObj);
|
262
|
+
});
|
263
|
+
_this.tasterBooleanOff.forEach(function (tasterBooleanOffObj) {
|
264
|
+
_this.createState(tasterBooleanOffObj);
|
265
|
+
});
|
266
|
+
_this.alexaSmartNamesForOn.forEach(function (alexaSmartName) {
|
267
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
268
|
+
});
|
269
|
+
_this.alexaSmartNamesForOff.forEach(function (alexaSmartName) {
|
270
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
271
|
+
});
|
272
|
+
_this.alexaActionNamesForOn.forEach(function (alexaSmartName) {
|
273
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
274
|
+
});
|
275
|
+
_this.alexaActionNamesForOff.forEach(function (alexaSmartName) {
|
276
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
277
|
+
});
|
278
|
+
_this.colorSchemes.forEach(function (scheme) {
|
279
|
+
if (scheme.getAlexaName() != null) {
|
280
|
+
_this.createIOTAdapterSmartDevices(scheme.getAlexaName());
|
281
|
+
}
|
282
|
+
});
|
283
|
+
_this.initRGB();
|
284
|
+
return _this;
|
285
|
+
}
|
286
|
+
ZigbeeLampeRGB.prototype.isNachtbeleuchtung = function () {
|
287
|
+
return this.nachtbeleuchtung;
|
288
|
+
};
|
289
|
+
ZigbeeLampeRGB.prototype.isTurnOffExitHouseSummer = function () {
|
290
|
+
return this.turnOffExitHouseSummer;
|
291
|
+
};
|
292
|
+
ZigbeeLampeRGB.prototype.isTurnOffExitHouseWinter = function () {
|
293
|
+
return this.turnOffExitHouseWinter;
|
294
|
+
};
|
295
|
+
ZigbeeLampeRGB.prototype.isTurnOnEnterHouseSummer = function () {
|
296
|
+
return this.turnOnEnterHouseSummer;
|
297
|
+
};
|
298
|
+
ZigbeeLampeRGB.prototype.isTurnOnEnterHouseWinter = function () {
|
299
|
+
return this.turnOnEnterHouseWinter;
|
300
|
+
};
|
301
|
+
ZigbeeLampeRGB.prototype.initRGB = function () {
|
302
|
+
var _this = this;
|
303
|
+
this.colorSchemes.forEach(function (colorscheme) {
|
304
|
+
colorscheme.setDevice(_this);
|
305
|
+
});
|
306
|
+
if (this.alexaColorSchemeForOn != null) {
|
307
|
+
this.alexaColorSchemeForOn.setDevice(this);
|
308
|
+
}
|
309
|
+
this.createAlias(this.getBaseState() + ".on", "alias.0.rgb." + this.getDeviceId() + ".on");
|
310
|
+
this.createAlias(this.getBaseState() + ".ct", "alias.0.rgb." + this.getDeviceId() + ".ct");
|
311
|
+
this.createAlias(this.getBaseState() + ".level", "alias.0.rgb." + this.getDeviceId() + ".level");
|
312
|
+
if (this.isGroup_ == false) {
|
313
|
+
this.createAlias(this.getBaseState() + ".reachable", "alias.0.rgb." + this.getDeviceId() + ".reachable");
|
314
|
+
}
|
315
|
+
else {
|
316
|
+
var groupReachable = "0_userdata.0.rgb." + this.getDeviceId() + ".reachable";
|
317
|
+
this.adapter.createState(groupReachable, true, {
|
318
|
+
name: groupReachable,
|
319
|
+
desc: groupReachable,
|
320
|
+
type: 'boolean',
|
321
|
+
read: true,
|
322
|
+
write: true
|
323
|
+
});
|
324
|
+
this.createAlias("0_userdata.0.rgb." + this.getDeviceId() + ".reachable", "alias.0.rgb." + this.getDeviceId() + ".reachable");
|
325
|
+
}
|
326
|
+
};
|
327
|
+
ZigbeeLampeRGB.prototype.createAlias = function (originalDatenpunkt, aliasDatenpunkt) {
|
328
|
+
this.adapter.setObject(aliasDatenpunkt, {
|
329
|
+
type: 'state',
|
330
|
+
common: {
|
331
|
+
name: this.adapter.getObject(originalDatenpunkt).common.name,
|
332
|
+
type: this.adapter.getObject(originalDatenpunkt).common.type,
|
333
|
+
unit: this.adapter.getObject(originalDatenpunkt).common.unit,
|
334
|
+
read: true,
|
335
|
+
write: true,
|
336
|
+
role: this.adapter.getObject(originalDatenpunkt).common.role,
|
337
|
+
alias: {
|
338
|
+
id: originalDatenpunkt
|
339
|
+
}
|
340
|
+
},
|
341
|
+
native: {}
|
342
|
+
});
|
343
|
+
};
|
344
|
+
ZigbeeLampeRGB.prototype.getColorSchemes = function () {
|
345
|
+
return this.colorSchemes;
|
346
|
+
};
|
347
|
+
ZigbeeLampeRGB.prototype.getColorSchemeForOn = function () {
|
348
|
+
return this.alexaColorSchemeForOn;
|
349
|
+
};
|
350
|
+
ZigbeeLampeRGB.prototype.getTasterBooleanOn = function () {
|
351
|
+
return this.tasterBooleanOn;
|
352
|
+
};
|
353
|
+
ZigbeeLampeRGB.prototype.getTasterBooleanOff = function () {
|
354
|
+
return this.tasterBooleanOff;
|
355
|
+
};
|
356
|
+
ZigbeeLampeRGB.prototype.createState = function (key_in) {
|
357
|
+
var jarvisDatenpunkt = key_in; //.replace(/\./g,'_'); // wegen Wohnzimmer T.V.
|
358
|
+
//log(">>> CREATE STATE: " + jarvisDatenpunkt);
|
359
|
+
this.adapter.createState(jarvisDatenpunkt, false, {
|
360
|
+
name: jarvisDatenpunkt,
|
361
|
+
desc: jarvisDatenpunkt,
|
362
|
+
type: 'boolean',
|
363
|
+
read: true,
|
364
|
+
write: true
|
365
|
+
});
|
366
|
+
};
|
367
|
+
ZigbeeLampeRGB.prototype.changeColor = function (colorscheme) {
|
368
|
+
var _this = this;
|
369
|
+
if (colorscheme.getDevice().getBaseState().includes("deconz")) {
|
370
|
+
this.adapter.setState(this.getBaseState() + ".level", colorscheme.getLevel());
|
371
|
+
if (colorscheme instanceof RGBColorScheme) {
|
372
|
+
var rgbColorscheme = colorscheme;
|
373
|
+
this.adapter.setState(this.getBaseState() + ".xy", this.colorConverter.convertHSL2XY(rgbColorscheme.getHue(), rgbColorscheme.getSat()));
|
374
|
+
}
|
375
|
+
else {
|
376
|
+
var whiteColorscheme = colorscheme;
|
377
|
+
this.adapter.setState(this.getBaseState() + ".ct", whiteColorscheme.getCt());
|
378
|
+
}
|
379
|
+
}
|
380
|
+
else {
|
381
|
+
this.adapter.log(">>> hue changeColor: Set Level to: " + colorscheme.getLevel());
|
382
|
+
setTimeout(function (obj) {
|
383
|
+
_this.adapter.setState(_this.getBaseState() + ".level", colorscheme.getLevel());
|
384
|
+
setTimeout(function (obj2) {
|
385
|
+
if (colorscheme instanceof RGBColorScheme) {
|
386
|
+
_this.adapter.log(">>> hue changeColor: Set Hue to: " + colorscheme.getHue());
|
387
|
+
_this.adapter.log(">>> hue changeColor: Set Sat to: " + colorscheme.getSat());
|
388
|
+
var rgbColorscheme = colorscheme;
|
389
|
+
//setState(this.getBaseState() + ".xy", this.colorConverter.convertHSL2XY(rgbColorscheme.getHue(), rgbColorscheme.getSat()));
|
390
|
+
_this.adapter.setState(_this.getBaseState() + ".hue", rgbColorscheme.getHue()); //, rgbColorscheme.getSat()));
|
391
|
+
_this.adapter.setState(_this.getBaseState() + ".sat", rgbColorscheme.getSat());
|
392
|
+
}
|
393
|
+
else {
|
394
|
+
var whiteColorscheme = colorscheme;
|
395
|
+
_this.adapter.setState(_this.getBaseState() + ".ct", whiteColorscheme.getCt());
|
396
|
+
//log(">>> deconz changeColor: Set ct to: " + whiteColorscheme.getCt());
|
397
|
+
}
|
398
|
+
}, 300);
|
399
|
+
}, 600);
|
400
|
+
}
|
401
|
+
};
|
402
|
+
ZigbeeLampeRGB.prototype.turnOn = function () {
|
403
|
+
if (this.alexaColorSchemeForOn == null) { // Schalte Licht nur ein, d.h. lass die Farbwerte so wie sie sind
|
404
|
+
this.adapter.setState(this.getBaseState() + ".on", true);
|
405
|
+
}
|
406
|
+
else {
|
407
|
+
this.changeColor(this.alexaColorSchemeForOn);
|
408
|
+
}
|
409
|
+
};
|
410
|
+
ZigbeeLampeRGB.prototype.turnOff = function () {
|
411
|
+
this.adapter.setState(this.getBaseState() + ".on", false);
|
412
|
+
};
|
413
|
+
ZigbeeLampeRGB.prototype.getAlexaNamesForOnAsString = function () {
|
414
|
+
var result = "";
|
415
|
+
this.alexaSmartNamesForOn.forEach(function (alexaOnName) {
|
416
|
+
if (result == "") {
|
417
|
+
result += alexaOnName;
|
418
|
+
}
|
419
|
+
else {
|
420
|
+
result += ", " + alexaOnName;
|
421
|
+
}
|
422
|
+
});
|
423
|
+
this.alexaActionNamesForOn.forEach(function (alexaOnName) {
|
424
|
+
if (result == "") {
|
425
|
+
result += alexaOnName;
|
426
|
+
}
|
427
|
+
else {
|
428
|
+
result += ", " + alexaOnName;
|
429
|
+
}
|
430
|
+
});
|
431
|
+
return result;
|
432
|
+
};
|
433
|
+
ZigbeeLampeRGB.prototype.getAlexaNamesForOffAsString = function () {
|
434
|
+
var result = "";
|
435
|
+
this.alexaSmartNamesForOff.forEach(function (alexaOffName) {
|
436
|
+
if (result == "") {
|
437
|
+
result += alexaOffName;
|
438
|
+
}
|
439
|
+
else {
|
440
|
+
result += ", " + alexaOffName;
|
441
|
+
}
|
442
|
+
});
|
443
|
+
this.alexaActionNamesForOff.forEach(function (alexaOffName) {
|
444
|
+
if (result == "") {
|
445
|
+
result += alexaOffName;
|
446
|
+
}
|
447
|
+
else {
|
448
|
+
result += ", " + alexaOffName;
|
449
|
+
}
|
450
|
+
});
|
451
|
+
return result;
|
452
|
+
};
|
453
|
+
ZigbeeLampeRGB.prototype.isSwitchedOn = function () {
|
454
|
+
if (this.adapter.getState(this.baseState + ".on").val == false) { // hue.0.Steckdose_Backstube.on
|
455
|
+
return false;
|
456
|
+
}
|
457
|
+
return true;
|
458
|
+
};
|
459
|
+
ZigbeeLampeRGB.prototype.getGroupMembers = function () {
|
460
|
+
return this.groupMembers;
|
461
|
+
};
|
462
|
+
ZigbeeLampeRGB.prototype.getAlexaSmartNamesForOn = function () {
|
463
|
+
return this.alexaSmartNamesForOn;
|
464
|
+
};
|
465
|
+
ZigbeeLampeRGB.prototype.getAlexaSmartNamesForOff = function () {
|
466
|
+
return this.alexaSmartNamesForOff;
|
467
|
+
};
|
468
|
+
ZigbeeLampeRGB.prototype.getAlexaActionNamesForOn = function () {
|
469
|
+
return this.alexaActionNamesForOn;
|
470
|
+
};
|
471
|
+
ZigbeeLampeRGB.prototype.getAlexaActionNamesForOff = function () {
|
472
|
+
return this.alexaActionNamesForOff;
|
473
|
+
};
|
474
|
+
ZigbeeLampeRGB.prototype.isGroup = function () {
|
475
|
+
return this.isGroup_;
|
476
|
+
};
|
477
|
+
ZigbeeLampeRGB.prototype.getDeviceId = function () {
|
478
|
+
if (this.isGroup_) {
|
479
|
+
return "ZG" + this.id.toString().padStart(3, '0');
|
480
|
+
}
|
481
|
+
else {
|
482
|
+
return "Z" + this.id.toString().padStart(3, '0');
|
483
|
+
}
|
484
|
+
};
|
485
|
+
ZigbeeLampeRGB.prototype.isStatusReachable = function () {
|
486
|
+
if (this.isGroup_) {
|
487
|
+
return true;
|
488
|
+
}
|
489
|
+
else {
|
490
|
+
return this.adapter.getState(this.baseState + ".reachable").val; // hue.0.Steckdose_Backstube.reachable
|
491
|
+
}
|
492
|
+
};
|
493
|
+
ZigbeeLampeRGB.prototype.getLevel = function () {
|
494
|
+
return this.adapter.getState(this.baseState + ".level").val;
|
495
|
+
};
|
496
|
+
ZigbeeLampeRGB.prototype.getCategory = function () {
|
497
|
+
return deviceZigbeeLampeRGB;
|
498
|
+
};
|
499
|
+
return ZigbeeLampeRGB;
|
500
|
+
}(AbstractZigbee));
|
501
|
+
exports.ZigbeeLampeRGB = ZigbeeLampeRGB;
|
502
|
+
var LampeWeissTasterScheme = /** @class */ (function () {
|
503
|
+
function LampeWeissTasterScheme(tasterBooleanOn, level, ct) {
|
504
|
+
this.tasterBooleanOn = tasterBooleanOn;
|
505
|
+
this.level = level;
|
506
|
+
this.ct = ct;
|
507
|
+
}
|
508
|
+
LampeWeissTasterScheme.prototype.getTasterBooleanOnName = function () {
|
509
|
+
return this.tasterBooleanOn;
|
510
|
+
};
|
511
|
+
LampeWeissTasterScheme.prototype.getLevel = function () {
|
512
|
+
return this.level;
|
513
|
+
};
|
514
|
+
LampeWeissTasterScheme.prototype.getCt = function () {
|
515
|
+
return this.ct;
|
516
|
+
};
|
517
|
+
return LampeWeissTasterScheme;
|
518
|
+
}());
|
519
|
+
exports.LampeWeissTasterScheme = LampeWeissTasterScheme;
|
520
|
+
var LampeWeissAlexaScheme = /** @class */ (function () {
|
521
|
+
function LampeWeissAlexaScheme(alexaName, level, ct) {
|
522
|
+
this.alexaName = alexaName;
|
523
|
+
this.level = level;
|
524
|
+
this.ct = ct;
|
525
|
+
}
|
526
|
+
LampeWeissAlexaScheme.prototype.getAlexaName = function () {
|
527
|
+
return this.alexaName;
|
528
|
+
};
|
529
|
+
LampeWeissAlexaScheme.prototype.getLevel = function () {
|
530
|
+
return this.level;
|
531
|
+
};
|
532
|
+
LampeWeissAlexaScheme.prototype.setDevice = function (device) {
|
533
|
+
this.device = device;
|
534
|
+
};
|
535
|
+
LampeWeissAlexaScheme.prototype.getDevice = function () {
|
536
|
+
return this.device;
|
537
|
+
};
|
538
|
+
LampeWeissAlexaScheme.prototype.getCt = function () {
|
539
|
+
return this.ct;
|
540
|
+
};
|
541
|
+
return LampeWeissAlexaScheme;
|
542
|
+
}());
|
543
|
+
exports.LampeWeissAlexaScheme = LampeWeissAlexaScheme;
|
544
|
+
var ZigbeeLampeWeiss = /** @class */ (function (_super) {
|
545
|
+
__extends(ZigbeeLampeWeiss, _super);
|
546
|
+
function ZigbeeLampeWeiss(adapter, id, baseState, etage, raum, device, alexaSmartNamesForOn, alexaActionNamesForOn, alexaLevelSchemeForOn, alexaSmartNamesForOff, alexaActionNamesForOff, levelSchemes, isGroup_, tasterBooleanOn, tasterBooleanOff, nachtbeleuchtung, turnOffExitHouseSummer, turnOffExitHouseWinter, turnOnEnterHouseSummer, turnOnEnterHouseWinter) {
|
547
|
+
var _this = _super.call(this, adapter, id, baseState, etage, raum, device) || this;
|
548
|
+
_this.adapter = adapter;
|
549
|
+
_this.alexaLevelSchemeForOn = alexaLevelSchemeForOn;
|
550
|
+
_this.alexaSmartNamesForOn = alexaSmartNamesForOn;
|
551
|
+
_this.alexaSmartNamesForOff = alexaSmartNamesForOff;
|
552
|
+
_this.alexaActionNamesForOn = alexaActionNamesForOn;
|
553
|
+
_this.alexaActionNamesForOff = alexaActionNamesForOff;
|
554
|
+
_this.nachtbeleuchtung = nachtbeleuchtung;
|
555
|
+
_this.turnOffExitHouseSummer = turnOffExitHouseSummer;
|
556
|
+
_this.turnOffExitHouseWinter = turnOffExitHouseWinter;
|
557
|
+
_this.turnOnEnterHouseSummer = turnOnEnterHouseSummer;
|
558
|
+
_this.turnOnEnterHouseWinter = turnOnEnterHouseWinter;
|
559
|
+
_this.isGroup_ = isGroup_;
|
560
|
+
_this.tasterBooleanOn = tasterBooleanOn;
|
561
|
+
_this.tasterBooleanOff = tasterBooleanOff;
|
562
|
+
_this.levelSchemes = levelSchemes;
|
563
|
+
// States anlegen:
|
564
|
+
_this.tasterBooleanOn.forEach(function (tasterScheme) {
|
565
|
+
if (tasterScheme.getTasterBooleanOnName() != null) {
|
566
|
+
_this.createState(tasterScheme.getTasterBooleanOnName());
|
567
|
+
}
|
568
|
+
});
|
569
|
+
_this.tasterBooleanOff.forEach(function (offName) {
|
570
|
+
_this.createState(offName);
|
571
|
+
});
|
572
|
+
_this.alexaSmartNamesForOn.forEach(function (alexaSmartName) {
|
573
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
574
|
+
});
|
575
|
+
_this.alexaSmartNamesForOff.forEach(function (alexaSmartName) {
|
576
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
577
|
+
});
|
578
|
+
_this.alexaActionNamesForOn.forEach(function (alexaSmartName) {
|
579
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
580
|
+
});
|
581
|
+
_this.alexaActionNamesForOff.forEach(function (alexaSmartName) {
|
582
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
583
|
+
});
|
584
|
+
_this.levelSchemes.forEach(function (scheme) {
|
585
|
+
if (scheme.getAlexaName() != null) {
|
586
|
+
_this.createIOTAdapterSmartDevices(scheme.getAlexaName());
|
587
|
+
}
|
588
|
+
});
|
589
|
+
return _this;
|
590
|
+
}
|
591
|
+
ZigbeeLampeWeiss.prototype.isNachtbeleuchtung = function () {
|
592
|
+
return this.nachtbeleuchtung;
|
593
|
+
};
|
594
|
+
ZigbeeLampeWeiss.prototype.isTurnOffExitHouseSummer = function () {
|
595
|
+
return this.turnOffExitHouseSummer;
|
596
|
+
};
|
597
|
+
ZigbeeLampeWeiss.prototype.isTurnOffExitHouseWinter = function () {
|
598
|
+
return this.turnOffExitHouseWinter;
|
599
|
+
};
|
600
|
+
ZigbeeLampeWeiss.prototype.isTurnOnEnterHouseSummer = function () {
|
601
|
+
return this.turnOnEnterHouseSummer;
|
602
|
+
};
|
603
|
+
ZigbeeLampeWeiss.prototype.isTurnOnEnterHouseWinter = function () {
|
604
|
+
return this.turnOnEnterHouseWinter;
|
605
|
+
};
|
606
|
+
ZigbeeLampeWeiss.prototype.getAlexaSmartNamesForOn = function () {
|
607
|
+
return this.alexaSmartNamesForOn;
|
608
|
+
};
|
609
|
+
ZigbeeLampeWeiss.prototype.getAlexaSmartNamesForOff = function () {
|
610
|
+
return this.alexaSmartNamesForOff;
|
611
|
+
};
|
612
|
+
ZigbeeLampeWeiss.prototype.getAlexaActionNamesForOn = function () {
|
613
|
+
return this.alexaActionNamesForOn;
|
614
|
+
};
|
615
|
+
ZigbeeLampeWeiss.prototype.getAlexaActionNamesForOff = function () {
|
616
|
+
return this.alexaActionNamesForOff;
|
617
|
+
};
|
618
|
+
ZigbeeLampeWeiss.prototype.getAlexaSchemes = function () {
|
619
|
+
return this.levelSchemes;
|
620
|
+
};
|
621
|
+
ZigbeeLampeWeiss.prototype.getAlexaSchemeForOn = function () {
|
622
|
+
return this.alexaLevelSchemeForOn;
|
623
|
+
};
|
624
|
+
ZigbeeLampeWeiss.prototype.getAlexaNamesForOnAsString = function () {
|
625
|
+
var result = "";
|
626
|
+
this.alexaSmartNamesForOn.forEach(function (alexaOnName) {
|
627
|
+
if (result == "") {
|
628
|
+
result += alexaOnName;
|
629
|
+
}
|
630
|
+
else {
|
631
|
+
result += ", " + alexaOnName;
|
632
|
+
}
|
633
|
+
});
|
634
|
+
this.alexaActionNamesForOn.forEach(function (alexaOnName) {
|
635
|
+
if (result == "") {
|
636
|
+
result += alexaOnName;
|
637
|
+
}
|
638
|
+
else {
|
639
|
+
result += ", " + alexaOnName;
|
640
|
+
}
|
641
|
+
});
|
642
|
+
return result;
|
643
|
+
};
|
644
|
+
ZigbeeLampeWeiss.prototype.getAlexaNamesForOffAsString = function () {
|
645
|
+
var result = "";
|
646
|
+
this.alexaSmartNamesForOff.forEach(function (alexaOffName) {
|
647
|
+
if (result == "") {
|
648
|
+
result += alexaOffName;
|
649
|
+
}
|
650
|
+
else {
|
651
|
+
result += ", " + alexaOffName;
|
652
|
+
}
|
653
|
+
});
|
654
|
+
this.alexaActionNamesForOff.forEach(function (alexaOffName) {
|
655
|
+
if (result == "") {
|
656
|
+
result += alexaOffName;
|
657
|
+
}
|
658
|
+
else {
|
659
|
+
result += ", " + alexaOffName;
|
660
|
+
}
|
661
|
+
});
|
662
|
+
return result;
|
663
|
+
};
|
664
|
+
ZigbeeLampeWeiss.prototype.getTasterBooleanOn = function () {
|
665
|
+
return this.tasterBooleanOn;
|
666
|
+
};
|
667
|
+
ZigbeeLampeWeiss.prototype.getTasterBooleanOff = function () {
|
668
|
+
return this.tasterBooleanOff;
|
669
|
+
};
|
670
|
+
ZigbeeLampeWeiss.prototype.createState = function (key_in) {
|
671
|
+
var jarvisDatenpunkt = key_in; //.replace(/\./g,'_'); // wegen Wohnzimmer T.V.
|
672
|
+
//log(">>> CREATE STATE: " + jarvisDatenpunkt);
|
673
|
+
this.adapter.createState(jarvisDatenpunkt, false, {
|
674
|
+
name: jarvisDatenpunkt,
|
675
|
+
desc: jarvisDatenpunkt,
|
676
|
+
type: 'boolean',
|
677
|
+
read: true,
|
678
|
+
write: true
|
679
|
+
});
|
680
|
+
};
|
681
|
+
ZigbeeLampeWeiss.prototype.isSwitchedOn = function () {
|
682
|
+
if (this.adapter.getState(this.baseState + ".on").val == false) { // hue.0.Steckdose_Backstube.on
|
683
|
+
return false;
|
684
|
+
}
|
685
|
+
return true;
|
686
|
+
};
|
687
|
+
ZigbeeLampeWeiss.prototype.turnOn = function () {
|
688
|
+
if (this.alexaLevelSchemeForOn == null) { // Schalte Licht nur ein
|
689
|
+
if (this.adapter.getState(this.baseState + ".on").val != true) {
|
690
|
+
this.adapter.setState(this.baseState + ".on", true);
|
691
|
+
}
|
692
|
+
}
|
693
|
+
else {
|
694
|
+
this.changeLevel(this.alexaLevelSchemeForOn);
|
695
|
+
}
|
696
|
+
};
|
697
|
+
ZigbeeLampeWeiss.prototype.turnOff = function () {
|
698
|
+
if (this.adapter.getState(this.baseState + ".on").val != false) {
|
699
|
+
this.adapter.setState(this.baseState + ".on", false);
|
700
|
+
}
|
701
|
+
};
|
702
|
+
ZigbeeLampeWeiss.prototype.changeLevel = function (levelScheme) {
|
703
|
+
this.adapter.log("LampeWeiß --> ChangeLevel: Level:" + levelScheme.getLevel() + ", ct: " + levelScheme.getCt());
|
704
|
+
this.adapter.setState(this.baseState + ".on", true);
|
705
|
+
this.adapter.setState(this.baseState + ".level", levelScheme.getLevel());
|
706
|
+
if (levelScheme.getCt() != -1) {
|
707
|
+
this.adapter.setState(this.baseState + ".ct", levelScheme.getCt());
|
708
|
+
}
|
709
|
+
};
|
710
|
+
ZigbeeLampeWeiss.prototype.isStatusReachable = function () {
|
711
|
+
if (this.isGroup_) {
|
712
|
+
return true;
|
713
|
+
}
|
714
|
+
else {
|
715
|
+
return this.adapter.getState(this.baseState + ".reachable").val; // hue.0.Steckdose_Backstube.reachable
|
716
|
+
}
|
717
|
+
};
|
718
|
+
ZigbeeLampeWeiss.prototype.isGroup = function () {
|
719
|
+
return this.isGroup_;
|
720
|
+
};
|
721
|
+
ZigbeeLampeWeiss.prototype.getDeviceId = function () {
|
722
|
+
if (this.isGroup_) {
|
723
|
+
return "ZG" + this.id.toString().padStart(3, '0');
|
724
|
+
}
|
725
|
+
else {
|
726
|
+
return "Z" + this.id.toString().padStart(3, '0');
|
727
|
+
}
|
728
|
+
};
|
729
|
+
ZigbeeLampeWeiss.prototype.getLevel = function () {
|
730
|
+
return this.adapter.getState(this.baseState + ".level").val;
|
731
|
+
};
|
732
|
+
ZigbeeLampeWeiss.prototype.getCategory = function () {
|
733
|
+
return deviceZigbeeLampeWeiss;
|
734
|
+
};
|
735
|
+
return ZigbeeLampeWeiss;
|
736
|
+
}(AbstractZigbee));
|
737
|
+
exports.ZigbeeLampeWeiss = ZigbeeLampeWeiss;
|
738
|
+
var ColorConverter = /** @class */ (function () {
|
739
|
+
function ColorConverter() {
|
740
|
+
}
|
741
|
+
ColorConverter.prototype.convertXY2HSL = function (x, y) {
|
742
|
+
var bri = 254;
|
743
|
+
var xy = {
|
744
|
+
x: x,
|
745
|
+
y: y
|
746
|
+
};
|
747
|
+
var z = 1.0 - xy.x - xy.y;
|
748
|
+
var Y = bri / 255;
|
749
|
+
var X = (Y / xy.y) * xy.x;
|
750
|
+
var Z = (Y / xy.y) * z;
|
751
|
+
var r = X * 1.656492 - Y * 0.354851 - Z * 0.255038;
|
752
|
+
var g = -X * 0.707196 + Y * 1.655397 + Z * 0.036152;
|
753
|
+
var b = X * 0.051713 - Y * 0.121364 + Z * 1.011530;
|
754
|
+
r = r <= 0.0031308 ? 12.92 * r : (1.0 + 0.055) * Math.pow(r, (1.0 / 2.4)) - 0.055;
|
755
|
+
g = g <= 0.0031308 ? 12.92 * g : (1.0 + 0.055) * Math.pow(g, (1.0 / 2.4)) - 0.055;
|
756
|
+
b = b <= 0.0031308 ? 12.92 * b : (1.0 + 0.055) * Math.pow(b, (1.0 / 2.4)) - 0.055;
|
757
|
+
var r_new = (r * 255).toString();
|
758
|
+
var g_new = (g * 255).toString();
|
759
|
+
var b_new = (b * 255).toString();
|
760
|
+
var red = parseInt(r_new) > 255 ? 255 : parseInt(r_new);
|
761
|
+
var green = parseInt(g_new) > 255 ? 255 : parseInt(g_new);
|
762
|
+
var blue = parseInt(b_new) > 255 ? 255 : parseInt(b_new);
|
763
|
+
red = Math.abs(red);
|
764
|
+
green = Math.abs(green);
|
765
|
+
blue = Math.abs(blue);
|
766
|
+
var min = Math.min(r, g, b), max = Math.max(r, g, b), delta = max - min, h, s, v = max;
|
767
|
+
v = Math.floor(max / 255 * 100);
|
768
|
+
if (max != 0)
|
769
|
+
s = Math.floor(delta / max * 100);
|
770
|
+
else {
|
771
|
+
// black
|
772
|
+
return [0, 0, 0];
|
773
|
+
}
|
774
|
+
if (r == max)
|
775
|
+
h = (g - b) / delta; // between yellow & magenta
|
776
|
+
else if (g == max)
|
777
|
+
h = 2 + (b - r) / delta; // between cyan & yellow
|
778
|
+
else
|
779
|
+
h = 4 + (r - g) / delta; // between magenta & cyan
|
780
|
+
h = Math.floor(h * 60); // degrees
|
781
|
+
if (h < 0)
|
782
|
+
h += 360;
|
783
|
+
return [h, s, v];
|
784
|
+
};
|
785
|
+
ColorConverter.prototype.convertHSL2XY = function (h, s) {
|
786
|
+
var l = 50;
|
787
|
+
// Must be fractions of 1
|
788
|
+
s /= 100;
|
789
|
+
l /= 100;
|
790
|
+
var c = (1 - Math.abs(2 * l - 1)) * s, x = c * (1 - Math.abs((h / 60) % 2 - 1)), m = l - c / 2, r = 0, g = 0, b = 0;
|
791
|
+
if (0 <= h && h < 60) {
|
792
|
+
r = c;
|
793
|
+
g = x;
|
794
|
+
b = 0;
|
795
|
+
}
|
796
|
+
else if (60 <= h && h < 120) {
|
797
|
+
r = x;
|
798
|
+
g = c;
|
799
|
+
b = 0;
|
800
|
+
}
|
801
|
+
else if (120 <= h && h < 180) {
|
802
|
+
r = 0;
|
803
|
+
g = c;
|
804
|
+
b = x;
|
805
|
+
}
|
806
|
+
else if (180 <= h && h < 240) {
|
807
|
+
r = 0;
|
808
|
+
g = x;
|
809
|
+
b = c;
|
810
|
+
}
|
811
|
+
else if (240 <= h && h < 300) {
|
812
|
+
r = x;
|
813
|
+
g = 0;
|
814
|
+
b = c;
|
815
|
+
}
|
816
|
+
else if (300 <= h && h < 360) {
|
817
|
+
r = c;
|
818
|
+
g = 0;
|
819
|
+
b = x;
|
820
|
+
}
|
821
|
+
r = Math.round((r + m) * 255);
|
822
|
+
g = Math.round((g + m) * 255);
|
823
|
+
b = Math.round((b + m) * 255);
|
824
|
+
var red = r;
|
825
|
+
var green = g;
|
826
|
+
var blue = b;
|
827
|
+
if (red > 0.04045)
|
828
|
+
red = Math.pow((red + 0.055) / (1.0 + 0.055), 2.4);
|
829
|
+
else
|
830
|
+
red = red / 12.92;
|
831
|
+
if (green > 0.04045)
|
832
|
+
green = Math.pow((green + 0.055) / (1.0 + 0.055), 2.4);
|
833
|
+
else
|
834
|
+
green = green / 12.92;
|
835
|
+
if (blue > 0.04045)
|
836
|
+
blue = Math.pow((blue + 0.055) / (1.0 + 0.055), 2.4);
|
837
|
+
else
|
838
|
+
blue = blue / 12.92;
|
839
|
+
var X = red * 0.664511 + green * 0.154324 + blue * 0.162028;
|
840
|
+
var Y = red * 0.283881 + green * 0.668433 + blue * 0.047685;
|
841
|
+
var Z = red * 0.000088 + green * 0.07231 + blue * 0.986039;
|
842
|
+
var x2 = X / (X + Y + Z);
|
843
|
+
var y2 = Y / (X + Y + Z);
|
844
|
+
return new Array(x2, y2);
|
845
|
+
};
|
846
|
+
return ColorConverter;
|
847
|
+
}());
|
848
|
+
var ZigbeeSteckdose = /** @class */ (function (_super) {
|
849
|
+
__extends(ZigbeeSteckdose, _super);
|
850
|
+
function ZigbeeSteckdose(adapter, id, baseState, etage, raum, device, alexaSmartNamesForOn, alexaActionNamesForOn, alexaSmartNamesForOff, alexaActionNamesForOff, additionalStates4TurnOn, additionalStates4TurnOff) {
|
851
|
+
var _this = _super.call(this, adapter, id, baseState, etage, raum, device) || this;
|
852
|
+
_this.adapter = adapter;
|
853
|
+
_this.alexaSmartNamesForOn = alexaSmartNamesForOn;
|
854
|
+
_this.alexaSmartNamesForOff = alexaSmartNamesForOff;
|
855
|
+
_this.alexaActionNamesForOn = alexaActionNamesForOn;
|
856
|
+
_this.alexaActionNamesForOff = alexaActionNamesForOff;
|
857
|
+
_this.additionalStates4TurnOn = additionalStates4TurnOn;
|
858
|
+
_this.additionalStates4TurnOff = additionalStates4TurnOff;
|
859
|
+
// Diese boolean States können auch das Licht einschalten. Wird benötigt z.B. bei einem RGB-Farbschema "hell" (realisiert über boolean-Datenpunkt). Dann soll auch die Shelly-Lampe eingeschalten werden
|
860
|
+
_this.additionalStates4TurnOn.forEach(function (turnOnState) {
|
861
|
+
_this.createState(turnOnState);
|
862
|
+
});
|
863
|
+
// Diese boolean States können auch das Licht ausschalten. Wird benötigt z.B. bei einem RGB-Farbschema "hell" (realisiert über boolean-Datenpunkt). Dann soll auch die Shelly-Lampe eingeschalten werden
|
864
|
+
_this.additionalStates4TurnOff.forEach(function (turnOffState) {
|
865
|
+
_this.createState(turnOffState);
|
866
|
+
});
|
867
|
+
_this.alexaSmartNamesForOn.forEach(function (alexaSmartName) {
|
868
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
869
|
+
});
|
870
|
+
_this.alexaSmartNamesForOff.forEach(function (alexaSmartName) {
|
871
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
872
|
+
});
|
873
|
+
_this.alexaActionNamesForOn.forEach(function (alexaSmartName) {
|
874
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
875
|
+
});
|
876
|
+
_this.alexaActionNamesForOff.forEach(function (alexaSmartName) {
|
877
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
878
|
+
});
|
879
|
+
return _this;
|
880
|
+
}
|
881
|
+
ZigbeeSteckdose.prototype.createState = function (key_in) {
|
882
|
+
var jarvisDatenpunkt = key_in; //.replace(/\./g,'_'); // wegen Wohnzimmer T.V.
|
883
|
+
this.adapter.createState(jarvisDatenpunkt, false, {
|
884
|
+
name: jarvisDatenpunkt,
|
885
|
+
desc: jarvisDatenpunkt,
|
886
|
+
type: 'boolean',
|
887
|
+
read: true,
|
888
|
+
write: true
|
889
|
+
});
|
890
|
+
};
|
891
|
+
ZigbeeSteckdose.prototype.getAdditionalStates4TurnOn = function () {
|
892
|
+
return this.additionalStates4TurnOn;
|
893
|
+
};
|
894
|
+
ZigbeeSteckdose.prototype.getAdditionalStates4TurnOff = function () {
|
895
|
+
return this.additionalStates4TurnOff;
|
896
|
+
};
|
897
|
+
ZigbeeSteckdose.prototype.getAlexaSmartNamesForOn = function () {
|
898
|
+
return this.alexaSmartNamesForOn;
|
899
|
+
};
|
900
|
+
ZigbeeSteckdose.prototype.getAlexaSmartNamesForOff = function () {
|
901
|
+
return this.alexaSmartNamesForOff;
|
902
|
+
};
|
903
|
+
ZigbeeSteckdose.prototype.getAlexaActionNamesForOn = function () {
|
904
|
+
return this.alexaActionNamesForOn;
|
905
|
+
};
|
906
|
+
ZigbeeSteckdose.prototype.getAlexaActionNamesForOff = function () {
|
907
|
+
return this.alexaActionNamesForOff;
|
908
|
+
};
|
909
|
+
ZigbeeSteckdose.prototype.getSwitchState = function () {
|
910
|
+
return this.baseState + ".on";
|
911
|
+
};
|
912
|
+
ZigbeeSteckdose.prototype.isSwitchedOn = function () {
|
913
|
+
if (this.adapter.getState(this.baseState + ".on").val == false) { // hue.0.Steckdose_Backstube.on
|
914
|
+
return false;
|
915
|
+
}
|
916
|
+
return true;
|
917
|
+
};
|
918
|
+
ZigbeeSteckdose.prototype.getCategory = function () {
|
919
|
+
return deviceZigbeeSteckdose;
|
920
|
+
};
|
921
|
+
ZigbeeSteckdose.prototype.getAlexaNamesForOnAsString = function () {
|
922
|
+
var result = "";
|
923
|
+
this.alexaSmartNamesForOn.forEach(function (alexaOnName) {
|
924
|
+
if (result == "") {
|
925
|
+
result += alexaOnName;
|
926
|
+
}
|
927
|
+
else {
|
928
|
+
result += ", " + alexaOnName;
|
929
|
+
}
|
930
|
+
});
|
931
|
+
this.alexaActionNamesForOn.forEach(function (alexaOnName) {
|
932
|
+
if (result == "") {
|
933
|
+
result += alexaOnName;
|
934
|
+
}
|
935
|
+
else {
|
936
|
+
result += ", " + alexaOnName;
|
937
|
+
}
|
938
|
+
});
|
939
|
+
return result;
|
940
|
+
};
|
941
|
+
ZigbeeSteckdose.prototype.getAlexaNamesForOffAsString = function () {
|
942
|
+
var result = "";
|
943
|
+
this.alexaSmartNamesForOff.forEach(function (alexaOffName) {
|
944
|
+
if (result == "") {
|
945
|
+
result += alexaOffName;
|
946
|
+
}
|
947
|
+
else {
|
948
|
+
result += ", " + alexaOffName;
|
949
|
+
}
|
950
|
+
});
|
951
|
+
this.alexaActionNamesForOff.forEach(function (alexaOffName) {
|
952
|
+
if (result == "") {
|
953
|
+
result += alexaOffName;
|
954
|
+
}
|
955
|
+
else {
|
956
|
+
result += ", " + alexaOffName;
|
957
|
+
}
|
958
|
+
});
|
959
|
+
return result;
|
960
|
+
};
|
961
|
+
return ZigbeeSteckdose;
|
962
|
+
}(AbstractZigbee));
|
963
|
+
exports.ZigbeeSteckdose = ZigbeeSteckdose;
|
964
|
+
var ZigbeeSchalter = /** @class */ (function (_super) {
|
965
|
+
__extends(ZigbeeSchalter, _super);
|
966
|
+
function ZigbeeSchalter(adapter, id, baseState, etage, raum, device) {
|
967
|
+
var _this = _super.call(this, adapter, id, baseState, etage, raum, device) || this;
|
968
|
+
_this.adapter = adapter;
|
969
|
+
return _this;
|
970
|
+
}
|
971
|
+
ZigbeeSchalter.prototype.getCategory = function () {
|
972
|
+
return deviceZigbeeSchalter;
|
973
|
+
};
|
974
|
+
return ZigbeeSchalter;
|
975
|
+
}(AbstractZigbee));
|
976
|
+
exports.ZigbeeSchalter = ZigbeeSchalter;
|
977
|
+
var ZigbeeRepeater = /** @class */ (function (_super) {
|
978
|
+
__extends(ZigbeeRepeater, _super);
|
979
|
+
function ZigbeeRepeater(adapter, id, baseState, etage, raum, device) {
|
980
|
+
var _this = _super.call(this, adapter, id, baseState, etage, raum, device) || this;
|
981
|
+
_this.adapter = adapter;
|
982
|
+
return _this;
|
983
|
+
}
|
984
|
+
ZigbeeRepeater.prototype.getCategory = function () {
|
985
|
+
return deviceZigbeeRepeater;
|
986
|
+
};
|
987
|
+
return ZigbeeRepeater;
|
988
|
+
}(AbstractZigbee));
|
989
|
+
exports.ZigbeeRepeater = ZigbeeRepeater;
|
990
|
+
var ZigbeeFenstersensor = /** @class */ (function (_super) {
|
991
|
+
__extends(ZigbeeFenstersensor, _super);
|
992
|
+
function ZigbeeFenstersensor(adapter, id, baseState, etage, raum, device) {
|
993
|
+
var _this = _super.call(this, adapter, id, baseState, etage, raum, device) || this;
|
994
|
+
_this.adapter = adapter;
|
995
|
+
return _this;
|
996
|
+
}
|
997
|
+
ZigbeeFenstersensor.prototype.isOpen = function () {
|
998
|
+
if (this.adapter.getState(this.baseState + ".open").val == false) { // deconz.0.Sensors.117.open
|
999
|
+
return false;
|
1000
|
+
}
|
1001
|
+
return true;
|
1002
|
+
};
|
1003
|
+
ZigbeeFenstersensor.prototype.isStatusReachable = function () {
|
1004
|
+
var reachable = this.adapter.getState(this.baseState + ".reachable").val; // hue.0.Steckdose_Backstube.reachable
|
1005
|
+
return reachable;
|
1006
|
+
};
|
1007
|
+
ZigbeeFenstersensor.prototype.getBattery = function () {
|
1008
|
+
return this.adapter.getState(this.baseState + ".battery").val; // // alias.0.Z021.battery
|
1009
|
+
};
|
1010
|
+
ZigbeeFenstersensor.prototype.getCategory = function () {
|
1011
|
+
return deviceZigbeeFenstersensor;
|
1012
|
+
};
|
1013
|
+
return ZigbeeFenstersensor;
|
1014
|
+
}(AbstractZigbee));
|
1015
|
+
exports.ZigbeeFenstersensor = ZigbeeFenstersensor;
|
1016
|
+
var ZigbeeRauchmelder = /** @class */ (function (_super) {
|
1017
|
+
__extends(ZigbeeRauchmelder, _super);
|
1018
|
+
function ZigbeeRauchmelder(adapter, id, baseState, etage, raum, device) {
|
1019
|
+
var _this = _super.call(this, adapter, id, baseState, etage, raum, device) || this;
|
1020
|
+
_this.adapter = adapter;
|
1021
|
+
return _this;
|
1022
|
+
}
|
1023
|
+
ZigbeeRauchmelder.prototype.isFire = function () {
|
1024
|
+
if (this.adapter.getState(this.baseState + ".fire").val == false) { // hue.0.Steckdose_Backstube.on
|
1025
|
+
return false;
|
1026
|
+
}
|
1027
|
+
return true;
|
1028
|
+
};
|
1029
|
+
ZigbeeRauchmelder.prototype.isStatusReachable = function () {
|
1030
|
+
var reachable = this.adapter.getState(this.baseState + ".reachable").val; // hue.0.Steckdose_Backstube.reachable
|
1031
|
+
return reachable;
|
1032
|
+
};
|
1033
|
+
ZigbeeRauchmelder.prototype.getBattery = function () {
|
1034
|
+
return this.adapter.getState(this.baseState + ".battery").val; // // alias.0.Z021.battery
|
1035
|
+
};
|
1036
|
+
ZigbeeRauchmelder.prototype.getCategory = function () {
|
1037
|
+
return deviceZigbeeRauchmelder;
|
1038
|
+
};
|
1039
|
+
return ZigbeeRauchmelder;
|
1040
|
+
}(AbstractZigbee));
|
1041
|
+
exports.ZigbeeRauchmelder = ZigbeeRauchmelder;
|
1042
|
+
var ZigbeeBewegungsmelder = /** @class */ (function (_super) {
|
1043
|
+
__extends(ZigbeeBewegungsmelder, _super);
|
1044
|
+
function ZigbeeBewegungsmelder(adapter, id, baseState, etage, raum, device) {
|
1045
|
+
var _this = _super.call(this, adapter, id, baseState, etage, raum, device) || this;
|
1046
|
+
_this.adapter = adapter;
|
1047
|
+
return _this;
|
1048
|
+
}
|
1049
|
+
ZigbeeBewegungsmelder.prototype.getCategory = function () {
|
1050
|
+
return deviceZigbeeBewegungsmelder;
|
1051
|
+
};
|
1052
|
+
ZigbeeBewegungsmelder.prototype.getBattery = function () {
|
1053
|
+
return this.adapter.getState(this.baseState + ".battery").val; // // alias.0.Z021.battery
|
1054
|
+
};
|
1055
|
+
return ZigbeeBewegungsmelder;
|
1056
|
+
}(AbstractZigbee));
|
1057
|
+
exports.ZigbeeBewegungsmelder = ZigbeeBewegungsmelder;
|
1058
|
+
var ZigbeeWandtaster = /** @class */ (function (_super) {
|
1059
|
+
__extends(ZigbeeWandtaster, _super);
|
1060
|
+
function ZigbeeWandtaster(adapter, id, baseState, etage, raum, device) {
|
1061
|
+
var _this = _super.call(this, adapter, id, baseState, etage, raum, device) || this;
|
1062
|
+
_this.adapter = adapter;
|
1063
|
+
return _this;
|
1064
|
+
}
|
1065
|
+
ZigbeeWandtaster.prototype.getCategory = function () {
|
1066
|
+
return deviceZigbeeWandtaster;
|
1067
|
+
};
|
1068
|
+
ZigbeeWandtaster.prototype.getBattery = function () {
|
1069
|
+
return this.adapter.getState(this.baseState + ".battery").val; // // alias.0.Z021.battery
|
1070
|
+
};
|
1071
|
+
return ZigbeeWandtaster;
|
1072
|
+
}(AbstractZigbee));
|
1073
|
+
exports.ZigbeeWandtaster = ZigbeeWandtaster;
|
1074
|
+
var ZigbeeDosenrelais = /** @class */ (function (_super) {
|
1075
|
+
__extends(ZigbeeDosenrelais, _super);
|
1076
|
+
function ZigbeeDosenrelais(adapter, id, baseState, etage, raum, device, alexaSmartNames) {
|
1077
|
+
var _this = _super.call(this, adapter, id, baseState, etage, raum, device) || this;
|
1078
|
+
_this.adapter = adapter;
|
1079
|
+
_this.alexaSmartNames = alexaSmartNames;
|
1080
|
+
_this.alexaSmartNames.forEach(function (alexaSmartName) {
|
1081
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
1082
|
+
});
|
1083
|
+
return _this;
|
1084
|
+
}
|
1085
|
+
ZigbeeDosenrelais.prototype.getSwitchState = function () {
|
1086
|
+
return this.baseState + ".on";
|
1087
|
+
};
|
1088
|
+
ZigbeeDosenrelais.prototype.isSwitchedOn = function () {
|
1089
|
+
if (this.adapter.getState(this.baseState + ".on").val == false) {
|
1090
|
+
return false;
|
1091
|
+
}
|
1092
|
+
return true;
|
1093
|
+
};
|
1094
|
+
ZigbeeDosenrelais.prototype.turnOn = function () {
|
1095
|
+
this.adapter.setState(this.baseState + ".on", true);
|
1096
|
+
};
|
1097
|
+
ZigbeeDosenrelais.prototype.turnOff = function () {
|
1098
|
+
this.adapter.setState(this.baseState + ".on", false);
|
1099
|
+
};
|
1100
|
+
ZigbeeDosenrelais.prototype.getCategory = function () {
|
1101
|
+
return deviceZigbeeDosenrelais;
|
1102
|
+
};
|
1103
|
+
ZigbeeDosenrelais.prototype.getAlexaSmartNames = function () {
|
1104
|
+
return this.alexaSmartNames;
|
1105
|
+
};
|
1106
|
+
return ZigbeeDosenrelais;
|
1107
|
+
}(AbstractZigbee));
|
1108
|
+
exports.ZigbeeDosenrelais = ZigbeeDosenrelais;
|
1109
|
+
var AlexaInputConverter = /** @class */ (function () {
|
1110
|
+
function AlexaInputConverter(adapter, value, logContext) {
|
1111
|
+
this.actionTurnOn = false;
|
1112
|
+
this.actionTurnOff = false;
|
1113
|
+
this.actionChangeLevel = false;
|
1114
|
+
this.actionChangeColor = false;
|
1115
|
+
this.actionChangeCT = false;
|
1116
|
+
this.smartName = "?";
|
1117
|
+
this.levelNew = -1;
|
1118
|
+
this.hueNew = -1;
|
1119
|
+
this.ctNew = -1;
|
1120
|
+
this.adapter = adapter;
|
1121
|
+
this.value = value;
|
1122
|
+
if (this.value.toString().endsWith('.level')) {
|
1123
|
+
this.smartName = this.value.replace("0_userdata.0.alexa.", "").replace(".level", "");
|
1124
|
+
this.levelNew = this.adapter.getState(value).val;
|
1125
|
+
if (this.levelNew == 100) {
|
1126
|
+
this.actionTurnOn = true;
|
1127
|
+
}
|
1128
|
+
else if (this.levelNew == 0) {
|
1129
|
+
this.actionTurnOff = true;
|
1130
|
+
}
|
1131
|
+
else {
|
1132
|
+
this.actionChangeLevel = true;
|
1133
|
+
}
|
1134
|
+
}
|
1135
|
+
else if (value.endsWith('.hue')) {
|
1136
|
+
this.smartName = value.replace("0_userdata.0.alexa.", "").replace(".hue", "");
|
1137
|
+
this.hueNew = this.adapter.getState(this.value).val;
|
1138
|
+
this.actionChangeColor = true;
|
1139
|
+
}
|
1140
|
+
else if (value.endsWith('.ct')) {
|
1141
|
+
this.smartName = value.replace("0_userdata.0.alexa.", "").replace(".ct", "");
|
1142
|
+
this.ctNew = this.adapter.getState(value).val;
|
1143
|
+
this.actionChangeCT = true;
|
1144
|
+
}
|
1145
|
+
this.adapter.log("");
|
1146
|
+
this.adapter.log(">>> ALEXA (" + logContext + ") >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
1147
|
+
this.adapter.log(" Value : " + this.value);
|
1148
|
+
this.adapter.log(" smartName : " + this.smartName);
|
1149
|
+
this.adapter.log(" actionTurnOn : " + this.actionTurnOn);
|
1150
|
+
this.adapter.log(" actionTurnOff : " + this.actionTurnOff);
|
1151
|
+
if (this.actionChangeLevel) {
|
1152
|
+
this.adapter.log(" actionChangeLevel: " + this.actionChangeLevel + " (" + this.levelNew + ")");
|
1153
|
+
}
|
1154
|
+
else {
|
1155
|
+
this.adapter.log(" actionChangeLevel: " + this.actionChangeLevel);
|
1156
|
+
}
|
1157
|
+
if (this.actionChangeColor) {
|
1158
|
+
this.adapter.log(" actionChangeColor: " + this.actionChangeColor + " (" + this.hueNew + ")");
|
1159
|
+
}
|
1160
|
+
else {
|
1161
|
+
this.adapter.log(" actionChangeColor: " + this.actionChangeColor);
|
1162
|
+
}
|
1163
|
+
if (this.actionChangeCT) {
|
1164
|
+
this.adapter.log(" actionChangeCT: " + this.actionChangeCT + " (" + this.ctNew + ")");
|
1165
|
+
}
|
1166
|
+
else {
|
1167
|
+
this.adapter.log(" actionChangeCT: " + this.actionChangeCT);
|
1168
|
+
}
|
1169
|
+
this.adapter.log("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
|
1170
|
+
}
|
1171
|
+
AlexaInputConverter.prototype.isActionTurnedOn = function () {
|
1172
|
+
return this.actionTurnOn;
|
1173
|
+
};
|
1174
|
+
AlexaInputConverter.prototype.isActionTurnedOff = function () {
|
1175
|
+
return this.actionTurnOff;
|
1176
|
+
};
|
1177
|
+
AlexaInputConverter.prototype.isActionChangedLevel = function () {
|
1178
|
+
return this.actionChangeLevel;
|
1179
|
+
};
|
1180
|
+
AlexaInputConverter.prototype.isActionChangedColor = function () {
|
1181
|
+
return this.actionChangeColor;
|
1182
|
+
};
|
1183
|
+
AlexaInputConverter.prototype.isActionChangedColorTemperature = function () {
|
1184
|
+
return this.actionChangeCT;
|
1185
|
+
};
|
1186
|
+
AlexaInputConverter.prototype.getSmartName = function () {
|
1187
|
+
return this.smartName;
|
1188
|
+
};
|
1189
|
+
AlexaInputConverter.prototype.getLevel = function () {
|
1190
|
+
return this.levelNew;
|
1191
|
+
};
|
1192
|
+
AlexaInputConverter.prototype.getHue = function () {
|
1193
|
+
return this.hueNew;
|
1194
|
+
};
|
1195
|
+
AlexaInputConverter.prototype.getColorTemperature = function () {
|
1196
|
+
return this.ctNew;
|
1197
|
+
};
|
1198
|
+
return AlexaInputConverter;
|
1199
|
+
}());
|
1200
|
+
exports.AlexaInputConverter = AlexaInputConverter;
|
1201
|
+
module.exports = {
|
1202
|
+
AbstractZigbee: AbstractZigbee,
|
1203
|
+
ColorScheme: ColorScheme,
|
1204
|
+
RGBColorScheme: RGBColorScheme,
|
1205
|
+
WhiteColorScheme: WhiteColorScheme,
|
1206
|
+
ZigbeeLampeRGB: ZigbeeLampeRGB,
|
1207
|
+
LampeWeissTasterScheme: LampeWeissTasterScheme,
|
1208
|
+
LampeWeissAlexaScheme: LampeWeissAlexaScheme,
|
1209
|
+
ZigbeeLampeWeiss: ZigbeeLampeWeiss,
|
1210
|
+
ZigbeeSteckdose: ZigbeeSteckdose,
|
1211
|
+
ZigbeeSchalter: ZigbeeSchalter,
|
1212
|
+
ZigbeeRepeater: ZigbeeRepeater,
|
1213
|
+
ZigbeeFenstersensor: ZigbeeFenstersensor,
|
1214
|
+
ZigbeeRauchmelder: ZigbeeRauchmelder,
|
1215
|
+
ZigbeeBewegungsmelder: ZigbeeBewegungsmelder,
|
1216
|
+
ZigbeeWandtaster: ZigbeeWandtaster,
|
1217
|
+
ZigbeeDosenrelais: ZigbeeDosenrelais,
|
1218
|
+
AlexaInputConverter: AlexaInputConverter,
|
1219
|
+
deviceZigbeeSteckdose: deviceZigbeeSteckdose,
|
1220
|
+
deviceZigbeeBewegungsmelder: deviceZigbeeBewegungsmelder,
|
1221
|
+
deviceZigbeeLampeRGB: deviceZigbeeLampeRGB,
|
1222
|
+
deviceZigbeeLampeWeiss: deviceZigbeeLampeWeiss,
|
1223
|
+
deviceZigbeeRauchmelder: deviceZigbeeRauchmelder,
|
1224
|
+
deviceZigbeeWandtaster: deviceZigbeeWandtaster,
|
1225
|
+
deviceZigbeeDosenrelais: deviceZigbeeDosenrelais,
|
1226
|
+
deviceZigbeeSchalter: deviceZigbeeSchalter,
|
1227
|
+
deviceZigbeeRepeater: deviceZigbeeRepeater,
|
1228
|
+
deviceZigbeeFenstersensor: deviceZigbeeFenstersensor
|
1229
|
+
};
|