hoffmation-base 3.6.0 → 3.6.1
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.
|
@@ -11,6 +11,10 @@ export interface iBlockAutomaticHandler {
|
|
|
11
11
|
*
|
|
12
12
|
*/
|
|
13
13
|
readonly automaticBlockActive: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Whether the active block was set by a person (Manual, API or Force) rather than by a rule.
|
|
16
|
+
*/
|
|
17
|
+
readonly automaticBlockedByUser: boolean;
|
|
14
18
|
/**
|
|
15
19
|
*
|
|
16
20
|
*/
|
|
@@ -340,6 +340,17 @@ class AcDevice extends devices_1.RoomBaseDevice {
|
|
|
340
340
|
if (!this.settings.noCoolingOnMovement || !this.on || this.mode === enums_1.AcMode.Heating) {
|
|
341
341
|
return;
|
|
342
342
|
}
|
|
343
|
+
// Somebody asked for this unit to run and pinned it - a configured rule does not overrule that.
|
|
344
|
+
// This is the case the report was about: switching the AC on from the phone pins it for an hour,
|
|
345
|
+
// the next movement a minute later switched it off anyway, and the pin then kept the automatic
|
|
346
|
+
// from ever switching it back on. The unit stayed off for the full hour.
|
|
347
|
+
//
|
|
348
|
+
// Only a person's pin counts. The block this path sets itself is an automatic one, so a later
|
|
349
|
+
// movement can still renew it.
|
|
350
|
+
if (this.blockAutomationHandler.automaticBlockedByUser) {
|
|
351
|
+
this.log(enums_1.LogLevel.Debug, 'Movement detected, but the AC was pinned by hand - leaving it alone.');
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
343
354
|
this.setAcState(new command_1.AcSetStateCommand(action, enums_1.AcMode.Off, undefined, 'Something moved in the room and noCoolingOnMovement is set.', this.buildMovementBlock(action)));
|
|
344
355
|
}
|
|
345
356
|
/**
|
|
@@ -9,11 +9,22 @@ export declare class BlockAutomaticHandler implements iBlockAutomaticHandler {
|
|
|
9
9
|
private readonly _logger;
|
|
10
10
|
private readonly _restoreAutomatic;
|
|
11
11
|
private _automaticBlockedUntil;
|
|
12
|
+
private _blockSetByUser;
|
|
12
13
|
private _restoreAutomaticStateTimeout;
|
|
13
14
|
constructor(restoreAutomaticCb: (c: RestoreTargetAutomaticValueCommand) => void, _logger: (level: LogLevel, message: string, logDebugType?: LogDebugType) => void);
|
|
14
15
|
get automaticBlockedUntil(): Date;
|
|
15
16
|
private set automaticBlockedUntil(value);
|
|
16
17
|
get automaticBlockActive(): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Whether the active block was set by a person rather than by another rule.
|
|
20
|
+
*
|
|
21
|
+
* The expiry date alone cannot answer that, and a rule that has to decide whether it may overrule
|
|
22
|
+
* the current state needs to: at the end of the day the user's choice outranks a configured
|
|
23
|
+
* automatism. Manual, API and Force all count - they are the same decision reaching the house
|
|
24
|
+
* through different doors.
|
|
25
|
+
* @returns True while a block set by a person is still running.
|
|
26
|
+
*/
|
|
27
|
+
get automaticBlockedByUser(): boolean;
|
|
17
28
|
disableAutomatic(c: BlockAutomaticCommand): void;
|
|
18
29
|
disableAutomaticUntil(c: BlockAutomaticUntilCommand): void;
|
|
19
30
|
liftAutomaticBlock(c: BlockAutomaticLiftBlockCommand): void;
|
|
@@ -16,6 +16,7 @@ class BlockAutomaticHandler {
|
|
|
16
16
|
constructor(restoreAutomaticCb, _logger) {
|
|
17
17
|
this._logger = _logger;
|
|
18
18
|
this._automaticBlockedUntil = new Date(0);
|
|
19
|
+
this._blockSetByUser = false;
|
|
19
20
|
this._restoreAutomaticStateTimeout = null;
|
|
20
21
|
this._restoreAutomatic = restoreAutomaticCb;
|
|
21
22
|
}
|
|
@@ -28,6 +29,18 @@ class BlockAutomaticHandler {
|
|
|
28
29
|
get automaticBlockActive() {
|
|
29
30
|
return this._automaticBlockedUntil > new Date();
|
|
30
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Whether the active block was set by a person rather than by another rule.
|
|
34
|
+
*
|
|
35
|
+
* The expiry date alone cannot answer that, and a rule that has to decide whether it may overrule
|
|
36
|
+
* the current state needs to: at the end of the day the user's choice outranks a configured
|
|
37
|
+
* automatism. Manual, API and Force all count - they are the same decision reaching the house
|
|
38
|
+
* through different doors.
|
|
39
|
+
* @returns True while a block set by a person is still running.
|
|
40
|
+
*/
|
|
41
|
+
get automaticBlockedByUser() {
|
|
42
|
+
return this.automaticBlockActive && this._blockSetByUser;
|
|
43
|
+
}
|
|
31
44
|
disableAutomatic(c) {
|
|
32
45
|
this.disableAutomaticUntil(new command_1.BlockAutomaticUntilCommand(c, new Date(utils_1.Utils.nowMS() + c.durationMS), '', c.onCollideAction, c.revertToAutomaticAtBlockLift));
|
|
33
46
|
}
|
|
@@ -41,6 +54,9 @@ class BlockAutomaticHandler {
|
|
|
41
54
|
}
|
|
42
55
|
this._logger(enums_1.LogLevel.Info, c.logMessage);
|
|
43
56
|
this.automaticBlockedUntil = c.targetDate;
|
|
57
|
+
// Recorded here rather than derived later: the command is gone once this returns, and the level
|
|
58
|
+
// that pinned the device is exactly what a rule needs to know before overruling it.
|
|
59
|
+
this._blockSetByUser = c.isForceAction;
|
|
44
60
|
if (c.revertToAutomaticAtBlockLift) {
|
|
45
61
|
const revertCommand = new command_1.RestoreTargetAutomaticValueCommand(c, 'Restore to automatic state after block.');
|
|
46
62
|
revertCommand.overrideCommandSource = enums_1.CommandSource.Automatic;
|
|
@@ -53,6 +69,7 @@ class BlockAutomaticHandler {
|
|
|
53
69
|
liftAutomaticBlock(c) {
|
|
54
70
|
this.removeRestoreTimeout();
|
|
55
71
|
this.automaticBlockedUntil = new Date(0);
|
|
72
|
+
this._blockSetByUser = false;
|
|
56
73
|
if (c.revertToAutomatic) {
|
|
57
74
|
this._restoreAutomatic(new command_1.RestoreTargetAutomaticValueCommand(c));
|
|
58
75
|
}
|