hoffmation-base 2.22.8 → 2.22.9

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.
@@ -23,6 +23,7 @@ class API {
23
23
  if (!d.deviceCapabilities.includes(DeviceCapability_1.DeviceCapability.scene)) {
24
24
  return new Error(`Device with ID ${deviceId} is no scene`);
25
25
  }
26
+ d.log(models_1.LogLevel.Info, `API Call to end this.`);
26
27
  d.endScene();
27
28
  return null;
28
29
  }
@@ -92,6 +93,7 @@ class API {
92
93
  desiredMode = settings_service_1.SettingsService.heatMode == config_1.HeatingMode.Winter ? ac_1.AcMode.Heating : ac_1.AcMode.Cooling;
93
94
  }
94
95
  }
96
+ d.log(models_1.LogLevel.Info, `API Call to set AC to ${desiredState} with mode ${desiredMode} for ${forceTime}ms`);
95
97
  d.setState(desiredMode, desiredTemperature, forceTime);
96
98
  return true;
97
99
  }
@@ -101,6 +103,7 @@ class API {
101
103
  */
102
104
  static setAllAc(desiredState) {
103
105
  ac_1.DaikinService.setAll(desiredState, true);
106
+ log_service_1.ServerLogService.writeLog(models_1.LogLevel.Info, `API Call to set all AC´s to ${desiredState}`);
104
107
  }
105
108
  /**
106
109
  * Changes the status of a given Lamp
@@ -117,6 +120,7 @@ class API {
117
120
  if (!d.deviceCapabilities.includes(DeviceCapability_1.DeviceCapability.lamp)) {
118
121
  return new Error(`Device with ID ${deviceId} is no Lamp`);
119
122
  }
123
+ d.log(models_1.LogLevel.Info, `API Call to set Lamp to ${state} for ${timeout}ms`);
120
124
  d.setLight(state, timeout, true);
121
125
  return null;
122
126
  }
@@ -135,6 +139,7 @@ class API {
135
139
  if (!d.deviceCapabilities.includes(DeviceCapability_1.DeviceCapability.actuator)) {
136
140
  return new Error(`Device with ID ${deviceId} is no actuator`);
137
141
  }
142
+ d.log(models_1.LogLevel.Info, `API Call to set Actuator to ${state} for ${timeout}ms`);
138
143
  d.setActuator(state, timeout, true);
139
144
  return null;
140
145
  }
@@ -155,6 +160,7 @@ class API {
155
160
  if (!d.deviceCapabilities.includes(DeviceCapability_1.DeviceCapability.dimmablelamp)) {
156
161
  return new Error(`Device with ID ${deviceId} is no dimmablelamp`);
157
162
  }
163
+ d.log(models_1.LogLevel.Info, `API Call to set Dimmer to ${state} with brightness ${brightness} for ${timeout}ms`);
158
164
  d.setLight(state, timeout, true, brightness, transitionTime);
159
165
  return null;
160
166
  }
@@ -177,6 +183,7 @@ class API {
177
183
  if (!d.deviceCapabilities.includes(DeviceCapability_1.DeviceCapability.ledLamp)) {
178
184
  return new Error(`Device with ID ${deviceId} is no dimmablelamp`);
179
185
  }
186
+ d.log(models_1.LogLevel.Info, `API Call to set LED to ${state} with brightness ${brightness} and color ${color} for ${timeout}ms`);
180
187
  d.setLight(state, timeout, true, brightness, transitionTime, color, colorTemp);
181
188
  return null;
182
189
  }
@@ -202,6 +209,7 @@ class API {
202
209
  else {
203
210
  d.setLevel(level, false);
204
211
  }
212
+ d.log(models_1.LogLevel.Info, `API Call to set Shutter to ${level}`);
205
213
  return null;
206
214
  }
207
215
  static speakOnDevice(deviceId, message, volume = 30) {
@@ -212,6 +220,7 @@ class API {
212
220
  if (!d.deviceCapabilities.includes(DeviceCapability_1.DeviceCapability.speaker)) {
213
221
  return new Error(`Device with ID ${deviceId} is no speaker`);
214
222
  }
223
+ d.log(models_1.LogLevel.Info, `API Call to speak "${message}" on device with volume ${volume}`);
215
224
  d.speakOnDevice(message, volume);
216
225
  return null;
217
226
  }
@@ -229,6 +238,7 @@ class API {
229
238
  if (!d.deviceCapabilities.includes(DeviceCapability_1.DeviceCapability.scene)) {
230
239
  return new Error(`Device with ID ${deviceId} is no scene`);
231
240
  }
241
+ d.log(models_1.LogLevel.Info, `API Call to start this.`);
232
242
  d.startScene(turnOffTimeout);
233
243
  return null;
234
244
  }
@@ -241,9 +251,11 @@ class API {
241
251
  return new Error(`Device with ID ${deviceId} is no Garage Door Opener`);
242
252
  }
243
253
  if (open) {
254
+ d.log(models_1.LogLevel.Info, `API Call to open Garage Door`);
244
255
  d.open();
245
256
  }
246
257
  else {
258
+ d.log(models_1.LogLevel.Info, `API Call to close Garage Door`);
247
259
  d.close();
248
260
  }
249
261
  return null;
@@ -262,6 +274,7 @@ class API {
262
274
  if (d.settings === undefined) {
263
275
  return new Error(`Device with ID ${deviceId} has no settings`);
264
276
  }
277
+ d.log(models_1.LogLevel.Info, `API Call to change settings to ${JSON.stringify(settings)})}`);
265
278
  d.settings.fromPartialObject(settings);
266
279
  d.settings.persist(d);
267
280
  return null;
@@ -274,6 +287,7 @@ class API {
274
287
  if (g.settings === undefined) {
275
288
  return new Error(`Group with ID ${groupId} has no settings`);
276
289
  }
290
+ g.log(models_1.LogLevel.Info, `API Call to change settings to ${JSON.stringify(settings)})}`);
277
291
  g.settings.fromPartialObject(settings);
278
292
  g.settings.persist(g);
279
293
  return null;
@@ -289,6 +303,7 @@ class API {
289
303
  if (r === undefined) {
290
304
  return new Error(`Room with ID ${roomName} not found`);
291
305
  }
306
+ r.log(models_1.LogLevel.Info, `API Call to change settings to ${JSON.stringify(settings)})}`);
292
307
  r.settings.settingsContainer.fromPartialObject(settings);
293
308
  r.settings.settingsContainer.persist(r);
294
309
  return null;
@@ -305,11 +320,13 @@ class API {
305
320
  }
306
321
  static persistAllDeviceSettings() {
307
322
  var _a;
323
+ log_service_1.ServerLogService.writeLog(models_1.LogLevel.Info, `API Call to persist all device settings`);
308
324
  for (const device of Object.values(devices_1.Devices.alLDevices)) {
309
325
  (_a = device.settings) === null || _a === void 0 ? void 0 : _a.persist(device);
310
326
  }
311
327
  }
312
328
  static loadAllDeviceSettingsFromDb() {
329
+ log_service_1.ServerLogService.writeLog(models_1.LogLevel.Info, `API Call to load all device settings`);
313
330
  for (const device of Object.values(devices_1.Devices.alLDevices)) {
314
331
  device.loadDeviceSettings();
315
332
  }
@@ -327,6 +344,7 @@ class API {
327
344
  if (!d.deviceCapabilities.includes(DeviceCapability_1.DeviceCapability.blockAutomatic)) {
328
345
  return new Error(`Device with ID ${deviceId} is not capable of blocking automatic`);
329
346
  }
347
+ d.log(models_1.LogLevel.Info, `API Call to lift automatic block`);
330
348
  d.blockAutomationHandler.liftAutomaticBlock();
331
349
  return null;
332
350
  }
@@ -345,6 +363,7 @@ class API {
345
363
  if (!d.deviceCapabilities.includes(DeviceCapability_1.DeviceCapability.blockAutomatic)) {
346
364
  return new Error(`Device with ID ${deviceId} is not capable of blocking automatic`);
347
365
  }
366
+ d.log(models_1.LogLevel.Info, `API Call to block automatic for ${duration}ms with ${onCollision} on collision`);
348
367
  d.blockAutomationHandler.disableAutomatic(duration, onCollision);
349
368
  return null;
350
369
  }
@@ -356,6 +375,7 @@ class API {
356
375
  if (!d.deviceCapabilities.includes(DeviceCapability_1.DeviceCapability.buttonSwitch)) {
357
376
  return new Error(`Device with ID ${deviceId} is no switch`);
358
377
  }
378
+ d.log(models_1.LogLevel.Info, `API Call to press button ${position} with ${pressType}`);
359
379
  return d.pressButton(position, pressType);
360
380
  }
361
381
  }