hoffmation-base 3.0.0-alpha.19 → 3.0.0-alpha.20

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 (45) hide show
  1. package/lib/models/command/ShutterSetLevelCommand.js +1 -0
  2. package/lib/models/command/WindowRestoreDesiredPositionCommand.js +1 -0
  3. package/lib/models/command/WindowSetDesiredPositionCommand.js +1 -0
  4. package/lib/models/command/WindowSetRolloByWeatherStatusCommand.js +1 -0
  5. package/lib/models/command/actuatorSetStateCommand.js +1 -0
  6. package/lib/models/command/actuatorToggleCommand.js +1 -0
  7. package/lib/models/command/actuatorWriteStateToDeviceCommand.js +1 -0
  8. package/lib/models/command/baseCommand.d.ts +1 -1
  9. package/lib/models/command/baseCommand.js +1 -0
  10. package/lib/models/command/blockAutomaticCommand.d.ts +17 -0
  11. package/lib/models/command/blockAutomaticCommand.js +22 -0
  12. package/lib/models/command/blockAutomaticLiftBlockCommand.d.ts +12 -0
  13. package/lib/models/command/blockAutomaticLiftBlockCommand.js +17 -0
  14. package/lib/models/command/blockAutomaticUntilCommand.d.ts +17 -0
  15. package/lib/models/command/blockAutomaticUntilCommand.js +22 -0
  16. package/lib/models/command/commandSource.js +1 -0
  17. package/lib/models/command/commandType.d.ts +3 -0
  18. package/lib/models/command/commandType.js +3 -0
  19. package/lib/models/command/index.d.ts +3 -0
  20. package/lib/models/command/index.js +7 -1
  21. package/lib/models/command/lampSetLightCommand.js +1 -0
  22. package/lib/models/command/ledSetLightCommand.js +1 -0
  23. package/lib/models/command/lightGroupSwitchTimeConditionalCommand.js +1 -0
  24. package/lib/models/command/restoreTargetAutomaticValueCommand.js +1 -0
  25. package/lib/models/command/roomRestoreLightCommand.js +1 -0
  26. package/lib/models/command/roomRestoreShutterPositionCommand.js +1 -0
  27. package/lib/models/command/shutterSunriseUpCommand.js +1 -0
  28. package/lib/models/command/shutterSunsetDownCommand.js +1 -0
  29. package/lib/models/command/wledSetLightCommand.js +1 -0
  30. package/lib/server/devices/baseDeviceInterfaces/iAcDevice.d.ts +0 -5
  31. package/lib/server/devices/groups/heatGroup.d.ts +1 -0
  32. package/lib/server/devices/groups/heatGroup.js +2 -3
  33. package/lib/server/devices/sharedFunctions/lampUtils.js +2 -3
  34. package/lib/server/devices/wledDevice.js +1 -1
  35. package/lib/server/devices/zigbee/BaseDevices/zigbeeDimmer.js +1 -1
  36. package/lib/server/services/ac/ac-device.d.ts +0 -5
  37. package/lib/server/services/ac/ac-device.js +2 -8
  38. package/lib/server/services/ac/daikin-service.js +2 -1
  39. package/lib/server/services/api/api-service.d.ts +65 -2
  40. package/lib/server/services/api/api-service.js +108 -18
  41. package/lib/server/services/blockAutomaticHandler.d.ts +6 -9
  42. package/lib/server/services/blockAutomaticHandler.js +11 -29
  43. package/lib/server/services/govee/own-govee-device.js +1 -1
  44. package/lib/tsconfig.tsbuildinfo +1 -1
  45. package/package.json +1 -1
@@ -39,10 +39,12 @@ class API {
39
39
  }
40
40
  return result;
41
41
  }
42
+ // TODO: Missing Comment
42
43
  static getDevices() {
43
44
  // console.log(Util.inspect(Devices.alLDevices, false, 5));
44
45
  return devices_1.Devices.alLDevices;
45
46
  }
