hoffmation-base 3.2.1-alpha.4 → 3.2.1-alpha.6
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.
- package/lib/action/actuatorChangeAction.js +1 -1
- package/lib/action/baseAction.d.ts +2 -1
- package/lib/action/baseAction.js +1 -2
- package/lib/action/batteryLevelChangeAction.js +1 -1
- package/lib/action/handleChangeAction.js +1 -1
- package/lib/action/humiditySensorChangeAction.js +1 -1
- package/lib/action/motionSensorAction.js +1 -1
- package/lib/action/presenceGroupAnyMovementAction.d.ts +2 -2
- package/lib/action/presenceGroupFirstEnterAction.d.ts +2 -2
- package/lib/action/presenceGroupLastLeftAction.d.ts +2 -2
- package/lib/action/shutterPositionChangedAction.js +1 -1
- package/lib/action/temperatureSensorChangeAction.js +1 -1
- package/lib/command/baseCommand.js +2 -2
- package/lib/devices/BaseDevice.js +7 -0
- package/lib/devices/sharedFunctions/lampUtils.js +0 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/ringStorage.d.ts +1 -0
- package/lib/utils/ringStorage.js +3 -0
- 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(
|
|
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
|
|
4
|
+
protected constructor(source: BaseAction | CommandSource, reason?: string);
|
|
4
5
|
get logMessage(): string;
|
|
5
6
|
}
|
package/lib/action/baseAction.js
CHANGED
|
@@ -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
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
|
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
|
|
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
|
|
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(
|
|
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(
|
|
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;
|
|
@@ -61,13 +61,13 @@ class BaseCommand {
|
|
|
61
61
|
}
|
|
62
62
|
get reasonTrace() {
|
|
63
63
|
let ownPart = `${this.type}`;
|
|
64
|
-
if (this.reason
|
|
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 (
|
|
70
|
+
if (this.source instanceof BaseCommand) {
|
|
71
71
|
return `${this.source.reasonTrace} -> ${ownPart}`;
|
|
72
72
|
}
|
|
73
73
|
return `CommandType("${enums_1.CommandSource[this.source]}") stack => ${ownPart}`;
|
|
@@ -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
|
}
|