hoffmation-base 3.2.1-alpha.6 → 3.2.1-alpha.8

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.
@@ -25,7 +25,7 @@ class BaseCommand {
25
25
  if (this.overrideCommandSource !== undefined) {
26
26
  return this.overrideCommandSource === enums_1.CommandSource.Automatic;
27
27
  }
28
- if (this.source instanceof BaseCommand) {
28
+ if (typeof this.source === 'object') {
29
29
  return this.source.isAutomaticAction;
30
30
  }
31
31
  return this.source === enums_1.CommandSource.Automatic;
@@ -36,7 +36,7 @@ class BaseCommand {
36
36
  this.overrideCommandSource === enums_1.CommandSource.API ||
37
37
  this.overrideCommandSource === enums_1.CommandSource.Force);
38
38
  }
39
- if (this.source instanceof BaseCommand) {
39
+ if (typeof this.source === 'object') {
40
40
  return this.source.isForceAction;
41
41
  }
42
42
  return (this.source === enums_1.CommandSource.Manual || this.source === enums_1.CommandSource.API || this.source === enums_1.CommandSource.Force);
@@ -45,7 +45,7 @@ class BaseCommand {
45
45
  if (this.overrideCommandSource !== undefined) {
46
46
  return this.overrideCommandSource === enums_1.CommandSource.Manual || this.overrideCommandSource === enums_1.CommandSource.API;
47
47
  }
48
- if (this.source instanceof BaseCommand) {
48
+ if (typeof this.source === 'object') {
49
49
  return this.source.isManual;
50
50
  }
51
51
  return this.source === enums_1.CommandSource.Manual || this.source === enums_1.CommandSource.API;
@@ -54,7 +54,7 @@ class BaseCommand {
54
54
  if (this.overrideCommandSource !== undefined) {
55
55
  return this.overrideCommandSource === enums_1.CommandSource.Initial;
56
56
  }
57
- if (this.source instanceof BaseCommand) {
57
+ if (typeof this.source === 'object') {
58
58
  return this.source.isInitial;
59
59
  }
60
60
  return this.source === enums_1.CommandSource.Initial;
@@ -67,7 +67,7 @@ class BaseCommand {
67
67
  if (this.ignoreReason !== undefined) {
68
68
  ownPart += ` ignored due to: "${this.ignoreReason}"`;
69
69
  }
70
- if (this.source instanceof BaseCommand) {
70
+ if (typeof this.source === 'object') {
71
71
  return `${this.source.reasonTrace} -> ${ownPart}`;
72
72
  }
73
73
  return `CommandType("${enums_1.CommandSource[this.source]}") stack => ${ownPart}`;
@@ -76,7 +76,7 @@ class BaseCommand {
76
76
  if (this.type === type) {
77
77
  return true;
78
78
  }
79
- if (this.source instanceof BaseCommand) {
79
+ if (typeof this.source === 'object') {
80
80
  return this.source.containsType(type);
81
81
  }
82
82
  return false;
@@ -93,7 +93,7 @@ class BaseDevice {
93
93
  // eslint-disable-next-line
94
94
  const returnValue = lodash_1.default.omit(this, 'lastCommands');
95
95
  returnValue['lastCommands'] = this.lastCommands.readAmount(this.lastCommands.maximumSize);
96
- return utils_1.Utils.jsonFilter(this, this.jsonOmitKeys);
96
+ return utils_1.Utils.jsonFilter(returnValue, this.jsonOmitKeys);
97
97
  }
98
98
  }
99
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;
@@ -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
  }
@@ -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;
@@ -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
  /**
@@ -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.AcDevice = void 0;
7
- const lodash_1 = __importDefault(require("lodash"));
8
4
  const devices_1 = require("../../devices");
9
5
  const interfaces_1 = require("../../interfaces");
10
6
  const enums_1 = require("../../enums");
@@ -301,9 +297,9 @@ class AcDevice extends devices_1.RoomBaseDevice {
301
297
  /** @inheritDoc */
302
298
  toJSON() {
303
299
  // eslint-disable-next-line
304
- const result = lodash_1.default.omit(super.toJSON(), ['room', '_room']);
300
+ const result = super.toJSON();
305
301
  result['on'] = this.on;
306
- return utils_1.Utils.jsonFilter(result);
302
+ return result;
307
303
  }
308
304
  }
309
305
  exports.AcDevice = AcDevice;
@@ -45,6 +45,4 @@ export declare class OwnDaikinDevice extends AcDevice {
45
45
  */
46
46
  private handleDeviceUnreach;
47
47
  private handleParamNg;
48
- /** @inheritDoc */
49
- toJSON(): Partial<OwnDaikinDevice>;
50
48
  }
@@ -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.OwnDaikinDevice = void 0;
7
- const lodash_1 = __importDefault(require("lodash"));
8
4
  const ac_device_1 = require("./ac-device");
9
5
  const daikin_controller_1 = require("daikin-controller");
10
6
  const enums_1 = require("../../enums");
@@ -35,6 +31,7 @@ class OwnDaikinDevice extends ac_device_1.AcDevice {
35
31
  /** @inheritDoc */
36
32
  this.deviceType = enums_1.DeviceType.Daikin;
37
33
  this._on = false;
34
+ this.jsonOmitKeys.push('_device');
38
35
  }
39
36
  get device() {
40
37
  return this._device;
@@ -191,12 +188,5 @@ class OwnDaikinDevice extends ac_device_1.AcDevice {
191
188
  }
192
189
  });
193
190
  }
194
- /** @inheritDoc */
195
- toJSON() {
196
- // eslint-disable-next-line
197
- const result = lodash_1.default.omit(super.toJSON(), ['device', '_device']);
198
- result['on'] = this.on;
199
- return utils_1.Utils.jsonFilter(result);
200
- }
201
191
  }
202
192
  exports.OwnDaikinDevice = OwnDaikinDevice;