hoffmation-base 3.0.0-beta.0 → 3.0.0-beta.2
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/deviceSettings/heaterSettings.d.ts +4 -0
- package/lib/models/deviceSettings/heaterSettings.js +14 -8
- package/lib/server/devices/baseDeviceInterfaces/iHeater.d.ts +2 -14
- package/lib/server/devices/groups/heatGroup.js +16 -5
- package/lib/server/devices/shelly/shellyTrv.d.ts +10 -5
- package/lib/server/devices/shelly/shellyTrv.js +15 -6
- package/lib/server/devices/zigbee/BaseDevices/zigbeeHeater.d.ts +9 -5
- package/lib/server/devices/zigbee/BaseDevices/zigbeeHeater.js +20 -14
- package/lib/server/devices/zigbee/zigbeeEuroHeater.d.ts +1 -1
- package/lib/server/devices/zigbee/zigbeeEuroHeater.js +5 -5
- package/lib/server/devices/zigbee/zigbeeTuyaValve.d.ts +2 -1
- package/lib/server/devices/zigbee/zigbeeTuyaValve.js +7 -4
- package/lib/server/services/dbo/postgreSqlPersist.js +8 -2
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -10,6 +10,10 @@ export declare class HeaterSettings extends DeviceSettings {
|
|
|
10
10
|
* @default true
|
|
11
11
|
*/
|
|
12
12
|
useOwnTemperatur: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Whether this devices temperature measurement should be included in the room temperature calculation.
|
|
15
|
+
*/
|
|
16
|
+
useOwnTemperatureForRoomTemperature: boolean;
|
|
13
17
|
/**
|
|
14
18
|
* Whether this device should be controlled using only valve position
|
|
15
19
|
* @default false
|
|
@@ -16,6 +16,10 @@ class HeaterSettings extends deviceSettings_1.DeviceSettings {
|
|
|
16
16
|
* @default true
|
|
17
17
|
*/
|
|
18
18
|
this.useOwnTemperatur = true;
|
|
19
|
+
/**
|
|
20
|
+
* Whether this devices temperature measurement should be included in the room temperature calculation.
|
|
21
|
+
*/
|
|
22
|
+
this.useOwnTemperatureForRoomTemperature = true;
|
|
19
23
|
/**
|
|
20
24
|
* Whether this device should be controlled using only valve position
|
|
21
25
|
* @default false
|
|
@@ -55,16 +59,18 @@ class HeaterSettings extends deviceSettings_1.DeviceSettings {
|
|
|
55
59
|
this.manualDisabled = false;
|
|
56
60
|
}
|
|
57
61
|
fromPartialObject(data) {
|
|
58
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
62
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
59
63
|
this.automaticMode = (_a = data.automaticMode) !== null && _a !== void 0 ? _a : this.automaticMode;
|
|
60
64
|
this.useOwnTemperatur = (_b = data.useOwnTemperatur) !== null && _b !== void 0 ? _b : this.useOwnTemperatur;
|
|
61
|
-
this.
|
|
62
|
-
|
|
63
|
-
this.
|
|
64
|
-
this.
|
|
65
|
-
this.
|
|
66
|
-
this.
|
|
67
|
-
this.
|
|
65
|
+
this.useOwnTemperatureForRoomTemperature =
|
|
66
|
+
(_c = data.useOwnTemperatureForRoomTemperature) !== null && _c !== void 0 ? _c : this.useOwnTemperatureForRoomTemperature;
|
|
67
|
+
this.controlByPid = (_d = data.controlByPid) !== null && _d !== void 0 ? _d : this.controlByPid;
|
|
68
|
+
this.controlByTempDiff = (_e = data.controlByTempDiff) !== null && _e !== void 0 ? _e : this.controlByTempDiff;
|
|
69
|
+
this.seasonalTurnOffActive = (_f = data.seasonalTurnOffActive) !== null && _f !== void 0 ? _f : this.seasonalTurnOffActive;
|
|
70
|
+
this.seasonTurnOffDay = (_g = data.seasonTurnOffDay) !== null && _g !== void 0 ? _g : this.seasonTurnOffDay;
|
|
71
|
+
this.seasonTurnOnDay = (_h = data.seasonTurnOnDay) !== null && _h !== void 0 ? _h : this.seasonTurnOnDay;
|
|
72
|
+
this.pidForcedMinimum = (_j = data.pidForcedMinimum) !== null && _j !== void 0 ? _j : this.pidForcedMinimum;
|
|
73
|
+
this.manualDisabled = (_k = data.manualDisabled) !== null && _k !== void 0 ? _k : this.manualDisabled;
|
|
68
74
|
super.fromPartialObject(data);
|
|
69
75
|
}
|
|
70
76
|
toJSON() {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { HeaterSettings } from '../../../models';
|
|
2
2
|
import { iRoomDevice } from './iRoomDevice';
|
|
3
3
|
import { iDisposable } from '../../services';
|
|
4
|
+
import { iTemperatureSensor } from './iTemperatureSensor';
|
|
4
5
|
/**
|
|
5
6
|
* This interface represents a heater device.
|
|
6
7
|
*
|
|
7
8
|
* For devices with {@link DeviceCapability.heater} capability.
|
|
8
9
|
*/
|
|
9
|
-
export interface iHeater extends iRoomDevice, iDisposable {
|
|
10
|
+
export interface iHeater extends iTemperatureSensor, iRoomDevice, iDisposable {
|
|
10
11
|
/**
|
|
11
12
|
* The settings of the heater
|
|
12
13
|
*/
|
|
@@ -19,14 +20,6 @@ export interface iHeater extends iRoomDevice, iDisposable {
|
|
|
19
20
|
* The current valve position of the heater (between 0 and 1.0)
|
|
20
21
|
*/
|
|
21
22
|
readonly iLevel: number;
|
|
22
|
-
/**
|
|
23
|
-
* The current temperature in degree Celsius of the heater
|
|
24
|
-
*/
|
|
25
|
-
readonly iTemperature: number;
|
|
26
|
-
/**
|
|
27
|
-
* The current room temperature in degree Celsius
|
|
28
|
-
*/
|
|
29
|
-
readonly roomTemperature: number;
|
|
30
23
|
/**
|
|
31
24
|
* The interval to persist the heater information
|
|
32
25
|
* This mainly enforces the interval to be implemented.
|
|
@@ -40,11 +33,6 @@ export interface iHeater extends iRoomDevice, iDisposable {
|
|
|
40
33
|
* Perform a check to calculate the new desired heater state
|
|
41
34
|
*/
|
|
42
35
|
checkAutomaticChange(): void;
|
|
43
|
-
/**
|
|
44
|
-
* Informs the heater that the temperature of the room has changed
|
|
45
|
-
* @param newTemperatur - The new temperature in degree Celsius.
|
|
46
|
-
*/
|
|
47
|
-
onTemperaturChange(newTemperatur: number): void;
|
|
48
36
|
/**
|
|
49
37
|
* Persists the current heater information to the database
|
|
50
38
|
*/
|
|
@@ -47,8 +47,13 @@ class HeatGroup extends base_group_1.BaseGroup {
|
|
|
47
47
|
get temperature() {
|
|
48
48
|
let temp = baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE;
|
|
49
49
|
let count = 0;
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
const usedIds = [];
|
|
51
|
+
this.getHeater().forEach((heaterAsSensor) => {
|
|
52
|
+
usedIds.push(heaterAsSensor.id);
|
|
53
|
+
if (!heaterAsSensor.settings.useOwnTemperatureForRoomTemperature) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const sensorValue = heaterAsSensor.iTemperature;
|
|
52
57
|
if (sensorValue === baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE) {
|
|
53
58
|
return;
|
|
54
59
|
}
|
|
@@ -59,11 +64,12 @@ class HeatGroup extends base_group_1.BaseGroup {
|
|
|
59
64
|
}
|
|
60
65
|
temp = (temp * count + sensorValue) / ++count;
|
|
61
66
|
});
|
|
62
|
-
this.
|
|
63
|
-
if (
|
|
67
|
+
this.getTempSensors().forEach((sensor) => {
|
|
68
|
+
if (usedIds.includes(sensor.id)) {
|
|
69
|
+
// Heater which correctly implement sensor as well.
|
|
64
70
|
return;
|
|
65
71
|
}
|
|
66
|
-
const sensorValue =
|
|
72
|
+
const sensorValue = sensor.iTemperature;
|
|
67
73
|
if (sensorValue === baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE) {
|
|
68
74
|
return;
|
|
69
75
|
}
|
|
@@ -155,10 +161,15 @@ class HeatGroup extends base_group_1.BaseGroup {
|
|
|
155
161
|
if (temp == baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE) {
|
|
156
162
|
return;
|
|
157
163
|
}
|
|
164
|
+
const usedIds = [];
|
|
158
165
|
this.getHeater().forEach((heater) => {
|
|
166
|
+
usedIds.push(heater.id);
|
|
159
167
|
heater.onTemperaturChange(temp);
|
|
160
168
|
});
|
|
161
169
|
this.getTempSensors().forEach((sensor) => {
|
|
170
|
+
if (usedIds.includes(sensor.id)) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
162
173
|
sensor.onTemperaturChange(temp);
|
|
163
174
|
});
|
|
164
175
|
this.getOwnAcDevices().forEach((ac) => {
|
|
@@ -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 { 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;
|
|
@@ -47,9 +48,13 @@ export declare class ShellyTrv extends ShellyDevice implements iHeater, iBattery
|
|
|
47
48
|
/** @inheritDoc */
|
|
48
49
|
get iTemperature(): number;
|
|
49
50
|
/** @inheritDoc */
|
|
51
|
+
get sTemperature(): string;
|
|
52
|
+
/** @inheritDoc */
|
|
50
53
|
get roomTemperature(): number;
|
|
51
54
|
private set roomTemperatur(value);
|
|
52
55
|
/** @inheritDoc */
|
|
56
|
+
addTempChangeCallback(pCallback: (action: TemperatureSensorChangeAction) => void): void;
|
|
57
|
+
/** @inheritDoc */
|
|
53
58
|
checkAutomaticChange(): void;
|
|
54
59
|
/** @inheritDoc */
|
|
55
60
|
onTemperaturChange(newTemperatur: number): void;
|
|
@@ -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;
|
|
@@ -98,19 +99,23 @@ class ShellyTrv extends shellyDevice_1.ShellyDevice {
|
|
|
98
99
|
}
|
|
99
100
|
/** @inheritDoc */
|
|
100
101
|
get iTemperature() {
|
|
101
|
-
if (this.settings.
|
|
102
|
-
return this.
|
|
102
|
+
if (this.settings.useOwnTemperatureForRoomTemperature) {
|
|
103
|
+
return this.temperatureSensor.temperature;
|
|
103
104
|
}
|
|
104
105
|
else {
|
|
105
106
|
return this._roomTemperature;
|
|
106
107
|
}
|
|
107
108
|
}
|
|
108
109
|
/** @inheritDoc */
|
|
110
|
+
get sTemperature() {
|
|
111
|
+
return `${this.iTemperature}°C`;
|
|
112
|
+
}
|
|
113
|
+
/** @inheritDoc */
|
|
109
114
|
get roomTemperature() {
|
|
110
|
-
return this.
|
|
115
|
+
return this.temperatureSensor.roomTemperature;
|
|
111
116
|
}
|
|
112
117
|
set roomTemperatur(val) {
|
|
113
|
-
this.
|
|
118
|
+
this.temperatureSensor.roomTemperature = val;
|
|
114
119
|
if (this.settings.useOwnTemperatur) {
|
|
115
120
|
return;
|
|
116
121
|
}
|
|
@@ -120,6 +125,10 @@ class ShellyTrv extends shellyDevice_1.ShellyDevice {
|
|
|
120
125
|
}
|
|
121
126
|
}
|
|
122
127
|
/** @inheritDoc */
|
|
128
|
+
addTempChangeCallback(pCallback) {
|
|
129
|
+
this.temperatureSensor.addTempChangeCallback(pCallback);
|
|
130
|
+
}
|
|
131
|
+
/** @inheritDoc */
|
|
123
132
|
checkAutomaticChange() {
|
|
124
133
|
var _a;
|
|
125
134
|
if (!this._initialSeasonCheckDone) {
|
|
@@ -177,7 +186,7 @@ class ShellyTrv extends shellyDevice_1.ShellyDevice {
|
|
|
177
186
|
this._minimumValveLevel = state.val;
|
|
178
187
|
}
|
|
179
188
|
else if (idSplit[3] === 'tmp' && idSplit[4] === 'temperatureC') {
|
|
180
|
-
this.
|
|
189
|
+
this.temperatureSensor.temperature = state.val;
|
|
181
190
|
}
|
|
182
191
|
else if (idSplit[3] === 'tmp' && idSplit[4] === 'automaticTemperatureControl') {
|
|
183
192
|
this._automaticMode = state.val;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { ZigbeeDevice } from './zigbeeDevice';
|
|
2
2
|
import { iBatteryDevice, iHeater } from '../../baseDeviceInterfaces';
|
|
3
|
-
import { HeaterSettings } from '../../../../models';
|
|
3
|
+
import { 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;
|
|
@@ -21,7 +23,6 @@ export declare class ZigbeeHeater extends ZigbeeDevice implements iHeater, iBatt
|
|
|
21
23
|
protected _desiredTemperatur: number;
|
|
22
24
|
protected _pidController: PIDController;
|
|
23
25
|
protected _seasonTurnOff: boolean;
|
|
24
|
-
protected _roomTemperature: number;
|
|
25
26
|
constructor(pInfo: IoBrokerDeviceInfo, pType: DeviceType);
|
|
26
27
|
/** @inheritDoc */
|
|
27
28
|
get batteryLevel(): number;
|
|
@@ -36,12 +37,15 @@ export declare class ZigbeeHeater extends ZigbeeDevice implements iHeater, iBatt
|
|
|
36
37
|
get sLevel(): string;
|
|
37
38
|
/** @inheritDoc */
|
|
38
39
|
get iLevel(): number;
|
|
39
|
-
get sTemperatur(): string;
|
|
40
40
|
/** @inheritDoc */
|
|
41
41
|
get iTemperature(): number;
|
|
42
42
|
/** @inheritDoc */
|
|
43
|
+
get sTemperature(): string;
|
|
44
|
+
/** @inheritDoc */
|
|
43
45
|
get roomTemperature(): number;
|
|
44
|
-
protected set
|
|
46
|
+
protected set roomTemperature(val: number);
|
|
47
|
+
/** @inheritDoc */
|
|
48
|
+
addTempChangeCallback(pCallback: (action: TemperatureSensorChangeAction) => void): void;
|
|
45
49
|
/** @inheritDoc */
|
|
46
50
|
checkAutomaticChange(): void;
|
|
47
51
|
/** @inheritDoc */
|
|
@@ -18,6 +18,8 @@ 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;
|
|
@@ -36,7 +38,6 @@ class ZigbeeHeater extends zigbeeDevice_1.ZigbeeDevice {
|
|
|
36
38
|
Kd: 9, // PID: Kd in 1/1000
|
|
37
39
|
});
|
|
38
40
|
this._seasonTurnOff = false;
|
|
39
|
-
this._roomTemperature = baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE;
|
|
40
41
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.heater);
|
|
41
42
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.batteryDriven);
|
|
42
43
|
this._iAutomaticInterval = services_1.Utils.guardedInterval(this.checkAutomaticChange, 300000, this); // Alle 5 Minuten prüfen
|
|
@@ -76,24 +77,29 @@ class ZigbeeHeater extends zigbeeDevice_1.ZigbeeDevice {
|
|
|
76
77
|
get iLevel() {
|
|
77
78
|
return this._level;
|
|
78
79
|
}
|
|
79
|
-
get sTemperatur() {
|
|
80
|
-
return `${this.iTemperature}°C`;
|
|
81
|
-
}
|
|
82
80
|
/** @inheritDoc */
|
|
83
81
|
get iTemperature() {
|
|
84
|
-
if (this.settings.
|
|
85
|
-
return this.
|
|
82
|
+
if (this.settings.useOwnTemperatureForRoomTemperature) {
|
|
83
|
+
return this.temperatureSensor.temperature;
|
|
86
84
|
}
|
|
87
85
|
else {
|
|
88
|
-
return this.
|
|
86
|
+
return this.roomTemperature;
|
|
89
87
|
}
|
|
90
88
|
}
|
|
91
89
|
/** @inheritDoc */
|
|
90
|
+
get sTemperature() {
|
|
91
|
+
return `${this.iTemperature}°C`;
|
|
92
|
+
}
|
|
93
|
+
/** @inheritDoc */
|
|
92
94
|
get roomTemperature() {
|
|
93
|
-
return this.
|
|
95
|
+
return this.temperatureSensor.roomTemperature;
|
|
94
96
|
}
|
|
95
|
-
set
|
|
96
|
-
this.
|
|
97
|
+
set roomTemperature(val) {
|
|
98
|
+
this.temperatureSensor.roomTemperature = val;
|
|
99
|
+
}
|
|
100
|
+
/** @inheritDoc */
|
|
101
|
+
addTempChangeCallback(pCallback) {
|
|
102
|
+
this.temperatureSensor.addTempChangeCallback(pCallback);
|
|
97
103
|
}
|
|
98
104
|
/** @inheritDoc */
|
|
99
105
|
checkAutomaticChange() {
|
|
@@ -121,7 +127,7 @@ class ZigbeeHeater extends zigbeeDevice_1.ZigbeeDevice {
|
|
|
121
127
|
}
|
|
122
128
|
/** @inheritDoc */
|
|
123
129
|
onTemperaturChange(newTemperatur) {
|
|
124
|
-
this.
|
|
130
|
+
this.roomTemperature = newTemperatur;
|
|
125
131
|
}
|
|
126
132
|
persistHeater() {
|
|
127
133
|
var _a;
|
|
@@ -151,12 +157,12 @@ class ZigbeeHeater extends zigbeeDevice_1.ZigbeeDevice {
|
|
|
151
157
|
super.dispose();
|
|
152
158
|
}
|
|
153
159
|
getNextPidLevel() {
|
|
154
|
-
if (this.seasonTurnOff || this.
|
|
160
|
+
if (this.seasonTurnOff || this.roomTemperature < 0) {
|
|
155
161
|
return 0;
|
|
156
162
|
}
|
|
157
163
|
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.
|
|
164
|
+
const newValue = this._pidController.calculate(this.roomTemperature);
|
|
165
|
+
this.log(models_1.LogLevel.Debug, `New PID Value ${newValue}% (cTemp: ${this.roomTemperature}, dTemp: ${this.desiredTemperature})`);
|
|
160
166
|
return newValue;
|
|
161
167
|
}
|
|
162
168
|
checkSeasonTurnOff() {
|
|
@@ -22,7 +22,7 @@ export declare class ZigbeeEuroHeater extends ZigbeeHeater implements iDisposabl
|
|
|
22
22
|
get desiredTemperature(): number;
|
|
23
23
|
/** @inheritDoc */
|
|
24
24
|
set desiredTemperature(val: number);
|
|
25
|
-
protected set
|
|
25
|
+
protected set roomTemperature(value: number);
|
|
26
26
|
private get tempDiff();
|
|
27
27
|
/** @inheritDoc */
|
|
28
28
|
update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
|
|
@@ -39,7 +39,7 @@ class ZigbeeEuroHeater extends BaseDevices_1.ZigbeeHeater {
|
|
|
39
39
|
}
|
|
40
40
|
/** @inheritDoc */
|
|
41
41
|
get roomTemperature() {
|
|
42
|
-
return
|
|
42
|
+
return super.roomTemperature;
|
|
43
43
|
}
|
|
44
44
|
/** @inheritDoc */
|
|
45
45
|
get desiredTemperature() {
|
|
@@ -50,8 +50,8 @@ class ZigbeeEuroHeater extends BaseDevices_1.ZigbeeHeater {
|
|
|
50
50
|
this._desiredTemperatur = val;
|
|
51
51
|
this.recalcLevel();
|
|
52
52
|
}
|
|
53
|
-
set
|
|
54
|
-
|
|
53
|
+
set roomTemperature(value) {
|
|
54
|
+
super.roomTemperature = value;
|
|
55
55
|
if (this.settings.useOwnTemperatur) {
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
@@ -134,7 +134,7 @@ class ZigbeeEuroHeater extends BaseDevices_1.ZigbeeHeater {
|
|
|
134
134
|
return;
|
|
135
135
|
}
|
|
136
136
|
this._lastRecalc = services_1.Utils.nowMS();
|
|
137
|
-
const desiredDiff = services_1.Utils.round(this.desiredTemperature - this.
|
|
137
|
+
const desiredDiff = services_1.Utils.round(this.desiredTemperature - this.roomTemperature, 1);
|
|
138
138
|
const currentDiff = this.tempDiff;
|
|
139
139
|
const missingDiff = services_1.Utils.round(desiredDiff - currentDiff, 1);
|
|
140
140
|
if (Math.abs(missingDiff) < 0.15) {
|
|
@@ -150,7 +150,7 @@ class ZigbeeEuroHeater extends BaseDevices_1.ZigbeeHeater {
|
|
|
150
150
|
}
|
|
151
151
|
const newLocalDiff = Math.sign(desiredDiff) * -9;
|
|
152
152
|
this.setLocalDiff(newLocalDiff);
|
|
153
|
-
this.setTargetTemperatur(this._temperatur + this.
|
|
153
|
+
this.setTargetTemperatur(this._temperatur + this.roomTemperature + newLocalDiff + this.desiredTemperature);
|
|
154
154
|
}
|
|
155
155
|
setLocalDiff(newLocalDiff) {
|
|
156
156
|
this.log(models_1.LogLevel.Debug, `Setting new Local Calibration Diff (${newLocalDiff}) for Euro Valve`);
|
|
@@ -16,8 +16,9 @@ export declare class ZigbeeTuyaValve extends ZigbeeHeater {
|
|
|
16
16
|
set seasonTurnOff(value: boolean);
|
|
17
17
|
/** @inheritDoc */
|
|
18
18
|
set desiredTemperature(val: number);
|
|
19
|
+
get roomTemperature(): number;
|
|
19
20
|
/** @inheritDoc */
|
|
20
|
-
protected set
|
|
21
|
+
protected set roomTemperature(value: number);
|
|
21
22
|
private get tempDiff();
|
|
22
23
|
/** @inheritDoc */
|
|
23
24
|
update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
|
|
@@ -31,9 +31,12 @@ class ZigbeeTuyaValve extends BaseDevices_1.ZigbeeHeater {
|
|
|
31
31
|
this._desiredTemperatur = val;
|
|
32
32
|
this.checkTempDiff();
|
|
33
33
|
}
|
|
34
|
+
get roomTemperature() {
|
|
35
|
+
return super.roomTemperature;
|
|
36
|
+
}
|
|
34
37
|
/** @inheritDoc */
|
|
35
|
-
set
|
|
36
|
-
|
|
38
|
+
set roomTemperature(value) {
|
|
39
|
+
super.roomTemperature = value;
|
|
37
40
|
if (this.settings.useOwnTemperatur) {
|
|
38
41
|
return;
|
|
39
42
|
}
|
|
@@ -81,7 +84,7 @@ class ZigbeeTuyaValve extends BaseDevices_1.ZigbeeHeater {
|
|
|
81
84
|
if (this.settings.useOwnTemperatur) {
|
|
82
85
|
return;
|
|
83
86
|
}
|
|
84
|
-
const desiredDiff = services_1.Utils.round(this.desiredTemperature - this.
|
|
87
|
+
const desiredDiff = services_1.Utils.round(this.desiredTemperature - this.roomTemperature, 1);
|
|
85
88
|
const currentDiff = this.tempDiff;
|
|
86
89
|
const missingDiff = services_1.Utils.round(desiredDiff - currentDiff, 1);
|
|
87
90
|
if (Math.abs(missingDiff) < 0.15) {
|
|
@@ -97,7 +100,7 @@ class ZigbeeTuyaValve extends BaseDevices_1.ZigbeeHeater {
|
|
|
97
100
|
}
|
|
98
101
|
const newLocalDiff = Math.sign(desiredDiff) * -9;
|
|
99
102
|
this.setLocalDiff(newLocalDiff);
|
|
100
|
-
this.setTargetTemperatur(this._localTempVal + this.
|
|
103
|
+
this.setTargetTemperatur(this._localTempVal + this.roomTemperature + newLocalDiff + this.desiredTemperature);
|
|
101
104
|
}
|
|
102
105
|
setLocalDiff(newLocalDiff) {
|
|
103
106
|
this.log(models_1.LogLevel.Debug, `Setting new Local Calibration Diff (${newLocalDiff}) for Tuya Valve`);
|
|
@@ -318,7 +318,7 @@ BEGIN
|
|
|
318
318
|
create table if not exists hoffmation_schema."Settings"
|
|
319
319
|
(
|
|
320
320
|
"id" varchar(60) not null,
|
|
321
|
-
"settings"
|
|
321
|
+
"settings" jsonb not null,
|
|
322
322
|
"customname" varchar(100) not null,
|
|
323
323
|
date timestamp not null,
|
|
324
324
|
constraint settings_pk
|
|
@@ -342,6 +342,12 @@ BEGIN
|
|
|
342
342
|
alter table hoffmation_schema."EnergyCalculation"
|
|
343
343
|
add "batteryLevel" double precision;
|
|
344
344
|
END IF;
|
|
345
|
+
IF (SELECT pg_typeof(settings) = to_regtype('varchar')
|
|
346
|
+
FROM hoffmation_schema."Settings"
|
|
347
|
+
LIMIT 1) THEN
|
|
348
|
+
alter table hoffmation_schema."Settings"
|
|
349
|
+
alter column settings type jsonb using settings::jsonb;
|
|
350
|
+
END IF;
|
|
345
351
|
END
|
|
346
352
|
$$;`);
|
|
347
353
|
this.initialized = true;
|
|
@@ -477,7 +483,7 @@ values ('${id}','${settings}','${customName}', '${new Date().toISOString()}')
|
|
|
477
483
|
}
|
|
478
484
|
/** @inheritDoc */
|
|
479
485
|
async loadSettings(id) {
|
|
480
|
-
const dbResult = await this.query(`SELECT settings, id, date
|
|
486
|
+
const dbResult = await this.query(`SELECT settings::text, id, date
|
|
481
487
|
from hoffmation_schema."Settings"
|
|
482
488
|
WHERE "id" = '${id}'
|
|
483
489
|
ORDER BY "date" DESC
|