hoffmation-base 0.1.41-1 → 0.1.41-13

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 (105) hide show
  1. package/lib/index.d.ts +1 -2
  2. package/lib/index.js +5 -4
  3. package/lib/models/deviceSettings/index.d.ts +1 -0
  4. package/lib/models/deviceSettings/index.js +1 -0
  5. package/lib/models/deviceSettings/motionSensorSettings.d.ts +9 -0
  6. package/lib/models/deviceSettings/motionSensorSettings.js +16 -0
  7. package/lib/models/deviceSettings/shutterSettings.d.ts +6 -0
  8. package/lib/models/deviceSettings/shutterSettings.js +6 -0
  9. package/lib/models/rooms/RoomBase.d.ts +7 -17
  10. package/lib/models/rooms/RoomBase.js +27 -32
  11. package/lib/models/rooms/RoomSettings/RoomSettings.js +1 -0
  12. package/lib/models/timeCallback.d.ts +7 -1
  13. package/lib/models/timeCallback.js +16 -10
  14. package/lib/server/devices/Heizgruppen.d.ts +1 -1
  15. package/lib/server/devices/Heizgruppen.js +3 -3
  16. package/lib/server/devices/IoBrokerBaseDevice.d.ts +11 -12
  17. package/lib/server/devices/IoBrokerBaseDevice.js +36 -38
  18. package/lib/server/devices/button.d.ts +1 -1
  19. package/lib/server/devices/button.js +5 -6
  20. package/lib/server/devices/device-cluster.d.ts +5 -4
  21. package/lib/server/devices/device-cluster.js +3 -2
  22. package/lib/server/devices/device-list.d.ts +4 -4
  23. package/lib/server/devices/device-list.js +5 -5
  24. package/lib/server/devices/deviceType.d.ts +1 -0
  25. package/lib/server/devices/deviceType.js +1 -0
  26. package/lib/server/devices/deviceUpdater.js +4 -4
  27. package/lib/server/devices/devices.d.ts +6 -7
  28. package/lib/server/devices/devices.js +78 -108
  29. package/lib/server/devices/groups/Fenster.d.ts +6 -6
  30. package/lib/server/devices/groups/Fenster.js +22 -24
  31. package/lib/server/devices/groups/fensterGroup.d.ts +2 -1
  32. package/lib/server/devices/groups/fensterGroup.js +42 -36
  33. package/lib/server/devices/groups/heatGroup.d.ts +2 -2
  34. package/lib/server/devices/groups/heatGroup.js +8 -8
  35. package/lib/server/devices/groups/lampenGroup.d.ts +3 -4
  36. package/lib/server/devices/groups/lampenGroup.js +12 -12
  37. package/lib/server/devices/groups/praesenzGroup.d.ts +6 -7
  38. package/lib/server/devices/groups/praesenzGroup.js +45 -40
  39. package/lib/server/devices/groups/tasterGroup.d.ts +1 -1
  40. package/lib/server/devices/groups/tasterGroup.js +3 -3
  41. package/lib/server/devices/hmIPDevices/hmIpBewegung.d.ts +12 -8
  42. package/lib/server/devices/hmIPDevices/hmIpBewegung.js +31 -26
  43. package/lib/server/devices/hmIPDevices/hmIpHeizgruppe.d.ts +8 -8
  44. package/lib/server/devices/hmIPDevices/hmIpHeizgruppe.js +40 -43
  45. package/lib/server/devices/hmIPDevices/hmIpLampe.d.ts +1 -2
  46. package/lib/server/devices/hmIPDevices/hmIpLampe.js +11 -13
  47. package/lib/server/devices/hmIPDevices/hmIpPraezenz.d.ts +5 -5
  48. package/lib/server/devices/hmIPDevices/hmIpPraezenz.js +17 -17
  49. package/lib/server/devices/iBaseDevice.d.ts +11 -0
  50. package/lib/server/devices/iBaseDevice.js +2 -0
  51. package/lib/server/devices/iButtonSwitch.d.ts +2 -2
  52. package/lib/server/devices/iEnergyManager.d.ts +18 -2
  53. package/lib/server/devices/iEnergyManager.js +28 -0
  54. package/lib/server/devices/iExcessEnergyConsumer.d.ts +3 -3
  55. package/lib/server/devices/iHeater.d.ts +3 -3
  56. package/lib/server/devices/iHumiditySensor.d.ts +2 -2
  57. package/lib/server/devices/iLamp.d.ts +3 -5
  58. package/lib/server/devices/iMotionSensor.d.ts +13 -0
  59. package/lib/server/devices/iMotionSensor.js +2 -0
  60. package/lib/server/devices/iShutter.d.ts +3 -3
  61. package/lib/server/devices/iTemperaturSensor.d.ts +2 -2
  62. package/lib/server/devices/iVibrationSensor.d.ts +9 -0
  63. package/lib/server/devices/iVibrationSensor.js +2 -0
  64. package/lib/server/devices/index.d.ts +3 -0
  65. package/lib/server/devices/index.js +3 -0
  66. package/lib/server/devices/jsObject/jsObjectEnergyManager.d.ts +36 -24
  67. package/lib/server/devices/jsObject/jsObjectEnergyManager.js +79 -39
  68. package/lib/server/devices/zigbee/index.d.ts +1 -0
  69. package/lib/server/devices/zigbee/index.js +1 -0
  70. package/lib/server/devices/zigbee/zigbeeAquaraMotion.d.ts +4 -4
  71. package/lib/server/devices/zigbee/zigbeeAquaraMotion.js +15 -16
  72. package/lib/server/devices/zigbee/zigbeeAquaraVibra.d.ts +11 -5
  73. package/lib/server/devices/zigbee/zigbeeAquaraVibra.js +48 -32
  74. package/lib/server/devices/zigbee/zigbeeIlluDimmer.d.ts +1 -2
  75. package/lib/server/devices/zigbee/zigbeeIlluDimmer.js +23 -25
  76. package/lib/server/devices/zigbee/zigbeeIlluLampe.d.ts +2 -2
  77. package/lib/server/devices/zigbee/zigbeeIlluLampe.js +7 -8
  78. package/lib/server/devices/zigbee/zigbeeIlluLedRGBCCT.d.ts +1 -2
  79. package/lib/server/devices/zigbee/zigbeeIlluLedRGBCCT.js +18 -20
  80. package/lib/server/devices/zigbee/zigbeeIlluShutter.d.ts +0 -2
  81. package/lib/server/devices/zigbee/zigbeeIlluShutter.js +26 -24
  82. package/lib/server/devices/zigbee/zigbeeMotionSensor.d.ts +8 -6
  83. package/lib/server/devices/zigbee/zigbeeMotionSensor.js +22 -21
  84. package/lib/server/devices/zigbee/zigbeeShutter.d.ts +13 -11
  85. package/lib/server/devices/zigbee/zigbeeShutter.js +43 -34
  86. package/lib/server/devices/zigbee/zigbeeUbisysShutter.d.ts +9 -0
  87. package/lib/server/devices/zigbee/zigbeeUbisysShutter.js +26 -0
  88. package/lib/server/services/ShutterService.d.ts +1 -2
  89. package/lib/server/services/ShutterService.js +6 -5
  90. package/lib/server/services/Telegram/telegram-service.d.ts +1 -1
  91. package/lib/server/services/Telegram/telegram-service.js +13 -11
  92. package/lib/server/services/api/api-service.d.ts +5 -5
  93. package/lib/server/services/api/api-service.js +5 -5
  94. package/lib/server/services/calendar/m/303/274ll-service.d.ts +4 -4
  95. package/lib/server/services/calendar/m/303/274ll-service.js +18 -14
  96. package/lib/server/services/dbo/postgreSqlPersist.d.ts +9 -9
  97. package/lib/server/services/dbo/postgreSqlPersist.js +13 -13
  98. package/lib/server/services/room-service/room-service.d.ts +5 -6
  99. package/lib/server/services/room-service/room-service.js +29 -30
  100. package/lib/server/services/time-callback-service.d.ts +9 -15
  101. package/lib/server/services/time-callback-service.js +39 -45
  102. package/lib/server/services/utils/utils.d.ts +2 -0
  103. package/lib/server/services/utils/utils.js +6 -10
  104. package/lib/tsconfig.tsbuildinfo +1 -1
  105. package/package.json +14 -14
