hoffmation-base 3.0.0-alpha.83 → 3.0.0-alpha.85

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.
@@ -20,6 +20,10 @@ export declare class DachsDeviceSettings extends ActuatorSettings {
20
20
  * Defines the battery level above which the dachs should be prevented from starting/running.
21
21
  */
22
22
  batteryLevelPreventStartThreshold: number;
23
+ /**
24
+ * Defines the battery level above which the external heating rod should be turned on
25
+ */
26
+ batteryLevelHeatingRodThreshold: number;
23
27
  /**
24
28
  * Defines the desired minimum temperature for warm water.
25
29
  */
@@ -26,6 +26,10 @@ class DachsDeviceSettings extends actuatorSettings_1.ActuatorSettings {
26
26
  * Defines the battery level above which the dachs should be prevented from starting/running.
27
27
  */
28
28
  this.batteryLevelPreventStartThreshold = 70;
29
+ /**
30
+ * Defines the battery level above which the external heating rod should be turned on
31
+ */
32
+ this.batteryLevelHeatingRodThreshold = 80;
29
33
  /**
30
34
  * Defines the desired minimum temperature for warm water.
31
35
  */
@@ -26,6 +26,10 @@ export declare class Dachs implements iBaseDevice, iActuator {
26
26
  * An external actuator controlling the warm water pump
27
27
  */
28
28
  warmWaterPump?: iActuator;
29
+ /**
30
+ * An external actuator controlling the heat rod.
31
+ */
32
+ heatingRod?: iActuator;
29
33
  /**
30
34
  * An external actuator to prevent the Dachs from starting.
31
35
  */
@@ -79,4 +83,5 @@ export declare class Dachs implements iBaseDevice, iActuator {
79
83
  */
80
84
  private onBatteryLevelChange;
81
85
  private onTempChange;
86
+ private checkHeatingRod;
82
87
  }
@@ -12,6 +12,7 @@ const dachsSettings_1 = require("../../../models/deviceSettings/dachsSettings");
12
12
  const lib_1 = require("./lib");
13
13
  const dachsTemperatureSensor_1 = require("./dachsTemperatureSensor");
14
14
  const blockAutomaticHandler_1 = require("../../services/blockAutomaticHandler");
15
+ const config_1 = require("../../config");
15
16
  class Dachs {
16
17
  /** @inheritDoc */
17
18
  get customName() {
@@ -105,6 +106,7 @@ class Dachs {
105
106
  'warmWaterSensor',
106
107
  'heatStorageTempSensor',
107
108
  'warmWaterPump',
109
+ 'heatingRod',
108
110
  'blockDachsStart',
109
111
  ]));
110
112
  }
@@ -197,6 +199,7 @@ class Dachs {
197
199
  * @param {BatteryLevelChangeAction} action - The action containing the new level
198
200
  */
199
201
  onBatteryLevelChange(action) {
202
+ this.checkHeatingRod(action);
200
203
  if (this.blockDachsStart !== undefined) {
201
204
  if (action.newLevel > this.settings.batteryLevelPreventStartThreshold) {
202
205
  const blockAction = new models_1.ActuatorSetStateCommand(action, true, `Battery reached ${action.newLevel}%, Dachs should not run any more`, null);
@@ -257,5 +260,18 @@ class Dachs {
257
260
  const setAction = new models_1.ActuatorSetStateCommand(action, desiredState, reason, null);
258
261
  this.warmWaterPump.setActuator(setAction);
259
262
  }
263
+ checkHeatingRod(action) {
264
+ var _a;
265
+ if (this.heatingRod === undefined) {
266
+ return;
267
+ }
268
+ const shouldBeOff = ((_a = services_1.SettingsService.settings.heaterSettings) === null || _a === void 0 ? void 0 : _a.mode) === config_1.HeatingMode.Winter ||
269
+ action.newLevel < this.settings.batteryLevelHeatingRodThreshold;
270
+ if (this.heatingRod.actuatorOn !== shouldBeOff) {
271
+ return;
272
+ }
273
+ const setAction = new models_1.ActuatorSetStateCommand(action, !shouldBeOff, `Battery reached ${action.newLevel}%, heating rod should be turned ${shouldBeOff ? 'off' : 'on'}`, null);
274
+ this.heatingRod.setActuator(setAction);
275
+ }
260
276
  }
261
277
  exports.Dachs = Dachs;
@@ -86,7 +86,7 @@ class EspresenseDevice {
86
86
  try {
87
87
  data = JSON.parse(state.val);
88
88
  }
89
- catch (e) {
89
+ catch (_e) {
90
90
  this.log(models_1.LogLevel.Error, `Recieved malformed update data: ${state.val}`);
91
91
  return;
92
92
  }
@@ -65,7 +65,10 @@ class TasterGroup extends base_group_1.BaseGroup {
65
65
  const sonosGroup = this.getRoom().SonosGroup;
66
66
  if (sonosGroup !== undefined && sonosGroup.getOwnSonosDevices().length > 0) {
67
67
  (_h = t.buttonBotRight) === null || _h === void 0 ? void 0 : _h.addCb(button_1.ButtonPressType.long, (pValue) => {
68
- pValue && sonosGroup.trigger(this.getRoom().settings.radioUrl);
68
+ if (!pValue) {
69
+ return;
70
+ }
71
+ sonosGroup.trigger(this.getRoom().settings.radioUrl);
69
72
  });
70
73
  }
71
74
  }
@@ -73,10 +76,16 @@ class TasterGroup extends base_group_1.BaseGroup {
73
76
  const heatGroup = this.getRoom().HeatGroup;
74
77
  if (heatGroup !== undefined && heatGroup.getOwnAcDevices().length > 0) {
75
78
  (_k = t.buttonBotRight) === null || _k === void 0 ? void 0 : _k.addCb(button_1.ButtonPressType.short, (pValue) => {
76
- pValue && heatGroup.setAc(true);
79
+ if (!pValue) {
80
+ return;
81
+ }
82
+ heatGroup.setAc(true);
77
83
  });
78
84
  (_l = t.buttonBotRight) === null || _l === void 0 ? void 0 : _l.addCb(button_1.ButtonPressType.long, (pValue) => {
79
- pValue && heatGroup.setAc(false, true);
85
+ if (!pValue) {
86
+ return;
87
+ }
88
+ heatGroup.setAc(false, true);
80
89
  });
81
90
  }
82
91
  }
@@ -15,7 +15,7 @@ class WindowGroup extends base_group_1.BaseGroup {
15
15
  */
16
16
  get anyShutterDown() {
17
17
  return this.windows.some((w) => {
18
- w.anyShutterDown;
18
+ return w.anyShutterDown;
19
19
  });
20
20
  }
21
21
  constructor(roomName, windows) {
@@ -240,7 +240,7 @@ class IOBrokerConnection {
240
240
  try {
241
241
  state.val = JSON.parse(state.val);
242
242
  }
243
- catch (e) {
243
+ catch (_e) {
244
244
  iobrokerConnectionLogging_1.iobrokerConnectionLogging.writeLog(iobrokerConnectionLogging_1.iobrokerConnectionLogLevel.Debug, 'Command seems to be an object, but cannot parse it: ' + state.val);
245
245
  }
246
246
  }
@@ -643,7 +643,9 @@ class IOBrokerConnection {
643
643
  const adapter = parts[1];
644
644
  parts.splice(0, 2);
645
645
  this._socket.emit('mkdir', adapter, parts.join('/'), (err) => {
646
- callback && callback(err);
646
+ if (callback) {
647
+ callback(err);
648
+ }
647
649
  });
648
650
  }
649
651
  unlink(name, callback) {
@@ -651,7 +653,9 @@ class IOBrokerConnection {
651
653
  const adapter = parts[1];
652
654
  parts.splice(0, 2);
653
655
  this._socket.emit('unlink', adapter, parts.join('/'), (err) => {
654
- callback && callback(err);
656
+ if (callback) {
657
+ callback(err);
658
+ }
655
659
  });
656
660
  }
657
661
  renameFile(oldname, newname, callback) {
@@ -661,7 +665,9 @@ class IOBrokerConnection {
661
665
  const parts2 = newname.split('/');
662
666
  parts2.splice(0, 2);
663
667
  this._socket.emit('rename', adapter, parts1.join('/'), parts2.join('/'), (err) => {
664
- callback && callback(err);
668
+ if (callback) {
669
+ callback(err);
670
+ }
665
671
  });
666
672
  }
667
673
  setState(pointId, state, callback) {
@@ -708,7 +714,9 @@ class IOBrokerConnection {
708
714
  }
709
715
  this._socket.emit('getStates', idPattern, (err, data) => {
710
716
  iobrokerConnectionLogging_1.iobrokerConnectionLogging.writeLog(iobrokerConnectionLogging_1.iobrokerConnectionLogLevel.Debug, `getStates Callback; Error: "${err}"`);
711
- this._gettingStates !== undefined && this._gettingStates--;
717
+ if (this._gettingStates !== undefined) {
718
+ this._gettingStates--;
719
+ }
712
720
  if (err || !data) {
713
721
  if (callback) {
714
722
  callback(err || new Error('Authentication required'));
@@ -74,7 +74,7 @@ class SonosService {
74
74
  log_service_1.ServerLogService.writeLog(models_1.LogLevel.Info, `Alle Geräte okay --> Last checked ${currentDevice.name}`);
75
75
  }
76
76
  }
77
- catch (e) {
77
+ catch (_e) {
78
78
  log_service_1.ServerLogService.writeLog(models_1.LogLevel.Error, `Atleast one device failed --> Last checked ${(_a = currentDevice === null || currentDevice === void 0 ? void 0 : currentDevice.name) !== null && _a !== void 0 ? _a : 'undefined'}`);
79
79
  Telegram_1.TelegramService.inform('Sonos device is failing --> Reinitialize whole system');
80
80
  this.initialize(true);
@@ -153,16 +153,22 @@ class AcDevice {
153
153
  }
154
154
  this._desiredTemperatur = heatGroup.desiredTemp;
155
155
  if (this.settings.manualDisabled) {
156
- acOn && this.log(models_1.LogLevel.Info, 'We should turn off now, as manual disable force is set.');
156
+ if (acOn) {
157
+ this.log(models_1.LogLevel.Info, 'We should turn off now, as manual disable force is set.');
158
+ }
157
159
  return ac_mode_1.AcMode.Off;
158
160
  }
159
161
  if ((_b = devices_1.Devices.energymanager) === null || _b === void 0 ? void 0 : _b.acBlocked) {
160
- acOn && this.log(models_1.LogLevel.Info, 'We should turn off now, as energy-manager demands off.');
162
+ if (acOn) {
163
+ this.log(models_1.LogLevel.Info, 'We should turn off now, as energy-manager demands off.');
164
+ }
161
165
  return ac_mode_1.AcMode.Off;
162
166
  }
163
167
  // Check Turn Off Time
164
168
  if (!utils_1.Utils.timeWithinBorders(this.settings.minimumHours, this.settings.minimumMinutes, this.settings.maximumHours, this.settings.maximumMinutes)) {
165
- acOn && this.log(models_1.LogLevel.Info, 'We should turn off now, to respect night settings.');
169
+ if (acOn) {
170
+ this.log(models_1.LogLevel.Info, 'We should turn off now, to respect night settings.');
171
+ }
166
172
  return ac_mode_1.AcMode.Off;
167
173
  }
168
174
  if (this.settings.useOwnTemperature) {
@@ -89,9 +89,9 @@ class WeatherService {
89
89
  break;
90
90
  }
91
91
  speaker.speakOnDevice(message, volume, false);
92
- !short &&
93
- precipitation > 0 &&
92
+ if (!short && precipitation > 0) {
94
93
  speaker.speakOnDevice(`Es werden etwa ${precipitation} Millimeter Niederschlag in den nächsten ${minutes} Minuten fallen`, volume, false);
94
+ }
95
95
  const alerts = WeatherService.getActiveAlerts();
96
96
  if (alerts.length > 0) {
97
97
  const alertMessage = ['Achtung, vorliegende Wetterwarnungen:'];