hoffmation-base 0.1.41-1 → 0.1.41-13
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/lib/index.d.ts +1 -2
- package/lib/index.js +5 -4
- package/lib/models/deviceSettings/index.d.ts +1 -0
- package/lib/models/deviceSettings/index.js +1 -0
- package/lib/models/deviceSettings/motionSensorSettings.d.ts +9 -0
- package/lib/models/deviceSettings/motionSensorSettings.js +16 -0
- package/lib/models/deviceSettings/shutterSettings.d.ts +6 -0
- package/lib/models/deviceSettings/shutterSettings.js +6 -0
- package/lib/models/rooms/RoomBase.d.ts +7 -17
- package/lib/models/rooms/RoomBase.js +27 -32
- package/lib/models/rooms/RoomSettings/RoomSettings.js +1 -0
- package/lib/models/timeCallback.d.ts +7 -1
- package/lib/models/timeCallback.js +16 -10
- package/lib/server/devices/Heizgruppen.d.ts +1 -1
- package/lib/server/devices/Heizgruppen.js +3 -3
- package/lib/server/devices/IoBrokerBaseDevice.d.ts +11 -12
- package/lib/server/devices/IoBrokerBaseDevice.js +36 -38
- package/lib/server/devices/button.d.ts +1 -1
- package/lib/server/devices/button.js +5 -6
- package/lib/server/devices/device-cluster.d.ts +5 -4
- package/lib/server/devices/device-cluster.js +3 -2
- package/lib/server/devices/device-list.d.ts +4 -4
- package/lib/server/devices/device-list.js +5 -5
- package/lib/server/devices/deviceType.d.ts +1 -0
- package/lib/server/devices/deviceType.js +1 -0
- package/lib/server/devices/deviceUpdater.js +4 -4
- package/lib/server/devices/devices.d.ts +6 -7
- package/lib/server/devices/devices.js +78 -108
- package/lib/server/devices/groups/Fenster.d.ts +6 -6
- package/lib/server/devices/groups/Fenster.js +22 -24
- package/lib/server/devices/groups/fensterGroup.d.ts +2 -1
- package/lib/server/devices/groups/fensterGroup.js +42 -36
- package/lib/server/devices/groups/heatGroup.d.ts +2 -2
- package/lib/server/devices/groups/heatGroup.js +8 -8
- package/lib/server/devices/groups/lampenGroup.d.ts +3 -4
- package/lib/server/devices/groups/lampenGroup.js +12 -12
- package/lib/server/devices/groups/praesenzGroup.d.ts +6 -7
- package/lib/server/devices/groups/praesenzGroup.js +45 -40
- package/lib/server/devices/groups/tasterGroup.d.ts +1 -1
- package/lib/server/devices/groups/tasterGroup.js +3 -3
- package/lib/server/devices/hmIPDevices/hmIpBewegung.d.ts +12 -8
- package/lib/server/devices/hmIPDevices/hmIpBewegung.js +31 -26
- package/lib/server/devices/hmIPDevices/hmIpHeizgruppe.d.ts +8 -8
- package/lib/server/devices/hmIPDevices/hmIpHeizgruppe.js +40 -43
- package/lib/server/devices/hmIPDevices/hmIpLampe.d.ts +1 -2
- package/lib/server/devices/hmIPDevices/hmIpLampe.js +11 -13
- package/lib/server/devices/hmIPDevices/hmIpPraezenz.d.ts +5 -5
- package/lib/server/devices/hmIPDevices/hmIpPraezenz.js +17 -17
- package/lib/server/devices/iBaseDevice.d.ts +11 -0
- package/lib/server/devices/iBaseDevice.js +2 -0
- package/lib/server/devices/iButtonSwitch.d.ts +2 -2
- package/lib/server/devices/iEnergyManager.d.ts +18 -2
- package/lib/server/devices/iEnergyManager.js +28 -0
- package/lib/server/devices/iExcessEnergyConsumer.d.ts +3 -3
- package/lib/server/devices/iHeater.d.ts +3 -3
- package/lib/server/devices/iHumiditySensor.d.ts +2 -2
- package/lib/server/devices/iLamp.d.ts +3 -5
- package/lib/server/devices/iMotionSensor.d.ts +13 -0
- package/lib/server/devices/iMotionSensor.js +2 -0
- package/lib/server/devices/iShutter.d.ts +3 -3
- package/lib/server/devices/iTemperaturSensor.d.ts +2 -2
- package/lib/server/devices/iVibrationSensor.d.ts +9 -0
- package/lib/server/devices/iVibrationSensor.js +2 -0
- package/lib/server/devices/index.d.ts +3 -0
- package/lib/server/devices/index.js +3 -0
- package/lib/server/devices/jsObject/jsObjectEnergyManager.d.ts +36 -24
- package/lib/server/devices/jsObject/jsObjectEnergyManager.js +79 -39
- package/lib/server/devices/zigbee/index.d.ts +1 -0
- package/lib/server/devices/zigbee/index.js +1 -0
- package/lib/server/devices/zigbee/zigbeeAquaraMotion.d.ts +4 -4
- package/lib/server/devices/zigbee/zigbeeAquaraMotion.js +15 -16
- package/lib/server/devices/zigbee/zigbeeAquaraVibra.d.ts +11 -5
- package/lib/server/devices/zigbee/zigbeeAquaraVibra.js +48 -32
- package/lib/server/devices/zigbee/zigbeeIlluDimmer.d.ts +1 -2
- package/lib/server/devices/zigbee/zigbeeIlluDimmer.js +23 -25
- package/lib/server/devices/zigbee/zigbeeIlluLampe.d.ts +2 -2
- package/lib/server/devices/zigbee/zigbeeIlluLampe.js +7 -8
- package/lib/server/devices/zigbee/zigbeeIlluLedRGBCCT.d.ts +1 -2
- package/lib/server/devices/zigbee/zigbeeIlluLedRGBCCT.js +18 -20
- package/lib/server/devices/zigbee/zigbeeIlluShutter.d.ts +0 -2
- package/lib/server/devices/zigbee/zigbeeIlluShutter.js +26 -24
- package/lib/server/devices/zigbee/zigbeeMotionSensor.d.ts +8 -6
- package/lib/server/devices/zigbee/zigbeeMotionSensor.js +22 -21
- package/lib/server/devices/zigbee/zigbeeShutter.d.ts +13 -11
- package/lib/server/devices/zigbee/zigbeeShutter.js +43 -34
- package/lib/server/devices/zigbee/zigbeeUbisysShutter.d.ts +9 -0
- package/lib/server/devices/zigbee/zigbeeUbisysShutter.js +26 -0
- package/lib/server/services/ShutterService.d.ts +1 -2
- package/lib/server/services/ShutterService.js +6 -5
- package/lib/server/services/Telegram/telegram-service.d.ts +1 -1
- package/lib/server/services/Telegram/telegram-service.js +13 -11
- package/lib/server/services/api/api-service.d.ts +5 -5
- package/lib/server/services/api/api-service.js +5 -5
- package/lib/server/services/calendar/m/303/274ll-service.d.ts +4 -4
- package/lib/server/services/calendar/m/303/274ll-service.js +18 -14
- package/lib/server/services/dbo/postgreSqlPersist.d.ts +9 -9
- package/lib/server/services/dbo/postgreSqlPersist.js +13 -13
- package/lib/server/services/room-service/room-service.d.ts +5 -6
- package/lib/server/services/room-service/room-service.js +29 -30
- package/lib/server/services/time-callback-service.d.ts +9 -15
- package/lib/server/services/time-callback-service.js +39 -45
- package/lib/server/services/utils/utils.d.ts +2 -0
- package/lib/server/services/utils/utils.js +6 -10
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -14
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Fenster = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const logLevel_1 = require("../../../models/logLevel");
|
|
8
|
-
const ShutterService_1 = require("../../services/ShutterService");
|
|
4
|
+
const services_1 = require("../../services");
|
|
5
|
+
const models_1 = require("../models");
|
|
6
|
+
const models_2 = require("../../../models");
|
|
9
7
|
const base_group_1 = require("./base-group");
|
|
10
8
|
const group_type_1 = require("./group-type");
|
|
11
9
|
const device_cluster_type_1 = require("../device-cluster-type");
|
|
@@ -35,10 +33,10 @@ class Fenster extends base_group_1.BaseGroup {
|
|
|
35
33
|
return this.deviceCluster.getIoBrokerDevicesByType(device_cluster_type_1.DeviceClusterType.MagnetContact);
|
|
36
34
|
}
|
|
37
35
|
getShutter() {
|
|
38
|
-
return this.deviceCluster.
|
|
36
|
+
return this.deviceCluster.getDevicesByType(device_cluster_type_1.DeviceClusterType.Shutter);
|
|
39
37
|
}
|
|
40
38
|
getVibration() {
|
|
41
|
-
return this.deviceCluster.
|
|
39
|
+
return this.deviceCluster.getDevicesByType(device_cluster_type_1.DeviceClusterType.Vibration);
|
|
42
40
|
}
|
|
43
41
|
griffeInPosition(pPosition) {
|
|
44
42
|
let count = 0;
|
|
@@ -52,39 +50,39 @@ class Fenster extends base_group_1.BaseGroup {
|
|
|
52
50
|
initialize() {
|
|
53
51
|
this.getHandle().forEach((griff) => {
|
|
54
52
|
griff.addKippCallback((kipp) => {
|
|
55
|
-
if (!(kipp && this.griffeInPosition(
|
|
53
|
+
if (!(kipp && this.griffeInPosition(models_1.FensterPosition.offen) === 0)) {
|
|
56
54
|
return;
|
|
57
55
|
}
|
|
58
56
|
this.getVibration().forEach((element) => {
|
|
59
|
-
element.
|
|
57
|
+
element.vibrationBlockedByGriff = true;
|
|
60
58
|
});
|
|
61
|
-
const timeOfDay =
|
|
62
|
-
if (
|
|
63
|
-
|
|
59
|
+
const timeOfDay = services_1.TimeCallbackService.dayType(this.getRoom().settings.rolloOffset);
|
|
60
|
+
if (services_1.TimeCallbackService.darkOutsideOrNight(timeOfDay)) {
|
|
61
|
+
services_1.ShutterService.windowAllMiddle(this);
|
|
64
62
|
}
|
|
65
63
|
else {
|
|
66
|
-
|
|
64
|
+
services_1.ShutterService.windowAllUp(this);
|
|
67
65
|
}
|
|
68
66
|
});
|
|
69
67
|
griff.addOffenCallback((offen) => {
|
|
70
68
|
if (offen) {
|
|
71
69
|
this.getVibration().forEach((element) => {
|
|
72
|
-
element.
|
|
70
|
+
element.vibrationBlockedByGriff = true;
|
|
73
71
|
});
|
|
74
|
-
|
|
72
|
+
services_1.ShutterService.windowAllUp(this);
|
|
75
73
|
return;
|
|
76
74
|
}
|
|
77
75
|
});
|
|
78
76
|
griff.addClosedCallback((geschlossen) => {
|
|
79
77
|
if (geschlossen &&
|
|
80
|
-
this.griffeInPosition(
|
|
81
|
-
this.griffeInPosition(
|
|
78
|
+
this.griffeInPosition(models_1.FensterPosition.offen) === 0 &&
|
|
79
|
+
this.griffeInPosition(models_1.FensterPosition.kipp) === 0) {
|
|
82
80
|
const now = new Date().getTime();
|
|
83
81
|
this.getVibration().forEach((element) => {
|
|
84
|
-
this.log(
|
|
85
|
-
|
|
86
|
-
if (element.
|
|
87
|
-
element.
|
|
82
|
+
this.log(models_2.LogLevel.Debug, `Starte Timeout für Vibrationsdeaktivierung für ${element.info.customName}`);
|
|
83
|
+
services_1.Utils.guardedTimeout(() => {
|
|
84
|
+
if (element.vibrationBlockedByGriffTimeStamp < now) {
|
|
85
|
+
element.vibrationBlockedByGriff = false;
|
|
88
86
|
}
|
|
89
87
|
}, 12000);
|
|
90
88
|
});
|
|
@@ -92,7 +90,7 @@ class Fenster extends base_group_1.BaseGroup {
|
|
|
92
90
|
}
|
|
93
91
|
});
|
|
94
92
|
});
|
|
95
|
-
|
|
93
|
+
services_1.Utils.guardedTimeout(() => {
|
|
96
94
|
this.getShutter().forEach((shutter) => {
|
|
97
95
|
shutter.fenster = this;
|
|
98
96
|
});
|
|
@@ -102,13 +100,13 @@ class Fenster extends base_group_1.BaseGroup {
|
|
|
102
100
|
}, 5, this);
|
|
103
101
|
}
|
|
104
102
|
rolloPositionChange(pValue) {
|
|
105
|
-
this.log(
|
|
103
|
+
this.log(models_2.LogLevel.Debug, `Rollo Position Change in ${this.roomName} to ${pValue}`);
|
|
106
104
|
if (pValue === 0 || pValue === 100) {
|
|
107
105
|
this.getRoom().setLightTimeBased(true);
|
|
108
106
|
}
|
|
109
107
|
}
|
|
110
108
|
restoreDesiredPosition() {
|
|
111
|
-
|
|
109
|
+
services_1.ShutterService.windowAllToPosition(this, this.desiredPosition, false);
|
|
112
110
|
}
|
|
113
111
|
}
|
|
114
112
|
exports.Fenster = Fenster;
|
|
@@ -7,8 +7,9 @@ export declare class FensterGroup extends BaseGroup {
|
|
|
7
7
|
allRolloUp(savePosition?: boolean): void;
|
|
8
8
|
allRolloToLevel(level: number, savePosition?: boolean): void;
|
|
9
9
|
initialize(): void;
|
|
10
|
-
private sunsetDown;
|
|
11
10
|
setRolloByWeatherStatus(): void;
|
|
12
11
|
sunriseUp(initial?: boolean): void;
|
|
13
12
|
restoreRolloPosition(recalc?: boolean): void;
|
|
13
|
+
changeVibrationMotionBlock(block: boolean): void;
|
|
14
|
+
private sunsetDown;
|
|
14
15
|
}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FensterGroup = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const FensterPosition_1 = require("../models/FensterPosition");
|
|
8
|
-
const logLevel_1 = require("../../../models/logLevel");
|
|
9
|
-
const time_callback_service_1 = require("../../services/time-callback-service");
|
|
10
|
-
const ShutterService_1 = require("../../services/ShutterService");
|
|
4
|
+
const models_1 = require("../../../models");
|
|
5
|
+
const services_1 = require("../../services");
|
|
6
|
+
const models_2 = require("../models");
|
|
11
7
|
const base_group_1 = require("./base-group");
|
|
12
8
|
const group_type_1 = require("./group-type");
|
|
13
9
|
class FensterGroup extends base_group_1.BaseGroup {
|
|
@@ -19,7 +15,7 @@ class FensterGroup extends base_group_1.BaseGroup {
|
|
|
19
15
|
this.fenster.forEach((f) => {
|
|
20
16
|
if (savePosition)
|
|
21
17
|
f.desiredPosition = 0;
|
|
22
|
-
|
|
18
|
+
services_1.ShutterService.windowAllDown(f, initial);
|
|
23
19
|
});
|
|
24
20
|
}
|
|
25
21
|
allRolloUp(savePosition = false) {
|
|
@@ -27,7 +23,7 @@ class FensterGroup extends base_group_1.BaseGroup {
|
|
|
27
23
|
if (savePosition) {
|
|
28
24
|
f.desiredPosition = 100;
|
|
29
25
|
}
|
|
30
|
-
|
|
26
|
+
services_1.ShutterService.windowAllUp(f);
|
|
31
27
|
});
|
|
32
28
|
}
|
|
33
29
|
allRolloToLevel(level, savePosition = false) {
|
|
@@ -35,56 +31,48 @@ class FensterGroup extends base_group_1.BaseGroup {
|
|
|
35
31
|
if (savePosition) {
|
|
36
32
|
f.desiredPosition = level;
|
|
37
33
|
}
|
|
38
|
-
|
|
34
|
+
services_1.ShutterService.windowAllToPosition(f, level, false);
|
|
39
35
|
});
|
|
40
36
|
}
|
|
41
37
|
initialize() {
|
|
42
38
|
const room = this.getRoom();
|
|
43
39
|
if (room.settings.sonnenAufgangRollos && room.settings.rolloOffset) {
|
|
44
|
-
this.log(
|
|
45
|
-
room.sonnenAufgangCallback = new
|
|
40
|
+
this.log(models_1.LogLevel.Trace, `Sonnenaufgang TimeCallback für ${this.roomName} hinzufügen`);
|
|
41
|
+
room.sonnenAufgangCallback = new models_1.TimeCallback(`${this.roomName} Sonnenaufgang Rollos`, models_1.TimeCallbackType.Sunrise, () => {
|
|
46
42
|
if (room.skipNextRolloUp) {
|
|
47
43
|
room.skipNextRolloUp = false;
|
|
48
44
|
return;
|
|
49
45
|
}
|
|
50
46
|
this.sunriseUp();
|
|
51
47
|
}, room.settings.rolloOffset.sunrise, undefined, undefined, room.settings.rolloOffset);
|
|
52
|
-
if (!
|
|
48
|
+
if (!services_1.TimeCallbackService.darkOutsideOrNight(services_1.TimeCallbackService.dayType(room.settings.rolloOffset))) {
|
|
53
49
|
this.sunriseUp(true);
|
|
54
50
|
}
|
|
55
|
-
|
|
51
|
+
services_1.TimeCallbackService.addCallback(room.sonnenAufgangCallback);
|
|
56
52
|
}
|
|
57
53
|
if (room.settings.sonnenUntergangRollos && room.settings.rolloOffset) {
|
|
58
|
-
room.sonnenUntergangCallback = new
|
|
54
|
+
room.sonnenUntergangCallback = new models_1.TimeCallback(`${this.roomName} Sonnenuntergang Rollo`, models_1.TimeCallbackType.SunSet, () => {
|
|
59
55
|
this.sunsetDown();
|
|
60
56
|
}, room.settings.rolloOffset.sunset);
|
|
61
|
-
if (
|
|
62
|
-
|
|
57
|
+
if (services_1.TimeCallbackService.darkOutsideOrNight(services_1.TimeCallbackService.dayType(room.settings.rolloOffset))) {
|
|
58
|
+
services_1.Utils.guardedTimeout(() => {
|
|
63
59
|
this.allRolloDown(true, true);
|
|
64
60
|
}, 60000, this);
|
|
65
61
|
}
|
|
66
|
-
|
|
62
|
+
services_1.TimeCallbackService.addCallback(room.sonnenUntergangCallback);
|
|
67
63
|
}
|
|
68
64
|
if (room.settings.rolloHeatReduction) {
|
|
69
|
-
|
|
70
|
-
|
|
65
|
+
services_1.Utils.guardedInterval(this.setRolloByWeatherStatus, 15 * 60 * 1000, this, true);
|
|
66
|
+
services_1.Utils.guardedTimeout(this.setRolloByWeatherStatus, 2 * 60 * 1000, this);
|
|
71
67
|
}
|
|
72
68
|
this.fenster.forEach((f) => {
|
|
73
69
|
f.initialize();
|
|
74
70
|
});
|
|
75
71
|
}
|
|
76
|
-
sunsetDown() {
|
|
77
|
-
var _a, _b;
|
|
78
|
-
this.allRolloToLevel(0, true);
|
|
79
|
-
const room = this.getRoom();
|
|
80
|
-
if (((_a = room.PraesenzGroup) === null || _a === void 0 ? void 0 : _a.anyPresent()) && room.settings.lampOffset) {
|
|
81
|
-
(_b = room.LampenGroup) === null || _b === void 0 ? void 0 : _b.switchTimeConditional(time_callback_service_1.TimeCallbackService.dayType(room.settings.lampOffset));
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
72
|
setRolloByWeatherStatus() {
|
|
85
73
|
const room = this.getRoom();
|
|
86
|
-
const timeOfDay =
|
|
87
|
-
const darkOutside =
|
|
74
|
+
const timeOfDay = services_1.TimeCallbackService.dayType(room.settings.rolloOffset);
|
|
75
|
+
const darkOutside = services_1.TimeCallbackService.darkOutsideOrNight(timeOfDay);
|
|
88
76
|
this.fenster.forEach((f) => {
|
|
89
77
|
var _a, _b, _c, _d;
|
|
90
78
|
if (f.getShutter().length === 0) {
|
|
@@ -96,15 +84,15 @@ class FensterGroup extends base_group_1.BaseGroup {
|
|
|
96
84
|
}
|
|
97
85
|
let desiredPos = f.desiredPosition;
|
|
98
86
|
if (desiredPos > 0) {
|
|
99
|
-
|
|
87
|
+
services_1.WeatherService.weatherRolloPosition(desiredPos, (_b = (_a = room.HeatGroup) === null || _a === void 0 ? void 0 : _a.desiredTemp) !== null && _b !== void 0 ? _b : -99, (_d = (_c = room.HeatGroup) === null || _c === void 0 ? void 0 : _c.currentTemp) !== null && _d !== void 0 ? _d : -99);
|
|
100
88
|
}
|
|
101
|
-
if (f.griffeInPosition(
|
|
89
|
+
if (f.griffeInPosition(models_2.FensterPosition.offen) > 0 && desiredPos < 100) {
|
|
102
90
|
return;
|
|
103
91
|
}
|
|
104
|
-
if (f.griffeInPosition(
|
|
92
|
+
if (f.griffeInPosition(models_2.FensterPosition.kipp) > 0) {
|
|
105
93
|
desiredPos = Math.max(30, desiredPos);
|
|
106
94
|
}
|
|
107
|
-
|
|
95
|
+
services_1.ShutterService.windowAllToPosition(f, desiredPos, false, true);
|
|
108
96
|
});
|
|
109
97
|
}
|
|
110
98
|
sunriseUp(initial = false) {
|
|
@@ -112,7 +100,7 @@ class FensterGroup extends base_group_1.BaseGroup {
|
|
|
112
100
|
if (f.noRolloOnSunrise || f.getShutter().length === 0) {
|
|
113
101
|
return;
|
|
114
102
|
}
|
|
115
|
-
this.log(
|
|
103
|
+
this.log(models_1.LogLevel.Debug, `Fahre das Rollo zum Sonnenaufgang ${initial ? '(ggf. nachträglich)' : ''} hoch`);
|
|
116
104
|
f.setDesiredPosition(100);
|
|
117
105
|
});
|
|
118
106
|
}
|
|
@@ -123,12 +111,30 @@ class FensterGroup extends base_group_1.BaseGroup {
|
|
|
123
111
|
});
|
|
124
112
|
return;
|
|
125
113
|
}
|
|
126
|
-
if (!
|
|
114
|
+
if (!services_1.TimeCallbackService.darkOutsideOrNight(services_1.TimeCallbackService.dayType(this.getRoom().settings.rolloOffset))) {
|
|
127
115
|
this.sunriseUp(true);
|
|
128
116
|
}
|
|
129
117
|
else {
|
|
130
118
|
this.sunsetDown();
|
|
131
119
|
}
|
|
132
120
|
}
|
|
121
|
+
changeVibrationMotionBlock(block) {
|
|
122
|
+
this.fenster.forEach((f) => {
|
|
123
|
+
if (f.getVibration().length === 0) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
f.getVibration().forEach((v) => {
|
|
127
|
+
v.vibrationBlockedByMotion = block;
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
sunsetDown() {
|
|
132
|
+
var _a, _b;
|
|
133
|
+
this.allRolloToLevel(0, true);
|
|
134
|
+
const room = this.getRoom();
|
|
135
|
+
if (((_a = room.PraesenzGroup) === null || _a === void 0 ? void 0 : _a.anyPresent()) && room.settings.lampOffset) {
|
|
136
|
+
(_b = room.LampenGroup) === null || _b === void 0 ? void 0 : _b.switchTimeConditional(services_1.TimeCallbackService.dayType(room.settings.lampOffset));
|
|
137
|
+
}
|
|
138
|
+
}
|
|
133
139
|
}
|
|
134
140
|
exports.FensterGroup = FensterGroup;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { HmIpHeizgruppe } from '../hmIPDevices
|
|
1
|
+
import { HmIpHeizgruppe } from '../hmIPDevices';
|
|
2
2
|
import { BaseGroup } from './base-group';
|
|
3
3
|
import { iTemperaturSensor } from '../iTemperaturSensor';
|
|
4
4
|
import { iHumiditySensor } from '../iHumiditySensor';
|
|
5
5
|
export declare class HeatGroup extends BaseGroup {
|
|
6
|
+
constructor(roomName: string, heaterIds: string[], tempSensorIds: string[], humiditySensorIds: string[]);
|
|
6
7
|
get currentTemp(): number;
|
|
7
8
|
get desiredTemp(): number;
|
|
8
9
|
getHeater(): HmIpHeizgruppe[];
|
|
9
10
|
getTempSensors(): iTemperaturSensor[];
|
|
10
11
|
getHumiditySensors(): iHumiditySensor[];
|
|
11
|
-
constructor(roomName: string, heaterIds: string[], tempSensorIds: string[], humiditySensorIds: string[]);
|
|
12
12
|
}
|
|
@@ -6,6 +6,12 @@ const group_type_1 = require("./group-type");
|
|
|
6
6
|
const device_cluster_type_1 = require("../device-cluster-type");
|
|
7
7
|
const device_list_1 = require("../device-list");
|
|
8
8
|
class HeatGroup extends base_group_1.BaseGroup {
|
|
9
|
+
constructor(roomName, heaterIds, tempSensorIds, humiditySensorIds) {
|
|
10
|
+
super(roomName, group_type_1.GroupType.Heating);
|
|
11
|
+
this.deviceCluster.deviceMap.set(device_cluster_type_1.DeviceClusterType.Heater, new device_list_1.DeviceList(heaterIds));
|
|
12
|
+
this.deviceCluster.deviceMap.set(device_cluster_type_1.DeviceClusterType.TemperaturSensor, new device_list_1.DeviceList(tempSensorIds));
|
|
13
|
+
this.deviceCluster.deviceMap.set(device_cluster_type_1.DeviceClusterType.HumiditySensor, new device_list_1.DeviceList(humiditySensorIds));
|
|
14
|
+
}
|
|
9
15
|
get currentTemp() {
|
|
10
16
|
if (this.getHeater().length === 0) {
|
|
11
17
|
return -99;
|
|
@@ -31,16 +37,10 @@ class HeatGroup extends base_group_1.BaseGroup {
|
|
|
31
37
|
return this.deviceCluster.getIoBrokerDevicesByType(device_cluster_type_1.DeviceClusterType.Heater);
|
|
32
38
|
}
|
|
33
39
|
getTempSensors() {
|
|
34
|
-
return this.deviceCluster.
|
|
40
|
+
return this.deviceCluster.getDevicesByType(device_cluster_type_1.DeviceClusterType.TemperaturSensor);
|
|
35
41
|
}
|
|
36
42
|
getHumiditySensors() {
|
|
37
|
-
return this.deviceCluster.
|
|
38
|
-
}
|
|
39
|
-
constructor(roomName, heaterIds, tempSensorIds, humiditySensorIds) {
|
|
40
|
-
super(roomName, group_type_1.GroupType.Heating);
|
|
41
|
-
this.deviceCluster.deviceMap.set(device_cluster_type_1.DeviceClusterType.Heater, new device_list_1.DeviceList(heaterIds));
|
|
42
|
-
this.deviceCluster.deviceMap.set(device_cluster_type_1.DeviceClusterType.TemperaturSensor, new device_list_1.DeviceList(tempSensorIds));
|
|
43
|
-
this.deviceCluster.deviceMap.set(device_cluster_type_1.DeviceClusterType.HumiditySensor, new device_list_1.DeviceList(humiditySensorIds));
|
|
43
|
+
return this.deviceCluster.getDevicesByType(device_cluster_type_1.DeviceClusterType.HumiditySensor);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
exports.HeatGroup = HeatGroup;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { ZigbeeIkeaSteckdose } from '../zigbee';
|
|
2
|
-
import { TimeOfDay } from '../../services';
|
|
3
|
-
import { ZigbeeIlluLedRGBCCT } from '../zigbee';
|
|
1
|
+
import { ZigbeeIkeaSteckdose, ZigbeeIlluLedRGBCCT } from '../zigbee';
|
|
4
2
|
import { BaseGroup } from './base-group';
|
|
5
3
|
import { iLamp } from '../iLamp';
|
|
4
|
+
import { TimeOfDay } from '../../../models';
|
|
6
5
|
export declare class LampenGroup extends BaseGroup {
|
|
7
6
|
constructor(roomName: string, lampenIds?: string[], steckerIds?: string[], ledIds?: string[]);
|
|
8
7
|
anyLightsOwn(): boolean;
|
|
@@ -11,7 +10,7 @@ export declare class LampenGroup extends BaseGroup {
|
|
|
11
10
|
getStecker(): ZigbeeIkeaSteckdose[];
|
|
12
11
|
switchAll(target: boolean, force?: boolean): void;
|
|
13
12
|
switchTimeConditional(time: TimeOfDay): void;
|
|
14
|
-
setAllLampen(pValue: boolean, time?: TimeOfDay, force?: boolean): void;
|
|
13
|
+
setAllLampen(pValue: boolean, time?: TimeOfDay, force?: boolean, timeout?: number): void;
|
|
15
14
|
setAllStecker(pValue: boolean, time?: TimeOfDay, force?: boolean): void;
|
|
16
15
|
setAllLED(pValue: boolean, brightness?: number, color?: string, colortemp?: number): void;
|
|
17
16
|
}
|
|
@@ -34,7 +34,7 @@ class LampenGroup extends base_group_1.BaseGroup {
|
|
|
34
34
|
return false;
|
|
35
35
|
}
|
|
36
36
|
getLampen() {
|
|
37
|
-
return this.deviceCluster.
|
|
37
|
+
return this.deviceCluster.getDevicesByType(device_cluster_type_1.DeviceClusterType.Lamps);
|
|
38
38
|
}
|
|
39
39
|
getLED() {
|
|
40
40
|
return this.deviceCluster.getIoBrokerDevicesByType(device_cluster_type_1.DeviceClusterType.LED);
|
|
@@ -54,30 +54,30 @@ class LampenGroup extends base_group_1.BaseGroup {
|
|
|
54
54
|
let resultLampen = false;
|
|
55
55
|
let resultSteckdosen = false;
|
|
56
56
|
if (this.getLED().length > 0) {
|
|
57
|
-
this.log(models_1.LogLevel.Trace, `Set LEDs time based for time "${
|
|
57
|
+
this.log(models_1.LogLevel.Trace, `Set LEDs time based for time "${models_1.TimeOfDay[time]}"`);
|
|
58
58
|
this.getLED().forEach((s) => {
|
|
59
59
|
s.setTimeBased(time);
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
else if (this.getStecker().length > 0) {
|
|
63
|
-
this.log(models_1.LogLevel.Trace, `Set outlets time based for time "${
|
|
63
|
+
this.log(models_1.LogLevel.Trace, `Set outlets time based for time "${models_1.TimeOfDay[time]}"`);
|
|
64
64
|
resultSteckdosen = darkOutside;
|
|
65
65
|
}
|
|
66
66
|
else {
|
|
67
|
-
this.log(models_1.LogLevel.Trace, `Set Lamps time based for time "${
|
|
67
|
+
this.log(models_1.LogLevel.Trace, `Set Lamps time based for time "${models_1.TimeOfDay[time]}"`);
|
|
68
68
|
resultLampen = darkOutside;
|
|
69
69
|
}
|
|
70
70
|
this.setAllLampen(resultLampen, time);
|
|
71
71
|
this.setAllStecker(resultSteckdosen, time);
|
|
72
72
|
}
|
|
73
|
-
setAllLampen(pValue, time, force = false) {
|
|
73
|
+
setAllLampen(pValue, time, force = false, timeout) {
|
|
74
74
|
this.getLampen().forEach((s) => {
|
|
75
75
|
if (!pValue ||
|
|
76
76
|
time === undefined ||
|
|
77
|
-
(time ===
|
|
78
|
-
(time ===
|
|
79
|
-
(time ===
|
|
80
|
-
|
|
77
|
+
(time === models_1.TimeOfDay.Night && s.settings.nightOn) ||
|
|
78
|
+
(time === models_1.TimeOfDay.BeforeSunrise && s.settings.dawnOn) ||
|
|
79
|
+
(time === models_1.TimeOfDay.AfterSunset && s.settings.duskOn)) {
|
|
80
|
+
timeout !== null && timeout !== void 0 ? timeout : (timeout = pValue && force ? 30 * 60 * 1000 : -1);
|
|
81
81
|
if (pValue && time !== undefined) {
|
|
82
82
|
s.setTimeBased(time, timeout, force);
|
|
83
83
|
}
|
|
@@ -91,9 +91,9 @@ class LampenGroup extends base_group_1.BaseGroup {
|
|
|
91
91
|
this.getStecker().forEach((s) => {
|
|
92
92
|
if (!pValue ||
|
|
93
93
|
time === undefined ||
|
|
94
|
-
(time ===
|
|
95
|
-
(time ===
|
|
96
|
-
(time ===
|
|
94
|
+
(time === models_1.TimeOfDay.Night && s.settings.nightOn) ||
|
|
95
|
+
(time === models_1.TimeOfDay.BeforeSunrise && s.settings.dawnOn) ||
|
|
96
|
+
(time === models_1.TimeOfDay.AfterSunset && s.settings.duskOn)) {
|
|
97
97
|
const timeout = pValue && force ? 30 * 60 * 1000 : -1;
|
|
98
98
|
s.setStecker(pValue, timeout, force);
|
|
99
99
|
}
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import { HmIpPraezenz } from '../hmIPDevices
|
|
2
|
-
import { HmIpBewegung } from '../hmIPDevices/hmIpBewegung';
|
|
1
|
+
import { HmIpPraezenz } from '../hmIPDevices';
|
|
3
2
|
import { BaseGroup } from './base-group';
|
|
4
|
-
import {
|
|
3
|
+
import { iMotionSensor } from '../iMotionSensor';
|
|
5
4
|
export declare class PraesenzGroup extends BaseGroup {
|
|
6
5
|
private _lastMovement;
|
|
7
6
|
private _lastLeftTimeout;
|
|
8
|
-
getMotionDetector(): Array<HmIpBewegung | ZigbeeMotionSensor>;
|
|
9
|
-
getPresenceSensors(): HmIpPraezenz[];
|
|
10
7
|
constructor(roomName: string, presenceDetectorIds: string[], motionSensorIds: string[]);
|
|
8
|
+
getMotionDetector(): Array<iMotionSensor>;
|
|
9
|
+
getPresenceSensors(): HmIpPraezenz[];
|
|
11
10
|
initCallbacks(): void;
|
|
12
11
|
presentAmount(): number;
|
|
13
12
|
anyPresent(): boolean;
|
|
14
13
|
lastLeftCB(val: boolean, cb: () => void): void;
|
|
14
|
+
addLastLeftCallback(cb: () => void): void;
|
|
15
|
+
addFirstEnterCallback(cb: () => void): void;
|
|
15
16
|
/**
|
|
16
17
|
* In case of an existing delayed last left callback timeout, this removes it.
|
|
17
18
|
* @private
|
|
18
19
|
*/
|
|
19
20
|
private resetLastLeftTimeout;
|
|
20
|
-
addLastLeftCallback(cb: () => void): void;
|
|
21
21
|
private firstEnterCallback;
|
|
22
|
-
addFirstEnterCallback(cb: () => void): void;
|
|
23
22
|
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PraesenzGroup = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const logLevel_1 = require("../../../models/logLevel");
|
|
7
|
-
const time_callback_service_1 = require("../../services/time-callback-service");
|
|
8
|
-
const room_service_1 = require("../../services/room-service/room-service");
|
|
4
|
+
const models_1 = require("../../../models");
|
|
5
|
+
const services_1 = require("../../services");
|
|
9
6
|
const base_group_1 = require("./base-group");
|
|
10
7
|
const device_cluster_type_1 = require("../device-cluster-type");
|
|
11
8
|
const group_type_1 = require("./group-type");
|
|
@@ -30,31 +27,35 @@ class PraesenzGroup extends base_group_1.BaseGroup {
|
|
|
30
27
|
if (!val) {
|
|
31
28
|
return;
|
|
32
29
|
}
|
|
33
|
-
if (
|
|
34
|
-
|
|
30
|
+
if (services_1.RoomService.awayModeActive || (services_1.RoomService.nightAlarmActive && !p.excludeFromNightAlarm)) {
|
|
31
|
+
services_1.RoomService.startIntrusionAlarm(this.getRoom(), p);
|
|
35
32
|
}
|
|
36
|
-
|
|
33
|
+
services_1.RoomService.movementHistory.add(`${services_1.Utils.nowString()}: Raum "${this.roomName}" Gerät "${p.info.fullName}"`);
|
|
37
34
|
});
|
|
38
35
|
});
|
|
39
36
|
this.getMotionDetector().forEach((b) => {
|
|
40
37
|
b.addMovementCallback((val) => {
|
|
38
|
+
var _a;
|
|
41
39
|
if (!val) {
|
|
42
40
|
return;
|
|
43
41
|
}
|
|
44
|
-
if (
|
|
45
|
-
|
|
42
|
+
if (services_1.RoomService.awayModeActive || (services_1.RoomService.nightAlarmActive && !b.settings.excludeFromNightAlarm)) {
|
|
43
|
+
services_1.RoomService.startIntrusionAlarm(this.getRoom(), b);
|
|
44
|
+
}
|
|
45
|
+
if (!b.settings.seesWindow) {
|
|
46
|
+
(_a = this.getRoom().FensterGroup) === null || _a === void 0 ? void 0 : _a.changeVibrationMotionBlock(true);
|
|
46
47
|
}
|
|
47
|
-
|
|
48
|
+
services_1.RoomService.movementHistory.add(`${services_1.Utils.nowString()}: Raum "${this.roomName}" Gerät "${b.info.fullName}"`);
|
|
48
49
|
});
|
|
49
50
|
});
|
|
50
51
|
if (this.getRoom().settings.lichtSonnenAufgangAus && this.getRoom().settings.lampOffset) {
|
|
51
|
-
const cb = new
|
|
52
|
+
const cb = new models_1.TimeCallback(`${this.roomName} Morgens Lampe aus`, models_1.TimeCallbackType.Sunrise, () => {
|
|
52
53
|
var _a;
|
|
53
|
-
this.log(
|
|
54
|
+
this.log(models_1.LogLevel.Info, `Es ist hell genug --> Schalte Lampen im ${this.roomName} aus`);
|
|
54
55
|
(_a = this.getRoom().LampenGroup) === null || _a === void 0 ? void 0 : _a.switchAll(false);
|
|
55
56
|
}, this.getRoom().settings.lampOffset.sunrise);
|
|
56
57
|
this.getRoom().sonnenAufgangLichtCallback = cb;
|
|
57
|
-
|
|
58
|
+
services_1.TimeCallbackService.addCallback(cb);
|
|
58
59
|
}
|
|
59
60
|
this.addLastLeftCallback(() => {
|
|
60
61
|
var _a;
|
|
@@ -62,7 +63,7 @@ class PraesenzGroup extends base_group_1.BaseGroup {
|
|
|
62
63
|
});
|
|
63
64
|
if (this.getRoom().settings.lampenBeiBewegung) {
|
|
64
65
|
this.addFirstEnterCallback(() => {
|
|
65
|
-
this.log(
|
|
66
|
+
this.log(models_1.LogLevel.DeepTrace, `Bewegung im Raum ${this.roomName} festgestellt --> Licht einschalten`);
|
|
66
67
|
this.getRoom().setLightTimeBased();
|
|
67
68
|
});
|
|
68
69
|
}
|
|
@@ -95,36 +96,31 @@ class PraesenzGroup extends base_group_1.BaseGroup {
|
|
|
95
96
|
return false;
|
|
96
97
|
}
|
|
97
98
|
lastLeftCB(val, cb) {
|
|
99
|
+
var _a;
|
|
98
100
|
if (val || this.anyPresent()) {
|
|
99
101
|
this.resetLastLeftTimeout();
|
|
100
102
|
return;
|
|
101
103
|
}
|
|
102
|
-
let timeAfterReset =
|
|
104
|
+
let timeAfterReset = services_1.Utils.nowMS() - this._lastMovement.getTime() - this.getRoom().settings.movementResetTimer * 1000;
|
|
103
105
|
if (timeAfterReset > 0) {
|
|
104
|
-
this.log(
|
|
106
|
+
this.log(models_1.LogLevel.Debug, `Movement reset. Active Motions: ${this.presentAmount()}\tTime after Last Movement including Reset: ${timeAfterReset}`);
|
|
107
|
+
(_a = this.getRoom().FensterGroup) === null || _a === void 0 ? void 0 : _a.changeVibrationMotionBlock(false);
|
|
105
108
|
cb();
|
|
106
109
|
return;
|
|
107
110
|
}
|
|
108
|
-
this.log(
|
|
111
|
+
this.log(models_1.LogLevel.Debug, `Movement reset in ${this.roomName} delayed.`);
|
|
109
112
|
this.resetLastLeftTimeout();
|
|
110
|
-
this._lastLeftTimeout =
|
|
113
|
+
this._lastLeftTimeout = services_1.Utils.guardedTimeout(() => {
|
|
114
|
+
var _a;
|
|
111
115
|
timeAfterReset =
|
|
112
|
-
|
|
113
|
-
this.log(
|
|
116
|
+
services_1.Utils.nowMS() - this._lastMovement.getTime() - this.getRoom().settings.movementResetTimer * 1000;
|
|
117
|
+
this.log(models_1.LogLevel.Debug, `Delayed Movement reset. Active Motions: ${this.presentAmount()}\tTime after Last Movement including Reset: ${timeAfterReset}`);
|
|
114
118
|
if (!this.anyPresent() && timeAfterReset > 0) {
|
|
119
|
+
(_a = this.getRoom().FensterGroup) === null || _a === void 0 ? void 0 : _a.changeVibrationMotionBlock(false);
|
|
115
120
|
cb();
|
|
116
121
|
}
|
|
117
122
|
}, Math.abs(timeAfterReset) + 500, this);
|
|
118
123
|
}
|
|
119
|
-
/**
|
|
120
|
-
* In case of an existing delayed last left callback timeout, this removes it.
|
|
121
|
-
* @private
|
|
122
|
-
*/
|
|
123
|
-
resetLastLeftTimeout() {
|
|
124
|
-
if (this._lastLeftTimeout !== null) {
|
|
125
|
-
clearTimeout(this._lastLeftTimeout);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
124
|
addLastLeftCallback(cb) {
|
|
129
125
|
this.getPresenceSensors().forEach((p) => {
|
|
130
126
|
p.addPresenceCallback((val) => {
|
|
@@ -137,16 +133,6 @@ class PraesenzGroup extends base_group_1.BaseGroup {
|
|
|
137
133
|
});
|
|
138
134
|
});
|
|
139
135
|
}
|
|
140
|
-
firstEnterCallback(val, cb) {
|
|
141
|
-
if (!val) {
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
this._lastMovement = new Date();
|
|
145
|
-
if (this.presentAmount() > 1) {
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
cb();
|
|
149
|
-
}
|
|
150
136
|
addFirstEnterCallback(cb) {
|
|
151
137
|
this.getPresenceSensors().forEach((p) => {
|
|
152
138
|
p.addPresenceCallback((val) => {
|
|
@@ -159,5 +145,24 @@ class PraesenzGroup extends base_group_1.BaseGroup {
|
|
|
159
145
|
});
|
|
160
146
|
});
|
|
161
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* In case of an existing delayed last left callback timeout, this removes it.
|
|
150
|
+
* @private
|
|
151
|
+
*/
|
|
152
|
+
resetLastLeftTimeout() {
|
|
153
|
+
if (this._lastLeftTimeout !== null) {
|
|
154
|
+
clearTimeout(this._lastLeftTimeout);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
firstEnterCallback(val, cb) {
|
|
158
|
+
if (!val) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
this._lastMovement = new Date();
|
|
162
|
+
if (this.presentAmount() > 1) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
cb();
|
|
166
|
+
}
|
|
162
167
|
}
|
|
163
168
|
exports.PraesenzGroup = PraesenzGroup;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseGroup } from './base-group';
|
|
2
2
|
import { iButtonSwitch } from '../iButtonSwitch';
|
|
3
3
|
export declare class TasterGroup extends BaseGroup {
|
|
4
|
-
getButtons(): iButtonSwitch[];
|
|
5
4
|
constructor(roomName: string, buttonIds: string[]);
|
|
5
|
+
getButtons(): iButtonSwitch[];
|
|
6
6
|
initCallbacks(): void;
|
|
7
7
|
}
|
|
@@ -7,13 +7,13 @@ const group_type_1 = require("./group-type");
|
|
|
7
7
|
const device_list_1 = require("../device-list");
|
|
8
8
|
const button_1 = require("../button");
|
|
9
9
|
class TasterGroup extends base_group_1.BaseGroup {
|
|
10
|
-
getButtons() {
|
|
11
|
-
return this.deviceCluster.getIoBrokerDevicesByType(device_cluster_type_1.DeviceClusterType.Buttons);
|
|
12
|
-
}
|
|
13
10
|
constructor(roomName, buttonIds) {
|
|
14
11
|
super(roomName, group_type_1.GroupType.Buttons);
|
|
15
12
|
this.deviceCluster.deviceMap.set(device_cluster_type_1.DeviceClusterType.Buttons, new device_list_1.DeviceList(buttonIds));
|
|
16
13
|
}
|
|
14
|
+
getButtons() {
|
|
15
|
+
return this.deviceCluster.getDevicesByType(device_cluster_type_1.DeviceClusterType.Buttons);
|
|
16
|
+
}
|
|
17
17
|
initCallbacks() {
|
|
18
18
|
this.getButtons().forEach((t) => {
|
|
19
19
|
var _a, _b, _c, _d, _e, _f, _g;
|