hoffmation-base 3.2.10-alpha.4 → 3.2.10-alpha.6
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.
|
@@ -23,6 +23,14 @@ export declare class WeatherService {
|
|
|
23
23
|
private static latitude;
|
|
24
24
|
private static longitude;
|
|
25
25
|
private static appID?;
|
|
26
|
+
/**
|
|
27
|
+
* The highest maximum temperature forecast for today (prevents oscillation)
|
|
28
|
+
*/
|
|
29
|
+
private static _todayMaxMaxTemperature;
|
|
30
|
+
/**
|
|
31
|
+
* The date of the last weather update (for daily reset)
|
|
32
|
+
*/
|
|
33
|
+
private static _lastUpdateDate;
|
|
26
34
|
static addWeatherUpdateCb(name: string, cb: () => void): void;
|
|
27
35
|
static get todayMaxTemp(): number;
|
|
28
36
|
static get todayCloudiness(): number | undefined;
|
|
@@ -31,6 +39,11 @@ export declare class WeatherService {
|
|
|
31
39
|
static stopInterval(): void;
|
|
32
40
|
static playWeatherInfo(speaker: iSpeaker, volume?: number, short?: boolean, retries?: number): void;
|
|
33
41
|
static processHourlyWeather(response: WeatherResponse): void;
|
|
42
|
+
/**
|
|
43
|
+
* Updates the daily maximum temperature to prevent shutter oscillation
|
|
44
|
+
* Tracks the highest forecasted maximum temperature for today
|
|
45
|
+
*/
|
|
46
|
+
private static updateDailyMaxTemperature;
|
|
34
47
|
static get currentHumidity(): number;
|
|
35
48
|
static get currentTemp(): number;
|
|
36
49
|
static willOutsideBeWarmer(referenceTemperature: number, logger: (level: LogLevel, message: string, debugType?: LogDebugType) => void): boolean;
|
|
@@ -18,7 +18,9 @@ class WeatherService {
|
|
|
18
18
|
}
|
|
19
19
|
static get todayMaxTemp() {
|
|
20
20
|
var _a, _b, _c;
|
|
21
|
-
return
|
|
21
|
+
return this._todayMaxMaxTemperature !== interfaces_1.UNDEFINED_TEMP_VALUE
|
|
22
|
+
? this._todayMaxMaxTemperature
|
|
23
|
+
: ((_c = (_b = (_a = WeatherService.lastResponse) === null || _a === void 0 ? void 0 : _a.daily[0]) === null || _b === void 0 ? void 0 : _b.temp.max) !== null && _c !== void 0 ? _c : interfaces_1.UNDEFINED_TEMP_VALUE);
|
|
22
24
|
}
|
|
23
25
|
static get todayCloudiness() {
|
|
24
26
|
var _a, _b;
|
|
@@ -111,6 +113,8 @@ class WeatherService {
|
|
|
111
113
|
}
|
|
112
114
|
static processHourlyWeather(response) {
|
|
113
115
|
this.lastResponse = response;
|
|
116
|
+
// Update daily maximum temperature to prevent shutter oscillation
|
|
117
|
+
this.updateDailyMaxTemperature();
|
|
114
118
|
logging_1.ServerLogService.writeLog(enums_1.LogLevel.Info, `Es sind gerade ${this.lastResponse.current.temp} Grad (gefühlt ${this.lastResponse.current.feels_like}).`);
|
|
115
119
|
if (this.lastResponse.alerts !== undefined && this.lastResponse.alerts.length > 0) {
|
|
116
120
|
const message = ['Es gibt folgende Wetterwarnungen:'];
|
|
@@ -120,6 +124,24 @@ class WeatherService {
|
|
|
120
124
|
logging_1.ServerLogService.writeLog(enums_1.LogLevel.Info, message.join('\n'));
|
|
121
125
|
}
|
|
122
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* Updates the daily maximum temperature to prevent shutter oscillation
|
|
129
|
+
* Tracks the highest forecasted maximum temperature for today
|
|
130
|
+
*/
|
|
131
|
+
static updateDailyMaxTemperature() {
|
|
132
|
+
var _a, _b, _c, _d;
|
|
133
|
+
if (!((_d = (_c = (_b = (_a = this.lastResponse) === null || _a === void 0 ? void 0 : _a.daily) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.temp) === null || _d === void 0 ? void 0 : _d.max)) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const today = new Date().toDateString();
|
|
137
|
+
const currentForecastMax = this.lastResponse.daily[0].temp.max;
|
|
138
|
+
if (this._lastUpdateDate === today && currentForecastMax < this._todayMaxMaxTemperature) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
this._todayMaxMaxTemperature = currentForecastMax;
|
|
142
|
+
this._lastUpdateDate = today;
|
|
143
|
+
logging_1.ServerLogService.writeLog(enums_1.LogLevel.Debug, `Daily max temperature updated to ${currentForecastMax}°C`);
|
|
144
|
+
}
|
|
123
145
|
static get currentHumidity() {
|
|
124
146
|
var _a;
|
|
125
147
|
if (((_a = WeatherService.lastResponse) === null || _a === void 0 ? void 0 : _a.current) === undefined) {
|
|
@@ -147,7 +169,7 @@ class WeatherService {
|
|
|
147
169
|
}
|
|
148
170
|
static weatherRolloPosition(normalPos, desiredTemperatur, currentTemperatur, logger, shutterSettings) {
|
|
149
171
|
let result = normalPos;
|
|
150
|
-
if (currentTemperatur < desiredTemperatur && currentTemperatur < shutterSettings.
|
|
172
|
+
if (currentTemperatur < desiredTemperatur && currentTemperatur < shutterSettings.heatReductionDirectionThreshold) {
|
|
151
173
|
logger(enums_1.LogLevel.Trace, 'RolloWeatherPosition: Room needs to heat up anyways.');
|
|
152
174
|
return result;
|
|
153
175
|
}
|
|
@@ -155,8 +177,7 @@ class WeatherService {
|
|
|
155
177
|
logger(enums_1.LogLevel.Trace, 'RolloWeatherPosition: Shutter should be down anyways.');
|
|
156
178
|
return result;
|
|
157
179
|
}
|
|
158
|
-
else if (this.willOutsideBeWarmer(shutterSettings.heatReductionThreshold, logger)
|
|
159
|
-
currentTemperatur > shutterSettings.heatReductionDirectionThreshold) {
|
|
180
|
+
else if (this.willOutsideBeWarmer(shutterSettings.heatReductionThreshold, logger)) {
|
|
160
181
|
result = shutterSettings.heatReductionPosition;
|
|
161
182
|
}
|
|
162
183
|
else if (this.hoursTilSunset() < 1) {
|
|
@@ -265,3 +286,11 @@ WeatherService.active = false;
|
|
|
265
286
|
*/
|
|
266
287
|
WeatherService.oneDay = 1000 * 60 * 60 * 24;
|
|
267
288
|
WeatherService._dataUpdateCbs = {};
|
|
289
|
+
/**
|
|
290
|
+
* The highest maximum temperature forecast for today (prevents oscillation)
|
|
291
|
+
*/
|
|
292
|
+
WeatherService._todayMaxMaxTemperature = interfaces_1.UNDEFINED_TEMP_VALUE;
|
|
293
|
+
/**
|
|
294
|
+
* The date of the last weather update (for daily reset)
|
|
295
|
+
*/
|
|
296
|
+
WeatherService._lastUpdateDate = '';
|