hoffmation-base 3.2.1-alpha.1 → 3.2.1-alpha.11

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 (44) hide show
  1. package/lib/action/actuatorChangeAction.js +1 -1
  2. package/lib/action/baseAction.d.ts +2 -1
  3. package/lib/action/baseAction.js +1 -2
  4. package/lib/action/batteryLevelChangeAction.js +1 -1
  5. package/lib/action/handleChangeAction.js +1 -1
  6. package/lib/action/humiditySensorChangeAction.js +1 -1
  7. package/lib/action/motionSensorAction.js +1 -1
  8. package/lib/action/presenceGroupAnyMovementAction.d.ts +2 -2
  9. package/lib/action/presenceGroupFirstEnterAction.d.ts +2 -2
  10. package/lib/action/presenceGroupLastLeftAction.d.ts +2 -2
  11. package/lib/action/shutterPositionChangedAction.js +1 -1
  12. package/lib/action/temperatureSensorChangeAction.js +1 -1
  13. package/lib/command/baseCommand.d.ts +7 -1
  14. package/lib/command/baseCommand.js +17 -8
  15. package/lib/devices/BaseDevice.js +8 -1
  16. package/lib/devices/CameraDevice.d.ts +1 -2
  17. package/lib/devices/CameraDevice.js +1 -10
  18. package/lib/devices/dachs/dachs.d.ts +0 -2
  19. package/lib/devices/dachs/dachs.js +17 -17
  20. package/lib/devices/dachs/dachsTemperatureSensor.js +1 -1
  21. package/lib/devices/espresense/detectedBluetoothDevice.d.ts +1 -2
  22. package/lib/devices/espresense/detectedBluetoothDevice.js +0 -3
  23. package/lib/devices/espresense/espresenseDevice.d.ts +1 -3
  24. package/lib/devices/espresense/espresenseDevice.js +0 -5
  25. package/lib/devices/govee/own-govee-device.js +0 -1
  26. package/lib/devices/hmIPDevices/hmIpRoll.d.ts +0 -2
  27. package/lib/devices/hmIPDevices/hmIpRoll.js +1 -7
  28. package/lib/devices/sharedFunctions/lampUtils.js +0 -1
  29. package/lib/devices/tv/tvDevice.js +2 -6
  30. package/lib/devices/velux/veluxShutter.d.ts +0 -2
  31. package/lib/devices/velux/veluxShutter.js +1 -7
  32. package/lib/devices/victron/victron-device.js +1 -1
  33. package/lib/interfaces/iJsonCustomPrepend.d.ts +9 -0
  34. package/lib/interfaces/iJsonCustomPrepend.js +2 -0
  35. package/lib/interfaces/index.d.ts +1 -0
  36. package/lib/interfaces/index.js +1 -0
  37. package/lib/services/ac/ac-device.js +2 -6
  38. package/lib/services/ac/own-daikin-device.d.ts +0 -2
  39. package/lib/services/ac/own-daikin-device.js +1 -11
  40. package/lib/tsconfig.tsbuildinfo +1 -1
  41. package/lib/utils/ringStorage.d.ts +1 -0
  42. package/lib/utils/ringStorage.js +3 -0
  43. package/lib/utils/utils.js +7 -1
  44. package/package.json +1 -1
@@ -5,7 +5,7 @@ const baseAction_1 = require("./baseAction");
5
5
  const enums_1 = require("../enums");
