iobroker-ucl 1.4.9 → 1.4.11
Sign up to get free protection for your applications and to get access to all the features.
- package/!!!_INSTRUCTIONS_!!!.ts +38 -3
- package/alexa.js +103 -103
- package/camera.js +60 -61
- package/camera.ts +5 -5
- package/date.js +43 -43
- package/homematicClasses.js +775 -775
- package/homematicFunctions.js +953 -954
- package/html.js +417 -417
- package/main.js +185 -185
- package/package.json +1 -1
- package/shellyClasses.js +763 -763
- package/shellyFunctions.js +732 -733
- package/test.js +59 -58
- package/test.ts +2 -0
- package/zigbeeClasses.js +1139 -1139
- package/zigbeeFunctions.js +1189 -1190
package/zigbeeClasses.js
CHANGED
@@ -1,1139 +1,1139 @@
|
|
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.ZigbeeDosenrelais = exports.ZigbeeWandtaster = exports.ZigbeeBewegungsmelder = exports.ZigbeeRauchmelder = exports.ZigbeeFenstersensor = exports.ZigbeeRepeater = exports.ZigbeeSchalter = exports.ZigbeeSteckdose = exports.ColorConverter = 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
|
-
_this.adapter.setState(_this.getBaseState() + ".xy", _this.colorConverter.convertHSL2XY(rgbColorscheme.getHue(), rgbColorscheme.getSat()).join()); // Im Hue-Fall ist es ein String
|
393
|
-
}
|
394
|
-
else {
|
395
|
-
var whiteColorscheme = colorscheme;
|
396
|
-
_this.adapter.setState(_this.getBaseState() + ".ct", whiteColorscheme.getCt());
|
397
|
-
//log(">>> deconz changeColor: Set ct to: " + whiteColorscheme.getCt());
|
398
|
-
}
|
399
|
-
}, 300);
|
400
|
-
}, 600);
|
401
|
-
}
|
402
|
-
};
|
403
|
-
ZigbeeLampeRGB.prototype.turnOn = function () {
|
404
|
-
if (this.alexaColorSchemeForOn == null) { // Schalte Licht nur ein, d.h. lass die Farbwerte so wie sie sind
|
405
|
-
this.adapter.setState(this.getBaseState() + ".on", true);
|
406
|
-
}
|
407
|
-
else {
|
408
|
-
this.changeColor(this.alexaColorSchemeForOn);
|
409
|
-
}
|
410
|
-
};
|
411
|
-
ZigbeeLampeRGB.prototype.turnOff = function () {
|
412
|
-
this.adapter.setState(this.getBaseState() + ".on", false);
|
413
|
-
};
|
414
|
-
ZigbeeLampeRGB.prototype.getAlexaNamesForOnAsString = function () {
|
415
|
-
var result = "";
|
416
|
-
this.alexaSmartNamesForOn.forEach(function (alexaOnName) {
|
417
|
-
if (result == "") {
|
418
|
-
result += alexaOnName;
|
419
|
-
}
|
420
|
-
else {
|
421
|
-
result += ", " + alexaOnName;
|
422
|
-
}
|
423
|
-
});
|
424
|
-
this.alexaActionNamesForOn.forEach(function (alexaOnName) {
|
425
|
-
if (result == "") {
|
426
|
-
result += alexaOnName;
|
427
|
-
}
|
428
|
-
else {
|
429
|
-
result += ", " + alexaOnName;
|
430
|
-
}
|
431
|
-
});
|
432
|
-
return result;
|
433
|
-
};
|
434
|
-
ZigbeeLampeRGB.prototype.getAlexaNamesForOffAsString = function () {
|
435
|
-
var result = "";
|
436
|
-
this.alexaSmartNamesForOff.forEach(function (alexaOffName) {
|
437
|
-
if (result == "") {
|
438
|
-
result += alexaOffName;
|
439
|
-
}
|
440
|
-
else {
|
441
|
-
result += ", " + alexaOffName;
|
442
|
-
}
|
443
|
-
});
|
444
|
-
this.alexaActionNamesForOff.forEach(function (alexaOffName) {
|
445
|
-
if (result == "") {
|
446
|
-
result += alexaOffName;
|
447
|
-
}
|
448
|
-
else {
|
449
|
-
result += ", " + alexaOffName;
|
450
|
-
}
|
451
|
-
});
|
452
|
-
return result;
|
453
|
-
};
|
454
|
-
ZigbeeLampeRGB.prototype.isSwitchedOn = function () {
|
455
|
-
if (this.adapter.getState(this.baseState + ".on").val == false) { // hue.0.Steckdose_Backstube.on
|
456
|
-
return false;
|
457
|
-
}
|
458
|
-
return true;
|
459
|
-
};
|
460
|
-
ZigbeeLampeRGB.prototype.getGroupMembers = function () {
|
461
|
-
return this.groupMembers;
|
462
|
-
};
|
463
|
-
ZigbeeLampeRGB.prototype.getAlexaSmartNamesForOn = function () {
|
464
|
-
return this.alexaSmartNamesForOn;
|
465
|
-
};
|
466
|
-
ZigbeeLampeRGB.prototype.getAlexaSmartNamesForOff = function () {
|
467
|
-
return this.alexaSmartNamesForOff;
|
468
|
-
};
|
469
|
-
ZigbeeLampeRGB.prototype.getAlexaActionNamesForOn = function () {
|
470
|
-
return this.alexaActionNamesForOn;
|
471
|
-
};
|
472
|
-
ZigbeeLampeRGB.prototype.getAlexaActionNamesForOff = function () {
|
473
|
-
return this.alexaActionNamesForOff;
|
474
|
-
};
|
475
|
-
ZigbeeLampeRGB.prototype.isGroup = function () {
|
476
|
-
return this.isGroup_;
|
477
|
-
};
|
478
|
-
ZigbeeLampeRGB.prototype.getDeviceId = function () {
|
479
|
-
if (this.isGroup_) {
|
480
|
-
return "ZG" + this.id.toString().padStart(3, '0');
|
481
|
-
}
|
482
|
-
else {
|
483
|
-
return "Z" + this.id.toString().padStart(3, '0');
|
484
|
-
}
|
485
|
-
};
|
486
|
-
ZigbeeLampeRGB.prototype.isStatusReachable = function () {
|
487
|
-
if (this.isGroup_) {
|
488
|
-
return true;
|
489
|
-
}
|
490
|
-
else {
|
491
|
-
return this.adapter.getState(this.baseState + ".reachable").val; // hue.0.Steckdose_Backstube.reachable
|
492
|
-
}
|
493
|
-
};
|
494
|
-
ZigbeeLampeRGB.prototype.getLevel = function () {
|
495
|
-
return this.adapter.getState(this.baseState + ".level").val;
|
496
|
-
};
|
497
|
-
ZigbeeLampeRGB.prototype.getCategory = function () {
|
498
|
-
return deviceZigbeeLampeRGB;
|
499
|
-
};
|
500
|
-
return ZigbeeLampeRGB;
|
501
|
-
}(AbstractZigbee));
|
502
|
-
exports.ZigbeeLampeRGB = ZigbeeLampeRGB;
|
503
|
-
var LampeWeissTasterScheme = /** @class */ (function () {
|
504
|
-
function LampeWeissTasterScheme(tasterBooleanOn, level, ct) {
|
505
|
-
this.tasterBooleanOn = tasterBooleanOn;
|
506
|
-
this.level = level;
|
507
|
-
this.ct = ct;
|
508
|
-
}
|
509
|
-
LampeWeissTasterScheme.prototype.getTasterBooleanOnName = function () {
|
510
|
-
return this.tasterBooleanOn;
|
511
|
-
};
|
512
|
-
LampeWeissTasterScheme.prototype.getLevel = function () {
|
513
|
-
return this.level;
|
514
|
-
};
|
515
|
-
LampeWeissTasterScheme.prototype.getCt = function () {
|
516
|
-
return this.ct;
|
517
|
-
};
|
518
|
-
return LampeWeissTasterScheme;
|
519
|
-
}());
|
520
|
-
exports.LampeWeissTasterScheme = LampeWeissTasterScheme;
|
521
|
-
var LampeWeissAlexaScheme = /** @class */ (function () {
|
522
|
-
function LampeWeissAlexaScheme(alexaName, level, ct) {
|
523
|
-
this.alexaName = alexaName;
|
524
|
-
this.level = level;
|
525
|
-
this.ct = ct;
|
526
|
-
}
|
527
|
-
LampeWeissAlexaScheme.prototype.getAlexaName = function () {
|
528
|
-
return this.alexaName;
|
529
|
-
};
|
530
|
-
LampeWeissAlexaScheme.prototype.getLevel = function () {
|
531
|
-
return this.level;
|
532
|
-
};
|
533
|
-
LampeWeissAlexaScheme.prototype.setDevice = function (device) {
|
534
|
-
this.device = device;
|
535
|
-
};
|
536
|
-
LampeWeissAlexaScheme.prototype.getDevice = function () {
|
537
|
-
return this.device;
|
538
|
-
};
|
539
|
-
LampeWeissAlexaScheme.prototype.getCt = function () {
|
540
|
-
return this.ct;
|
541
|
-
};
|
542
|
-
return LampeWeissAlexaScheme;
|
543
|
-
}());
|
544
|
-
exports.LampeWeissAlexaScheme = LampeWeissAlexaScheme;
|
545
|
-
var ZigbeeLampeWeiss = /** @class */ (function (_super) {
|
546
|
-
__extends(ZigbeeLampeWeiss, _super);
|
547
|
-
function ZigbeeLampeWeiss(adapter, id, baseState, etage, raum, device, alexaSmartNamesForOn, alexaActionNamesForOn, alexaLevelSchemeForOn, alexaSmartNamesForOff, alexaActionNamesForOff, levelSchemes, isGroup_, tasterBooleanOn, tasterBooleanOff, nachtbeleuchtung, turnOffExitHouseSummer, turnOffExitHouseWinter, turnOnEnterHouseSummer, turnOnEnterHouseWinter) {
|
548
|
-
var _this = _super.call(this, adapter, id, baseState, etage, raum, device) || this;
|
549
|
-
_this.adapter = adapter;
|
550
|
-
_this.alexaLevelSchemeForOn = alexaLevelSchemeForOn;
|
551
|
-
_this.alexaSmartNamesForOn = alexaSmartNamesForOn;
|
552
|
-
_this.alexaSmartNamesForOff = alexaSmartNamesForOff;
|
553
|
-
_this.alexaActionNamesForOn = alexaActionNamesForOn;
|
554
|
-
_this.alexaActionNamesForOff = alexaActionNamesForOff;
|
555
|
-
_this.nachtbeleuchtung = nachtbeleuchtung;
|
556
|
-
_this.turnOffExitHouseSummer = turnOffExitHouseSummer;
|
557
|
-
_this.turnOffExitHouseWinter = turnOffExitHouseWinter;
|
558
|
-
_this.turnOnEnterHouseSummer = turnOnEnterHouseSummer;
|
559
|
-
_this.turnOnEnterHouseWinter = turnOnEnterHouseWinter;
|
560
|
-
_this.isGroup_ = isGroup_;
|
561
|
-
_this.tasterBooleanOn = tasterBooleanOn;
|
562
|
-
_this.tasterBooleanOff = tasterBooleanOff;
|
563
|
-
_this.levelSchemes = levelSchemes;
|
564
|
-
// States anlegen:
|
565
|
-
_this.tasterBooleanOn.forEach(function (tasterScheme) {
|
566
|
-
if (tasterScheme.getTasterBooleanOnName() != null) {
|
567
|
-
_this.createState(tasterScheme.getTasterBooleanOnName());
|
568
|
-
}
|
569
|
-
});
|
570
|
-
_this.tasterBooleanOff.forEach(function (offName) {
|
571
|
-
_this.createState(offName);
|
572
|
-
});
|
573
|
-
_this.alexaSmartNamesForOn.forEach(function (alexaSmartName) {
|
574
|
-
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
575
|
-
});
|
576
|
-
_this.alexaSmartNamesForOff.forEach(function (alexaSmartName) {
|
577
|
-
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
578
|
-
});
|
579
|
-
_this.alexaActionNamesForOn.forEach(function (alexaSmartName) {
|
580
|
-
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
581
|
-
});
|
582
|
-
_this.alexaActionNamesForOff.forEach(function (alexaSmartName) {
|
583
|
-
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
584
|
-
});
|
585
|
-
_this.levelSchemes.forEach(function (scheme) {
|
586
|
-
if (scheme.getAlexaName() != null) {
|
587
|
-
_this.createIOTAdapterSmartDevices(scheme.getAlexaName());
|
588
|
-
}
|
589
|
-
});
|
590
|
-
return _this;
|
591
|
-
}
|
592
|
-
ZigbeeLampeWeiss.prototype.isNachtbeleuchtung = function () {
|
593
|
-
return this.nachtbeleuchtung;
|
594
|
-
};
|
595
|
-
ZigbeeLampeWeiss.prototype.isTurnOffExitHouseSummer = function () {
|
596
|
-
return this.turnOffExitHouseSummer;
|
597
|
-
};
|
598
|
-
ZigbeeLampeWeiss.prototype.isTurnOffExitHouseWinter = function () {
|
599
|
-
return this.turnOffExitHouseWinter;
|
600
|
-
};
|
601
|
-
ZigbeeLampeWeiss.prototype.isTurnOnEnterHouseSummer = function () {
|
602
|
-
return this.turnOnEnterHouseSummer;
|
603
|
-
};
|
604
|
-
ZigbeeLampeWeiss.prototype.isTurnOnEnterHouseWinter = function () {
|
605
|
-
return this.turnOnEnterHouseWinter;
|
606
|
-
};
|
607
|
-
ZigbeeLampeWeiss.prototype.getAlexaSmartNamesForOn = function () {
|
608
|
-
return this.alexaSmartNamesForOn;
|
609
|
-
};
|
610
|
-
ZigbeeLampeWeiss.prototype.getAlexaSmartNamesForOff = function () {
|
611
|
-
return this.alexaSmartNamesForOff;
|
612
|
-
};
|
613
|
-
ZigbeeLampeWeiss.prototype.getAlexaActionNamesForOn = function () {
|
614
|
-
return this.alexaActionNamesForOn;
|
615
|
-
};
|
616
|
-
ZigbeeLampeWeiss.prototype.getAlexaActionNamesForOff = function () {
|
617
|
-
return this.alexaActionNamesForOff;
|
618
|
-
};
|
619
|
-
ZigbeeLampeWeiss.prototype.getAlexaSchemes = function () {
|
620
|
-
return this.levelSchemes;
|
621
|
-
};
|
622
|
-
ZigbeeLampeWeiss.prototype.getAlexaSchemeForOn = function () {
|
623
|
-
return this.alexaLevelSchemeForOn;
|
624
|
-
};
|
625
|
-
ZigbeeLampeWeiss.prototype.getAlexaNamesForOnAsString = function () {
|
626
|
-
var result = "";
|
627
|
-
this.alexaSmartNamesForOn.forEach(function (alexaOnName) {
|
628
|
-
if (result == "") {
|
629
|
-
result += alexaOnName;
|
630
|
-
}
|
631
|
-
else {
|
632
|
-
result += ", " + alexaOnName;
|
633
|
-
}
|
634
|
-
});
|
635
|
-
this.alexaActionNamesForOn.forEach(function (alexaOnName) {
|
636
|
-
if (result == "") {
|
637
|
-
result += alexaOnName;
|
638
|
-
}
|
639
|
-
else {
|
640
|
-
result += ", " + alexaOnName;
|
641
|
-
}
|
642
|
-
});
|
643
|
-
return result;
|
644
|
-
};
|
645
|
-
ZigbeeLampeWeiss.prototype.getAlexaNamesForOffAsString = function () {
|
646
|
-
var result = "";
|
647
|
-
this.alexaSmartNamesForOff.forEach(function (alexaOffName) {
|
648
|
-
if (result == "") {
|
649
|
-
result += alexaOffName;
|
650
|
-
}
|
651
|
-
else {
|
652
|
-
result += ", " + alexaOffName;
|
653
|
-
}
|
654
|
-
});
|
655
|
-
this.alexaActionNamesForOff.forEach(function (alexaOffName) {
|
656
|
-
if (result == "") {
|
657
|
-
result += alexaOffName;
|
658
|
-
}
|
659
|
-
else {
|
660
|
-
result += ", " + alexaOffName;
|
661
|
-
}
|
662
|
-
});
|
663
|
-
return result;
|
664
|
-
};
|
665
|
-
ZigbeeLampeWeiss.prototype.getTasterBooleanOn = function () {
|
666
|
-
return this.tasterBooleanOn;
|
667
|
-
};
|
668
|
-
ZigbeeLampeWeiss.prototype.getTasterBooleanOff = function () {
|
669
|
-
return this.tasterBooleanOff;
|
670
|
-
};
|
671
|
-
ZigbeeLampeWeiss.prototype.createState = function (key_in) {
|
672
|
-
var jarvisDatenpunkt = key_in; //.replace(/\./g,'_'); // wegen Wohnzimmer T.V.
|
673
|
-
//log(">>> CREATE STATE: " + jarvisDatenpunkt);
|
674
|
-
this.adapter.createState(jarvisDatenpunkt, false, {
|
675
|
-
name: jarvisDatenpunkt,
|
676
|
-
desc: jarvisDatenpunkt,
|
677
|
-
type: 'boolean',
|
678
|
-
read: true,
|
679
|
-
write: true
|
680
|
-
});
|
681
|
-
};
|
682
|
-
ZigbeeLampeWeiss.prototype.isSwitchedOn = function () {
|
683
|
-
if (this.adapter.getState(this.baseState + ".on").val == false) { // hue.0.Steckdose_Backstube.on
|
684
|
-
return false;
|
685
|
-
}
|
686
|
-
return true;
|
687
|
-
};
|
688
|
-
ZigbeeLampeWeiss.prototype.turnOn = function () {
|
689
|
-
if (this.alexaLevelSchemeForOn == null) { // Schalte Licht nur ein
|
690
|
-
if (this.adapter.getState(this.baseState + ".on").val != true) {
|
691
|
-
this.adapter.setState(this.baseState + ".on", true);
|
692
|
-
}
|
693
|
-
}
|
694
|
-
else {
|
695
|
-
this.changeLevel(this.alexaLevelSchemeForOn);
|
696
|
-
}
|
697
|
-
};
|
698
|
-
ZigbeeLampeWeiss.prototype.turnOff = function () {
|
699
|
-
if (this.adapter.getState(this.baseState + ".on").val != false) {
|
700
|
-
this.adapter.setState(this.baseState + ".on", false);
|
701
|
-
}
|
702
|
-
};
|
703
|
-
ZigbeeLampeWeiss.prototype.changeLevel = function (levelScheme) {
|
704
|
-
this.adapter.log("LampeWeiß --> ChangeLevel: Level:" + levelScheme.getLevel() + ", ct: " + levelScheme.getCt());
|
705
|
-
this.adapter.setState(this.baseState + ".on", true);
|
706
|
-
this.adapter.setState(this.baseState + ".level", levelScheme.getLevel());
|
707
|
-
if (levelScheme.getCt() != -1) {
|
708
|
-
this.adapter.setState(this.baseState + ".ct", levelScheme.getCt());
|
709
|
-
}
|
710
|
-
};
|
711
|
-
ZigbeeLampeWeiss.prototype.isStatusReachable = function () {
|
712
|
-
if (this.isGroup_) {
|
713
|
-
return true;
|
714
|
-
}
|
715
|
-
else {
|
716
|
-
return this.adapter.getState(this.baseState + ".reachable").val; // hue.0.Steckdose_Backstube.reachable
|
717
|
-
}
|
718
|
-
};
|
719
|
-
ZigbeeLampeWeiss.prototype.isGroup = function () {
|
720
|
-
return this.isGroup_;
|
721
|
-
};
|
722
|
-
ZigbeeLampeWeiss.prototype.getDeviceId = function () {
|
723
|
-
if (this.isGroup_) {
|
724
|
-
return "ZG" + this.id.toString().padStart(3, '0');
|
725
|
-
}
|
726
|
-
else {
|
727
|
-
return "Z" + this.id.toString().padStart(3, '0');
|
728
|
-
}
|
729
|
-
};
|
730
|
-
ZigbeeLampeWeiss.prototype.getLevel = function () {
|
731
|
-
return this.adapter.getState(this.baseState + ".level").val;
|
732
|
-
};
|
733
|
-
ZigbeeLampeWeiss.prototype.getCategory = function () {
|
734
|
-
return deviceZigbeeLampeWeiss;
|
735
|
-
};
|
736
|
-
return ZigbeeLampeWeiss;
|
737
|
-
}(AbstractZigbee));
|
738
|
-
exports.ZigbeeLampeWeiss = ZigbeeLampeWeiss;
|
739
|
-
var ColorConverter = /** @class */ (function () {
|
740
|
-
function ColorConverter() {
|
741
|
-
}
|
742
|
-
ColorConverter.prototype.convertXY2HSL = function (x, y) {
|
743
|
-
var bri = 254;
|
744
|
-
var xy = {
|
745
|
-
x: x,
|
746
|
-
y: y
|
747
|
-
};
|
748
|
-
var z = 1.0 - xy.x - xy.y;
|
749
|
-
var Y = bri / 255;
|
750
|
-
var X = (Y / xy.y) * xy.x;
|
751
|
-
var Z = (Y / xy.y) * z;
|
752
|
-
var r = X * 1.656492 - Y * 0.354851 - Z * 0.255038;
|
753
|
-
var g = -X * 0.707196 + Y * 1.655397 + Z * 0.036152;
|
754
|
-
var b = X * 0.051713 - Y * 0.121364 + Z * 1.011530;
|
755
|
-
r = r <= 0.0031308 ? 12.92 * r : (1.0 + 0.055) * Math.pow(r, (1.0 / 2.4)) - 0.055;
|
756
|
-
g = g <= 0.0031308 ? 12.92 * g : (1.0 + 0.055) * Math.pow(g, (1.0 / 2.4)) - 0.055;
|
757
|
-
b = b <= 0.0031308 ? 12.92 * b : (1.0 + 0.055) * Math.pow(b, (1.0 / 2.4)) - 0.055;
|
758
|
-
var r_new = (r * 255).toString();
|
759
|
-
var g_new = (g * 255).toString();
|
760
|
-
var b_new = (b * 255).toString();
|
761
|
-
var red = parseInt(r_new) > 255 ? 255 : parseInt(r_new);
|
762
|
-
var green = parseInt(g_new) > 255 ? 255 : parseInt(g_new);
|
763
|
-
var blue = parseInt(b_new) > 255 ? 255 : parseInt(b_new);
|
764
|
-
red = Math.abs(red);
|
765
|
-
green = Math.abs(green);
|
766
|
-
blue = Math.abs(blue);
|
767
|
-
var min = Math.min(r, g, b), max = Math.max(r, g, b), delta = max - min, h, s, v = max;
|
768
|
-
v = Math.floor(max / 255 * 100);
|
769
|
-
if (max != 0)
|
770
|
-
s = Math.floor(delta / max * 100);
|
771
|
-
else {
|
772
|
-
// black
|
773
|
-
return [0, 0, 0];
|
774
|
-
}
|
775
|
-
if (r == max)
|
776
|
-
h = (g - b) / delta; // between yellow & magenta
|
777
|
-
else if (g == max)
|
778
|
-
h = 2 + (b - r) / delta; // between cyan & yellow
|
779
|
-
else
|
780
|
-
h = 4 + (r - g) / delta; // between magenta & cyan
|
781
|
-
h = Math.floor(h * 60); // degrees
|
782
|
-
if (h < 0)
|
783
|
-
h += 360;
|
784
|
-
return [h, s, v];
|
785
|
-
};
|
786
|
-
ColorConverter.prototype.convertHSL2XY = function (h, s) {
|
787
|
-
var l = 50;
|
788
|
-
// Must be fractions of 1
|
789
|
-
s /= 100;
|
790
|
-
l /= 100;
|
791
|
-
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;
|
792
|
-
if (0 <= h && h < 60) {
|
793
|
-
r = c;
|
794
|
-
g = x;
|
795
|
-
b = 0;
|
796
|
-
}
|
797
|
-
else if (60 <= h && h < 120) {
|
798
|
-
r = x;
|
799
|
-
g = c;
|
800
|
-
b = 0;
|
801
|
-
}
|
802
|
-
else if (120 <= h && h < 180) {
|
803
|
-
r = 0;
|
804
|
-
g = c;
|
805
|
-
b = x;
|
806
|
-
}
|
807
|
-
else if (180 <= h && h < 240) {
|
808
|
-
r = 0;
|
809
|
-
g = x;
|
810
|
-
b = c;
|
811
|
-
}
|
812
|
-
else if (240 <= h && h < 300) {
|
813
|
-
r = x;
|
814
|
-
g = 0;
|
815
|
-
b = c;
|
816
|
-
}
|
817
|
-
else if (300 <= h && h < 360) {
|
818
|
-
r = c;
|
819
|
-
g = 0;
|
820
|
-
b = x;
|
821
|
-
}
|
822
|
-
r = Math.round((r + m) * 255);
|
823
|
-
g = Math.round((g + m) * 255);
|
824
|
-
b = Math.round((b + m) * 255);
|
825
|
-
var red = r;
|
826
|
-
var green = g;
|
827
|
-
var blue = b;
|
828
|
-
if (red > 0.04045)
|
829
|
-
red = Math.pow((red + 0.055) / (1.0 + 0.055), 2.4);
|
830
|
-
else
|
831
|
-
red = red / 12.92;
|
832
|
-
if (green > 0.04045)
|
833
|
-
green = Math.pow((green + 0.055) / (1.0 + 0.055), 2.4);
|
834
|
-
else
|
835
|
-
green = green / 12.92;
|
836
|
-
if (blue > 0.04045)
|
837
|
-
blue = Math.pow((blue + 0.055) / (1.0 + 0.055), 2.4);
|
838
|
-
else
|
839
|
-
blue = blue / 12.92;
|
840
|
-
var X = red * 0.664511 + green * 0.154324 + blue * 0.162028;
|
841
|
-
var Y = red * 0.283881 + green * 0.668433 + blue * 0.047685;
|
842
|
-
var Z = red * 0.000088 + green * 0.07231 + blue * 0.986039;
|
843
|
-
var x2 = X / (X + Y + Z);
|
844
|
-
var y2 = Y / (X + Y + Z);
|
845
|
-
return new Array(x2, y2);
|
846
|
-
};
|
847
|
-
return ColorConverter;
|
848
|
-
}());
|
849
|
-
exports.ColorConverter = ColorConverter;
|
850
|
-
var ZigbeeSteckdose = /** @class */ (function (_super) {
|
851
|
-
__extends(ZigbeeSteckdose, _super);
|
852
|
-
function ZigbeeSteckdose(adapter, id, baseState, etage, raum, device, alexaSmartNamesForOn, alexaActionNamesForOn, alexaSmartNamesForOff, alexaActionNamesForOff, additionalStates4TurnOn, additionalStates4TurnOff) {
|
853
|
-
var _this = _super.call(this, adapter, id, baseState, etage, raum, device) || this;
|
854
|
-
_this.adapter = adapter;
|
855
|
-
_this.alexaSmartNamesForOn = alexaSmartNamesForOn;
|
856
|
-
_this.alexaSmartNamesForOff = alexaSmartNamesForOff;
|
857
|
-
_this.alexaActionNamesForOn = alexaActionNamesForOn;
|
858
|
-
_this.alexaActionNamesForOff = alexaActionNamesForOff;
|
859
|
-
_this.additionalStates4TurnOn = additionalStates4TurnOn;
|
860
|
-
_this.additionalStates4TurnOff = additionalStates4TurnOff;
|
861
|
-
// 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
|
862
|
-
_this.additionalStates4TurnOn.forEach(function (turnOnState) {
|
863
|
-
_this.createState(turnOnState);
|
864
|
-
});
|
865
|
-
// 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
|
866
|
-
_this.additionalStates4TurnOff.forEach(function (turnOffState) {
|
867
|
-
_this.createState(turnOffState);
|
868
|
-
});
|
869
|
-
_this.alexaSmartNamesForOn.forEach(function (alexaSmartName) {
|
870
|
-
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
871
|
-
});
|
872
|
-
_this.alexaSmartNamesForOff.forEach(function (alexaSmartName) {
|
873
|
-
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
874
|
-
});
|
875
|
-
_this.alexaActionNamesForOn.forEach(function (alexaSmartName) {
|
876
|
-
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
877
|
-
});
|
878
|
-
_this.alexaActionNamesForOff.forEach(function (alexaSmartName) {
|
879
|
-
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
880
|
-
});
|
881
|
-
return _this;
|
882
|
-
}
|
883
|
-
ZigbeeSteckdose.prototype.createState = function (key_in) {
|
884
|
-
var jarvisDatenpunkt = key_in; //.replace(/\./g,'_'); // wegen Wohnzimmer T.V.
|
885
|
-
this.adapter.createState(jarvisDatenpunkt, false, {
|
886
|
-
name: jarvisDatenpunkt,
|
887
|
-
desc: jarvisDatenpunkt,
|
888
|
-
type: 'boolean',
|
889
|
-
read: true,
|
890
|
-
write: true
|
891
|
-
});
|
892
|
-
};
|
893
|
-
ZigbeeSteckdose.prototype.getAdditionalStates4TurnOn = function () {
|
894
|
-
return this.additionalStates4TurnOn;
|
895
|
-
};
|
896
|
-
ZigbeeSteckdose.prototype.getAdditionalStates4TurnOff = function () {
|
897
|
-
return this.additionalStates4TurnOff;
|
898
|
-
};
|
899
|
-
ZigbeeSteckdose.prototype.getAlexaSmartNamesForOn = function () {
|
900
|
-
return this.alexaSmartNamesForOn;
|
901
|
-
};
|
902
|
-
ZigbeeSteckdose.prototype.getAlexaSmartNamesForOff = function () {
|
903
|
-
return this.alexaSmartNamesForOff;
|
904
|
-
};
|
905
|
-
ZigbeeSteckdose.prototype.getAlexaActionNamesForOn = function () {
|
906
|
-
return this.alexaActionNamesForOn;
|
907
|
-
};
|
908
|
-
ZigbeeSteckdose.prototype.getAlexaActionNamesForOff = function () {
|
909
|
-
return this.alexaActionNamesForOff;
|
910
|
-
};
|
911
|
-
ZigbeeSteckdose.prototype.getSwitchState = function () {
|
912
|
-
return this.baseState + ".on";
|
913
|
-
};
|
914
|
-
ZigbeeSteckdose.prototype.isSwitchedOn = function () {
|
915
|
-
if (this.adapter.getState(this.baseState + ".on").val == false) { // hue.0.Steckdose_Backstube.on
|
916
|
-
return false;
|
917
|
-
}
|
918
|
-
return true;
|
919
|
-
};
|
920
|
-
ZigbeeSteckdose.prototype.getCategory = function () {
|
921
|
-
return deviceZigbeeSteckdose;
|
922
|
-
};
|
923
|
-
ZigbeeSteckdose.prototype.getAlexaNamesForOnAsString = function () {
|
924
|
-
var result = "";
|
925
|
-
this.alexaSmartNamesForOn.forEach(function (alexaOnName) {
|
926
|
-
if (result == "") {
|
927
|
-
result += alexaOnName;
|
928
|
-
}
|
929
|
-
else {
|
930
|
-
result += ", " + alexaOnName;
|
931
|
-
}
|
932
|
-
});
|
933
|
-
this.alexaActionNamesForOn.forEach(function (alexaOnName) {
|
934
|
-
if (result == "") {
|
935
|
-
result += alexaOnName;
|
936
|
-
}
|
937
|
-
else {
|
938
|
-
result += ", " + alexaOnName;
|
939
|
-
}
|
940
|
-
});
|
941
|
-
return result;
|
942
|
-
};
|
943
|
-
ZigbeeSteckdose.prototype.getAlexaNamesForOffAsString = function () {
|
944
|
-
var result = "";
|
945
|
-
this.alexaSmartNamesForOff.forEach(function (alexaOffName) {
|
946
|
-
if (result == "") {
|
947
|
-
result += alexaOffName;
|
948
|
-
}
|
949
|
-
else {
|
950
|
-
result += ", " + alexaOffName;
|
951
|
-
}
|
952
|
-
});
|
953
|
-
this.alexaActionNamesForOff.forEach(function (alexaOffName) {
|
954
|
-
if (result == "") {
|
955
|
-
result += alexaOffName;
|
956
|
-
}
|
957
|
-
else {
|
958
|
-
result += ", " + alexaOffName;
|
959
|
-
}
|
960
|
-
});
|
961
|
-
return result;
|
962
|
-
};
|
963
|
-
return ZigbeeSteckdose;
|
964
|
-
}(AbstractZigbee));
|
965
|
-
exports.ZigbeeSteckdose = ZigbeeSteckdose;
|
966
|
-
var ZigbeeSchalter = /** @class */ (function (_super) {
|
967
|
-
__extends(ZigbeeSchalter, _super);
|
968
|
-
function ZigbeeSchalter(adapter, id, baseState, etage, raum, device) {
|
969
|
-
var _this = _super.call(this, adapter, id, baseState, etage, raum, device) || this;
|
970
|
-
_this.adapter = adapter;
|
971
|
-
return _this;
|
972
|
-
}
|
973
|
-
ZigbeeSchalter.prototype.getCategory = function () {
|
974
|
-
return deviceZigbeeSchalter;
|
975
|
-
};
|
976
|
-
return ZigbeeSchalter;
|
977
|
-
}(AbstractZigbee));
|
978
|
-
exports.ZigbeeSchalter = ZigbeeSchalter;
|
979
|
-
var ZigbeeRepeater = /** @class */ (function (_super) {
|
980
|
-
__extends(ZigbeeRepeater, _super);
|
981
|
-
function ZigbeeRepeater(adapter, id, baseState, etage, raum, device) {
|
982
|
-
var _this = _super.call(this, adapter, id, baseState, etage, raum, device) || this;
|
983
|
-
_this.adapter = adapter;
|
984
|
-
return _this;
|
985
|
-
}
|
986
|
-
ZigbeeRepeater.prototype.getCategory = function () {
|
987
|
-
return deviceZigbeeRepeater;
|
988
|
-
};
|
989
|
-
return ZigbeeRepeater;
|
990
|
-
}(AbstractZigbee));
|
991
|
-
exports.ZigbeeRepeater = ZigbeeRepeater;
|
992
|
-
var ZigbeeFenstersensor = /** @class */ (function (_super) {
|
993
|
-
__extends(ZigbeeFenstersensor, _super);
|
994
|
-
function ZigbeeFenstersensor(adapter, id, baseState, etage, raum, device) {
|
995
|
-
var _this = _super.call(this, adapter, id, baseState, etage, raum, device) || this;
|
996
|
-
_this.adapter = adapter;
|
997
|
-
return _this;
|
998
|
-
}
|
999
|
-
ZigbeeFenstersensor.prototype.isOpen = function () {
|
1000
|
-
if (this.adapter.getState(this.baseState + ".open").val == false) { // deconz.0.Sensors.117.open
|
1001
|
-
return false;
|
1002
|
-
}
|
1003
|
-
return true;
|
1004
|
-
};
|
1005
|
-
ZigbeeFenstersensor.prototype.isStatusReachable = function () {
|
1006
|
-
var reachable = this.adapter.getState(this.baseState + ".reachable").val; // hue.0.Steckdose_Backstube.reachable
|
1007
|
-
return reachable;
|
1008
|
-
};
|
1009
|
-
ZigbeeFenstersensor.prototype.getBattery = function () {
|
1010
|
-
return this.adapter.getState(this.baseState + ".battery").val; // // alias.0.Z021.battery
|
1011
|
-
};
|
1012
|
-
ZigbeeFenstersensor.prototype.getCategory = function () {
|
1013
|
-
return deviceZigbeeFenstersensor;
|
1014
|
-
};
|
1015
|
-
return ZigbeeFenstersensor;
|
1016
|
-
}(AbstractZigbee));
|
1017
|
-
exports.ZigbeeFenstersensor = ZigbeeFenstersensor;
|
1018
|
-
var ZigbeeRauchmelder = /** @class */ (function (_super) {
|
1019
|
-
__extends(ZigbeeRauchmelder, _super);
|
1020
|
-
function ZigbeeRauchmelder(adapter, id, baseState, etage, raum, device) {
|
1021
|
-
var _this = _super.call(this, adapter, id, baseState, etage, raum, device) || this;
|
1022
|
-
_this.adapter = adapter;
|
1023
|
-
return _this;
|
1024
|
-
}
|
1025
|
-
ZigbeeRauchmelder.prototype.isFire = function () {
|
1026
|
-
if (this.adapter.getState(this.baseState + ".fire").val == false) { // hue.0.Steckdose_Backstube.on
|
1027
|
-
return false;
|
1028
|
-
}
|
1029
|
-
return true;
|
1030
|
-
};
|
1031
|
-
ZigbeeRauchmelder.prototype.isStatusReachable = function () {
|
1032
|
-
var reachable = this.adapter.getState(this.baseState + ".reachable").val; // hue.0.Steckdose_Backstube.reachable
|
1033
|
-
return reachable;
|
1034
|
-
};
|
1035
|
-
ZigbeeRauchmelder.prototype.getBattery = function () {
|
1036
|
-
return this.adapter.getState(this.baseState + ".battery").val; // // alias.0.Z021.battery
|
1037
|
-
};
|
1038
|
-
ZigbeeRauchmelder.prototype.getCategory = function () {
|
1039
|
-
return deviceZigbeeRauchmelder;
|
1040
|
-
};
|
1041
|
-
return ZigbeeRauchmelder;
|
1042
|
-
}(AbstractZigbee));
|
1043
|
-
exports.ZigbeeRauchmelder = ZigbeeRauchmelder;
|
1044
|
-
var ZigbeeBewegungsmelder = /** @class */ (function (_super) {
|
1045
|
-
__extends(ZigbeeBewegungsmelder, _super);
|
1046
|
-
function ZigbeeBewegungsmelder(adapter, id, baseState, etage, raum, device) {
|
1047
|
-
var _this = _super.call(this, adapter, id, baseState, etage, raum, device) || this;
|
1048
|
-
_this.adapter = adapter;
|
1049
|
-
return _this;
|
1050
|
-
}
|
1051
|
-
ZigbeeBewegungsmelder.prototype.getCategory = function () {
|
1052
|
-
return deviceZigbeeBewegungsmelder;
|
1053
|
-
};
|
1054
|
-
ZigbeeBewegungsmelder.prototype.getBattery = function () {
|
1055
|
-
return this.adapter.getState(this.baseState + ".battery").val; // // alias.0.Z021.battery
|
1056
|
-
};
|
1057
|
-
return ZigbeeBewegungsmelder;
|
1058
|
-
}(AbstractZigbee));
|
1059
|
-
exports.ZigbeeBewegungsmelder = ZigbeeBewegungsmelder;
|
1060
|
-
var ZigbeeWandtaster = /** @class */ (function (_super) {
|
1061
|
-
__extends(ZigbeeWandtaster, _super);
|
1062
|
-
function ZigbeeWandtaster(adapter, id, baseState, etage, raum, device) {
|
1063
|
-
var _this = _super.call(this, adapter, id, baseState, etage, raum, device) || this;
|
1064
|
-
_this.adapter = adapter;
|
1065
|
-
return _this;
|
1066
|
-
}
|
1067
|
-
ZigbeeWandtaster.prototype.getCategory = function () {
|
1068
|
-
return deviceZigbeeWandtaster;
|
1069
|
-
};
|
1070
|
-
ZigbeeWandtaster.prototype.getBattery = function () {
|
1071
|
-
return this.adapter.getState(this.baseState + ".battery").val; // // alias.0.Z021.battery
|
1072
|
-
};
|
1073
|
-
return ZigbeeWandtaster;
|
1074
|
-
}(AbstractZigbee));
|
1075
|
-
exports.ZigbeeWandtaster = ZigbeeWandtaster;
|
1076
|
-
var ZigbeeDosenrelais = /** @class */ (function (_super) {
|
1077
|
-
__extends(ZigbeeDosenrelais, _super);
|
1078
|
-
function ZigbeeDosenrelais(adapter, id, baseState, etage, raum, device, alexaSmartNames) {
|
1079
|
-
var _this = _super.call(this, adapter, id, baseState, etage, raum, device) || this;
|
1080
|
-
_this.adapter = adapter;
|
1081
|
-
_this.alexaSmartNames = alexaSmartNames;
|
1082
|
-
_this.alexaSmartNames.forEach(function (alexaSmartName) {
|
1083
|
-
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
1084
|
-
});
|
1085
|
-
return _this;
|
1086
|
-
}
|
1087
|
-
ZigbeeDosenrelais.prototype.getSwitchState = function () {
|
1088
|
-
return this.baseState + ".on";
|
1089
|
-
};
|
1090
|
-
ZigbeeDosenrelais.prototype.isSwitchedOn = function () {
|
1091
|
-
if (this.adapter.getState(this.baseState + ".on").val == false) {
|
1092
|
-
return false;
|
1093
|
-
}
|
1094
|
-
return true;
|
1095
|
-
};
|
1096
|
-
ZigbeeDosenrelais.prototype.turnOn = function () {
|
1097
|
-
this.adapter.setState(this.baseState + ".on", true);
|
1098
|
-
};
|
1099
|
-
ZigbeeDosenrelais.prototype.turnOff = function () {
|
1100
|
-
this.adapter.setState(this.baseState + ".on", false);
|
1101
|
-
};
|
1102
|
-
ZigbeeDosenrelais.prototype.getCategory = function () {
|
1103
|
-
return deviceZigbeeDosenrelais;
|
1104
|
-
};
|
1105
|
-
ZigbeeDosenrelais.prototype.getAlexaSmartNames = function () {
|
1106
|
-
return this.alexaSmartNames;
|
1107
|
-
};
|
1108
|
-
return ZigbeeDosenrelais;
|
1109
|
-
}(AbstractZigbee));
|
1110
|
-
exports.ZigbeeDosenrelais = ZigbeeDosenrelais;
|
1111
|
-
module.exports = {
|
1112
|
-
AbstractZigbee: AbstractZigbee,
|
1113
|
-
ColorConverter: ColorConverter,
|
1114
|
-
ColorScheme: ColorScheme,
|
1115
|
-
RGBColorScheme: RGBColorScheme,
|
1116
|
-
WhiteColorScheme: WhiteColorScheme,
|
1117
|
-
ZigbeeLampeRGB: ZigbeeLampeRGB,
|
1118
|
-
LampeWeissTasterScheme: LampeWeissTasterScheme,
|
1119
|
-
LampeWeissAlexaScheme: LampeWeissAlexaScheme,
|
1120
|
-
ZigbeeLampeWeiss: ZigbeeLampeWeiss,
|
1121
|
-
ZigbeeSteckdose: ZigbeeSteckdose,
|
1122
|
-
ZigbeeSchalter: ZigbeeSchalter,
|
1123
|
-
ZigbeeRepeater: ZigbeeRepeater,
|
1124
|
-
ZigbeeFenstersensor: ZigbeeFenstersensor,
|
1125
|
-
ZigbeeRauchmelder: ZigbeeRauchmelder,
|
1126
|
-
ZigbeeBewegungsmelder: ZigbeeBewegungsmelder,
|
1127
|
-
ZigbeeWandtaster: ZigbeeWandtaster,
|
1128
|
-
ZigbeeDosenrelais: ZigbeeDosenrelais,
|
1129
|
-
deviceZigbeeSteckdose: deviceZigbeeSteckdose,
|
1130
|
-
deviceZigbeeBewegungsmelder: deviceZigbeeBewegungsmelder,
|
1131
|
-
deviceZigbeeLampeRGB: deviceZigbeeLampeRGB,
|
1132
|
-
deviceZigbeeLampeWeiss: deviceZigbeeLampeWeiss,
|
1133
|
-
deviceZigbeeRauchmelder: deviceZigbeeRauchmelder,
|
1134
|
-
deviceZigbeeWandtaster: deviceZigbeeWandtaster,
|
1135
|
-
deviceZigbeeDosenrelais: deviceZigbeeDosenrelais,
|
1136
|
-
deviceZigbeeSchalter: deviceZigbeeSchalter,
|
1137
|
-
deviceZigbeeRepeater: deviceZigbeeRepeater,
|
1138
|
-
deviceZigbeeFenstersensor: deviceZigbeeFenstersensor
|
1139
|
-
};
|
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.ZigbeeDosenrelais = exports.ZigbeeWandtaster = exports.ZigbeeBewegungsmelder = exports.ZigbeeRauchmelder = exports.ZigbeeFenstersensor = exports.ZigbeeRepeater = exports.ZigbeeSchalter = exports.ZigbeeSteckdose = exports.ColorConverter = 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", // <---- Das ist wichtig, ohne dieses Common-Zeugs würde hier "state" stehen und die ALexa-App würde dieses Gerär nicht als "Farbe-Lampe" akzeptieren/erkennen
|
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", // <---- Das ist wichtig, ohne dieses Common-Zeugs würde hier "state" stehen und die ALexa-App würde dieses Gerär nicht als "Farbe-Lampe" akzeptieren/erkennen
|
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, //'Heizung Ist Temperatur',
|
332
|
+
type: this.adapter.getObject(originalDatenpunkt).common.type, // 'number',
|
333
|
+
unit: this.adapter.getObject(originalDatenpunkt).common.unit, //'°C',
|
334
|
+
read: true,
|
335
|
+
write: true,
|
336
|
+
role: this.adapter.getObject(originalDatenpunkt).common.role, //'value.temperature',
|
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
|
+
_this.adapter.setState(_this.getBaseState() + ".xy", _this.colorConverter.convertHSL2XY(rgbColorscheme.getHue(), rgbColorscheme.getSat()).join()); // Im Hue-Fall ist es ein String
|
393
|
+
}
|
394
|
+
else {
|
395
|
+
var whiteColorscheme = colorscheme;
|
396
|
+
_this.adapter.setState(_this.getBaseState() + ".ct", whiteColorscheme.getCt());
|
397
|
+
//log(">>> deconz changeColor: Set ct to: " + whiteColorscheme.getCt());
|
398
|
+
}
|
399
|
+
}, 300);
|
400
|
+
}, 600);
|
401
|
+
}
|
402
|
+
};
|
403
|
+
ZigbeeLampeRGB.prototype.turnOn = function () {
|
404
|
+
if (this.alexaColorSchemeForOn == null) { // Schalte Licht nur ein, d.h. lass die Farbwerte so wie sie sind
|
405
|
+
this.adapter.setState(this.getBaseState() + ".on", true);
|
406
|
+
}
|
407
|
+
else {
|
408
|
+
this.changeColor(this.alexaColorSchemeForOn);
|
409
|
+
}
|
410
|
+
};
|
411
|
+
ZigbeeLampeRGB.prototype.turnOff = function () {
|
412
|
+
this.adapter.setState(this.getBaseState() + ".on", false);
|
413
|
+
};
|
414
|
+
ZigbeeLampeRGB.prototype.getAlexaNamesForOnAsString = function () {
|
415
|
+
var result = "";
|
416
|
+
this.alexaSmartNamesForOn.forEach(function (alexaOnName) {
|
417
|
+
if (result == "") {
|
418
|
+
result += alexaOnName;
|
419
|
+
}
|
420
|
+
else {
|
421
|
+
result += ", " + alexaOnName;
|
422
|
+
}
|
423
|
+
});
|
424
|
+
this.alexaActionNamesForOn.forEach(function (alexaOnName) {
|
425
|
+
if (result == "") {
|
426
|
+
result += alexaOnName;
|
427
|
+
}
|
428
|
+
else {
|
429
|
+
result += ", " + alexaOnName;
|
430
|
+
}
|
431
|
+
});
|
432
|
+
return result;
|
433
|
+
};
|
434
|
+
ZigbeeLampeRGB.prototype.getAlexaNamesForOffAsString = function () {
|
435
|
+
var result = "";
|
436
|
+
this.alexaSmartNamesForOff.forEach(function (alexaOffName) {
|
437
|
+
if (result == "") {
|
438
|
+
result += alexaOffName;
|
439
|
+
}
|
440
|
+
else {
|
441
|
+
result += ", " + alexaOffName;
|
442
|
+
}
|
443
|
+
});
|
444
|
+
this.alexaActionNamesForOff.forEach(function (alexaOffName) {
|
445
|
+
if (result == "") {
|
446
|
+
result += alexaOffName;
|
447
|
+
}
|
448
|
+
else {
|
449
|
+
result += ", " + alexaOffName;
|
450
|
+
}
|
451
|
+
});
|
452
|
+
return result;
|
453
|
+
};
|
454
|
+
ZigbeeLampeRGB.prototype.isSwitchedOn = function () {
|
455
|
+
if (this.adapter.getState(this.baseState + ".on").val == false) { // hue.0.Steckdose_Backstube.on
|
456
|
+
return false;
|
457
|
+
}
|
458
|
+
return true;
|
459
|
+
};
|
460
|
+
ZigbeeLampeRGB.prototype.getGroupMembers = function () {
|
461
|
+
return this.groupMembers;
|
462
|
+
};
|
463
|
+
ZigbeeLampeRGB.prototype.getAlexaSmartNamesForOn = function () {
|
464
|
+
return this.alexaSmartNamesForOn;
|
465
|
+
};
|
466
|
+
ZigbeeLampeRGB.prototype.getAlexaSmartNamesForOff = function () {
|
467
|
+
return this.alexaSmartNamesForOff;
|
468
|
+
};
|
469
|
+
ZigbeeLampeRGB.prototype.getAlexaActionNamesForOn = function () {
|
470
|
+
return this.alexaActionNamesForOn;
|
471
|
+
};
|
472
|
+
ZigbeeLampeRGB.prototype.getAlexaActionNamesForOff = function () {
|
473
|
+
return this.alexaActionNamesForOff;
|
474
|
+
};
|
475
|
+
ZigbeeLampeRGB.prototype.isGroup = function () {
|
476
|
+
return this.isGroup_;
|
477
|
+
};
|
478
|
+
ZigbeeLampeRGB.prototype.getDeviceId = function () {
|
479
|
+
if (this.isGroup_) {
|
480
|
+
return "ZG" + this.id.toString().padStart(3, '0');
|
481
|
+
}
|
482
|
+
else {
|
483
|
+
return "Z" + this.id.toString().padStart(3, '0');
|
484
|
+
}
|
485
|
+
};
|
486
|
+
ZigbeeLampeRGB.prototype.isStatusReachable = function () {
|
487
|
+
if (this.isGroup_) {
|
488
|
+
return true;
|
489
|
+
}
|
490
|
+
else {
|
491
|
+
return this.adapter.getState(this.baseState + ".reachable").val; // hue.0.Steckdose_Backstube.reachable
|
492
|
+
}
|
493
|
+
};
|
494
|
+
ZigbeeLampeRGB.prototype.getLevel = function () {
|
495
|
+
return this.adapter.getState(this.baseState + ".level").val;
|
496
|
+
};
|
497
|
+
ZigbeeLampeRGB.prototype.getCategory = function () {
|
498
|
+
return deviceZigbeeLampeRGB;
|
499
|
+
};
|
500
|
+
return ZigbeeLampeRGB;
|
501
|
+
}(AbstractZigbee));
|
502
|
+
exports.ZigbeeLampeRGB = ZigbeeLampeRGB;
|
503
|
+
var LampeWeissTasterScheme = /** @class */ (function () {
|
504
|
+
function LampeWeissTasterScheme(tasterBooleanOn, level, ct) {
|
505
|
+
this.tasterBooleanOn = tasterBooleanOn;
|
506
|
+
this.level = level;
|
507
|
+
this.ct = ct;
|
508
|
+
}
|
509
|
+
LampeWeissTasterScheme.prototype.getTasterBooleanOnName = function () {
|
510
|
+
return this.tasterBooleanOn;
|
511
|
+
};
|
512
|
+
LampeWeissTasterScheme.prototype.getLevel = function () {
|
513
|
+
return this.level;
|
514
|
+
};
|
515
|
+
LampeWeissTasterScheme.prototype.getCt = function () {
|
516
|
+
return this.ct;
|
517
|
+
};
|
518
|
+
return LampeWeissTasterScheme;
|
519
|
+
}());
|
520
|
+
exports.LampeWeissTasterScheme = LampeWeissTasterScheme;
|
521
|
+
var LampeWeissAlexaScheme = /** @class */ (function () {
|
522
|
+
function LampeWeissAlexaScheme(alexaName, level, ct) {
|
523
|
+
this.alexaName = alexaName;
|
524
|
+
this.level = level;
|
525
|
+
this.ct = ct;
|
526
|
+
}
|
527
|
+
LampeWeissAlexaScheme.prototype.getAlexaName = function () {
|
528
|
+
return this.alexaName;
|
529
|
+
};
|
530
|
+
LampeWeissAlexaScheme.prototype.getLevel = function () {
|
531
|
+
return this.level;
|
532
|
+
};
|
533
|
+
LampeWeissAlexaScheme.prototype.setDevice = function (device) {
|
534
|
+
this.device = device;
|
535
|
+
};
|
536
|
+
LampeWeissAlexaScheme.prototype.getDevice = function () {
|
537
|
+
return this.device;
|
538
|
+
};
|
539
|
+
LampeWeissAlexaScheme.prototype.getCt = function () {
|
540
|
+
return this.ct;
|
541
|
+
};
|
542
|
+
return LampeWeissAlexaScheme;
|
543
|
+
}());
|
544
|
+
exports.LampeWeissAlexaScheme = LampeWeissAlexaScheme;
|
545
|
+
var ZigbeeLampeWeiss = /** @class */ (function (_super) {
|
546
|
+
__extends(ZigbeeLampeWeiss, _super);
|
547
|
+
function ZigbeeLampeWeiss(adapter, id, baseState, etage, raum, device, alexaSmartNamesForOn, alexaActionNamesForOn, alexaLevelSchemeForOn, alexaSmartNamesForOff, alexaActionNamesForOff, levelSchemes, isGroup_, tasterBooleanOn, tasterBooleanOff, nachtbeleuchtung, turnOffExitHouseSummer, turnOffExitHouseWinter, turnOnEnterHouseSummer, turnOnEnterHouseWinter) {
|
548
|
+
var _this = _super.call(this, adapter, id, baseState, etage, raum, device) || this;
|
549
|
+
_this.adapter = adapter;
|
550
|
+
_this.alexaLevelSchemeForOn = alexaLevelSchemeForOn;
|
551
|
+
_this.alexaSmartNamesForOn = alexaSmartNamesForOn;
|
552
|
+
_this.alexaSmartNamesForOff = alexaSmartNamesForOff;
|
553
|
+
_this.alexaActionNamesForOn = alexaActionNamesForOn;
|
554
|
+
_this.alexaActionNamesForOff = alexaActionNamesForOff;
|
555
|
+
_this.nachtbeleuchtung = nachtbeleuchtung;
|
556
|
+
_this.turnOffExitHouseSummer = turnOffExitHouseSummer;
|
557
|
+
_this.turnOffExitHouseWinter = turnOffExitHouseWinter;
|
558
|
+
_this.turnOnEnterHouseSummer = turnOnEnterHouseSummer;
|
559
|
+
_this.turnOnEnterHouseWinter = turnOnEnterHouseWinter;
|
560
|
+
_this.isGroup_ = isGroup_;
|
561
|
+
_this.tasterBooleanOn = tasterBooleanOn;
|
562
|
+
_this.tasterBooleanOff = tasterBooleanOff;
|
563
|
+
_this.levelSchemes = levelSchemes;
|
564
|
+
// States anlegen:
|
565
|
+
_this.tasterBooleanOn.forEach(function (tasterScheme) {
|
566
|
+
if (tasterScheme.getTasterBooleanOnName() != null) {
|
567
|
+
_this.createState(tasterScheme.getTasterBooleanOnName());
|
568
|
+
}
|
569
|
+
});
|
570
|
+
_this.tasterBooleanOff.forEach(function (offName) {
|
571
|
+
_this.createState(offName);
|
572
|
+
});
|
573
|
+
_this.alexaSmartNamesForOn.forEach(function (alexaSmartName) {
|
574
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
575
|
+
});
|
576
|
+
_this.alexaSmartNamesForOff.forEach(function (alexaSmartName) {
|
577
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
578
|
+
});
|
579
|
+
_this.alexaActionNamesForOn.forEach(function (alexaSmartName) {
|
580
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
581
|
+
});
|
582
|
+
_this.alexaActionNamesForOff.forEach(function (alexaSmartName) {
|
583
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
584
|
+
});
|
585
|
+
_this.levelSchemes.forEach(function (scheme) {
|
586
|
+
if (scheme.getAlexaName() != null) {
|
587
|
+
_this.createIOTAdapterSmartDevices(scheme.getAlexaName());
|
588
|
+
}
|
589
|
+
});
|
590
|
+
return _this;
|
591
|
+
}
|
592
|
+
ZigbeeLampeWeiss.prototype.isNachtbeleuchtung = function () {
|
593
|
+
return this.nachtbeleuchtung;
|
594
|
+
};
|
595
|
+
ZigbeeLampeWeiss.prototype.isTurnOffExitHouseSummer = function () {
|
596
|
+
return this.turnOffExitHouseSummer;
|
597
|
+
};
|
598
|
+
ZigbeeLampeWeiss.prototype.isTurnOffExitHouseWinter = function () {
|
599
|
+
return this.turnOffExitHouseWinter;
|
600
|
+
};
|
601
|
+
ZigbeeLampeWeiss.prototype.isTurnOnEnterHouseSummer = function () {
|
602
|
+
return this.turnOnEnterHouseSummer;
|
603
|
+
};
|
604
|
+
ZigbeeLampeWeiss.prototype.isTurnOnEnterHouseWinter = function () {
|
605
|
+
return this.turnOnEnterHouseWinter;
|
606
|
+
};
|
607
|
+
ZigbeeLampeWeiss.prototype.getAlexaSmartNamesForOn = function () {
|
608
|
+
return this.alexaSmartNamesForOn;
|
609
|
+
};
|
610
|
+
ZigbeeLampeWeiss.prototype.getAlexaSmartNamesForOff = function () {
|
611
|
+
return this.alexaSmartNamesForOff;
|
612
|
+
};
|
613
|
+
ZigbeeLampeWeiss.prototype.getAlexaActionNamesForOn = function () {
|
614
|
+
return this.alexaActionNamesForOn;
|
615
|
+
};
|
616
|
+
ZigbeeLampeWeiss.prototype.getAlexaActionNamesForOff = function () {
|
617
|
+
return this.alexaActionNamesForOff;
|
618
|
+
};
|
619
|
+
ZigbeeLampeWeiss.prototype.getAlexaSchemes = function () {
|
620
|
+
return this.levelSchemes;
|
621
|
+
};
|
622
|
+
ZigbeeLampeWeiss.prototype.getAlexaSchemeForOn = function () {
|
623
|
+
return this.alexaLevelSchemeForOn;
|
624
|
+
};
|
625
|
+
ZigbeeLampeWeiss.prototype.getAlexaNamesForOnAsString = function () {
|
626
|
+
var result = "";
|
627
|
+
this.alexaSmartNamesForOn.forEach(function (alexaOnName) {
|
628
|
+
if (result == "") {
|
629
|
+
result += alexaOnName;
|
630
|
+
}
|
631
|
+
else {
|
632
|
+
result += ", " + alexaOnName;
|
633
|
+
}
|
634
|
+
});
|
635
|
+
this.alexaActionNamesForOn.forEach(function (alexaOnName) {
|
636
|
+
if (result == "") {
|
637
|
+
result += alexaOnName;
|
638
|
+
}
|
639
|
+
else {
|
640
|
+
result += ", " + alexaOnName;
|
641
|
+
}
|
642
|
+
});
|
643
|
+
return result;
|
644
|
+
};
|
645
|
+
ZigbeeLampeWeiss.prototype.getAlexaNamesForOffAsString = function () {
|
646
|
+
var result = "";
|
647
|
+
this.alexaSmartNamesForOff.forEach(function (alexaOffName) {
|
648
|
+
if (result == "") {
|
649
|
+
result += alexaOffName;
|
650
|
+
}
|
651
|
+
else {
|
652
|
+
result += ", " + alexaOffName;
|
653
|
+
}
|
654
|
+
});
|
655
|
+
this.alexaActionNamesForOff.forEach(function (alexaOffName) {
|
656
|
+
if (result == "") {
|
657
|
+
result += alexaOffName;
|
658
|
+
}
|
659
|
+
else {
|
660
|
+
result += ", " + alexaOffName;
|
661
|
+
}
|
662
|
+
});
|
663
|
+
return result;
|
664
|
+
};
|
665
|
+
ZigbeeLampeWeiss.prototype.getTasterBooleanOn = function () {
|
666
|
+
return this.tasterBooleanOn;
|
667
|
+
};
|
668
|
+
ZigbeeLampeWeiss.prototype.getTasterBooleanOff = function () {
|
669
|
+
return this.tasterBooleanOff;
|
670
|
+
};
|
671
|
+
ZigbeeLampeWeiss.prototype.createState = function (key_in) {
|
672
|
+
var jarvisDatenpunkt = key_in; //.replace(/\./g,'_'); // wegen Wohnzimmer T.V.
|
673
|
+
//log(">>> CREATE STATE: " + jarvisDatenpunkt);
|
674
|
+
this.adapter.createState(jarvisDatenpunkt, false, {
|
675
|
+
name: jarvisDatenpunkt,
|
676
|
+
desc: jarvisDatenpunkt,
|
677
|
+
type: 'boolean',
|
678
|
+
read: true,
|
679
|
+
write: true
|
680
|
+
});
|
681
|
+
};
|
682
|
+
ZigbeeLampeWeiss.prototype.isSwitchedOn = function () {
|
683
|
+
if (this.adapter.getState(this.baseState + ".on").val == false) { // hue.0.Steckdose_Backstube.on
|
684
|
+
return false;
|
685
|
+
}
|
686
|
+
return true;
|
687
|
+
};
|
688
|
+
ZigbeeLampeWeiss.prototype.turnOn = function () {
|
689
|
+
if (this.alexaLevelSchemeForOn == null) { // Schalte Licht nur ein
|
690
|
+
if (this.adapter.getState(this.baseState + ".on").val != true) {
|
691
|
+
this.adapter.setState(this.baseState + ".on", true);
|
692
|
+
}
|
693
|
+
}
|
694
|
+
else {
|
695
|
+
this.changeLevel(this.alexaLevelSchemeForOn);
|
696
|
+
}
|
697
|
+
};
|
698
|
+
ZigbeeLampeWeiss.prototype.turnOff = function () {
|
699
|
+
if (this.adapter.getState(this.baseState + ".on").val != false) {
|
700
|
+
this.adapter.setState(this.baseState + ".on", false);
|
701
|
+
}
|
702
|
+
};
|
703
|
+
ZigbeeLampeWeiss.prototype.changeLevel = function (levelScheme) {
|
704
|
+
this.adapter.log("LampeWeiß --> ChangeLevel: Level:" + levelScheme.getLevel() + ", ct: " + levelScheme.getCt());
|
705
|
+
this.adapter.setState(this.baseState + ".on", true);
|
706
|
+
this.adapter.setState(this.baseState + ".level", levelScheme.getLevel());
|
707
|
+
if (levelScheme.getCt() != -1) {
|
708
|
+
this.adapter.setState(this.baseState + ".ct", levelScheme.getCt());
|
709
|
+
}
|
710
|
+
};
|
711
|
+
ZigbeeLampeWeiss.prototype.isStatusReachable = function () {
|
712
|
+
if (this.isGroup_) {
|
713
|
+
return true;
|
714
|
+
}
|
715
|
+
else {
|
716
|
+
return this.adapter.getState(this.baseState + ".reachable").val; // hue.0.Steckdose_Backstube.reachable
|
717
|
+
}
|
718
|
+
};
|
719
|
+
ZigbeeLampeWeiss.prototype.isGroup = function () {
|
720
|
+
return this.isGroup_;
|
721
|
+
};
|
722
|
+
ZigbeeLampeWeiss.prototype.getDeviceId = function () {
|
723
|
+
if (this.isGroup_) {
|
724
|
+
return "ZG" + this.id.toString().padStart(3, '0');
|
725
|
+
}
|
726
|
+
else {
|
727
|
+
return "Z" + this.id.toString().padStart(3, '0');
|
728
|
+
}
|
729
|
+
};
|
730
|
+
ZigbeeLampeWeiss.prototype.getLevel = function () {
|
731
|
+
return this.adapter.getState(this.baseState + ".level").val;
|
732
|
+
};
|
733
|
+
ZigbeeLampeWeiss.prototype.getCategory = function () {
|
734
|
+
return deviceZigbeeLampeWeiss;
|
735
|
+
};
|
736
|
+
return ZigbeeLampeWeiss;
|
737
|
+
}(AbstractZigbee));
|
738
|
+
exports.ZigbeeLampeWeiss = ZigbeeLampeWeiss;
|
739
|
+
var ColorConverter = /** @class */ (function () {
|
740
|
+
function ColorConverter() {
|
741
|
+
}
|
742
|
+
ColorConverter.prototype.convertXY2HSL = function (x, y) {
|
743
|
+
var bri = 254;
|
744
|
+
var xy = {
|
745
|
+
x: x,
|
746
|
+
y: y
|
747
|
+
};
|
748
|
+
var z = 1.0 - xy.x - xy.y;
|
749
|
+
var Y = bri / 255;
|
750
|
+
var X = (Y / xy.y) * xy.x;
|
751
|
+
var Z = (Y / xy.y) * z;
|
752
|
+
var r = X * 1.656492 - Y * 0.354851 - Z * 0.255038;
|
753
|
+
var g = -X * 0.707196 + Y * 1.655397 + Z * 0.036152;
|
754
|
+
var b = X * 0.051713 - Y * 0.121364 + Z * 1.011530;
|
755
|
+
r = r <= 0.0031308 ? 12.92 * r : (1.0 + 0.055) * Math.pow(r, (1.0 / 2.4)) - 0.055;
|
756
|
+
g = g <= 0.0031308 ? 12.92 * g : (1.0 + 0.055) * Math.pow(g, (1.0 / 2.4)) - 0.055;
|
757
|
+
b = b <= 0.0031308 ? 12.92 * b : (1.0 + 0.055) * Math.pow(b, (1.0 / 2.4)) - 0.055;
|
758
|
+
var r_new = (r * 255).toString();
|
759
|
+
var g_new = (g * 255).toString();
|
760
|
+
var b_new = (b * 255).toString();
|
761
|
+
var red = parseInt(r_new) > 255 ? 255 : parseInt(r_new);
|
762
|
+
var green = parseInt(g_new) > 255 ? 255 : parseInt(g_new);
|
763
|
+
var blue = parseInt(b_new) > 255 ? 255 : parseInt(b_new);
|
764
|
+
red = Math.abs(red);
|
765
|
+
green = Math.abs(green);
|
766
|
+
blue = Math.abs(blue);
|
767
|
+
var min = Math.min(r, g, b), max = Math.max(r, g, b), delta = max - min, h, s, v = max;
|
768
|
+
v = Math.floor(max / 255 * 100);
|
769
|
+
if (max != 0)
|
770
|
+
s = Math.floor(delta / max * 100);
|
771
|
+
else {
|
772
|
+
// black
|
773
|
+
return [0, 0, 0];
|
774
|
+
}
|
775
|
+
if (r == max)
|
776
|
+
h = (g - b) / delta; // between yellow & magenta
|
777
|
+
else if (g == max)
|
778
|
+
h = 2 + (b - r) / delta; // between cyan & yellow
|
779
|
+
else
|
780
|
+
h = 4 + (r - g) / delta; // between magenta & cyan
|
781
|
+
h = Math.floor(h * 60); // degrees
|
782
|
+
if (h < 0)
|
783
|
+
h += 360;
|
784
|
+
return [h, s, v];
|
785
|
+
};
|
786
|
+
ColorConverter.prototype.convertHSL2XY = function (h, s) {
|
787
|
+
var l = 50;
|
788
|
+
// Must be fractions of 1
|
789
|
+
s /= 100;
|
790
|
+
l /= 100;
|
791
|
+
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;
|
792
|
+
if (0 <= h && h < 60) {
|
793
|
+
r = c;
|
794
|
+
g = x;
|
795
|
+
b = 0;
|
796
|
+
}
|
797
|
+
else if (60 <= h && h < 120) {
|
798
|
+
r = x;
|
799
|
+
g = c;
|
800
|
+
b = 0;
|
801
|
+
}
|
802
|
+
else if (120 <= h && h < 180) {
|
803
|
+
r = 0;
|
804
|
+
g = c;
|
805
|
+
b = x;
|
806
|
+
}
|
807
|
+
else if (180 <= h && h < 240) {
|
808
|
+
r = 0;
|
809
|
+
g = x;
|
810
|
+
b = c;
|
811
|
+
}
|
812
|
+
else if (240 <= h && h < 300) {
|
813
|
+
r = x;
|
814
|
+
g = 0;
|
815
|
+
b = c;
|
816
|
+
}
|
817
|
+
else if (300 <= h && h < 360) {
|
818
|
+
r = c;
|
819
|
+
g = 0;
|
820
|
+
b = x;
|
821
|
+
}
|
822
|
+
r = Math.round((r + m) * 255);
|
823
|
+
g = Math.round((g + m) * 255);
|
824
|
+
b = Math.round((b + m) * 255);
|
825
|
+
var red = r;
|
826
|
+
var green = g;
|
827
|
+
var blue = b;
|
828
|
+
if (red > 0.04045)
|
829
|
+
red = Math.pow((red + 0.055) / (1.0 + 0.055), 2.4);
|
830
|
+
else
|
831
|
+
red = red / 12.92;
|
832
|
+
if (green > 0.04045)
|
833
|
+
green = Math.pow((green + 0.055) / (1.0 + 0.055), 2.4);
|
834
|
+
else
|
835
|
+
green = green / 12.92;
|
836
|
+
if (blue > 0.04045)
|
837
|
+
blue = Math.pow((blue + 0.055) / (1.0 + 0.055), 2.4);
|
838
|
+
else
|
839
|
+
blue = blue / 12.92;
|
840
|
+
var X = red * 0.664511 + green * 0.154324 + blue * 0.162028;
|
841
|
+
var Y = red * 0.283881 + green * 0.668433 + blue * 0.047685;
|
842
|
+
var Z = red * 0.000088 + green * 0.07231 + blue * 0.986039;
|
843
|
+
var x2 = X / (X + Y + Z);
|
844
|
+
var y2 = Y / (X + Y + Z);
|
845
|
+
return new Array(x2, y2);
|
846
|
+
};
|
847
|
+
return ColorConverter;
|
848
|
+
}());
|
849
|
+
exports.ColorConverter = ColorConverter;
|
850
|
+
var ZigbeeSteckdose = /** @class */ (function (_super) {
|
851
|
+
__extends(ZigbeeSteckdose, _super);
|
852
|
+
function ZigbeeSteckdose(adapter, id, baseState, etage, raum, device, alexaSmartNamesForOn, alexaActionNamesForOn, alexaSmartNamesForOff, alexaActionNamesForOff, additionalStates4TurnOn, additionalStates4TurnOff) {
|
853
|
+
var _this = _super.call(this, adapter, id, baseState, etage, raum, device) || this;
|
854
|
+
_this.adapter = adapter;
|
855
|
+
_this.alexaSmartNamesForOn = alexaSmartNamesForOn;
|
856
|
+
_this.alexaSmartNamesForOff = alexaSmartNamesForOff;
|
857
|
+
_this.alexaActionNamesForOn = alexaActionNamesForOn;
|
858
|
+
_this.alexaActionNamesForOff = alexaActionNamesForOff;
|
859
|
+
_this.additionalStates4TurnOn = additionalStates4TurnOn;
|
860
|
+
_this.additionalStates4TurnOff = additionalStates4TurnOff;
|
861
|
+
// 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
|
862
|
+
_this.additionalStates4TurnOn.forEach(function (turnOnState) {
|
863
|
+
_this.createState(turnOnState);
|
864
|
+
});
|
865
|
+
// 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
|
866
|
+
_this.additionalStates4TurnOff.forEach(function (turnOffState) {
|
867
|
+
_this.createState(turnOffState);
|
868
|
+
});
|
869
|
+
_this.alexaSmartNamesForOn.forEach(function (alexaSmartName) {
|
870
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
871
|
+
});
|
872
|
+
_this.alexaSmartNamesForOff.forEach(function (alexaSmartName) {
|
873
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
874
|
+
});
|
875
|
+
_this.alexaActionNamesForOn.forEach(function (alexaSmartName) {
|
876
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
877
|
+
});
|
878
|
+
_this.alexaActionNamesForOff.forEach(function (alexaSmartName) {
|
879
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
880
|
+
});
|
881
|
+
return _this;
|
882
|
+
}
|
883
|
+
ZigbeeSteckdose.prototype.createState = function (key_in) {
|
884
|
+
var jarvisDatenpunkt = key_in; //.replace(/\./g,'_'); // wegen Wohnzimmer T.V.
|
885
|
+
this.adapter.createState(jarvisDatenpunkt, false, {
|
886
|
+
name: jarvisDatenpunkt,
|
887
|
+
desc: jarvisDatenpunkt,
|
888
|
+
type: 'boolean',
|
889
|
+
read: true,
|
890
|
+
write: true
|
891
|
+
});
|
892
|
+
};
|
893
|
+
ZigbeeSteckdose.prototype.getAdditionalStates4TurnOn = function () {
|
894
|
+
return this.additionalStates4TurnOn;
|
895
|
+
};
|
896
|
+
ZigbeeSteckdose.prototype.getAdditionalStates4TurnOff = function () {
|
897
|
+
return this.additionalStates4TurnOff;
|
898
|
+
};
|
899
|
+
ZigbeeSteckdose.prototype.getAlexaSmartNamesForOn = function () {
|
900
|
+
return this.alexaSmartNamesForOn;
|
901
|
+
};
|
902
|
+
ZigbeeSteckdose.prototype.getAlexaSmartNamesForOff = function () {
|
903
|
+
return this.alexaSmartNamesForOff;
|
904
|
+
};
|
905
|
+
ZigbeeSteckdose.prototype.getAlexaActionNamesForOn = function () {
|
906
|
+
return this.alexaActionNamesForOn;
|
907
|
+
};
|
908
|
+
ZigbeeSteckdose.prototype.getAlexaActionNamesForOff = function () {
|
909
|
+
return this.alexaActionNamesForOff;
|
910
|
+
};
|
911
|
+
ZigbeeSteckdose.prototype.getSwitchState = function () {
|
912
|
+
return this.baseState + ".on";
|
913
|
+
};
|
914
|
+
ZigbeeSteckdose.prototype.isSwitchedOn = function () {
|
915
|
+
if (this.adapter.getState(this.baseState + ".on").val == false) { // hue.0.Steckdose_Backstube.on
|
916
|
+
return false;
|
917
|
+
}
|
918
|
+
return true;
|
919
|
+
};
|
920
|
+
ZigbeeSteckdose.prototype.getCategory = function () {
|
921
|
+
return deviceZigbeeSteckdose;
|
922
|
+
};
|
923
|
+
ZigbeeSteckdose.prototype.getAlexaNamesForOnAsString = function () {
|
924
|
+
var result = "";
|
925
|
+
this.alexaSmartNamesForOn.forEach(function (alexaOnName) {
|
926
|
+
if (result == "") {
|
927
|
+
result += alexaOnName;
|
928
|
+
}
|
929
|
+
else {
|
930
|
+
result += ", " + alexaOnName;
|
931
|
+
}
|
932
|
+
});
|
933
|
+
this.alexaActionNamesForOn.forEach(function (alexaOnName) {
|
934
|
+
if (result == "") {
|
935
|
+
result += alexaOnName;
|
936
|
+
}
|
937
|
+
else {
|
938
|
+
result += ", " + alexaOnName;
|
939
|
+
}
|
940
|
+
});
|
941
|
+
return result;
|
942
|
+
};
|
943
|
+
ZigbeeSteckdose.prototype.getAlexaNamesForOffAsString = function () {
|
944
|
+
var result = "";
|
945
|
+
this.alexaSmartNamesForOff.forEach(function (alexaOffName) {
|
946
|
+
if (result == "") {
|
947
|
+
result += alexaOffName;
|
948
|
+
}
|
949
|
+
else {
|
950
|
+
result += ", " + alexaOffName;
|
951
|
+
}
|
952
|
+
});
|
953
|
+
this.alexaActionNamesForOff.forEach(function (alexaOffName) {
|
954
|
+
if (result == "") {
|
955
|
+
result += alexaOffName;
|
956
|
+
}
|
957
|
+
else {
|
958
|
+
result += ", " + alexaOffName;
|
959
|
+
}
|
960
|
+
});
|
961
|
+
return result;
|
962
|
+
};
|
963
|
+
return ZigbeeSteckdose;
|
964
|
+
}(AbstractZigbee));
|
965
|
+
exports.ZigbeeSteckdose = ZigbeeSteckdose;
|
966
|
+
var ZigbeeSchalter = /** @class */ (function (_super) {
|
967
|
+
__extends(ZigbeeSchalter, _super);
|
968
|
+
function ZigbeeSchalter(adapter, id, baseState, etage, raum, device) {
|
969
|
+
var _this = _super.call(this, adapter, id, baseState, etage, raum, device) || this;
|
970
|
+
_this.adapter = adapter;
|
971
|
+
return _this;
|
972
|
+
}
|
973
|
+
ZigbeeSchalter.prototype.getCategory = function () {
|
974
|
+
return deviceZigbeeSchalter;
|
975
|
+
};
|
976
|
+
return ZigbeeSchalter;
|
977
|
+
}(AbstractZigbee));
|
978
|
+
exports.ZigbeeSchalter = ZigbeeSchalter;
|
979
|
+
var ZigbeeRepeater = /** @class */ (function (_super) {
|
980
|
+
__extends(ZigbeeRepeater, _super);
|
981
|
+
function ZigbeeRepeater(adapter, id, baseState, etage, raum, device) {
|
982
|
+
var _this = _super.call(this, adapter, id, baseState, etage, raum, device) || this;
|
983
|
+
_this.adapter = adapter;
|
984
|
+
return _this;
|
985
|
+
}
|
986
|
+
ZigbeeRepeater.prototype.getCategory = function () {
|
987
|
+
return deviceZigbeeRepeater;
|
988
|
+
};
|
989
|
+
return ZigbeeRepeater;
|
990
|
+
}(AbstractZigbee));
|
991
|
+
exports.ZigbeeRepeater = ZigbeeRepeater;
|
992
|
+
var ZigbeeFenstersensor = /** @class */ (function (_super) {
|
993
|
+
__extends(ZigbeeFenstersensor, _super);
|
994
|
+
function ZigbeeFenstersensor(adapter, id, baseState, etage, raum, device) {
|
995
|
+
var _this = _super.call(this, adapter, id, baseState, etage, raum, device) || this;
|
996
|
+
_this.adapter = adapter;
|
997
|
+
return _this;
|
998
|
+
}
|
999
|
+
ZigbeeFenstersensor.prototype.isOpen = function () {
|
1000
|
+
if (this.adapter.getState(this.baseState + ".open").val == false) { // deconz.0.Sensors.117.open
|
1001
|
+
return false;
|
1002
|
+
}
|
1003
|
+
return true;
|
1004
|
+
};
|
1005
|
+
ZigbeeFenstersensor.prototype.isStatusReachable = function () {
|
1006
|
+
var reachable = this.adapter.getState(this.baseState + ".reachable").val; // hue.0.Steckdose_Backstube.reachable
|
1007
|
+
return reachable;
|
1008
|
+
};
|
1009
|
+
ZigbeeFenstersensor.prototype.getBattery = function () {
|
1010
|
+
return this.adapter.getState(this.baseState + ".battery").val; // // alias.0.Z021.battery
|
1011
|
+
};
|
1012
|
+
ZigbeeFenstersensor.prototype.getCategory = function () {
|
1013
|
+
return deviceZigbeeFenstersensor;
|
1014
|
+
};
|
1015
|
+
return ZigbeeFenstersensor;
|
1016
|
+
}(AbstractZigbee));
|
1017
|
+
exports.ZigbeeFenstersensor = ZigbeeFenstersensor;
|
1018
|
+
var ZigbeeRauchmelder = /** @class */ (function (_super) {
|
1019
|
+
__extends(ZigbeeRauchmelder, _super);
|
1020
|
+
function ZigbeeRauchmelder(adapter, id, baseState, etage, raum, device) {
|
1021
|
+
var _this = _super.call(this, adapter, id, baseState, etage, raum, device) || this;
|
1022
|
+
_this.adapter = adapter;
|
1023
|
+
return _this;
|
1024
|
+
}
|
1025
|
+
ZigbeeRauchmelder.prototype.isFire = function () {
|
1026
|
+
if (this.adapter.getState(this.baseState + ".fire").val == false) { // hue.0.Steckdose_Backstube.on
|
1027
|
+
return false;
|
1028
|
+
}
|
1029
|
+
return true;
|
1030
|
+
};
|
1031
|
+
ZigbeeRauchmelder.prototype.isStatusReachable = function () {
|
1032
|
+
var reachable = this.adapter.getState(this.baseState + ".reachable").val; // hue.0.Steckdose_Backstube.reachable
|
1033
|
+
return reachable;
|
1034
|
+
};
|
1035
|
+
ZigbeeRauchmelder.prototype.getBattery = function () {
|
1036
|
+
return this.adapter.getState(this.baseState + ".battery").val; // // alias.0.Z021.battery
|
1037
|
+
};
|
1038
|
+
ZigbeeRauchmelder.prototype.getCategory = function () {
|
1039
|
+
return deviceZigbeeRauchmelder;
|
1040
|
+
};
|
1041
|
+
return ZigbeeRauchmelder;
|
1042
|
+
}(AbstractZigbee));
|
1043
|
+
exports.ZigbeeRauchmelder = ZigbeeRauchmelder;
|
1044
|
+
var ZigbeeBewegungsmelder = /** @class */ (function (_super) {
|
1045
|
+
__extends(ZigbeeBewegungsmelder, _super);
|
1046
|
+
function ZigbeeBewegungsmelder(adapter, id, baseState, etage, raum, device) {
|
1047
|
+
var _this = _super.call(this, adapter, id, baseState, etage, raum, device) || this;
|
1048
|
+
_this.adapter = adapter;
|
1049
|
+
return _this;
|
1050
|
+
}
|
1051
|
+
ZigbeeBewegungsmelder.prototype.getCategory = function () {
|
1052
|
+
return deviceZigbeeBewegungsmelder;
|
1053
|
+
};
|
1054
|
+
ZigbeeBewegungsmelder.prototype.getBattery = function () {
|
1055
|
+
return this.adapter.getState(this.baseState + ".battery").val; // // alias.0.Z021.battery
|
1056
|
+
};
|
1057
|
+
return ZigbeeBewegungsmelder;
|
1058
|
+
}(AbstractZigbee));
|
1059
|
+
exports.ZigbeeBewegungsmelder = ZigbeeBewegungsmelder;
|
1060
|
+
var ZigbeeWandtaster = /** @class */ (function (_super) {
|
1061
|
+
__extends(ZigbeeWandtaster, _super);
|
1062
|
+
function ZigbeeWandtaster(adapter, id, baseState, etage, raum, device) {
|
1063
|
+
var _this = _super.call(this, adapter, id, baseState, etage, raum, device) || this;
|
1064
|
+
_this.adapter = adapter;
|
1065
|
+
return _this;
|
1066
|
+
}
|
1067
|
+
ZigbeeWandtaster.prototype.getCategory = function () {
|
1068
|
+
return deviceZigbeeWandtaster;
|
1069
|
+
};
|
1070
|
+
ZigbeeWandtaster.prototype.getBattery = function () {
|
1071
|
+
return this.adapter.getState(this.baseState + ".battery").val; // // alias.0.Z021.battery
|
1072
|
+
};
|
1073
|
+
return ZigbeeWandtaster;
|
1074
|
+
}(AbstractZigbee));
|
1075
|
+
exports.ZigbeeWandtaster = ZigbeeWandtaster;
|
1076
|
+
var ZigbeeDosenrelais = /** @class */ (function (_super) {
|
1077
|
+
__extends(ZigbeeDosenrelais, _super);
|
1078
|
+
function ZigbeeDosenrelais(adapter, id, baseState, etage, raum, device, alexaSmartNames) {
|
1079
|
+
var _this = _super.call(this, adapter, id, baseState, etage, raum, device) || this;
|
1080
|
+
_this.adapter = adapter;
|
1081
|
+
_this.alexaSmartNames = alexaSmartNames;
|
1082
|
+
_this.alexaSmartNames.forEach(function (alexaSmartName) {
|
1083
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
1084
|
+
});
|
1085
|
+
return _this;
|
1086
|
+
}
|
1087
|
+
ZigbeeDosenrelais.prototype.getSwitchState = function () {
|
1088
|
+
return this.baseState + ".on";
|
1089
|
+
};
|
1090
|
+
ZigbeeDosenrelais.prototype.isSwitchedOn = function () {
|
1091
|
+
if (this.adapter.getState(this.baseState + ".on").val == false) {
|
1092
|
+
return false;
|
1093
|
+
}
|
1094
|
+
return true;
|
1095
|
+
};
|
1096
|
+
ZigbeeDosenrelais.prototype.turnOn = function () {
|
1097
|
+
this.adapter.setState(this.baseState + ".on", true);
|
1098
|
+
};
|
1099
|
+
ZigbeeDosenrelais.prototype.turnOff = function () {
|
1100
|
+
this.adapter.setState(this.baseState + ".on", false);
|
1101
|
+
};
|
1102
|
+
ZigbeeDosenrelais.prototype.getCategory = function () {
|
1103
|
+
return deviceZigbeeDosenrelais;
|
1104
|
+
};
|
1105
|
+
ZigbeeDosenrelais.prototype.getAlexaSmartNames = function () {
|
1106
|
+
return this.alexaSmartNames;
|
1107
|
+
};
|
1108
|
+
return ZigbeeDosenrelais;
|
1109
|
+
}(AbstractZigbee));
|
1110
|
+
exports.ZigbeeDosenrelais = ZigbeeDosenrelais;
|
1111
|
+
module.exports = {
|
1112
|
+
AbstractZigbee: AbstractZigbee,
|
1113
|
+
ColorConverter: ColorConverter,
|
1114
|
+
ColorScheme: ColorScheme,
|
1115
|
+
RGBColorScheme: RGBColorScheme,
|
1116
|
+
WhiteColorScheme: WhiteColorScheme,
|
1117
|
+
ZigbeeLampeRGB: ZigbeeLampeRGB,
|
1118
|
+
LampeWeissTasterScheme: LampeWeissTasterScheme,
|
1119
|
+
LampeWeissAlexaScheme: LampeWeissAlexaScheme,
|
1120
|
+
ZigbeeLampeWeiss: ZigbeeLampeWeiss,
|
1121
|
+
ZigbeeSteckdose: ZigbeeSteckdose,
|
1122
|
+
ZigbeeSchalter: ZigbeeSchalter,
|
1123
|
+
ZigbeeRepeater: ZigbeeRepeater,
|
1124
|
+
ZigbeeFenstersensor: ZigbeeFenstersensor,
|
1125
|
+
ZigbeeRauchmelder: ZigbeeRauchmelder,
|
1126
|
+
ZigbeeBewegungsmelder: ZigbeeBewegungsmelder,
|
1127
|
+
ZigbeeWandtaster: ZigbeeWandtaster,
|
1128
|
+
ZigbeeDosenrelais: ZigbeeDosenrelais,
|
1129
|
+
deviceZigbeeSteckdose: deviceZigbeeSteckdose,
|
1130
|
+
deviceZigbeeBewegungsmelder: deviceZigbeeBewegungsmelder,
|
1131
|
+
deviceZigbeeLampeRGB: deviceZigbeeLampeRGB,
|
1132
|
+
deviceZigbeeLampeWeiss: deviceZigbeeLampeWeiss,
|
1133
|
+
deviceZigbeeRauchmelder: deviceZigbeeRauchmelder,
|
1134
|
+
deviceZigbeeWandtaster: deviceZigbeeWandtaster,
|
1135
|
+
deviceZigbeeDosenrelais: deviceZigbeeDosenrelais,
|
1136
|
+
deviceZigbeeSchalter: deviceZigbeeSchalter,
|
1137
|
+
deviceZigbeeRepeater: deviceZigbeeRepeater,
|
1138
|
+
deviceZigbeeFenstersensor: deviceZigbeeFenstersensor
|
1139
|
+
};
|