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