hoffmation-base 3.0.0-beta.0 → 3.0.0-beta.10
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/dachsSettings.d.ts +8 -0
- package/lib/models/deviceSettings/dachsSettings.js +12 -1
- package/lib/models/deviceSettings/heaterSettings.d.ts +4 -0
- package/lib/models/deviceSettings/heaterSettings.js +14 -8
- package/lib/server/devices/baseDeviceInterfaces/iHandleSensor.d.ts +6 -0
- package/lib/server/devices/baseDeviceInterfaces/iHeater.d.ts +12 -15
- package/lib/server/devices/baseDeviceInterfaces/index.d.ts +1 -0
- package/lib/server/devices/baseDeviceInterfaces/index.js +1 -0
- package/lib/server/devices/dachs/dachs.d.ts +3 -1
- package/lib/server/devices/dachs/dachs.js +19 -5
- package/lib/server/devices/dachs/lib/dachsHttpClient.js +4 -0
- package/lib/server/devices/device-cluster.js +6 -0
- package/lib/server/devices/deviceType.d.ts +1 -0
- package/lib/server/devices/deviceType.js +1 -0
- package/lib/server/devices/devices.js +3 -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 +22 -5
- 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/sharedFunctions/temperatureSensor.d.ts +6 -0
- package/lib/server/devices/sharedFunctions/temperatureSensor.js +12 -2
- package/lib/server/devices/shelly/shellyTrv.d.ts +16 -5
- package/lib/server/devices/shelly/shellyTrv.js +40 -6
- package/lib/server/devices/zigbee/BaseDevices/zigbeeHeater.d.ts +15 -5
- package/lib/server/devices/zigbee/BaseDevices/zigbeeHeater.js +45 -14
- package/lib/server/devices/zigbee/BaseDevices/zigbeeWindowHandle.d.ts +3 -0
- package/lib/server/devices/zigbee/BaseDevices/zigbeeWindowHandle.js +4 -0
- package/lib/server/devices/zigbee/index.d.ts +1 -0
- package/lib/server/devices/zigbee/index.js +3 -0
- package/lib/server/devices/zigbee/zigbeeEuroHeater.d.ts +1 -1
- package/lib/server/devices/zigbee/zigbeeEuroHeater.js +5 -5
- package/lib/server/devices/zigbee/zigbeeSodaHandle.d.ts +4 -0
- package/lib/server/devices/zigbee/zigbeeSodaHandle.js +7 -2
- package/lib/server/devices/zigbee/zigbeeTuyaMotion.d.ts +7 -0
- package/lib/server/devices/zigbee/zigbeeTuyaMotion.js +18 -0
- package/lib/server/devices/zigbee/zigbeeTuyaValve.d.ts +2 -1
- package/lib/server/devices/zigbee/zigbeeTuyaValve.js +7 -4
- package/lib/server/services/Sonos/mp3-server.js +6 -0
- package/lib/server/services/Telegram/telegram-service.js +9 -0
- package/lib/server/services/dbo/postgreSqlPersist.js +90 -66
- package/lib/server/services/https-service.js +3 -0
- package/lib/server/services/weather/weather-service.js +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -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);
|
|
@@ -8,6 +8,12 @@ export declare class TemperatureSensor implements iJsonOmitKeys {
|
|
|
8
8
|
* The current room temperature as a number in Celsius
|
|
9
9
|
*/
|
|
10
10
|
roomTemperature: number;
|
|
11
|
+
/**
|
|
12
|
+
* Temperature correction coefficient to mitigate outdoor temperature, e.g. if this is closely placed to a window.
|
|
13
|
+
* @remarks Default: 0 and difference to 21°C
|
|
14
|
+
* @example With outdoor temp of 10°C and a coefficient of 0.5, the temperature correction will be +5.5°C
|
|
15
|
+
*/
|
|
16
|
+
outdoorTemperatureCorrectionCoefficient: number;
|
|
11
17
|
/**
|
|
12
18
|
* The interval to persist the temperature sensor information
|
|
13
19
|
*/
|
|
@@ -13,6 +13,12 @@ class TemperatureSensor {
|
|
|
13
13
|
* The current room temperature as a number in Celsius
|
|
14
14
|
*/
|
|
15
15
|
this.roomTemperature = baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE;
|
|
16
|
+
/**
|
|
17
|
+
* Temperature correction coefficient to mitigate outdoor temperature, e.g. if this is closely placed to a window.
|
|
18
|
+
* @remarks Default: 0 and difference to 21°C
|
|
19
|
+
* @example With outdoor temp of 10°C and a coefficient of 0.5, the temperature correction will be +5.5°C
|
|
20
|
+
*/
|
|
21
|
+
this.outdoorTemperatureCorrectionCoefficient = 0;
|
|
16
22
|
/**
|
|
17
23
|
* The interval to persist the temperature sensor information
|
|
18
24
|
*/
|
|
@@ -23,9 +29,13 @@ class TemperatureSensor {
|
|
|
23
29
|
this._temperaturCallbacks = [];
|
|
24
30
|
}
|
|
25
31
|
set temperature(val) {
|
|
26
|
-
|
|
32
|
+
let correctedValue = val;
|
|
33
|
+
if (this.outdoorTemperatureCorrectionCoefficient !== 0 && services_1.WeatherService.currentTemp !== baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE) {
|
|
34
|
+
correctedValue = val + this.outdoorTemperatureCorrectionCoefficient * (21 - services_1.WeatherService.currentTemp);
|
|
35
|
+
}
|
|
36
|
+
this._temperature = correctedValue;
|
|
27
37
|
for (const cb of this._temperaturCallbacks) {
|
|
28
|
-
cb(new models_1.TemperatureSensorChangeAction(this._device,
|
|
38
|
+
cb(new models_1.TemperatureSensorChangeAction(this._device, correctedValue));
|
|
29
39
|
}
|
|
30
40
|
}
|
|
31
41
|
get temperature() {
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { ShellyDevice } from './shellyDevice';
|
|
2
|
-
import { iBatteryDevice, iHeater } from '../baseDeviceInterfaces';
|
|
3
|
-
import { HeaterSettings } from '../../../models';
|
|
2
|
+
import { iBatteryDevice, iHeater, iTemperatureSensor } from '../baseDeviceInterfaces';
|
|
3
|
+
import { HandleChangeAction, HeaterSettings, TemperatureSensorChangeAction } from '../../../models';
|
|
4
4
|
import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
|
|
5
|
-
import { Battery } from '../sharedFunctions';
|
|
6
|
-
export declare class ShellyTrv extends ShellyDevice implements iHeater, iBatteryDevice {
|
|
5
|
+
import { Battery, TemperatureSensor } from '../sharedFunctions';
|
|
6
|
+
export declare class ShellyTrv extends ShellyDevice implements iHeater, iTemperatureSensor, iBatteryDevice {
|
|
7
7
|
/** @inheritDoc */
|
|
8
8
|
readonly battery: Battery;
|
|
9
9
|
/** @inheritDoc */
|
|
10
10
|
settings: HeaterSettings;
|
|
11
11
|
/** @inheritDoc */
|
|
12
|
+
temperatureSensor: TemperatureSensor;
|
|
13
|
+
/** @inheritDoc */
|
|
12
14
|
readonly persistHeaterInterval: NodeJS.Timeout;
|
|
13
15
|
protected _seasonTurnOff: boolean;
|
|
14
16
|
protected _roomTemperature: number;
|
|
@@ -19,7 +21,6 @@ export declare class ShellyTrv extends ShellyDevice implements iHeater, iBattery
|
|
|
19
21
|
private _level;
|
|
20
22
|
private _minimumValveLevel;
|
|
21
23
|
private _recalcTimeout;
|
|
22
|
-
private _temperatur;
|
|
23
24
|
private _targetTempVal;
|
|
24
25
|
private _desiredTemperatur;
|
|
25
26
|
private _useExternalTemperatureEnabled;
|
|
@@ -29,7 +30,9 @@ export declare class ShellyTrv extends ShellyDevice implements iHeater, iBattery
|
|
|
29
30
|
private readonly _setExternalTempId;
|
|
30
31
|
private readonly _setEnableExternalTempId;
|
|
31
32
|
private readonly _setPointTemperaturID;
|
|
33
|
+
private readonly _setWindowOpenID;
|
|
32
34
|
private readonly _valvePosId;
|
|
35
|
+
private _windowOpen;
|
|
33
36
|
constructor(pInfo: IoBrokerDeviceInfo);
|
|
34
37
|
/** @inheritDoc */
|
|
35
38
|
get batteryLevel(): number;
|
|
@@ -47,9 +50,15 @@ export declare class ShellyTrv extends ShellyDevice implements iHeater, iBattery
|
|
|
47
50
|
/** @inheritDoc */
|
|
48
51
|
get iTemperature(): number;
|
|
49
52
|
/** @inheritDoc */
|
|
53
|
+
get sTemperature(): string;
|
|
54
|
+
/** @inheritDoc */
|
|
50
55
|
get roomTemperature(): number;
|
|
56
|
+
/** @inheritDoc */
|
|
57
|
+
get windowOpen(): boolean;
|
|
51
58
|
private set roomTemperatur(value);
|
|
52
59
|
/** @inheritDoc */
|
|
60
|
+
addTempChangeCallback(pCallback: (action: TemperatureSensorChangeAction) => void): void;
|
|
61
|
+
/** @inheritDoc */
|
|
53
62
|
checkAutomaticChange(): void;
|
|
54
63
|
/** @inheritDoc */
|
|
55
64
|
onTemperaturChange(newTemperatur: number): void;
|
|
@@ -61,6 +70,8 @@ export declare class ShellyTrv extends ShellyDevice implements iHeater, iBattery
|
|
|
61
70
|
dispose(): void;
|
|
62
71
|
protected getNextPidLevel(): number;
|
|
63
72
|
private checkSeasonTurnOff;
|
|
73
|
+
onHandleChange(_action: HandleChangeAction): void;
|
|
74
|
+
private onWindowOpenChange;
|
|
64
75
|
private recalcLevel;
|
|
65
76
|
private setMode;
|
|
66
77
|
private setExternalTemperature;
|
|
@@ -17,6 +17,8 @@ class ShellyTrv extends shellyDevice_1.ShellyDevice {
|
|
|
17
17
|
/** @inheritDoc */
|
|
18
18
|
this.settings = new models_1.HeaterSettings();
|
|
19
19
|
/** @inheritDoc */
|
|
20
|
+
this.temperatureSensor = new sharedFunctions_1.TemperatureSensor(this);
|
|
21
|
+
/** @inheritDoc */
|
|
20
22
|
this.persistHeaterInterval = services_1.Utils.guardedInterval(() => {
|
|
21
23
|
this.persistHeater();
|
|
22
24
|
}, 5 * 60 * 1000, this, false);
|
|
@@ -28,7 +30,6 @@ class ShellyTrv extends shellyDevice_1.ShellyDevice {
|
|
|
28
30
|
this._level = 0;
|
|
29
31
|
this._minimumValveLevel = 0;
|
|
30
32
|
this._recalcTimeout = null;
|
|
31
|
-
this._temperatur = baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE;
|
|
32
33
|
this._targetTempVal = baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE;
|
|
33
34
|
this._desiredTemperatur = baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE;
|
|
34
35
|
this._useExternalTemperatureEnabled = false;
|
|
@@ -42,12 +43,15 @@ class ShellyTrv extends shellyDevice_1.ShellyDevice {
|
|
|
42
43
|
Ki: 1000, // PID: Ki in 1/1000
|
|
43
44
|
Kd: 9, // PID: Kd in 1/1000
|
|
44
45
|
});
|
|
46
|
+
this._windowOpen = false;
|
|
45
47
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.heater);
|
|
48
|
+
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.temperatureSensor);
|
|
46
49
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.batteryDriven);
|
|
47
50
|
this._setAutomaticModeId = `${this.info.fullID}.tmp.automaticTemperatureControl`;
|
|
48
51
|
this._setExternalTempId = `${this.info.fullID}.ext.temperature`;
|
|
49
52
|
this._setEnableExternalTempId = `${this.info.fullID}.ext.enabled`;
|
|
50
53
|
this._setPointTemperaturID = `${this.info.fullID}.tmp.temperatureTargetC`;
|
|
54
|
+
this._setWindowOpenID = `${this.info.fullID}.ext.openWindow`;
|
|
51
55
|
this._minumumLevelId = `${this.info.fullID}.tmp.minimumValvePosition`;
|
|
52
56
|
this._valvePosId = `${this.info.fullID}.tmp.valvePosition`;
|
|
53
57
|
this._iAutomaticInterval = services_1.Utils.guardedInterval(this.checkAutomaticChange, 300000, this); // Alle 5 Minuten prüfen
|
|
@@ -98,19 +102,27 @@ class ShellyTrv extends shellyDevice_1.ShellyDevice {
|
|
|
98
102
|
}
|
|
99
103
|
/** @inheritDoc */
|
|
100
104
|
get iTemperature() {
|
|
101
|
-
if (this.settings.
|
|
102
|
-
return this.
|
|
105
|
+
if (this.settings.useOwnTemperatureForRoomTemperature) {
|
|
106
|
+
return this.temperatureSensor.temperature;
|
|
103
107
|
}
|
|
104
108
|
else {
|
|
105
109
|
return this._roomTemperature;
|
|
106
110
|
}
|
|
107
111
|
}
|
|
108
112
|
/** @inheritDoc */
|
|
113
|
+
get sTemperature() {
|
|
114
|
+
return `${this.iTemperature}°C`;
|
|
115
|
+
}
|
|
116
|
+
/** @inheritDoc */
|
|
109
117
|
get roomTemperature() {
|
|
110
|
-
return this.
|
|
118
|
+
return this.temperatureSensor.roomTemperature;
|
|
119
|
+
}
|
|
120
|
+
/** @inheritDoc */
|
|
121
|
+
get windowOpen() {
|
|
122
|
+
return this._windowOpen;
|
|
111
123
|
}
|
|
112
124
|
set roomTemperatur(val) {
|
|
113
|
-
this.
|
|
125
|
+
this.temperatureSensor.roomTemperature = val;
|
|
114
126
|
if (this.settings.useOwnTemperatur) {
|
|
115
127
|
return;
|
|
116
128
|
}
|
|
@@ -120,6 +132,10 @@ class ShellyTrv extends shellyDevice_1.ShellyDevice {
|
|
|
120
132
|
}
|
|
121
133
|
}
|
|
122
134
|
/** @inheritDoc */
|
|
135
|
+
addTempChangeCallback(pCallback) {
|
|
136
|
+
this.temperatureSensor.addTempChangeCallback(pCallback);
|
|
137
|
+
}
|
|
138
|
+
/** @inheritDoc */
|
|
123
139
|
checkAutomaticChange() {
|
|
124
140
|
var _a;
|
|
125
141
|
if (!this._initialSeasonCheckDone) {
|
|
@@ -177,7 +193,7 @@ class ShellyTrv extends shellyDevice_1.ShellyDevice {
|
|
|
177
193
|
this._minimumValveLevel = state.val;
|
|
178
194
|
}
|
|
179
195
|
else if (idSplit[3] === 'tmp' && idSplit[4] === 'temperatureC') {
|
|
180
|
-
this.
|
|
196
|
+
this.temperatureSensor.temperature = state.val;
|
|
181
197
|
}
|
|
182
198
|
else if (idSplit[3] === 'tmp' && idSplit[4] === 'automaticTemperatureControl') {
|
|
183
199
|
this._automaticMode = state.val;
|
|
@@ -225,6 +241,24 @@ class ShellyTrv extends shellyDevice_1.ShellyDevice {
|
|
|
225
241
|
}
|
|
226
242
|
this._initialSeasonCheckDone = true;
|
|
227
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
|
+
}
|
|
228
262
|
recalcLevel() {
|
|
229
263
|
if (this.settings.useOwnTemperatur || this.seasonTurnOff || !this.settings.controlByPid) {
|
|
230
264
|
return;
|
|
@@ -1,31 +1,36 @@
|
|
|
1
1
|
import { ZigbeeDevice } from './zigbeeDevice';
|
|
2
2
|
import { iBatteryDevice, iHeater } from '../../baseDeviceInterfaces';
|
|
3
|
-
import { HeaterSettings } 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';
|
|
7
|
-
import { Battery } from '../../sharedFunctions';
|
|
7
|
+
import { Battery, TemperatureSensor } from '../../sharedFunctions';
|
|
8
8
|
export declare class ZigbeeHeater extends ZigbeeDevice implements iHeater, iBatteryDevice {
|
|
9
9
|
/** @inheritDoc */
|
|
10
10
|
readonly battery: Battery;
|
|
11
11
|
/** @inheritDoc */
|
|
12
12
|
readonly persistHeaterInterval: NodeJS.Timeout;
|
|
13
13
|
/** @inheritDoc */
|
|
14
|
+
temperatureSensor: TemperatureSensor;
|
|
15
|
+
/** @inheritDoc */
|
|
14
16
|
settings: HeaterSettings;
|
|
15
17
|
protected _battery: number;
|
|
16
18
|
protected _iAutomaticInterval: NodeJS.Timeout | undefined;
|
|
17
19
|
protected _initialSeasonCheckDone: boolean;
|
|
18
20
|
protected _level: number;
|
|
19
21
|
protected _setPointTemperaturID: string;
|
|
22
|
+
protected _setWindowOpenID: string;
|
|
20
23
|
protected _temperatur: number;
|
|
21
24
|
protected _desiredTemperatur: number;
|
|
22
25
|
protected _pidController: PIDController;
|
|
23
26
|
protected _seasonTurnOff: boolean;
|
|
24
|
-
protected
|
|
27
|
+
protected _windowOpen: boolean;
|
|
25
28
|
constructor(pInfo: IoBrokerDeviceInfo, pType: DeviceType);
|
|
26
29
|
/** @inheritDoc */
|
|
27
30
|
get batteryLevel(): number;
|
|
28
31
|
/** @inheritDoc */
|
|
32
|
+
get windowOpen(): boolean;
|
|
33
|
+
/** @inheritDoc */
|
|
29
34
|
get seasonTurnOff(): boolean;
|
|
30
35
|
/** @inheritDoc */
|
|
31
36
|
set seasonTurnOff(value: boolean);
|
|
@@ -36,14 +41,18 @@ export declare class ZigbeeHeater extends ZigbeeDevice implements iHeater, iBatt
|
|
|
36
41
|
get sLevel(): string;
|
|
37
42
|
/** @inheritDoc */
|
|
38
43
|
get iLevel(): number;
|
|
39
|
-
get sTemperatur(): string;
|
|
40
44
|
/** @inheritDoc */
|
|
41
45
|
get iTemperature(): number;
|
|
42
46
|
/** @inheritDoc */
|
|
47
|
+
get sTemperature(): string;
|
|
48
|
+
/** @inheritDoc */
|
|
43
49
|
get roomTemperature(): number;
|
|
44
|
-
protected set
|
|
50
|
+
protected set roomTemperature(val: number);
|
|
51
|
+
/** @inheritDoc */
|
|
52
|
+
addTempChangeCallback(pCallback: (action: TemperatureSensorChangeAction) => void): void;
|
|
45
53
|
/** @inheritDoc */
|
|
46
54
|
checkAutomaticChange(): void;
|
|
55
|
+
onHandleChange(_action: HandleChangeAction): void;
|
|
47
56
|
/** @inheritDoc */
|
|
48
57
|
onTemperaturChange(newTemperatur: number): void;
|
|
49
58
|
persistHeater(): void;
|
|
@@ -53,4 +62,5 @@ export declare class ZigbeeHeater extends ZigbeeDevice implements iHeater, iBatt
|
|
|
53
62
|
dispose(): void;
|
|
54
63
|
protected getNextPidLevel(): number;
|
|
55
64
|
private checkSeasonTurnOff;
|
|
65
|
+
private onWindowOpenChange;
|
|
56
66
|
}
|
|
@@ -18,11 +18,14 @@ class ZigbeeHeater extends zigbeeDevice_1.ZigbeeDevice {
|
|
|
18
18
|
this.persistHeater();
|
|
19
19
|
}, 5 * 60 * 1000, this, false);
|
|
20
20
|
/** @inheritDoc */
|
|
21
|
+
this.temperatureSensor = new sharedFunctions_1.TemperatureSensor(this);
|
|
22
|
+
/** @inheritDoc */
|
|
21
23
|
this.settings = new models_1.HeaterSettings();
|
|
22
24
|
this._battery = -99;
|
|
23
25
|
this._initialSeasonCheckDone = false;
|
|
24
26
|
this._level = 0;
|
|
25
27
|
this._setPointTemperaturID = '';
|
|
28
|
+
this._setWindowOpenID = '';
|
|
26
29
|
this._temperatur = baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE;
|
|
27
30
|
this._desiredTemperatur = baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE;
|
|
28
31
|
this._pidController = new liquid_pid_1.PIDController({
|
|
@@ -36,8 +39,9 @@ class ZigbeeHeater extends zigbeeDevice_1.ZigbeeDevice {
|
|
|
36
39
|
Kd: 9, // PID: Kd in 1/1000
|
|
37
40
|
});
|
|
38
41
|
this._seasonTurnOff = false;
|
|
39
|
-
this.
|
|
42
|
+
this._windowOpen = false;
|
|
40
43
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.heater);
|
|
44
|
+
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.temperatureSensor);
|
|
41
45
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.batteryDriven);
|
|
42
46
|
this._iAutomaticInterval = services_1.Utils.guardedInterval(this.checkAutomaticChange, 300000, this); // Alle 5 Minuten prüfen
|
|
43
47
|
services_1.TimeCallbackService.addCallback(new models_1.TimeCallback(`${this.info.fullID} Season Check`, models_1.TimeCallbackType.TimeOfDay, () => {
|
|
@@ -49,6 +53,10 @@ class ZigbeeHeater extends zigbeeDevice_1.ZigbeeDevice {
|
|
|
49
53
|
return this.battery.level;
|
|
50
54
|
}
|
|
51
55
|
/** @inheritDoc */
|
|
56
|
+
get windowOpen() {
|
|
57
|
+
return this._windowOpen;
|
|
58
|
+
}
|
|
59
|
+
/** @inheritDoc */
|
|
52
60
|
get seasonTurnOff() {
|
|
53
61
|
return this._seasonTurnOff;
|
|
54
62
|
}
|
|
@@ -76,24 +84,29 @@ class ZigbeeHeater extends zigbeeDevice_1.ZigbeeDevice {
|
|
|
76
84
|
get iLevel() {
|
|
77
85
|
return this._level;
|
|
78
86
|
}
|
|
79
|
-
get sTemperatur() {
|
|
80
|
-
return `${this.iTemperature}°C`;
|
|
81
|
-
}
|
|
82
87
|
/** @inheritDoc */
|
|
83
88
|
get iTemperature() {
|
|
84
|
-
if (this.settings.
|
|
85
|
-
return this.
|
|
89
|
+
if (this.settings.useOwnTemperatureForRoomTemperature) {
|
|
90
|
+
return this.temperatureSensor.temperature;
|
|
86
91
|
}
|
|
87
92
|
else {
|
|
88
|
-
return this.
|
|
93
|
+
return this.roomTemperature;
|
|
89
94
|
}
|
|
90
95
|
}
|
|
91
96
|
/** @inheritDoc */
|
|
97
|
+
get sTemperature() {
|
|
98
|
+
return `${this.iTemperature}°C`;
|
|
99
|
+
}
|
|
100
|
+
/** @inheritDoc */
|
|
92
101
|
get roomTemperature() {
|
|
93
|
-
return this.
|
|
102
|
+
return this.temperatureSensor.roomTemperature;
|
|
94
103
|
}
|
|
95
|
-
set
|
|
96
|
-
this.
|
|
104
|
+
set roomTemperature(val) {
|
|
105
|
+
this.temperatureSensor.roomTemperature = val;
|
|
106
|
+
}
|
|
107
|
+
/** @inheritDoc */
|
|
108
|
+
addTempChangeCallback(pCallback) {
|
|
109
|
+
this.temperatureSensor.addTempChangeCallback(pCallback);
|
|
97
110
|
}
|
|
98
111
|
/** @inheritDoc */
|
|
99
112
|
checkAutomaticChange() {
|
|
@@ -119,9 +132,21 @@ class ZigbeeHeater extends zigbeeDevice_1.ZigbeeDevice {
|
|
|
119
132
|
this.desiredTemperature = targetTemperature;
|
|
120
133
|
}
|
|
121
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
|
+
}
|
|
122
147
|
/** @inheritDoc */
|
|
123
148
|
onTemperaturChange(newTemperatur) {
|
|
124
|
-
this.
|
|
149
|
+
this.roomTemperature = newTemperatur;
|
|
125
150
|
}
|
|
126
151
|
persistHeater() {
|
|
127
152
|
var _a;
|
|
@@ -151,12 +176,12 @@ class ZigbeeHeater extends zigbeeDevice_1.ZigbeeDevice {
|
|
|
151
176
|
super.dispose();
|
|
152
177
|
}
|
|
153
178
|
getNextPidLevel() {
|
|
154
|
-
if (this.seasonTurnOff || this.
|
|
179
|
+
if (this.seasonTurnOff || this.roomTemperature < 0) {
|
|
155
180
|
return 0;
|
|
156
181
|
}
|
|
157
182
|
this._pidController.setPoint(this.desiredTemperature);
|
|
158
|
-
const newValue = this._pidController.calculate(this.
|
|
159
|
-
this.log(models_1.LogLevel.Debug, `New PID Value ${newValue}% (cTemp: ${this.
|
|
183
|
+
const newValue = this._pidController.calculate(this.roomTemperature);
|
|
184
|
+
this.log(models_1.LogLevel.Debug, `New PID Value ${newValue}% (cTemp: ${this.roomTemperature}, dTemp: ${this.desiredTemperature})`);
|
|
160
185
|
return newValue;
|
|
161
186
|
}
|
|
162
187
|
checkSeasonTurnOff() {
|
|
@@ -167,5 +192,11 @@ class ZigbeeHeater extends zigbeeDevice_1.ZigbeeDevice {
|
|
|
167
192
|
}
|
|
168
193
|
this._initialSeasonCheckDone = true;
|
|
169
194
|
}
|
|
195
|
+
onWindowOpenChange(pValue) {
|
|
196
|
+
if (!this._setWindowOpenID) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
this.setState(this._setWindowOpenID, pValue);
|
|
200
|
+
}
|
|
170
201
|
}
|
|
171
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]) {
|