hoffmation-base 3.0.0-alpha.13 → 3.0.0-alpha.14
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/command/baseCommand.d.ts +1 -0
- package/lib/models/command/baseCommand.js +6 -0
- package/lib/models/command/dimmerSetLightCommand.js +5 -4
- package/lib/server/devices/sharedFunctions/lampUtils.js +4 -3
- package/lib/server/services/ac/ac-device.js +11 -7
- package/lib/server/services/ac/own-daikin-device.js +10 -2
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -8,6 +8,7 @@ export declare abstract class BaseCommand {
|
|
|
8
8
|
constructor(source?: CommandSource | BaseCommand, reason?: string);
|
|
9
9
|
get isAutomaticAction(): boolean;
|
|
10
10
|
get isForceAction(): boolean;
|
|
11
|
+
get isManual(): boolean;
|
|
11
12
|
get isInitial(): boolean;
|
|
12
13
|
get reasonTrace(): string;
|
|
13
14
|
}
|
|
@@ -20,6 +20,12 @@ class BaseCommand {
|
|
|
20
20
|
}
|
|
21
21
|
return (this.source === commandSource_1.CommandSource.Manual || this.source === commandSource_1.CommandSource.API || this.source === commandSource_1.CommandSource.Force);
|
|
22
22
|
}
|
|
23
|
+
get isManual() {
|
|
24
|
+
if (this.source instanceof BaseCommand) {
|
|
25
|
+
return this.source.isManual;
|
|
26
|
+
}
|
|
27
|
+
return this.source === commandSource_1.CommandSource.Manual || this.source === commandSource_1.CommandSource.API;
|
|
28
|
+
}
|
|
23
29
|
get isInitial() {
|
|
24
30
|
if (this.source instanceof BaseCommand) {
|
|
25
31
|
return this.source.isInitial;
|
|
@@ -23,15 +23,16 @@ class DimmerSetLightCommand extends lampSetLightCommand_1.LampSetLightCommand {
|
|
|
23
23
|
return `Dimmer setLight to ${this.on} for reason: ${this.reasonTrace}`;
|
|
24
24
|
}
|
|
25
25
|
static byTimeBased(s, c) {
|
|
26
|
+
const manual = c.isForceAction;
|
|
26
27
|
switch (c.time) {
|
|
27
28
|
case timeCallback_1.TimeOfDay.Daylight:
|
|
28
|
-
return new DimmerSetLightCommand(c, true, '
|
|
29
|
+
return new DimmerSetLightCommand(c, true, 'Daylight', c.timeout, s.dayBrightness);
|
|
29
30
|
case timeCallback_1.TimeOfDay.BeforeSunrise:
|
|
30
|
-
return new DimmerSetLightCommand(c, s.dawnOn, '', c.timeout, s.dawnBrightness, undefined);
|
|
31
|
+
return new DimmerSetLightCommand(c, manual || s.dawnOn, 'Dawn', c.timeout, s.dawnBrightness, undefined);
|
|
31
32
|
case timeCallback_1.TimeOfDay.AfterSunset:
|
|
32
|
-
return new DimmerSetLightCommand(c, s.duskOn, '', c.timeout, s.duskBrightness, undefined);
|
|
33
|
+
return new DimmerSetLightCommand(c, manual || s.duskOn, 'Dusk', c.timeout, s.duskBrightness, undefined);
|
|
33
34
|
case timeCallback_1.TimeOfDay.Night:
|
|
34
|
-
return new DimmerSetLightCommand(c, s.nightOn, '', c.timeout, s.nightBrightness, undefined);
|
|
35
|
+
return new DimmerSetLightCommand(c, manual || s.nightOn, 'Night', c.timeout, s.nightBrightness, undefined);
|
|
35
36
|
default:
|
|
36
37
|
throw new Error(`TimeOfDay ${c.time} not supported`);
|
|
37
38
|
}
|
|
@@ -16,7 +16,8 @@ class LampUtils {
|
|
|
16
16
|
}, 3000, this);
|
|
17
17
|
}
|
|
18
18
|
static setTimeBased(device, c) {
|
|
19
|
-
if (
|
|
19
|
+
if (c.isManual ||
|
|
20
|
+
(c.time === models_1.TimeOfDay.Night && device.settings.nightOn) ||
|
|
20
21
|
(c.time === models_1.TimeOfDay.BeforeSunrise && device.settings.dawnOn) ||
|
|
21
22
|
(c.time === models_1.TimeOfDay.AfterSunset && device.settings.duskOn)) {
|
|
22
23
|
device.setLight(new models_1.LampSetLightCommand(c, true, `SetLight due to TimeBased ${models_1.TimeOfDay[c.time]}`, c.timeout));
|
|
@@ -42,10 +43,10 @@ class LampUtils {
|
|
|
42
43
|
c.time = services_1.TimeCallbackService.dayType((_a = device.room) === null || _a === void 0 ? void 0 : _a.settings.lampOffset);
|
|
43
44
|
}
|
|
44
45
|
if (newVal && c.time !== undefined) {
|
|
45
|
-
device.setTimeBased(new models_1.LampSetTimeBasedCommand(c, c.time, '
|
|
46
|
+
device.setTimeBased(new models_1.LampSetTimeBasedCommand(c, c.time, '', timeout));
|
|
46
47
|
return true;
|
|
47
48
|
}
|
|
48
|
-
device.setLight(new models_1.LampSetLightCommand(c, newVal, '
|
|
49
|
+
device.setLight(new models_1.LampSetLightCommand(c, newVal, '', timeout));
|
|
49
50
|
return newVal;
|
|
50
51
|
}
|
|
51
52
|
static checkBlockActive(device, c) {
|
|
@@ -52,7 +52,7 @@ class AcDevice {
|
|
|
52
52
|
this._info.customName = `${roomName} ${name}`;
|
|
53
53
|
this._info.room = roomName;
|
|
54
54
|
this._info.allDevicesKey = `ac-${roomName}-${name}`;
|
|
55
|
-
utils_1.Utils.guardedInterval(this.automaticCheck, 5 * 60 * 1000, this,
|
|
55
|
+
utils_1.Utils.guardedInterval(this.automaticCheck, 5 * 60 * 1000, this, false);
|
|
56
56
|
utils_1.Utils.guardedInterval(this.persist, 15 * 60 * 1000, this, true);
|
|
57
57
|
this.persistDeviceInfo();
|
|
58
58
|
this.loadDeviceSettings();
|
|
@@ -97,9 +97,14 @@ class AcDevice {
|
|
|
97
97
|
return this.calculateDesiredMode() !== ac_mode_1.AcMode.Off;
|
|
98
98
|
}
|
|
99
99
|
calculateDesiredMode() {
|
|
100
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
100
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
101
101
|
const acOn = this.on;
|
|
102
|
-
|
|
102
|
+
const heatGroup = (_a = this.room) === null || _a === void 0 ? void 0 : _a.HeatGroup;
|
|
103
|
+
if (!heatGroup) {
|
|
104
|
+
this.log(models_1.LogLevel.Warn, `Can't calculate AC Mode as we have no heat group`);
|
|
105
|
+
return ac_mode_1.AcMode.Off;
|
|
106
|
+
}
|
|
107
|
+
this._desiredTemperatur = heatGroup.desiredTemp;
|
|
103
108
|
if (this.settings.manualDisabled) {
|
|
104
109
|
acOn && this.log(models_1.LogLevel.Info, `We should turn off now, as manual disable force is set.`);
|
|
105
110
|
return ac_mode_1.AcMode.Off;
|
|
@@ -109,7 +114,6 @@ class AcDevice {
|
|
|
109
114
|
acOn && this.log(models_1.LogLevel.Info, `We should turn off now, to respect night settings.`);
|
|
110
115
|
return ac_mode_1.AcMode.Off;
|
|
111
116
|
}
|
|
112
|
-
const heatGroup = (_d = this.room) === null || _d === void 0 ? void 0 : _d.HeatGroup;
|
|
113
117
|
if (this.settings.useOwnTemperatureAndAutomatic) {
|
|
114
118
|
// Device is in automatic mode so ignore energy and room temperature
|
|
115
119
|
if ((heatGroup === null || heatGroup === void 0 ? void 0 : heatGroup.settings.automaticMode) === false) {
|
|
@@ -118,7 +122,7 @@ class AcDevice {
|
|
|
118
122
|
if (settings_service_1.SettingsService.heatMode !== config_1.HeatingMode.Sommer && this.settings.heatingAllowed) {
|
|
119
123
|
return ac_mode_1.AcMode.Heating;
|
|
120
124
|
}
|
|
121
|
-
if (!this.settings.noCoolingOnMovement || ((
|
|
125
|
+
if (!this.settings.noCoolingOnMovement || ((_c = (_b = this.room) === null || _b === void 0 ? void 0 : _b.PraesenzGroup) === null || _c === void 0 ? void 0 : _c.anyPresent()) !== true) {
|
|
122
126
|
return ac_mode_1.AcMode.Cooling;
|
|
123
127
|
}
|
|
124
128
|
return ac_mode_1.AcMode.Off;
|
|
@@ -135,7 +139,7 @@ class AcDevice {
|
|
|
135
139
|
let threshold = acOn ? 0.5 : 1.5;
|
|
136
140
|
let thresholdHeating = acOn ? 0.5 : 1.5;
|
|
137
141
|
let desiredMode = ac_mode_1.AcMode.Off;
|
|
138
|
-
const excessEnergy = (
|
|
142
|
+
const excessEnergy = (_e = (_d = devices_1.Devices.energymanager) === null || _d === void 0 ? void 0 : _d.excessEnergy) !== null && _e !== void 0 ? _e : -1;
|
|
139
143
|
if ((acOn ? 200 : 1000) < excessEnergy) {
|
|
140
144
|
// As there is plenty of energy to spare we plan to overshoot the target by 1 degree
|
|
141
145
|
threshold = -0.5;
|
|
@@ -146,7 +150,7 @@ class AcDevice {
|
|
|
146
150
|
const heatUntil = targetTemp - thresholdHeating;
|
|
147
151
|
if (temp > coolUntil && settings_service_1.SettingsService.heatMode === config_1.HeatingMode.Sommer) {
|
|
148
152
|
desiredMode = ac_mode_1.AcMode.Cooling;
|
|
149
|
-
if (this.settings.noCoolingOnMovement && ((
|
|
153
|
+
if (this.settings.noCoolingOnMovement && ((_g = (_f = this.room) === null || _f === void 0 ? void 0 : _f.PraesenzGroup) === null || _g === void 0 ? void 0 : _g.anyPresent()) === true) {
|
|
150
154
|
return ac_mode_1.AcMode.Off;
|
|
151
155
|
}
|
|
152
156
|
}
|
|
@@ -86,7 +86,15 @@ class OwnDaikinDevice extends ac_device_1.AcDevice {
|
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
setDesiredInfo(retry = false, forceTemp) {
|
|
89
|
-
var _a;
|
|
89
|
+
var _a, _b;
|
|
90
|
+
if (this._desiredTemperatur === devices_1.UNDEFINED_TEMP_VALUE) {
|
|
91
|
+
if (((_a = this.room) === null || _a === void 0 ? void 0 : _a.HeatGroup) === undefined) {
|
|
92
|
+
this.log(models_1.LogLevel.Error, `Neither desired temperature nor HeatGroup is set for ${this.name}(${this.ip})`);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
this._desiredTemperatur = this.room.HeatGroup.desiredTemp;
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
90
98
|
let targetTemp = this._desiredTemperatur;
|
|
91
99
|
if (this.desiredMode == daikin_controller_1.Mode.HOT) {
|
|
92
100
|
targetTemp = this.settings.useOwnTemperatureAndAutomatic ? targetTemp + 1 : 29;
|
|
@@ -100,7 +108,7 @@ class OwnDaikinDevice extends ac_device_1.AcDevice {
|
|
|
100
108
|
targetHumidity: this.desiredHum,
|
|
101
109
|
targetTemperature: forceTemp !== null && forceTemp !== void 0 ? forceTemp : targetTemp,
|
|
102
110
|
};
|
|
103
|
-
(
|
|
111
|
+
(_b = this.device) === null || _b === void 0 ? void 0 : _b.setACControlInfo(changeObject, (err, res) => {
|
|
104
112
|
var _a;
|
|
105
113
|
if (err !== null) {
|
|
106
114
|
log_service_1.ServerLogService.writeLog(models_1.LogLevel.Warn, `Setting Ac Info for ${this.name} failed: ${err} `);
|