hoffmation-base 3.0.0-alpha.84 → 3.0.0-alpha.86

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.
@@ -12,6 +12,15 @@ export declare class DachsDeviceSettings extends ActuatorSettings {
12
12
  * Uses {@link iBatteryDevice.addBatteryLevelCallback}
13
13
  */
14
14
  batteryLevelTurnOnThreshold: number;
15
+ /**
16
+ * Defines the battery level at which the dachs should be turned on,
17
+ * in evening hours to prevent a battery based island-system to run out of
18
+ * power overnight.
19
+ * @default -1 --> No turn on for battery loading
20
+ *
21
+ * Uses {@link iBatteryDevice.addBatteryLevelCallback}
22
+ */
23
+ batteryLevelBeforeNightTurnOnThreshold: number;
15
24
  /**
16
25
  * Defines the battery level below which the dachs should be allowed to start
17
26
  */
@@ -18,6 +18,15 @@ class DachsDeviceSettings extends actuatorSettings_1.ActuatorSettings {
18
18
  * Uses {@link iBatteryDevice.addBatteryLevelCallback}
19
19
  */
20
20
  this.batteryLevelTurnOnThreshold = -1;
21
+ /**
22
+ * Defines the battery level at which the dachs should be turned on,
23
+ * in evening hours to prevent a battery based island-system to run out of
24
+ * power overnight.
25
+ * @default -1 --> No turn on for battery loading
26
+ *
27
+ * Uses {@link iBatteryDevice.addBatteryLevelCallback}
28
+ */
29
+ this.batteryLevelBeforeNightTurnOnThreshold = -1;
21
30
  /**
22
31
  * Defines the battery level below which the dachs should be allowed to start
23
32
  */
@@ -216,8 +216,18 @@ class Dachs {
216
216
  return;
217
217
  }
218
218
  }
219
- if (this._dachsOn || this.settings.batteryLevelTurnOnThreshold < action.newLevel) {
220
- // We are already running, or battery level is high enough.
219
+ if (this._dachsOn) {
220
+ // We are already running
221
+ return;
222
+ }
223
+ const dayType = services_1.TimeCallbackService.dayType(new services_1.SunTimeOffsets());
224
+ if ((dayType === models_1.TimeOfDay.Daylight || dayType === models_1.TimeOfDay.BeforeSunrise) &&
225
+ action.newLevel > this.settings.batteryLevelTurnOnThreshold) {
226
+ // It is daytime (maybe solar power) and it is no critical battery level
227
+ return;
228
+ }
229
+ if (action.newLevel > this.settings.batteryLevelBeforeNightTurnOnThreshold) {
230
+ // It is not daylight but battery level is high enough
221
231
  return;
222
232
  }
223
233
  const setStateCommand = new models_1.ActuatorSetStateCommand(action, true, 'Energy Level of battery dropped to critical level', null);
@@ -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:'];