hoffmation-base 2.10.0 → 2.10.2
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/server/devices/zigbee/BaseDevices/zigbeeDimmer.d.ts +6 -4
- package/lib/server/devices/zigbee/BaseDevices/zigbeeDimmer.js +13 -21
- package/lib/server/devices/zigbee/index.d.ts +1 -0
- package/lib/server/devices/zigbee/index.js +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -14
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
/// <reference types="iobroker" />
|
|
3
2
|
import { DimmerSettings, TimeOfDay } from '../../../../models';
|
|
4
3
|
import { DeviceType } from '../../deviceType';
|
|
5
4
|
import { ZigbeeDevice } from './index';
|
|
6
5
|
import { IoBrokerDeviceInfo } from '../../IoBrokerDeviceInfo';
|
|
7
6
|
import { iDimmableLamp } from '../../baseDeviceInterfaces/iDimmableLamp';
|
|
8
|
-
|
|
7
|
+
import { iTemporaryDisableAutomatic } from '../../baseDeviceInterfaces';
|
|
8
|
+
import { BlockAutomaticHandler } from '../../../services/blockAutomaticHandler';
|
|
9
|
+
export declare abstract class ZigbeeDimmer extends ZigbeeDevice implements iDimmableLamp, iTemporaryDisableAutomatic {
|
|
10
|
+
readonly blockAutomationHandler: BlockAutomaticHandler;
|
|
9
11
|
queuedValue: boolean | null;
|
|
10
12
|
settings: DimmerSettings;
|
|
11
13
|
protected _brightness: number;
|
|
12
14
|
protected _lastPersist: number;
|
|
13
15
|
protected _lightOn: boolean;
|
|
14
16
|
protected _transitionTime: number;
|
|
15
|
-
protected
|
|
16
|
-
protected _turnOffTimeout: NodeJS.Timeout | undefined;
|
|
17
|
+
protected _targetAutomaticState: boolean;
|
|
17
18
|
protected abstract readonly _stateIdBrightness: string;
|
|
18
19
|
protected abstract readonly _stateIdState: string;
|
|
19
20
|
protected abstract readonly _stateIdTransitionTime: string;
|
|
@@ -25,6 +26,7 @@ export declare abstract class ZigbeeDimmer extends ZigbeeDevice implements iDimm
|
|
|
25
26
|
get transitionTime(): number;
|
|
26
27
|
get actuatorOn(): boolean;
|
|
27
28
|
protected constructor(pInfo: IoBrokerDeviceInfo, deviceType: DeviceType);
|
|
29
|
+
restoreTargetAutomaticValue(): void;
|
|
28
30
|
update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
|
|
29
31
|
setTimeBased(time: TimeOfDay, timeout?: number, force?: boolean): void;
|
|
30
32
|
setActuator(pValue: boolean, timeout?: number, force?: boolean): void;
|
|
@@ -5,6 +5,7 @@ const models_1 = require("../../../../models");
|
|
|
5
5
|
const services_1 = require("../../../services");
|
|
6
6
|
const index_1 = require("./index");
|
|
7
7
|
const DeviceCapability_1 = require("../../DeviceCapability");
|
|
8
|
+
const blockAutomaticHandler_1 = require("../../../services/blockAutomaticHandler");
|
|
8
9
|
class ZigbeeDimmer extends index_1.ZigbeeDevice {
|
|
9
10
|
get lightOn() {
|
|
10
11
|
return this._lightOn;
|
|
@@ -26,10 +27,15 @@ class ZigbeeDimmer extends index_1.ZigbeeDevice {
|
|
|
26
27
|
this._lastPersist = 0;
|
|
27
28
|
this._lightOn = false;
|
|
28
29
|
this._transitionTime = 0;
|
|
29
|
-
this.
|
|
30
|
-
this._turnOffTimeout = undefined;
|
|
30
|
+
this._targetAutomaticState = false;
|
|
31
31
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.lamp);
|
|
32
32
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.dimmablelamp);
|
|
33
|
+
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.blockAutomatic);
|
|
34
|
+
this.blockAutomationHandler = new blockAutomaticHandler_1.BlockAutomaticHandler(this.restoreTargetAutomaticValue.bind(this));
|
|
35
|
+
}
|
|
36
|
+
restoreTargetAutomaticValue() {
|
|
37
|
+
this.log(models_1.LogLevel.Debug, `Restore Target Automatic value`);
|
|
38
|
+
this.setActuator(this._targetAutomaticState);
|
|
33
39
|
}
|
|
34
40
|
update(idSplit, state, initial = false) {
|
|
35
41
|
this.queuedValue = null;
|
|
@@ -98,8 +104,9 @@ class ZigbeeDimmer extends index_1.ZigbeeDevice {
|
|
|
98
104
|
}
|
|
99
105
|
});
|
|
100
106
|
}
|
|
101
|
-
if (!force &&
|
|
102
|
-
this.log(models_1.LogLevel.Debug, `Skip automatic command to ${pValue} as it is locked until ${new Date(this.
|
|
107
|
+
if (!force && this.blockAutomationHandler.automaticBlockActive) {
|
|
108
|
+
this.log(models_1.LogLevel.Debug, `Skip automatic command to ${pValue} as it is locked until ${new Date(this.blockAutomationHandler.automaticBlockedUntil).toLocaleTimeString()}`);
|
|
109
|
+
this._targetAutomaticState = pValue;
|
|
103
110
|
return;
|
|
104
111
|
}
|
|
105
112
|
if (pValue && brightness === -1 && this.brightness < 10) {
|
|
@@ -121,24 +128,9 @@ class ZigbeeDimmer extends index_1.ZigbeeDevice {
|
|
|
121
128
|
this.setState(this._stateIdBrightness, brightness);
|
|
122
129
|
}
|
|
123
130
|
}
|
|
124
|
-
if (
|
|
125
|
-
|
|
126
|
-
this._turnOffTimeout = undefined;
|
|
127
|
-
}
|
|
128
|
-
if (timeout < 0 || !pValue) {
|
|
129
|
-
return;
|
|
131
|
+
if (timeout > -1) {
|
|
132
|
+
this.blockAutomationHandler.disableAutomatic(timeout, models_1.CollisionSolving.overrideIfGreater);
|
|
130
133
|
}
|
|
131
|
-
this._turnOffTime = services_1.Utils.nowMS() + timeout;
|
|
132
|
-
this._turnOffTimeout = services_1.Utils.guardedTimeout(() => {
|
|
133
|
-
this.log(models_1.LogLevel.Debug, `Delayed Turnoff initiated`);
|
|
134
|
-
this._turnOffTimeout = undefined;
|
|
135
|
-
if (!this.room) {
|
|
136
|
-
this.setLight(false, -1, true);
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
this.room.setLightTimeBased(true);
|
|
140
|
-
}
|
|
141
|
-
}, timeout, this);
|
|
142
134
|
}
|
|
143
135
|
persist() {
|
|
144
136
|
var _a;
|
|
@@ -14,6 +14,7 @@ export * from './zigbeeIlluDimmer';
|
|
|
14
14
|
export * from './zigbeeIlluLampe';
|
|
15
15
|
export * from './zigbeeIlluLedRGBCCT';
|
|
16
16
|
export * from './zigbeeIlluShutter';
|
|
17
|
+
export * from './zigbeeInnr142C';
|
|
17
18
|
export * from './zigbeeLinkindLedRgbCct';
|
|
18
19
|
export * from './zigbeeOsramDimmer';
|
|
19
20
|
export * from './zigbeeSMaBiTMagnetContact';
|
|
@@ -30,6 +30,7 @@ __exportStar(require("./zigbeeIlluDimmer"), exports);
|
|
|
30
30
|
__exportStar(require("./zigbeeIlluLampe"), exports);
|
|
31
31
|
__exportStar(require("./zigbeeIlluLedRGBCCT"), exports);
|
|
32
32
|
__exportStar(require("./zigbeeIlluShutter"), exports);
|
|
33
|
+
__exportStar(require("./zigbeeInnr142C"), exports);
|
|
33
34
|
__exportStar(require("./zigbeeLinkindLedRgbCct"), exports);
|
|
34
35
|
__exportStar(require("./zigbeeOsramDimmer"), exports);
|
|
35
36
|
__exportStar(require("./zigbeeSMaBiTMagnetContact"), exports);
|