hoffmation-base 3.0.0-alpha.12 → 3.0.0-alpha.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.
|
@@ -6,6 +6,7 @@ export declare abstract class BaseCommand {
|
|
|
6
6
|
readonly timestamp: Date;
|
|
7
7
|
abstract _commandType: CommandType;
|
|
8
8
|
constructor(source?: CommandSource | BaseCommand, reason?: string);
|
|
9
|
+
get isAutomaticAction(): boolean;
|
|
9
10
|
get isForceAction(): boolean;
|
|
10
11
|
get isInitial(): boolean;
|
|
11
12
|
get reasonTrace(): string;
|
|
@@ -8,6 +8,12 @@ class BaseCommand {
|
|
|
8
8
|
this.reason = reason;
|
|
9
9
|
this.timestamp = new Date();
|
|
10
10
|
}
|
|
11
|
+
get isAutomaticAction() {
|
|
12
|
+
if (this.source instanceof BaseCommand) {
|
|
13
|
+
return this.source.isAutomaticAction;
|
|
14
|
+
}
|
|
15
|
+
return this.source === commandSource_1.CommandSource.Automatic;
|
|
16
|
+
}
|
|
11
17
|
get isForceAction() {
|
|
12
18
|
if (this.source instanceof BaseCommand) {
|
|
13
19
|
return this.source.isForceAction;
|
|
@@ -19,7 +19,7 @@ class LampUtils {
|
|
|
19
19
|
if ((c.time === models_1.TimeOfDay.Night && device.settings.nightOn) ||
|
|
20
20
|
(c.time === models_1.TimeOfDay.BeforeSunrise && device.settings.dawnOn) ||
|
|
21
21
|
(c.time === models_1.TimeOfDay.AfterSunset && device.settings.duskOn)) {
|
|
22
|
-
device.setLight(new models_1.LampSetLightCommand(c, true, `SetLight due to TimeBased ${c.time}`, c.timeout));
|
|
22
|
+
device.setLight(new models_1.LampSetLightCommand(c, true, `SetLight due to TimeBased ${models_1.TimeOfDay[c.time]}`, c.timeout));
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
static checkUnBlock(device, command) {
|
|
@@ -68,6 +68,10 @@ class LampUtils {
|
|
|
68
68
|
if (LampUtils.checkBlockActive(device, c)) {
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
|
+
if (c.isAutomaticAction) {
|
|
72
|
+
// Preserve the target state for the automatic handler, as
|
|
73
|
+
device.targetAutomaticState = c.on;
|
|
74
|
+
}
|
|
71
75
|
if (LampUtils.checkUnchanged(device, c)) {
|
|
72
76
|
return;
|
|
73
77
|
}
|