hoffmation-base 3.2.1-alpha.8 → 3.2.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/command/baseCommand.d.ts +3 -2
- package/lib/command/baseCommand.js +7 -2
- package/lib/devices/BaseDevice.js +4 -2
- package/lib/devices/dachs/dachs.d.ts +1 -0
- package/lib/devices/dachs/dachs.js +24 -3
- package/lib/devices/govee/own-govee-device.js +0 -1
- package/lib/index.js +7 -4
- package/lib/interfaces/deviceSettings/iDachsDeviceSettings.d.ts +21 -7
- package/lib/interfaces/iJsonCustomPrepend.d.ts +9 -0
- package/lib/interfaces/iJsonCustomPrepend.js +2 -0
- package/lib/interfaces/index.d.ts +1 -0
- package/lib/interfaces/index.js +1 -0
- package/lib/services/dbo/persistence.d.ts +6 -1
- package/lib/services/dbo/persistence.js +41 -0
- package/lib/settingsObjects/deviceSettings/dachsSettings.d.ts +11 -36
- package/lib/settingsObjects/deviceSettings/dachsSettings.js +18 -41
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/utils.js +7 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CommandSource, CommandType } from '../enums';
|
|
2
2
|
import { iBaseCommand } from './iBaseCommand';
|
|
3
|
-
import { iJsonOmitKeys } from '../interfaces';
|
|
4
|
-
export declare abstract class BaseCommand implements iBaseCommand, iJsonOmitKeys {
|
|
3
|
+
import { iJsonCustomPrepend, iJsonOmitKeys } from '../interfaces';
|
|
4
|
+
export declare abstract class BaseCommand implements iBaseCommand, iJsonOmitKeys, iJsonCustomPrepend {
|
|
5
5
|
readonly source: CommandSource | iBaseCommand;
|
|
6
6
|
readonly reason: string;
|
|
7
7
|
/**
|
|
@@ -40,5 +40,6 @@ export declare abstract class BaseCommand implements iBaseCommand, iJsonOmitKeys
|
|
|
40
40
|
get reasonTrace(): string;
|
|
41
41
|
containsType(type: CommandType): boolean;
|
|
42
42
|
get logMessage(): string;
|
|
43
|
+
customPrepend(): Partial<unknown>;
|
|
43
44
|
toJSON(): Partial<BaseCommand>;
|
|
44
45
|
}
|
|
@@ -70,7 +70,7 @@ class BaseCommand {
|
|
|
70
70
|
if (typeof this.source === 'object') {
|
|
71
71
|
return `${this.source.reasonTrace} -> ${ownPart}`;
|
|
72
72
|
}
|
|
73
|
-
return `
|
|
73
|
+
return `CommandSource("${enums_1.CommandSource[this.source]}") stack => ${ownPart}`;
|
|
74
74
|
}
|
|
75
75
|
containsType(type) {
|
|
76
76
|
if (this.type === type) {
|
|
@@ -84,8 +84,13 @@ class BaseCommand {
|
|
|
84
84
|
get logMessage() {
|
|
85
85
|
return this.reasonTrace;
|
|
86
86
|
}
|
|
87
|
+
customPrepend() {
|
|
88
|
+
return {
|
|
89
|
+
logMessage: this.logMessage,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
87
92
|
toJSON() {
|
|
88
|
-
// eslint-disable-next-line
|
|
93
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
89
94
|
const result = lodash_1.default.omit(this, ['source']);
|
|
90
95
|
result['logMessage'] = this.logMessage;
|
|
91
96
|
return result;
|
|
@@ -59,12 +59,14 @@ class BaseDevice {
|
|
|
59
59
|
loadDeviceSettings() {
|
|
60
60
|
utils_1.Utils.retryAction(() => {
|
|
61
61
|
var _a;
|
|
62
|
-
if (this.settings === undefined || services_1.Persistence.
|
|
62
|
+
if (this.settings === undefined || !services_1.Persistence.dboReady) {
|
|
63
63
|
return false;
|
|
64
64
|
}
|
|
65
65
|
(_a = this.settings) === null || _a === void 0 ? void 0 : _a.initializeFromDb(this);
|
|
66
66
|
return true;
|
|
67
|
-
}, this)
|
|
67
|
+
}, this, 5, 2000, undefined, () => {
|
|
68
|
+
this.log(enums_1.LogLevel.Error, 'Could not load device settings within 5 retries.');
|
|
69
|
+
});
|
|
68
70
|
}
|
|
69
71
|
log(level, message, logDebugType = enums_1.LogDebugType.None) {
|
|
70
72
|
logging_1.ServerLogService.writeLog(level, message, {
|
|
@@ -14,7 +14,7 @@ const DeviceInfo_1 = require("../DeviceInfo");
|
|
|
14
14
|
const devices_1 = require("../devices");
|
|
15
15
|
const utils_1 = require("../../utils");
|
|
16
16
|
const sharedFunctions_1 = require("../sharedFunctions");
|
|
17
|
-
const
|
|
17
|
+
const models_1 = require("../../models");
|
|
18
18
|
const command_1 = require("../../command");
|
|
19
19
|
const services_1 = require("../../services");
|
|
20
20
|
const settings_service_1 = require("../../settings-service");
|
|
@@ -48,6 +48,10 @@ class Dachs extends RoomBaseDevice_1.RoomBaseDevice {
|
|
|
48
48
|
this._dachsOn = false;
|
|
49
49
|
this._tempWarmWater = 0;
|
|
50
50
|
this._tempHeatStorage = 0;
|
|
51
|
+
/*
|
|
52
|
+
* The timestamp of the last time the Block was enforced.
|
|
53
|
+
*/
|
|
54
|
+
this._blockStarted = 0;
|
|
51
55
|
this.jsonOmitKeys.push(...[
|
|
52
56
|
'client',
|
|
53
57
|
'config',
|
|
@@ -61,6 +65,7 @@ class Dachs extends RoomBaseDevice_1.RoomBaseDevice {
|
|
|
61
65
|
]);
|
|
62
66
|
devices_1.Devices.alLDevices[allDevicesKey] = this;
|
|
63
67
|
this.deviceCapabilities.push(enums_1.DeviceCapability.actuator);
|
|
68
|
+
this.deviceCapabilities.push(enums_1.DeviceCapability.blockAutomatic);
|
|
64
69
|
if (options.influxDb) {
|
|
65
70
|
this._influxClient = new lib_1.DachsInfluxClient(options.influxDb);
|
|
66
71
|
}
|
|
@@ -189,6 +194,9 @@ class Dachs extends RoomBaseDevice_1.RoomBaseDevice {
|
|
|
189
194
|
this.checkAllDesiredStates(action, action.newLevel);
|
|
190
195
|
}
|
|
191
196
|
checkAllDesiredStates(action, batteryLevel) {
|
|
197
|
+
if (this.blockAutomationHandler.automaticBlockActive) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
192
200
|
const shouldDachsBeStarted = this.shouldDachsBeStarted(action, batteryLevel);
|
|
193
201
|
this.checkHeatingRod(action, batteryLevel);
|
|
194
202
|
this.checkAlternativeActuator(shouldDachsBeStarted, action);
|
|
@@ -270,17 +278,31 @@ class Dachs extends RoomBaseDevice_1.RoomBaseDevice {
|
|
|
270
278
|
}
|
|
271
279
|
shouldDachsBeStarted(action, batteryLevel) {
|
|
272
280
|
var _a, _b;
|
|
281
|
+
const dayType = services_1.TimeCallbackService.dayType(new models_1.SunTimeOffsets());
|
|
273
282
|
if (this.blockDachsStart !== undefined) {
|
|
274
|
-
if (
|
|
283
|
+
if ((dayType === enums_1.TimeOfDay.Daylight || dayType === enums_1.TimeOfDay.BeforeSunrise) &&
|
|
284
|
+
batteryLevel > this.settings.batteryLevelPreventStartThreshold) {
|
|
275
285
|
const blockAction = new command_1.ActuatorSetStateCommand(action, true, `Battery reached ${batteryLevel}%, Dachs should not run any more`, null);
|
|
276
286
|
blockAction.overrideCommandSource = enums_1.CommandSource.Force;
|
|
277
287
|
this.blockDachsStart.setActuator(blockAction);
|
|
288
|
+
this._blockStarted = utils_1.Utils.nowMS();
|
|
289
|
+
return false;
|
|
290
|
+
}
|
|
291
|
+
else if (batteryLevel > this.settings.batteryLevelPreventStartAtNightThreshold) {
|
|
292
|
+
const blockAction = new command_1.ActuatorSetStateCommand(action, true, `Battery reached ${batteryLevel}%, Dachs should not run any more`, null);
|
|
293
|
+
blockAction.overrideCommandSource = enums_1.CommandSource.Force;
|
|
294
|
+
this.blockDachsStart.setActuator(blockAction);
|
|
295
|
+
this._blockStarted = utils_1.Utils.nowMS();
|
|
278
296
|
return false;
|
|
279
297
|
}
|
|
280
298
|
else if (batteryLevel < this.settings.batteryLevelAllowStartThreshold) {
|
|
281
299
|
const liftAction = new command_1.ActuatorSetStateCommand(action, false, `Battery reached ${batteryLevel}%, Dachs is now allowed to run if needed`, null);
|
|
282
300
|
this.blockDachsStart.setActuator(liftAction);
|
|
283
301
|
}
|
|
302
|
+
else if (utils_1.Utils.nowMS() - this._blockStarted > 180 * 60 * 60) {
|
|
303
|
+
const liftAction = new command_1.ActuatorSetStateCommand(action, false, `Battery is at ${batteryLevel}%, but Dachs wasn't allowed to run for 3 hours, Dachs is now allowed to run if needed`, null);
|
|
304
|
+
this.blockDachsStart.setActuator(liftAction);
|
|
305
|
+
}
|
|
284
306
|
else if (((_a = settings_service_1.SettingsService.settings.heaterSettings) === null || _a === void 0 ? void 0 : _a.mode) === enums_1.HeatingMode.Winter &&
|
|
285
307
|
this.heatStorageTempSensor.temperatureSensor.temperature < this.settings.winterMinimumPreNightHeatStorageTemp &&
|
|
286
308
|
utils_1.Utils.dateByTimeSpan(21, 30) < new Date()) {
|
|
@@ -301,7 +323,6 @@ class Dachs extends RoomBaseDevice_1.RoomBaseDevice {
|
|
|
301
323
|
// It is winter and heat storage is kinda cold --> Start
|
|
302
324
|
return true;
|
|
303
325
|
}
|
|
304
|
-
const dayType = services_1.TimeCallbackService.dayType(new sun_time_offsets_1.SunTimeOffsets());
|
|
305
326
|
if ((dayType === enums_1.TimeOfDay.Daylight || dayType === enums_1.TimeOfDay.BeforeSunrise) &&
|
|
306
327
|
batteryLevel > this.settings.batteryLevelTurnOnThreshold) {
|
|
307
328
|
// It is daytime (maybe solar power) and it is no critical battery level
|
|
@@ -32,7 +32,6 @@ class OwnGoveeDevice extends RoomBaseDevice_1.RoomBaseDevice {
|
|
|
32
32
|
this._color = '#fcba32';
|
|
33
33
|
this._colortemp = 500;
|
|
34
34
|
this._lastPersist = 0;
|
|
35
|
-
this.jsonOmitKeys.push('device');
|
|
36
35
|
this.deviceId = deviceId;
|
|
37
36
|
this.deviceCapabilities.push(...[
|
|
38
37
|
enums_1.DeviceCapability.ledLamp,
|
package/lib/index.js
CHANGED
|
@@ -48,7 +48,7 @@ class HoffmationInitializationObject {
|
|
|
48
48
|
exports.HoffmationInitializationObject = HoffmationInitializationObject;
|
|
49
49
|
class HoffmationBase {
|
|
50
50
|
static async initializeBeforeIoBroker(initObject) {
|
|
51
|
-
var _a
|
|
51
|
+
var _a;
|
|
52
52
|
settings_service_1.SettingsService.initialize(initObject.config);
|
|
53
53
|
i18n_1.Res.initialize(initObject.config.translationSettings);
|
|
54
54
|
if (initObject.config.logSettings) {
|
|
@@ -57,9 +57,12 @@ class HoffmationBase {
|
|
|
57
57
|
logging_1.ServerLogService.writeLog(enums_1.LogLevel.Info, 'Hoffmation-Base Startup');
|
|
58
58
|
if (initObject.config.persistence) {
|
|
59
59
|
if (initObject.config.persistence.postgreSql) {
|
|
60
|
-
|
|
60
|
+
logging_1.ServerLogService.writeLog(enums_1.LogLevel.Info, 'Creating PostgresSQL Client');
|
|
61
|
+
const dbo = new services_1.PostgreSqlPersist(initObject.config.persistence.postgreSql);
|
|
62
|
+
await dbo.initialize();
|
|
63
|
+
services_1.Persistence.dbo = dbo;
|
|
64
|
+
logging_1.ServerLogService.writeLog(enums_1.LogLevel.Info, 'Persistence initialized');
|
|
61
65
|
}
|
|
62
|
-
await ((_a = services_1.Persistence.dbo) === null || _a === void 0 ? void 0 : _a.initialize());
|
|
63
66
|
}
|
|
64
67
|
if (settings_service_1.SettingsService.settings.mp3Server) {
|
|
65
68
|
logging_1.ServerLogService.writeLog(enums_1.LogLevel.Info, 'Mp3Server settings detected --> initializing');
|
|
@@ -81,7 +84,7 @@ class HoffmationBase {
|
|
|
81
84
|
logging_1.ServerLogService.writeLog(enums_1.LogLevel.Info, 'Asus Router settings detected --> initializing');
|
|
82
85
|
new services_1.AsusRouter(settings_service_1.SettingsService.settings.asusConfig);
|
|
83
86
|
}
|
|
84
|
-
else if ((
|
|
87
|
+
else if ((_a = settings_service_1.SettingsService.settings.unifiSettings) === null || _a === void 0 ? void 0 : _a.loginOptions) {
|
|
85
88
|
logging_1.ServerLogService.writeLog(enums_1.LogLevel.Info, 'Unifi Router settings detected --> initializing');
|
|
86
89
|
new services_1.UnifiRouter(settings_service_1.SettingsService.settings.unifiSettings.loginOptions);
|
|
87
90
|
}
|
|
@@ -4,39 +4,53 @@ import { iActuatorSettings } from './iActuatorSettings';
|
|
|
4
4
|
*/
|
|
5
5
|
export interface iDachsDeviceSettings extends iActuatorSettings {
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* The refresh interval in ms to pull the data from the device.
|
|
8
8
|
*/
|
|
9
9
|
refreshIntervalTime: number;
|
|
10
10
|
/**
|
|
11
|
+
* Defines the battery level at which the dachs should be turned on,
|
|
12
|
+
* to prevent a battery based island-system to be out of power.
|
|
13
|
+
* @default -1 --> No turn on for battery loading
|
|
11
14
|
*
|
|
15
|
+
* Uses {@link iBatteryDevice.addBatteryLevelCallback}
|
|
12
16
|
*/
|
|
13
17
|
batteryLevelTurnOnThreshold: number;
|
|
14
18
|
/**
|
|
19
|
+
* Defines the battery level at which the dachs should be turned on,
|
|
20
|
+
* in evening hours to prevent a battery based island-system to run out of
|
|
21
|
+
* power overnight.
|
|
22
|
+
* @default -1 --> No turn on for battery loading
|
|
15
23
|
*
|
|
24
|
+
* Uses {@link iBatteryDevice.addBatteryLevelCallback}
|
|
16
25
|
*/
|
|
17
26
|
batteryLevelBeforeNightTurnOnThreshold: number;
|
|
18
27
|
/**
|
|
19
|
-
*
|
|
28
|
+
* Defines the battery level below which the dachs should be allowed to start
|
|
20
29
|
*/
|
|
21
30
|
batteryLevelAllowStartThreshold: number;
|
|
22
31
|
/**
|
|
23
|
-
*
|
|
32
|
+
* Defines the battery level above which the dachs should be prevented from starting/running at daytime.
|
|
24
33
|
*/
|
|
25
34
|
batteryLevelPreventStartThreshold: number;
|
|
26
35
|
/**
|
|
27
|
-
*
|
|
36
|
+
* Defines the battery level above which the dachs should be prevented from starting/running at nighttime.
|
|
37
|
+
* @type {number}
|
|
38
|
+
*/
|
|
39
|
+
batteryLevelPreventStartAtNightThreshold: number;
|
|
40
|
+
/**
|
|
41
|
+
* Defines the battery level above which the external heating rod should be turned on
|
|
28
42
|
*/
|
|
29
43
|
batteryLevelHeatingRodThreshold: number;
|
|
30
44
|
/**
|
|
31
|
-
*
|
|
45
|
+
* Defines the desired minimum temperature for warm water.
|
|
32
46
|
*/
|
|
33
47
|
warmWaterDesiredMinTemp: number;
|
|
34
48
|
/**
|
|
35
|
-
*
|
|
49
|
+
* Defines the desired minimum temperature for heat storage during winter.
|
|
36
50
|
*/
|
|
37
51
|
winterMinimumHeatStorageTemp: number;
|
|
38
52
|
/**
|
|
39
|
-
*
|
|
53
|
+
* Defines the desired minimum temperature for heat storage during winter.
|
|
40
54
|
*/
|
|
41
55
|
winterMinimumPreNightHeatStorageTemp: number;
|
|
42
56
|
/**
|
|
@@ -16,6 +16,7 @@ export * from './iButtonCallback';
|
|
|
16
16
|
export * from './iButtonCapabilities';
|
|
17
17
|
export * from './iDeviceInfo';
|
|
18
18
|
export * from './iIdHolder';
|
|
19
|
+
export * from './iJsonCustomPrepend';
|
|
19
20
|
export * from './iJsonOmitKeys';
|
|
20
21
|
export * from './iLogSettings';
|
|
21
22
|
export * from './iAsusConfig';
|
package/lib/interfaces/index.js
CHANGED
|
@@ -32,6 +32,7 @@ __exportStar(require("./iButtonCallback"), exports);
|
|
|
32
32
|
__exportStar(require("./iButtonCapabilities"), exports);
|
|
33
33
|
__exportStar(require("./iDeviceInfo"), exports);
|
|
34
34
|
__exportStar(require("./iIdHolder"), exports);
|
|
35
|
+
__exportStar(require("./iJsonCustomPrepend"), exports);
|
|
35
36
|
__exportStar(require("./iJsonOmitKeys"), exports);
|
|
36
37
|
__exportStar(require("./iLogSettings"), exports);
|
|
37
38
|
__exportStar(require("./iAsusConfig"), exports);
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { iPersist } from '../../interfaces';
|
|
2
2
|
export declare class Persistence {
|
|
3
|
+
private static _dbo;
|
|
3
4
|
/**
|
|
4
5
|
* The persitence layer object
|
|
6
|
+
* @returns The persistence layer
|
|
5
7
|
*/
|
|
6
|
-
static dbo: iPersist | undefined;
|
|
8
|
+
static get dbo(): iPersist | undefined;
|
|
9
|
+
static set dbo(value: iPersist | undefined);
|
|
10
|
+
static get dboReady(): boolean;
|
|
11
|
+
static lazyDbo(retries?: number): Promise<iPersist | undefined>;
|
|
7
12
|
static get anyDboActive(): boolean;
|
|
8
13
|
}
|
|
@@ -1,9 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Persistence = void 0;
|
|
4
|
+
const logging_1 = require("../../logging");
|
|
5
|
+
const enums_1 = require("../../enums");
|
|
6
|
+
const utils_1 = require("../../utils");
|
|
4
7
|
class Persistence {
|
|
8
|
+
/**
|
|
9
|
+
* The persitence layer object
|
|
10
|
+
* @returns The persistence layer
|
|
11
|
+
*/
|
|
12
|
+
static get dbo() {
|
|
13
|
+
if (this._dbo === undefined) {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
if (!this._dbo.initialized) {
|
|
17
|
+
const err = new Error('Db is not yet initialized');
|
|
18
|
+
logging_1.ServerLogService.writeLog(enums_1.LogLevel.Warn, 'Db is not yet initialized, Stack: ' + err.stack);
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
return this._dbo;
|
|
22
|
+
}
|
|
23
|
+
static set dbo(value) {
|
|
24
|
+
this._dbo = value;
|
|
25
|
+
}
|
|
26
|
+
static get dboReady() {
|
|
27
|
+
return this._dbo !== undefined && this._dbo.initialized;
|
|
28
|
+
}
|
|
29
|
+
static async lazyDbo(retries = 5) {
|
|
30
|
+
if (this.dbo === undefined) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
if (this.dbo.initialized) {
|
|
34
|
+
return this.dbo;
|
|
35
|
+
}
|
|
36
|
+
if (retries == 0) {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
return new Promise((resolve) => {
|
|
40
|
+
utils_1.Utils.guardedTimeout(() => {
|
|
41
|
+
resolve(Persistence.lazyDbo(retries - 1));
|
|
42
|
+
}, 2000, this);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
5
45
|
static get anyDboActive() {
|
|
6
46
|
return this.dbo !== undefined;
|
|
7
47
|
}
|
|
8
48
|
}
|
|
9
49
|
exports.Persistence = Persistence;
|
|
50
|
+
Persistence._dbo = undefined;
|
|
@@ -1,50 +1,25 @@
|
|
|
1
1
|
import { iDachsDeviceSettings } from '../../interfaces';
|
|
2
2
|
import { ActuatorSettings } from './actuatorSettings';
|
|
3
3
|
export declare class DachsDeviceSettings extends ActuatorSettings implements iDachsDeviceSettings {
|
|
4
|
-
/**
|
|
5
|
-
* The refresh interval in ms to pull the data from the device.
|
|
6
|
-
*/
|
|
4
|
+
/** @inheritDoc */
|
|
7
5
|
refreshIntervalTime: number;
|
|
8
|
-
/**
|
|
9
|
-
* Defines the battery level at which the dachs should be turned on,
|
|
10
|
-
* to prevent a battery based island-system to be out of power.
|
|
11
|
-
* @default -1 --> No turn on for battery loading
|
|
12
|
-
*
|
|
13
|
-
* Uses {@link iBatteryDevice.addBatteryLevelCallback}
|
|
14
|
-
*/
|
|
6
|
+
/** @inheritDoc */
|
|
15
7
|
batteryLevelTurnOnThreshold: number;
|
|
16
|
-
/**
|
|
17
|
-
* Defines the battery level at which the dachs should be turned on,
|
|
18
|
-
* in evening hours to prevent a battery based island-system to run out of
|
|
19
|
-
* power overnight.
|
|
20
|
-
* @default -1 --> No turn on for battery loading
|
|
21
|
-
*
|
|
22
|
-
* Uses {@link iBatteryDevice.addBatteryLevelCallback}
|
|
23
|
-
*/
|
|
8
|
+
/** @inheritDoc */
|
|
24
9
|
batteryLevelBeforeNightTurnOnThreshold: number;
|
|
25
|
-
/**
|
|
26
|
-
* Defines the battery level below which the dachs should be allowed to start
|
|
27
|
-
*/
|
|
10
|
+
/** @inheritDoc */
|
|
28
11
|
batteryLevelAllowStartThreshold: number;
|
|
29
|
-
/**
|
|
30
|
-
* Defines the battery level above which the dachs should be prevented from starting/running.
|
|
31
|
-
*/
|
|
12
|
+
/** @inheritDoc */
|
|
32
13
|
batteryLevelPreventStartThreshold: number;
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
|
|
14
|
+
/** @inheritDoc */
|
|
15
|
+
batteryLevelPreventStartAtNightThreshold: number;
|
|
16
|
+
/** @inheritDoc */
|
|
36
17
|
batteryLevelHeatingRodThreshold: number;
|
|
37
|
-
/**
|
|
38
|
-
* Defines the desired minimum temperature for warm water.
|
|
39
|
-
*/
|
|
18
|
+
/** @inheritDoc */
|
|
40
19
|
warmWaterDesiredMinTemp: number;
|
|
41
|
-
/**
|
|
42
|
-
* Defines the desired minimum temperature for heat storage during winter.
|
|
43
|
-
*/
|
|
20
|
+
/** @inheritDoc */
|
|
44
21
|
winterMinimumHeatStorageTemp: number;
|
|
45
|
-
/**
|
|
46
|
-
* Defines the desired minimum temperature for heat storage during winter.
|
|
47
|
-
*/
|
|
22
|
+
/** @inheritDoc */
|
|
48
23
|
winterMinimumPreNightHeatStorageTemp: number;
|
|
49
24
|
fromPartialObject(data: Partial<DachsDeviceSettings>): void;
|
|
50
25
|
toJSON(): Partial<DachsDeviceSettings>;
|
|
@@ -6,54 +6,29 @@ const actuatorSettings_1 = require("./actuatorSettings");
|
|
|
6
6
|
class DachsDeviceSettings extends actuatorSettings_1.ActuatorSettings {
|
|
7
7
|
constructor() {
|
|
8
8
|
super(...arguments);
|
|
9
|
-
/**
|
|
10
|
-
* The refresh interval in ms to pull the data from the device.
|
|
11
|
-
*/
|
|
9
|
+
/** @inheritDoc */
|
|
12
10
|
this.refreshIntervalTime = 30000;
|
|
13
|
-
/**
|
|
14
|
-
* Defines the battery level at which the dachs should be turned on,
|
|
15
|
-
* to prevent a battery based island-system to be out of power.
|
|
16
|
-
* @default -1 --> No turn on for battery loading
|
|
17
|
-
*
|
|
18
|
-
* Uses {@link iBatteryDevice.addBatteryLevelCallback}
|
|
19
|
-
*/
|
|
11
|
+
/** @inheritDoc */
|
|
20
12
|
this.batteryLevelTurnOnThreshold = -1;
|
|
21
|
-
/**
|
|
22
|
-
* Defines the battery level at which the dachs should be turned on,
|
|
23
|
-
* in evening hours to prevent a battery based island-system to run out of
|
|
24
|
-
* power overnight.
|
|
25
|
-
* @default -1 --> No turn on for battery loading
|
|
26
|
-
*
|
|
27
|
-
* Uses {@link iBatteryDevice.addBatteryLevelCallback}
|
|
28
|
-
*/
|
|
13
|
+
/** @inheritDoc */
|
|
29
14
|
this.batteryLevelBeforeNightTurnOnThreshold = -1;
|
|
30
|
-
/**
|
|
31
|
-
* Defines the battery level below which the dachs should be allowed to start
|
|
32
|
-
*/
|
|
15
|
+
/** @inheritDoc */
|
|
33
16
|
this.batteryLevelAllowStartThreshold = 50;
|
|
34
|
-
/**
|
|
35
|
-
* Defines the battery level above which the dachs should be prevented from starting/running.
|
|
36
|
-
*/
|
|
17
|
+
/** @inheritDoc */
|
|
37
18
|
this.batteryLevelPreventStartThreshold = 70;
|
|
38
|
-
/**
|
|
39
|
-
|
|
40
|
-
|
|
19
|
+
/** @inheritDoc */
|
|
20
|
+
this.batteryLevelPreventStartAtNightThreshold = 90;
|
|
21
|
+
/** @inheritDoc */
|
|
41
22
|
this.batteryLevelHeatingRodThreshold = 80;
|
|
42
|
-
/**
|
|
43
|
-
* Defines the desired minimum temperature for warm water.
|
|
44
|
-
*/
|
|
23
|
+
/** @inheritDoc */
|
|
45
24
|
this.warmWaterDesiredMinTemp = 45;
|
|
46
|
-
/**
|
|
47
|
-
* Defines the desired minimum temperature for heat storage during winter.
|
|
48
|
-
*/
|
|
25
|
+
/** @inheritDoc */
|
|
49
26
|
this.winterMinimumHeatStorageTemp = 55;
|
|
50
|
-
/**
|
|
51
|
-
* Defines the desired minimum temperature for heat storage during winter.
|
|
52
|
-
*/
|
|
27
|
+
/** @inheritDoc */
|
|
53
28
|
this.winterMinimumPreNightHeatStorageTemp = 65;
|
|
54
29
|
}
|
|
55
30
|
fromPartialObject(data) {
|
|
56
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
31
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
57
32
|
this.refreshIntervalTime = (_a = data.refreshIntervalTime) !== null && _a !== void 0 ? _a : this.refreshIntervalTime;
|
|
58
33
|
this.batteryLevelBeforeNightTurnOnThreshold =
|
|
59
34
|
(_b = data.batteryLevelBeforeNightTurnOnThreshold) !== null && _b !== void 0 ? _b : this.batteryLevelBeforeNightTurnOnThreshold;
|
|
@@ -61,11 +36,13 @@ class DachsDeviceSettings extends actuatorSettings_1.ActuatorSettings {
|
|
|
61
36
|
this.batteryLevelHeatingRodThreshold = (_d = data.batteryLevelHeatingRodThreshold) !== null && _d !== void 0 ? _d : this.batteryLevelHeatingRodThreshold;
|
|
62
37
|
this.batteryLevelPreventStartThreshold =
|
|
63
38
|
(_e = data.batteryLevelPreventStartThreshold) !== null && _e !== void 0 ? _e : this.batteryLevelPreventStartThreshold;
|
|
64
|
-
this.
|
|
65
|
-
|
|
66
|
-
this.
|
|
39
|
+
this.batteryLevelPreventStartAtNightThreshold =
|
|
40
|
+
(_f = data.batteryLevelPreventStartAtNightThreshold) !== null && _f !== void 0 ? _f : this.batteryLevelPreventStartAtNightThreshold;
|
|
41
|
+
this.batteryLevelAllowStartThreshold = (_g = data.batteryLevelAllowStartThreshold) !== null && _g !== void 0 ? _g : this.batteryLevelAllowStartThreshold;
|
|
42
|
+
this.warmWaterDesiredMinTemp = (_h = data.warmWaterDesiredMinTemp) !== null && _h !== void 0 ? _h : this.warmWaterDesiredMinTemp;
|
|
43
|
+
this.winterMinimumHeatStorageTemp = (_j = data.winterMinimumHeatStorageTemp) !== null && _j !== void 0 ? _j : this.winterMinimumHeatStorageTemp;
|
|
67
44
|
this.winterMinimumPreNightHeatStorageTemp =
|
|
68
|
-
(
|
|
45
|
+
(_k = data.winterMinimumPreNightHeatStorageTemp) !== null && _k !== void 0 ? _k : this.winterMinimumPreNightHeatStorageTemp;
|
|
69
46
|
super.fromPartialObject(data);
|
|
70
47
|
}
|
|
71
48
|
toJSON() {
|