hoffmation-base 2.20.2 → 2.20.4
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/deviceSettings/ledSettings.d.ts +1 -0
- package/lib/models/deviceSettings/ledSettings.js +20 -19
- package/lib/server/devices/IoBrokerBaseDevice.js +1 -1
- package/lib/server/devices/blueIris/cameraDevice.js +7 -1
- package/lib/server/devices/groups/presenceGroup.js +2 -1
- package/lib/server/devices/zigbee/BaseDevices/zigbeeLedRGBCCT.js +3 -1
- package/lib/server/services/govee/own-govee-device.js +3 -2
- package/lib/server/services/utils/utils.d.ts +1 -0
- package/lib/server/services/utils/utils.js +9 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ const server_1 = require("../../server");
|
|
|
6
6
|
class LedSettings extends dimmerSettings_1.DimmerSettings {
|
|
7
7
|
constructor() {
|
|
8
8
|
super(...arguments);
|
|
9
|
-
this.defaultColor =
|
|
9
|
+
this.defaultColor = LedSettings.fallbackColor;
|
|
10
10
|
this.dayOn = false;
|
|
11
11
|
this.dayBrightness = 100;
|
|
12
12
|
this.dayColor = this.defaultColor;
|
|
@@ -25,24 +25,24 @@ class LedSettings extends dimmerSettings_1.DimmerSettings {
|
|
|
25
25
|
this.nightColorTemp = -1;
|
|
26
26
|
}
|
|
27
27
|
fromPartialObject(data) {
|
|
28
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
29
|
-
this.
|
|
30
|
-
this.
|
|
31
|
-
this.
|
|
32
|
-
this.
|
|
33
|
-
this.
|
|
34
|
-
this.
|
|
35
|
-
this.
|
|
36
|
-
this.
|
|
37
|
-
this.
|
|
38
|
-
this.
|
|
39
|
-
this.
|
|
40
|
-
this.
|
|
41
|
-
this.
|
|
42
|
-
this.
|
|
43
|
-
this.
|
|
44
|
-
this.
|
|
45
|
-
this.
|
|
28
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
29
|
+
this.dayOn = (_a = data.dayOn) !== null && _a !== void 0 ? _a : this.dayOn;
|
|
30
|
+
this.dayBrightness = (_b = data.dayBrightness) !== null && _b !== void 0 ? _b : this.dayBrightness;
|
|
31
|
+
this.dayColorTemp = (_c = data.dayColorTemp) !== null && _c !== void 0 ? _c : this.dayColorTemp;
|
|
32
|
+
this.dawnOn = (_d = data.dawnOn) !== null && _d !== void 0 ? _d : this.dawnOn;
|
|
33
|
+
this.dawnBrightness = (_e = data.dawnBrightness) !== null && _e !== void 0 ? _e : this.dawnBrightness;
|
|
34
|
+
this.dawnColorTemp = (_f = data.dawnColorTemp) !== null && _f !== void 0 ? _f : this.dawnColorTemp;
|
|
35
|
+
this.duskOn = (_g = data.duskOn) !== null && _g !== void 0 ? _g : this.duskOn;
|
|
36
|
+
this.duskBrightness = (_h = data.duskBrightness) !== null && _h !== void 0 ? _h : this.duskBrightness;
|
|
37
|
+
this.duskColorTemp = (_j = data.duskColorTemp) !== null && _j !== void 0 ? _j : this.duskColorTemp;
|
|
38
|
+
this.nightOn = (_k = data.nightOn) !== null && _k !== void 0 ? _k : this.nightOn;
|
|
39
|
+
this.nightBrightness = (_l = data.nightBrightness) !== null && _l !== void 0 ? _l : this.nightBrightness;
|
|
40
|
+
this.nightColorTemp = (_m = data.nightColorTemp) !== null && _m !== void 0 ? _m : this.nightColorTemp;
|
|
41
|
+
this.defaultColor = (_p = server_1.Utils.formatHex((_o = data.defaultColor) !== null && _o !== void 0 ? _o : this.defaultColor)) !== null && _p !== void 0 ? _p : LedSettings.fallbackColor;
|
|
42
|
+
this.dayColor = (_r = server_1.Utils.formatHex((_q = data.dayColor) !== null && _q !== void 0 ? _q : this.dayColor)) !== null && _r !== void 0 ? _r : LedSettings.fallbackColor;
|
|
43
|
+
this.dawnColor = (_t = server_1.Utils.formatHex((_s = data.dawnColor) !== null && _s !== void 0 ? _s : this.dawnColor)) !== null && _t !== void 0 ? _t : LedSettings.fallbackColor;
|
|
44
|
+
this.duskColor = (_v = server_1.Utils.formatHex((_u = data.duskColor) !== null && _u !== void 0 ? _u : this.duskColor)) !== null && _v !== void 0 ? _v : LedSettings.fallbackColor;
|
|
45
|
+
this.nightColor = (_x = server_1.Utils.formatHex((_w = data.nightColor) !== null && _w !== void 0 ? _w : this.nightColor)) !== null && _x !== void 0 ? _x : LedSettings.fallbackColor;
|
|
46
46
|
super.fromPartialObject(data);
|
|
47
47
|
}
|
|
48
48
|
toJSON() {
|
|
@@ -50,3 +50,4 @@ class LedSettings extends dimmerSettings_1.DimmerSettings {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
exports.LedSettings = LedSettings;
|
|
53
|
+
LedSettings.fallbackColor = '#fbbc32';
|
|
@@ -23,7 +23,7 @@ class IoBrokerBaseDevice {
|
|
|
23
23
|
this.individualStateCallbacks = new Map();
|
|
24
24
|
this.addToCorrectRoom();
|
|
25
25
|
this.persistDeviceInfo();
|
|
26
|
-
services_1.Utils.guardedTimeout(this.loadDeviceSettings,
|
|
26
|
+
services_1.Utils.guardedTimeout(this.loadDeviceSettings, 300, this);
|
|
27
27
|
}
|
|
28
28
|
get id() {
|
|
29
29
|
const result = services_1.Utils.guard(this.info.allDevicesKey);
|
|
@@ -142,13 +142,13 @@ class CameraDevice {
|
|
|
142
142
|
}
|
|
143
143
|
update(idSplit, state) {
|
|
144
144
|
const stateName = idSplit[4];
|
|
145
|
-
this.log(models_1.LogLevel.Debug, `Update for "${stateName}" to value: ${state.val}`);
|
|
146
145
|
switch (stateName) {
|
|
147
146
|
case 'MotionDetected':
|
|
148
147
|
this._movementDetectedStateId = idSplit.join('.');
|
|
149
148
|
if (this.settings.movementDetectionOnPersonOnly) {
|
|
150
149
|
return;
|
|
151
150
|
}
|
|
151
|
+
this.log(models_1.LogLevel.Debug, `Update for "${stateName}" to value: ${state.val}`);
|
|
152
152
|
const movementDetected = state.val === 1;
|
|
153
153
|
this.updateMovement(movementDetected);
|
|
154
154
|
if (movementDetected) {
|
|
@@ -158,6 +158,7 @@ class CameraDevice {
|
|
|
158
158
|
case 'PersonDetected':
|
|
159
159
|
this._personDetectedStateId = idSplit.join('.');
|
|
160
160
|
const newValue = state.val === 1;
|
|
161
|
+
this.log(models_1.LogLevel.Debug, `Update for "${stateName}" to value: ${state.val}`);
|
|
161
162
|
if (newValue) {
|
|
162
163
|
this.log(models_1.LogLevel.Info, `Person Detected`);
|
|
163
164
|
this.resetPersonDetectFallbackTimer();
|
|
@@ -170,6 +171,7 @@ class CameraDevice {
|
|
|
170
171
|
case 'DogDetected':
|
|
171
172
|
this._dogDetectedStateId = idSplit.join('.');
|
|
172
173
|
const newDogDetectionVal = state.val === 1;
|
|
174
|
+
this.log(models_1.LogLevel.Debug, `Update for "${stateName}" to value: ${state.val}`);
|
|
173
175
|
if (newDogDetectionVal) {
|
|
174
176
|
this.log(models_1.LogLevel.Info, `Dog Detected`);
|
|
175
177
|
this.resetDogDetectFallbackTimer();
|
|
@@ -280,6 +282,10 @@ class CameraDevice {
|
|
|
280
282
|
this._movementDetectFallbackTimeout = services_1.Utils.guardedTimeout(() => {
|
|
281
283
|
var _a;
|
|
282
284
|
this._movementDetectFallbackTimeout = null;
|
|
285
|
+
if (!this._movementDetected) {
|
|
286
|
+
// Der Fallback wird nicht benötigt, da bereits das Movement zurückgesetzt wurde
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
283
289
|
this._movementDetected = false;
|
|
284
290
|
this.updateMovement(false);
|
|
285
291
|
if (this._movementDetectedStateId !== undefined) {
|
|
@@ -81,8 +81,9 @@ class PresenceGroup extends base_group_1.BaseGroup {
|
|
|
81
81
|
var _a;
|
|
82
82
|
timeAfterReset =
|
|
83
83
|
services_1.Utils.nowMS() - this._lastMovement.getTime() - this.getRoom().settings.movementResetTimer * 1000;
|
|
84
|
+
const presentAmount = this.presentAmount();
|
|
84
85
|
this.log(models_1.LogLevel.Debug, `Delayed Movement reset. Active Motions: ${this.presentAmount()}\tTime after Last Movement including Reset: ${timeAfterReset}`);
|
|
85
|
-
if (
|
|
86
|
+
if (presentAmount <= 0 && timeAfterReset > 0) {
|
|
86
87
|
(_a = this.getRoom().WindowGroup) === null || _a === void 0 ? void 0 : _a.changeVibrationMotionBlock(false);
|
|
87
88
|
cb();
|
|
88
89
|
}
|
|
@@ -4,6 +4,7 @@ exports.ZigbeeLedRGBCCT = void 0;
|
|
|
4
4
|
const models_1 = require("../../../../models");
|
|
5
5
|
const DeviceCapability_1 = require("../../DeviceCapability");
|
|
6
6
|
const zigbeeDimmer_1 = require("./zigbeeDimmer");
|
|
7
|
+
const services_1 = require("../../../services");
|
|
7
8
|
class ZigbeeLedRGBCCT extends zigbeeDimmer_1.ZigbeeDimmer {
|
|
8
9
|
constructor(pInfo, deviceType) {
|
|
9
10
|
super(pInfo, deviceType);
|
|
@@ -77,7 +78,8 @@ class ZigbeeLedRGBCCT extends zigbeeDimmer_1.ZigbeeDimmer {
|
|
|
77
78
|
brightness = 10;
|
|
78
79
|
}
|
|
79
80
|
this.log(models_1.LogLevel.Debug, `LED Schalten An: ${pValue}\tHelligkeit: ${brightness}%\tFarbe: "${color}"\tColorTemperatur: ${colorTemp}`);
|
|
80
|
-
|
|
81
|
+
const formattedColor = services_1.Utils.formatHex(color);
|
|
82
|
+
if (formattedColor !== null) {
|
|
81
83
|
this.ioConn.setState(this._stateIdColor, color, (err) => {
|
|
82
84
|
if (err) {
|
|
83
85
|
this.log(models_1.LogLevel.Error, `LED Farbe schalten ergab Fehler: ${err}`);
|
|
@@ -39,7 +39,7 @@ class OwnGoveeDevice {
|
|
|
39
39
|
devices_1.Devices.alLDevices[`govee-${roomName}-${deviceId}`] = this;
|
|
40
40
|
this.persistDeviceInfo();
|
|
41
41
|
this.blockAutomationHandler = new blockAutomaticHandler_1.BlockAutomaticHandler(this.restoreTargetAutomaticValue.bind(this));
|
|
42
|
-
this.loadDeviceSettings
|
|
42
|
+
utils_1.Utils.guardedTimeout(this.loadDeviceSettings, 300, this);
|
|
43
43
|
}
|
|
44
44
|
get color() {
|
|
45
45
|
return this._color;
|
|
@@ -131,7 +131,8 @@ class OwnGoveeDevice {
|
|
|
131
131
|
brightness = 10;
|
|
132
132
|
}
|
|
133
133
|
this.log(models_1.LogLevel.Debug, `LED Schalten An: ${pValue}\tHelligkeit: ${brightness}%\tFarbe: "${color}"\tColorTemperatur: ${colorTemp}`);
|
|
134
|
-
|
|
134
|
+
const formattedColor = utils_1.Utils.formatHex(color);
|
|
135
|
+
if (formattedColor !== null) {
|
|
135
136
|
this.setColor(color);
|
|
136
137
|
}
|
|
137
138
|
let dontBlock = false;
|
|
@@ -33,4 +33,5 @@ export declare class Utils {
|
|
|
33
33
|
private static deepOmit;
|
|
34
34
|
static nextMatchingDate(hours?: number, minutes?: number, now?: Date): Date;
|
|
35
35
|
static timeWithinBorders(minimumHours: number, minimumMinutes: number, maxHours: number, maxMinutes: number, now?: Date): boolean;
|
|
36
|
+
static formatHex(hex: string): string | null;
|
|
36
37
|
}
|
|
@@ -234,5 +234,14 @@ class Utils {
|
|
|
234
234
|
}
|
|
235
235
|
return true;
|
|
236
236
|
}
|
|
237
|
+
static formatHex(hex) {
|
|
238
|
+
if (hex === undefined || hex === null || hex === '') {
|
|
239
|
+
return null;
|
|
240
|
+
}
|
|
241
|
+
if (!hex.startsWith('#')) {
|
|
242
|
+
return `#${hex}`;
|
|
243
|
+
}
|
|
244
|
+
return hex;
|
|
245
|
+
}
|
|
237
246
|
}
|
|
238
247
|
exports.Utils = Utils;
|