hoffmation-base 3.0.0-beta.8 → 3.0.0-beta.9
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/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/server/devices/baseDeviceInterfaces/iHandleSensor.d.ts +6 -0
- package/lib/server/devices/baseDeviceInterfaces/iHeater.d.ts +10 -1
- 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/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/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseAction } from './baseAction';
|
|
2
|
+
import { CommandType } from '../command';
|
|
3
|
+
import { iHandleSensor } from '../../server';
|
|
4
|
+
export declare class HandleChangeAction extends BaseAction {
|
|
5
|
+
/** @inheritDoc */
|
|
6
|
+
type: CommandType;
|
|
7
|
+
/**
|
|
8
|
+
* The window-handle that triggered the action
|
|
9
|
+
*/
|
|
10
|
+
readonly handle: iHandleSensor;
|
|
11
|
+
constructor(handle: iHandleSensor);
|
|
12
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HandleChangeAction = void 0;
|
|
4
|
+
const baseAction_1 = require("./baseAction");
|
|
5
|
+
const command_1 = require("../command");
|
|
6
|
+
const server_1 = require("../../server");
|
|
7
|
+
class HandleChangeAction extends baseAction_1.BaseAction {
|
|
8
|
+
constructor(handle) {
|
|
9
|
+
super(undefined, `${handle.customName} ${handle.position === server_1.WindowPosition.closed ? 'opened' : 'closed'}`);
|
|
10
|
+
/** @inheritDoc */
|
|
11
|
+
this.type = command_1.CommandType.HandleChangedAction;
|
|
12
|
+
this.handle = handle;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.HandleChangeAction = HandleChangeAction;
|
|
@@ -8,3 +8,4 @@ export * from './temperatureSensorChangeAction';
|
|
|
8
8
|
export { ActuatorChangeAction } from './actuatorChangeAction';
|
|
9
9
|
export { BatteryLevelChangeAction } from './batteryLevelChangeAction';
|
|
10
10
|
export { PresenceGroupAnyMovementAction } from './presenceGroupAnyMovementAction';
|
|
11
|
+
export { HandleChangeAction } from './handleChangeAction';
|
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.PresenceGroupAnyMovementAction = exports.BatteryLevelChangeAction = exports.ActuatorChangeAction = exports.BaseAction = void 0;
|
|
17
|
+
exports.HandleChangeAction = exports.PresenceGroupAnyMovementAction = exports.BatteryLevelChangeAction = exports.ActuatorChangeAction = exports.BaseAction = void 0;
|
|
18
18
|
var baseAction_1 = require("./baseAction");
|
|
19
19
|
Object.defineProperty(exports, "BaseAction", { enumerable: true, get: function () { return baseAction_1.BaseAction; } });
|
|
20
20
|
__exportStar(require("./humiditySensorChangeAction"), exports);
|
|
@@ -29,3 +29,5 @@ var batteryLevelChangeAction_1 = require("./batteryLevelChangeAction");
|
|
|
29
29
|
Object.defineProperty(exports, "BatteryLevelChangeAction", { enumerable: true, get: function () { return batteryLevelChangeAction_1.BatteryLevelChangeAction; } });
|
|
30
30
|
var presenceGroupAnyMovementAction_1 = require("./presenceGroupAnyMovementAction");
|
|
31
31
|
Object.defineProperty(exports, "PresenceGroupAnyMovementAction", { enumerable: true, get: function () { return presenceGroupAnyMovementAction_1.PresenceGroupAnyMovementAction; } });
|
|
32
|
+
var handleChangeAction_1 = require("./handleChangeAction");
|
|
33
|
+
Object.defineProperty(exports, "HandleChangeAction", { enumerable: true, get: function () { return handleChangeAction_1.HandleChangeAction; } });
|
|
@@ -28,6 +28,7 @@ export declare enum CommandType {
|
|
|
28
28
|
ShutterSunriseUpCommand = "ShutterSunriseUpCommand",
|
|
29
29
|
SunsetDownCommand = "SunsetDownCommand",
|
|
30
30
|
TemperatureSensorChangeAction = "TemperatureSensorChangeAction",
|
|
31
|
+
HandleChangedAction = "HandleChangedAction",
|
|
31
32
|
WindowRestoreDesiredPositionCommand = "WindowRestoreDesiredPositionCommand",
|
|
32
33
|
WindowSetDesiredPositionCommand = "WindowSetDesiredPositionCommand",
|
|
33
34
|
WindowSetRolloByWeatherStatusCommand = "WindowSetRolloByWeatherStatusCommand",
|
|
@@ -32,6 +32,7 @@ var CommandType;
|
|
|
32
32
|
CommandType["ShutterSunriseUpCommand"] = "ShutterSunriseUpCommand";
|
|
33
33
|
CommandType["SunsetDownCommand"] = "SunsetDownCommand";
|
|
34
34
|
CommandType["TemperatureSensorChangeAction"] = "TemperatureSensorChangeAction";
|
|
35
|
+
CommandType["HandleChangedAction"] = "HandleChangedAction";
|
|
35
36
|
CommandType["WindowRestoreDesiredPositionCommand"] = "WindowRestoreDesiredPositionCommand";
|
|
36
37
|
CommandType["WindowSetDesiredPositionCommand"] = "WindowSetDesiredPositionCommand";
|
|
37
38
|
CommandType["WindowSetRolloByWeatherStatusCommand"] = "WindowSetRolloByWeatherStatusCommand";
|
|
@@ -2,6 +2,7 @@ import { WindowPosition } from '../models';
|
|
|
2
2
|
import { iRoomDevice } from './iRoomDevice';
|
|
3
3
|
import { HandleSensor } from '../sharedFunctions';
|
|
4
4
|
import { Window } from '../groups';
|
|
5
|
+
import { HandleChangeAction } from '../../../models';
|
|
5
6
|
/**
|
|
6
7
|
* Interface for Handle Sensors.
|
|
7
8
|
* A handle sensor can be any device that is capable of detecting the position of a window handle e.g. a sensor, a window handle, etc.
|
|
@@ -40,4 +41,9 @@ export interface iHandleSensor extends iRoomDevice {
|
|
|
40
41
|
* @param pCallback - The callback to fire
|
|
41
42
|
*/
|
|
42
43
|
addClosedCallback(pCallback: (pValue: boolean) => void): void;
|
|
44
|
+
/**
|
|
45
|
+
* Add a callback that is called when the handle is changed to any position
|
|
46
|
+
* @param cb - The callback to fire
|
|
47
|
+
*/
|
|
48
|
+
addHandleChangeCallback(cb: (handleChangeAction: HandleChangeAction) => void): void;
|
|
43
49
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HeaterSettings } from '../../../models';
|
|
1
|
+
import { HandleChangeAction, HeaterSettings } from '../../../models';
|
|
2
2
|
import { iRoomDevice } from './iRoomDevice';
|
|
3
3
|
import { iDisposable } from '../../services';
|
|
4
4
|
import { iTemperatureSensor } from './iTemperatureSensor';
|
|
@@ -29,6 +29,10 @@ export interface iHeater extends iTemperatureSensor, iRoomDevice, iDisposable {
|
|
|
29
29
|
* Whether the heater is currently in a season turnoff state (no heating in summer)
|
|
30
30
|
*/
|
|
31
31
|
seasonTurnOff: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Whether any window in the room is open.
|
|
34
|
+
*/
|
|
35
|
+
readonly windowOpen: boolean;
|
|
32
36
|
/**
|
|
33
37
|
* Perform a check to calculate the new desired heater state
|
|
34
38
|
*/
|
|
@@ -37,4 +41,9 @@ export interface iHeater extends iTemperatureSensor, iRoomDevice, iDisposable {
|
|
|
37
41
|
* Persists the current heater information to the database
|
|
38
42
|
*/
|
|
39
43
|
persistHeater(): void;
|
|
44
|
+
/**
|
|
45
|
+
* Called when a window handle in the room changes its state
|
|
46
|
+
* @param action
|
|
47
|
+
*/
|
|
48
|
+
onHandleChange(action: HandleChangeAction): void;
|
|
40
49
|
}
|
|
@@ -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':
|
|
@@ -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;
|
|
@@ -5,6 +5,7 @@ import { DeviceType } from '../../deviceType';
|
|
|
5
5
|
import { IoBrokerDeviceInfo } from '../../IoBrokerDeviceInfo';
|
|
6
6
|
import { WindowPosition } from '../../models';
|
|
7
7
|
import { Window } from '../../groups';
|
|
8
|
+
import { HandleChangeAction } from '../../../../models';
|
|
8
9
|
import { HandleSettings } from '../../../../models/deviceSettings/handleSettings';
|
|
9
10
|
export declare class ZigbeeWindowHandle extends ZigbeeDevice implements iHandleSensor, iBatteryDevice {
|
|
10
11
|
/** @inheritDoc */
|
|
@@ -31,6 +32,8 @@ export declare class ZigbeeWindowHandle extends ZigbeeDevice implements iHandleS
|
|
|
31
32
|
/** @inheritDoc */
|
|
32
33
|
addClosedCallback(pCallback: (pValue: boolean) => void): void;
|
|
33
34
|
/** @inheritDoc */
|
|
35
|
+
addHandleChangeCallback(cb: (handleChangeAction: HandleChangeAction) => void): void;
|
|
36
|
+
/** @inheritDoc */
|
|
34
37
|
update(idSplit: string[], state: ioBroker.State, initial?: boolean, pOverride?: boolean): void;
|
|
35
38
|
private toWindowPosition;
|
|
36
39
|
}
|
|
@@ -52,6 +52,10 @@ class ZigbeeWindowHandle extends index_1.ZigbeeDevice {
|
|
|
52
52
|
this.handleSensor.addClosedCallback(pCallback);
|
|
53
53
|
}
|
|
54
54
|
/** @inheritDoc */
|
|
55
|
+
addHandleChangeCallback(cb) {
|
|
56
|
+
this.handleSensor.addHandleChangeCallback(cb);
|
|
57
|
+
}
|
|
58
|
+
/** @inheritDoc */
|
|
55
59
|
update(idSplit, state, initial = false, pOverride = false) {
|
|
56
60
|
super.update(idSplit, state, initial, pOverride);
|
|
57
61
|
switch (idSplit[3]) {
|