hoffmation-base 3.0.0-beta.8 → 3.0.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/README.md +34 -8
- package/lib/models/action/handleChangeAction.d.ts +12 -0
- package/lib/models/action/handleChangeAction.js +15 -0
- package/lib/models/action/index.d.ts +1 -0
- package/lib/models/action/index.js +3 -1
- package/lib/models/command/commandType.d.ts +1 -0
- package/lib/models/command/commandType.js +1 -0
- package/lib/models/deviceSettings/cameraSettings.d.ts +4 -0
- package/lib/models/deviceSettings/cameraSettings.js +6 -1
- package/lib/models/deviceSettings/deviceSettings.d.ts +5 -0
- package/lib/models/deviceSettings/deviceSettings.js +7 -0
- 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/baseDeviceInterfaces/iHandleSensor.d.ts +6 -0
- package/lib/server/devices/baseDeviceInterfaces/iHeater.d.ts +10 -1
- package/lib/server/devices/baseDeviceInterfaces/index.d.ts +1 -0
- package/lib/server/devices/baseDeviceInterfaces/index.js +1 -0
- 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/dachs/lib/dachsHttpClient.js +4 -0
- package/lib/server/devices/groups/Window.d.ts +7 -1
- package/lib/server/devices/groups/Window.js +15 -1
- package/lib/server/devices/groups/heatGroup.js +6 -0
- package/lib/server/devices/groups/windowGroup.d.ts +11 -1
- package/lib/server/devices/groups/windowGroup.js +18 -0
- package/lib/server/devices/hmIPDevices/hmIpGriff.d.ts +3 -0
- package/lib/server/devices/hmIPDevices/hmIpGriff.js +4 -0
- package/lib/server/devices/hmIPDevices/hmIpHeizgruppe.d.ts +7 -1
- package/lib/server/devices/hmIPDevices/hmIpHeizgruppe.js +24 -0
- package/lib/server/devices/index.d.ts +1 -0
- package/lib/server/devices/index.js +1 -0
- package/lib/server/devices/sharedFunctions/handleSensor.d.ts +3 -2
- package/lib/server/devices/sharedFunctions/handleSensor.js +8 -0
- package/lib/server/devices/shelly/shellyTrv.d.ts +7 -1
- package/lib/server/devices/shelly/shellyTrv.js +24 -0
- package/lib/server/devices/zigbee/BaseDevices/zigbeeHeater.d.ts +7 -1
- package/lib/server/devices/zigbee/BaseDevices/zigbeeHeater.js +24 -0
- package/lib/server/devices/zigbee/BaseDevices/zigbeeWindowHandle.d.ts +3 -0
- package/lib/server/devices/zigbee/BaseDevices/zigbeeWindowHandle.js +4 -0
- package/lib/server/services/dbo/postgreSqlPersist.js +82 -64
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -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);
|
|
@@ -33,6 +33,8 @@ const _ = __importStar(require("lodash"));
|
|
|
33
33
|
const keyTemplates_1 = __importDefault(require("./keyTemplates"));
|
|
34
34
|
const services_1 = require("../../../services");
|
|
35
35
|
const models_1 = require("../../../../models");
|
|
36
|
+
const http = __importStar(require("node:http"));
|
|
37
|
+
const https = __importStar(require("node:https"));
|
|
36
38
|
/**
|
|
37
39
|
* axios HTTP Client Class
|
|
38
40
|
* - with some prepared fetch functions for data
|
|
@@ -47,6 +49,8 @@ class DachsHttpClient {
|
|
|
47
49
|
this.options = options;
|
|
48
50
|
//combine parameter to baseUrl
|
|
49
51
|
//check http prefix
|
|
52
|
+
axios_1.default.defaults.httpsAgent = new https.Agent({ keepAlive: false });
|
|
53
|
+
axios_1.default.defaults.httpAgent = new http.Agent({ keepAlive: false });
|
|
50
54
|
const protocol = options.protocol ? options.protocol : 'http';
|
|
51
55
|
this.options.host = this.options.host.startsWith('http') ? this.options.host : `${protocol}://${this.options.host}`;
|
|
52
56
|
//combine all parameter for url
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WindowPosition } from '../models';
|
|
2
|
-
import { ShutterPositionChangedAction, WindowRestoreDesiredPositionCommand, WindowSetDesiredPositionCommand } from '../../../models';
|
|
2
|
+
import { HandleChangeAction, ShutterPositionChangedAction, WindowRestoreDesiredPositionCommand, WindowSetDesiredPositionCommand } from '../../../models';
|
|
3
3
|
import { iHandleSensor, iShutter, iVibrationSensor } from '../baseDeviceInterfaces';
|
|
4
4
|
import { BaseGroup } from './base-group';
|
|
5
5
|
import { ZigbeeMagnetContact } from '../zigbee';
|
|
@@ -19,6 +19,11 @@ export declare class Window extends BaseGroup {
|
|
|
19
19
|
* @returns {boolean} true if any shutter is down
|
|
20
20
|
*/
|
|
21
21
|
get anyShutterDown(): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Checks if any handle is not closed
|
|
24
|
+
* @returns {boolean} true if any handle is not closed
|
|
25
|
+
*/
|
|
26
|
+
get anyHandleNotClosed(): boolean;
|
|
22
27
|
constructor(roomName: string, handleIds?: string[], vibrationIds?: string[], shutterIds?: string[], magnetIds?: string[]);
|
|
23
28
|
/**
|
|
24
29
|
* sets the desired Pos and moves rollo to this level
|
|
@@ -33,4 +38,5 @@ export declare class Window extends BaseGroup {
|
|
|
33
38
|
initialize(): void;
|
|
34
39
|
rolloPositionChange(action: ShutterPositionChangedAction): void;
|
|
35
40
|
restoreDesiredPosition(c: WindowRestoreDesiredPositionCommand): void;
|
|
41
|
+
addHandleChangeCallback(cb: (handleChangeAction: HandleChangeAction) => void): void;
|
|
36
42
|
}
|
|
@@ -25,6 +25,15 @@ class Window extends base_group_1.BaseGroup {
|
|
|
25
25
|
return s.currentLevel === 0;
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Checks if any handle is not closed
|
|
30
|
+
* @returns {boolean} true if any handle is not closed
|
|
31
|
+
*/
|
|
32
|
+
get anyHandleNotClosed() {
|
|
33
|
+
return this.getHandle().some((h) => {
|
|
34
|
+
return h.position !== models_1.WindowPosition.closed;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
28
37
|
constructor(roomName, handleIds = [], vibrationIds = [], shutterIds = [], magnetIds = []) {
|
|
29
38
|
super(roomName, group_type_1.GroupType.Window);
|
|
30
39
|
this.handleIds = handleIds;
|
|
@@ -46,7 +55,7 @@ class Window extends base_group_1.BaseGroup {
|
|
|
46
55
|
this.restoreDesiredPosition(new models_2.WindowRestoreDesiredPositionCommand(c));
|
|
47
56
|
}
|
|
48
57
|
getHandle() {
|
|
49
|
-
return this.deviceCluster.
|
|
58
|
+
return this.deviceCluster.getDevicesByType(device_cluster_type_1.DeviceClusterType.Handle);
|
|
50
59
|
}
|
|
51
60
|
getMagnetContact() {
|
|
52
61
|
return this.deviceCluster.getIoBrokerDevicesByType(device_cluster_type_1.DeviceClusterType.MagnetContact);
|
|
@@ -122,5 +131,10 @@ class Window extends base_group_1.BaseGroup {
|
|
|
122
131
|
restoreDesiredPosition(c) {
|
|
123
132
|
services_1.ShutterService.windowAllToPosition(this, new models_2.ShutterSetLevelCommand(c, this._desiredPosition));
|
|
124
133
|
}
|
|
134
|
+
addHandleChangeCallback(cb) {
|
|
135
|
+
this.getHandle().forEach((griff) => {
|
|
136
|
+
griff.addHandleChangeCallback(cb);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
125
139
|
}
|
|
126
140
|
exports.Window = Window;
|
|
@@ -120,6 +120,7 @@ class HeatGroup extends base_group_1.BaseGroup {
|
|
|
120
120
|
return this.deviceCluster.getDevicesByType(device_cluster_type_1.DeviceClusterType.Ac);
|
|
121
121
|
}
|
|
122
122
|
initialize() {
|
|
123
|
+
var _a;
|
|
123
124
|
services_1.Utils.guardedTimeout(() => {
|
|
124
125
|
this.settings.initializeFromDb(this);
|
|
125
126
|
}, 200, this);
|
|
@@ -131,6 +132,11 @@ class HeatGroup extends base_group_1.BaseGroup {
|
|
|
131
132
|
this.getOwnAcDevices().forEach((acDev) => {
|
|
132
133
|
acDev.room = this.getRoom();
|
|
133
134
|
});
|
|
135
|
+
(_a = this.getRoom().WindowGroup) === null || _a === void 0 ? void 0 : _a.addHandleChangeCallback((handleChangeAction) => {
|
|
136
|
+
this.getHeater().forEach((heater) => {
|
|
137
|
+
heater.onHandleChange(handleChangeAction);
|
|
138
|
+
});
|
|
139
|
+
});
|
|
134
140
|
}
|
|
135
141
|
/**
|
|
136
142
|
* Sets all ACs to new desired Value
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RoomRestoreShutterPositionCommand, ShutterSunriseUpCommand, TimeCallback, WindowSetDesiredPositionCommand, WindowSetRolloByWeatherStatusCommand } from '../../../models';
|
|
1
|
+
import { HandleChangeAction, RoomRestoreShutterPositionCommand, ShutterSunriseUpCommand, TimeCallback, WindowSetDesiredPositionCommand, WindowSetRolloByWeatherStatusCommand } from '../../../models';
|
|
2
2
|
import { Window } from './Window';
|
|
3
3
|
import { BaseGroup } from './base-group';
|
|
4
4
|
export declare class WindowGroup extends BaseGroup {
|
|
@@ -20,7 +20,17 @@ export declare class WindowGroup extends BaseGroup {
|
|
|
20
20
|
* @returns {boolean} True if there is atleast one shutte with level of 0%.
|
|
21
21
|
*/
|
|
22
22
|
get anyShutterDown(): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Checks if any handle of any window is open
|
|
25
|
+
* @returns {boolean} True if there is atleast one handle that is open.
|
|
26
|
+
*/
|
|
27
|
+
get anyWindowOpen(): boolean;
|
|
23
28
|
constructor(roomName: string, windows: Window[]);
|
|
29
|
+
/**
|
|
30
|
+
* Adds Callbacks to each window and their handles.
|
|
31
|
+
* @param cb - The callback to execute on met condition.
|
|
32
|
+
*/
|
|
33
|
+
addHandleChangeCallback(cb: (handleChangeAction: HandleChangeAction) => void): void;
|
|
24
34
|
setDesiredPosition(c: WindowSetDesiredPositionCommand): void;
|
|
25
35
|
initialize(): void;
|
|
26
36
|
recalcTimeCallbacks(): void;
|
|
@@ -18,6 +18,15 @@ class WindowGroup extends base_group_1.BaseGroup {
|
|
|
18
18
|
return w.anyShutterDown;
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Checks if any handle of any window is open
|
|
23
|
+
* @returns {boolean} True if there is atleast one handle that is open.
|
|
24
|
+
*/
|
|
25
|
+
get anyWindowOpen() {
|
|
26
|
+
return this.windows.some((w) => {
|
|
27
|
+
return w.anyHandleNotClosed;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
21
30
|
constructor(roomName, windows) {
|
|
22
31
|
super(roomName, group_type_1.GroupType.WindowGroup);
|
|
23
32
|
this.windows = windows;
|
|
@@ -36,6 +45,15 @@ class WindowGroup extends base_group_1.BaseGroup {
|
|
|
36
45
|
this.deviceCluster.deviceMap.set(device_cluster_type_1.DeviceClusterType.Shutter, new device_list_1.DeviceList(shutterIds));
|
|
37
46
|
this.deviceCluster.deviceMap.set(device_cluster_type_1.DeviceClusterType.MagnetContact, new device_list_1.DeviceList(magnetIds));
|
|
38
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Adds Callbacks to each window and their handles.
|
|
50
|
+
* @param cb - The callback to execute on met condition.
|
|
51
|
+
*/
|
|
52
|
+
addHandleChangeCallback(cb) {
|
|
53
|
+
this.windows.forEach((f) => {
|
|
54
|
+
f.addHandleChangeCallback(cb);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
39
57
|
setDesiredPosition(c) {
|
|
40
58
|
this.windows.forEach((f) => {
|
|
41
59
|
f.setDesiredPosition(c);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { iDisposable } from '../../services';
|
|
2
2
|
import { WindowPosition } from '../models';
|
|
3
3
|
import { Window } from '../groups';
|
|
4
|
+
import { HandleChangeAction } from '../../../models';
|
|
4
5
|
import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
|
|
5
6
|
import { HmIPDevice } from './hmIpDevice';
|
|
6
7
|
import { iBatteryDevice, iHandleSensor } from '../baseDeviceInterfaces';
|
|
@@ -34,6 +35,8 @@ export declare class HmIpGriff extends HmIPDevice implements iHandleSensor, iBat
|
|
|
34
35
|
/** @inheritDoc */
|
|
35
36
|
addClosedCallback(pCallback: (pValue: boolean) => void): void;
|
|
36
37
|
/** @inheritDoc */
|
|
38
|
+
addHandleChangeCallback(cb: (handleChangeAction: HandleChangeAction) => void): void;
|
|
39
|
+
/** @inheritDoc */
|
|
37
40
|
update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
|
|
38
41
|
/** @inheritDoc */
|
|
39
42
|
dispose(): void;
|
|
@@ -55,6 +55,10 @@ class HmIpGriff extends hmIpDevice_1.HmIPDevice {
|
|
|
55
55
|
this.handleSensor.addClosedCallback(pCallback);
|
|
56
56
|
}
|
|
57
57
|
/** @inheritDoc */
|
|
58
|
+
addHandleChangeCallback(cb) {
|
|
59
|
+
this.handleSensor.addHandleChangeCallback(cb);
|
|
60
|
+
}
|
|
61
|
+
/** @inheritDoc */
|
|
58
62
|
update(idSplit, state, initial = false) {
|
|
59
63
|
this.log(models_1.LogLevel.DeepTrace, `Griff Update: JSON: ${JSON.stringify(state)}ID: ${idSplit.join('.')}`);
|
|
60
64
|
super.update(idSplit, state, initial, true);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HmIPDevice } from './hmIpDevice';
|
|
2
2
|
import { iDisposable } from '../../services';
|
|
3
|
-
import { HeaterSettings, HumiditySensorChangeAction, TemperatureSensorChangeAction } from '../../../models';
|
|
3
|
+
import { HandleChangeAction, HeaterSettings, HumiditySensorChangeAction, TemperatureSensorChangeAction } from '../../../models';
|
|
4
4
|
import { iHeater, iHumiditySensor, iTemperatureSensor } from '../baseDeviceInterfaces';
|
|
5
5
|
import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
|
|
6
6
|
import { HumiditySensor, TemperatureSensor } from '../sharedFunctions';
|
|
@@ -13,10 +13,12 @@ export declare class HmIpHeizgruppe extends HmIPDevice implements iTemperatureSe
|
|
|
13
13
|
humiditySensor: HumiditySensor;
|
|
14
14
|
/** @inheritDoc */
|
|
15
15
|
settings: HeaterSettings;
|
|
16
|
+
private readonly _setWindowOpenID;
|
|
16
17
|
private _iAutomaticInterval;
|
|
17
18
|
private _initialSeasonCheckDone;
|
|
18
19
|
private _level;
|
|
19
20
|
private _setPointTemperatureID;
|
|
21
|
+
private _windowOpen;
|
|
20
22
|
constructor(pInfo: IoBrokerDeviceInfo);
|
|
21
23
|
protected _seasonTurnOff: boolean;
|
|
22
24
|
/** @inheritDoc */
|
|
@@ -41,6 +43,8 @@ export declare class HmIpHeizgruppe extends HmIPDevice implements iTemperatureSe
|
|
|
41
43
|
/** @inheritDoc */
|
|
42
44
|
get roomTemperature(): number;
|
|
43
45
|
/** @inheritDoc */
|
|
46
|
+
get windowOpen(): boolean;
|
|
47
|
+
/** @inheritDoc */
|
|
44
48
|
addHumidityCallback(pCallback: (action: HumiditySensorChangeAction) => void): void;
|
|
45
49
|
getBelongingHeizungen(): iHeater[];
|
|
46
50
|
/** @inheritDoc */
|
|
@@ -55,8 +59,10 @@ export declare class HmIpHeizgruppe extends HmIPDevice implements iTemperatureSe
|
|
|
55
59
|
persistTemperaturSensor(): void;
|
|
56
60
|
/** @inheritDoc */
|
|
57
61
|
persistHeater(): void;
|
|
62
|
+
onHandleChange(_action: HandleChangeAction): void;
|
|
58
63
|
/** @inheritDoc */
|
|
59
64
|
dispose(): void;
|
|
60
65
|
private checkSeasonTurnOff;
|
|
66
|
+
private onWindowOpenChange;
|
|
61
67
|
private updateBaseInformation;
|
|
62
68
|
}
|
|
@@ -21,9 +21,11 @@ class HmIpHeizgruppe extends hmIpDevice_1.HmIPDevice {
|
|
|
21
21
|
this.humiditySensor = new sharedFunctions_1.HumiditySensor(this);
|
|
22
22
|
/** @inheritDoc */
|
|
23
23
|
this.settings = new models_1.HeaterSettings();
|
|
24
|
+
this._setWindowOpenID = '';
|
|
24
25
|
this._initialSeasonCheckDone = false;
|
|
25
26
|
this._level = 0;
|
|
26
27
|
this._setPointTemperatureID = '';
|
|
28
|
+
this._windowOpen = false;
|
|
27
29
|
this._seasonTurnOff = false;
|
|
28
30
|
this._desiredTemperature = 0;
|
|
29
31
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.temperatureSensor);
|
|
@@ -91,6 +93,10 @@ class HmIpHeizgruppe extends hmIpDevice_1.HmIPDevice {
|
|
|
91
93
|
return this.temperatureSensor.roomTemperature;
|
|
92
94
|
}
|
|
93
95
|
/** @inheritDoc */
|
|
96
|
+
get windowOpen() {
|
|
97
|
+
return this._windowOpen;
|
|
98
|
+
}
|
|
99
|
+
/** @inheritDoc */
|
|
94
100
|
addHumidityCallback(pCallback) {
|
|
95
101
|
this.humiditySensor.addHumidityCallback(pCallback);
|
|
96
102
|
}
|
|
@@ -145,6 +151,18 @@ class HmIpHeizgruppe extends hmIpDevice_1.HmIPDevice {
|
|
|
145
151
|
var _a;
|
|
146
152
|
(_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistHeater(this);
|
|
147
153
|
}
|
|
154
|
+
onHandleChange(_action) {
|
|
155
|
+
var _a;
|
|
156
|
+
if (this.room.WindowGroup === undefined) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
const newState = (_a = this.room.WindowGroup) === null || _a === void 0 ? void 0 : _a.anyWindowOpen;
|
|
160
|
+
if (newState === this._windowOpen) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
this._windowOpen = newState;
|
|
164
|
+
this.onWindowOpenChange(this._windowOpen);
|
|
165
|
+
}
|
|
148
166
|
/** @inheritDoc */
|
|
149
167
|
dispose() {
|
|
150
168
|
this.temperatureSensor.dispose();
|
|
@@ -165,6 +183,12 @@ class HmIpHeizgruppe extends hmIpDevice_1.HmIPDevice {
|
|
|
165
183
|
}
|
|
166
184
|
this._initialSeasonCheckDone = true;
|
|
167
185
|
}
|
|
186
|
+
onWindowOpenChange(pValue) {
|
|
187
|
+
if (!this._setWindowOpenID) {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
this.setState(this._setWindowOpenID, pValue);
|
|
191
|
+
}
|
|
168
192
|
updateBaseInformation(name, state) {
|
|
169
193
|
switch (name) {
|
|
170
194
|
case 'ACTUAL_TEMPERATURE':
|
|
@@ -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);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { WindowPosition } from '../models';
|
|
2
|
-
import { LogLevel } from '../../../models';
|
|
2
|
+
import { HandleChangeAction, iJsonOmitKeys, LogLevel } from '../../../models';
|
|
3
3
|
import { iDisposable, LogDebugType } from '../../services';
|
|
4
4
|
import { Window } from '../groups';
|
|
5
5
|
import { iHandleSensor } from '../baseDeviceInterfaces';
|
|
6
|
-
import { iJsonOmitKeys } from '../../../models/iJsonOmitKeys';
|
|
7
6
|
export declare class HandleSensor implements iDisposable, iJsonOmitKeys {
|
|
8
7
|
private readonly _device;
|
|
9
8
|
/** @inheritDoc */
|
|
@@ -24,6 +23,7 @@ export declare class HandleSensor implements iDisposable, iJsonOmitKeys {
|
|
|
24
23
|
private _kippCallback;
|
|
25
24
|
private _closedCallback;
|
|
26
25
|
private _offenCallback;
|
|
26
|
+
private _handleChangeCallback;
|
|
27
27
|
private _iOpenTimeout;
|
|
28
28
|
private _helpingRoomTemp;
|
|
29
29
|
constructor(_device: iHandleSensor);
|
|
@@ -35,6 +35,7 @@ export declare class HandleSensor implements iDisposable, iJsonOmitKeys {
|
|
|
35
35
|
addKippCallback(pCallback: (pValue: boolean) => void): void;
|
|
36
36
|
/** @inheritDoc */
|
|
37
37
|
addClosedCallback(pCallback: (pValue: boolean) => void): void;
|
|
38
|
+
addHandleChangeCallback(cb: (handleChangeAction: HandleChangeAction) => void): void;
|
|
38
39
|
dispose(): void;
|
|
39
40
|
/**
|
|
40
41
|
* Persists the handle sensor state to the persistence layer
|
|
@@ -21,6 +21,7 @@ class HandleSensor {
|
|
|
21
21
|
this._kippCallback = [];
|
|
22
22
|
this._closedCallback = [];
|
|
23
23
|
this._offenCallback = [];
|
|
24
|
+
this._handleChangeCallback = [];
|
|
24
25
|
this._helpingRoomTemp = false;
|
|
25
26
|
}
|
|
26
27
|
get _settings() {
|
|
@@ -35,6 +36,7 @@ class HandleSensor {
|
|
|
35
36
|
}
|
|
36
37
|
this.log(models_2.LogLevel.Debug, `Update Windowhandle to position "${models_1.WindowPosition[pValue]}"`);
|
|
37
38
|
this.position = pValue;
|
|
39
|
+
const handleChangeAction = new models_2.HandleChangeAction(this._device);
|
|
38
40
|
for (const c1 of this._closedCallback) {
|
|
39
41
|
c1(pValue === 0);
|
|
40
42
|
}
|
|
@@ -44,6 +46,9 @@ class HandleSensor {
|
|
|
44
46
|
for (const c3 of this._offenCallback) {
|
|
45
47
|
c3(pValue === 2);
|
|
46
48
|
}
|
|
49
|
+
for (const c4 of this._handleChangeCallback) {
|
|
50
|
+
c4(handleChangeAction);
|
|
51
|
+
}
|
|
47
52
|
this.persist();
|
|
48
53
|
if (pValue === models_1.WindowPosition.closed) {
|
|
49
54
|
if (this._iOpenTimeout !== undefined) {
|
|
@@ -121,6 +126,9 @@ class HandleSensor {
|
|
|
121
126
|
addClosedCallback(pCallback) {
|
|
122
127
|
this._closedCallback.push(pCallback);
|
|
123
128
|
}
|
|
129
|
+
addHandleChangeCallback(cb) {
|
|
130
|
+
this._handleChangeCallback.push(cb);
|
|
131
|
+
}
|
|
124
132
|
dispose() {
|
|
125
133
|
if (this._iOpenTimeout) {
|
|
126
134
|
clearInterval(this._iOpenTimeout);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ShellyDevice } from './shellyDevice';
|
|
2
2
|
import { iBatteryDevice, iHeater, iTemperatureSensor } from '../baseDeviceInterfaces';
|
|
3
|
-
import { HeaterSettings, TemperatureSensorChangeAction } from '../../../models';
|
|
3
|
+
import { HandleChangeAction, HeaterSettings, TemperatureSensorChangeAction } from '../../../models';
|
|
4
4
|
import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
|
|
5
5
|
import { Battery, TemperatureSensor } from '../sharedFunctions';
|
|
6
6
|
export declare class ShellyTrv extends ShellyDevice implements iHeater, iTemperatureSensor, iBatteryDevice {
|
|
@@ -30,7 +30,9 @@ export declare class ShellyTrv extends ShellyDevice implements iHeater, iTempera
|
|
|
30
30
|
private readonly _setExternalTempId;
|
|
31
31
|
private readonly _setEnableExternalTempId;
|
|
32
32
|
private readonly _setPointTemperaturID;
|
|
33
|
+
private readonly _setWindowOpenID;
|
|
33
34
|
private readonly _valvePosId;
|
|
35
|
+
private _windowOpen;
|
|
34
36
|
constructor(pInfo: IoBrokerDeviceInfo);
|
|
35
37
|
/** @inheritDoc */
|
|
36
38
|
get batteryLevel(): number;
|
|
@@ -51,6 +53,8 @@ export declare class ShellyTrv extends ShellyDevice implements iHeater, iTempera
|
|
|
51
53
|
get sTemperature(): string;
|
|
52
54
|
/** @inheritDoc */
|
|
53
55
|
get roomTemperature(): number;
|
|
56
|
+
/** @inheritDoc */
|
|
57
|
+
get windowOpen(): boolean;
|
|
54
58
|
private set roomTemperatur(value);
|
|
55
59
|
/** @inheritDoc */
|
|
56
60
|
addTempChangeCallback(pCallback: (action: TemperatureSensorChangeAction) => void): void;
|
|
@@ -66,6 +70,8 @@ export declare class ShellyTrv extends ShellyDevice implements iHeater, iTempera
|
|
|
66
70
|
dispose(): void;
|
|
67
71
|
protected getNextPidLevel(): number;
|
|
68
72
|
private checkSeasonTurnOff;
|
|
73
|
+
onHandleChange(_action: HandleChangeAction): void;
|
|
74
|
+
private onWindowOpenChange;
|
|
69
75
|
private recalcLevel;
|
|
70
76
|
private setMode;
|
|
71
77
|
private setExternalTemperature;
|
|
@@ -43,6 +43,7 @@ class ShellyTrv extends shellyDevice_1.ShellyDevice {
|
|
|
43
43
|
Ki: 1000, // PID: Ki in 1/1000
|
|
44
44
|
Kd: 9, // PID: Kd in 1/1000
|
|
45
45
|
});
|
|
46
|
+
this._windowOpen = false;
|
|
46
47
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.heater);
|
|
47
48
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.temperatureSensor);
|
|
48
49
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.batteryDriven);
|
|
@@ -50,6 +51,7 @@ class ShellyTrv extends shellyDevice_1.ShellyDevice {
|
|
|
50
51
|
this._setExternalTempId = `${this.info.fullID}.ext.temperature`;
|
|
51
52
|
this._setEnableExternalTempId = `${this.info.fullID}.ext.enabled`;
|
|
52
53
|
this._setPointTemperaturID = `${this.info.fullID}.tmp.temperatureTargetC`;
|
|
54
|
+
this._setWindowOpenID = `${this.info.fullID}.ext.openWindow`;
|
|
53
55
|
this._minumumLevelId = `${this.info.fullID}.tmp.minimumValvePosition`;
|
|
54
56
|
this._valvePosId = `${this.info.fullID}.tmp.valvePosition`;
|
|
55
57
|
this._iAutomaticInterval = services_1.Utils.guardedInterval(this.checkAutomaticChange, 300000, this); // Alle 5 Minuten prüfen
|
|
@@ -115,6 +117,10 @@ class ShellyTrv extends shellyDevice_1.ShellyDevice {
|
|
|
115
117
|
get roomTemperature() {
|
|
116
118
|
return this.temperatureSensor.roomTemperature;
|
|
117
119
|
}
|
|
120
|
+
/** @inheritDoc */
|
|
121
|
+
get windowOpen() {
|
|
122
|
+
return this._windowOpen;
|
|
123
|
+
}
|
|
118
124
|
set roomTemperatur(val) {
|
|
119
125
|
this.temperatureSensor.roomTemperature = val;
|
|
120
126
|
if (this.settings.useOwnTemperatur) {
|
|
@@ -235,6 +241,24 @@ class ShellyTrv extends shellyDevice_1.ShellyDevice {
|
|
|
235
241
|
}
|
|
236
242
|
this._initialSeasonCheckDone = true;
|
|
237
243
|
}
|
|
244
|
+
onHandleChange(_action) {
|
|
245
|
+
var _a;
|
|
246
|
+
if (this.room.WindowGroup === undefined) {
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
const newState = (_a = this.room.WindowGroup) === null || _a === void 0 ? void 0 : _a.anyWindowOpen;
|
|
250
|
+
if (newState === this._windowOpen) {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
this._windowOpen = newState;
|
|
254
|
+
this.onWindowOpenChange(this._windowOpen);
|
|
255
|
+
}
|
|
256
|
+
onWindowOpenChange(pValue) {
|
|
257
|
+
if (!this._setWindowOpenID) {
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
this.setState(this._setWindowOpenID, pValue);
|
|
261
|
+
}
|
|
238
262
|
recalcLevel() {
|
|
239
263
|
if (this.settings.useOwnTemperatur || this.seasonTurnOff || !this.settings.controlByPid) {
|
|
240
264
|
return;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ZigbeeDevice } from './zigbeeDevice';
|
|
2
2
|
import { iBatteryDevice, iHeater } from '../../baseDeviceInterfaces';
|
|
3
|
-
import { HeaterSettings, TemperatureSensorChangeAction } from '../../../../models';
|
|
3
|
+
import { HandleChangeAction, HeaterSettings, TemperatureSensorChangeAction } from '../../../../models';
|
|
4
4
|
import { DeviceType } from '../../deviceType';
|
|
5
5
|
import { IoBrokerDeviceInfo } from '../../IoBrokerDeviceInfo';
|
|
6
6
|
import { PIDController } from '../../../../liquid-pid';
|
|
@@ -19,14 +19,18 @@ export declare class ZigbeeHeater extends ZigbeeDevice implements iHeater, iBatt
|
|
|
19
19
|
protected _initialSeasonCheckDone: boolean;
|
|
20
20
|
protected _level: number;
|
|
21
21
|
protected _setPointTemperaturID: string;
|
|
22
|
+
protected _setWindowOpenID: string;
|
|
22
23
|
protected _temperatur: number;
|
|
23
24
|
protected _desiredTemperatur: number;
|
|
24
25
|
protected _pidController: PIDController;
|
|
25
26
|
protected _seasonTurnOff: boolean;
|
|
27
|
+
protected _windowOpen: boolean;
|
|
26
28
|
constructor(pInfo: IoBrokerDeviceInfo, pType: DeviceType);
|
|
27
29
|
/** @inheritDoc */
|
|
28
30
|
get batteryLevel(): number;
|
|
29
31
|
/** @inheritDoc */
|
|
32
|
+
get windowOpen(): boolean;
|
|
33
|
+
/** @inheritDoc */
|
|
30
34
|
get seasonTurnOff(): boolean;
|
|
31
35
|
/** @inheritDoc */
|
|
32
36
|
set seasonTurnOff(value: boolean);
|
|
@@ -48,6 +52,7 @@ export declare class ZigbeeHeater extends ZigbeeDevice implements iHeater, iBatt
|
|
|
48
52
|
addTempChangeCallback(pCallback: (action: TemperatureSensorChangeAction) => void): void;
|
|
49
53
|
/** @inheritDoc */
|
|
50
54
|
checkAutomaticChange(): void;
|
|
55
|
+
onHandleChange(_action: HandleChangeAction): void;
|
|
51
56
|
/** @inheritDoc */
|
|
52
57
|
onTemperaturChange(newTemperatur: number): void;
|
|
53
58
|
persistHeater(): void;
|
|
@@ -57,4 +62,5 @@ export declare class ZigbeeHeater extends ZigbeeDevice implements iHeater, iBatt
|
|
|
57
62
|
dispose(): void;
|
|
58
63
|
protected getNextPidLevel(): number;
|
|
59
64
|
private checkSeasonTurnOff;
|
|
65
|
+
private onWindowOpenChange;
|
|
60
66
|
}
|
|
@@ -25,6 +25,7 @@ class ZigbeeHeater extends zigbeeDevice_1.ZigbeeDevice {
|
|
|
25
25
|
this._initialSeasonCheckDone = false;
|
|
26
26
|
this._level = 0;
|
|
27
27
|
this._setPointTemperaturID = '';
|
|
28
|
+
this._setWindowOpenID = '';
|
|
28
29
|
this._temperatur = baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE;
|
|
29
30
|
this._desiredTemperatur = baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE;
|
|
30
31
|
this._pidController = new liquid_pid_1.PIDController({
|
|
@@ -38,6 +39,7 @@ class ZigbeeHeater extends zigbeeDevice_1.ZigbeeDevice {
|
|
|
38
39
|
Kd: 9, // PID: Kd in 1/1000
|
|
39
40
|
});
|
|
40
41
|
this._seasonTurnOff = false;
|
|
42
|
+
this._windowOpen = false;
|
|
41
43
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.heater);
|
|
42
44
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.temperatureSensor);
|
|
43
45
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.batteryDriven);
|
|
@@ -51,6 +53,10 @@ class ZigbeeHeater extends zigbeeDevice_1.ZigbeeDevice {
|
|
|
51
53
|
return this.battery.level;
|
|
52
54
|
}
|
|
53
55
|
/** @inheritDoc */
|
|
56
|
+
get windowOpen() {
|
|
57
|
+
return this._windowOpen;
|
|
58
|
+
}
|
|
59
|
+
/** @inheritDoc */
|
|
54
60
|
get seasonTurnOff() {
|
|
55
61
|
return this._seasonTurnOff;
|
|
56
62
|
}
|
|
@@ -126,6 +132,18 @@ class ZigbeeHeater extends zigbeeDevice_1.ZigbeeDevice {
|
|
|
126
132
|
this.desiredTemperature = targetTemperature;
|
|
127
133
|
}
|
|
128
134
|
}
|
|
135
|
+
onHandleChange(_action) {
|
|
136
|
+
var _a;
|
|
137
|
+
if (this.room.WindowGroup === undefined) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const newState = (_a = this.room.WindowGroup) === null || _a === void 0 ? void 0 : _a.anyWindowOpen;
|
|
141
|
+
if (newState === this._windowOpen) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
this._windowOpen = newState;
|
|
145
|
+
this.onWindowOpenChange(this._windowOpen);
|
|
146
|
+
}
|
|
129
147
|
/** @inheritDoc */
|
|
130
148
|
onTemperaturChange(newTemperatur) {
|
|
131
149
|
this.roomTemperature = newTemperatur;
|
|
@@ -174,5 +192,11 @@ class ZigbeeHeater extends zigbeeDevice_1.ZigbeeDevice {
|
|
|
174
192
|
}
|
|
175
193
|
this._initialSeasonCheckDone = true;
|
|
176
194
|
}
|
|
195
|
+
onWindowOpenChange(pValue) {
|
|
196
|
+
if (!this._setWindowOpenID) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
this.setState(this._setWindowOpenID, pValue);
|
|
200
|
+
}
|
|
177
201
|
}
|
|
178
202
|
exports.ZigbeeHeater = ZigbeeHeater;
|