hoffmation-base 2.20.3 → 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.
@@ -1,5 +1,6 @@
1
1
  import { DimmerSettings } from './dimmerSettings';
2
2
  export declare class LedSettings extends DimmerSettings {
3
+ static fallbackColor: string;
3
4
  defaultColor: string;
4
5
  dayOn: boolean;
5
6
  dayBrightness: number;
@@ -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 = '#fbbc32';
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.defaultColor = (_a = data.defaultColor) !== null && _a !== void 0 ? _a : this.defaultColor;
30
- this.dayOn = (_b = data.dayOn) !== null && _b !== void 0 ? _b : this.dayOn;
31
- this.dayBrightness = (_c = data.dayBrightness) !== null && _c !== void 0 ? _c : this.dayBrightness;
32
- this.dayColor = (_d = data.dayColor) !== null && _d !== void 0 ? _d : this.dayColor;
33
- this.dayColorTemp = (_e = data.dayColorTemp) !== null && _e !== void 0 ? _e : this.dayColorTemp;
34
- this.dawnOn = (_f = data.dawnOn) !== null && _f !== void 0 ? _f : this.dawnOn;
35
- this.dawnBrightness = (_g = data.dawnBrightness) !== null && _g !== void 0 ? _g : this.dawnBrightness;
36
- this.dawnColor = (_h = data.dawnColor) !== null && _h !== void 0 ? _h : this.dawnColor;
37
- this.dawnColorTemp = (_j = data.dawnColorTemp) !== null && _j !== void 0 ? _j : this.dawnColorTemp;
38
- this.duskOn = (_k = data.duskOn) !== null && _k !== void 0 ? _k : this.duskOn;
39
- this.duskBrightness = (_l = data.duskBrightness) !== null && _l !== void 0 ? _l : this.duskBrightness;
40
- this.duskColor = (_m = data.duskColor) !== null && _m !== void 0 ? _m : this.duskColor;
41
- this.duskColorTemp = (_o = data.duskColorTemp) !== null && _o !== void 0 ? _o : this.duskColorTemp;
42
- this.nightOn = (_p = data.nightOn) !== null && _p !== void 0 ? _p : this.nightOn;
43
- this.nightBrightness = (_q = data.nightBrightness) !== null && _q !== void 0 ? _q : this.nightBrightness;
44
- this.nightColor = (_r = data.nightColor) !== null && _r !== void 0 ? _r : this.nightColor;
45
- this.nightColorTemp = (_s = data.nightColorTemp) !== null && _s !== void 0 ? _s : this.nightColorTemp;
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, 200, this);
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);
@@ -282,6 +282,10 @@ class CameraDevice {
282
282
  this._movementDetectFallbackTimeout = services_1.Utils.guardedTimeout(() => {
283
283
  var _a;
284
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
+ }
285
289
  this._movementDetected = false;
286
290
  this.updateMovement(false);
287
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 (!this.anyPresent() && timeAfterReset > 0) {
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
- if (color !== '') {
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
- if (color !== '') {
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;