hoffmation-base 2.21.0 → 2.22.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.
@@ -99,7 +99,9 @@ class Dachs {
99
99
  this.settings.initializeFromDb(this);
100
100
  }
101
101
  loadData() {
102
- this.client.fetchAllKeys().then((data) => {
102
+ this.client
103
+ .fetchAllKeys()
104
+ .then((data) => {
103
105
  var _a, _b;
104
106
  this.queuedValue = null;
105
107
  this.fetchedData = data;
@@ -121,6 +123,9 @@ class Dachs {
121
123
  this._tempHeatStorage = (_b = this.fetchedData['Hka_Mw1.Temp.sbFuehler1']) !== null && _b !== void 0 ? _b : 0;
122
124
  this.heatStorageTempSensor.update(this._tempHeatStorage);
123
125
  this.persist();
126
+ })
127
+ .catch((error) => {
128
+ this.log(models_1.LogLevel.Error, `Error while fetching data: ${error}`);
124
129
  });
125
130
  }
126
131
  persist() {
@@ -91,6 +91,8 @@ class DachsHttpClient {
91
91
  this.axiosInstance
92
92
  .get(`/getKey` + this.urlBuilder(keys))
93
93
  .then((res) => {
94
+ if (!res.data)
95
+ reject('No data received');
94
96
  resolve(this.parser(res.data));
95
97
  })
96
98
  .catch((err) => {
@@ -80,23 +80,27 @@ class LightGroup extends base_group_1.BaseGroup {
80
80
  const darkOutside = services_1.TimeCallbackService.darkOutsideOrNight(time);
81
81
  let resultLampen = false;
82
82
  let resultSteckdosen = false;
83
+ let activatedGroups = 0;
83
84
  if (this.getWled().length > 0) {
85
+ activatedGroups++;
84
86
  this.log(models_1.LogLevel.Debug, `Set Wled time based for time "${models_1.TimeOfDay[time]}"`);
85
87
  this.getWled().forEach((wled) => {
86
88
  wled.setTimeBased(time);
87
89
  });
88
90
  }
89
91
  if (this.getLED().length > 0) {
92
+ activatedGroups++;
90
93
  this.log(models_1.LogLevel.Trace, `Set LEDs time based for time "${models_1.TimeOfDay[time]}"`);
91
94
  this.getLED().forEach((s) => {
92
95
  s.setTimeBased(time);
93
96
  });
94
97
  }
95
- else if (this.getOutlets().length > 0) {
98
+ if (this.getOutlets().length > 0) {
99
+ activatedGroups++;
96
100
  this.log(models_1.LogLevel.Trace, `Set outlets time based for time "${models_1.TimeOfDay[time]}"`);
97
101
  resultSteckdosen = darkOutside;
98
102
  }
99
- else {
103
+ if (activatedGroups === 0) {
100
104
  this.log(models_1.LogLevel.Trace, `Set Lamps time based for time "${models_1.TimeOfDay[time]}"`);
101
105
  resultLampen = darkOutside;
102
106
  }
@@ -14,7 +14,17 @@ class GooveeService {
14
14
  static initialize() {
15
15
  log_service_1.ServerLogService.writeLog(models_1.LogLevel.Debug, `Initializing Goovee-Service`);
16
16
  this.all = [];
17
- this.goveeApi = new theimo1221_govee_lan_control_1.default();
17
+ this.goveeApi = new theimo1221_govee_lan_control_1.default({
18
+ logger: (message) => {
19
+ log_service_1.ServerLogService.writeLog(models_1.LogLevel.Debug, `Govee: ${message}`);
20
+ },
21
+ errorLogger: (message) => {
22
+ if (message.startsWith('UDP Socket was not')) {
23
+ return;
24
+ }
25
+ log_service_1.ServerLogService.writeLog(models_1.LogLevel.Error, `Govee: ${message}`);
26
+ },
27
+ });
18
28
  this.goveeApi.on('deviceAdded', (device) => {
19
29
  log_service_1.ServerLogService.writeLog(models_1.LogLevel.Info, `GoveeDevice ${device.deviceID} joined`);
20
30
  GooveeService.initializeDevice(device);