hoffmation-base 2.1.3 → 2.1.5-alpha.0
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/models/base64Image.d.ts +8 -0
- package/lib/models/base64Image.js +14 -0
- package/lib/models/deviceSettings/cameraSettings.d.ts +7 -0
- package/lib/models/deviceSettings/cameraSettings.js +21 -0
- package/lib/models/deviceSettings/index.d.ts +1 -0
- package/lib/models/deviceSettings/index.js +1 -0
- package/lib/models/index.d.ts +1 -0
- package/lib/models/index.js +1 -0
- package/lib/models/objectSettings.js +5 -1
- package/lib/models/rooms/RoomBase.d.ts +2 -2
- package/lib/server/blueIris/blueIrisCoordinator.d.ts +7 -0
- package/lib/server/blueIris/blueIrisCoordinator.js +21 -0
- package/lib/server/blueIris/cameraDevice.d.ts +46 -0
- package/lib/server/blueIris/cameraDevice.js +173 -0
- package/lib/server/blueIris/index.d.ts +2 -0
- package/lib/server/blueIris/index.js +18 -0
- package/lib/server/devices/DeviceCapability.d.ts +2 -1
- package/lib/server/devices/DeviceCapability.js +1 -0
- package/lib/server/devices/baseDeviceInterfaces/iMotionSensor.d.ts +1 -1
- package/lib/server/devices/device-cluster-type.d.ts +2 -1
- package/lib/server/devices/device-cluster-type.js +1 -0
- package/lib/server/devices/device-cluster.js +3 -0
- package/lib/server/devices/deviceType.d.ts +2 -1
- package/lib/server/devices/deviceType.js +1 -0
- package/lib/server/devices/deviceUpdater.js +3 -3
- package/lib/server/devices/groups/index.d.ts +1 -1
- package/lib/server/devices/groups/index.js +1 -1
- package/lib/server/devices/groups/{praesenzGroup.d.ts → presenceGroup.d.ts} +1 -1
- package/lib/server/devices/groups/{praesenzGroup.js → presenceGroup.js} +10 -9
- package/lib/server/devices/index.d.ts +1 -0
- package/lib/server/devices/index.js +1 -0
- package/lib/server/devices/mqtt/index.d.ts +1 -0
- package/lib/server/devices/mqtt/index.js +17 -0
- package/lib/server/devices/mqtt/mqttCoordinator.d.ts +4 -0
- package/lib/server/devices/mqtt/mqttCoordinator.js +18 -0
- package/lib/server/devices/zigbee/BaseDevices/zigbeeMotionSensor.d.ts +2 -1
- package/lib/server/devices/zigbee/BaseDevices/zigbeeMotionSensor.js +6 -3
- package/lib/server/services/Telegram/telegram-service.d.ts +2 -0
- package/lib/server/services/Telegram/telegram-service.js +10 -0
- package/lib/server/services/api/api-service.d.ts +1 -0
- package/lib/server/services/api/api-service.js +10 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Base64Image = void 0;
|
|
4
|
+
class Base64Image {
|
|
5
|
+
constructor(data, name, type = 'image/jpg') {
|
|
6
|
+
this.data = data;
|
|
7
|
+
this.name = name;
|
|
8
|
+
this.type = type;
|
|
9
|
+
}
|
|
10
|
+
get buffer() {
|
|
11
|
+
return Buffer.from(this.data, 'base64');
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.Base64Image = Base64Image;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MotionSensorSettings } from './motionSensorSettings';
|
|
2
|
+
export declare class CameraSettings extends MotionSensorSettings {
|
|
3
|
+
alertPersonOnTelegram: boolean;
|
|
4
|
+
movementDetectionOnPersonOnly: boolean;
|
|
5
|
+
fromPartialObject(data: Partial<CameraSettings>): void;
|
|
6
|
+
protected toJSON(): Partial<MotionSensorSettings>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CameraSettings = void 0;
|
|
4
|
+
const server_1 = require("../../server");
|
|
5
|
+
const motionSensorSettings_1 = require("./motionSensorSettings");
|
|
6
|
+
class CameraSettings extends motionSensorSettings_1.MotionSensorSettings {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.alertPersonOnTelegram = false;
|
|
10
|
+
this.movementDetectionOnPersonOnly = false;
|
|
11
|
+
}
|
|
12
|
+
fromPartialObject(data) {
|
|
13
|
+
var _a;
|
|
14
|
+
this.alertPersonOnTelegram = (_a = data.alertPersonOnTelegram) !== null && _a !== void 0 ? _a : this.alertPersonOnTelegram;
|
|
15
|
+
super.fromPartialObject(data);
|
|
16
|
+
}
|
|
17
|
+
toJSON() {
|
|
18
|
+
return server_1.Utils.jsonFilter(this);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.CameraSettings = CameraSettings;
|
|
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./acSettings"), exports);
|
|
18
18
|
__exportStar(require("./actuatorSettings"), exports);
|
|
19
|
+
__exportStar(require("./cameraSettings"), exports);
|
|
19
20
|
__exportStar(require("./deviceSettings"), exports);
|
|
20
21
|
__exportStar(require("./dimmerSettings"), exports);
|
|
21
22
|
__exportStar(require("./heaterSettings"), exports);
|
package/lib/models/index.d.ts
CHANGED
package/lib/models/index.js
CHANGED
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./rooms/index"), exports);
|
|
18
18
|
__exportStar(require("./deviceSettings/index"), exports);
|
|
19
19
|
__exportStar(require("./persistence/index"), exports);
|
|
20
|
+
__exportStar(require("./base64Image"), exports);
|
|
20
21
|
__exportStar(require("./collisionSolving"), exports);
|
|
21
22
|
__exportStar(require("./connectionCallbacks"), exports);
|
|
22
23
|
__exportStar(require("./daytime"), exports);
|
|
@@ -1,8 +1,12 @@
|
|
|
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.ObjectSettings = void 0;
|
|
4
7
|
const server_1 = require("../server");
|
|
5
8
|
const logLevel_1 = require("./logLevel");
|
|
9
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
6
10
|
class ObjectSettings {
|
|
7
11
|
persist(holder) {
|
|
8
12
|
var _a;
|
|
@@ -37,7 +41,7 @@ class ObjectSettings {
|
|
|
37
41
|
}
|
|
38
42
|
}
|
|
39
43
|
toJSON() {
|
|
40
|
-
return server_1.Utils.jsonFilter(this);
|
|
44
|
+
return server_1.Utils.jsonFilter(lodash_1.default.omit(this, ['onChangeCb']));
|
|
41
45
|
}
|
|
42
46
|
}
|
|
43
47
|
exports.ObjectSettings = ObjectSettings;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TimeCallback } from '../timeCallback';
|
|
2
|
-
import { BaseGroup, DeviceCluster, GroupType, HeatGroup, LampenGroup,
|
|
2
|
+
import { BaseGroup, DeviceCluster, GroupType, HeatGroup, LampenGroup, PresenceGroup, SmokeGroup, SpeakerGroup, TasterGroup, WaterGroup, WindowGroup } from '../../server';
|
|
3
3
|
import { LogLevel } from '../logLevel';
|
|
4
4
|
import { RoomSettingsController } from './RoomSettings';
|
|
5
5
|
import { iRoomBase } from './iRoomBase';
|
|
@@ -24,7 +24,7 @@ export declare class RoomBase implements iRoomBase, iIdHolder {
|
|
|
24
24
|
protected _deviceCluster: DeviceCluster;
|
|
25
25
|
get deviceCluster(): DeviceCluster;
|
|
26
26
|
get WindowGroup(): WindowGroup | undefined;
|
|
27
|
-
get PraesenzGroup():
|
|
27
|
+
get PraesenzGroup(): PresenceGroup | undefined;
|
|
28
28
|
get LampenGroup(): LampenGroup | undefined;
|
|
29
29
|
get TasterGroup(): TasterGroup | undefined;
|
|
30
30
|
get SonosGroup(): SpeakerGroup | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="iobroker" />
|
|
2
|
+
import { CameraDevice } from './cameraDevice';
|
|
3
|
+
export declare class BlueIrisCoordinator {
|
|
4
|
+
private static cameraDeviceMap;
|
|
5
|
+
static addDevice(device: CameraDevice, devName: string): void;
|
|
6
|
+
static update(idSplit: string[], state: ioBroker.State): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BlueIrisCoordinator = void 0;
|
|
4
|
+
class BlueIrisCoordinator {
|
|
5
|
+
static addDevice(device, devName) {
|
|
6
|
+
this.cameraDeviceMap.set(devName, device);
|
|
7
|
+
}
|
|
8
|
+
static update(idSplit, state) {
|
|
9
|
+
if (idSplit.length < 5) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const devName = idSplit[3];
|
|
13
|
+
const dev = this.cameraDeviceMap.get(devName !== null && devName !== void 0 ? devName : '');
|
|
14
|
+
if (dev === undefined) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
dev.update(idSplit[4], state);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.BlueIrisCoordinator = BlueIrisCoordinator;
|
|
21
|
+
BlueIrisCoordinator.cameraDeviceMap = new Map();
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/// <reference types="iobroker" />
|
|
2
|
+
import { DeviceInfo, DeviceType, iMotionSensor, iRoomDevice } from '../devices';
|
|
3
|
+
import { CameraSettings, LogLevel, RoomBase } from '../../models';
|
|
4
|
+
import { LogDebugType } from '../services';
|
|
5
|
+
import { DeviceCapability } from '../devices/DeviceCapability';
|
|
6
|
+
export declare class CameraDevice implements iRoomDevice, iMotionSensor {
|
|
7
|
+
get lastImage(): string;
|
|
8
|
+
settings: CameraSettings;
|
|
9
|
+
readonly deviceCapabilities: DeviceCapability[];
|
|
10
|
+
deviceType: DeviceType;
|
|
11
|
+
readonly name: string;
|
|
12
|
+
protected _lastMotion: number;
|
|
13
|
+
private _initialized;
|
|
14
|
+
private _movementDetectedCallback;
|
|
15
|
+
private _lastImage;
|
|
16
|
+
private _personDetected;
|
|
17
|
+
constructor(name: string, roomName: string);
|
|
18
|
+
private _detectionsToday;
|
|
19
|
+
get detectionsToday(): number;
|
|
20
|
+
set detectionsToday(pVal: number);
|
|
21
|
+
private _movementDetected;
|
|
22
|
+
get movementDetected(): boolean;
|
|
23
|
+
private _info;
|
|
24
|
+
get info(): DeviceInfo;
|
|
25
|
+
set info(info: DeviceInfo);
|
|
26
|
+
/**
|
|
27
|
+
* Time since Last Motion in seconds
|
|
28
|
+
* @returns {number}
|
|
29
|
+
*/
|
|
30
|
+
get timeSinceLastMotion(): number;
|
|
31
|
+
get customName(): string;
|
|
32
|
+
get id(): string;
|
|
33
|
+
get room(): RoomBase | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Adds a callback for when a motion state has changed.
|
|
36
|
+
* @param pCallback Function that accepts the new state as parameter
|
|
37
|
+
*/
|
|
38
|
+
addMovementCallback(pCallback: (newState: boolean) => void): void;
|
|
39
|
+
persistMotionSensor(): void;
|
|
40
|
+
update(stateName: string, state: ioBroker.State): void;
|
|
41
|
+
updateMovement(newState: boolean): void;
|
|
42
|
+
log(level: LogLevel, message: string, debugType?: LogDebugType): void;
|
|
43
|
+
toJSON(): Partial<iRoomDevice>;
|
|
44
|
+
persistDeviceInfo(): void;
|
|
45
|
+
loadDeviceSettings(): void;
|
|
46
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CameraDevice = void 0;
|
|
7
|
+
const devices_1 = require("../devices");
|
|
8
|
+
const models_1 = require("../../models");
|
|
9
|
+
const blueIrisCoordinator_1 = require("./blueIrisCoordinator");
|
|
10
|
+
const services_1 = require("../services");
|
|
11
|
+
const DeviceCapability_1 = require("../devices/DeviceCapability");
|
|
12
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
13
|
+
class CameraDevice {
|
|
14
|
+
get lastImage() {
|
|
15
|
+
return this._lastImage;
|
|
16
|
+
}
|
|
17
|
+
constructor(name, roomName) {
|
|
18
|
+
var _a;
|
|
19
|
+
this.settings = new models_1.CameraSettings();
|
|
20
|
+
this.deviceCapabilities = [DeviceCapability_1.DeviceCapability.camera, DeviceCapability_1.DeviceCapability.motionSensor];
|
|
21
|
+
this.deviceType = devices_1.DeviceType.Camera;
|
|
22
|
+
this._lastMotion = 0;
|
|
23
|
+
this._initialized = false;
|
|
24
|
+
this._movementDetectedCallback = [];
|
|
25
|
+
this._lastImage = '';
|
|
26
|
+
this._personDetected = false;
|
|
27
|
+
this._detectionsToday = 0;
|
|
28
|
+
this._movementDetected = false;
|
|
29
|
+
this.name = name;
|
|
30
|
+
this._info = new devices_1.DeviceInfo();
|
|
31
|
+
this._info.fullName = `Camera ${roomName} ${name}`;
|
|
32
|
+
this._info.customName = `Camera ${name}`;
|
|
33
|
+
this._info.room = roomName;
|
|
34
|
+
this._info.allDevicesKey = `camera-${roomName}-${name}`;
|
|
35
|
+
devices_1.Devices.alLDevices[this._info.allDevicesKey] = this;
|
|
36
|
+
blueIrisCoordinator_1.BlueIrisCoordinator.addDevice(this, name);
|
|
37
|
+
this.persistDeviceInfo();
|
|
38
|
+
this.loadDeviceSettings();
|
|
39
|
+
if (!services_1.Utils.anyDboActive) {
|
|
40
|
+
this._initialized = true;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
(_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.motionSensorTodayCount(this).then((todayCount) => {
|
|
44
|
+
var _a;
|
|
45
|
+
this.detectionsToday = (_a = todayCount.count) !== null && _a !== void 0 ? _a : 0;
|
|
46
|
+
this.log(models_1.LogLevel.Debug, `Reinitialized movement counter with ${this.detectionsToday}`);
|
|
47
|
+
this._initialized = true;
|
|
48
|
+
}).catch((err) => {
|
|
49
|
+
var _a;
|
|
50
|
+
this.log(models_1.LogLevel.Warn, `Failed to initialize movement counter, err ${(_a = err === null || err === void 0 ? void 0 : err.message) !== null && _a !== void 0 ? _a : err}`);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
get detectionsToday() {
|
|
55
|
+
return this._detectionsToday;
|
|
56
|
+
}
|
|
57
|
+
set detectionsToday(pVal) {
|
|
58
|
+
this._detectionsToday = pVal;
|
|
59
|
+
}
|
|
60
|
+
get movementDetected() {
|
|
61
|
+
return this._movementDetected;
|
|
62
|
+
}
|
|
63
|
+
get info() {
|
|
64
|
+
return this._info;
|
|
65
|
+
}
|
|
66
|
+
set info(info) {
|
|
67
|
+
this._info = info;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Time since Last Motion in seconds
|
|
71
|
+
* @returns {number}
|
|
72
|
+
*/
|
|
73
|
+
get timeSinceLastMotion() {
|
|
74
|
+
return Math.round((services_1.Utils.nowMS() - this._lastMotion) / 1000);
|
|
75
|
+
}
|
|
76
|
+
get customName() {
|
|
77
|
+
return this.info.customName;
|
|
78
|
+
}
|
|
79
|
+
get id() {
|
|
80
|
+
var _a;
|
|
81
|
+
return (_a = this.info.allDevicesKey) !== null && _a !== void 0 ? _a : `camera-${this.info.room}-${this.info.customName}`;
|
|
82
|
+
}
|
|
83
|
+
get room() {
|
|
84
|
+
return services_1.API.getRoom(this.info.room);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Adds a callback for when a motion state has changed.
|
|
88
|
+
* @param pCallback Function that accepts the new state as parameter
|
|
89
|
+
*/
|
|
90
|
+
addMovementCallback(pCallback) {
|
|
91
|
+
this._movementDetectedCallback.push(pCallback);
|
|
92
|
+
}
|
|
93
|
+
persistMotionSensor() {
|
|
94
|
+
var _a;
|
|
95
|
+
(_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistMotionSensor(this);
|
|
96
|
+
}
|
|
97
|
+
update(stateName, state) {
|
|
98
|
+
switch (stateName) {
|
|
99
|
+
case 'MotionDetected':
|
|
100
|
+
if (this.settings.movementDetectionOnPersonOnly) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
this.updateMovement(state.val === '1');
|
|
104
|
+
break;
|
|
105
|
+
case 'Person':
|
|
106
|
+
if (!this.settings.movementDetectionOnPersonOnly) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const newValue = state.val === '1';
|
|
110
|
+
if (newValue) {
|
|
111
|
+
this.log(models_1.LogLevel.Debug, `Person Detected`);
|
|
112
|
+
}
|
|
113
|
+
this._personDetected = newValue;
|
|
114
|
+
this.updateMovement(newValue);
|
|
115
|
+
break;
|
|
116
|
+
case 'MotionSnapshot':
|
|
117
|
+
this._lastImage = state.val;
|
|
118
|
+
if (this.settings.alertPersonOnTelegram && this._personDetected) {
|
|
119
|
+
services_1.TelegramService.sendImage(`${this.name} detected Person`, new models_1.Base64Image(this._lastImage, 'person_alert'));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
updateMovement(newState) {
|
|
124
|
+
if (!this._initialized && newState) {
|
|
125
|
+
this.log(models_1.LogLevel.Trace, `Movement recognized, but database initialization has not finished yet --> delay.`);
|
|
126
|
+
services_1.Utils.guardedTimeout(() => {
|
|
127
|
+
this.updateMovement(newState);
|
|
128
|
+
}, 1000, this);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
if (newState === this.movementDetected) {
|
|
132
|
+
this.log(models_1.LogLevel.Debug, `Skip movement because state is already ${newState}`, services_1.LogDebugType.SkipUnchangedMovementState);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
this._lastMotion = services_1.Utils.nowMS();
|
|
136
|
+
this._movementDetected = newState;
|
|
137
|
+
this.persistMotionSensor();
|
|
138
|
+
this.log(models_1.LogLevel.Debug, `New movement state: ${newState}`, services_1.LogDebugType.NewMovementState);
|
|
139
|
+
if (newState) {
|
|
140
|
+
this.detectionsToday++;
|
|
141
|
+
this.log(models_1.LogLevel.Trace, `This is movement no. ${this.detectionsToday}`);
|
|
142
|
+
}
|
|
143
|
+
for (const c of this._movementDetectedCallback) {
|
|
144
|
+
c(newState);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
log(level, message, debugType = services_1.LogDebugType.None) {
|
|
148
|
+
var _a, _b;
|
|
149
|
+
services_1.ServerLogService.writeLog(level, `${this.name}: ${message}`, {
|
|
150
|
+
debugType: debugType,
|
|
151
|
+
room: (_b = (_a = this.room) === null || _a === void 0 ? void 0 : _a.roomName) !== null && _b !== void 0 ? _b : '',
|
|
152
|
+
deviceId: this.name,
|
|
153
|
+
deviceName: this.name,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
toJSON() {
|
|
157
|
+
return services_1.Utils.jsonFilter(lodash_1.default.omit(this, [
|
|
158
|
+
// To reduce Byte-size on cyclic update
|
|
159
|
+
'_lastImage',
|
|
160
|
+
]));
|
|
161
|
+
}
|
|
162
|
+
persistDeviceInfo() {
|
|
163
|
+
services_1.Utils.guardedTimeout(() => {
|
|
164
|
+
var _a;
|
|
165
|
+
(_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.addDevice(this);
|
|
166
|
+
}, 5000, this);
|
|
167
|
+
}
|
|
168
|
+
loadDeviceSettings() {
|
|
169
|
+
var _a;
|
|
170
|
+
(_a = this.settings) === null || _a === void 0 ? void 0 : _a.initializeFromDb(this);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
exports.CameraDevice = CameraDevice;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./blueIrisCoordinator"), exports);
|
|
18
|
+
__exportStar(require("./cameraDevice"), exports);
|
|
@@ -27,4 +27,5 @@ var DeviceCapability;
|
|
|
27
27
|
DeviceCapability[DeviceCapability["trackableDevice"] = 102] = "trackableDevice";
|
|
28
28
|
DeviceCapability[DeviceCapability["scene"] = 103] = "scene";
|
|
29
29
|
DeviceCapability[DeviceCapability["blockAutomatic"] = 104] = "blockAutomatic";
|
|
30
|
+
DeviceCapability[DeviceCapability["camera"] = 105] = "camera";
|
|
30
31
|
})(DeviceCapability = exports.DeviceCapability || (exports.DeviceCapability = {}));
|
|
@@ -2,7 +2,7 @@ import { MotionSensorSettings } from '../../../models';
|
|
|
2
2
|
import { iRoomDevice } from './iRoomDevice';
|
|
3
3
|
export interface iMotionSensor extends iRoomDevice {
|
|
4
4
|
settings: MotionSensorSettings;
|
|
5
|
-
movementDetected: boolean;
|
|
5
|
+
readonly movementDetected: boolean;
|
|
6
6
|
readonly timeSinceLastMotion: number;
|
|
7
7
|
detectionsToday: number;
|
|
8
8
|
/**
|
|
@@ -23,4 +23,5 @@ var DeviceClusterType;
|
|
|
23
23
|
DeviceClusterType[DeviceClusterType["Ac"] = 18] = "Ac";
|
|
24
24
|
DeviceClusterType[DeviceClusterType["WLED"] = 19] = "WLED";
|
|
25
25
|
DeviceClusterType[DeviceClusterType["Tv"] = 20] = "Tv";
|
|
26
|
+
DeviceClusterType[DeviceClusterType["Camera"] = 21] = "Camera";
|
|
26
27
|
})(DeviceClusterType = exports.DeviceClusterType || (exports.DeviceClusterType = {}));
|
|
@@ -32,6 +32,9 @@ class DeviceCluster {
|
|
|
32
32
|
case deviceType_1.DeviceType.SamsungTv:
|
|
33
33
|
clusterTypes.push(device_cluster_type_1.DeviceClusterType.Tv);
|
|
34
34
|
break;
|
|
35
|
+
case deviceType_1.DeviceType.Camera:
|
|
36
|
+
clusterTypes.push(device_cluster_type_1.DeviceClusterType.Camera);
|
|
37
|
+
break;
|
|
35
38
|
case deviceType_1.DeviceType.HmIpLampe:
|
|
36
39
|
case deviceType_1.DeviceType.ZigbeeIlluDimmer:
|
|
37
40
|
case deviceType_1.DeviceType.ZigbeeOsramDimmer:
|
|
@@ -46,4 +46,5 @@ var DeviceType;
|
|
|
46
46
|
DeviceType[DeviceType["Espresense"] = 4001] = "Espresense";
|
|
47
47
|
DeviceType[DeviceType["TrackableDevice"] = 4002] = "TrackableDevice";
|
|
48
48
|
DeviceType[DeviceType["SamsungTv"] = 5001] = "SamsungTv";
|
|
49
|
+
DeviceType[DeviceType["Camera"] = 6001] = "Camera";
|
|
49
50
|
})(DeviceType = exports.DeviceType || (exports.DeviceType = {}));
|
|
@@ -4,7 +4,7 @@ exports.DeviceUpdater = void 0;
|
|
|
4
4
|
const services_1 = require("../services");
|
|
5
5
|
const models_1 = require("../../models");
|
|
6
6
|
const devices_1 = require("./devices");
|
|
7
|
-
const
|
|
7
|
+
const mqtt_1 = require("./mqtt");
|
|
8
8
|
class DeviceUpdater {
|
|
9
9
|
constructor(pDevices) {
|
|
10
10
|
this.devices = pDevices;
|
|
@@ -26,8 +26,8 @@ class DeviceUpdater {
|
|
|
26
26
|
const idSplit = id.split('.');
|
|
27
27
|
if (idSplit.length < 2)
|
|
28
28
|
return;
|
|
29
|
-
if (idSplit[0] == 'mqtt'
|
|
30
|
-
|
|
29
|
+
if (idSplit[0] == 'mqtt') {
|
|
30
|
+
mqtt_1.MqttCoordinator.update(idSplit, state);
|
|
31
31
|
}
|
|
32
32
|
const device = devices_1.Devices.alLDevices[`${idSplit[0]}-${idSplit[2]}`];
|
|
33
33
|
if (typeof device === 'undefined' || device.update === undefined) {
|
|
@@ -4,7 +4,7 @@ export * from './windowGroup';
|
|
|
4
4
|
export * from './group-type';
|
|
5
5
|
export * from './heatGroup';
|
|
6
6
|
export * from './lampenGroup';
|
|
7
|
-
export * from './
|
|
7
|
+
export * from './presenceGroup';
|
|
8
8
|
export * from './smokeGroup';
|
|
9
9
|
export * from './speakerGroup';
|
|
10
10
|
export * from './tasterGroup';
|
|
@@ -20,7 +20,7 @@ __exportStar(require("./windowGroup"), exports);
|
|
|
20
20
|
__exportStar(require("./group-type"), exports);
|
|
21
21
|
__exportStar(require("./heatGroup"), exports);
|
|
22
22
|
__exportStar(require("./lampenGroup"), exports);
|
|
23
|
-
__exportStar(require("./
|
|
23
|
+
__exportStar(require("./presenceGroup"), exports);
|
|
24
24
|
__exportStar(require("./smokeGroup"), exports);
|
|
25
25
|
__exportStar(require("./speakerGroup"), exports);
|
|
26
26
|
__exportStar(require("./tasterGroup"), exports);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseGroup } from './base-group';
|
|
2
2
|
import { iMotionSensor } from '../baseDeviceInterfaces';
|
|
3
|
-
export declare class
|
|
3
|
+
export declare class PresenceGroup extends BaseGroup {
|
|
4
4
|
private _lastMovement;
|
|
5
5
|
private _lastLeftTimeout;
|
|
6
6
|
constructor(roomName: string, motionSensorIds: string[]);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.PresenceGroup = void 0;
|
|
4
4
|
const models_1 = require("../../../models");
|
|
5
5
|
const services_1 = require("../../services");
|
|
6
6
|
const base_group_1 = require("./base-group");
|
|
7
7
|
const device_cluster_type_1 = require("../device-cluster-type");
|
|
8
8
|
const group_type_1 = require("./group-type");
|
|
9
9
|
const device_list_1 = require("../device-list");
|
|
10
|
-
class
|
|
10
|
+
class PresenceGroup extends base_group_1.BaseGroup {
|
|
11
11
|
constructor(roomName, motionSensorIds) {
|
|
12
12
|
super(roomName, group_type_1.GroupType.Presence);
|
|
13
13
|
this._lastMovement = new Date(0);
|
|
@@ -37,12 +37,13 @@ class PraesenzGroup extends base_group_1.BaseGroup {
|
|
|
37
37
|
var _a;
|
|
38
38
|
(_a = this.getRoom().LampenGroup) === null || _a === void 0 ? void 0 : _a.switchAll(false);
|
|
39
39
|
});
|
|
40
|
-
|
|
41
|
-
this.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
});
|
|
45
|
-
|
|
40
|
+
this.addFirstEnterCallback(() => {
|
|
41
|
+
if (!this.getRoom().settings.lampenBeiBewegung) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
this.log(models_1.LogLevel.DeepTrace, `Bewegung im Raum ${this.roomName} festgestellt --> Licht einschalten`);
|
|
45
|
+
this.getRoom().setLightTimeBased();
|
|
46
|
+
});
|
|
46
47
|
}
|
|
47
48
|
presentAmount() {
|
|
48
49
|
let count = 0;
|
|
@@ -121,4 +122,4 @@ class PraesenzGroup extends base_group_1.BaseGroup {
|
|
|
121
122
|
cb();
|
|
122
123
|
}
|
|
123
124
|
}
|
|
124
|
-
exports.
|
|
125
|
+
exports.PresenceGroup = PresenceGroup;
|
|
@@ -32,6 +32,7 @@ __exportStar(require("./deviceType"), exports);
|
|
|
32
32
|
__exportStar(require("./deviceUpdater"), exports);
|
|
33
33
|
__exportStar(require("./Griffe"), exports);
|
|
34
34
|
__exportStar(require("./Heizgruppen"), exports);
|
|
35
|
+
__exportStar(require("./mqtt"), exports);
|
|
35
36
|
__exportStar(require("./iDeviceUpdater"), exports);
|
|
36
37
|
__exportStar(require("./IoBrokerBaseDevice"), exports);
|
|
37
38
|
__exportStar(require("./tv"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './mqttCoordinator';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./mqttCoordinator"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MqttCoordinator = void 0;
|
|
4
|
+
const espresense_1 = require("../espresense");
|
|
5
|
+
const blueIris_1 = require("../../blueIris");
|
|
6
|
+
class MqttCoordinator {
|
|
7
|
+
static update(idSplit, state) {
|
|
8
|
+
switch (idSplit[2]) {
|
|
9
|
+
case 'espresense':
|
|
10
|
+
espresense_1.EspresenseCoordinator.update(idSplit, state);
|
|
11
|
+
break;
|
|
12
|
+
case 'BlueIris':
|
|
13
|
+
blueIris_1.BlueIrisCoordinator.update(idSplit, state);
|
|
14
|
+
break;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.MqttCoordinator = MqttCoordinator;
|
|
@@ -6,11 +6,12 @@ import { MotionSensorSettings } from '../../../../models';
|
|
|
6
6
|
import { iBatteryDevice, iMotionSensor } from '../../baseDeviceInterfaces';
|
|
7
7
|
import { IoBrokerDeviceInfo } from '../../IoBrokerDeviceInfo';
|
|
8
8
|
export declare class ZigbeeMotionSensor extends ZigbeeDevice implements iMotionSensor, iBatteryDevice {
|
|
9
|
+
private _movementDetected;
|
|
9
10
|
private _battery;
|
|
10
11
|
private _lastBatteryPersist;
|
|
11
12
|
get lastBatteryPersist(): number;
|
|
12
13
|
settings: MotionSensorSettings;
|
|
13
|
-
movementDetected: boolean;
|
|
14
|
+
get movementDetected(): boolean;
|
|
14
15
|
get battery(): number;
|
|
15
16
|
protected _initialized: boolean;
|
|
16
17
|
protected _movementDetectedCallback: Array<(pValue: boolean) => void>;
|