hoffmation-base 3.0.0-beta.11 → 3.0.0-beta.12
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/server/devices/{blueIris/cameraDevice.d.ts → CameraDevice.d.ts} +28 -30
- package/lib/server/devices/{blueIris/cameraDevice.js → CameraDevice.js} +69 -112
- package/lib/server/devices/baseDeviceInterfaces/iCameraDevice.d.ts +0 -7
- package/lib/server/devices/blueIris/blueIrisCameraDevice.d.ts +28 -0
- package/lib/server/devices/blueIris/blueIrisCameraDevice.js +80 -0
- package/lib/server/devices/blueIris/index.d.ts +1 -1
- package/lib/server/devices/blueIris/index.js +1 -1
- package/lib/server/devices/index.d.ts +1 -0
- package/lib/server/devices/index.js +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import { iBaseDevice, iCameraDevice, iRoomDevice } from '
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
export declare class CameraDevice implements iCameraDevice {
|
|
8
|
-
/**
|
|
9
|
-
* The name of the camera in BlueIris
|
|
10
|
-
*/
|
|
11
|
-
readonly blueIrisName: string;
|
|
1
|
+
import { iBaseDevice, iCameraDevice, iRoomDevice } from './baseDeviceInterfaces';
|
|
2
|
+
import { DeviceType } from './deviceType';
|
|
3
|
+
import { DeviceCapability } from './DeviceCapability';
|
|
4
|
+
import { CameraSettings, LogLevel, MotionSensorAction, RoomBase } from '../../models';
|
|
5
|
+
import { DeviceInfo } from './DeviceInfo';
|
|
6
|
+
import { LogDebugType } from '../services';
|
|
7
|
+
export declare abstract class CameraDevice implements iCameraDevice {
|
|
12
8
|
/** @inheritDoc */
|
|
13
9
|
settings: CameraSettings;
|
|
14
10
|
/** @inheritDoc */
|
|
@@ -20,31 +16,28 @@ export declare class CameraDevice implements iCameraDevice {
|
|
|
20
16
|
*/
|
|
21
17
|
readonly name: string;
|
|
22
18
|
/** @inheritDoc */
|
|
23
|
-
readonly mpegStreamLink: string;
|
|
19
|
+
abstract readonly mpegStreamLink: string;
|
|
24
20
|
/** @inheritDoc */
|
|
25
|
-
readonly h264IosStreamLink: string;
|
|
21
|
+
abstract readonly h264IosStreamLink: string;
|
|
26
22
|
/** @inheritDoc */
|
|
27
|
-
readonly rtspStreamLink: string;
|
|
23
|
+
abstract readonly rtspStreamLink: string;
|
|
28
24
|
/** @inheritDoc */
|
|
29
|
-
readonly currentImageLink: string;
|
|
25
|
+
abstract readonly currentImageLink: string;
|
|
30
26
|
/** @inheritDoc */
|
|
31
27
|
detectionsToday: number;
|
|
32
28
|
protected _lastMotion: number;
|
|
29
|
+
protected _initialized: boolean;
|
|
30
|
+
protected _movementDetectedCallback: Array<(action: MotionSensorAction) => void>;
|
|
31
|
+
protected _lastImage: string;
|
|
32
|
+
protected _personDetected: boolean;
|
|
33
|
+
protected _dogDetected: boolean;
|
|
34
|
+
protected _devicesBlockingAlarmMap: Map<string, iBaseDevice>;
|
|
35
|
+
protected _movementDetected: boolean;
|
|
36
|
+
protected _info: DeviceInfo;
|
|
33
37
|
private _personDetectFallbackTimeout;
|
|
34
38
|
private _movementDetectFallbackTimeout;
|
|
35
39
|
private _dogDetectFallbackTimeout;
|
|
36
|
-
|
|
37
|
-
private _dogDetectedStateId;
|
|
38
|
-
private _movementDetectedStateId;
|
|
39
|
-
private _initialized;
|
|
40
|
-
private _movementDetectedCallback;
|
|
41
|
-
private _lastImage;
|
|
42
|
-
private _personDetected;
|
|
43
|
-
private _dogDetected;
|
|
44
|
-
private _devicesBlockingAlarmMap;
|
|
45
|
-
private _movementDetected;
|
|
46
|
-
private _info;
|
|
47
|
-
constructor(mqttName: string, roomName: string, blueIrisName: string);
|
|
40
|
+
protected constructor(name: string, roomName: string);
|
|
48
41
|
/** @inheritDoc */
|
|
49
42
|
get lastImage(): string;
|
|
50
43
|
/** @inheritDoc */
|
|
@@ -71,14 +64,19 @@ export declare class CameraDevice implements iCameraDevice {
|
|
|
71
64
|
blockForDevice(device: iBaseDevice, block: boolean): void;
|
|
72
65
|
/** @inheritDoc */
|
|
73
66
|
persistMotionSensor(): void;
|
|
74
|
-
/** @inheritDoc */
|
|
75
|
-
update(idSplit: string[], state: ioBroker.State): void;
|
|
76
67
|
log(level: LogLevel, message: string, debugType?: LogDebugType): void;
|
|
77
68
|
toJSON(): Partial<iRoomDevice>;
|
|
78
69
|
persistDeviceInfo(): void;
|
|
79
70
|
loadDeviceSettings(): void;
|
|
71
|
+
protected onNewMotionDetectedValue(newValue: boolean): void;
|
|
72
|
+
protected onNewPersonDetectedValue(newValue: boolean): void;
|
|
73
|
+
protected onNewImageSnapshot(image: string): void;
|
|
74
|
+
protected onNewDogDetectionValue(newDogDetectionVal: boolean): void;
|
|
75
|
+
protected abstract resetPersonDetectedState(): void;
|
|
76
|
+
protected abstract resetDogDetectedState(): void;
|
|
77
|
+
protected abstract resetMovementDetectedState(): void;
|
|
80
78
|
private updateMovement;
|
|
81
79
|
private resetPersonDetectFallbackTimer;
|
|
82
|
-
private resetDogDetectFallbackTimer;
|
|
83
80
|
private resetMovementFallbackTimer;
|
|
81
|
+
private resetDogDetectFallbackTimer;
|
|
84
82
|
}
|
|
@@ -4,17 +4,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.CameraDevice = void 0;
|
|
7
|
+
const deviceType_1 = require("./deviceType");
|
|
8
|
+
const DeviceCapability_1 = require("./DeviceCapability");
|
|
9
|
+
const models_1 = require("../../models");
|
|
10
|
+
const DeviceInfo_1 = require("./DeviceInfo");
|
|
11
|
+
const devices_1 = require("./devices");
|
|
12
|
+
const services_1 = require("../services");
|
|
7
13
|
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
-
const models_1 = require("../../../models");
|
|
9
|
-
const blueIrisCoordinator_1 = require("./blueIrisCoordinator");
|
|
10
|
-
const services_1 = require("../../services");
|
|
11
|
-
const devices_1 = require("../devices");
|
|
12
|
-
const DeviceInfo_1 = require("../DeviceInfo");
|
|
13
|
-
const DeviceCapability_1 = require("../DeviceCapability");
|
|
14
|
-
const deviceType_1 = require("../deviceType");
|
|
15
|
-
const ioBroker_1 = require("../../ioBroker");
|
|
16
14
|
class CameraDevice {
|
|
17
|
-
constructor(
|
|
15
|
+
constructor(name, roomName) {
|
|
18
16
|
var _a;
|
|
19
17
|
/** @inheritDoc */
|
|
20
18
|
this.settings = new models_1.CameraSettings();
|
|
@@ -23,22 +21,8 @@ class CameraDevice {
|
|
|
23
21
|
/** @inheritDoc */
|
|
24
22
|
this.deviceType = deviceType_1.DeviceType.Camera;
|
|
25
23
|
/** @inheritDoc */
|
|
26
|
-
this.mpegStreamLink = '';
|
|
27
|
-
/** @inheritDoc */
|
|
28
|
-
this.h264IosStreamLink = '';
|
|
29
|
-
/** @inheritDoc */
|
|
30
|
-
this.rtspStreamLink = '';
|
|
31
|
-
/** @inheritDoc */
|
|
32
|
-
this.currentImageLink = '';
|
|
33
|
-
/** @inheritDoc */
|
|
34
24
|
this.detectionsToday = 0;
|
|
35
25
|
this._lastMotion = 0;
|
|
36
|
-
this._personDetectFallbackTimeout = null;
|
|
37
|
-
this._movementDetectFallbackTimeout = null;
|
|
38
|
-
this._dogDetectFallbackTimeout = null;
|
|
39
|
-
this._personDetectedStateId = undefined;
|
|
40
|
-
this._dogDetectedStateId = undefined;
|
|
41
|
-
this._movementDetectedStateId = undefined;
|
|
42
26
|
this._initialized = false;
|
|
43
27
|
this._movementDetectedCallback = [];
|
|
44
28
|
this._lastImage = '';
|
|
@@ -46,24 +30,18 @@ class CameraDevice {
|
|
|
46
30
|
this._dogDetected = false;
|
|
47
31
|
this._devicesBlockingAlarmMap = new Map();
|
|
48
32
|
this._movementDetected = false;
|
|
49
|
-
this.
|
|
50
|
-
this.
|
|
33
|
+
this._personDetectFallbackTimeout = null;
|
|
34
|
+
this._movementDetectFallbackTimeout = null;
|
|
35
|
+
this._dogDetectFallbackTimeout = null;
|
|
36
|
+
this.name = name;
|
|
51
37
|
this._info = new DeviceInfo_1.DeviceInfo();
|
|
52
|
-
this._info.fullName = `Camera ${roomName} ${
|
|
53
|
-
this._info.customName = `Camera ${
|
|
38
|
+
this._info.fullName = `Camera ${roomName} ${name}`;
|
|
39
|
+
this._info.customName = `Camera ${name}`;
|
|
54
40
|
this._info.room = roomName;
|
|
55
|
-
this._info.allDevicesKey = `camera-${roomName}-${
|
|
41
|
+
this._info.allDevicesKey = `camera-${roomName}-${name}`;
|
|
56
42
|
devices_1.Devices.alLDevices[this._info.allDevicesKey] = this;
|
|
57
|
-
blueIrisCoordinator_1.BlueIrisCoordinator.addDevice(this, mqttName);
|
|
58
43
|
this.persistDeviceInfo();
|
|
59
44
|
this.loadDeviceSettings();
|
|
60
|
-
const blueIrisSettings = services_1.SettingsService.settings.blueIris;
|
|
61
|
-
if (blueIrisSettings !== undefined) {
|
|
62
|
-
this.mpegStreamLink = `${blueIrisSettings.serverAddress}/mjpg/${this.blueIrisName}/video.mjpg?user=${blueIrisSettings.username}&pw=${blueIrisSettings.password}`;
|
|
63
|
-
this.h264IosStreamLink = `${blueIrisSettings.serverAddress}/h264/${this.blueIrisName}/temp.m?user=${blueIrisSettings.username}&pw=${blueIrisSettings.password}`;
|
|
64
|
-
this.rtspStreamLink = `rtsp://${blueIrisSettings.username}:${blueIrisSettings.password}@${blueIrisSettings.serverAddress.replace('http://', '')}:80/${this.blueIrisName}`;
|
|
65
|
-
this.currentImageLink = `${blueIrisSettings.serverAddress}/image/${this.blueIrisName}.jpg?q=100&s=100&user=${blueIrisSettings.username}&pw=${blueIrisSettings.password}`;
|
|
66
|
-
}
|
|
67
45
|
if (!services_1.Utils.anyDboActive) {
|
|
68
46
|
this._initialized = true;
|
|
69
47
|
}
|
|
@@ -139,58 +117,6 @@ class CameraDevice {
|
|
|
139
117
|
var _a;
|
|
140
118
|
(_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistMotionSensor(this);
|
|
141
119
|
}
|
|
142
|
-
/** @inheritDoc */
|
|
143
|
-
update(idSplit, state) {
|
|
144
|
-
const stateName = idSplit[4];
|
|
145
|
-
switch (stateName) {
|
|
146
|
-
case 'MotionDetected':
|
|
147
|
-
this._movementDetectedStateId = idSplit.join('.');
|
|
148
|
-
if (this.settings.movementDetectionOnPersonOnly) {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
this.log(models_1.LogLevel.Debug, `Update for "${stateName}" to value: ${state.val}`);
|
|
152
|
-
const movementDetected = state.val === 1;
|
|
153
|
-
this.updateMovement(movementDetected);
|
|
154
|
-
if (movementDetected) {
|
|
155
|
-
this.resetMovementFallbackTimer();
|
|
156
|
-
}
|
|
157
|
-
break;
|
|
158
|
-
case 'PersonDetected':
|
|
159
|
-
this._personDetectedStateId = idSplit.join('.');
|
|
160
|
-
const newValue = state.val === 1;
|
|
161
|
-
this.log(models_1.LogLevel.Debug, `Update for "${stateName}" to value: ${state.val}`);
|
|
162
|
-
if (newValue) {
|
|
163
|
-
this.log(models_1.LogLevel.Info, 'Person Detected');
|
|
164
|
-
this.resetPersonDetectFallbackTimer();
|
|
165
|
-
}
|
|
166
|
-
this._personDetected = newValue;
|
|
167
|
-
if (this.settings.movementDetectionOnPersonOnly) {
|
|
168
|
-
this.updateMovement(newValue);
|
|
169
|
-
}
|
|
170
|
-
break;
|
|
171
|
-
case 'DogDetected':
|
|
172
|
-
this._dogDetectedStateId = idSplit.join('.');
|
|
173
|
-
const newDogDetectionVal = state.val === 1;
|
|
174
|
-
this.log(models_1.LogLevel.Debug, `Update for "${stateName}" to value: ${state.val}`);
|
|
175
|
-
if (newDogDetectionVal) {
|
|
176
|
-
this.log(models_1.LogLevel.Info, 'Dog Detected');
|
|
177
|
-
this.resetDogDetectFallbackTimer();
|
|
178
|
-
}
|
|
179
|
-
this._dogDetected = newDogDetectionVal;
|
|
180
|
-
if (this.settings.movementDetectionOnDogsToo) {
|
|
181
|
-
this.updateMovement(newDogDetectionVal);
|
|
182
|
-
}
|
|
183
|
-
break;
|
|
184
|
-
case 'MotionSnapshot':
|
|
185
|
-
this._lastImage = state.val;
|
|
186
|
-
services_1.Utils.guardedTimeout(() => {
|
|
187
|
-
// Give Person Detected Update some time, as otherwise personDetected might still be false
|
|
188
|
-
if (this.settings.alertPersonOnTelegram && this._personDetected && !this.alarmBlockedByDevices) {
|
|
189
|
-
services_1.TelegramService.sendImage(`${this.name} detected Person`, new models_1.Base64Image(this._lastImage, 'person_alert'));
|
|
190
|
-
}
|
|
191
|
-
}, 1000);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
120
|
log(level, message, debugType = services_1.LogDebugType.None) {
|
|
195
121
|
var _a, _b;
|
|
196
122
|
services_1.ServerLogService.writeLog(level, `${this.name}: ${message}`, {
|
|
@@ -216,6 +142,46 @@ class CameraDevice {
|
|
|
216
142
|
var _a;
|
|
217
143
|
(_a = this.settings) === null || _a === void 0 ? void 0 : _a.initializeFromDb(this);
|
|
218
144
|
}
|
|
145
|
+
onNewMotionDetectedValue(newValue) {
|
|
146
|
+
if (this.settings.movementDetectionOnPersonOnly) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
this.log(models_1.LogLevel.Debug, `Update for "Motion" to value: ${newValue}`);
|
|
150
|
+
this.updateMovement(newValue);
|
|
151
|
+
if (newValue) {
|
|
152
|
+
this.resetMovementFallbackTimer();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
onNewPersonDetectedValue(newValue) {
|
|
156
|
+
this.log(models_1.LogLevel.Debug, `Update for PersonDetected to value: ${newValue}`);
|
|
157
|
+
if (newValue) {
|
|
158
|
+
this.log(models_1.LogLevel.Info, 'Person Detected');
|
|
159
|
+
this.resetPersonDetectFallbackTimer();
|
|
160
|
+
}
|
|
161
|
+
this._personDetected = newValue;
|
|
162
|
+
if (this.settings.movementDetectionOnPersonOnly) {
|
|
163
|
+
this.updateMovement(newValue);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
onNewImageSnapshot(image) {
|
|
167
|
+
this._lastImage = image;
|
|
168
|
+
services_1.Utils.guardedTimeout(() => {
|
|
169
|
+
// Give Person Detected Update some time, as otherwise personDetected might still be false
|
|
170
|
+
if (this.settings.alertPersonOnTelegram && this._personDetected && !this.alarmBlockedByDevices) {
|
|
171
|
+
services_1.TelegramService.sendImage(`${this.name} detected Person`, new models_1.Base64Image(this._lastImage, 'person_alert'));
|
|
172
|
+
}
|
|
173
|
+
}, 1000);
|
|
174
|
+
}
|
|
175
|
+
onNewDogDetectionValue(newDogDetectionVal) {
|
|
176
|
+
if (newDogDetectionVal) {
|
|
177
|
+
this.log(models_1.LogLevel.Info, 'Dog Detected');
|
|
178
|
+
this.resetDogDetectFallbackTimer();
|
|
179
|
+
}
|
|
180
|
+
this._dogDetected = newDogDetectionVal;
|
|
181
|
+
if (this.settings.movementDetectionOnDogsToo) {
|
|
182
|
+
this.updateMovement(newDogDetectionVal);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
219
185
|
updateMovement(newState) {
|
|
220
186
|
if (!this._initialized && newState) {
|
|
221
187
|
this.log(models_1.LogLevel.Trace, 'Movement recognized, but database initialization has not finished yet --> delay.');
|
|
@@ -246,32 +212,12 @@ class CameraDevice {
|
|
|
246
212
|
this._personDetectFallbackTimeout = null;
|
|
247
213
|
}
|
|
248
214
|
this._personDetectFallbackTimeout = services_1.Utils.guardedTimeout(() => {
|
|
249
|
-
var _a;
|
|
250
215
|
this._personDetectFallbackTimeout = null;
|
|
251
216
|
this._personDetected = false;
|
|
252
217
|
if (this.settings.movementDetectionOnPersonOnly) {
|
|
253
218
|
this.updateMovement(false);
|
|
254
219
|
}
|
|
255
|
-
|
|
256
|
-
(_a = ioBroker_1.ioBrokerMain.iOConnection) === null || _a === void 0 ? void 0 : _a.setState(this._personDetectedStateId, { val: 0, ack: true });
|
|
257
|
-
}
|
|
258
|
-
}, 120000, this);
|
|
259
|
-
}
|
|
260
|
-
resetDogDetectFallbackTimer() {
|
|
261
|
-
if (this._dogDetectFallbackTimeout !== null) {
|
|
262
|
-
clearTimeout(this._dogDetectFallbackTimeout);
|
|
263
|
-
this._dogDetectFallbackTimeout = null;
|
|
264
|
-
}
|
|
265
|
-
this._dogDetectFallbackTimeout = services_1.Utils.guardedTimeout(() => {
|
|
266
|
-
var _a;
|
|
267
|
-
this._dogDetectFallbackTimeout = null;
|
|
268
|
-
this._dogDetected = false;
|
|
269
|
-
if (this.settings.movementDetectionOnDogsToo) {
|
|
270
|
-
this.updateMovement(false);
|
|
271
|
-
}
|
|
272
|
-
if (this._dogDetectedStateId !== undefined) {
|
|
273
|
-
(_a = ioBroker_1.ioBrokerMain.iOConnection) === null || _a === void 0 ? void 0 : _a.setState(this._dogDetectedStateId, { val: 0, ack: true });
|
|
274
|
-
}
|
|
220
|
+
this.resetPersonDetectedState();
|
|
275
221
|
}, 120000, this);
|
|
276
222
|
}
|
|
277
223
|
resetMovementFallbackTimer() {
|
|
@@ -280,7 +226,6 @@ class CameraDevice {
|
|
|
280
226
|
this._movementDetectFallbackTimeout = null;
|
|
281
227
|
}
|
|
282
228
|
this._movementDetectFallbackTimeout = services_1.Utils.guardedTimeout(() => {
|
|
283
|
-
var _a;
|
|
284
229
|
this._movementDetectFallbackTimeout = null;
|
|
285
230
|
if (!this._movementDetected) {
|
|
286
231
|
// Der Fallback wird nicht benötigt, da bereits das Movement zurückgesetzt wurde
|
|
@@ -288,9 +233,21 @@ class CameraDevice {
|
|
|
288
233
|
}
|
|
289
234
|
this._movementDetected = false;
|
|
290
235
|
this.updateMovement(false);
|
|
291
|
-
|
|
292
|
-
|
|
236
|
+
this.resetMovementDetectedState();
|
|
237
|
+
}, 120000, this);
|
|
238
|
+
}
|
|
239
|
+
resetDogDetectFallbackTimer() {
|
|
240
|
+
if (this._dogDetectFallbackTimeout !== null) {
|
|
241
|
+
clearTimeout(this._dogDetectFallbackTimeout);
|
|
242
|
+
this._dogDetectFallbackTimeout = null;
|
|
243
|
+
}
|
|
244
|
+
this._dogDetectFallbackTimeout = services_1.Utils.guardedTimeout(() => {
|
|
245
|
+
this._dogDetectFallbackTimeout = null;
|
|
246
|
+
this._dogDetected = false;
|
|
247
|
+
if (this.settings.movementDetectionOnDogsToo) {
|
|
248
|
+
this.updateMovement(false);
|
|
293
249
|
}
|
|
250
|
+
this.resetDogDetectedState();
|
|
294
251
|
}, 120000, this);
|
|
295
252
|
}
|
|
296
253
|
}
|
|
@@ -47,11 +47,4 @@ export interface iCameraDevice extends iMotionSensor {
|
|
|
47
47
|
* @param block - Whether to block the alarm for the device or lift the block
|
|
48
48
|
*/
|
|
49
49
|
blockForDevice(device: iBaseDevice, block: boolean): void;
|
|
50
|
-
/**
|
|
51
|
-
* Inform this camera of state updates within iOBroker
|
|
52
|
-
* TODO: Make camera independent of iOBroker
|
|
53
|
-
* @param idSplit - The id split of the state
|
|
54
|
-
* @param state - The state that has been updated
|
|
55
|
-
*/
|
|
56
|
-
update(idSplit: string[], state: ioBroker.State): void;
|
|
57
50
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { CameraDevice } from '../CameraDevice';
|
|
2
|
+
export declare class BlueIrisCameraDevice extends CameraDevice {
|
|
3
|
+
/**
|
|
4
|
+
* The name of the camera in BlueIris
|
|
5
|
+
*/
|
|
6
|
+
readonly blueIrisName: string;
|
|
7
|
+
/** @inheritDoc */
|
|
8
|
+
readonly mpegStreamLink: string;
|
|
9
|
+
/** @inheritDoc */
|
|
10
|
+
readonly h264IosStreamLink: string;
|
|
11
|
+
/** @inheritDoc */
|
|
12
|
+
readonly rtspStreamLink: string;
|
|
13
|
+
/** @inheritDoc */
|
|
14
|
+
readonly currentImageLink: string;
|
|
15
|
+
private _personDetectedStateId;
|
|
16
|
+
private _dogDetectedStateId;
|
|
17
|
+
private _movementDetectedStateId;
|
|
18
|
+
constructor(mqttName: string, roomName: string, blueIrisName: string);
|
|
19
|
+
/**
|
|
20
|
+
* Inform this camera of state updates within iOBroker
|
|
21
|
+
* @param idSplit - The id split of the state
|
|
22
|
+
* @param state - The state that has been updated
|
|
23
|
+
*/
|
|
24
|
+
update(idSplit: string[], state: ioBroker.State): void;
|
|
25
|
+
protected resetPersonDetectedState(): void;
|
|
26
|
+
protected resetDogDetectedState(): void;
|
|
27
|
+
protected resetMovementDetectedState(): void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BlueIrisCameraDevice = void 0;
|
|
4
|
+
const models_1 = require("../../../models");
|
|
5
|
+
const blueIrisCoordinator_1 = require("./blueIrisCoordinator");
|
|
6
|
+
const services_1 = require("../../services");
|
|
7
|
+
const ioBroker_1 = require("../../ioBroker");
|
|
8
|
+
const CameraDevice_1 = require("../CameraDevice");
|
|
9
|
+
class BlueIrisCameraDevice extends CameraDevice_1.CameraDevice {
|
|
10
|
+
constructor(mqttName, roomName, blueIrisName) {
|
|
11
|
+
super(mqttName, roomName);
|
|
12
|
+
/** @inheritDoc */
|
|
13
|
+
this.mpegStreamLink = '';
|
|
14
|
+
/** @inheritDoc */
|
|
15
|
+
this.h264IosStreamLink = '';
|
|
16
|
+
/** @inheritDoc */
|
|
17
|
+
this.rtspStreamLink = '';
|
|
18
|
+
/** @inheritDoc */
|
|
19
|
+
this.currentImageLink = '';
|
|
20
|
+
this._personDetectedStateId = undefined;
|
|
21
|
+
this._dogDetectedStateId = undefined;
|
|
22
|
+
this._movementDetectedStateId = undefined;
|
|
23
|
+
this.blueIrisName = blueIrisName;
|
|
24
|
+
blueIrisCoordinator_1.BlueIrisCoordinator.addDevice(this, mqttName);
|
|
25
|
+
const blueIrisSettings = services_1.SettingsService.settings.blueIris;
|
|
26
|
+
if (blueIrisSettings !== undefined) {
|
|
27
|
+
this.mpegStreamLink = `${blueIrisSettings.serverAddress}/mjpg/${this.blueIrisName}/video.mjpg?user=${blueIrisSettings.username}&pw=${blueIrisSettings.password}`;
|
|
28
|
+
this.h264IosStreamLink = `${blueIrisSettings.serverAddress}/h264/${this.blueIrisName}/temp.m?user=${blueIrisSettings.username}&pw=${blueIrisSettings.password}`;
|
|
29
|
+
this.rtspStreamLink = `rtsp://${blueIrisSettings.username}:${blueIrisSettings.password}@${blueIrisSettings.serverAddress.replace('http://', '')}:80/${this.blueIrisName}`;
|
|
30
|
+
this.currentImageLink = `${blueIrisSettings.serverAddress}/image/${this.blueIrisName}.jpg?q=100&s=100&user=${blueIrisSettings.username}&pw=${blueIrisSettings.password}`;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Inform this camera of state updates within iOBroker
|
|
35
|
+
* @param idSplit - The id split of the state
|
|
36
|
+
* @param state - The state that has been updated
|
|
37
|
+
*/
|
|
38
|
+
update(idSplit, state) {
|
|
39
|
+
const stateName = idSplit[4];
|
|
40
|
+
switch (stateName) {
|
|
41
|
+
case 'MotionDetected':
|
|
42
|
+
this._movementDetectedStateId = idSplit.join('.');
|
|
43
|
+
this.onNewMotionDetectedValue(state.val === 1);
|
|
44
|
+
break;
|
|
45
|
+
case 'PersonDetected':
|
|
46
|
+
this._personDetectedStateId = idSplit.join('.');
|
|
47
|
+
const newValue = state.val === 1;
|
|
48
|
+
this.onNewPersonDetectedValue(newValue);
|
|
49
|
+
break;
|
|
50
|
+
case 'DogDetected':
|
|
51
|
+
this._dogDetectedStateId = idSplit.join('.');
|
|
52
|
+
const newDogDetectionVal = state.val === 1;
|
|
53
|
+
this.log(models_1.LogLevel.Debug, `Update for "${stateName}" to value: ${state.val}`);
|
|
54
|
+
this.onNewDogDetectionValue(newDogDetectionVal);
|
|
55
|
+
break;
|
|
56
|
+
case 'MotionSnapshot':
|
|
57
|
+
this.onNewImageSnapshot(state.val);
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
resetPersonDetectedState() {
|
|
62
|
+
var _a;
|
|
63
|
+
if (this._personDetectedStateId !== undefined) {
|
|
64
|
+
(_a = ioBroker_1.ioBrokerMain.iOConnection) === null || _a === void 0 ? void 0 : _a.setState(this._personDetectedStateId, { val: 0, ack: true });
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
resetDogDetectedState() {
|
|
68
|
+
var _a;
|
|
69
|
+
if (this._dogDetectedStateId !== undefined) {
|
|
70
|
+
(_a = ioBroker_1.ioBrokerMain.iOConnection) === null || _a === void 0 ? void 0 : _a.setState(this._dogDetectedStateId, { val: 0, ack: true });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
resetMovementDetectedState() {
|
|
74
|
+
var _a;
|
|
75
|
+
if (this._movementDetectedStateId !== undefined) {
|
|
76
|
+
(_a = ioBroker_1.ioBrokerMain.iOConnection) === null || _a === void 0 ? void 0 : _a.setState(this._movementDetectedStateId, { val: 0, ack: true });
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
exports.BlueIrisCameraDevice = BlueIrisCameraDevice;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './blueIrisCoordinator';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './blueIrisCameraDevice';
|
|
@@ -15,4 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./blueIrisCoordinator"), exports);
|
|
18
|
-
__exportStar(require("./
|
|
18
|
+
__exportStar(require("./blueIrisCameraDevice"), exports);
|
|
@@ -50,3 +50,4 @@ __exportStar(require("./IoBrokerDeviceInfo"), exports);
|
|
|
50
50
|
var nameAmountValuePair_1 = require("./nameAmountValuePair");
|
|
51
51
|
Object.defineProperty(exports, "NameAmountValuePair", { enumerable: true, get: function () { return nameAmountValuePair_1.NameAmountValuePair; } });
|
|
52
52
|
__exportStar(require("./wledDevice"), exports);
|
|
53
|
+
__exportStar(require("./CameraDevice"), exports);
|