iobroker-ucl 1.1.9 → 1.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/!!!_INSTRUCTIONS_!!!.ts +7 -3
- package/homematicClasses.js +448 -72
- package/homematicClasses.ts +515 -74
- package/homematicFunctions.js +349 -4
- package/homematicFunctions.ts +410 -8
- package/main.js +37 -2
- package/main.ts +12 -3
- package/package.json +12 -12
- package/shellyClasses.js +756 -0
- package/shellyClasses.ts +873 -0
- package/shellyFunctions.js +694 -0
- package/shellyFunctions.ts +778 -0
- package/test.js +8 -9
- package/test.ts +8 -9
- package/zigbeeFunctions.js +0 -1
- package/zigbeeFunctions.ts +0 -2
package/shellyClasses.js
ADDED
@@ -0,0 +1,756 @@
|
|
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.ShellyLampeRGB = exports.ShellyRGBTasterScheme = exports.ShellyRGBAlexaScheme = exports.ShellyDimmer = exports.ShellyDimmerAlexaScheme = exports.ShellyLampeWeiss = exports.AbstractShelly = void 0;
|
19
|
+
var deviceShellyLampeWeiss = "Lampe Weiss";
|
20
|
+
var deviceShellyDimmer = "Dimmer";
|
21
|
+
var deviceShellyLampeRGB = "Lampe RGB";
|
22
|
+
var deviceShellySteckdose = "Steckdose";
|
23
|
+
var deviceShellyRollladen = "Rollladen";
|
24
|
+
var deviceShellySensor = "Sensor";
|
25
|
+
var AbstractShelly = /** @class */ (function () {
|
26
|
+
function AbstractShelly(adapter, id, etage, raum, device, baseState) {
|
27
|
+
this.adapter = adapter;
|
28
|
+
this.id = id;
|
29
|
+
this.etage = etage;
|
30
|
+
this.raum = raum;
|
31
|
+
this.device = device;
|
32
|
+
this.baseState = baseState;
|
33
|
+
}
|
34
|
+
AbstractShelly.prototype.getDeviceId = function () {
|
35
|
+
return "S" + this.id.toString().padStart(2, '0');
|
36
|
+
};
|
37
|
+
AbstractShelly.prototype.getDeviceIdAsRawNumber = function () {
|
38
|
+
return this.id;
|
39
|
+
};
|
40
|
+
AbstractShelly.prototype.getEtage = function () {
|
41
|
+
return this.etage;
|
42
|
+
};
|
43
|
+
AbstractShelly.prototype.getRaum = function () {
|
44
|
+
return this.raum;
|
45
|
+
};
|
46
|
+
AbstractShelly.prototype.getDevice = function () {
|
47
|
+
return this.device;
|
48
|
+
};
|
49
|
+
AbstractShelly.prototype.getBezeichnung = function () {
|
50
|
+
return this.etage + " " + this.raum + " " + this.device;
|
51
|
+
};
|
52
|
+
AbstractShelly.prototype.getIP = function () {
|
53
|
+
return this.adapter.getState(this.baseState + ".hostname").val;
|
54
|
+
};
|
55
|
+
AbstractShelly.prototype.isNewFirmwareAvailable = function () {
|
56
|
+
return this.adapter.getState(this.baseState + ".firmware").val;
|
57
|
+
};
|
58
|
+
AbstractShelly.prototype.getBaseState = function () {
|
59
|
+
return this.baseState;
|
60
|
+
};
|
61
|
+
AbstractShelly.prototype.getReducedBaseState = function () {
|
62
|
+
return this.baseState.replace("shelly.0.", "");
|
63
|
+
};
|
64
|
+
// Shelly1, Shelly2.5,...
|
65
|
+
AbstractShelly.prototype.getType = function () {
|
66
|
+
var typ = this.adapter.getState(this.baseState + ".id").val;
|
67
|
+
if (typ == "shelly1") {
|
68
|
+
return "1";
|
69
|
+
}
|
70
|
+
else if (typ == "shellyswitch25") {
|
71
|
+
return "2.5";
|
72
|
+
}
|
73
|
+
else if (typ == "shellyswitch") {
|
74
|
+
return "2.0";
|
75
|
+
}
|
76
|
+
else if (typ == "shellyplug-s") {
|
77
|
+
return "Plug";
|
78
|
+
}
|
79
|
+
else if (typ == "shellyem3") {
|
80
|
+
return "3EM";
|
81
|
+
}
|
82
|
+
else {
|
83
|
+
return typ;
|
84
|
+
}
|
85
|
+
};
|
86
|
+
AbstractShelly.prototype.getSignal = function () {
|
87
|
+
return this.adapter.getState(this.baseState + ".rssi").val;
|
88
|
+
};
|
89
|
+
AbstractShelly.prototype.getUptime = function () {
|
90
|
+
return this.adapter.getState(this.baseState + ".uptime").val;
|
91
|
+
};
|
92
|
+
AbstractShelly.prototype.getFirmware = function () {
|
93
|
+
var versionState = this.baseState + ".version";
|
94
|
+
var version = this.adapter.getState(versionState).val;
|
95
|
+
version = version.substr(0, version.indexOf('-'));
|
96
|
+
return version;
|
97
|
+
};
|
98
|
+
AbstractShelly.prototype.createIOTAdapterSmartDevices = function (smartName) {
|
99
|
+
// Level:
|
100
|
+
// ----------------------------------------------------------------------------------
|
101
|
+
var alexaLampeLevel = "0_userdata.0.alexa." + smartName + ".level";
|
102
|
+
this.adapter.createState(alexaLampeLevel, 0, {
|
103
|
+
name: alexaLampeLevel,
|
104
|
+
desc: alexaLampeLevel,
|
105
|
+
type: 'number',
|
106
|
+
read: true,
|
107
|
+
write: true
|
108
|
+
});
|
109
|
+
// @ts-ignore
|
110
|
+
var objLevel = this.adapter.getObject(alexaLampeLevel);
|
111
|
+
objLevel.common = {
|
112
|
+
"type": "number",
|
113
|
+
"name": alexaLampeLevel,
|
114
|
+
"read": true,
|
115
|
+
"write": true,
|
116
|
+
"role": "level.dimmer",
|
117
|
+
"min": 0,
|
118
|
+
"max": 100,
|
119
|
+
"def": 0,
|
120
|
+
"smartName": {
|
121
|
+
"de": smartName,
|
122
|
+
"smartType": "LIGHT"
|
123
|
+
}
|
124
|
+
};
|
125
|
+
this.adapter.setObject(alexaLampeLevel, objLevel);
|
126
|
+
// HUE:
|
127
|
+
// ----------------------------------------------------------------------------------
|
128
|
+
var alexaLampeHue = "0_userdata.0.alexa." + smartName + ".hue";
|
129
|
+
this.adapter.createState(alexaLampeHue, 0, {
|
130
|
+
name: alexaLampeHue,
|
131
|
+
desc: alexaLampeHue,
|
132
|
+
type: 'number',
|
133
|
+
read: true,
|
134
|
+
write: true
|
135
|
+
});
|
136
|
+
// @ts-ignore
|
137
|
+
var objHue = this.adapter.getObject(alexaLampeHue);
|
138
|
+
objHue.common = {
|
139
|
+
"name": alexaLampeHue,
|
140
|
+
"desc": alexaLampeHue,
|
141
|
+
"type": "number",
|
142
|
+
"read": true,
|
143
|
+
"write": true,
|
144
|
+
"role": "level.color.hue",
|
145
|
+
"smartName": {
|
146
|
+
"de": smartName,
|
147
|
+
"smartType": "LIGHT"
|
148
|
+
}
|
149
|
+
};
|
150
|
+
this.adapter.setObject(alexaLampeHue, objHue);
|
151
|
+
// SAT:
|
152
|
+
// ----------------------------------------------------------------------------------
|
153
|
+
var alexaLampeSat = "0_userdata.0.alexa." + smartName + ".sat";
|
154
|
+
this.adapter.createState(alexaLampeSat, 0, {
|
155
|
+
name: alexaLampeSat,
|
156
|
+
desc: alexaLampeSat,
|
157
|
+
type: 'number',
|
158
|
+
read: true,
|
159
|
+
write: true
|
160
|
+
});
|
161
|
+
// @ts-ignore
|
162
|
+
var obSat = this.adapter.getObject(alexaLampeSat);
|
163
|
+
obSat.common = {
|
164
|
+
"name": alexaLampeSat,
|
165
|
+
"desc": alexaLampeSat,
|
166
|
+
"type": "number",
|
167
|
+
"read": true,
|
168
|
+
"write": true,
|
169
|
+
"role": "level.color.saturation",
|
170
|
+
"smartName": {
|
171
|
+
"de": smartName,
|
172
|
+
"smartType": "LIGHT"
|
173
|
+
}
|
174
|
+
};
|
175
|
+
this.adapter.setObject(alexaLampeSat, obSat);
|
176
|
+
// CT:
|
177
|
+
// ----------------------------------------------------------------------------------
|
178
|
+
var alexaLampeCT = "0_userdata.0.alexa." + smartName + ".ct";
|
179
|
+
this.adapter.createState(alexaLampeCT, 0, {
|
180
|
+
name: alexaLampeCT,
|
181
|
+
desc: alexaLampeCT,
|
182
|
+
type: 'number',
|
183
|
+
read: true,
|
184
|
+
write: true
|
185
|
+
});
|
186
|
+
// @ts-ignore
|
187
|
+
var objCT = this.adapter.getObject(alexaLampeCT);
|
188
|
+
objCT.common = {
|
189
|
+
"type": "number",
|
190
|
+
"name": alexaLampeCT,
|
191
|
+
"read": true,
|
192
|
+
"write": true,
|
193
|
+
"role": "level.color.temperature",
|
194
|
+
"smartName": {
|
195
|
+
"de": smartName,
|
196
|
+
"smartType": "LIGHT"
|
197
|
+
}
|
198
|
+
};
|
199
|
+
this.adapter.setObject(alexaLampeCT, objCT);
|
200
|
+
};
|
201
|
+
return AbstractShelly;
|
202
|
+
}());
|
203
|
+
exports.AbstractShelly = AbstractShelly;
|
204
|
+
var ShellyLampeWeiss = /** @class */ (function (_super) {
|
205
|
+
__extends(ShellyLampeWeiss, _super);
|
206
|
+
function ShellyLampeWeiss(adapter, id, etage, raum, device, baseState, channel, alexaSmartNamesForOn, alexaActionNamesForOn, alexaSmartNamesForOff, alexaActionNamesForOff, additionalStates4TurnOn, additionalStates4TurnOff, nachtbeleuchtung, turnOffExitHouseSummer, turnOffExitHouseWinter, turnOnEnterHouseSummer, turnOnEnterHouseWinter) {
|
207
|
+
var _this = _super.call(this, adapter, id, etage, raum, device, baseState) || this;
|
208
|
+
_this.turnOffExitHouseSummer = turnOffExitHouseSummer;
|
209
|
+
_this.turnOffExitHouseWinter = turnOffExitHouseWinter;
|
210
|
+
_this.turnOnEnterHouseSummer = turnOnEnterHouseSummer;
|
211
|
+
_this.turnOnEnterHouseWinter = turnOnEnterHouseWinter;
|
212
|
+
_this.nachtbeleuchtung = nachtbeleuchtung;
|
213
|
+
_this.channel = channel;
|
214
|
+
_this.alexaSmartNamesForOn = alexaSmartNamesForOn;
|
215
|
+
_this.alexaSmartNamesForOff = alexaSmartNamesForOff;
|
216
|
+
_this.alexaActionNamesForOn = alexaActionNamesForOn;
|
217
|
+
_this.alexaActionNamesForOff = alexaActionNamesForOff;
|
218
|
+
_this.additionalStates4TurnOn = additionalStates4TurnOn;
|
219
|
+
_this.additionalStates4TurnOff = additionalStates4TurnOff;
|
220
|
+
_this.additionalStates4TurnOn.forEach(function (booleanOnObj) {
|
221
|
+
_this.createState(booleanOnObj);
|
222
|
+
});
|
223
|
+
_this.additionalStates4TurnOff.forEach(function (tasterBooleanOffObj) {
|
224
|
+
_this.createState(tasterBooleanOffObj);
|
225
|
+
});
|
226
|
+
_this.alexaSmartNamesForOn.forEach(function (alexaSmartName) {
|
227
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
228
|
+
});
|
229
|
+
_this.alexaSmartNamesForOff.forEach(function (alexaSmartName) {
|
230
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
231
|
+
});
|
232
|
+
_this.alexaActionNamesForOn.forEach(function (alexaSmartName) {
|
233
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
234
|
+
});
|
235
|
+
_this.alexaActionNamesForOff.forEach(function (alexaSmartName) {
|
236
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
237
|
+
});
|
238
|
+
return _this;
|
239
|
+
}
|
240
|
+
ShellyLampeWeiss.prototype.createState = function (key_in) {
|
241
|
+
var jarvisDatenpunkt = key_in; //.replace(/\./g,'_'); // wegen Wohnzimmer T.V.
|
242
|
+
//log(">>> CREATE STATE: " + jarvisDatenpunkt);
|
243
|
+
this.adapter.createState(jarvisDatenpunkt, false, {
|
244
|
+
name: jarvisDatenpunkt,
|
245
|
+
desc: jarvisDatenpunkt,
|
246
|
+
type: 'boolean',
|
247
|
+
read: true,
|
248
|
+
write: true
|
249
|
+
});
|
250
|
+
};
|
251
|
+
ShellyLampeWeiss.prototype.isTurnOffExitHouseSummer = function () {
|
252
|
+
return this.turnOffExitHouseSummer;
|
253
|
+
};
|
254
|
+
ShellyLampeWeiss.prototype.isTurnOffExitHouseWinter = function () {
|
255
|
+
return this.turnOffExitHouseWinter;
|
256
|
+
};
|
257
|
+
ShellyLampeWeiss.prototype.isTurnOnEnterHouseSummer = function () {
|
258
|
+
return this.turnOnEnterHouseSummer;
|
259
|
+
};
|
260
|
+
ShellyLampeWeiss.prototype.isTurnOnEnterHouseWinter = function () {
|
261
|
+
return this.turnOnEnterHouseWinter;
|
262
|
+
};
|
263
|
+
ShellyLampeWeiss.prototype.isNachtbeleuchtung = function () {
|
264
|
+
return this.nachtbeleuchtung;
|
265
|
+
};
|
266
|
+
ShellyLampeWeiss.prototype.getAdditionalStates4TurnOn = function () {
|
267
|
+
return this.additionalStates4TurnOn;
|
268
|
+
};
|
269
|
+
ShellyLampeWeiss.prototype.getAdditionalStates4TurnOff = function () {
|
270
|
+
return this.additionalStates4TurnOff;
|
271
|
+
};
|
272
|
+
ShellyLampeWeiss.prototype.getSwitchState = function () {
|
273
|
+
return this.baseState + ".Relay" + this.channel + ".Switch";
|
274
|
+
};
|
275
|
+
ShellyLampeWeiss.prototype.isDeviceOn = function () {
|
276
|
+
return this.adapter.getState(this.getSwitchState()).val;
|
277
|
+
};
|
278
|
+
ShellyLampeWeiss.prototype.getCategory = function () {
|
279
|
+
return deviceShellyLampeWeiss;
|
280
|
+
};
|
281
|
+
ShellyLampeWeiss.prototype.getAlexaNamesForOnAsString = function () {
|
282
|
+
var result = "";
|
283
|
+
this.alexaSmartNamesForOn.forEach(function (alexaOnName) {
|
284
|
+
if (result == "") {
|
285
|
+
result += alexaOnName;
|
286
|
+
}
|
287
|
+
else {
|
288
|
+
result += ", " + alexaOnName;
|
289
|
+
}
|
290
|
+
});
|
291
|
+
this.alexaActionNamesForOn.forEach(function (alexaOnName) {
|
292
|
+
if (result == "") {
|
293
|
+
result += alexaOnName;
|
294
|
+
}
|
295
|
+
else {
|
296
|
+
result += ", " + alexaOnName;
|
297
|
+
}
|
298
|
+
});
|
299
|
+
return result;
|
300
|
+
};
|
301
|
+
ShellyLampeWeiss.prototype.getAlexaNamesForOffAsString = function () {
|
302
|
+
var result = "";
|
303
|
+
this.alexaSmartNamesForOff.forEach(function (alexaOffName) {
|
304
|
+
if (result == "") {
|
305
|
+
result += alexaOffName;
|
306
|
+
}
|
307
|
+
else {
|
308
|
+
result += ", " + alexaOffName;
|
309
|
+
}
|
310
|
+
});
|
311
|
+
this.alexaActionNamesForOff.forEach(function (alexaOffName) {
|
312
|
+
if (result == "") {
|
313
|
+
result += alexaOffName;
|
314
|
+
}
|
315
|
+
else {
|
316
|
+
result += ", " + alexaOffName;
|
317
|
+
}
|
318
|
+
});
|
319
|
+
return result;
|
320
|
+
};
|
321
|
+
ShellyLampeWeiss.prototype.getAlexaSmartNamesForOn = function () {
|
322
|
+
return this.alexaSmartNamesForOn;
|
323
|
+
};
|
324
|
+
ShellyLampeWeiss.prototype.getAlexaSmartNamesForOff = function () {
|
325
|
+
return this.alexaSmartNamesForOff;
|
326
|
+
};
|
327
|
+
ShellyLampeWeiss.prototype.getAlexaActionNamesForOn = function () {
|
328
|
+
return this.alexaActionNamesForOn;
|
329
|
+
};
|
330
|
+
ShellyLampeWeiss.prototype.getAlexaActionNamesForOff = function () {
|
331
|
+
return this.alexaActionNamesForOff;
|
332
|
+
};
|
333
|
+
return ShellyLampeWeiss;
|
334
|
+
}(AbstractShelly));
|
335
|
+
exports.ShellyLampeWeiss = ShellyLampeWeiss;
|
336
|
+
var ShellyDimmerAlexaScheme = /** @class */ (function () {
|
337
|
+
function ShellyDimmerAlexaScheme(alexaName, level) {
|
338
|
+
this.alexaName = alexaName;
|
339
|
+
this.level = level;
|
340
|
+
}
|
341
|
+
ShellyDimmerAlexaScheme.prototype.getAlexaName = function () {
|
342
|
+
return this.alexaName;
|
343
|
+
};
|
344
|
+
ShellyDimmerAlexaScheme.prototype.getLevel = function () {
|
345
|
+
return this.level;
|
346
|
+
};
|
347
|
+
ShellyDimmerAlexaScheme.prototype.setDevice = function (device) {
|
348
|
+
this.device = device;
|
349
|
+
};
|
350
|
+
ShellyDimmerAlexaScheme.prototype.getDevice = function () {
|
351
|
+
return this.device;
|
352
|
+
};
|
353
|
+
return ShellyDimmerAlexaScheme;
|
354
|
+
}());
|
355
|
+
exports.ShellyDimmerAlexaScheme = ShellyDimmerAlexaScheme;
|
356
|
+
var ShellyDimmerTasterScheme = /** @class */ (function () {
|
357
|
+
function ShellyDimmerTasterScheme(tasterBooleanOn, level) {
|
358
|
+
this.tasterBooleanOn = tasterBooleanOn;
|
359
|
+
this.level = level;
|
360
|
+
}
|
361
|
+
ShellyDimmerTasterScheme.prototype.getTasterBooleanOnName = function () {
|
362
|
+
return this.tasterBooleanOn;
|
363
|
+
};
|
364
|
+
ShellyDimmerTasterScheme.prototype.getLevel = function () {
|
365
|
+
return this.level;
|
366
|
+
};
|
367
|
+
return ShellyDimmerTasterScheme;
|
368
|
+
}());
|
369
|
+
var ShellyDimmer = /** @class */ (function (_super) {
|
370
|
+
__extends(ShellyDimmer, _super);
|
371
|
+
function ShellyDimmer(adapter, id, etage, raum, device, baseState, alexaSmartNamesForOn, alexaActionNamesForOn, alexaLevelSchemeForOn, alexaSmartNamesForOff, alexaActionNamesForOff, levelSchemes, tasterBooleanOn, tasterBooleanOff, nachtbeleuchtung, turnOffExitHouseSummer, turnOffExitHouseWinter, turnOnEnterHouseSummer, turnOnEnterHouseWinter) {
|
372
|
+
var _this = _super.call(this, adapter, id, etage, raum, device, baseState) || this;
|
373
|
+
_this.alexaSmartNamesForOn = alexaSmartNamesForOn;
|
374
|
+
_this.alexaSmartNamesForOff = alexaSmartNamesForOff;
|
375
|
+
_this.alexaActionNamesForOn = alexaActionNamesForOn;
|
376
|
+
_this.alexaActionNamesForOff = alexaActionNamesForOff;
|
377
|
+
_this.nachtbeleuchtung = nachtbeleuchtung;
|
378
|
+
_this.turnOffExitHouseSummer = turnOffExitHouseSummer;
|
379
|
+
_this.turnOffExitHouseWinter = turnOffExitHouseWinter;
|
380
|
+
_this.turnOnEnterHouseSummer = turnOnEnterHouseSummer;
|
381
|
+
_this.turnOnEnterHouseWinter = turnOnEnterHouseWinter;
|
382
|
+
_this.alexaLevelSchemeForOn = alexaLevelSchemeForOn;
|
383
|
+
_this.tasterBooleanOn = tasterBooleanOn;
|
384
|
+
_this.levelSchemes = levelSchemes;
|
385
|
+
_this.tasterBooleanOff = tasterBooleanOff;
|
386
|
+
if (_this.alexaLevelSchemeForOn != null) {
|
387
|
+
_this.alexaLevelSchemeForOn.setDevice(_this);
|
388
|
+
if (alexaLevelSchemeForOn.getAlexaName() != null) {
|
389
|
+
_this.createState(alexaLevelSchemeForOn.getAlexaName());
|
390
|
+
}
|
391
|
+
}
|
392
|
+
_this.tasterBooleanOn.forEach(function (tasterScheme) {
|
393
|
+
if (tasterScheme.getTasterBooleanOnName() != null) {
|
394
|
+
_this.createState(tasterScheme.getTasterBooleanOnName());
|
395
|
+
}
|
396
|
+
});
|
397
|
+
_this.tasterBooleanOff.forEach(function (offName) {
|
398
|
+
_this.createState(offName);
|
399
|
+
});
|
400
|
+
_this.alexaSmartNamesForOn.forEach(function (alexaSmartName) {
|
401
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
402
|
+
});
|
403
|
+
_this.alexaSmartNamesForOff.forEach(function (alexaSmartName) {
|
404
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
405
|
+
});
|
406
|
+
_this.alexaActionNamesForOn.forEach(function (alexaSmartName) {
|
407
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
408
|
+
});
|
409
|
+
_this.alexaActionNamesForOff.forEach(function (alexaSmartName) {
|
410
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
411
|
+
});
|
412
|
+
return _this;
|
413
|
+
}
|
414
|
+
ShellyDimmer.prototype.isNachtbeleuchtung = function () {
|
415
|
+
return this.nachtbeleuchtung;
|
416
|
+
};
|
417
|
+
ShellyDimmer.prototype.isTurnOffExitHouseSummer = function () {
|
418
|
+
return this.turnOffExitHouseSummer;
|
419
|
+
};
|
420
|
+
ShellyDimmer.prototype.isTurnOffExitHouseWinter = function () {
|
421
|
+
return this.turnOffExitHouseWinter;
|
422
|
+
};
|
423
|
+
ShellyDimmer.prototype.isTurnOnEnterHouseSummer = function () {
|
424
|
+
return this.turnOnEnterHouseSummer;
|
425
|
+
};
|
426
|
+
ShellyDimmer.prototype.isTurnOnEnterHouseWinter = function () {
|
427
|
+
return this.turnOnEnterHouseWinter;
|
428
|
+
};
|
429
|
+
ShellyDimmer.prototype.createState = function (key_in) {
|
430
|
+
var jarvisDatenpunkt = key_in; //.replace(/\./g,'_'); // wegen Wohnzimmer T.V.
|
431
|
+
//log(">>> CREATE STATE: " + jarvisDatenpunkt);
|
432
|
+
this.adapter.createState(jarvisDatenpunkt, false, {
|
433
|
+
name: jarvisDatenpunkt,
|
434
|
+
desc: jarvisDatenpunkt,
|
435
|
+
type: 'boolean',
|
436
|
+
read: true,
|
437
|
+
write: true
|
438
|
+
});
|
439
|
+
};
|
440
|
+
ShellyDimmer.prototype.getAlexaLevelSchemeForOn = function () {
|
441
|
+
return this.alexaLevelSchemeForOn;
|
442
|
+
};
|
443
|
+
ShellyDimmer.prototype.getAlexaSchemes = function () {
|
444
|
+
return this.levelSchemes;
|
445
|
+
};
|
446
|
+
ShellyDimmer.prototype.getTasterBooleanOn = function () {
|
447
|
+
return this.tasterBooleanOn;
|
448
|
+
};
|
449
|
+
ShellyDimmer.prototype.getTasterBooleanOff = function () {
|
450
|
+
return this.tasterBooleanOff;
|
451
|
+
};
|
452
|
+
ShellyDimmer.prototype.getSwitchState = function () {
|
453
|
+
return this.baseState + ".lights.Switch"; // shelly.0.SHDM-2#98CDAC0BE168#1.lights.Switch
|
454
|
+
};
|
455
|
+
ShellyDimmer.prototype.isDeviceOn = function () {
|
456
|
+
return this.adapter.getState(this.getSwitchState()).val;
|
457
|
+
};
|
458
|
+
ShellyDimmer.prototype.getCategory = function () {
|
459
|
+
return deviceShellyDimmer;
|
460
|
+
};
|
461
|
+
ShellyDimmer.prototype.getAlexaNamesForOnAsString = function () {
|
462
|
+
var result = "";
|
463
|
+
this.alexaSmartNamesForOn.forEach(function (alexaOnName) {
|
464
|
+
if (result == "") {
|
465
|
+
result += alexaOnName;
|
466
|
+
}
|
467
|
+
else {
|
468
|
+
result += ", " + alexaOnName;
|
469
|
+
}
|
470
|
+
});
|
471
|
+
this.alexaActionNamesForOn.forEach(function (alexaOnName) {
|
472
|
+
if (result == "") {
|
473
|
+
result += alexaOnName;
|
474
|
+
}
|
475
|
+
else {
|
476
|
+
result += ", " + alexaOnName;
|
477
|
+
}
|
478
|
+
});
|
479
|
+
return result;
|
480
|
+
};
|
481
|
+
ShellyDimmer.prototype.getAlexaNamesForOffAsString = function () {
|
482
|
+
var result = "";
|
483
|
+
this.alexaSmartNamesForOff.forEach(function (alexaOffName) {
|
484
|
+
if (result == "") {
|
485
|
+
result += alexaOffName;
|
486
|
+
}
|
487
|
+
else {
|
488
|
+
result += ", " + alexaOffName;
|
489
|
+
}
|
490
|
+
});
|
491
|
+
this.alexaActionNamesForOff.forEach(function (alexaOffName) {
|
492
|
+
if (result == "") {
|
493
|
+
result += alexaOffName;
|
494
|
+
}
|
495
|
+
else {
|
496
|
+
result += ", " + alexaOffName;
|
497
|
+
}
|
498
|
+
});
|
499
|
+
return result;
|
500
|
+
};
|
501
|
+
ShellyDimmer.prototype.getAlexaSmartNamesForOn = function () {
|
502
|
+
return this.alexaSmartNamesForOn;
|
503
|
+
};
|
504
|
+
ShellyDimmer.prototype.getAlexaSmartNamesForOff = function () {
|
505
|
+
return this.alexaSmartNamesForOff;
|
506
|
+
};
|
507
|
+
ShellyDimmer.prototype.getAlexaActionNamesForOn = function () {
|
508
|
+
return this.alexaActionNamesForOn;
|
509
|
+
};
|
510
|
+
ShellyDimmer.prototype.getAlexaActionNamesForOff = function () {
|
511
|
+
return this.alexaActionNamesForOff;
|
512
|
+
};
|
513
|
+
return ShellyDimmer;
|
514
|
+
}(AbstractShelly));
|
515
|
+
exports.ShellyDimmer = ShellyDimmer;
|
516
|
+
var ShellyRGBAlexaScheme = /** @class */ (function () {
|
517
|
+
function ShellyRGBAlexaScheme(alexaName, level) {
|
518
|
+
this.alexaName = alexaName;
|
519
|
+
this.level = level;
|
520
|
+
}
|
521
|
+
ShellyRGBAlexaScheme.prototype.getAlexaName = function () {
|
522
|
+
return this.alexaName;
|
523
|
+
};
|
524
|
+
ShellyRGBAlexaScheme.prototype.getLevel = function () {
|
525
|
+
return this.level;
|
526
|
+
};
|
527
|
+
ShellyRGBAlexaScheme.prototype.setDevice = function (device) {
|
528
|
+
this.device = device;
|
529
|
+
};
|
530
|
+
ShellyRGBAlexaScheme.prototype.getDevice = function () {
|
531
|
+
return this.device;
|
532
|
+
};
|
533
|
+
return ShellyRGBAlexaScheme;
|
534
|
+
}());
|
535
|
+
exports.ShellyRGBAlexaScheme = ShellyRGBAlexaScheme;
|
536
|
+
var ShellyRGBTasterScheme = /** @class */ (function () {
|
537
|
+
function ShellyRGBTasterScheme(tasterBooleanOn, level) {
|
538
|
+
this.tasterBooleanOn = tasterBooleanOn;
|
539
|
+
this.level = level;
|
540
|
+
}
|
541
|
+
ShellyRGBTasterScheme.prototype.getTasterBooleanOnName = function () {
|
542
|
+
return this.tasterBooleanOn;
|
543
|
+
};
|
544
|
+
ShellyRGBTasterScheme.prototype.getLevel = function () {
|
545
|
+
return this.level;
|
546
|
+
};
|
547
|
+
return ShellyRGBTasterScheme;
|
548
|
+
}());
|
549
|
+
exports.ShellyRGBTasterScheme = ShellyRGBTasterScheme;
|
550
|
+
var ShellyLampeRGB = /** @class */ (function (_super) {
|
551
|
+
__extends(ShellyLampeRGB, _super);
|
552
|
+
function ShellyLampeRGB(adapter, id, etage, raum, device, baseState, channel, alexaSmartNamesForOn, alexaActionNamesForOn, alexaLevelSchemeForOn, alexaSmartNamesForOff, alexaActionNamesForOff, levelSchemes, tasterBooleanOn, tasterBooleanOff) {
|
553
|
+
var _this = _super.call(this, adapter, id, etage, raum, device, baseState) || this;
|
554
|
+
_this.channel = channel;
|
555
|
+
_this.alexaSmartNamesForOn = alexaSmartNamesForOn;
|
556
|
+
_this.alexaSmartNamesForOff = alexaSmartNamesForOff;
|
557
|
+
_this.alexaActionNamesForOn = alexaActionNamesForOn;
|
558
|
+
_this.alexaActionNamesForOff = alexaActionNamesForOff;
|
559
|
+
_this.alexaLevelSchemeForOn = alexaLevelSchemeForOn;
|
560
|
+
_this.tasterBooleanOn = tasterBooleanOn;
|
561
|
+
_this.levelSchemes = levelSchemes;
|
562
|
+
_this.tasterBooleanOff = tasterBooleanOff;
|
563
|
+
if (_this.alexaLevelSchemeForOn != null) {
|
564
|
+
_this.alexaLevelSchemeForOn.setDevice(_this);
|
565
|
+
if (alexaLevelSchemeForOn.getAlexaName() != null) {
|
566
|
+
_this.createState(alexaLevelSchemeForOn.getAlexaName());
|
567
|
+
}
|
568
|
+
}
|
569
|
+
_this.tasterBooleanOn.forEach(function (tasterScheme) {
|
570
|
+
if (tasterScheme.getTasterBooleanOnName() != null) {
|
571
|
+
_this.createState(tasterScheme.getTasterBooleanOnName());
|
572
|
+
}
|
573
|
+
});
|
574
|
+
_this.tasterBooleanOff.forEach(function (offName) {
|
575
|
+
_this.createState(offName);
|
576
|
+
});
|
577
|
+
_this.alexaSmartNamesForOn.forEach(function (alexaSmartName) {
|
578
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
579
|
+
});
|
580
|
+
_this.alexaSmartNamesForOff.forEach(function (alexaSmartName) {
|
581
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
582
|
+
});
|
583
|
+
_this.alexaActionNamesForOn.forEach(function (alexaSmartName) {
|
584
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
585
|
+
});
|
586
|
+
_this.alexaActionNamesForOff.forEach(function (alexaSmartName) {
|
587
|
+
_this.createIOTAdapterSmartDevices(alexaSmartName);
|
588
|
+
});
|
589
|
+
return _this;
|
590
|
+
}
|
591
|
+
ShellyLampeRGB.prototype.createState = function (key_in) {
|
592
|
+
var jarvisDatenpunkt = key_in; //.replace(/\./g,'_'); // wegen Wohnzimmer T.V.
|
593
|
+
//log(">>> CREATE STATE: " + jarvisDatenpunkt);
|
594
|
+
this.adapter.createState(jarvisDatenpunkt, false, {
|
595
|
+
name: jarvisDatenpunkt,
|
596
|
+
desc: jarvisDatenpunkt,
|
597
|
+
type: 'boolean',
|
598
|
+
read: true,
|
599
|
+
write: true
|
600
|
+
});
|
601
|
+
};
|
602
|
+
ShellyLampeRGB.prototype.getAlexaLevelSchemeForOn = function () {
|
603
|
+
return this.alexaLevelSchemeForOn;
|
604
|
+
};
|
605
|
+
ShellyLampeRGB.prototype.getAlexaSchemes = function () {
|
606
|
+
return this.levelSchemes;
|
607
|
+
};
|
608
|
+
ShellyLampeRGB.prototype.getTasterBooleanOn = function () {
|
609
|
+
return this.tasterBooleanOn;
|
610
|
+
};
|
611
|
+
ShellyLampeRGB.prototype.getTasterBooleanOff = function () {
|
612
|
+
return this.tasterBooleanOff;
|
613
|
+
};
|
614
|
+
ShellyLampeRGB.prototype.getSwitchState = function () {
|
615
|
+
return this.baseState + ".lights.Switch"; // shelly.0.SHRGBW2#D962D3#1.lights.Switch
|
616
|
+
};
|
617
|
+
ShellyLampeRGB.prototype.isDeviceOn = function () {
|
618
|
+
return this.adapter.getState(this.getSwitchState()).val;
|
619
|
+
};
|
620
|
+
ShellyLampeRGB.prototype.getCategory = function () {
|
621
|
+
return deviceShellyLampeRGB;
|
622
|
+
};
|
623
|
+
ShellyLampeRGB.prototype.getAlexaNamesForOnAsString = function () {
|
624
|
+
var result = "";
|
625
|
+
this.alexaSmartNamesForOn.forEach(function (alexaOnName) {
|
626
|
+
if (result == "") {
|
627
|
+
result += alexaOnName;
|
628
|
+
}
|
629
|
+
else {
|
630
|
+
result += ", " + alexaOnName;
|
631
|
+
}
|
632
|
+
});
|
633
|
+
this.alexaActionNamesForOn.forEach(function (alexaOnName) {
|
634
|
+
if (result == "") {
|
635
|
+
result += alexaOnName;
|
636
|
+
}
|
637
|
+
else {
|
638
|
+
result += ", " + alexaOnName;
|
639
|
+
}
|
640
|
+
});
|
641
|
+
return result;
|
642
|
+
};
|
643
|
+
ShellyLampeRGB.prototype.getAlexaNamesForOffAsString = function () {
|
644
|
+
var result = "";
|
645
|
+
this.alexaSmartNamesForOff.forEach(function (alexaOffName) {
|
646
|
+
if (result == "") {
|
647
|
+
result += alexaOffName;
|
648
|
+
}
|
649
|
+
else {
|
650
|
+
result += ", " + alexaOffName;
|
651
|
+
}
|
652
|
+
});
|
653
|
+
this.alexaActionNamesForOff.forEach(function (alexaOffName) {
|
654
|
+
if (result == "") {
|
655
|
+
result += alexaOffName;
|
656
|
+
}
|
657
|
+
else {
|
658
|
+
result += ", " + alexaOffName;
|
659
|
+
}
|
660
|
+
});
|
661
|
+
return result;
|
662
|
+
};
|
663
|
+
ShellyLampeRGB.prototype.getAlexaSmartNamesForOn = function () {
|
664
|
+
return this.alexaSmartNamesForOn;
|
665
|
+
};
|
666
|
+
ShellyLampeRGB.prototype.getAlexaSmartNamesForOff = function () {
|
667
|
+
return this.alexaSmartNamesForOff;
|
668
|
+
};
|
669
|
+
ShellyLampeRGB.prototype.getAlexaActionNamesForOn = function () {
|
670
|
+
return this.alexaActionNamesForOn;
|
671
|
+
};
|
672
|
+
ShellyLampeRGB.prototype.getAlexaActionNamesForOff = function () {
|
673
|
+
return this.alexaActionNamesForOff;
|
674
|
+
};
|
675
|
+
return ShellyLampeRGB;
|
676
|
+
}(AbstractShelly));
|
677
|
+
exports.ShellyLampeRGB = ShellyLampeRGB;
|
678
|
+
var ShellySteckdose = /** @class */ (function (_super) {
|
679
|
+
__extends(ShellySteckdose, _super);
|
680
|
+
function ShellySteckdose(adapter, id, etage, raum, device, baseState, channel, alexaNamesForOn, alexaActionNamesForOn, alexaNamesForOff, alexaActionNamesForOff, additionalStates4TurnOn, additionalStates4TurnOff, nachtbeleuchtung, turnOffExitHouseSummer, turnOffExitHouseWinter, turnOnEnterHouseSummer, turnOnEnterHouseWinter) {
|
681
|
+
return _super.call(this, adapter, id, etage, raum, device, baseState, channel, alexaNamesForOn, alexaActionNamesForOn, alexaNamesForOff, alexaActionNamesForOff, additionalStates4TurnOn, additionalStates4TurnOff, nachtbeleuchtung, turnOffExitHouseSummer, turnOffExitHouseWinter, turnOnEnterHouseSummer, turnOnEnterHouseWinter) || this;
|
682
|
+
}
|
683
|
+
ShellySteckdose.prototype.getCategory = function () {
|
684
|
+
return deviceShellySteckdose;
|
685
|
+
};
|
686
|
+
return ShellySteckdose;
|
687
|
+
}(ShellyLampeWeiss));
|
688
|
+
var ShellyRollladen = /** @class */ (function (_super) {
|
689
|
+
__extends(ShellyRollladen, _super);
|
690
|
+
function ShellyRollladen(adapter, id, etage, raum, device, baseState) {
|
691
|
+
return _super.call(this, adapter, id, etage, raum, device, baseState) || this;
|
692
|
+
}
|
693
|
+
ShellyRollladen.prototype.getShutterPositionState = function () {
|
694
|
+
if (this.baseState.includes('shellyplus2')) {
|
695
|
+
return this.baseState + ".Cover0.Position"; // new: shelly.1.shellyplus2pm#4855199b3e38#1.Cover0.Position
|
696
|
+
}
|
697
|
+
else {
|
698
|
+
return this.baseState + ".Shutter.Position"; // new: shelly.1.shellyplus2pm#4855199b3e38#1.Cover0.Position
|
699
|
+
}
|
700
|
+
};
|
701
|
+
ShellyRollladen.prototype.getShutterOpenState = function () {
|
702
|
+
if (this.baseState.includes('shellyplus2')) {
|
703
|
+
return this.baseState + ".Cover0.Open"; // new: shelly.1.shellyplus2pm#4855199b3e38#1.Cover0.Position
|
704
|
+
}
|
705
|
+
else {
|
706
|
+
return this.baseState + ".Shutter.Open"; // new: shelly.1.shellyplus2pm#4855199b3e38#1.Cover0.Position
|
707
|
+
}
|
708
|
+
};
|
709
|
+
ShellyRollladen.prototype.getShutterCloseState = function () {
|
710
|
+
if (this.baseState.includes('shellyplus2')) {
|
711
|
+
return this.baseState + ".Cover0.Close"; // new: shelly.1.shellyplus2pm#4855199b3e38#1.Cover0.Position
|
712
|
+
}
|
713
|
+
else {
|
714
|
+
return this.baseState + ".Shutter.Close"; // new: shelly.1.shellyplus2pm#4855199b3e38#1.Cover0.Position
|
715
|
+
}
|
716
|
+
};
|
717
|
+
// Steckdose, Rollladen, Lampe
|
718
|
+
ShellyRollladen.prototype.getCategory = function () {
|
719
|
+
return deviceShellyRollladen;
|
720
|
+
};
|
721
|
+
return ShellyRollladen;
|
722
|
+
}(AbstractShelly));
|
723
|
+
var ShellySensor = /** @class */ (function (_super) {
|
724
|
+
__extends(ShellySensor, _super);
|
725
|
+
function ShellySensor(adapter, id, etage, raum, device, baseState) {
|
726
|
+
return _super.call(this, adapter, id, etage, raum, device, baseState) || this;
|
727
|
+
}
|
728
|
+
ShellySensor.prototype.getTemperature = function () {
|
729
|
+
return this.adapter.getState(this.baseState + ".Temperature0.Celsius").val; // shelly.1.shellyhtg3#34b7da8d0234#1.Temperature0.Celsius
|
730
|
+
};
|
731
|
+
ShellySensor.prototype.getHumidity = function () {
|
732
|
+
return this.adapter.getState(this.baseState + ".Humidity0.Relative").val; // shelly.1.shellyhtg3#34b7da8d0234#1.Humidity0.Relative
|
733
|
+
};
|
734
|
+
ShellySensor.prototype.getCategory = function () {
|
735
|
+
return deviceShellySensor;
|
736
|
+
};
|
737
|
+
return ShellySensor;
|
738
|
+
}(AbstractShelly));
|
739
|
+
module.exports = {
|
740
|
+
ShellyLampeWeiss: ShellyLampeWeiss,
|
741
|
+
ShellyDimmerAlexaScheme: ShellyDimmerAlexaScheme,
|
742
|
+
ShellyDimmerTasterScheme: ShellyDimmerTasterScheme,
|
743
|
+
ShellyDimmer: ShellyDimmer,
|
744
|
+
ShellyRGBAlexaScheme: ShellyRGBAlexaScheme,
|
745
|
+
ShellyRGBTasterScheme: ShellyRGBTasterScheme,
|
746
|
+
ShellyLampeRGB: ShellyLampeRGB,
|
747
|
+
ShellySteckdose: ShellySteckdose,
|
748
|
+
ShellyRollladen: ShellyRollladen,
|
749
|
+
ShellySensor: ShellySensor,
|
750
|
+
deviceShellyLampeWeiss: deviceShellyLampeWeiss,
|
751
|
+
deviceShellyDimmer: deviceShellyDimmer,
|
752
|
+
deviceShellyLampeRGB: deviceShellyLampeRGB,
|
753
|
+
deviceShellySteckdose: deviceShellySteckdose,
|
754
|
+
deviceShellyRollladen: deviceShellyRollladen,
|
755
|
+
deviceShellySensor: deviceShellySensor
|
756
|
+
};
|