hoffmation-base 2.22.1 → 2.22.3
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/config/iIobrokerSettigns.d.ts +4 -0
- package/lib/server/devices/zigbee/BaseDevices/zigbeeDevice.d.ts +2 -0
- package/lib/server/devices/zigbee/BaseDevices/zigbeeDevice.js +12 -1
- package/lib/server/devices/zigbee/BaseDevices/zigbeeDimmer.js +17 -16
- package/lib/server/devices/zigbee/zigbeeInnr142C.d.ts +1 -0
- package/lib/server/devices/zigbee/zigbeeInnr142C.js +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -6,6 +6,8 @@ import { iDisposable } from '../../../services';
|
|
|
6
6
|
export declare class ZigbeeDevice extends IoBrokerBaseDevice implements iDisposable {
|
|
7
7
|
protected _available: boolean;
|
|
8
8
|
protected _dontSendOnUnavailable: boolean;
|
|
9
|
+
protected _debounceStateDelay: number;
|
|
10
|
+
private _lastWrite;
|
|
9
11
|
private readonly _deviceQueryId;
|
|
10
12
|
get available(): boolean;
|
|
11
13
|
protected _linkQuality: number;
|
|
@@ -18,6 +18,9 @@ class ZigbeeDevice extends IoBrokerBaseDevice_1.IoBrokerBaseDevice {
|
|
|
18
18
|
super(pInfo, pType);
|
|
19
19
|
this._available = false;
|
|
20
20
|
this._dontSendOnUnavailable = false;
|
|
21
|
+
// If configured > 0, this indicates the minimum time between state writes in ms
|
|
22
|
+
this._debounceStateDelay = 0;
|
|
23
|
+
this._lastWrite = 0;
|
|
21
24
|
this._linkQuality = 0;
|
|
22
25
|
this.persistZigbeeInterval = services_1.Utils.guardedInterval(() => {
|
|
23
26
|
this.persistZigbeeDevice();
|
|
@@ -73,7 +76,15 @@ class ZigbeeDevice extends IoBrokerBaseDevice_1.IoBrokerBaseDevice {
|
|
|
73
76
|
this.log(models_1.LogLevel.Warn, `Device unavailable --> Not changing ${pointId} to ${state}`);
|
|
74
77
|
return;
|
|
75
78
|
}
|
|
76
|
-
|
|
79
|
+
if (this._debounceStateDelay === 0 || services_1.Utils.nowMS() - this._lastWrite > this._debounceStateDelay) {
|
|
80
|
+
this._lastWrite = services_1.Utils.nowMS();
|
|
81
|
+
super.setState(pointId, state, onSuccess, onError);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
services_1.Utils.guardedTimeout(() => {
|
|
85
|
+
this.log(models_1.LogLevel.Trace, `Debounced write to ${pointId} to ${state}`);
|
|
86
|
+
this.setState(pointId, state, onSuccess, onError);
|
|
87
|
+
}, this._debounceStateDelay, this);
|
|
77
88
|
}
|
|
78
89
|
}
|
|
79
90
|
exports.ZigbeeDevice = ZigbeeDevice;
|
|
@@ -90,6 +90,7 @@ class ZigbeeDimmer extends index_1.ZigbeeDevice {
|
|
|
90
90
|
* @param {number} transitionTime The transition time for the brightness, to switch smoothly
|
|
91
91
|
*/
|
|
92
92
|
setLight(pValue, timeout = -1, force = false, brightness = -1, transitionTime = -1) {
|
|
93
|
+
var _a;
|
|
93
94
|
if (this._stateIdState === '') {
|
|
94
95
|
this.log(models_1.LogLevel.Error, `Keine State ID bekannt.`);
|
|
95
96
|
return;
|
|
@@ -113,25 +114,25 @@ class ZigbeeDimmer extends index_1.ZigbeeDevice {
|
|
|
113
114
|
brightness = 10;
|
|
114
115
|
}
|
|
115
116
|
this.log(models_1.LogLevel.Debug, `Set Light Acutator to "${pValue}" with brightness ${brightness}`, services_1.LogDebugType.SetActuator);
|
|
116
|
-
this.setState(this._stateIdState, pValue);
|
|
117
|
-
this.queuedValue = pValue;
|
|
118
|
-
if (brightness > -1) {
|
|
119
|
-
if (brightness < this.settings.turnOnThreshhold) {
|
|
120
|
-
this.setState(this._stateIdBrightness, this.settings.turnOnThreshhold, () => {
|
|
121
|
-
services_1.Utils.guardedTimeout(() => {
|
|
122
|
-
this.log(models_1.LogLevel.Info, `Delayed reduced brightness on ${this.info.customName}`);
|
|
123
|
-
this.setState(this._stateIdBrightness, brightness);
|
|
124
|
-
}, 1000, this);
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
else if (this._brightness !== brightness) {
|
|
128
|
-
// Only set brightness if it is different from the current one
|
|
129
|
-
this.setState(this._stateIdBrightness, brightness);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
117
|
if (timeout > -1 && !dontBlock) {
|
|
133
118
|
this.blockAutomationHandler.disableAutomatic(timeout, models_1.CollisionSolving.overrideIfGreater);
|
|
134
119
|
}
|
|
120
|
+
if (((_a = services_1.SettingsService.settings.ioBroker) === null || _a === void 0 ? void 0 : _a.useZigbee2mqtt) && !pValue) {
|
|
121
|
+
// With zigbee2mqtt to turn on only setting brighness>0 is needed, so we need state only for turning off
|
|
122
|
+
this.setState(this._stateIdState, pValue);
|
|
123
|
+
this.queuedValue = pValue;
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
if (brightness >= this.settings.turnOnThreshhold) {
|
|
127
|
+
this.setState(this._stateIdBrightness, brightness);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
this.setState(this._stateIdBrightness, this.settings.turnOnThreshhold, () => {
|
|
131
|
+
services_1.Utils.guardedTimeout(() => {
|
|
132
|
+
this.log(models_1.LogLevel.Info, `Delayed reduced brightness on ${this.info.customName}`);
|
|
133
|
+
this.setState(this._stateIdBrightness, brightness);
|
|
134
|
+
}, 1000, this);
|
|
135
|
+
});
|
|
135
136
|
}
|
|
136
137
|
persist() {
|
|
137
138
|
var _a;
|
|
@@ -11,5 +11,6 @@ export declare class ZigbeeInnr142C extends ZigbeeLedRGBCCT {
|
|
|
11
11
|
protected readonly _stateNameTransitionTime: string;
|
|
12
12
|
protected readonly _stateNameColor: string;
|
|
13
13
|
protected readonly _stateNameColorTemp: string;
|
|
14
|
+
protected readonly _debounceStateDelay: number;
|
|
14
15
|
constructor(pInfo: IoBrokerDeviceInfo);
|
|
15
16
|
}
|
|
@@ -11,6 +11,7 @@ class ZigbeeInnr142C extends BaseDevices_1.ZigbeeLedRGBCCT {
|
|
|
11
11
|
this._stateNameTransitionTime = 'transition_time';
|
|
12
12
|
this._stateNameColor = 'color';
|
|
13
13
|
this._stateNameColorTemp = 'colortemp';
|
|
14
|
+
this._debounceStateDelay = 2500;
|
|
14
15
|
this._stateIdBrightness = `${this.info.fullID}.brightness`;
|
|
15
16
|
this._stateIdColor = `${this.info.fullID}.color`;
|
|
16
17
|
this._stateIdColorTemp = `${this.info.fullID}.colortemp`;
|