hoffmation-base 3.2.1-alpha.0 → 3.2.1-alpha.1
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/devices/dachs/dachsTemperatureSensor.d.ts +0 -6
- package/lib/devices/dachs/dachsTemperatureSensor.js +1 -22
- package/lib/devices/espresense/detectedBluetoothDevice.d.ts +2 -2
- package/lib/devices/espresense/detectedBluetoothDevice.js +1 -4
- package/lib/devices/espresense/espresenseDevice.js +8 -6
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -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(...['room', '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
|
}
|
|
@@ -19,7 +19,7 @@ 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;
|
|
@@ -28,7 +28,7 @@ export declare class DetectedBluetoothDevice extends BaseDevice {
|
|
|
28
28
|
getDistance(id: string, maxAge?: number): TrackedDistanceData | undefined;
|
|
29
29
|
getDistances(maxAge?: number): Array<TrackedDistanceData>;
|
|
30
30
|
getDistanceReport(maxAge?: number): string;
|
|
31
|
-
static getOrCreate(devName: string): DetectedBluetoothDevice;
|
|
31
|
+
static getOrCreate(devName: string): DetectedBluetoothDevice | undefined;
|
|
32
32
|
private static deviceKeyBySettings;
|
|
33
33
|
persistDeviceInfo(): void;
|
|
34
34
|
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);
|
|
@@ -99,7 +96,7 @@ class DetectedBluetoothDevice extends BaseDevice_1.BaseDevice {
|
|
|
99
96
|
var _a, _b;
|
|
100
97
|
const settings = (_a = settings_service_1.SettingsService.settings.espresense) === null || _a === void 0 ? void 0 : _a.deviceMap[devName];
|
|
101
98
|
if (settings === undefined) {
|
|
102
|
-
return
|
|
99
|
+
return undefined;
|
|
103
100
|
}
|
|
104
101
|
const dev = api_1.API.getDevice(this.deviceKeyBySettings(settings));
|
|
105
102
|
return (_b = dev) !== null && _b !== void 0 ? _b : new DetectedBluetoothDevice(devName, settings);
|
|
@@ -65,7 +65,7 @@ class EspresenseDevice extends RoomBaseDevice_1.RoomBaseDevice {
|
|
|
65
65
|
* @param state - The state containing the json-formatted distance data
|
|
66
66
|
*/
|
|
67
67
|
update(devName, state) {
|
|
68
|
-
var _a, _b;
|
|
68
|
+
var _a, _b, _c;
|
|
69
69
|
let data = null;
|
|
70
70
|
try {
|
|
71
71
|
data = JSON.parse(state.val);
|
|
@@ -74,9 +74,9 @@ class EspresenseDevice extends RoomBaseDevice_1.RoomBaseDevice {
|
|
|
74
74
|
this.log(enums_1.LogLevel.Error, `Recieved malformed update data: ${state.val}`);
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
|
-
|
|
77
|
+
const dev = (_a = this.deviceMap.get(devName)) !== null && _a !== void 0 ? _a : this.addDeviceTracking(devName);
|
|
78
78
|
if (dev === undefined) {
|
|
79
|
-
|
|
79
|
+
return;
|
|
80
80
|
}
|
|
81
81
|
dev.updateDistance(this, data.distance);
|
|
82
82
|
dev.guessRoom();
|
|
@@ -98,10 +98,10 @@ class EspresenseDevice extends RoomBaseDevice_1.RoomBaseDevice {
|
|
|
98
98
|
}
|
|
99
99
|
continue;
|
|
100
100
|
}
|
|
101
|
-
if (distance > cb.distanceTrigger && ((
|
|
101
|
+
if (distance > cb.distanceTrigger && ((_b = trackedDistance.previousDistance) !== null && _b !== void 0 ? _b : 99) < cb.distanceTrigger) {
|
|
102
102
|
cb.callback(false, distance);
|
|
103
103
|
}
|
|
104
|
-
else if (distance < cb.distanceTrigger && ((
|
|
104
|
+
else if (distance < cb.distanceTrigger && ((_c = trackedDistance.previousDistance) !== null && _c !== void 0 ? _c : 0) > cb.distanceTrigger) {
|
|
105
105
|
cb.callback(true, distance);
|
|
106
106
|
}
|
|
107
107
|
}
|
|
@@ -125,7 +125,9 @@ class EspresenseDevice extends RoomBaseDevice_1.RoomBaseDevice {
|
|
|
125
125
|
}
|
|
126
126
|
addDeviceTracking(devName) {
|
|
127
127
|
const dev = detectedBluetoothDevice_1.DetectedBluetoothDevice.getOrCreate(devName);
|
|
128
|
-
|
|
128
|
+
if (dev) {
|
|
129
|
+
this.deviceMap.set(devName, dev);
|
|
130
|
+
}
|
|
129
131
|
return dev;
|
|
130
132
|
}
|
|
131
133
|
}
|