hoffmation-base 1.2.6 → 1.3.0

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.
Files changed (59) hide show
  1. package/lib/models/deviceSettings/acSettings.d.ts +2 -0
  2. package/lib/models/deviceSettings/acSettings.js +15 -0
  3. package/lib/models/deviceSettings/actuatorSettings.d.ts +2 -0
  4. package/lib/models/deviceSettings/actuatorSettings.js +13 -0
  5. package/lib/models/deviceSettings/deviceSettings.d.ts +6 -1
  6. package/lib/models/deviceSettings/deviceSettings.js +35 -0
  7. package/lib/models/deviceSettings/dimmerSettings.d.ts +2 -0
  8. package/lib/models/deviceSettings/dimmerSettings.js +13 -0
  9. package/lib/models/deviceSettings/heaterSettings.d.ts +2 -0
  10. package/lib/models/deviceSettings/heaterSettings.js +16 -0
  11. package/lib/models/deviceSettings/index.d.ts +5 -0
  12. package/lib/models/deviceSettings/index.js +5 -0
  13. package/lib/models/deviceSettings/ledSettings.d.ts +2 -0
  14. package/lib/models/deviceSettings/ledSettings.js +25 -0
  15. package/lib/models/deviceSettings/motionSensorSettings.d.ts +2 -0
  16. package/lib/models/deviceSettings/motionSensorSettings.js +10 -0
  17. package/lib/models/deviceSettings/sceneSettings.d.ts +2 -0
  18. package/lib/models/deviceSettings/sceneSettings.js +8 -0
  19. package/lib/models/deviceSettings/shutterSettings.d.ts +2 -0
  20. package/lib/models/deviceSettings/shutterSettings.js +11 -0
  21. package/lib/models/deviceSettings/sonosDeviceSettings.d.ts +6 -0
  22. package/lib/models/deviceSettings/sonosDeviceSettings.js +20 -0
  23. package/lib/models/deviceSettings/tvSettings.d.ts +2 -0
  24. package/lib/models/deviceSettings/tvSettings.js +9 -0
  25. package/lib/models/deviceSettings/windowSettings.d.ts +2 -0
  26. package/lib/models/deviceSettings/windowSettings.js +8 -0
  27. package/lib/models/deviceSettings/wledSettings.d.ts +2 -0
  28. package/lib/models/deviceSettings/wledSettings.js +20 -0
  29. package/lib/models/persistence/idSettings.d.ts +4 -0
  30. package/lib/models/persistence/idSettings.js +9 -0
  31. package/lib/models/persistence/index.d.ts +1 -0
  32. package/lib/models/persistence/index.js +1 -0
  33. package/lib/server/devices/IoBrokerBaseDevice.d.ts +3 -1
  34. package/lib/server/devices/IoBrokerBaseDevice.js +5 -0
  35. package/lib/server/devices/baseDeviceInterfaces/iAcDevice.d.ts +2 -2
  36. package/lib/server/devices/baseDeviceInterfaces/iBaseDevice.d.ts +3 -1
  37. package/lib/server/devices/baseDeviceInterfaces/iScene.d.ts +1 -1
  38. package/lib/server/devices/espresense/detectedBluetoothDevice.d.ts +2 -0
  39. package/lib/server/devices/espresense/detectedBluetoothDevice.js +5 -0
  40. package/lib/server/devices/espresense/espresenseDevice.d.ts +2 -0
  41. package/lib/server/devices/espresense/espresenseDevice.js +5 -0
  42. package/lib/server/devices/scene/room-scene.d.ts +2 -2
  43. package/lib/server/devices/scene/room-scene.js +5 -2
  44. package/lib/server/devices/tv/tvDevice.d.ts +3 -3
  45. package/lib/server/devices/tv/tvDevice.js +5 -2
  46. package/lib/server/devices/wledDevice.d.ts +1 -2
  47. package/lib/server/devices/wledDevice.js +1 -2
  48. package/lib/server/services/Sonos/own-sonos-device.d.ts +3 -2
  49. package/lib/server/services/Sonos/own-sonos-device.js +5 -1
  50. package/lib/server/services/Sonos/sonos-service.js +3 -1
  51. package/lib/server/services/ac/ac-device.d.ts +4 -4
  52. package/lib/server/services/ac/ac-device.js +19 -15
  53. package/lib/server/services/api/api-service.d.ts +12 -3
  54. package/lib/server/services/api/api-service.js +32 -1
  55. package/lib/server/services/dbo/iPersist.d.ts +2 -0
  56. package/lib/server/services/dbo/postgreSqlPersist.d.ts +2 -0
  57. package/lib/server/services/dbo/postgreSqlPersist.js +31 -0
  58. package/lib/tsconfig.tsbuildinfo +1 -1
  59. package/package.json +8 -8
