hoffmation-base 3.0.0-alpha.92 → 3.0.0-alpha.93
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/server/services/utils/utils.d.ts +1 -1
- package/lib/server/services/utils/utils.js +6 -1
- package/lib/server/services/weather/weather-current.d.ts +7 -3
- package/lib/server/services/weather/weather-daily.d.ts +4 -0
- package/lib/server/services/weather/weather-hourly.d.ts +6 -0
- package/lib/server/services/weather/weather-service.js +4 -2
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ export declare class Utils {
|
|
|
11
11
|
static get anyDboActive(): boolean;
|
|
12
12
|
static get timeTilMidnight(): number;
|
|
13
13
|
static catchEm<T>(promise: Promise<T>): Promise<CatchEmResult<T>>;
|
|
14
|
-
static guardedFunction(func: (...args: unknown[]) => void, thisContext: unknown | undefined): void;
|
|
14
|
+
static guardedFunction(func: (...args: unknown[]) => void, thisContext: unknown | undefined, additionalErrorMsg?: string): void;
|
|
15
15
|
static nowMS(): number;
|
|
16
16
|
static delay(ms: number): Promise<void>;
|
|
17
17
|
static guardedNewThread(func: (...args: unknown[]) => void, thisContext?: unknown | undefined): void;
|
|
@@ -29,7 +29,7 @@ class Utils {
|
|
|
29
29
|
data: null,
|
|
30
30
|
}));
|
|
31
31
|
}
|
|
32
|
-
static guardedFunction(func, thisContext) {
|
|
32
|
+
static guardedFunction(func, thisContext, additionalErrorMsg) {
|
|
33
33
|
try {
|
|
34
34
|
if (thisContext) {
|
|
35
35
|
func.bind(thisContext)();
|
|
@@ -39,6 +39,11 @@ class Utils {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
catch (e) {
|
|
42
|
+
const message = `Guarded Function failed: ${e.message}\n Stack: ${e.stack}`;
|
|
43
|
+
if (additionalErrorMsg) {
|
|
44
|
+
log_service_1.ServerLogService.writeLog(models_1.LogLevel.Error, `${message}\n${additionalErrorMsg}`);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
42
47
|
log_service_1.ServerLogService.writeLog(models_1.LogLevel.Error, `Guarded Function failed: ${e.message}\n Stack: ${e.stack}`);
|
|
43
48
|
}
|
|
44
49
|
}
|
|
@@ -13,11 +13,15 @@ export interface WeatherCurrent {
|
|
|
13
13
|
dew_point: number;
|
|
14
14
|
uvi: number;
|
|
15
15
|
clouds: number;
|
|
16
|
-
rain?:
|
|
17
|
-
|
|
16
|
+
rain?: {
|
|
17
|
+
'1h': number;
|
|
18
|
+
};
|
|
19
|
+
snow?: {
|
|
20
|
+
'1h': number;
|
|
21
|
+
};
|
|
18
22
|
visibility: number;
|
|
19
23
|
wind_speed: number;
|
|
20
24
|
wind_deg: number;
|
|
21
25
|
wind_gust: number;
|
|
22
|
-
weather: WeatherItem
|
|
26
|
+
weather: WeatherItem;
|
|
23
27
|
}
|
|
@@ -206,7 +206,9 @@ class WeatherService {
|
|
|
206
206
|
if (!this.appID) {
|
|
207
207
|
return;
|
|
208
208
|
}
|
|
209
|
-
|
|
209
|
+
const host = 'api.openweathermap.org';
|
|
210
|
+
const path = `/data/3.0/onecall?lat=${WeatherService.latitude}&lon=${WeatherService.longitude}&appid=${WeatherService.appID}&units=metric&lang=de`;
|
|
211
|
+
https_service_1.HTTPSService.request(new HTTPSOptions_1.HTTPSOptions(host, path, {}, 'GET', 443), '', 5, (response) => {
|
|
210
212
|
log_service_1.ServerLogService.writeLog(models_1.LogLevel.Debug, 'WeatherAPi Response erhalten');
|
|
211
213
|
log_service_1.ServerLogService.writeLog(models_1.LogLevel.DeepTrace, `WeatherAPi Response: ${response}`);
|
|
212
214
|
utils_1.Utils.guardedFunction(() => {
|
|
@@ -215,7 +217,7 @@ class WeatherService {
|
|
|
215
217
|
for (const dataUpdateCbsKey in this._dataUpdateCbs) {
|
|
216
218
|
this._dataUpdateCbs[dataUpdateCbsKey]();
|
|
217
219
|
}
|
|
218
|
-
}, this);
|
|
220
|
+
}, this, `Response from Weather API call at https://${host}/${path}: ${response}`);
|
|
219
221
|
});
|
|
220
222
|
}
|
|
221
223
|
static recalcAzimuth() {
|