@@ -1,22 +1,26 @@
1
1
  /// <reference types="iobroker" />
2
2
  import { HmIPDevice } from './hmIpDevice';
3
+ import { MotionSensorSettings } from '../../../models';
3
4
  import { DeviceInfo } from '../DeviceInfo';
4
5
  import { iIlluminationSensor } from '../iIlluminationSensor';
5
- export declare class HmIpBewegung extends HmIPDevice implements iIlluminationSensor {
6
- excludeFromNightAlarm: boolean;
7
- movementDetected: boolean;
8
- private _detectionsToday;
9
- private _movementDetectedCallback;
6
+ import { iMotionSensor } from '../iMotionSensor';
7
+ export declare class HmIpBewegung extends HmIPDevice implements iIlluminationSensor, iMotionSensor {
10
8
  private static MOVEMENT_DETECTION;
11
9
  private static CURRENT_ILLUMINATION;
10
+ settings: MotionSensorSettings;
11
+ movementDetected: boolean;
12
+ private _movementDetectedCallback;
12
13
  private initialized;
13
14
  private _fallBackTimeout;
15
+ private _lastMotionTime;
16
+ constructor(pInfo: DeviceInfo);
17
+ get timeSinceLastMotion(): number;
18
+ private _detectionsToday;
19
+ get detectionsToday(): number;
20
+ set detectionsToday(pVal: number);
14
21
  private _currentIllumination;
15
22
  get currentIllumination(): number;
16
23
  private set currentIllumination(value);
17
- get detectionsToday(): number;
18
- set detectionsToday(pVal: number);
19
- constructor(pInfo: DeviceInfo);
20
24
  addMovementCallback(pCallback: (pValue: boolean) => void): void;
21
25
  update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
22
26
  updateMovement(pVal: boolean): void;
@@ -3,49 +3,53 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HmIpBewegung = void 0;
4
4
  const hmIpDevice_1 = require("./hmIpDevice");
5
5
  const deviceType_1 = require("../deviceType");
6
- const utils_1 = require("../../services/utils/utils");
7
- const CurrentIlluminationDataPoint_1 = require("../../../models/persistence/CurrentIlluminationDataPoint");
8
- const logLevel_1 = require("../../../models/logLevel");
9
- const index_1 = require("../../../index");
6
+ const models_1 = require("../../../models");
7
+ const services_1 = require("../../services");
10
8
  class HmIpBewegung extends hmIpDevice_1.HmIPDevice {
11
9
  constructor(pInfo) {
10
+ var _a;
12
11
  super(pInfo, deviceType_1.DeviceType.HmIpBewegung);
13
- this.excludeFromNightAlarm = false;
12
+ this.settings = new models_1.MotionSensorSettings();
14
13
  this.movementDetected = false;
15
- this._detectionsToday = 0;
16
14
  this._movementDetectedCallback = [];
17
15
  this.initialized = false;
16
+ this._lastMotionTime = 0;
17
+ this._detectionsToday = 0;
18
18
  this._currentIllumination = -1;
19
- index_1.dbo === null || index_1.dbo === void 0 ? void 0 : index_1.dbo.getCount(this).then((todayCount) => {
19
+ (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.getCount(this).then((todayCount) => {
20
20
  this.detectionsToday = todayCount.counter;
21
- this.log(logLevel_1.LogLevel.Debug, `Bewegungscounter vorinitialisiert mit ${this.detectionsToday}`);
21
+ this.log(models_1.LogLevel.Debug, `Bewegungscounter vorinitialisiert mit ${this.detectionsToday}`);
22
22
  this.initialized = true;
23
23
  }).catch((err) => {
24
24
  var _a;
25
- this.log(logLevel_1.LogLevel.Warn, `Failed to initialize Movement Counter, err ${(_a = err === null || err === void 0 ? void 0 : err.message) !== null && _a !== void 0 ? _a : err}`);
25
+ this.log(models_1.LogLevel.Warn, `Failed to initialize Movement Counter, err ${(_a = err === null || err === void 0 ? void 0 : err.message) !== null && _a !== void 0 ? _a : err}`);
26
26
  });
27
27
  }
28
- get currentIllumination() {
29
- return this._currentIllumination;
30
- }
31
- set currentIllumination(value) {
32
- var _a, _b, _c;
33
- this._currentIllumination = value;
34
- index_1.dbo === null || index_1.dbo === void 0 ? void 0 : index_1.dbo.persistCurrentIllumination(new CurrentIlluminationDataPoint_1.CurrentIlluminationDataPoint(this.info.room, this.info.devID, value, new Date(), (_c = (_b = (_a = this.room) === null || _a === void 0 ? void 0 : _a.LampenGroup) === null || _b === void 0 ? void 0 : _b.anyLightsOwn()) !== null && _c !== void 0 ? _c : false));
28
+ get timeSinceLastMotion() {
29
+ return Math.floor((services_1.Utils.nowMS() - this._lastMotionTime) / 1000);
35
30
  }
36
31
  get detectionsToday() {
37
32
  return this._detectionsToday;
38
33
  }
39
34
  set detectionsToday(pVal) {
35
+ var _a;
40
36
  const oldVal = this._detectionsToday;
41
37
  this._detectionsToday = pVal;
42
- index_1.dbo === null || index_1.dbo === void 0 ? void 0 : index_1.dbo.persistTodayCount(this, pVal, oldVal);
38
+ (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistTodayCount(this, pVal, oldVal);
39
+ }
40
+ get currentIllumination() {
41
+ return this._currentIllumination;
42
+ }
43
+ set currentIllumination(value) {
44
+ var _a, _b, _c, _d;
45
+ this._currentIllumination = value;
46
+ (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistCurrentIllumination(new models_1.CurrentIlluminationDataPoint(this.info.room, this.info.devID, value, new Date(), (_d = (_c = (_b = this.room) === null || _b === void 0 ? void 0 : _b.LampenGroup) === null || _c === void 0 ? void 0 : _c.anyLightsOwn()) !== null && _d !== void 0 ? _d : false));
43
47
  }
44
48
  addMovementCallback(pCallback) {
45
49
  this._movementDetectedCallback.push(pCallback);
46
50
  }
47
51
  update(idSplit, state, initial = false) {
48
- this.log(logLevel_1.LogLevel.DeepTrace, `Bewegungs Update: JSON: ${JSON.stringify(state)}ID: ${idSplit.join('.')}`);
52
+ this.log(models_1.LogLevel.DeepTrace, `Bewegungs Update: JSON: ${JSON.stringify(state)}ID: ${idSplit.join('.')}`);
49
53
  super.update(idSplit, state, initial, true);
50
54
  if (idSplit[3] !== '3') {
51
55
  // Nur die Infos in Kanal 3 sind relevant
@@ -62,14 +66,14 @@ class HmIpBewegung extends hmIpDevice_1.HmIPDevice {
62
66
  }
63
67
  updateMovement(pVal) {
64
68
  if (!this.initialized && pVal) {
65
- this.log(logLevel_1.LogLevel.Trace, `Bewegung erkannt aber die Initialisierung aus der DB ist noch nicht erfolgt --> verzögern`);
66
- utils_1.Utils.guardedTimeout(() => {
69
+ this.log(models_1.LogLevel.Trace, `Bewegung erkannt aber die Initialisierung aus der DB ist noch nicht erfolgt --> verzögern`);
70
+ services_1.Utils.guardedTimeout(() => {
67
71
  this.updateMovement(pVal);
68
72
  }, 1000, this);
69
73
  return;
70
74
  }
71
75
  if (pVal === this.movementDetected) {
72
- this.log(logLevel_1.LogLevel.Debug, `Überspringe Bewegung da bereits der Wert ${pVal} vorliegt`);
76
+ this.log(models_1.LogLevel.Debug, `Überspringe Bewegung da bereits der Wert ${pVal} vorliegt`);
73
77
  if (pVal) {
74
78
  this.resetFallbackTimeout();
75
79
  this.startFallbackTimeout();
@@ -78,11 +82,12 @@ class HmIpBewegung extends hmIpDevice_1.HmIPDevice {
78
82
  }
79
83
  this.resetFallbackTimeout();
80
84
  this.movementDetected = pVal;
81
- this.log(logLevel_1.LogLevel.Debug, `Neuer Bewegunsstatus Wert : ${pVal}`);
85
+ this.log(models_1.LogLevel.Debug, `Neuer Bewegunsstatus Wert : ${pVal}`);
82
86
  if (pVal) {
83
87
  this.startFallbackTimeout();
84
88
  this.detectionsToday++;
85
- this.log(logLevel_1.LogLevel.Trace, `Dies ist die ${this.detectionsToday} Bewegung `);
89
+ this._lastMotionTime = services_1.Utils.nowMS();
90
+ this.log(models_1.LogLevel.Trace, `Dies ist die ${this.detectionsToday} Bewegung `);
86
91
  }
87
92
  for (const c of this._movementDetectedCallback) {
88
93
  c(pVal);
@@ -90,13 +95,13 @@ class HmIpBewegung extends hmIpDevice_1.HmIPDevice {
90
95
  }
91
96
  resetFallbackTimeout() {
92
97
  if (this._fallBackTimeout) {
93
- this.log(logLevel_1.LogLevel.Trace, `Fallback Timeout zurücksetzen`);
98
+ this.log(models_1.LogLevel.Trace, `Fallback Timeout zurücksetzen`);
94
99
  clearTimeout(this._fallBackTimeout);
95
100
  }
96
101
  }
97
102
  startFallbackTimeout() {
98
- this._fallBackTimeout = utils_1.Utils.guardedTimeout(() => {
99
- this.log(logLevel_1.LogLevel.Debug, `Benötige Fallback Bewegungs Reset `);
103
+ this._fallBackTimeout = services_1.Utils.guardedTimeout(() => {
104
+ this.log(models_1.LogLevel.Debug, `Benötige Fallback Bewegungs Reset `);
100
105
  this._fallBackTimeout = undefined;
101
106
  this.updateMovement(false);
102
107
  }, 270000, this);
@@ -1,7 +1,7 @@
1
1
  /// <reference types="iobroker" />
2
2
  import { HmIPDevice } from './hmIpDevice';
3
3
  import { DeviceInfo } from '../DeviceInfo';
4
- import { TemperaturSettings } from '../../../models/temperaturSettings';
4
+ import { TemperaturSettings } from '../../../models';
5
5
  import { iTemperaturSensor } from '../iTemperaturSensor';
6
6
  import { iHumiditySensor } from '../iHumiditySensor';
7
7
  import { iHeater } from '../iHeater';
@@ -10,27 +10,27 @@ export declare class HmIpHeizgruppe extends HmIPDevice implements iTemperaturSen
10
10
  private _iAutomaticInterval;
11
11
  private _level;
12
12
  private _temperatur;
13
- private _humidity;
14
- private _desiredTemperatur;
15
13
  private _setPointTemperaturID;
16
14
  private _automaticFallBackTemperatur;
17
15
  private _automaticPoints;
18
16
  private _humidityCallbacks;
19
17
  constructor(pInfo: DeviceInfo);
20
- get sLevel(): string;
21
- get iLevel(): number;
22
- get sTemperatur(): string;
23
- get iTemperatur(): number;
18
+ private _humidity;
24
19
  get humidity(): number;
25
20
  private set humidity(value);
21
+ private _desiredTemperatur;
26
22
  get desiredTemperatur(): number;
27
23
  set desiredTemperatur(val: number);
24
+ get sLevel(): string;
25
+ get iLevel(): number;
26
+ get sTemperatur(): string;
27
+ get iTemperatur(): number;
28
28
  addHumidityCallback(pCallback: (pValue: number) => void): void;
29
29
  deleteAutomaticPoint(name: string): void;
30
30
  getBelongingHeizungen(): iHeater[];
31
31
  setAutomaticPoint(name: string, setting: TemperaturSettings): void;
32
32
  update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
33
33
  stopAutomaticCheck(): void;
34
- private updateBaseInformation;
35
34
  checkAutomaticChange(): void;
35
+ private updateBaseInformation;
36
36
  }
@@ -3,37 +3,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HmIpHeizgruppe = void 0;
4
4
  const hmIpDevice_1 = require("./hmIpDevice");
5
5
  const deviceType_1 = require("../deviceType");
6
- const utils_1 = require("../../services/utils/utils");
7
- const temperaturSettings_1 = require("../../../models/temperaturSettings");
8
- const logLevel_1 = require("../../../models/logLevel");
6
+ const services_1 = require("../../services");
7
+ const models_1 = require("../../../models");
9
8
  const device_cluster_type_1 = require("../device-cluster-type");
10
- const index_1 = require("../../../index");
11
9
  class HmIpHeizgruppe extends hmIpDevice_1.HmIPDevice {
12
10
  constructor(pInfo) {
13
11
  super(pInfo, deviceType_1.DeviceType.HmIpHeizgruppe);
14
12
  this._automaticMode = true;
15
13
  this._level = 0;
16
14
  this._temperatur = 0;
17
- this._humidity = 0;
18
- this._desiredTemperatur = 0;
19
15
  this._setPointTemperaturID = '';
20
16
  this._automaticFallBackTemperatur = 20;
21
17
  this._automaticPoints = {};
22
18
  this._humidityCallbacks = [];
19
+ this._humidity = 0;
20
+ this._desiredTemperatur = 0;
23
21
  this._setPointTemperaturID = `${this.info.fullID}.1.SET_POINT_TEMPERATURE`;
24
- this._iAutomaticInterval = utils_1.Utils.guardedInterval(this.checkAutomaticChange, 300000, this); // Alle 5 Minuten prüfen
25
- }
26
- get sLevel() {
27
- return `${this._level * 100}%`;
28
- }
29
- get iLevel() {
30
- return this._level;
31
- }
32
- get sTemperatur() {
33
- return `${this._temperatur}°C`;
34
- }
35
- get iTemperatur() {
36
- return this._temperatur;
22
+ this._iAutomaticInterval = services_1.Utils.guardedInterval(this.checkAutomaticChange, 300000, this); // Alle 5 Minuten prüfen
37
23
  }
38
24
  get humidity() {
39
25
  return this._humidity;
@@ -49,11 +35,23 @@ class HmIpHeizgruppe extends hmIpDevice_1.HmIPDevice {
49
35
  }
50
36
  set desiredTemperatur(val) {
51
37
  this.setState(this._setPointTemperaturID, val, () => {
52
- this.log(logLevel_1.LogLevel.Info, `Changed temperature of to "${val}.`);
38
+ this.log(models_1.LogLevel.Info, `Changed temperature of to "${val}.`);
53
39
  }, (err) => {
54
- this.log(logLevel_1.LogLevel.Error, `Temperaturänderung ergab Fehler ${err}.`);
40
+ this.log(models_1.LogLevel.Error, `Temperaturänderung ergab Fehler ${err}.`);
55
41
  });
56
42
  }
43
+ get sLevel() {
44
+ return `${this._level * 100}%`;
45
+ }
46
+ get iLevel() {
47
+ return this._level;
48
+ }
49
+ get sTemperatur() {
50
+ return `${this._temperatur}°C`;
51
+ }
52
+ get iTemperatur() {
53
+ return this._temperatur;
54
+ }
57
55
  addHumidityCallback(pCallback) {
58
56
  this._humidityCallbacks.push(pCallback);
59
57
  if (this._humidity > 0) {
@@ -68,14 +66,13 @@ class HmIpHeizgruppe extends hmIpDevice_1.HmIPDevice {
68
66
  if (!this.room) {
69
67
  return [];
70
68
  }
71
- const result = this.room.deviceCluster.getDevicesByType(device_cluster_type_1.DeviceClusterType.Heater);
72
- return result;
69
+ return this.room.deviceCluster.getDevicesByType(device_cluster_type_1.DeviceClusterType.Heater);
73
70
  }
74
71
  setAutomaticPoint(name, setting) {
75
72
  this._automaticPoints[name] = setting;
76
73
  }
77
74
  update(idSplit, state, initial = false) {
78
- this.log(logLevel_1.LogLevel.DeepTrace, `Heizgruppe Update: ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`);
75
+ this.log(models_1.LogLevel.DeepTrace, `Heizgruppe Update: ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`);
79
76
  super.update(idSplit, state, initial, true);
80
77
  switch (idSplit[3]) {
81
78
  case '1':
@@ -89,6 +86,24 @@ class HmIpHeizgruppe extends hmIpDevice_1.HmIPDevice {
89
86
  this._iAutomaticInterval = undefined;
90
87
  }
91
88
  }
89
+ checkAutomaticChange() {
90
+ var _a, _b, _c;
91
+ if (!this._automaticMode) {
92
+ (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.addTemperaturDataPoint(this);
93
+ return;
94
+ }
95
+ const setting = models_1.TemperaturSettings.getActiveSetting(this._automaticPoints, new Date());
96
+ if (setting === undefined) {
97
+ this.log(models_1.LogLevel.Warn, `Undefined Heating Timestamp.`);
98
+ this.desiredTemperatur = this._automaticFallBackTemperatur;
99
+ return;
100
+ }
101
+ if (this._desiredTemperatur !== setting.temperatur) {
102
+ this.log(models_1.LogLevel.Debug, `Automatische Temperaturanpassung für ${this.info.customName} auf ${setting.temperatur}°C`);
103
+ this.desiredTemperatur = (_b = setting.temperatur) !== null && _b !== void 0 ? _b : this._automaticFallBackTemperatur;
104
+ }
105
+ (_c = services_1.Utils.dbo) === null || _c === void 0 ? void 0 : _c.addTemperaturDataPoint(this);
106
+ }
92
107
  updateBaseInformation(name, state) {
93
108
  switch (name) {
94
109
  case 'ACTUAL_TEMPERATURE':
@@ -101,28 +116,10 @@ class HmIpHeizgruppe extends hmIpDevice_1.HmIPDevice {
101
116
  this.humidity = state.val;
102
117
  break;
103
118
  case 'SET_POINT_TEMPERATURE':
104
- this.log(logLevel_1.LogLevel.DeepTrace, `Heizgruppe Update Soll-Temperatur JSON: ${JSON.stringify(state)}`);
119
+ this.log(models_1.LogLevel.DeepTrace, `Heizgruppe Update Soll-Temperatur JSON: ${JSON.stringify(state)}`);
105
120
  this._desiredTemperatur = state.val;
106
121
  break;
107
122
  }
108
123
  }
109
- checkAutomaticChange() {
110
- var _a;
111
- if (!this._automaticMode) {
112
- index_1.dbo === null || index_1.dbo === void 0 ? void 0 : index_1.dbo.addTemperaturDataPoint(this);
113
- return;
114
- }
115
- const setting = temperaturSettings_1.TemperaturSettings.getActiveSetting(this._automaticPoints, new Date());
116
- if (setting === undefined) {
117
- this.log(logLevel_1.LogLevel.Warn, `Undefined Heating Timestamp.`);
118
- this.desiredTemperatur = this._automaticFallBackTemperatur;
119
- return;
120
- }
121
- if (this._desiredTemperatur !== setting.temperatur) {
122
- this.log(logLevel_1.LogLevel.Debug, `Automatische Temperaturanpassung für ${this.info.customName} auf ${setting.temperatur}°C`);
123
- this.desiredTemperatur = (_a = setting.temperatur) !== null && _a !== void 0 ? _a : this._automaticFallBackTemperatur;
124
- }
125
- index_1.dbo === null || index_1.dbo === void 0 ? void 0 : index_1.dbo.addTemperaturDataPoint(this);
126
- }
127
124
  }
128
125
  exports.HmIpHeizgruppe = HmIpHeizgruppe;
@@ -1,9 +1,8 @@
1
1
  /// <reference types="iobroker" />
2
2
  import { HmIPDevice } from './hmIpDevice';
3
- import { ActuatorSettings } from '../../../models';
3
+ import { ActuatorSettings, TimeOfDay } from '../../../models';
4
4
  import { DeviceInfo } from '../DeviceInfo';
5
5
  import { iLamp } from '../iLamp';
6
- import { TimeOfDay } from '../../services';
7
6
  export declare class HmIpLampe extends HmIPDevice implements iLamp {
8
7
  lightOn: boolean;
9
8
  queuedLightValue: boolean | null;
@@ -5,8 +5,6 @@ const hmIpDevice_1 = require("./hmIpDevice");
5
5
  const deviceType_1 = require("../deviceType");
6
6
  const services_1 = require("../../services");
7
7
  const models_1 = require("../../../models");
8
- const models_2 = require("../../../models");
9
- const services_2 = require("../../services");
10
8
  class HmIpLampe extends hmIpDevice_1.HmIPDevice {
11
9
  constructor(pInfo) {
12
10
  super(pInfo, deviceType_1.DeviceType.HmIpLampe);
@@ -19,7 +17,7 @@ class HmIpLampe extends hmIpDevice_1.HmIPDevice {
19
17
  this.lightOnSwitchID = `${this.info.fullID}.2.STATE`;
20
18
  }
21
19
  update(idSplit, state, initial = false) {
22
- this.log(models_2.LogLevel.DeepTrace, `Lampen Update : ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`);
20
+ this.log(models_1.LogLevel.DeepTrace, `Lampen Update : ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`);
23
21
  super.update(idSplit, state, initial, true);
24
22
  this.queuedLightValue = null;
25
23
  switch (idSplit[3]) {
@@ -33,20 +31,20 @@ class HmIpLampe extends hmIpDevice_1.HmIPDevice {
33
31
  /** @inheritdoc */
34
32
  setLight(pValue, timeout = -1, force = false) {
35
33
  if (!force && pValue === this.lightOn && this.queuedLightValue === null) {
36
- this.log(models_2.LogLevel.DeepTrace, `Skip light command as it is already ${pValue}`);
34
+ this.log(models_1.LogLevel.DeepTrace, `Skip light command as it is already ${pValue}`);
37
35
  return;
38
36
  }
39
37
  if (this.lightOnSwitchID === '') {
40
- this.log(models_2.LogLevel.Error, `Keine Switch ID bekannt.`);
38
+ this.log(models_1.LogLevel.Error, `Keine Switch ID bekannt.`);
41
39
  return;
42
40
  }
43
41
  if (!force && services_1.Utils.nowMS() < this.turnOffTime) {
44
- this.log(models_2.LogLevel.Debug, `Skip automatic command to ${pValue} as it is locked until ${new Date(this.turnOffTime).toLocaleString()}`);
42
+ this.log(models_1.LogLevel.Debug, `Skip automatic command to ${pValue} as it is locked until ${new Date(this.turnOffTime).toLocaleString()}`);
45
43
  return;
46
44
  }
47
- this.log(models_2.LogLevel.Debug, `Lampe schalten Wert: ${pValue}`);
45
+ this.log(models_1.LogLevel.Debug, `Lampe schalten Wert: ${pValue}`);
48
46
  this.setState(this.lightOnSwitchID, pValue, undefined, (err) => {
49
- this.log(models_2.LogLevel.Error, `Lampe schalten ergab Fehler: ${err}`);
47
+ this.log(models_1.LogLevel.Error, `Lampe schalten ergab Fehler: ${err}`);
50
48
  });
51
49
  this.queuedLightValue = pValue;
52
50
  if (this.settings.isStromStoss) {
@@ -67,7 +65,7 @@ class HmIpLampe extends hmIpDevice_1.HmIPDevice {
67
65
  }
68
66
  this.turnOffTime = services_1.Utils.nowMS() + timeout;
69
67
  this._turnOffTimeout = services_1.Utils.guardedTimeout(() => {
70
- this.log(models_2.LogLevel.Debug, `Delayed Turnoff initiated`);
68
+ this.log(models_1.LogLevel.Debug, `Delayed Turnoff initiated`);
71
69
  this._turnOffTimeout = undefined;
72
70
  if (!this.room) {
73
71
  this.setLight(false, -1, true);
@@ -82,7 +80,7 @@ class HmIpLampe extends hmIpDevice_1.HmIPDevice {
82
80
  const newVal = this.queuedLightValue !== null ? !this.queuedLightValue : !this.lightOn;
83
81
  const timeout = newVal && force ? 30 * 60 * 1000 : -1;
84
82
  if (newVal && time === undefined && calculateTime && this.room !== undefined) {
85
- time = services_2.TimeCallbackService.dayType((_a = this.room) === null || _a === void 0 ? void 0 : _a.settings.lampOffset);
83
+ time = services_1.TimeCallbackService.dayType((_a = this.room) === null || _a === void 0 ? void 0 : _a.settings.lampOffset);
86
84
  }
87
85
  if (newVal && time !== undefined) {
88
86
  this.setTimeBased(time, timeout, force);
@@ -92,9 +90,9 @@ class HmIpLampe extends hmIpDevice_1.HmIPDevice {
92
90
  return newVal;
93
91
  }
94
92
  setTimeBased(time, timeout = -1, force = false) {
95
- if ((time === services_2.TimeOfDay.Night && this.settings.nightOn) ||
96
- (time === services_2.TimeOfDay.BeforeSunrise && this.settings.dawnOn) ||
97
- (time === services_2.TimeOfDay.AfterSunset && this.settings.duskOn)) {
93
+ if ((time === models_1.TimeOfDay.Night && this.settings.nightOn) ||
94
+ (time === models_1.TimeOfDay.BeforeSunrise && this.settings.dawnOn) ||
95
+ (time === models_1.TimeOfDay.AfterSunset && this.settings.duskOn)) {
98
96
  this.setLight(true, timeout, force);
99
97
  }
100
98
  }
@@ -3,19 +3,19 @@ import { HmIPDevice } from './hmIpDevice';
3
3
  import { DeviceInfo } from '../DeviceInfo';
4
4
  import { iIlluminationSensor } from '../iIlluminationSensor';
5
5
  export declare class HmIpPraezenz extends HmIPDevice implements iIlluminationSensor {
6
+ private static PRESENCE_DETECTION;
7
+ private static CURRENT_ILLUMINATION;
6
8
  excludeFromNightAlarm: boolean;
7
9
  presenceDetected: boolean;
8
- private _detectionsToday;
9
10
  private _presenceDetectedCallback;
10
- private static PRESENCE_DETECTION;
11
- private static CURRENT_ILLUMINATION;
12
11
  private initialized;
13
- private _currentIllumination;
12
+ constructor(pInfo: DeviceInfo);
13
+ private _detectionsToday;
14
14
  get detectionsToday(): number;
15
15
  set detectionsToday(pVal: number);
16
+ private _currentIllumination;
16
17
  get currentIllumination(): number;
17
18
  private set currentIllumination(value);
18
- constructor(pInfo: DeviceInfo);
19
19
  addPresenceCallback(pCallback: (pValue: boolean) => void): void;
20
20
  update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
21
21
  updatePresence(pVal: boolean): void;
@@ -3,51 +3,51 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HmIpPraezenz = void 0;
4
4
  const hmIpDevice_1 = require("./hmIpDevice");
5
5
  const deviceType_1 = require("../deviceType");
6
- const utils_1 = require("../../services/utils/utils");
7
- const CurrentIlluminationDataPoint_1 = require("../../../models/persistence/CurrentIlluminationDataPoint");
8
- const logLevel_1 = require("../../../models/logLevel");
9
- const index_1 = require("../../../index");
6
+ const models_1 = require("../../../models");
7
+ const services_1 = require("../../services");
10
8
  class HmIpPraezenz extends hmIpDevice_1.HmIPDevice {
11
9
  constructor(pInfo) {
10
+ var _a;
12
11
  super(pInfo, deviceType_1.DeviceType.HmIpPraezenz);
13
12
  this.excludeFromNightAlarm = false;
14
13
  this.presenceDetected = false;
15
- this._detectionsToday = 0;
16
14
  this._presenceDetectedCallback = [];
17
15
  // private presenceStateID: string;
18
16
  this.initialized = false;
17
+ this._detectionsToday = 0;
19
18
  this._currentIllumination = -1;
20
19
  // this.presenceStateID = `${this.info.fullID}.1.${HmIpPraezenz.PRESENCE_DETECTION}`;
21
- index_1.dbo === null || index_1.dbo === void 0 ? void 0 : index_1.dbo.getCount(this).then((todayCount) => {
20
+ (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.getCount(this).then((todayCount) => {
22
21
  this.detectionsToday = todayCount.counter;
23
- this.log(logLevel_1.LogLevel.Debug, `Präsenzcounter vorinitialisiert mit ${this.detectionsToday}`);
22
+ this.log(models_1.LogLevel.Debug, `Präsenzcounter vorinitialisiert mit ${this.detectionsToday}`);
24
23
  this.initialized = true;
25
24
  }).catch((err) => {
26
25
  var _a;
27
- this.log(logLevel_1.LogLevel.Warn, `Failed to initialize Movement Counter, err ${(_a = err === null || err === void 0 ? void 0 : err.message) !== null && _a !== void 0 ? _a : err}`);
26
+ this.log(models_1.LogLevel.Warn, `Failed to initialize Movement Counter, err ${(_a = err === null || err === void 0 ? void 0 : err.message) !== null && _a !== void 0 ? _a : err}`);
28
27
  });
29
28
  }
30
29
  get detectionsToday() {
31
30
  return this._detectionsToday;
32
31
  }
33
32
  set detectionsToday(pVal) {
33
+ var _a;
34
34
  const oldVal = this._detectionsToday;
35
35
  this._detectionsToday = pVal;
36
- index_1.dbo === null || index_1.dbo === void 0 ? void 0 : index_1.dbo.persistTodayCount(this, pVal, oldVal);
36
+ (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistTodayCount(this, pVal, oldVal);
37
37
  }
38
38
  get currentIllumination() {
39
39
  return this._currentIllumination;
40
40
  }
41
41
  set currentIllumination(value) {
42
- var _a, _b, _c;
42
+ var _a, _b, _c, _d;
43
43
  this._currentIllumination = value;
44
- index_1.dbo === null || index_1.dbo === void 0 ? void 0 : index_1.dbo.persistCurrentIllumination(new CurrentIlluminationDataPoint_1.CurrentIlluminationDataPoint(this.info.room, this.info.devID, value, new Date(), (_c = (_b = (_a = this.room) === null || _a === void 0 ? void 0 : _a.LampenGroup) === null || _b === void 0 ? void 0 : _b.anyLightsOwn()) !== null && _c !== void 0 ? _c : false));
44
+ (_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistCurrentIllumination(new models_1.CurrentIlluminationDataPoint(this.info.room, this.info.devID, value, new Date(), (_d = (_c = (_b = this.room) === null || _b === void 0 ? void 0 : _b.LampenGroup) === null || _c === void 0 ? void 0 : _c.anyLightsOwn()) !== null && _d !== void 0 ? _d : false));
45
45
  }
46
46
  addPresenceCallback(pCallback) {
47
47
  this._presenceDetectedCallback.push(pCallback);
48
48
  }
49
49
  update(idSplit, state, initial = false) {
50
- this.log(logLevel_1.LogLevel.DeepTrace, `Präzens Update: JSON: ${JSON.stringify(state)}ID: ${idSplit.join('.')}`);
50
+ this.log(models_1.LogLevel.DeepTrace, `Präzens Update: JSON: ${JSON.stringify(state)}ID: ${idSplit.join('.')}`);
51
51
  super.update(idSplit, state, initial, true);
52
52
  if (idSplit[3] !== '1') {
53
53
  // Nur die Infos in Kanal 1 sind relevant
@@ -64,21 +64,21 @@ class HmIpPraezenz extends hmIpDevice_1.HmIPDevice {
64
64
  }
65
65
  updatePresence(pVal) {
66
66
  if (!this.initialized && pVal) {
67
- this.log(logLevel_1.LogLevel.Debug, `Präsenz erkannt aber die Initialisierung aus der DB ist noch nicht erfolgt --> verzögern`);
68
- utils_1.Utils.guardedTimeout(() => {
67
+ this.log(models_1.LogLevel.Debug, `Präsenz erkannt aber die Initialisierung aus der DB ist noch nicht erfolgt --> verzögern`);
68
+ services_1.Utils.guardedTimeout(() => {
69
69
  this.updatePresence(pVal);
70
70
  }, 1000, this);
71
71
  return;
72
72
  }
73
73
  if (pVal === this.presenceDetected) {
74
- this.log(logLevel_1.LogLevel.Debug, `Überspringe Präsenz da bereits der Wert ${pVal} vorliegt`);
74
+ this.log(models_1.LogLevel.Debug, `Überspringe Präsenz da bereits der Wert ${pVal} vorliegt`);
75
75
  return;
76
76
  }
77
77
  this.presenceDetected = pVal;
78
- this.log(logLevel_1.LogLevel.Debug, `Neuer Präsenzstatus Wert : ${pVal}`);
78
+ this.log(models_1.LogLevel.Debug, `Neuer Präsenzstatus Wert : ${pVal}`);
79
79
  if (pVal) {
80
80
  this.detectionsToday++;
81
- this.log(logLevel_1.LogLevel.Trace, `Dies ist die ${this.detectionsToday} Bewegung `);
81
+ this.log(models_1.LogLevel.Trace, `Dies ist die ${this.detectionsToday} Bewegung `);
82
82
  }
83
83
  for (const c of this._presenceDetectedCallback) {
84
84
  c(pVal);
@@ -0,0 +1,11 @@
1
+ import { LogLevel, RoomBase } from '../../models';
2
+ import { DeviceType } from './deviceType';
3
+ import { DeviceInfo } from './DeviceInfo';
4
+ export interface IBaseDevice {
5
+ room: RoomBase | undefined;
6
+ deviceType: DeviceType;
7
+ info: DeviceInfo;
8
+ readonly id: string;
9
+ battery: number | undefined;
10
+ log(level: LogLevel, message: string): void;
11
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +1,6 @@
1
1
  import { Button } from './button';
2
- import { IoBrokerBaseDevice } from './IoBrokerBaseDevice';
3
- export interface iButtonSwitch extends IoBrokerBaseDevice {
2
+ import { IBaseDevice } from './iBaseDevice';
3
+ export interface iButtonSwitch extends IBaseDevice {
4
4
  buttonTopLeft: Button | undefined;
5
5
  buttonTopRight: Button | undefined;
6
6
  buttonMidLeft: Button | undefined;
@@ -1,6 +1,19 @@
1
- import { IoBrokerBaseDevice } from './IoBrokerBaseDevice';
2
1
  import { iExcessEnergyConsumer } from './iExcessEnergyConsumer';
3
- export interface iEnergyManager extends IoBrokerBaseDevice {
2
+ import { IBaseDevice } from './iBaseDevice';
3
+ export declare class PhaseState {
4
+ private readonly _meterValue;
5
+ private readonly _production;
6
+ private readonly _injectingWattage;
7
+ private readonly _drawingWattage;
8
+ private readonly _selfConsumingWattage;
9
+ private readonly _totalConsumption;
10
+ constructor(_meterValue: number, _production: number);
11
+ get selfConsumingWattage(): number;
12
+ get drawingWattage(): number;
13
+ get injectingWattage(): number;
14
+ get totalConsumptionWattage(): number;
15
+ }
16
+ export interface iEnergyManager extends IBaseDevice {
4
17
  baseConsumption: number;
5
18
  currentProduction: number;
6
19
  excessEnergy: number;
@@ -9,6 +22,9 @@ export interface iEnergyManager extends IoBrokerBaseDevice {
9
22
  drawingWattage: number;
10
23
  selfConsumingWattage: number;
11
24
  injectingWattage: number;
25
+ phaseAState: PhaseState;
26
+ phaseBState: PhaseState;
27
+ phaseCState: PhaseState;
12
28
  addExcessConsumer(device: iExcessEnergyConsumer): void;
13
29
  recalculatePowerSharing(): void;
14
30
  cleanup(): void;
@@ -1,2 +1,30 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PhaseState = void 0;
4
+ class PhaseState {
5
+ constructor(_meterValue, _production) {
6
+ this._meterValue = _meterValue;
7
+ this._production = _production;
8
+ this._injectingWattage = 0;
9
+ this._drawingWattage = 0;
10
+ this._selfConsumingWattage = 0;
11
+ this._totalConsumption = 0;
12
+ this._injectingWattage = Math.max(0, this._meterValue);
13
+ this._selfConsumingWattage = this._production - Math.max(0, this._meterValue);
14
+ this._drawingWattage = Math.min(0, this._meterValue) * -1;
15
+ this._totalConsumption = this._production - this._meterValue;
16
+ }
17
+ get selfConsumingWattage() {
18
+ return this._selfConsumingWattage;
19
+ }
20
+ get drawingWattage() {
21
+ return this._drawingWattage;
22
+ }
23
+ get injectingWattage() {
24
+ return this._injectingWattage;
25
+ }
26
+ get totalConsumptionWattage() {
27
+ return this._totalConsumption;
28
+ }
29
+ }
30
+ exports.PhaseState = PhaseState;
@@ -1,6 +1,6 @@
1
- import { IoBrokerBaseDevice } from './IoBrokerBaseDevice';
2
- import { ExcessEnergyConsumerSettings } from '../../models/excessEnergyConsumerSettings';
3
- export interface iExcessEnergyConsumer extends IoBrokerBaseDevice {
1
+ import { ExcessEnergyConsumerSettings } from '../../models';
2
+ import { IBaseDevice } from './iBaseDevice';
3
+ export interface iExcessEnergyConsumer extends IBaseDevice {
4
4
  energyConsumerSettings: ExcessEnergyConsumerSettings;
5
5
  currentConsumption: number;
6
6
  }