6
6
  class ActuatorChangeAction extends baseAction_1.BaseAction {
7
7
  constructor(device) {
8
- super(undefined, `New Actuator state (${device.actuatorOn}) received`);
8
+ super(enums_1.CommandSource.Automatic, `New Actuator state (${device.actuatorOn}) received`);
9
9
  /** @inheritDoc */
10
10
  this.type = enums_1.CommandType.ActuatorChangeAction;
11
11
  this.actuatorOn = device.actuatorOn;
@@ -1,5 +1,6 @@
1
1
  import { BaseCommand } from '../command';
2
+ import { CommandSource } from '../enums';
2
3
  export declare abstract class BaseAction extends BaseCommand {
3
- protected constructor(source?: BaseAction, reason?: string);
4
+ protected constructor(source: BaseAction | CommandSource, reason?: string);
4
5
  get logMessage(): string;
5
6
  }
@@ -2,10 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BaseAction = void 0;
4
4
  const command_1 = require("../command");
5
- const enums_1 = require("../enums");
6
5
  class BaseAction extends command_1.BaseCommand {
7
6
  constructor(source, reason) {
8
- super(source !== null && source !== void 0 ? source : enums_1.CommandSource.Automatic, reason);
7
+ super(source, reason);
9
8
  }
10
9
  get logMessage() {
11
10
  return this.reasonTrace;
@@ -5,7 +5,7 @@ const baseAction_1 = require("./baseAction");
5
5
  const enums_1 = require("../enums");
6
6
  class BatteryLevelChangeAction extends baseAction_1.BaseAction {
7
7
  constructor(device) {
8
- super(undefined, `New Battery Level (${device.batteryLevel}%) received`);
8
+ super(enums_1.CommandSource.Automatic, `New Battery Level (${device.batteryLevel}%) received`);
9
9
  /** @inheritDoc */
10
10
  this.type = enums_1.CommandType.BatteryManagerLevelChangeAction;
11
11
  this.newLevel = device.batteryLevel;
@@ -5,7 +5,7 @@ const baseAction_1 = require("./baseAction");
5
5
  const enums_1 = require("../enums");
6
6
  class HandleChangeAction extends baseAction_1.BaseAction {
7
7
  constructor(handle) {
8
- super(undefined, `${handle.customName} ${handle.position === enums_1.WindowPosition.closed ? 'opened' : 'closed'}`);
8
+ super(enums_1.CommandSource.Automatic, `${handle.customName} ${handle.position === enums_1.WindowPosition.closed ? 'opened' : 'closed'}`);
9
9
  /** @inheritDoc */
10
10
  this.type = enums_1.CommandType.HandleChangedAction;
11
11
  this.handle = handle;
@@ -5,7 +5,7 @@ const baseAction_1 = require("./baseAction");
5
5
  const enums_1 = require("../enums");
6
6
  class HumiditySensorChangeAction extends baseAction_1.BaseAction {
7
7
  constructor(sensor, newHumidity) {
8
- super(undefined, `${sensor.customName} detected ${newHumidity} humidity`);
8
+ super(enums_1.CommandSource.Automatic, `${sensor.customName} detected ${newHumidity} humidity`);
9
9
  /** @inheritDoc */
10
10
  this.type = enums_1.CommandType.HumiditySensorChangeAction;
11
11
  this.newHumidity = newHumidity;
@@ -5,7 +5,7 @@ const baseAction_1 = require("./baseAction");
5
5
  const enums_1 = require("../enums");
6
6
  class MotionSensorAction extends baseAction_1.BaseAction {
7
7
  constructor(sensor) {
8
- super(undefined, `${sensor.customName} ${sensor.movementDetected ? 'detected' : 'cleared'} motion`);
8
+ super(enums_1.CommandSource.Automatic, `${sensor.customName} ${sensor.movementDetected ? 'detected' : 'cleared'} motion`);
9
9
  /** @inheritDoc */
10
10
  this.type = enums_1.CommandType.MotionSensorAction;
11
11
  this.motionDetected = sensor.movementDetected;
@@ -1,7 +1,7 @@
1
1
  import { BaseAction } from './baseAction';
2
- import { CommandType } from '../enums';
2
+ import { CommandSource, CommandType } from '../enums';
3
3
  export declare class PresenceGroupAnyMovementAction extends BaseAction {
4
4
  /** @inheritDoc */
5
5
  type: CommandType;
6
- constructor(source?: BaseAction, reason?: string);
6
+ constructor(source: BaseAction | CommandSource, reason?: string);
7
7
  }
@@ -1,7 +1,7 @@
1
1
  import { BaseAction } from './baseAction';
2
- import { CommandType } from '../enums';
2
+ import { CommandSource, CommandType } from '../enums';
3
3
  export declare class PresenceGroupFirstEnterAction extends BaseAction {
4
4
  /** @inheritDoc */
5
5
  type: CommandType;
6
- constructor(source?: BaseAction, reason?: string);
6
+ constructor(source: BaseAction | CommandSource, reason?: string);
7
7
  }
@@ -1,7 +1,7 @@
1
- import { CommandType } from '../enums';
1
+ import { CommandSource, CommandType } from '../enums';
2
2
  import { BaseAction } from './baseAction';
3
3
  export declare class PresenceGroupLastLeftAction extends BaseAction {
4
4
  /** @inheritDoc */
5
5
  type: CommandType;
6
- constructor(source?: BaseAction, reason?: string);
6
+ constructor(source: BaseAction | CommandSource, reason?: string);
7
7
  }
@@ -5,7 +5,7 @@ const baseAction_1 = require("./baseAction");
5
5
  const enums_1 = require("../enums");
6
6
  class ShutterPositionChangedAction extends baseAction_1.BaseAction {
7
7
  constructor(shutter, newPosition) {
8
- super(undefined, `${shutter.customName} changed position to ${newPosition}`);
8
+ super(enums_1.CommandSource.Automatic, `${shutter.customName} changed position to ${newPosition}`);
9
9
  this.newPosition = newPosition;
10
10
  /** @inheritDoc */
11
11
  this.type = enums_1.CommandType.ShutterPositionChangedAction;
@@ -5,7 +5,7 @@ const baseAction_1 = require("./baseAction");
5
5
  const enums_1 = require("../enums");
6
6
  class TemperatureSensorChangeAction extends baseAction_1.BaseAction {
7
7
  constructor(sensor, newTemperature) {
8
- super(undefined, `${sensor.customName} detected ${newTemperature} °C`);
8
+ super(enums_1.CommandSource.Automatic, `${sensor.customName} detected ${newTemperature} °C`);
9
9
  /** @inheritDoc */
10
10
  this.type = enums_1.CommandType.TemperatureSensorChangeAction;
11
11
  this.newTemperature = newTemperature;
@@ -1,8 +1,13 @@
1
1
  import { CommandSource, CommandType } from '../enums';
2
2
  import { iBaseCommand } from './iBaseCommand';
3
- export declare abstract class BaseCommand implements iBaseCommand {
3
+ import { iJsonCustomPrepend, iJsonOmitKeys } from '../interfaces';
4
+ export declare abstract class BaseCommand implements iBaseCommand, iJsonOmitKeys, iJsonCustomPrepend {
4
5
  readonly source: CommandSource | iBaseCommand;
5
6
  readonly reason: string;
7
+ /**
8
+ *
9
+ */
10
+ jsonOmitKeys: string[];
6
11
  /**
7
12
  * The timestamp of the command being created
8
13
  */
@@ -35,5 +40,6 @@ export declare abstract class BaseCommand implements iBaseCommand {
35
40
  get reasonTrace(): string;
36
41
  containsType(type: CommandType): boolean;
37
42
  get logMessage(): string;
43
+ customPrepend(): Partial<unknown>;
38
44
  toJSON(): Partial<BaseCommand>;
39
45
  }
@@ -15,13 +15,17 @@ class BaseCommand {
15
15
  constructor(source = enums_1.CommandSource.Unknown, reason = '') {
16
16
  this.source = source;
17
17
  this.reason = reason;
18
+ /**
19
+ *
20
+ */
21
+ this.jsonOmitKeys = ['source'];
18
22
  this.timestamp = new Date();
19
23
  }
20
24
  get isAutomaticAction() {
21
25
  if (this.overrideCommandSource !== undefined) {
22
26
  return this.overrideCommandSource === enums_1.CommandSource.Automatic;
23
27
  }
24
- if (this.source instanceof BaseCommand) {
28
+ if (typeof this.source === 'object') {
25
29
  return this.source.isAutomaticAction;
26
30
  }
27
31
  return this.source === enums_1.CommandSource.Automatic;
@@ -32,7 +36,7 @@ class BaseCommand {
32
36
  this.overrideCommandSource === enums_1.CommandSource.API ||
33
37
  this.overrideCommandSource === enums_1.CommandSource.Force);
34
38
  }
35
- if (this.source instanceof BaseCommand) {
39
+ if (typeof this.source === 'object') {
36
40
  return this.source.isForceAction;
37
41
  }
38
42
  return (this.source === enums_1.CommandSource.Manual || this.source === enums_1.CommandSource.API || this.source === enums_1.CommandSource.Force);
@@ -41,7 +45,7 @@ class BaseCommand {
41
45
  if (this.overrideCommandSource !== undefined) {
42
46
  return this.overrideCommandSource === enums_1.CommandSource.Manual || this.overrideCommandSource === enums_1.CommandSource.API;
43
47
  }
44
- if (this.source instanceof BaseCommand) {
48
+ if (typeof this.source === 'object') {
45
49
  return this.source.isManual;
46
50
  }
47
51
  return this.source === enums_1.CommandSource.Manual || this.source === enums_1.CommandSource.API;
@@ -50,14 +54,14 @@ class BaseCommand {
50
54
  if (this.overrideCommandSource !== undefined) {
51
55
  return this.overrideCommandSource === enums_1.CommandSource.Initial;
52
56
  }
53
- if (this.source instanceof BaseCommand) {
57
+ if (typeof this.source === 'object') {
54
58
  return this.source.isInitial;
55
59
  }
56
60
  return this.source === enums_1.CommandSource.Initial;
57
61
  }
58
62
  get reasonTrace() {
59
63
  let ownPart = `${this.type}`;
60
- if (this.reason !== undefined) {
64
+ if (this.reason) {
61
65
  ownPart += `("${this.reason}")`;
62
66
  }
63
67
  if (this.ignoreReason !== undefined) {
@@ -66,13 +70,13 @@ class BaseCommand {
66
70
  if (typeof this.source === 'object') {
67
71
  return `${this.source.reasonTrace} -> ${ownPart}`;
68
72
  }
69
- return `CommandType("${enums_1.CommandSource[this.source]}") stack => ${ownPart}`;
73
+ return `CommandSource("${enums_1.CommandSource[this.source]}") stack => ${ownPart}`;
70
74
  }
71
75
  containsType(type) {
72
76
  if (this.type === type) {
73
77
  return true;
74
78
  }
75
- if (this.source instanceof BaseCommand) {
79
+ if (typeof this.source === 'object') {
76
80
  return this.source.containsType(type);
77
81
  }
78
82
  return false;
@@ -80,8 +84,13 @@ class BaseCommand {
80
84
  get logMessage() {
81
85
  return this.reasonTrace;
82
86
  }
87
+ customPrepend() {
88
+ return {
89
+ logMessage: this.logMessage,
90
+ };
91
+ }
83
92
  toJSON() {
84
- // eslint-disable-next-line
93
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
85
94
  const result = lodash_1.default.omit(this, ['source']);
86
95
  result['logMessage'] = this.logMessage;
87
96
  return result;
@@ -1,10 +1,14 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.BaseDevice = void 0;
4
7
  const enums_1 = require("../enums");
5
8
  const utils_1 = require("../utils");
6
9
  const logging_1 = require("../logging");
7
10
  const services_1 = require("../services");
11
+ const lodash_1 = __importDefault(require("lodash"));
8
12
  class BaseDevice {
9
13
  constructor(_info, deviceType) {
10
14
  this._info = _info;
@@ -86,7 +90,10 @@ class BaseDevice {
86
90
  }
87
91
  /** @inheritDoc */
88
92
  toJSON() {
89
- return utils_1.Utils.jsonFilter(this, this.jsonOmitKeys);
93
+ // eslint-disable-next-line
94
+ const returnValue = lodash_1.default.omit(this, 'lastCommands');
95
+ returnValue['lastCommands'] = this.lastCommands.readAmount(this.lastCommands.maximumSize);
96
+ return utils_1.Utils.jsonFilter(returnValue, this.jsonOmitKeys);
90
97
  }
91
98
  }
92
99
  exports.BaseDevice = BaseDevice;
@@ -1,4 +1,4 @@
1
- import { iBaseDevice, iCameraDevice, iCameraSettings, iRoomDevice } from '../interfaces';
1
+ import { iBaseDevice, iCameraDevice, iCameraSettings } from '../interfaces';
2
2
  import { LogDebugType, LogLevel } from '../enums';
3
3
  import { MotionSensorAction } from '../action';
4
4
  import { DeviceInfo } from './DeviceInfo';
@@ -34,7 +34,6 @@ export declare abstract class CameraDevice extends RoomBaseDevice implements iCa
34
34
  protected _lastUpdate: Date;
35
35
  get lastUpdate(): Date;
36
36
  protected constructor(name: string, roomName: string);
37
- toJSON(): Partial<iRoomDevice>;
38
37
  /** @inheritDoc */
39
38
  get lastImage(): string;
40
39
  /** @inheritDoc */
@@ -1,10 +1,6 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.CameraDevice = void 0;
7
- const lodash_1 = __importDefault(require("lodash"));
8
4
  const settingsObjects_1 = require("../settingsObjects");
9
5
  const enums_1 = require("../enums");
10
6
  const models_1 = require("../models");
@@ -43,18 +39,13 @@ class CameraDevice extends RoomBaseDevice_1.RoomBaseDevice {
43
39
  this._movementDetectFallbackTimeout = null;
44
40
  this._dogDetectFallbackTimeout = null;
45
41
  this._lastUpdate = new Date(0);
42
+ this.jsonOmitKeys.push('_lastImage');
46
43
  this.deviceCapabilities.push(enums_1.DeviceCapability.camera);
47
44
  this.deviceCapabilities.push(enums_1.DeviceCapability.motionSensor);
48
45
  this.name = name;
49
46
  devices_1.Devices.alLDevices[allDevicesKey] = this;
50
47
  utils_1.Utils.guardedTimeout(this.initializeMovementCounter, 4000, this);
51
48
  }
52
- toJSON() {
53
- return utils_1.Utils.jsonFilter(lodash_1.default.omit(super.toJSON(), [
54
- // To reduce Byte-size on cyclic update
55
- '_lastImage',
56
- ]));
57
- }
58
49
  /** @inheritDoc */
59
50
  get lastImage() {
60
51
  return this._lastImage;
@@ -57,8 +57,6 @@ export declare class Dachs extends RoomBaseDevice implements iBaseDevice, iActua
57
57
  /** @inheritDoc */
58
58
  restoreTargetAutomaticValue(c: RestoreTargetAutomaticValueCommand): void;
59
59
  /** @inheritDoc */
60
- toJSON(): Partial<Dachs>;
61
- /** @inheritDoc */
62
60
  persist(): void;
63
61
  private loadData;
64
62
  /** @inheritDoc */
@@ -14,7 +14,7 @@ const DeviceInfo_1 = require("../DeviceInfo");
14
14
  const devices_1 = require("../devices");
15
15
  const utils_1 = require("../../utils");
16
16
  const sharedFunctions_1 = require("../sharedFunctions");
17
- const sun_time_offsets_1 = require("../../models/sun-time-offsets");
17
+ const models_1 = require("../../models");
18
18
  const command_1 = require("../../command");
19
19
  const services_1 = require("../../services");
20
20
  const settings_service_1 = require("../../settings-service");
@@ -48,8 +48,20 @@ class Dachs extends RoomBaseDevice_1.RoomBaseDevice {
48
48
  this._dachsOn = false;
49
49
  this._tempWarmWater = 0;
50
50
  this._tempHeatStorage = 0;
51
+ this.jsonOmitKeys.push(...[
52
+ 'client',
53
+ 'config',
54
+ '_influxClient',
55
+ 'warmWaterSensor',
56
+ 'heatStorageTempSensor',
57
+ 'warmWaterPump',
58
+ 'heatingRod',
59
+ 'blockDachsStart',
60
+ 'warmWaterDachsAlternativeActuator',
61
+ ]);
51
62
  devices_1.Devices.alLDevices[allDevicesKey] = this;
52
63
  this.deviceCapabilities.push(enums_1.DeviceCapability.actuator);
64
+ this.deviceCapabilities.push(enums_1.DeviceCapability.blockAutomatic);
53
65
  if (options.influxDb) {
54
66
  this._influxClient = new lib_1.DachsInfluxClient(options.influxDb);
55
67
  }
@@ -84,21 +96,6 @@ class Dachs extends RoomBaseDevice_1.RoomBaseDevice {
84
96
  this.setActuator(new command_1.ActuatorSetStateCommand(c, this.targetAutomaticState, 'Restore Target Automatic value'));
85
97
  }
86
98
  /** @inheritDoc */
87
- toJSON() {
88
- return utils_1.Utils.jsonFilter(lodash_1.default.omit(super.toJSON(), [
89
- 'room',
90
- 'client',
91
- 'config',
92
- '_influxClient',
93
- 'warmWaterSensor',
94
- 'heatStorageTempSensor',
95
- 'warmWaterPump',
96
- 'heatingRod',
97
- 'blockDachsStart',
98
- 'warmWaterDachsAlternativeActuator',
99
- ]));
100
- }
101
- /** @inheritDoc */
102
99
  persist() {
103
100
  var _a;
104
101
  (_a = services_1.Persistence.dbo) === null || _a === void 0 ? void 0 : _a.persistActuator(this);
@@ -193,6 +190,9 @@ class Dachs extends RoomBaseDevice_1.RoomBaseDevice {
193
190
  this.checkAllDesiredStates(action, action.newLevel);
194
191
  }
195
192
  checkAllDesiredStates(action, batteryLevel) {
193
+ if (this.blockAutomationHandler.automaticBlockActive) {
194
+ return;
195
+ }
196
196
  const shouldDachsBeStarted = this.shouldDachsBeStarted(action, batteryLevel);
197
197
  this.checkHeatingRod(action, batteryLevel);
198
198
  this.checkAlternativeActuator(shouldDachsBeStarted, action);
@@ -305,7 +305,7 @@ class Dachs extends RoomBaseDevice_1.RoomBaseDevice {
305
305
  // It is winter and heat storage is kinda cold --> Start
306
306
  return true;
307
307
  }
308
- const dayType = services_1.TimeCallbackService.dayType(new sun_time_offsets_1.SunTimeOffsets());
308
+ const dayType = services_1.TimeCallbackService.dayType(new models_1.SunTimeOffsets());
309
309
  if ((dayType === enums_1.TimeOfDay.Daylight || dayType === enums_1.TimeOfDay.BeforeSunrise) &&
310
310
  batteryLevel > this.settings.batteryLevelTurnOnThreshold) {
311
311
  // It is daytime (maybe solar power) and it is no critical battery level
@@ -20,7 +20,7 @@ class DachsTemperatureSensor extends RoomBaseDevice_1.RoomBaseDevice {
20
20
  /** @inheritDoc */
21
21
  this.temperatureSensor = new sharedFunctions_1.TemperatureSensor(this);
22
22
  this.deviceCapabilities.push(enums_1.DeviceCapability.temperatureSensor);
23
- this.jsonOmitKeys.push(...['room', 'client', 'config', '_influxClient']);
23
+ this.jsonOmitKeys.push(...['client', 'config', '_influxClient']);
24
24
  devices_1.Devices.alLDevices[allDevicesKey] = this;
25
25
  devices_1.Devices.temperatureWarmWater = this;
26
26
  }
@@ -1,5 +1,5 @@
1
1
  import { LogDebugType, LogLevel } from '../../enums';
2
- import { iBaseDevice, iBluetoothTrackingSettings } from '../../interfaces';
2
+ import { iBluetoothTrackingSettings } from '../../interfaces';
3
3
  import { TrackedDistanceData } from './trackedDistanceData';
4
4
  import { iBluetoothDetector } from '../../interfaces/baseDevices/iBluetoothDetector';
5
5
  import { BaseDevice } from '../BaseDevice';
@@ -24,7 +24,6 @@ export declare class DetectedBluetoothDevice extends BaseDevice {
24
24
  get name(): string;
25
25
  updateDistance(tracker: iBluetoothDetector, distance: number): void;
26
26
  log(level: LogLevel, message: string, debugType?: LogDebugType): void;
27
- toJSON(): Partial<iBaseDevice>;
28
27
  getDistance(id: string, maxAge?: number): TrackedDistanceData | undefined;
29
28
  getDistances(maxAge?: number): Array<TrackedDistanceData>;
30
29
  getDistanceReport(maxAge?: number): string;
@@ -62,9 +62,6 @@ class DetectedBluetoothDevice extends BaseDevice_1.BaseDevice {
62
62
  deviceName: this.name,
63
63
  });
64
64
  }
65
- toJSON() {
66
- return utils_1.Utils.jsonFilter(this);
67
- }
68
65
  getDistance(id, maxAge = 120) {
69
66
  const data = this.distanceMap.get(id);
70
67
  if (data === undefined) {
@@ -1,4 +1,4 @@
1
- import { iRoomDevice, iTrilaterationBasePoint } from '../../interfaces';
1
+ import { iTrilaterationBasePoint } from '../../interfaces';
2
2
  import { iBluetoothDetector } from '../../interfaces/baseDevices/iBluetoothDetector';
3
3
  import { ProximityCallback } from './proximityCallback';
4
4
  import { RoomBaseDevice } from '../RoomBaseDevice';
@@ -35,8 +35,6 @@ export declare class EspresenseDevice extends RoomBaseDevice implements iBluetoo
35
35
  */
36
36
  update(devName: string, state: ioBroker.State): void;
37
37
  /** @inheritDoc */
38
- toJSON(): Partial<iRoomDevice>;
39
- /** @inheritDoc */
40
38
  loadDeviceSettings(): void;
41
39
  /** @inheritDoc */
42
40
  addProximityCallback(cb: ProximityCallback): void;
@@ -8,7 +8,6 @@ const DeviceInfo_1 = require("../DeviceInfo");
8
8
  const devices_1 = require("../devices");
9
9
  const espresenseCoordinator_1 = require("./espresenseCoordinator");
10
10
  const trilateration_1 = require("./trilateration");
11
- const utils_1 = require("../../utils");
12
11
  const RoomBaseDevice_1 = require("../RoomBaseDevice");
13
12
  class EspresenseDevice extends RoomBaseDevice_1.RoomBaseDevice {
14
13
  /**
@@ -107,10 +106,6 @@ class EspresenseDevice extends RoomBaseDevice_1.RoomBaseDevice {
107
106
  }
108
107
  }
109
108
  /** @inheritDoc */
110
- toJSON() {
111
- return utils_1.Utils.jsonFilter(this);
112
- }
113
- /** @inheritDoc */
114
109
  loadDeviceSettings() {
115
110
  // Nothing
116
111
  }
@@ -32,7 +32,6 @@ class OwnGoveeDevice extends RoomBaseDevice_1.RoomBaseDevice {
32
32
  this._color = '#fcba32';
33
33
  this._colortemp = 500;
34
34
  this._lastPersist = 0;
35
- this.jsonOmitKeys.push('device');
36
35
  this.deviceId = deviceId;
37
36
  this.deviceCapabilities.push(...[
38
37
  enums_1.DeviceCapability.ledLamp,
@@ -3,7 +3,6 @@ import { iShutter, iWindow } from '../../interfaces';
3
3
  import { ShutterSettings } from '../../settingsObjects';
4
4
  import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
5
5
  import { ShutterSetLevelCommand } from '../../command';
6
- import { IoBrokerBaseDevice } from '../IoBrokerBaseDevice';
7
6
  export declare class HmIpRoll extends HmIPDevice implements iShutter {
8
7
  /** @inheritDoc */
9
8
  settings: ShutterSettings;
@@ -23,5 +22,4 @@ export declare class HmIpRoll extends HmIPDevice implements iShutter {
23
22
  persist(): void;
24
23
  private setCurrentLevel;
25
24
  setLevel(command: ShutterSetLevelCommand): void;
26
- toJSON(): Partial<IoBrokerBaseDevice>;
27
25
  }
@@ -1,10 +1,6 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.HmIpRoll = void 0;
7
- const lodash_1 = __importDefault(require("lodash"));
8
4
  const hmIpDevice_1 = require("./hmIpDevice");
9
5
  const settingsObjects_1 = require("../../settingsObjects");
10
6
  const enums_1 = require("../../enums");
@@ -21,6 +17,7 @@ class HmIpRoll extends hmIpDevice_1.HmIPDevice {
21
17
  this._setLevel = -1;
22
18
  this._setLevelTime = -1;
23
19
  this._currentLevel = -1;
20
+ this.jsonOmitKeys.push('_window');
24
21
  this.deviceCapabilities.push(enums_1.DeviceCapability.shutter);
25
22
  this._setLevelSwitchID = `${this.info.fullID}.4.LEVEL`;
26
23
  (_a = this.dbo) === null || _a === void 0 ? void 0 : _a.getLastDesiredPosition(this).then((val) => {
@@ -117,8 +114,5 @@ class HmIpRoll extends hmIpDevice_1.HmIPDevice {
117
114
  this.log(enums_1.LogLevel.Debug, `Fahre Rollo auf Position ${targetLevel}`);
118
115
  this.setState(this._setLevelSwitchID, targetLevel);
119
116
  }
120
- toJSON() {
121
- return lodash_1.default.omit(super.toJSON(), ['_window']);
122
- }
123
117
  }
124
118
  exports.HmIpRoll = HmIpRoll;
@@ -115,7 +115,6 @@ class LampUtils {
115
115
  device.targetAutomaticState = c.on;
116
116
  }
117
117
  if (LampUtils.canActuatorChangeBeSkipped(device, c)) {
118
- device.logCommand(c, 'Actuator change can be skipped');
119
118
  return;
120
119
  }
121
120
  device.queuedValue = c.on;
@@ -1,10 +1,6 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.TvDevice = void 0;
7
- const lodash_1 = __importDefault(require("lodash"));
8
4
  const enums_1 = require("../../enums");
9
5
  const settingsObjects_1 = require("../../settingsObjects");
10
6
  const DeviceInfo_1 = require("../DeviceInfo");
@@ -45,9 +41,9 @@ class TvDevice extends RoomBaseDevice_1.RoomBaseDevice {
45
41
  }
46
42
  toJSON() {
47
43
  // eslint-disable-next-line
48
- const result = lodash_1.default.omit(super.toJSON(), ['room']);
44
+ const result = super.toJSON();
49
45
  result['on'] = this.on;
50
- return utils_1.Utils.jsonFilter(result);
46
+ return result;
51
47
  }
52
48
  }
53
49
  exports.TvDevice = TvDevice;
@@ -3,7 +3,6 @@ import { iShutter, iWindow } from '../../interfaces';
3
3
  import { ShutterSettings } from '../../settingsObjects';
4
4
  import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
5
5
  import { ShutterSetLevelCommand } from '../../command';
6
- import { IoBrokerBaseDevice } from '../IoBrokerBaseDevice';
7
6
  export declare class VeluxShutter extends VeluxDevice implements iShutter {
8
7
  /** @inheritDoc */
9
8
  settings: ShutterSettings;
@@ -22,6 +21,5 @@ export declare class VeluxShutter extends VeluxDevice implements iShutter {
22
21
  update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
23
22
  persist(): void;
24
23
  setLevel(command: ShutterSetLevelCommand): void;
25
- toJSON(): Partial<IoBrokerBaseDevice>;
26
24
  private setCurrentLevel;
27
25
  }
@@ -1,10 +1,6 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.VeluxShutter = void 0;
7
- const lodash_1 = __importDefault(require("lodash"));
8
4
  const veluxDevice_1 = require("./veluxDevice");
9
5
  const settingsObjects_1 = require("../../settingsObjects");
10
6
  const enums_1 = require("../../enums");
@@ -21,6 +17,7 @@ class VeluxShutter extends veluxDevice_1.VeluxDevice {
21
17
  this._setLevel = -1;
22
18
  this._setLevelTime = -1;
23
19
  this._currentLevel = -1;
20
+ this.jsonOmitKeys.push('_window');
24
21
  this.deviceCapabilities.push(enums_1.DeviceCapability.shutter);
25
22
  this._setLevelSwitchID = `${this.info.fullID}.targetPosition`;
26
23
  (_a = this.dbo) === null || _a === void 0 ? void 0 : _a.getLastDesiredPosition(this).then((val) => {
@@ -103,9 +100,6 @@ class VeluxShutter extends veluxDevice_1.VeluxDevice {
103
100
  // Level is inverted for Velux Adapter (100 = 0, 0 = 100, 25 = 75, etc.)
104
101
  this.setState(this._setLevelSwitchID, Math.abs(targetLevel - 100));
105
102
  }
106
- toJSON() {
107
- return lodash_1.default.omit(super.toJSON(), ['_window']);
108
- }
109
103
  setCurrentLevel(value, initial = false) {
110
104
  let correctedValue = Math.abs(value - 100);
111
105
  if (correctedValue !== this._setLevel && utils_1.Utils.nowMS() - this._setLevelTime < 60 * 10000) {
@@ -135,7 +135,7 @@ class VictronDevice extends BaseDevice_1.BaseDevice {
135
135
  injectingWattage: this.injectingWattage,
136
136
  selfConsumingWattage: this.selfConsumingWattage,
137
137
  },
138
- ...utils_1.Utils.jsonFilter(super.toJSON(), this.jsonOmitKeys),
138
+ ...super.toJSON(),
139
139
  };
140
140
  }
141
141
  /**
@@ -0,0 +1,9 @@
1
+ /**
2
+ * An object which defines certain keys to append to the JSON output
3
+ */
4
+ export interface iJsonCustomPrepend {
5
+ /**
6
+ * List of keys to append
7
+ */
8
+ readonly customPrepend: () => Partial<unknown>;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -16,6 +16,7 @@ export * from './iButtonCallback';
16
16
  export * from './iButtonCapabilities';
17
17
  export * from './iDeviceInfo';
18
18
  export * from './iIdHolder';
19
+ export * from './iJsonCustomPrepend';
19
20
  export * from './iJsonOmitKeys';
20
21
  export * from './iLogSettings';
21
22
  export * from './iAsusConfig';
@@ -32,6 +32,7 @@ __exportStar(require("./iButtonCallback"), exports);
32
32
  __exportStar(require("./iButtonCapabilities"), exports);
33
33
  __exportStar(require("./iDeviceInfo"), exports);
34
34
  __exportStar(require("./iIdHolder"), exports);
35
+ __exportStar(require("./iJsonCustomPrepend"), exports);
35
36
  __exportStar(require("./iJsonOmitKeys"), exports);
36
37
  __exportStar(require("./iLogSettings"), exports);
37
38
  __exportStar(require("./iAsusConfig"), exports);