hoffmation-base 3.0.0-alpha.99 → 3.0.0-beta.1
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/actuatorChangeAction.d.ts +13 -0
- package/lib/models/action/actuatorChangeAction.js +14 -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/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/dachs/dachs.d.ts +2 -0
- package/lib/server/devices/dachs/dachs.js +26 -13
- 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/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseAction } from './baseAction';
|
|
2
|
+
import { CommandType } from '../command';
|
|
3
|
+
import { iActuator } from '../../server';
|
|
4
|
+
export declare class ActuatorChangeAction extends BaseAction {
|
|
5
|
+
/** @inheritDoc */
|
|
6
|
+
type: CommandType;
|
|
7
|
+
/**
|
|
8
|
+
* The new state
|
|
9
|
+
* @type {boolean}
|
|
10
|
+
*/
|
|
11
|
+
readonly actuatorOn: boolean;
|
|
12
|
+
constructor(device: iActuator);
|
|
13
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActuatorChangeAction = void 0;
|
|
4
|
+
const baseAction_1 = require("./baseAction");
|
|
5
|
+
const command_1 = require("../command");
|
|
6
|
+
class ActuatorChangeAction extends baseAction_1.BaseAction {
|
|
7
|
+
constructor(device) {
|
|
8
|
+
super(undefined, `New Actuator state (${device.actuatorOn}) received`);
|
|
9
|
+
/** @inheritDoc */
|
|
10
|
+
this.type = command_1.CommandType.ActuatorChangeAction;
|
|
11
|
+
this.actuatorOn = device.actuatorOn;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.ActuatorChangeAction = ActuatorChangeAction;
|
|
@@ -5,5 +5,6 @@ export * from './presenceGroupLastLeftAction';
|
|
|
5
5
|
export * from './presenceGroupFirstEnterAction';
|
|
6
6
|
export * from './shutterPositionChangedAction';
|
|
7
7
|
export * from './temperatureSensorChangeAction';
|
|
8
|
+
export { ActuatorChangeAction } from './actuatorChangeAction';
|
|
8
9
|
export { BatteryLevelChangeAction } from './batteryLevelChangeAction';
|
|
9
10
|
export { PresenceGroupAnyMovementAction } from './presenceGroupAnyMovementAction';
|
|
@@ -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.BaseAction = void 0;
|
|
17
|
+
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);
|
|
@@ -23,6 +23,8 @@ __exportStar(require("./presenceGroupLastLeftAction"), exports);
|
|
|
23
23
|
__exportStar(require("./presenceGroupFirstEnterAction"), exports);
|
|
24
24
|
__exportStar(require("./shutterPositionChangedAction"), exports);
|
|
25
25
|
__exportStar(require("./temperatureSensorChangeAction"), exports);
|
|
26
|
+
var actuatorChangeAction_1 = require("./actuatorChangeAction");
|
|
27
|
+
Object.defineProperty(exports, "ActuatorChangeAction", { enumerable: true, get: function () { return actuatorChangeAction_1.ActuatorChangeAction; } });
|
|
26
28
|
var batteryLevelChangeAction_1 = require("./batteryLevelChangeAction");
|
|
27
29
|
Object.defineProperty(exports, "BatteryLevelChangeAction", { enumerable: true, get: function () { return batteryLevelChangeAction_1.BatteryLevelChangeAction; } });
|
|
28
30
|
var presenceGroupAnyMovementAction_1 = require("./presenceGroupAnyMovementAction");
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare enum CommandType {
|
|
2
|
+
ActuatorChangeAction = "ActuatorChangeAction",
|
|
2
3
|
BatteryManagerLevelChangeAction = "BatteryManagerLevelChangeAction",
|
|
3
4
|
BlockAutomaticLiftBlockCommand = "BlockAutomaticLiftBlockCommand",
|
|
4
5
|
BlockAutomaticCommand = "BlockAutomaticCommand",
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CommandType = void 0;
|
|
4
4
|
var CommandType;
|
|
5
5
|
(function (CommandType) {
|
|
6
|
+
CommandType["ActuatorChangeAction"] = "ActuatorChangeAction";
|
|
6
7
|
CommandType["BatteryManagerLevelChangeAction"] = "BatteryManagerLevelChangeAction";
|
|
7
8
|
CommandType["BlockAutomaticLiftBlockCommand"] = "BlockAutomaticLiftBlockCommand";
|
|
8
9
|
CommandType["BlockAutomaticCommand"] = "BlockAutomaticCommand";
|
|
@@ -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
|
*/
|
|
@@ -86,8 +86,10 @@ export declare class Dachs implements iBaseDevice, iActuator {
|
|
|
86
86
|
* @param {BatteryLevelChangeAction} action - The action containing the new level
|
|
87
87
|
*/
|
|
88
88
|
private onBatteryLevelChange;
|
|
89
|
+
private checkAllDesiredStates;
|
|
89
90
|
private onTempChange;
|
|
90
91
|
private checkHeatingRod;
|
|
91
92
|
private shouldDachsBeStarted;
|
|
92
93
|
private checkAlternativeActuator;
|
|
94
|
+
private onDachsRunningStateChange;
|
|
93
95
|
}
|
|
@@ -141,11 +141,17 @@ class Dachs {
|
|
|
141
141
|
this._influxClient.addMeasurementToQueue(key, value ? '1' : '0');
|
|
142
142
|
}
|
|
143
143
|
this._influxClient.flush();
|
|
144
|
+
const isDachsOn = this.fetchedData['Hka_Mw1.usDrehzahl'] >= 1;
|
|
145
|
+
const didDachsChange = this._dachsOn !== isDachsOn;
|
|
146
|
+
this._dachsOn = isDachsOn;
|
|
144
147
|
this._dachsOn = this.fetchedData['Hka_Mw1.usDrehzahl'] >= 1;
|
|
145
148
|
this._tempWarmWater = (_a = this.fetchedData['Hka_Mw1.Temp.sbZS_Warmwasser']) !== null && _a !== void 0 ? _a : 0;
|
|
146
149
|
this.warmWaterSensor.update(this._tempWarmWater);
|
|
147
150
|
this._tempHeatStorage = (_b = this.fetchedData['Hka_Mw1.Temp.sbFuehler1']) !== null && _b !== void 0 ? _b : 0;
|
|
148
151
|
this.heatStorageTempSensor.update(this._tempHeatStorage);
|
|
152
|
+
if (didDachsChange) {
|
|
153
|
+
this.onDachsRunningStateChange(new models_1.ActuatorChangeAction(this));
|
|
154
|
+
}
|
|
149
155
|
this.persist();
|
|
150
156
|
})
|
|
151
157
|
.catch((error) => {
|
|
@@ -208,8 +214,11 @@ class Dachs {
|
|
|
208
214
|
* @param {BatteryLevelChangeAction} action - The action containing the new level
|
|
209
215
|
*/
|
|
210
216
|
onBatteryLevelChange(action) {
|
|
211
|
-
|
|
212
|
-
|
|
217
|
+
this.checkAllDesiredStates(action, action.newLevel);
|
|
218
|
+
}
|
|
219
|
+
checkAllDesiredStates(action, batteryLevel) {
|
|
220
|
+
const shouldDachsBeStarted = this.shouldDachsBeStarted(action, batteryLevel);
|
|
221
|
+
this.checkHeatingRod(action, batteryLevel);
|
|
213
222
|
this.checkAlternativeActuator(shouldDachsBeStarted, action);
|
|
214
223
|
if (!shouldDachsBeStarted) {
|
|
215
224
|
return;
|
|
@@ -267,34 +276,34 @@ class Dachs {
|
|
|
267
276
|
const setAction = new models_1.ActuatorSetStateCommand(action, desiredWwPumpState, reason, null);
|
|
268
277
|
this.warmWaterPump.setActuator(setAction);
|
|
269
278
|
}
|
|
270
|
-
checkHeatingRod(action) {
|
|
279
|
+
checkHeatingRod(action, batteryLevel) {
|
|
271
280
|
if (this.heatingRod === undefined) {
|
|
272
281
|
return;
|
|
273
282
|
}
|
|
274
|
-
const shouldBeOff =
|
|
283
|
+
const shouldBeOff = batteryLevel < this.settings.batteryLevelHeatingRodThreshold;
|
|
275
284
|
if (this.heatingRod.actuatorOn !== shouldBeOff) {
|
|
276
285
|
return;
|
|
277
286
|
}
|
|
278
|
-
const setAction = new models_1.ActuatorSetStateCommand(action, !shouldBeOff, `Battery reached ${
|
|
287
|
+
const setAction = new models_1.ActuatorSetStateCommand(action, !shouldBeOff, `Battery reached ${batteryLevel}%, heating rod should be turned ${shouldBeOff ? 'off' : 'on'}`, null);
|
|
279
288
|
this.heatingRod.setActuator(setAction);
|
|
280
289
|
}
|
|
281
|
-
shouldDachsBeStarted(action) {
|
|
290
|
+
shouldDachsBeStarted(action, batteryLevel) {
|
|
282
291
|
var _a;
|
|
283
292
|
if (this.blockDachsStart !== undefined) {
|
|
284
|
-
if (
|
|
285
|
-
const blockAction = new models_1.ActuatorSetStateCommand(action, true, `Battery reached ${
|
|
293
|
+
if (batteryLevel > this.settings.batteryLevelPreventStartThreshold) {
|
|
294
|
+
const blockAction = new models_1.ActuatorSetStateCommand(action, true, `Battery reached ${batteryLevel}%, Dachs should not run any more`, null);
|
|
286
295
|
blockAction.overrideCommandSource = models_1.CommandSource.Force;
|
|
287
296
|
this.blockDachsStart.setActuator(blockAction);
|
|
288
297
|
return false;
|
|
289
298
|
}
|
|
290
|
-
else if (
|
|
291
|
-
const liftAction = new models_1.ActuatorSetStateCommand(action, false, `Battery reached ${
|
|
299
|
+
else if (batteryLevel < this.settings.batteryLevelAllowStartThreshold) {
|
|
300
|
+
const liftAction = new models_1.ActuatorSetStateCommand(action, false, `Battery reached ${batteryLevel}%, Dachs is now allowed to run if needed`, null);
|
|
292
301
|
this.blockDachsStart.setActuator(liftAction);
|
|
293
302
|
}
|
|
294
303
|
else if (((_a = services_1.SettingsService.settings.heaterSettings) === null || _a === void 0 ? void 0 : _a.mode) === config_1.HeatingMode.Winter &&
|
|
295
304
|
this.heatStorageTempSensor.temperatureSensor.temperature < 60 &&
|
|
296
305
|
services_1.Utils.dateByTimeSpan(21, 30) < new Date()) {
|
|
297
|
-
const liftWinterAction = new models_1.ActuatorSetStateCommand(action, false, `Battery at ${
|
|
306
|
+
const liftWinterAction = new models_1.ActuatorSetStateCommand(action, false, `Battery at ${batteryLevel}% but it is winter, we are nearing night and heat storage is kinda cold: Dachs is now allowed to run if needed`, null);
|
|
298
307
|
this.blockDachsStart.setActuator(liftWinterAction);
|
|
299
308
|
}
|
|
300
309
|
else if (this.blockDachsStart.actuatorOn) {
|
|
@@ -308,11 +317,11 @@ class Dachs {
|
|
|
308
317
|
}
|
|
309
318
|
const dayType = services_1.TimeCallbackService.dayType(new services_1.SunTimeOffsets());
|
|
310
319
|
if ((dayType === models_1.TimeOfDay.Daylight || dayType === models_1.TimeOfDay.BeforeSunrise) &&
|
|
311
|
-
|
|
320
|
+
batteryLevel > this.settings.batteryLevelTurnOnThreshold) {
|
|
312
321
|
// It is daytime (maybe solar power) and it is no critical battery level
|
|
313
322
|
return false;
|
|
314
323
|
}
|
|
315
|
-
if (
|
|
324
|
+
if (batteryLevel > this.settings.batteryLevelBeforeNightTurnOnThreshold) {
|
|
316
325
|
// It is not daylight but battery level is high enough
|
|
317
326
|
return false;
|
|
318
327
|
}
|
|
@@ -340,5 +349,9 @@ class Dachs {
|
|
|
340
349
|
command.overrideCommandSource = models_1.CommandSource.Force;
|
|
341
350
|
this.warmWaterDachsAlternativeActuator.setActuator(command);
|
|
342
351
|
}
|
|
352
|
+
onDachsRunningStateChange(runStateChange) {
|
|
353
|
+
var _a, _b;
|
|
354
|
+
this.checkAllDesiredStates(runStateChange, (_b = (_a = devices_1.Devices.energymanager) === null || _a === void 0 ? void 0 : _a.batteryLevel) !== null && _b !== void 0 ? _b : 0);
|
|
355
|
+
}
|
|
343
356
|
}
|
|
344
357
|
exports.Dachs = Dachs;
|
|
@@ -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;
|