hoffmation-base 3.0.0-alpha.63 → 3.0.0-alpha.65

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.
@@ -39,8 +39,8 @@ class DeviceUpdater {
39
39
  }
40
40
  else if (idSplit[0] == devices_1.Devices.IDENTIFIER_SMART_GARDEN) {
41
41
  if (idSplit[1] === 'admin' ||
42
- idSplit[2].indexOf('LOCATION') !== 0 ||
43
42
  idSplit.length < 4 ||
43
+ idSplit[2].indexOf('LOCATION') !== 0 ||
44
44
  idSplit[3].indexOf('DEVICE') !== 0) {
45
45
  // This is no update for a smartgarden device
46
46
  return;
@@ -15,6 +15,11 @@ export declare class Window extends BaseGroup {
15
15
  * @returns {number} The level (0 closed, 100 open)
16
16
  */
17
17
  get desiredPosition(): number;
18
+ /**
19
+ * Checks if any shutter is down (0%)
20
+ * @returns {boolean} true if any shutter is down
21
+ */
22
+ get anyShutterDown(): boolean;
18
23
  constructor(roomName: string, handleIds?: string[], vibrationIds?: string[], shutterIds?: string[], magnetIds?: string[]);
19
24
  /**
20
25
  * sets the desired Pos and moves rollo to this level
@@ -16,6 +16,15 @@ class Window extends base_group_1.BaseGroup {
16
16
  get desiredPosition() {
17
17
  return this._desiredPosition;
18
18
  }
19
+ /**
20
+ * Checks if any shutter is down (0%)
21
+ * @returns {boolean} true if any shutter is down
22
+ */
23
+ get anyShutterDown() {
24
+ return this.getShutter().some((s) => {
25
+ return s.currentLevel === 0;
26
+ });
27
+ }
19
28
  constructor(roomName, handleIds = [], vibrationIds = [], shutterIds = [], magnetIds = []) {
20
29
  super(roomName, group_type_1.GroupType.Window);
21
30
  this.handleIds = handleIds;
@@ -15,6 +15,11 @@ export declare class WindowGroup extends BaseGroup {
15
15
  * @warning Manual setting of this callback is not recommended. Prefer {@link recalcTimeCallbacks} after changing settings.
16
16
  */
17
17
  sunsetShutterCallback: TimeCallback | undefined;
18
+ /**
19
+ * Checks if any Shutter of any window is down
20
+ * @returns {boolean} True if there is atleast one shutte with level of 0%.
21
+ */
22
+ get anyShutterDown(): boolean;
18
23
  constructor(roomName: string, windows: Window[]);
19
24
  setDesiredPosition(c: WindowSetDesiredPositionCommand): void;
20
25
  initialize(): void;
@@ -9,6 +9,15 @@ const group_type_1 = require("./group-type");
9
9
  const device_list_1 = require("../device-list");
10
10
  const device_cluster_type_1 = require("../device-cluster-type");
11
11
  class WindowGroup extends base_group_1.BaseGroup {
12
+ /**
13
+ * Checks if any Shutter of any window is down
14
+ * @returns {boolean} True if there is atleast one shutte with level of 0%.
15
+ */
16
+ get anyShutterDown() {
17
+ return this.windows.some((w) => {
18
+ w.anyShutterDown;
19
+ });
20
+ }
12
21
  constructor(roomName, windows) {
13
22
  super(roomName, group_type_1.GroupType.WindowGroup);
14
23
  this.windows = windows;
@@ -172,8 +181,9 @@ class WindowGroup extends base_group_1.BaseGroup {
172
181
  }
173
182
  this.sunriseUp(new models_1.ShutterSunriseUpCommand(models_1.CommandSource.Automatic, 'Time-Callback fired'));
174
183
  }, room.settings.rolloOffset.sunrise, undefined, undefined, room.settings.rolloOffset);
175
- if (!services_1.TimeCallbackService.darkOutsideOrNight(services_1.TimeCallbackService.dayType(room.settings.rolloOffset))) {
176
- this.sunriseUp(new models_1.ShutterSunriseUpCommand(models_1.CommandSource.Initial, 'Initial sunrise up as it is day'));
184
+ if (!services_1.TimeCallbackService.darkOutsideOrNight(services_1.TimeCallbackService.dayType(room.settings.rolloOffset)) &&
185
+ this.anyShutterDown) {
186
+ this.sunriseUp(new models_1.ShutterSunriseUpCommand(models_1.CommandSource.Initial, 'Initial sunrise up as it is day and at least 1 shutter is down.'));
177
187
  }
178
188
  services_1.TimeCallbackService.addCallback(this.sunriseShutterCallback);
179
189
  }
@@ -52,8 +52,14 @@ class ioBrokerMain {
52
52
  this.connectionCallbacks.onUpdate = (id, state) => {
53
53
  services_1.Utils.guardedNewThread(() => {
54
54
  // console.log('NEW VALUE of ' + id + ': ' + JSON.stringify(state));
55
- this.states[id] = state;
56
- this.deviceUpdater.updateState(id, state);
55
+ try {
56
+ this.states[id] = state;
57
+ this.deviceUpdater.updateState(id, state);
58
+ }
59
+ catch (e) {
60
+ services_1.ServerLogService.writeLog(models_1.LogLevel.Alert, `Update of state (${id}) to ${state} failed: ${e}`);
61
+ return;
62
+ }
57
63
  }, this);
58
64
  };
59
65
  this.connectionCallbacks.onError = (err) => {