47
+ // TODO: Missing Comment
46
48
  static getDevice(id) {
47
49
  const d = devices_1.Devices.alLDevices[id];
48
50
  if (d === undefined) {
@@ -50,6 +52,7 @@ class API {
50
52
  }
51
53
  return devices_1.Devices.alLDevices[id];
52
54
  }
55
+ // TODO: Missing Comment
53
56
  static getGroup(id) {
54
57
  const g = room_service_1.RoomService.Groups.get(id);
55
58
  if (g === undefined) {
@@ -57,13 +60,16 @@ class API {
57
60
  }
58
61
  return g;
59
62
  }
63
+ // TODO: Missing Comment
60
64
  static getRooms() {
61
65
  // console.log(inspect(Object.fromEntries(RoomService.Rooms)));
62
66
  return room_service_1.RoomService.Rooms;
63
67
  }
68
+ // TODO: Missing Comment
64
69
  static getRoom(id) {
65
70
  return room_service_1.RoomService.Rooms.get(id);
66
71
  }
72
+ // TODO: Missing Comment
67
73
  static getLog() {
68
74
  return log_service_1.ServerLogService.getLog();
69
75
  }
@@ -107,12 +113,23 @@ class API {
107
113
  }
108
114
  /**
109
115
  * Changes the status of a given Lamp
116
+ * @deprecated Use "API.lampSetLight" instead
117
+ * TODO: Remove deprecated API method
110
118
  * @param {string} deviceId The device Id of the lamp
111
119
  * @param {boolean} state The desired new state
112
120
  * @param timeout Desired time after which this should be reverted to normal state
113
121
  * @returns {Error | null} In case it failed the Error containing the reason
114
122
  */
115
123
  static setLamp(deviceId, state, timeout = 60 * 60 * 1000) {
124
+ return this.lampSetLight(deviceId, new models_1.LampSetLightCommand(models_1.CommandSource.API, state, '', timeout));
125
+ }
126
+ /**
127
+ * Changes the status of a given Lamp
128
+ * @param {string} deviceId The device Id of the lamp
129
+ * @param {LampSetLightCommand} c The command(stack) to perform on the lamp
130
+ * @returns {Error | null} In case it failed the Error containing the reason.
131
+ */
132
+ static lampSetLight(deviceId, c) {
116
133
  const d = this.getDevice(deviceId);
117
134
  if (d === undefined) {
118
135
  return new Error(`Device with ID ${deviceId} not found`);
@@ -120,18 +137,29 @@ class API {
120
137
  if (!d.deviceCapabilities.includes(DeviceCapability_1.DeviceCapability.lamp)) {
121
138
  return new Error(`Device with ID ${deviceId} is no Lamp`);
122
139
  }
123
- d.log(models_1.LogLevel.Info, `API Call to set Lamp to ${state} for ${timeout}ms`);
124
- d.setLight(new models_1.LampSetLightCommand(models_1.CommandSource.API, state, '', timeout));
140
+ d.log(models_1.LogLevel.Info, `Received LampSetLightCommand API call.`);
141
+ d.setLight(c);
125
142
  return null;
126
143
  }
127
144
  /**
128
145
  * Changes the status of a given actuator
146
+ * @deprecated Use "API.actuatorSetState" instead
147
+ * TODO: Remove deprecated API method
129
148
  * @param {string} deviceId The device Id of the actuator
130
149
  * @param {boolean} state The desired new state
131
150
  * @param timeout Desired time after which this should be reverted to automatic state
132
151
  * @returns {Error | null} In case it failed the Error containing the reason
133
152
  */
134
153
  static setActuator(deviceId, state, timeout = 60 * 60 * 1000) {
154
+ return this.actuatorSetState(deviceId, new models_1.ActuatorSetStateCommand(models_1.CommandSource.API, state, '', timeout));
155
+ }
156
+ /**
157
+ * Changes the status of a given actuator
158
+ * @param {string} deviceId The device Id of the actuator
159
+ * @param {ActuatorSetStateCommand} c The command(stack) to perform on the actuator
160
+ * @returns {Error | null} In case it failed the Error containing the reason
161
+ */
162
+ static actuatorSetState(deviceId, c) {
135
163
  const d = this.getDevice(deviceId);
136
164
  if (d === undefined) {
137
165
  return new Error(`Device with ID ${deviceId} not found`);
@@ -139,12 +167,14 @@ class API {
139
167
  if (!d.deviceCapabilities.includes(DeviceCapability_1.DeviceCapability.actuator)) {
140
168
  return new Error(`Device with ID ${deviceId} is no actuator`);
141
169
  }
142
- d.log(models_1.LogLevel.Info, `API Call to set Actuator to ${state} for ${timeout}ms`);
143
- d.setActuator(new models_1.ActuatorSetStateCommand(models_1.CommandSource.API, state, '', timeout));
170
+ d.log(models_1.LogLevel.Info, `Received ActuatorSetStateCommand API call.`);
171
+ d.setActuator(c);
144
172
  return null;
145
173
  }
146
174
  /**
147
- * Changes the status of a given actuator
175
+ * Changes the status of the given dimmer
176
+ * @deprecated Use "API.dimmerSetLight" instead
177
+ * TODO: Remove deprecated API method
148
178
  * @param {string} deviceId The device Id of the actuator
149
179
  * @param {boolean} state The desired new state
150
180
  * @param timeout A chosen Timeout after which the light should be reset
@@ -153,6 +183,15 @@ class API {
153
183
  * @returns {Error | null} In case it failed the Error containing the reason
154
184
  */
155
185
  static setDimmer(deviceId, state, timeout, brightness, transitionTime) {
186
+ return this.dimmerSetLight(deviceId, new models_1.DimmerSetLightCommand(models_1.CommandSource.API, state, '', timeout, brightness, transitionTime));
187
+ }
188
+ /**
189
+ * Changes the status of the given dimmer
190
+ * @param {string} deviceId The device Id of the dimmable device.
191
+ * @param {DimmerSetLightCommand} command The command(stack) to perform on the dimmer
192
+ * @returns {Error | null} In case it failed the Error containing the reason.
193
+ */
194
+ static dimmerSetLight(deviceId, command) {
156
195
  const d = this.getDevice(deviceId);
157
196
  if (d === undefined) {
158
197
  return new Error(`Device with ID ${deviceId} not found`);
@@ -160,12 +199,14 @@ class API {
160
199
  if (!d.deviceCapabilities.includes(DeviceCapability_1.DeviceCapability.dimmablelamp)) {
161
200
  return new Error(`Device with ID ${deviceId} is no dimmablelamp`);
162
201
  }
163
- d.log(models_1.LogLevel.Info, `API Call to set Dimmer to ${state} with brightness ${brightness} for ${timeout}ms`);
164
- d.setLight(new models_1.DimmerSetLightCommand(models_1.CommandSource.API, state, '', timeout, brightness, transitionTime));
202
+ d.log(models_1.LogLevel.Info, `Received dimmerSetLight API call.`);
203
+ d.setLight(command);
165
204
  return null;
166
205
  }
167
206
  /**
168
- * Changes the status of a given actuator
207
+ * Changes the status of a given led-device
208
+ * @deprecated Use "API.ledSetLight" instead
209
+ * TODO: Remove deprecated API method
169
210
  * @param {string} deviceId The device Id of the actuator
170
211
  * @param {boolean} state The desired new state
171
212
  * @param timeout A chosen Timeout after which the light should be reset
@@ -176,25 +217,45 @@ class API {
176
217
  * @returns {Error | null} In case it failed the Error containing the reason
177
218
  */
178
219
  static setLedLamp(deviceId, state, timeout, brightness, transitionTime, color, colorTemp) {
220
+ return this.ledSetLight(deviceId, new models_1.LedSetLightCommand(models_1.CommandSource.API, state, '', timeout, brightness, transitionTime, color, colorTemp));
221
+ }
222
+ /**
223
+ * Changes the status of a given led-device
224
+ * @param {string} deviceId The device Id of the LED-Device
225
+ * @param {LedSetLightCommand} command The command(stack) to perform on the led-device
226
+ */
227
+ static ledSetLight(deviceId, command) {
179
228
  const d = this.getDevice(deviceId);
180
229
  if (d === undefined) {
181
230
  return new Error(`Device with ID ${deviceId} not found`);
182
231
  }
183
232
  if (!d.deviceCapabilities.includes(DeviceCapability_1.DeviceCapability.ledLamp)) {
184
- return new Error(`Device with ID ${deviceId} is no dimmablelamp`);
233
+ return new Error(`Device with ID ${deviceId} is no LED`);
185
234
  }
186
- d.log(models_1.LogLevel.Info, `API Call to set LED to ${state} with brightness ${brightness} and color ${color} for ${timeout}ms`);
187
- d.setLight(new models_1.LedSetLightCommand(models_1.CommandSource.API, state, '', timeout, brightness, transitionTime, color, colorTemp));
235
+ d.log(models_1.LogLevel.Info, `Received ledSetLight API call.`);
236
+ d.setLight(command);
188
237
  return null;
189
238
  }
190
239
  /**
191
240
  * Changes the position of a given shutter
192
241
  * if needed this updates the window position as well
242
+ * @deprecated Use "API.shutterSetLevel" instead
243
+ * TODO: Remove deprecated API method
193
244
  * @param {string} deviceId The device Id of the shutter
194
245
  * @param {number} level The desired new level (0 being open, 100 being closed)
195
246
  * @returns {Error | null} Error if there is no shutter with the given id
196
247
  */
197
248
  static setShutter(deviceId, level) {
249
+ return this.shutterSetLevel(deviceId, new models_1.ShutterSetLevelCommand(models_1.CommandSource.API, level));
250
+ }
251
+ /**
252
+ * Changes the position of a given shutter
253
+ * if needed this updates the window position as well
254
+ * @param {string} deviceId The device Id of the shutter
255
+ * @param {ShutterSetLevelCommand} command The command(stack) to perform on the shutter
256
+ * @returns {Error | null} Error if there is no shutter with the given id
257
+ */
258
+ static shutterSetLevel(deviceId, command) {
198
259
  const d = this.getDevice(deviceId);
199
260
  if (d === undefined) {
200
261
  return new Error(`Device with ID ${deviceId} not found`);
@@ -204,14 +265,15 @@ class API {
204
265
  }
205
266
  if (d.window) {
206
267
  // otherwise it will be overridden shortly after
207
- d.window.setDesiredPosition(new models_1.WindowSetDesiredPositionCommand(models_1.CommandSource.API, level));
268
+ d.window.setDesiredPosition(new models_1.WindowSetDesiredPositionCommand(command, command.level));
208
269
  }
209
270
  else {
210
- d.setLevel(new models_1.ShutterSetLevelCommand(models_1.CommandSource.API, level));
271
+ d.setLevel(command);
211
272
  }
212
- d.log(models_1.LogLevel.Info, `API Call to set Shutter to ${level}`);
273
+ d.log(models_1.LogLevel.Info, `Received shutterSetLevel API call.`);
213
274
  return null;
214
275
  }
276
+ // TODO: Missing Comment
215
277
  static speakOnDevice(deviceId, message, volume = 30) {
216
278
  const d = this.getDevice(deviceId);
217
279
  if (d === undefined) {
@@ -279,6 +341,7 @@ class API {
279
341
  d.settings.persist(d);
280
342
  return null;
281
343
  }
344
+ // TODO: Missing Comment
282
345
  static setGroupSettings(groupId, settings) {
283
346
  const g = this.getGroup(groupId);
284
347
  if (g === undefined) {
@@ -308,6 +371,7 @@ class API {
308
371
  r.settings.settingsContainer.persist(r);
309
372
  return null;
310
373
  }
374
+ // TODO: Missing Comment
311
375
  static getLastCameraImage(deviceId) {
312
376
  const d = this.getDevice(deviceId);
313
377
  if (d === undefined) {
@@ -318,6 +382,7 @@ class API {
318
382
  }
319
383
  return d.lastImage;
320
384
  }
385
+ // TODO: Missing Comment
321
386
  static persistAllDeviceSettings() {
322
387
  var _a;
323
388
  log_service_1.ServerLogService.writeLog(models_1.LogLevel.Info, `API Call to persist all device settings`);
@@ -325,6 +390,7 @@ class API {
325
390
  (_a = device.settings) === null || _a === void 0 ? void 0 : _a.persist(device);
326
391
  }
327
392
  }
393
+ // TODO: Missing Comment
328
394
  static loadAllDeviceSettingsFromDb() {
329
395
  log_service_1.ServerLogService.writeLog(models_1.LogLevel.Info, `API Call to load all device settings`);
330
396
  for (const device of Object.values(devices_1.Devices.alLDevices)) {
@@ -333,10 +399,21 @@ class API {
333
399
  }
334
400
  /**
335
401
  * Lifts a previously started Block of automatic
402
+ * @deprecated Use "API.blockAutomaticLiftAutomaticBlock" instead
403
+ * TODO: Remove deprecated API method
336
404
  * @param {string} deviceId The target device
337
405
  * @returns {Error | null} In case it failed the Error containing the reason
338
406
  */
339
407
  static liftAutomaticBlock(deviceId) {
408
+ return this.blockAutomaticLiftAutomaticBlock(deviceId, new models_1.BlockAutomaticLiftBlockCommand(models_1.CommandSource.API));
409
+ }
410
+ /**
411
+ * Lifts a previously started Block of automatic
412
+ * @param {string} deviceId The target device
413
+ * @param {BlockAutomaticLiftBlockCommand} command The command to lift the automatic block
414
+ * @returns {Error | null} In case it failed the Error containing the reason
415
+ */
416
+ static blockAutomaticLiftAutomaticBlock(deviceId, command) {
340
417
  const d = this.getDevice(deviceId);
341
418
  if (d === undefined) {
342
419
  return new Error(`Device with ID ${deviceId} not found`);
@@ -344,18 +421,30 @@ class API {
344
421
  if (!d.deviceCapabilities.includes(DeviceCapability_1.DeviceCapability.blockAutomatic)) {
345
422
  return new Error(`Device with ID ${deviceId} is not capable of blocking automatic`);
346
423
  }
347
- d.log(models_1.LogLevel.Info, `API Call to lift automatic block`);
348
- d.blockAutomationHandler.liftAutomaticBlock();
424
+ d.log(models_1.LogLevel.Info, `Received API Call to lift automatic block.`);
425
+ d.blockAutomationHandler.liftAutomaticBlock(command);
349
426
  return null;
350
427
  }
351
428
  /**
352
429
  * Blocks the automatic of the given device for provided Duration
430
+ * @deprecated Use "API.blockAutomaticDisable" instead
431
+ * TODO: Remove deprecated API method
353
432
  * @param {string} deviceId The target device
354
433
  * @param {number} duration The duration in ms for which the device should remain in current state
355
434
  * @param {CollisionSolving} onCollision The desired Collision Solving strategy, in case the automatic being blocked already
356
435
  * @returns {Error | null} In case it failed the Error containing the reason
357
436
  */
358
437
  static blockAutomatic(deviceId, duration, onCollision) {
438
+ this.blockAutomaticSetBlock(deviceId, new models_1.BlockAutomaticCommand(models_1.CommandSource.API, duration, '', onCollision));
439
+ return null;
440
+ }
441
+ /**
442
+ * Blocks the automatic of the given device for provided Duration
443
+ * @param {string} deviceId The target device
444
+ * @param {BlockAutomaticCommand} command The command to block the automatic
445
+ * @returns {Error | null} In case it failed the Error containing the reason
446
+ */
447
+ static blockAutomaticSetBlock(deviceId, command) {
359
448
  const d = this.getDevice(deviceId);
360
449
  if (d === undefined) {
361
450
  return new Error(`Device with ID ${deviceId} not found`);
@@ -363,10 +452,11 @@ class API {
363
452
  if (!d.deviceCapabilities.includes(DeviceCapability_1.DeviceCapability.blockAutomatic)) {
364
453
  return new Error(`Device with ID ${deviceId} is not capable of blocking automatic`);
365
454
  }
366
- d.log(models_1.LogLevel.Info, `API Call to block automatic for ${duration}ms with ${onCollision} on collision`);
367
- d.blockAutomationHandler.disableAutomatic(duration, onCollision);
455
+ d.log(models_1.LogLevel.Info, `Received API Call to block automatic.`);
456
+ d.blockAutomationHandler.disableAutomatic(command);
368
457
  return null;
369
458
  }
459
+ // TODO: Missing Comment
370
460
  static pressButtonSwitch(deviceId, position, pressType) {
371
461
  const d = this.getDevice(deviceId);
372
462
  if (d === undefined) {
@@ -1,18 +1,15 @@
1
- /// <reference types="node" />
2
- import { CollisionSolving, RestoreTargetAutomaticValueCommand } from '../../models';
1
+ import { BlockAutomaticCommand, BlockAutomaticLiftBlockCommand, BlockAutomaticUntilCommand, RestoreTargetAutomaticValueCommand } from '../../models';
3
2
  export declare class BlockAutomaticHandler {
4
3
  private readonly _restoreAutomatic;
5
- private _delayedLiftTimeout;
6
- constructor(restoreAutomaticCb: (c: RestoreTargetAutomaticValueCommand) => void);
7
4
  private _automaticBlockedUntil;
5
+ private _restoreAutomaticStateTimeout;
6
+ constructor(restoreAutomaticCb: (c: RestoreTargetAutomaticValueCommand) => void);
8
7
  get automaticBlockedUntil(): Date;
9
8
  private set automaticBlockedUntil(value);
10
- private _restoreAutomaticStateTimeout;
11
- get restoreAutomaticStateTimeout(): NodeJS.Timeout | null;
12
9
  get automaticBlockActive(): boolean;
13
- disableAutomatic(durationMS: number, onCollideAction?: CollisionSolving): void;
14
- disableAutomaticUntil(targetDate: Date, onCollideAction?: CollisionSolving): void;
15
- liftAutomaticBlock(delay?: number): void;
10
+ disableAutomatic(c: BlockAutomaticCommand): void;
11
+ disableAutomaticUntil(c: BlockAutomaticUntilCommand): void;
12
+ liftAutomaticBlock(c: BlockAutomaticLiftBlockCommand): void;
16
13
  private updateRestoreTimeout;
17
14
  toJSON(): Partial<BlockAutomaticHandler>;
18
15
  }
@@ -9,7 +9,6 @@ const utils_1 = require("./utils");
9
9
  const lodash_1 = __importDefault(require("lodash"));
10
10
  class BlockAutomaticHandler {
11
11
  constructor(restoreAutomaticCb) {
12
- this._delayedLiftTimeout = null;
13
12
  this._automaticBlockedUntil = new Date(0);
14
13
  this._restoreAutomaticStateTimeout = null;
15
14
  this._restoreAutomatic = restoreAutomaticCb;
@@ -19,49 +18,32 @@ class BlockAutomaticHandler {
19
18
  }
20
19
  set automaticBlockedUntil(target) {
21
20
  this._automaticBlockedUntil = target;
22
- this.updateRestoreTimeout();
23
- }
24
- get restoreAutomaticStateTimeout() {
25
- return this._restoreAutomaticStateTimeout;
26
21
  }
27
22
  get automaticBlockActive() {
28
23
  return this._automaticBlockedUntil > new Date();
29
24
  }
30
- disableAutomatic(durationMS, onCollideAction = models_1.CollisionSolving.overrideIfGreater) {
31
- this.disableAutomaticUntil(new Date(utils_1.Utils.nowMS() + durationMS), onCollideAction);
25
+ disableAutomatic(c) {
26
+ this.disableAutomaticUntil(new models_1.BlockAutomaticUntilCommand(c, new Date(utils_1.Utils.nowMS() + c.durationMS), '', c.onCollideAction));
32
27
  }
33
- disableAutomaticUntil(targetDate, onCollideAction = models_1.CollisionSolving.overrideIfGreater) {
28
+ disableAutomaticUntil(c) {
34
29
  const now = new Date();
35
30
  if (this._automaticBlockedUntil > now &&
36
- onCollideAction != models_1.CollisionSolving.override &&
37
- (onCollideAction != models_1.CollisionSolving.overrideIfGreater || targetDate < this._automaticBlockedUntil)) {
31
+ c.onCollideAction != models_1.CollisionSolving.override &&
32
+ (c.onCollideAction != models_1.CollisionSolving.overrideIfGreater || c.targetDate < this._automaticBlockedUntil)) {
38
33
  return;
39
34
  }
40
- this.automaticBlockedUntil = targetDate;
35
+ this.automaticBlockedUntil = c.targetDate;
36
+ this.updateRestoreTimeout(new models_1.RestoreTargetAutomaticValueCommand(c, 'Restore to automatic state after block.'));
41
37
  }
42
- // TODO: Missing conversion to command
43
- liftAutomaticBlock(delay = 0) {
44
- if (delay <= 0) {
45
- this.automaticBlockedUntil = new Date(0);
46
- return;
47
- }
48
- if (this._delayedLiftTimeout !== null) {
49
- return;
50
- }
51
- const currentBlockedUntil = this._automaticBlockedUntil;
52
- this._delayedLiftTimeout = utils_1.Utils.guardedTimeout(() => {
53
- this._delayedLiftTimeout = null;
54
- if (this.automaticBlockActive && this._automaticBlockedUntil.getTime() === currentBlockedUntil.getTime()) {
55
- this.liftAutomaticBlock(0);
56
- }
57
- }, delay, this);
38
+ liftAutomaticBlock(c) {
39
+ this._restoreAutomatic(new models_1.RestoreTargetAutomaticValueCommand(c));
58
40
  }
59
- updateRestoreTimeout() {
41
+ updateRestoreTimeout(c) {
60
42
  if (this._restoreAutomaticStateTimeout !== null) {
61
43
  clearTimeout(this._restoreAutomaticStateTimeout);
62
44
  }
63
45
  this._restoreAutomaticStateTimeout = utils_1.Utils.guardedTimeout(() => {
64
- this._restoreAutomatic(new models_1.RestoreTargetAutomaticValueCommand(models_1.CommandSource.Unknown, 'Automatic block restore timeout'));
46
+ this._restoreAutomatic(c);
65
47
  }, this._automaticBlockedUntil.getTime() - utils_1.Utils.nowMS() + 500, this);
66
48
  }
67
49
  toJSON() {
@@ -130,7 +130,7 @@ class OwnGoveeDevice {
130
130
  this.turnOff();
131
131
  }
132
132
  if (c.timeout > -1 && !dontBlock) {
133
- this.blockAutomationHandler.disableAutomatic(c.timeout, models_1.CollisionSolving.overrideIfGreater);
133
+ this.blockAutomationHandler.disableAutomatic(new models_1.BlockAutomaticCommand(c, c.timeout));
134
134
  }
135
135
  }
136
136
  setActuator(c) {