hoffmation-base 3.2.1-alpha.3 → 3.2.1-alpha.5

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.
@@ -61,13 +61,13 @@ class BaseCommand {
61
61
  }
62
62
  get reasonTrace() {
63
63
  let ownPart = `${this.type}`;
64
- if (this.reason !== undefined) {
64
+ if (this.reason) {
65
65
  ownPart += `("${this.reason}")`;
66
66
  }
67
67
  if (this.ignoreReason !== undefined) {
68
68
  ownPart += ` ignored due to: "${this.ignoreReason}"`;
69
69
  }
70
- if (typeof this.source === 'object') {
70
+ if (this.source.timestamp) {
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 (this.source.timestamp) {
80
80
  return this.source.containsType(type);
81
81
  }
82
82
  return false;
@@ -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,6 +90,9 @@ class BaseDevice {
86
90
  }
87
91
  /** @inheritDoc */
88
92
  toJSON() {
93
+ // eslint-disable-next-line
94
+ const returnValue = lodash_1.default.omit(this, 'lastCommands');
95
+ returnValue['lastCommands'] = this.lastCommands.readAmount(this.lastCommands.maximumSize);
89
96
  return utils_1.Utils.jsonFilter(this, this.jsonOmitKeys);
90
97
  }
91
98
  }
@@ -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
  }
@@ -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;