hoffmation-base 3.0.0-alpha.36 → 3.0.0-alpha.38
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/models/command/blockAutomaticUntilCommand.d.ts +1 -0
- package/lib/models/command/blockAutomaticUntilCommand.js +3 -0
- package/lib/server/devices/dachs/dachs.js +1 -1
- package/lib/server/devices/hmIPDevices/hmIpLampe.js +1 -1
- package/lib/server/devices/sharedFunctions/lampUtils.js +4 -0
- package/lib/server/devices/wledDevice.d.ts +0 -2
- package/lib/server/devices/wledDevice.js +1 -5
- package/lib/server/devices/zigbee/BaseDevices/ZigbeeActuator.js +1 -1
- package/lib/server/devices/zigbee/BaseDevices/zigbeeDimmer.d.ts +2 -2
- package/lib/server/devices/zigbee/BaseDevices/zigbeeDimmer.js +0 -2
- package/lib/server/devices/zigbee/BaseDevices/zigbeeLamp.d.ts +0 -2
- package/lib/server/devices/zigbee/BaseDevices/zigbeeLamp.js +0 -4
- package/lib/server/devices/zigbee/zigbeeIlluLampe.d.ts +0 -1
- package/lib/server/devices/zigbee/zigbeeIlluLampe.js +1 -2
- package/lib/server/devices/zigbee/zigbeeUbisysLampe.d.ts +0 -1
- package/lib/server/devices/zigbee/zigbeeUbisysLampe.js +0 -1
- package/lib/server/services/ac/ac-device.js +1 -1
- package/lib/server/services/blockAutomaticHandler.d.ts +4 -2
- package/lib/server/services/blockAutomaticHandler.js +5 -2
- package/lib/server/services/govee/own-govee-device.d.ts +1 -2
- package/lib/server/services/govee/own-govee-device.js +5 -8
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -23,4 +23,5 @@ export declare class BlockAutomaticUntilCommand extends BaseCommand {
|
|
|
23
23
|
* @param revertToAutomaticAtBlockLift - Whether the device should revert to automatic afterward. --> Default: {@link SettingsService.settings.blockAutomaticHandlerDefaults.revertToAutomaticAtBlockLift}
|
|
24
24
|
*/
|
|
25
25
|
constructor(source: CommandSource | BaseCommand, targetDate: Date, reason?: string, onCollideAction?: CollisionSolving, revertToAutomaticAtBlockLift?: boolean);
|
|
26
|
+
get logMessage(): string;
|
|
26
27
|
}
|
|
@@ -25,5 +25,8 @@ class BlockAutomaticUntilCommand extends baseCommand_1.BaseCommand {
|
|
|
25
25
|
this.revertToAutomaticAtBlockLift =
|
|
26
26
|
(_f = revertToAutomaticAtBlockLift !== null && revertToAutomaticAtBlockLift !== void 0 ? revertToAutomaticAtBlockLift : (_e = (_d = server_1.SettingsService.settings) === null || _d === void 0 ? void 0 : _d.blockAutomaticHandlerDefaults) === null || _e === void 0 ? void 0 : _e.revertToAutomaticAtBlockLift) !== null && _f !== void 0 ? _f : true;
|
|
27
27
|
}
|
|
28
|
+
get logMessage() {
|
|
29
|
+
return `Block automatic until ${this.targetDate.toISOString()}, reason: ${this.reasonTrace}`;
|
|
30
|
+
}
|
|
28
31
|
}
|
|
29
32
|
exports.BlockAutomaticUntilCommand = BlockAutomaticUntilCommand;
|
|
@@ -57,7 +57,7 @@ class Dachs {
|
|
|
57
57
|
this.warmWaterSensor = new dachsTemperatureSensor_1.DachsTemperatureSensor(this.config.roomName, 'ww', 'Water Temperature');
|
|
58
58
|
this.heatStorageTempSensor = new dachsTemperatureSensor_1.DachsTemperatureSensor(this.config.roomName, 'hs', 'Heat Storage Temperature');
|
|
59
59
|
services_1.Utils.guardedInterval(this.loadData, this.config.refreshInterval, this);
|
|
60
|
-
this.blockAutomationHandler = new blockAutomaticHandler_1.BlockAutomaticHandler(this.restoreTargetAutomaticValue.bind(this));
|
|
60
|
+
this.blockAutomationHandler = new blockAutomaticHandler_1.BlockAutomaticHandler(this.restoreTargetAutomaticValue.bind(this), this.log.bind(this));
|
|
61
61
|
}
|
|
62
62
|
/** @inheritDoc */
|
|
63
63
|
get info() {
|
|
@@ -23,7 +23,7 @@ class HmIpLampe extends hmIpDevice_1.HmIPDevice {
|
|
|
23
23
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.lamp);
|
|
24
24
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.blockAutomatic);
|
|
25
25
|
this.lightOnSwitchID = `${this.info.fullID}.2.STATE`;
|
|
26
|
-
this.blockAutomationHandler = new blockAutomaticHandler_1.BlockAutomaticHandler(this.restoreTargetAutomaticValue.bind(this));
|
|
26
|
+
this.blockAutomationHandler = new blockAutomaticHandler_1.BlockAutomaticHandler(this.restoreTargetAutomaticValue.bind(this), this.log.bind(this));
|
|
27
27
|
}
|
|
28
28
|
get actuatorOn() {
|
|
29
29
|
return this._actuatorOn;
|
|
@@ -29,6 +29,10 @@ class LampUtils {
|
|
|
29
29
|
}
|
|
30
30
|
static checkUnBlock(device, command) {
|
|
31
31
|
let dontBlock = false;
|
|
32
|
+
if (command.containsType(models_1.CommandType.ActuatorRestoreTargetAutomaticValueCommand)) {
|
|
33
|
+
// We are restoring the automatic value, so we don't want to block the device
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
32
36
|
if (command.isForceAction &&
|
|
33
37
|
device.settings.resetToAutomaticOnForceOffAfterForceOn &&
|
|
34
38
|
!command.on &&
|
|
@@ -23,8 +23,6 @@ export declare class WledDevice extends IoBrokerBaseDevice implements iDimmableL
|
|
|
23
23
|
/** @inheritDoc */
|
|
24
24
|
get actuatorOn(): boolean;
|
|
25
25
|
/** @inheritDoc */
|
|
26
|
-
get lightOn(): boolean;
|
|
27
|
-
/** @inheritDoc */
|
|
28
26
|
restoreTargetAutomaticValue(c: RestoreTargetAutomaticValueCommand): void;
|
|
29
27
|
update(idSplit: string[], state: ioBroker.State, initial?: boolean, _pOverride?: boolean): void;
|
|
30
28
|
/** @inheritDoc */
|
|
@@ -24,7 +24,7 @@ class WledDevice extends IoBrokerBaseDevice_1.IoBrokerBaseDevice {
|
|
|
24
24
|
this._onID = `${this.info.fullID}.on`;
|
|
25
25
|
this._presetID = `${this.info.fullID}.ps`;
|
|
26
26
|
this._brightnessID = `${this.info.fullID}.bri`;
|
|
27
|
-
this.blockAutomationHandler = new blockAutomaticHandler_1.BlockAutomaticHandler(this.restoreTargetAutomaticValue.bind(this));
|
|
27
|
+
this.blockAutomationHandler = new blockAutomaticHandler_1.BlockAutomaticHandler(this.restoreTargetAutomaticValue.bind(this), this.log.bind(this));
|
|
28
28
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.lamp);
|
|
29
29
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.dimmablelamp);
|
|
30
30
|
}
|
|
@@ -33,10 +33,6 @@ class WledDevice extends IoBrokerBaseDevice_1.IoBrokerBaseDevice {
|
|
|
33
33
|
return this.on;
|
|
34
34
|
}
|
|
35
35
|
/** @inheritDoc */
|
|
36
|
-
get lightOn() {
|
|
37
|
-
return this.on;
|
|
38
|
-
}
|
|
39
|
-
/** @inheritDoc */
|
|
40
36
|
restoreTargetAutomaticValue(c) {
|
|
41
37
|
this.setLight(new models_1.WledSetLightCommand(c, this.targetAutomaticState));
|
|
42
38
|
}
|
|
@@ -21,7 +21,7 @@ class ZigbeeActuator extends zigbeeDevice_1.ZigbeeDevice {
|
|
|
21
21
|
this._actuatorOn = false;
|
|
22
22
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.actuator);
|
|
23
23
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.blockAutomatic);
|
|
24
|
-
this.blockAutomationHandler = new blockAutomaticHandler_1.BlockAutomaticHandler(this.restoreTargetAutomaticValue.bind(this));
|
|
24
|
+
this.blockAutomationHandler = new blockAutomaticHandler_1.BlockAutomaticHandler(this.restoreTargetAutomaticValue.bind(this), this.log.bind(this));
|
|
25
25
|
}
|
|
26
26
|
/** @inheritDoc */
|
|
27
27
|
get actuatorOn() {
|
|
@@ -11,11 +11,11 @@ export declare abstract class ZigbeeDimmer extends ZigbeeLamp implements iDimmab
|
|
|
11
11
|
protected abstract readonly _stateIdTransitionTime: string;
|
|
12
12
|
protected abstract readonly _stateNameBrightness: string;
|
|
13
13
|
protected abstract readonly _stateNameTransitionTime: string;
|
|
14
|
-
protected constructor(pInfo: IoBrokerDeviceInfo, deviceType: DeviceType);
|
|
15
14
|
protected _brightness: number;
|
|
15
|
+
protected _transitionTime: number;
|
|
16
|
+
protected constructor(pInfo: IoBrokerDeviceInfo, deviceType: DeviceType);
|
|
16
17
|
/** @inheritDoc */
|
|
17
18
|
get brightness(): number;
|
|
18
|
-
protected _transitionTime: number;
|
|
19
19
|
/** @inheritDoc */
|
|
20
20
|
update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
|
|
21
21
|
/** @inheritDoc */
|
|
@@ -13,9 +13,7 @@ class ZigbeeDimmer extends zigbeeLamp_1.ZigbeeLamp {
|
|
|
13
13
|
this.settings = new models_1.DimmerSettings();
|
|
14
14
|
this._brightness = 0;
|
|
15
15
|
this._transitionTime = 0;
|
|
16
|
-
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.lamp);
|
|
17
16
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.dimmablelamp);
|
|
18
|
-
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.blockAutomatic);
|
|
19
17
|
}
|
|
20
18
|
/** @inheritDoc */
|
|
21
19
|
get brightness() {
|
|
@@ -6,8 +6,6 @@ import { DeviceType } from '../../deviceType';
|
|
|
6
6
|
export declare abstract class ZigbeeLamp extends ZigbeeActuator implements iLamp, iTemporaryDisableAutomatic {
|
|
7
7
|
constructor(pInfo: IoBrokerDeviceInfo, deviceType: DeviceType);
|
|
8
8
|
/** @inheritDoc */
|
|
9
|
-
get lightOn(): boolean;
|
|
10
|
-
/** @inheritDoc */
|
|
11
9
|
update(idSplit: string[], state: ioBroker.State, initial?: boolean, handledByChildObject?: boolean): void;
|
|
12
10
|
/** @inheritDoc */
|
|
13
11
|
setTimeBased(c: LampSetTimeBasedCommand): void;
|
|
@@ -11,10 +11,6 @@ class ZigbeeLamp extends ZigbeeActuator_1.ZigbeeActuator {
|
|
|
11
11
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.lamp);
|
|
12
12
|
}
|
|
13
13
|
/** @inheritDoc */
|
|
14
|
-
get lightOn() {
|
|
15
|
-
return this.actuatorOn;
|
|
16
|
-
}
|
|
17
|
-
/** @inheritDoc */
|
|
18
14
|
update(idSplit, state, initial = false, handledByChildObject = false) {
|
|
19
15
|
if (!handledByChildObject) {
|
|
20
16
|
this.log(models_1.LogLevel.DeepTrace, `Lamp Update: ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`);
|
|
@@ -3,6 +3,5 @@ import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
|
|
|
3
3
|
import { ZigbeeLamp } from './BaseDevices';
|
|
4
4
|
export declare class ZigbeeIlluLampe extends ZigbeeLamp implements iLamp {
|
|
5
5
|
protected readonly _actuatorOnStateIdState: string;
|
|
6
|
-
protected readonly _stateNameState: string;
|
|
7
6
|
constructor(pInfo: IoBrokerDeviceInfo);
|
|
8
7
|
}
|
|
@@ -6,8 +6,7 @@ const BaseDevices_1 = require("./BaseDevices");
|
|
|
6
6
|
class ZigbeeIlluLampe extends BaseDevices_1.ZigbeeLamp {
|
|
7
7
|
constructor(pInfo) {
|
|
8
8
|
super(pInfo, deviceType_1.DeviceType.ZigbeeIlluLampe);
|
|
9
|
-
this._actuatorOnStateIdState = `${pInfo.fullID}.
|
|
10
|
-
this._stateNameState = `${pInfo.fullID}.state`;
|
|
9
|
+
this._actuatorOnStateIdState = `${pInfo.fullID}.${this._stateNameState}`;
|
|
11
10
|
}
|
|
12
11
|
}
|
|
13
12
|
exports.ZigbeeIlluLampe = ZigbeeIlluLampe;
|
|
@@ -4,7 +4,6 @@ import { ZigbeeLamp } from './BaseDevices';
|
|
|
4
4
|
import { iLoadMeter } from '../baseDeviceInterfaces/iLoadMeter';
|
|
5
5
|
export declare class ZigbeeUbisysLampe extends ZigbeeLamp implements iLamp, iLoadMeter {
|
|
6
6
|
protected readonly _actuatorOnStateIdState: string;
|
|
7
|
-
protected readonly _stateNameState: string;
|
|
8
7
|
private _loadPower;
|
|
9
8
|
constructor(pInfo: IoBrokerDeviceInfo);
|
|
10
9
|
/** @inheritDoc */
|
|
@@ -11,7 +11,6 @@ class ZigbeeUbisysLampe extends BaseDevices_1.ZigbeeLamp {
|
|
|
11
11
|
this._loadPower = 0;
|
|
12
12
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.loadMetering);
|
|
13
13
|
this._actuatorOnStateIdState = `${pInfo.fullID}.state`;
|
|
14
|
-
this._stateNameState = `${pInfo.fullID}.state`;
|
|
15
14
|
}
|
|
16
15
|
/** @inheritDoc */
|
|
17
16
|
get loadPower() {
|
|
@@ -85,7 +85,7 @@ class AcDevice {
|
|
|
85
85
|
utils_1.Utils.guardedInterval(this.persist, 15 * 60 * 1000, this, true);
|
|
86
86
|
this.persistDeviceInfo();
|
|
87
87
|
this.loadDeviceSettings();
|
|
88
|
-
this.blockAutomationHandler = new blockAutomaticHandler_1.BlockAutomaticHandler(this.restoreTargetAutomaticValue.bind(this));
|
|
88
|
+
this.blockAutomationHandler = new blockAutomaticHandler_1.BlockAutomaticHandler(this.restoreTargetAutomaticValue.bind(this), this.log.bind(this));
|
|
89
89
|
}
|
|
90
90
|
/** @inheritDoc */
|
|
91
91
|
get energySettings() {
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { BlockAutomaticCommand, BlockAutomaticLiftBlockCommand, BlockAutomaticUntilCommand, RestoreTargetAutomaticValueCommand } from '../../models';
|
|
1
|
+
import { BlockAutomaticCommand, BlockAutomaticLiftBlockCommand, BlockAutomaticUntilCommand, LogLevel, RestoreTargetAutomaticValueCommand } from '../../models';
|
|
2
|
+
import { LogDebugType } from './log-service';
|
|
2
3
|
/**
|
|
3
4
|
* This class is responsible for blocking automatic actions for a specific duration.
|
|
4
5
|
* It also provides the possibility to lift the block before the duration is over {@link BlockAutomaticLiftBlockCommand}.
|
|
5
6
|
*/
|
|
6
7
|
export declare class BlockAutomaticHandler {
|
|
8
|
+
private readonly _logger;
|
|
7
9
|
private readonly _restoreAutomatic;
|
|
8
10
|
private _automaticBlockedUntil;
|
|
9
11
|
private _restoreAutomaticStateTimeout;
|
|
10
|
-
constructor(restoreAutomaticCb: (c: RestoreTargetAutomaticValueCommand) => void);
|
|
12
|
+
constructor(restoreAutomaticCb: (c: RestoreTargetAutomaticValueCommand) => void, _logger: (level: LogLevel, message: string, logDebugType?: LogDebugType) => void);
|
|
11
13
|
get automaticBlockedUntil(): Date;
|
|
12
14
|
private set automaticBlockedUntil(value);
|
|
13
15
|
get automaticBlockActive(): boolean;
|
|
@@ -12,7 +12,8 @@ const lodash_1 = __importDefault(require("lodash"));
|
|
|
12
12
|
* It also provides the possibility to lift the block before the duration is over {@link BlockAutomaticLiftBlockCommand}.
|
|
13
13
|
*/
|
|
14
14
|
class BlockAutomaticHandler {
|
|
15
|
-
constructor(restoreAutomaticCb) {
|
|
15
|
+
constructor(restoreAutomaticCb, _logger) {
|
|
16
|
+
this._logger = _logger;
|
|
16
17
|
this._automaticBlockedUntil = new Date(0);
|
|
17
18
|
this._restoreAutomaticStateTimeout = null;
|
|
18
19
|
this._restoreAutomatic = restoreAutomaticCb;
|
|
@@ -34,8 +35,10 @@ class BlockAutomaticHandler {
|
|
|
34
35
|
if (this._automaticBlockedUntil > now &&
|
|
35
36
|
c.onCollideAction != models_1.CollisionSolving.override &&
|
|
36
37
|
(c.onCollideAction != models_1.CollisionSolving.overrideIfGreater || c.targetDate < this._automaticBlockedUntil)) {
|
|
38
|
+
this._logger(models_1.LogLevel.Info, `Block already active until "${this.automaticBlockedUntil.toLocaleTimeString('de-DE')}" --> ignoring: ${c.logMessage}`);
|
|
37
39
|
return;
|
|
38
40
|
}
|
|
41
|
+
this._logger(models_1.LogLevel.Info, c.logMessage);
|
|
39
42
|
this.automaticBlockedUntil = c.targetDate;
|
|
40
43
|
if (c.revertToAutomaticAtBlockLift) {
|
|
41
44
|
const revertCommand = new models_1.RestoreTargetAutomaticValueCommand(c, 'Restore to automatic state after block.');
|
|
@@ -66,7 +69,7 @@ class BlockAutomaticHandler {
|
|
|
66
69
|
}, this._automaticBlockedUntil.getTime() - utils_1.Utils.nowMS() + 500, this);
|
|
67
70
|
}
|
|
68
71
|
toJSON() {
|
|
69
|
-
return utils_1.Utils.jsonFilter(lodash_1.default.omit(this, ['_restoreAutomatic']));
|
|
72
|
+
return utils_1.Utils.jsonFilter(lodash_1.default.omit(this, ['_restoreAutomatic', '_logger']));
|
|
70
73
|
}
|
|
71
74
|
}
|
|
72
75
|
exports.BlockAutomaticHandler = BlockAutomaticHandler;
|
|
@@ -27,7 +27,7 @@ export declare class OwnGoveeDevice implements iLedRgbCct, iTemporaryDisableAuto
|
|
|
27
27
|
/** @inheritDoc */
|
|
28
28
|
targetAutomaticState: boolean;
|
|
29
29
|
protected _info: DeviceInfo;
|
|
30
|
-
private
|
|
30
|
+
private _actuatorOn;
|
|
31
31
|
private _color;
|
|
32
32
|
private _colortemp;
|
|
33
33
|
private _room;
|
|
@@ -37,7 +37,6 @@ export declare class OwnGoveeDevice implements iLedRgbCct, iTemporaryDisableAuto
|
|
|
37
37
|
get room(): RoomBase;
|
|
38
38
|
get customName(): string;
|
|
39
39
|
get actuatorOn(): boolean;
|
|
40
|
-
get lightOn(): boolean;
|
|
41
40
|
get info(): DeviceInfo;
|
|
42
41
|
get id(): string;
|
|
43
42
|
get name(): string;
|
|
@@ -32,7 +32,7 @@ class OwnGoveeDevice {
|
|
|
32
32
|
this.brightness = -1;
|
|
33
33
|
/** @inheritDoc */
|
|
34
34
|
this.targetAutomaticState = false;
|
|
35
|
-
this.
|
|
35
|
+
this._actuatorOn = false;
|
|
36
36
|
this._color = '#fcba32';
|
|
37
37
|
this._colortemp = 500;
|
|
38
38
|
this._room = undefined;
|
|
@@ -44,7 +44,7 @@ class OwnGoveeDevice {
|
|
|
44
44
|
this._info.allDevicesKey = `govee-${roomName}-${deviceId}`;
|
|
45
45
|
devices_1.Devices.alLDevices[`govee-${roomName}-${deviceId}`] = this;
|
|
46
46
|
this.persistDeviceInfo();
|
|
47
|
-
this.blockAutomationHandler = new blockAutomaticHandler_1.BlockAutomaticHandler(this.restoreTargetAutomaticValue.bind(this));
|
|
47
|
+
this.blockAutomationHandler = new blockAutomaticHandler_1.BlockAutomaticHandler(this.restoreTargetAutomaticValue.bind(this), this.log.bind(this));
|
|
48
48
|
utils_1.Utils.guardedTimeout(this.loadDeviceSettings, 300, this);
|
|
49
49
|
}
|
|
50
50
|
get color() {
|
|
@@ -63,10 +63,7 @@ class OwnGoveeDevice {
|
|
|
63
63
|
return this.info.customName;
|
|
64
64
|
}
|
|
65
65
|
get actuatorOn() {
|
|
66
|
-
return this.
|
|
67
|
-
}
|
|
68
|
-
get lightOn() {
|
|
69
|
-
return this._on;
|
|
66
|
+
return this._actuatorOn;
|
|
70
67
|
}
|
|
71
68
|
get info() {
|
|
72
69
|
return this._info;
|
|
@@ -168,7 +165,7 @@ class OwnGoveeDevice {
|
|
|
168
165
|
}
|
|
169
166
|
update(data) {
|
|
170
167
|
this.queuedValue = null;
|
|
171
|
-
this.
|
|
168
|
+
this._actuatorOn = data.onOff === 1;
|
|
172
169
|
this.brightness = data.brightness;
|
|
173
170
|
this._color = `#${data.color.r.toString(16)}${data.color.g.toString(16)}${data.color.b.toString(16)}`;
|
|
174
171
|
this._colortemp = data.colorTemInKelvin;
|
|
@@ -199,7 +196,7 @@ class OwnGoveeDevice {
|
|
|
199
196
|
}
|
|
200
197
|
turnOn() {
|
|
201
198
|
var _a;
|
|
202
|
-
if (this.
|
|
199
|
+
if (this._actuatorOn) {
|
|
203
200
|
return;
|
|
204
201
|
}
|
|
205
202
|
this.queuedValue = true;
|