@@ -19,4 +19,6 @@ export declare class AcSettings extends DeviceSettings {
19
19
  * @type {boolean}
20
20
  */
21
21
  heatingAllowed: boolean;
22
+ fromPartialObject(data: Partial<AcSettings>): void;
23
+ protected toJSON(): Partial<AcSettings>;
22
24
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AcSettings = void 0;
4
4
  const deviceSettings_1 = require("./deviceSettings");
5
+ const server_1 = require("../../server");
5
6
  class AcSettings extends deviceSettings_1.DeviceSettings {
6
7
  constructor() {
7
8
  super(...arguments);
@@ -25,5 +26,19 @@ class AcSettings extends deviceSettings_1.DeviceSettings {
25
26
  */
26
27
  this.heatingAllowed = false;
27
28
  }
29
+ fromPartialObject(data) {
30
+ var _a, _b, _c, _d, _e, _f, _g;
31
+ this.minimumHours = (_a = data.minimumHours) !== null && _a !== void 0 ? _a : this.minimumHours;
32
+ this.minimumMinutes = (_b = data.minimumMinutes) !== null && _b !== void 0 ? _b : this.minimumMinutes;
33
+ this.maximumHours = (_c = data.maximumHours) !== null && _c !== void 0 ? _c : this.maximumHours;
34
+ this.maximumMinutes = (_d = data.maximumMinutes) !== null && _d !== void 0 ? _d : this.maximumMinutes;
35
+ this.stopCoolingTemperatur = (_e = data.stopCoolingTemperatur) !== null && _e !== void 0 ? _e : this.stopCoolingTemperatur;
36
+ this.stopHeatingTemperatur = (_f = data.stopHeatingTemperatur) !== null && _f !== void 0 ? _f : this.stopHeatingTemperatur;
37
+ this.heatingAllowed = (_g = data.heatingAllowed) !== null && _g !== void 0 ? _g : this.heatingAllowed;
38
+ super.fromPartialObject(data);
39
+ }
40
+ toJSON() {
41
+ return server_1.Utils.jsonFilter(this);
42
+ }
28
43
  }
29
44
  exports.AcSettings = AcSettings;
@@ -14,4 +14,6 @@ export declare class ActuatorSettings extends DeviceSettings {
14
14
  * @type {number}
15
15
  */
16
16
  stromStossResendTime: number;
17
+ fromPartialObject(data: Partial<ActuatorSettings>): void;
18
+ protected toJSON(): Partial<ActuatorSettings>;
17
19
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ActuatorSettings = void 0;
4
4
  const deviceSettings_1 = require("./deviceSettings");
5
+ const server_1 = require("../../server");
5
6
  class ActuatorSettings extends deviceSettings_1.DeviceSettings {
6
7
  constructor() {
7
8
  super(...arguments);
@@ -20,5 +21,17 @@ class ActuatorSettings extends deviceSettings_1.DeviceSettings {
20
21
  */
21
22
  this.stromStossResendTime = 180;
22
23
  }
24
+ fromPartialObject(data) {
25
+ var _a, _b, _c, _d, _e;
26
+ this.dawnOn = (_a = data.dawnOn) !== null && _a !== void 0 ? _a : this.dawnOn;
27
+ this.duskOn = (_b = data.duskOn) !== null && _b !== void 0 ? _b : this.duskOn;
28
+ this.nightOn = (_c = data.nightOn) !== null && _c !== void 0 ? _c : this.nightOn;
29
+ this.isStromStoss = (_d = data.isStromStoss) !== null && _d !== void 0 ? _d : this.isStromStoss;
30
+ this.stromStossResendTime = (_e = data.stromStossResendTime) !== null && _e !== void 0 ? _e : this.stromStossResendTime;
31
+ super.fromPartialObject(data);
32
+ }
33
+ toJSON() {
34
+ return server_1.Utils.jsonFilter(this);
35
+ }
23
36
  }
24
37
  exports.ActuatorSettings = ActuatorSettings;
@@ -1,2 +1,7 @@
1
- export declare class DeviceSettings {
1
+ import { iBaseDevice } from '../../server';
2
+ export declare abstract class DeviceSettings {
3
+ persist(device: iBaseDevice): void;
4
+ initializeFromDb(device: iBaseDevice): void;
5
+ fromPartialObject(_obj: Partial<DeviceSettings>): void;
6
+ protected toJSON(): Partial<DeviceSettings>;
2
7
  }
@@ -1,6 +1,41 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DeviceSettings = void 0;
4
+ const server_1 = require("../../server");
5
+ const logLevel_1 = require("../logLevel");
4
6
  class DeviceSettings {
7
+ persist(device) {
8
+ var _a;
9
+ (_a = server_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistDeviceSettings(device, JSON.stringify(this));
10
+ }
11
+ initializeFromDb(device) {
12
+ var _a;
13
+ (_a = server_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.loadDeviceSettings(device).then((data) => {
14
+ if (!data) {
15
+ // Nothing in db yet
16
+ return;
17
+ }
18
+ let obj = null;
19
+ try {
20
+ obj = JSON.parse(data);
21
+ }
22
+ catch (e) {
23
+ device.log(logLevel_1.LogLevel.Error, `Failed to parse Device Setting JSON (${e})`);
24
+ }
25
+ if (!obj) {
26
+ return;
27
+ }
28
+ this.fromPartialObject(obj);
29
+ if (this.toJSON() !== data) {
30
+ this.persist(device);
31
+ }
32
+ });
33
+ }
34
+ fromPartialObject(_obj) {
35
+ // Nothing
36
+ }
37
+ toJSON() {
38
+ return server_1.Utils.jsonFilter(this);
39
+ }
5
40
  }
6
41
  exports.DeviceSettings = DeviceSettings;
@@ -5,4 +5,6 @@ export declare class DimmerSettings extends ActuatorSettings {
5
5
  duskBrightness: number;
6
6
  dayBrightness: number;
7
7
  turnOnThreshhold: number;
8
+ fromPartialObject(data: Partial<DimmerSettings>): void;
9
+ protected toJSON(): Partial<DimmerSettings>;
8
10
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DimmerSettings = void 0;
4
4
  const actuatorSettings_1 = require("./actuatorSettings");
5
+ const server_1 = require("../../server");
5
6
  class DimmerSettings extends actuatorSettings_1.ActuatorSettings {
6
7
  constructor() {
7
8
  super(...arguments);
@@ -11,5 +12,17 @@ class DimmerSettings extends actuatorSettings_1.ActuatorSettings {
11
12
  this.dayBrightness = 100;
12
13
  this.turnOnThreshhold = -1;
13
14
  }
15
+ fromPartialObject(data) {
16
+ var _a, _b, _c, _d, _e;
17
+ this.nightBrightness = (_a = data.nightBrightness) !== null && _a !== void 0 ? _a : this.nightBrightness;
18
+ this.dawnBrightness = (_b = data.dawnBrightness) !== null && _b !== void 0 ? _b : this.dawnBrightness;
19
+ this.duskBrightness = (_c = data.duskBrightness) !== null && _c !== void 0 ? _c : this.duskBrightness;
20
+ this.dayBrightness = (_d = data.dayBrightness) !== null && _d !== void 0 ? _d : this.dayBrightness;
21
+ this.turnOnThreshhold = (_e = data.turnOnThreshhold) !== null && _e !== void 0 ? _e : this.turnOnThreshhold;
22
+ super.fromPartialObject(data);
23
+ }
24
+ toJSON() {
25
+ return server_1.Utils.jsonFilter(this);
26
+ }
14
27
  }
15
28
  exports.DimmerSettings = DimmerSettings;
@@ -26,4 +26,6 @@ export declare class HeaterSettings extends DeviceSettings {
26
26
  * @type {number}
27
27
  */
28
28
  seasonTurnOnDay: number;
29
+ fromPartialObject(data: Partial<HeaterSettings>): void;
30
+ protected toJSON(): Partial<HeaterSettings>;
29
31
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HeaterSettings = void 0;
4
4
  const deviceSettings_1 = require("./deviceSettings");
5
+ const server_1 = require("../../server");
5
6
  class HeaterSettings extends deviceSettings_1.DeviceSettings {
6
7
  constructor() {
7
8
  super(...arguments);
@@ -32,5 +33,20 @@ class HeaterSettings extends deviceSettings_1.DeviceSettings {
32
33
  */
33
34
  this.seasonTurnOnDay = 267;
34
35
  }
36
+ fromPartialObject(data) {
37
+ var _a, _b, _c, _d, _e, _f, _g, _h;
38
+ this.automaticMode = (_a = data.automaticMode) !== null && _a !== void 0 ? _a : this.automaticMode;
39
+ this.automaticFallBackTemperatur = (_b = data.automaticFallBackTemperatur) !== null && _b !== void 0 ? _b : this.automaticFallBackTemperatur;
40
+ this.useOwnTemperatur = (_c = data.useOwnTemperatur) !== null && _c !== void 0 ? _c : this.useOwnTemperatur;
41
+ this.controlByPid = (_d = data.controlByPid) !== null && _d !== void 0 ? _d : this.controlByPid;
42
+ this.controlByTempDiff = (_e = data.controlByTempDiff) !== null && _e !== void 0 ? _e : this.controlByTempDiff;
43
+ this.seasonalTurnOffActive = (_f = data.seasonalTurnOffActive) !== null && _f !== void 0 ? _f : this.seasonalTurnOffActive;
44
+ this.seasonTurnOffDay = (_g = data.seasonTurnOffDay) !== null && _g !== void 0 ? _g : this.seasonTurnOffDay;
45
+ this.seasonTurnOnDay = (_h = data.seasonTurnOnDay) !== null && _h !== void 0 ? _h : this.seasonTurnOnDay;
46
+ super.fromPartialObject(data);
47
+ }
48
+ toJSON() {
49
+ return server_1.Utils.jsonFilter(this);
50
+ }
35
51
  }
36
52
  exports.HeaterSettings = HeaterSettings;
@@ -1,8 +1,13 @@
1
+ export * from './acSettings';
1
2
  export * from './actuatorSettings';
2
3
  export * from './deviceSettings';
3
4
  export * from './dimmerSettings';
4
5
  export * from './heaterSettings';
5
6
  export * from './ledSettings';
6
7
  export * from './motionSensorSettings';
8
+ export * from './sceneSettings';
7
9
  export * from './shutterSettings';
10
+ export * from './sonosDeviceSettings';
11
+ export * from './tvSettings';
8
12
  export * from './windowSettings';
13
+ export * from './wledSettings';
@@ -14,11 +14,16 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./acSettings"), exports);
17
18
  __exportStar(require("./actuatorSettings"), exports);
18
19
  __exportStar(require("./deviceSettings"), exports);
19
20
  __exportStar(require("./dimmerSettings"), exports);
20
21
  __exportStar(require("./heaterSettings"), exports);
21
22
  __exportStar(require("./ledSettings"), exports);
22
23
  __exportStar(require("./motionSensorSettings"), exports);
24
+ __exportStar(require("./sceneSettings"), exports);
23
25
  __exportStar(require("./shutterSettings"), exports);
26
+ __exportStar(require("./sonosDeviceSettings"), exports);
27
+ __exportStar(require("./tvSettings"), exports);
24
28
  __exportStar(require("./windowSettings"), exports);
29
+ __exportStar(require("./wledSettings"), exports);
@@ -17,4 +17,6 @@ export declare class LedSettings extends DimmerSettings {
17
17
  nightBrightness: number;
18
18
  nightColor: string;
19
19
  nightColorTemp: number;
20
+ fromPartialObject(data: Partial<LedSettings>): void;
21
+ protected toJSON(): Partial<LedSettings>;
20
22
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LedSettings = void 0;
4
4
  const dimmerSettings_1 = require("./dimmerSettings");
5
+ const server_1 = require("../../server");
5
6
  class LedSettings extends dimmerSettings_1.DimmerSettings {
6
7
  constructor() {
7
8
  super(...arguments);
@@ -23,5 +24,29 @@ class LedSettings extends dimmerSettings_1.DimmerSettings {
23
24
  this.nightColor = '#ff5500';
24
25
  this.nightColorTemp = -1;
25
26
  }
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;
46
+ super.fromPartialObject(data);
47
+ }
48
+ toJSON() {
49
+ return server_1.Utils.jsonFilter(this);
50
+ }
26
51
  }
27
52
  exports.LedSettings = LedSettings;
@@ -6,4 +6,6 @@ export declare class MotionSensorSettings extends DeviceSettings {
6
6
  */
7
7
  seesWindow: boolean;
8
8
  excludeFromNightAlarm: boolean;
9
+ fromPartialObject(data: Partial<MotionSensorSettings>): void;
10
+ protected toJSON(): Partial<MotionSensorSettings>;
9
11
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MotionSensorSettings = void 0;
4
4
  const deviceSettings_1 = require("./deviceSettings");
5
+ const server_1 = require("../../server");
5
6
  class MotionSensorSettings extends deviceSettings_1.DeviceSettings {
6
7
  constructor() {
7
8
  super(...arguments);
@@ -12,5 +13,14 @@ class MotionSensorSettings extends deviceSettings_1.DeviceSettings {
12
13
  this.seesWindow = true;
13
14
  this.excludeFromNightAlarm = false;
14
15
  }
16
+ fromPartialObject(data) {
17
+ var _a, _b;
18
+ this.seesWindow = (_a = data.seesWindow) !== null && _a !== void 0 ? _a : this.seesWindow;
19
+ this.excludeFromNightAlarm = (_b = data.excludeFromNightAlarm) !== null && _b !== void 0 ? _b : this.excludeFromNightAlarm;
20
+ super.fromPartialObject(data);
21
+ }
22
+ toJSON() {
23
+ return server_1.Utils.jsonFilter(this);
24
+ }
15
25
  }
16
26
  exports.MotionSensorSettings = MotionSensorSettings;
@@ -1,4 +1,6 @@
1
1
  import { DeviceSettings } from './deviceSettings';
2
2
  export declare class SceneSettings extends DeviceSettings {
3
3
  defaultTurnOffTimeout?: number;
4
+ fromPartialObject(data: Partial<SceneSettings>): void;
5
+ protected toJSON(): Partial<SceneSettings>;
4
6
  }
@@ -2,6 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SceneSettings = void 0;
4
4
  const deviceSettings_1 = require("./deviceSettings");
5
+ const server_1 = require("../../server");
5
6
  class SceneSettings extends deviceSettings_1.DeviceSettings {
7
+ fromPartialObject(data) {
8
+ this.defaultTurnOffTimeout = data.defaultTurnOffTimeout;
9
+ super.fromPartialObject(data);
10
+ }
11
+ toJSON() {
12
+ return server_1.Utils.jsonFilter(this);
13
+ }
6
14
  }
7
15
  exports.SceneSettings = SceneSettings;
@@ -8,4 +8,6 @@ export declare class ShutterSettings extends DeviceSettings {
8
8
  * @type {boolean}
9
9
  */
10
10
  triggerPositionUpdateByTime: boolean;
11
+ fromPartialObject(data: Partial<ShutterSettings>): void;
12
+ protected toJSON(): Partial<ShutterSettings>;
11
13
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ShutterSettings = void 0;
4
4
  const deviceSettings_1 = require("./deviceSettings");
5
+ const server_1 = require("../../server");
5
6
  class ShutterSettings extends deviceSettings_1.DeviceSettings {
6
7
  constructor() {
7
8
  super(...arguments);
@@ -14,5 +15,15 @@ class ShutterSettings extends deviceSettings_1.DeviceSettings {
14
15
  */
15
16
  this.triggerPositionUpdateByTime = false;
16
17
  }
18
+ fromPartialObject(data) {
19
+ var _a, _b, _c;
20
+ this.msTilTop = (_a = data.msTilTop) !== null && _a !== void 0 ? _a : this.msTilTop;
21
+ this.msTilBot = (_b = data.msTilBot) !== null && _b !== void 0 ? _b : this.msTilBot;
22
+ this.triggerPositionUpdateByTime = (_c = data.triggerPositionUpdateByTime) !== null && _c !== void 0 ? _c : this.triggerPositionUpdateByTime;
23
+ super.fromPartialObject(data);
24
+ }
25
+ toJSON() {
26
+ return server_1.Utils.jsonFilter(this);
27
+ }
17
28
  }
18
29
  exports.ShutterSettings = ShutterSettings;
@@ -0,0 +1,6 @@
1
+ import { DeviceSettings } from './deviceSettings';
2
+ export declare class SonosDeviceSettings extends DeviceSettings {
3
+ maxPlayOnAllVolume: number;
4
+ fromPartialObject(data: Partial<SonosDeviceSettings>): void;
5
+ protected toJSON(): Partial<SonosDeviceSettings>;
6
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SonosDeviceSettings = void 0;
4
+ const deviceSettings_1 = require("./deviceSettings");
5
+ const server_1 = require("../../server");
6
+ class SonosDeviceSettings extends deviceSettings_1.DeviceSettings {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.maxPlayOnAllVolume = 80;
10
+ }
11
+ fromPartialObject(data) {
12
+ var _a;
13
+ this.maxPlayOnAllVolume = (_a = data.maxPlayOnAllVolume) !== null && _a !== void 0 ? _a : this.maxPlayOnAllVolume;
14
+ super.fromPartialObject(data);
15
+ }
16
+ toJSON() {
17
+ return server_1.Utils.jsonFilter(this);
18
+ }
19
+ }
20
+ exports.SonosDeviceSettings = SonosDeviceSettings;
@@ -2,4 +2,6 @@ import { DeviceSettings } from './deviceSettings';
2
2
  import { Daytime } from '../daytime';
3
3
  export declare class TvSettings extends DeviceSettings {
4
4
  automaticTurnOff: Daytime | undefined;
5
+ fromPartialObject(data: Partial<TvSettings>): void;
6
+ protected toJSON(): Partial<TvSettings>;
5
7
  }
@@ -2,6 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TvSettings = void 0;
4
4
  const deviceSettings_1 = require("./deviceSettings");
5
+ const server_1 = require("../../server");
5
6
  class TvSettings extends deviceSettings_1.DeviceSettings {
7
+ fromPartialObject(data) {
8
+ var _a;
9
+ this.automaticTurnOff = (_a = data.automaticTurnOff) !== null && _a !== void 0 ? _a : this.automaticTurnOff;
10
+ super.fromPartialObject(data);
11
+ }
12
+ toJSON() {
13
+ return server_1.Utils.jsonFilter(this);
14
+ }
6
15
  }
7
16
  exports.TvSettings = TvSettings;
@@ -5,4 +5,6 @@ export declare class WindowSettings extends DeviceSettings {
5
5
  * @type {number}
6
6
  */
7
7
  direction?: number;
8
+ fromPartialObject(data: Partial<WindowSettings>): void;
9
+ protected toJSON(): Partial<WindowSettings>;
8
10
  }
@@ -3,5 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WindowSettings = void 0;
4
4
  const deviceSettings_1 = require("./deviceSettings");
5
5
  class WindowSettings extends deviceSettings_1.DeviceSettings {
6
+ fromPartialObject(data) {
7
+ var _a;
8
+ this.direction = (_a = data.direction) !== null && _a !== void 0 ? _a : this.direction;
9
+ super.fromPartialObject(data);
10
+ }
11
+ toJSON() {
12
+ return this;
13
+ }
6
14
  }
7
15
  exports.WindowSettings = WindowSettings;
@@ -12,4 +12,6 @@ export declare class WledSettings extends DimmerSettings {
12
12
  dayPreset?: number;
13
13
  duskPreset?: number;
14
14
  nightPreset?: number;
15
+ fromPartialObject(data: Partial<WledSettings>): void;
16
+ protected toJSON(): Partial<WledSettings>;
15
17
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WledSettings = void 0;
4
4
  const dimmerSettings_1 = require("./dimmerSettings");
5
+ const server_1 = require("../../server");
5
6
  class WledSettings extends dimmerSettings_1.DimmerSettings {
6
7
  constructor() {
7
8
  super(...arguments);
@@ -14,5 +15,24 @@ class WledSettings extends dimmerSettings_1.DimmerSettings {
14
15
  this.nightOn = true;
15
16
  this.nightBrightness = 2;
16
17
  }
18
+ fromPartialObject(data) {
19
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
20
+ this.dayOn = (_a = data.dayOn) !== null && _a !== void 0 ? _a : this.dayOn;
21
+ this.dayBrightness = (_b = data.dayBrightness) !== null && _b !== void 0 ? _b : this.dayBrightness;
22
+ this.dawnOn = (_c = data.dawnOn) !== null && _c !== void 0 ? _c : this.dawnOn;
23
+ this.dawnBrightness = (_d = data.dawnBrightness) !== null && _d !== void 0 ? _d : this.dawnBrightness;
24
+ this.duskOn = (_e = data.duskOn) !== null && _e !== void 0 ? _e : this.duskOn;
25
+ this.duskBrightness = (_f = data.duskBrightness) !== null && _f !== void 0 ? _f : this.duskBrightness;
26
+ this.nightOn = (_g = data.nightOn) !== null && _g !== void 0 ? _g : this.nightOn;
27
+ this.nightBrightness = (_h = data.nightBrightness) !== null && _h !== void 0 ? _h : this.nightBrightness;
28
+ this.dawnPreset = (_j = data.dawnPreset) !== null && _j !== void 0 ? _j : this.dawnPreset;
29
+ this.dayPreset = (_k = data.dayPreset) !== null && _k !== void 0 ? _k : this.dayPreset;
30
+ this.duskPreset = (_l = data.duskPreset) !== null && _l !== void 0 ? _l : this.duskPreset;
31
+ this.nightPreset = (_m = data.nightPreset) !== null && _m !== void 0 ? _m : this.nightPreset;
32
+ super.fromPartialObject(data);
33
+ }
34
+ toJSON() {
35
+ return server_1.Utils.jsonFilter(this);
36
+ }
17
37
  }
18
38
  exports.WledSettings = WledSettings;
@@ -0,0 +1,4 @@
1
+ export declare class idSettings {
2
+ settings: string;
3
+ constructor(settings: string);
4
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.idSettings = void 0;
4
+ class idSettings {
5
+ constructor(settings) {
6
+ this.settings = settings;
7
+ }
8
+ }
9
+ exports.idSettings = idSettings;
@@ -1,6 +1,7 @@
1
1
  export * from './BasicRoomInfo';
2
2
  export * from './DesiredShutterPosition';
3
3
  export * from './EnergyCalculation';
4
+ export * from './idSettings';
4
5
  export * from './RoomDetailInfo';
5
6
  export * from './ShutterCalibration';
6
7
  export * from './temperaturDataPoint';
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./BasicRoomInfo"), exports);
18
18
  __exportStar(require("./DesiredShutterPosition"), exports);
19
19
  __exportStar(require("./EnergyCalculation"), exports);
20
+ __exportStar(require("./idSettings"), exports);
20
21
  __exportStar(require("./RoomDetailInfo"), exports);
21
22
  __exportStar(require("./ShutterCalibration"), exports);
22
23
  __exportStar(require("./temperaturDataPoint"), exports);
@@ -1,7 +1,7 @@
1
1
  /// <reference types="iobroker" />
2
2
  import { iRoomDevice } from './baseDeviceInterfaces';
3
3
  import { LogDebugType } from '../services';
4
- import { LogLevel, RoomBase, RoomDeviceAddingSettings } from '../../models';
4
+ import { DeviceSettings, LogLevel, RoomBase, RoomDeviceAddingSettings } from '../../models';
5
5
  import { IOBrokerConnection } from '../ioBroker';
6
6
  import { DeviceType } from './deviceType';
7
7
  import { IoBrokerDeviceInfo } from './IoBrokerDeviceInfo';
@@ -9,6 +9,7 @@ import { DeviceCapability } from './DeviceCapability';
9
9
  export declare abstract class IoBrokerBaseDevice implements iRoomDevice {
10
10
  protected _info: IoBrokerDeviceInfo;
11
11
  deviceType: DeviceType;
12
+ settings: DeviceSettings | undefined;
12
13
  static roomAddingSettings: {
13
14
  [id: string]: RoomDeviceAddingSettings;
14
15
  };
@@ -34,6 +35,7 @@ export declare abstract class IoBrokerBaseDevice implements iRoomDevice {
34
35
  get ioConn(): IOBrokerConnection | undefined;
35
36
  static addRoom(shortName: string, settings: RoomDeviceAddingSettings): void;
36
37
  static checkMissing(): void;
38
+ loadDeviceSettings(): void;
37
39
  /**
38
40
  * Allows to react on the state change of a given state with the passed cb
39
41
  * @param {string} stateName Last part of the id e.g. "available" not "zigbee.0.00158d00053d3e4b.available"
@@ -8,6 +8,7 @@ class IoBrokerBaseDevice {
8
8
  constructor(_info, deviceType) {
9
9
  this._info = _info;
10
10
  this.deviceType = deviceType;
11
+ this.settings = undefined;
11
12
  this.room = undefined;
12
13
  this.deviceCapabilities = [];
13
14
  this.individualStateCallbacks = new Map();
@@ -54,6 +55,10 @@ class IoBrokerBaseDevice {
54
55
  this.roomAddingSettings[rName].checkMissing();
55
56
  }
56
57
  }
58
+ loadDeviceSettings() {
59
+ var _a;
60
+ (_a = this.settings) === null || _a === void 0 ? void 0 : _a.initializeFromDb(this);
61
+ }
57
62
  /**
58
63
  * Allows to react on the state change of a given state with the passed cb
59
64
  * @param {string} stateName Last part of the id e.g. "available" not "zigbee.0.00158d00053d3e4b.available"
@@ -1,8 +1,8 @@
1
- import { AcSettings } from '../../../models/deviceSettings/acSettings';
1
+ import { AcSettings } from '../../../models';
2
2
  import { AcMode } from '../../services';
3
3
  import { iBaseDevice } from './iBaseDevice';
4
4
  export interface iAcDevice extends iBaseDevice {
5
- acSettings: AcSettings;
5
+ settings: AcSettings;
6
6
  readonly on: boolean;
7
7
  readonly temperature: number;
8
8
  /**
@@ -1,13 +1,15 @@
1
- import { LogLevel } from '../../../models';
1
+ import { DeviceSettings, LogLevel } from '../../../models';
2
2
  import { DeviceType } from '../deviceType';
3
3
  import { DeviceInfo } from '../DeviceInfo';
4
4
  import { DeviceCapability } from '../DeviceCapability';
5
5
  export interface iBaseDevice {
6
+ readonly settings: DeviceSettings | undefined;
6
7
  deviceType: DeviceType;
7
8
  info: DeviceInfo;
8
9
  readonly deviceCapabilities: DeviceCapability[];
9
10
  readonly id: string;
10
11
  log(level: LogLevel, message: string): void;
11
12
  persistDeviceInfo(): void;
13
+ loadDeviceSettings(): void;
12
14
  toJSON(): Partial<iBaseDevice>;
13
15
  }
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { iRoomDevice } from './index';
3
- import { SceneSettings } from '../../../models/deviceSettings/sceneSettings';
3
+ import { SceneSettings } from '../../../models';
4
4
  export interface iScene extends iRoomDevice {
5
5
  description: string;
6
6
  readonly onSceneStart: () => void;
@@ -9,6 +9,7 @@ import { TrackedDistanceData } from './trackedDistanceData';
9
9
  import { iBluetoothDetector } from '../baseDeviceInterfaces/iBluetoothDetector';
10
10
  export declare class DetectedBluetoothDevice implements iBaseDevice {
11
11
  id: string;
12
+ settings: undefined;
12
13
  distanceMap: Map<string, TrackedDistanceData>;
13
14
  readonly deviceCapabilities: DeviceCapability[];
14
15
  deviceType: DeviceType;
@@ -24,4 +25,5 @@ export declare class DetectedBluetoothDevice implements iBaseDevice {
24
25
  static getOrCreate(devName: string): DetectedBluetoothDevice;
25
26
  private static deviceKeyBySettings;
26
27
  persistDeviceInfo(): void;
28
+ loadDeviceSettings(): void;
27
29
  }
@@ -10,6 +10,7 @@ const trackedDistanceData_1 = require("./trackedDistanceData");
10
10
  class DetectedBluetoothDevice {
11
11
  constructor(id, settings) {
12
12
  this.id = id;
13
+ this.settings = undefined;
13
14
  this.distanceMap = new Map();
14
15
  this.deviceCapabilities = [DeviceCapability_1.DeviceCapability.trackableDevice];
15
16
  this.deviceType = deviceType_1.DeviceType.TrackableDevice;
@@ -22,6 +23,7 @@ class DetectedBluetoothDevice {
22
23
  if (settings.activeTracking) {
23
24
  devices_1.Devices.alLDevices[this.info.allDevicesKey] = this;
24
25
  this.persistDeviceInfo();
26
+ this.loadDeviceSettings();
25
27
  }
26
28
  }
27
29
  get name() {
@@ -90,5 +92,8 @@ class DetectedBluetoothDevice {
90
92
  (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.addDevice(this);
91
93
  }, 5000, this);
92
94
  }
95
+ loadDeviceSettings() {
96
+ // Nothing
97
+ }
93
98
  }
94
99
  exports.DetectedBluetoothDevice = DetectedBluetoothDevice;