hoffmation-base 3.2.1-alpha.0 → 3.2.1-alpha.10
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.d.ts +7 -1
- package/lib/command/baseCommand.js +17 -8
- package/lib/devices/BaseDevice.js +8 -1
- package/lib/devices/CameraDevice.d.ts +1 -2
- package/lib/devices/CameraDevice.js +1 -10
- package/lib/devices/dachs/dachs.d.ts +0 -2
- package/lib/devices/dachs/dachs.js +11 -15
- package/lib/devices/dachs/dachsTemperatureSensor.d.ts +0 -6
- package/lib/devices/dachs/dachsTemperatureSensor.js +1 -22
- package/lib/devices/espresense/detectedBluetoothDevice.d.ts +3 -4
- package/lib/devices/espresense/detectedBluetoothDevice.js +1 -7
- package/lib/devices/espresense/espresenseDevice.d.ts +1 -3
- package/lib/devices/espresense/espresenseDevice.js +8 -11
- package/lib/devices/govee/own-govee-device.js +0 -1
- package/lib/devices/hmIPDevices/hmIpRoll.d.ts +0 -2
- package/lib/devices/hmIPDevices/hmIpRoll.js +1 -7
- package/lib/devices/sharedFunctions/lampUtils.js +0 -1
- package/lib/devices/tv/tvDevice.js +2 -6
- package/lib/devices/velux/veluxShutter.d.ts +0 -2
- package/lib/devices/velux/veluxShutter.js +1 -7
- package/lib/devices/victron/victron-device.js +1 -1
- package/lib/interfaces/iJsonCustomPrepend.d.ts +9 -0
- package/lib/interfaces/iJsonCustomPrepend.js +2 -0
- package/lib/interfaces/index.d.ts +1 -0
- package/lib/interfaces/index.js +1 -0
- package/lib/services/ac/ac-device.js +2 -6
- package/lib/services/ac/own-daikin-device.d.ts +0 -2
- package/lib/services/ac/own-daikin-device.js +1 -11
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/ringStorage.d.ts +1 -0
- package/lib/utils/ringStorage.js +3 -0
- package/lib/utils/utils.js +7 -1
- 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;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { CommandSource, CommandType } from '../enums';
|
|
2
2
|
import { iBaseCommand } from './iBaseCommand';
|
|
3
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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 `
|
|
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
|
|
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
|
-
|
|
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
|
|
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 */
|
|
@@ -48,6 +48,17 @@ 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);
|
|
53
64
|
if (options.influxDb) {
|
|
@@ -84,21 +95,6 @@ class Dachs extends RoomBaseDevice_1.RoomBaseDevice {
|
|
|
84
95
|
this.setActuator(new command_1.ActuatorSetStateCommand(c, this.targetAutomaticState, 'Restore Target Automatic value'));
|
|
85
96
|
}
|
|
86
97
|
/** @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
98
|
persist() {
|
|
103
99
|
var _a;
|
|
104
100
|
(_a = services_1.Persistence.dbo) === null || _a === void 0 ? void 0 : _a.persistActuator(this);
|
|
@@ -26,11 +26,5 @@ export declare class DachsTemperatureSensor extends RoomBaseDevice implements iT
|
|
|
26
26
|
/** @inheritDoc */
|
|
27
27
|
onTemperaturChange(newTemperatur: number): void;
|
|
28
28
|
/** @inheritDoc */
|
|
29
|
-
toJSON(): Partial<DachsTemperatureSensor>;
|
|
30
|
-
/** @inheritDoc */
|
|
31
|
-
persistDeviceInfo(): void;
|
|
32
|
-
/** @inheritDoc */
|
|
33
|
-
loadDeviceSettings(): void;
|
|
34
|
-
/** @inheritDoc */
|
|
35
29
|
dispose(): void;
|
|
36
30
|
}
|
|
@@ -1,16 +1,10 @@
|
|
|
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.DachsTemperatureSensor = void 0;
|
|
7
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
8
4
|
const enums_1 = require("../../enums");
|
|
9
5
|
const sharedFunctions_1 = require("../sharedFunctions");
|
|
10
6
|
const DeviceInfo_1 = require("../DeviceInfo");
|
|
11
7
|
const devices_1 = require("../devices");
|
|
12
|
-
const utils_1 = require("../../utils");
|
|
13
|
-
const services_1 = require("../../services");
|
|
14
8
|
const RoomBaseDevice_1 = require("../RoomBaseDevice");
|
|
15
9
|
class DachsTemperatureSensor extends RoomBaseDevice_1.RoomBaseDevice {
|
|
16
10
|
constructor(roomName, shortKey, longKey) {
|
|
@@ -26,6 +20,7 @@ class DachsTemperatureSensor extends RoomBaseDevice_1.RoomBaseDevice {
|
|
|
26
20
|
/** @inheritDoc */
|
|
27
21
|
this.temperatureSensor = new sharedFunctions_1.TemperatureSensor(this);
|
|
28
22
|
this.deviceCapabilities.push(enums_1.DeviceCapability.temperatureSensor);
|
|
23
|
+
this.jsonOmitKeys.push(...['client', 'config', '_influxClient']);
|
|
29
24
|
devices_1.Devices.alLDevices[allDevicesKey] = this;
|
|
30
25
|
devices_1.Devices.temperatureWarmWater = this;
|
|
31
26
|
}
|
|
@@ -65,22 +60,6 @@ class DachsTemperatureSensor extends RoomBaseDevice_1.RoomBaseDevice {
|
|
|
65
60
|
this.roomTemperature = newTemperatur;
|
|
66
61
|
}
|
|
67
62
|
/** @inheritDoc */
|
|
68
|
-
toJSON() {
|
|
69
|
-
return utils_1.Utils.jsonFilter(lodash_1.default.omit(super.toJSON(), ['room', 'client', 'config', '_influxClient']));
|
|
70
|
-
}
|
|
71
|
-
/** @inheritDoc */
|
|
72
|
-
persistDeviceInfo() {
|
|
73
|
-
utils_1.Utils.guardedTimeout(() => {
|
|
74
|
-
var _a;
|
|
75
|
-
(_a = services_1.Persistence.dbo) === null || _a === void 0 ? void 0 : _a.addDevice(this);
|
|
76
|
-
}, 5000, this);
|
|
77
|
-
}
|
|
78
|
-
/** @inheritDoc */
|
|
79
|
-
loadDeviceSettings() {
|
|
80
|
-
var _a;
|
|
81
|
-
(_a = this.settings) === null || _a === void 0 ? void 0 : _a.initializeFromDb(this);
|
|
82
|
-
}
|
|
83
|
-
/** @inheritDoc */
|
|
84
63
|
dispose() {
|
|
85
64
|
this.temperatureSensor.dispose();
|
|
86
65
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LogDebugType, LogLevel } from '../../enums';
|
|
2
|
-
import {
|
|
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';
|
|
@@ -19,16 +19,15 @@ export declare class DetectedBluetoothDevice extends BaseDevice {
|
|
|
19
19
|
* If the device is currently present
|
|
20
20
|
*/
|
|
21
21
|
present: boolean;
|
|
22
|
-
constructor(trackedDeviceId: string, settings
|
|
22
|
+
constructor(trackedDeviceId: string, settings: iBluetoothTrackingSettings);
|
|
23
23
|
get customName(): string;
|
|
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;
|
|
31
|
-
static getOrCreate(devName: string): DetectedBluetoothDevice;
|
|
30
|
+
static getOrCreate(devName: string): DetectedBluetoothDevice | undefined;
|
|
32
31
|
private static deviceKeyBySettings;
|
|
33
32
|
persistDeviceInfo(): void;
|
|
34
33
|
loadDeviceSettings(): void;
|
|
@@ -15,9 +15,6 @@ const BaseDevice_1 = require("../BaseDevice");
|
|
|
15
15
|
const DeviceInfo_1 = require("../DeviceInfo");
|
|
16
16
|
class DetectedBluetoothDevice extends BaseDevice_1.BaseDevice {
|
|
17
17
|
constructor(trackedDeviceId, settings) {
|
|
18
|
-
if (settings === undefined) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
18
|
const info = new DeviceInfo_1.DeviceInfo();
|
|
22
19
|
info.customName = settings.customName;
|
|
23
20
|
const allDevicesKey = DetectedBluetoothDevice.deviceKeyBySettings(settings);
|
|
@@ -65,9 +62,6 @@ class DetectedBluetoothDevice extends BaseDevice_1.BaseDevice {
|
|
|
65
62
|
deviceName: this.name,
|
|
66
63
|
});
|
|
67
64
|
}
|
|
68
|
-
toJSON() {
|
|
69
|
-
return utils_1.Utils.jsonFilter(this);
|
|
70
|
-
}
|
|
71
65
|
getDistance(id, maxAge = 120) {
|
|
72
66
|
const data = this.distanceMap.get(id);
|
|
73
67
|
if (data === undefined) {
|
|
@@ -99,7 +93,7 @@ class DetectedBluetoothDevice extends BaseDevice_1.BaseDevice {
|
|
|
99
93
|
var _a, _b;
|
|
100
94
|
const settings = (_a = settings_service_1.SettingsService.settings.espresense) === null || _a === void 0 ? void 0 : _a.deviceMap[devName];
|
|
101
95
|
if (settings === undefined) {
|
|
102
|
-
return
|
|
96
|
+
return undefined;
|
|
103
97
|
}
|
|
104
98
|
const dev = api_1.API.getDevice(this.deviceKeyBySettings(settings));
|
|
105
99
|
return (_b = dev) !== null && _b !== void 0 ? _b : new DetectedBluetoothDevice(devName, settings);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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
|
/**
|
|
@@ -65,7 +64,7 @@ class EspresenseDevice extends RoomBaseDevice_1.RoomBaseDevice {
|
|
|
65
64
|
* @param state - The state containing the json-formatted distance data
|
|
66
65
|
*/
|
|
67
66
|
update(devName, state) {
|
|
68
|
-
var _a, _b;
|
|
67
|
+
var _a, _b, _c;
|
|
69
68
|
let data = null;
|
|
70
69
|
try {
|
|
71
70
|
data = JSON.parse(state.val);
|
|
@@ -74,9 +73,9 @@ class EspresenseDevice extends RoomBaseDevice_1.RoomBaseDevice {
|
|
|
74
73
|
this.log(enums_1.LogLevel.Error, `Recieved malformed update data: ${state.val}`);
|
|
75
74
|
return;
|
|
76
75
|
}
|
|
77
|
-
|
|
76
|
+
const dev = (_a = this.deviceMap.get(devName)) !== null && _a !== void 0 ? _a : this.addDeviceTracking(devName);
|
|
78
77
|
if (dev === undefined) {
|
|
79
|
-
|
|
78
|
+
return;
|
|
80
79
|
}
|
|
81
80
|
dev.updateDistance(this, data.distance);
|
|
82
81
|
dev.guessRoom();
|
|
@@ -98,19 +97,15 @@ class EspresenseDevice extends RoomBaseDevice_1.RoomBaseDevice {
|
|
|
98
97
|
}
|
|
99
98
|
continue;
|
|
100
99
|
}
|
|
101
|
-
if (distance > cb.distanceTrigger && ((
|
|
100
|
+
if (distance > cb.distanceTrigger && ((_b = trackedDistance.previousDistance) !== null && _b !== void 0 ? _b : 99) < cb.distanceTrigger) {
|
|
102
101
|
cb.callback(false, distance);
|
|
103
102
|
}
|
|
104
|
-
else if (distance < cb.distanceTrigger && ((
|
|
103
|
+
else if (distance < cb.distanceTrigger && ((_c = trackedDistance.previousDistance) !== null && _c !== void 0 ? _c : 0) > cb.distanceTrigger) {
|
|
105
104
|
cb.callback(true, distance);
|
|
106
105
|
}
|
|
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
|
}
|
|
@@ -125,7 +120,9 @@ class EspresenseDevice extends RoomBaseDevice_1.RoomBaseDevice {
|
|
|
125
120
|
}
|
|
126
121
|
addDeviceTracking(devName) {
|
|
127
122
|
const dev = detectedBluetoothDevice_1.DetectedBluetoothDevice.getOrCreate(devName);
|
|
128
|
-
|
|
123
|
+
if (dev) {
|
|
124
|
+
this.deviceMap.set(devName, dev);
|
|
125
|
+
}
|
|
129
126
|
return dev;
|
|
130
127
|
}
|
|
131
128
|
}
|
|
@@ -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;
|
|
@@ -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 =
|
|
44
|
+
const result = super.toJSON();
|
|
49
45
|
result['on'] = this.on;
|
|
50
|
-
return
|
|
46
|
+
return result;
|
|
51
47
|
}
|
|
52
48
|
}
|
|
53
49
|
exports.TvDevice = TvDevice;
|