hoffmation-base 3.4.8 → 3.4.9
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.
|
@@ -24,6 +24,19 @@ export declare class LightGroup extends BaseGroup implements iLightGroup {
|
|
|
24
24
|
getOutlets(): iActuator[];
|
|
25
25
|
getAllAsActuator(): iActuator[];
|
|
26
26
|
handleSunriseOff(): void;
|
|
27
|
+
/**
|
|
28
|
+
* Whether a switch-off has to be skipped because ambient light owns this actuator.
|
|
29
|
+
*
|
|
30
|
+
* Ambient light has priority: while it is active, automation must not switch a
|
|
31
|
+
* participating actuator off. Only an explicit force action may.
|
|
32
|
+
*
|
|
33
|
+
* Callers pass the command that would switch the actuator off; the caller decides
|
|
34
|
+
* what "off" means, since the time based commands resolve that per device.
|
|
35
|
+
* @param a - The actuator about to be switched
|
|
36
|
+
* @param c - The command that would switch it off
|
|
37
|
+
* @returns Whether the caller has to skip this actuator
|
|
38
|
+
*/
|
|
39
|
+
private isProtectedByAmbientLight;
|
|
27
40
|
switchAll(c: ActuatorSetStateCommand): void;
|
|
28
41
|
switchTimeConditional(c: LightGroupSwitchTimeConditionalCommand): void;
|
|
29
42
|
setAllLampen(c: LampSetLightCommand): void;
|
|
@@ -49,10 +49,28 @@ class LightGroup extends base_group_1.BaseGroup {
|
|
|
49
49
|
this.log(enums_1.LogLevel.Info, `Es ist hell genug --> Schalte Lampen im ${this.roomName} aus`);
|
|
50
50
|
this.switchAll(new command_1.ActuatorSetStateCommand(enums_1.CommandSource.Automatic, false, 'LightGroup handleSunriseOff'));
|
|
51
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Whether a switch-off has to be skipped because ambient light owns this actuator.
|
|
54
|
+
*
|
|
55
|
+
* Ambient light has priority: while it is active, automation must not switch a
|
|
56
|
+
* participating actuator off. Only an explicit force action may.
|
|
57
|
+
*
|
|
58
|
+
* Callers pass the command that would switch the actuator off; the caller decides
|
|
59
|
+
* what "off" means, since the time based commands resolve that per device.
|
|
60
|
+
* @param a - The actuator about to be switched
|
|
61
|
+
* @param c - The command that would switch it off
|
|
62
|
+
* @returns Whether the caller has to skip this actuator
|
|
63
|
+
*/
|
|
64
|
+
isProtectedByAmbientLight(a, c) {
|
|
65
|
+
if (!this._ambientLightOn || !a.settings.includeInAmbientLight || c.isForceAction) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
a.logCommand(c, `Ambient light mode is active --> Skip non force light off command in ${this.roomName}`, enums_1.LogDebugType.None, enums_1.LogLevel.Info);
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
52
71
|
switchAll(c) {
|
|
53
72
|
this.getAllAsActuator().forEach((a) => {
|
|
54
|
-
if (
|
|
55
|
-
a.logCommand(c, `Ambient light mode is active --> Skip non force light off command in ${this.roomName}`, enums_1.LogDebugType.None, enums_1.LogLevel.Info);
|
|
73
|
+
if (!c.on && this.isProtectedByAmbientLight(a, c)) {
|
|
56
74
|
return;
|
|
57
75
|
}
|
|
58
76
|
a.setActuator(c);
|
|
@@ -101,16 +119,28 @@ class LightGroup extends base_group_1.BaseGroup {
|
|
|
101
119
|
}
|
|
102
120
|
setAllLampen(c) {
|
|
103
121
|
this.getLights().forEach((s) => {
|
|
122
|
+
if (!c.on && this.isProtectedByAmbientLight(s, c)) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
104
125
|
s.setLight(c);
|
|
105
126
|
});
|
|
106
127
|
}
|
|
107
128
|
setAllLampenTimeBased(c) {
|
|
108
129
|
this.getLights().forEach((s) => {
|
|
130
|
+
// The lamp resolves this to on or off from its own time settings, so it can turn
|
|
131
|
+
// an ambient lamp off. While ambient light is active a participating lamp is
|
|
132
|
+
// already on, so skipping can only ever drop a redundant on - never a wanted one.
|
|
133
|
+
if (this.isProtectedByAmbientLight(s, c)) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
109
136
|
s.setTimeBased(c);
|
|
110
137
|
});
|
|
111
138
|
}
|
|
112
139
|
setAllOutlets(c) {
|
|
113
140
|
this.getOutlets().forEach((s) => {
|
|
141
|
+
if (!c.on && this.isProtectedByAmbientLight(s, c)) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
114
144
|
s.setActuator(c);
|
|
115
145
|
});
|
|
116
146
|
}
|