hoffmation-base 3.0.0-alpha.91 → 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.
@@ -1,6 +1,5 @@
1
- import { TemperatureSensorChangeAction } from '../../../models';
1
+ import { iJsonOmitKeys, TemperatureSensorChangeAction } from '../../../models';
2
2
  import { iTemperatureSensor } from '../baseDeviceInterfaces';
3
- import { iJsonOmitKeys } from '../../../models/iJsonOmitKeys';
4
3
  export declare class TemperatureSensor implements iJsonOmitKeys {
5
4
  private readonly _device;
6
5
  /** @inheritDoc */
@@ -17,6 +16,7 @@ export declare class TemperatureSensor implements iJsonOmitKeys {
17
16
  private _temperaturCallbacks;
18
17
  constructor(_device: iTemperatureSensor);
19
18
  set temperature(val: number);
19
+ get temperature(): number;
20
20
  /**
21
21
  * Persists the current temperature sensor information to the database
22
22
  */
@@ -28,6 +28,9 @@ class TemperatureSensor {
28
28
  cb(new models_1.TemperatureSensorChangeAction(this._device, val));
29
29
  }
30
30
  }
31
+ get temperature() {
32
+ return this._temperature;
33
+ }
31
34
  /**
32
35
  * Persists the current temperature sensor information to the database
33
36
  */
@@ -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?: number;
17
- snow?: number;
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
  }
@@ -5,6 +5,10 @@ export interface WeatherDaily {
5
5
  dt: number;
6
6
  sunrise: number;
7
7
  sunset: number;
8
+ moonrise: number;
9
+ moonset: number;
10
+ moon_phase: number;
11
+ summary: string;
8
12
  pressure: number;
9
13
  humidity: number;
10
14
  dew_point: number;
@@ -13,4 +13,10 @@ export interface WeatherHourly {
13
13
  wind_deg: number;
14
14
  weather: WeatherItem[];
15
15
  pop: number;
16
+ rain?: {
17
+ '1h': number;
18
+ };
19
+ snow?: {
20
+ '1h': number;
21
+ };
16
22
  }
@@ -206,7 +206,9 @@ class WeatherService {
206
206
  if (!this.appID) {
207
207
  return;
208
208
  }
209
- https_service_1.HTTPSService.request(new HTTPSOptions_1.HTTPSOptions('api.openweathermap.org', `/data/2.5/onecall?lat=${WeatherService.latitude}&lon=${WeatherService.longitude}&appid=${WeatherService.appID}&units=metric&lang=de`, {}, 'GET', 443), '', 5, (response) => {
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() {