hoffmation-base 3.0.0-alpha.64 → 3.0.0-alpha.66

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.
@@ -3,6 +3,7 @@ import { CommandSource } from './commandSource';
3
3
  import { CommandType } from './commandType';
4
4
  export declare class WindowSetDesiredPositionCommand extends BaseCommand {
5
5
  readonly position: number;
6
+ readonly applyNewPosition: boolean;
6
7
  /** @inheritDoc */
7
8
  type: CommandType;
8
9
  /**
@@ -10,6 +11,7 @@ export declare class WindowSetDesiredPositionCommand extends BaseCommand {
10
11
  * @param source - The source of the command
11
12
  * @param position - The desired position of the shutter (0 closed, 100 open)
12
13
  * @param reason - You can provide a reason for clarification
14
+ * @param applyNewPosition - Whether this new position should be applied immediately
13
15
  */
14
- constructor(source: CommandSource | BaseCommand, position: number, reason?: string);
16
+ constructor(source: CommandSource | BaseCommand, position: number, reason?: string, applyNewPosition?: boolean);
15
17
  }
@@ -9,10 +9,12 @@ class WindowSetDesiredPositionCommand extends baseCommand_1.BaseCommand {
9
9
  * @param source - The source of the command
10
10
  * @param position - The desired position of the shutter (0 closed, 100 open)
11
11
  * @param reason - You can provide a reason for clarification
12
+ * @param applyNewPosition - Whether this new position should be applied immediately
12
13
  */
13
- constructor(source, position, reason = '') {
14
+ constructor(source, position, reason = '', applyNewPosition = true) {
14
15
  super(source, reason);
15
16
  this.position = position;
17
+ this.applyNewPosition = applyNewPosition;
16
18
  /** @inheritDoc */
17
19
  this.type = commandType_1.CommandType.WindowSetDesiredPositionCommand;
18
20
  }
@@ -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;
@@ -173,7 +182,13 @@ class WindowGroup extends base_group_1.BaseGroup {
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
184
  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'));
185
+ if (!this.anyShutterDown) {
186
+ // Only set new desired position without applying it.
187
+ this.setDesiredPosition(new models_1.WindowSetDesiredPositionCommand(models_1.CommandSource.Initial, 100, 'It is daytime during restart.', false));
188
+ }
189
+ else {
190
+ this.sunriseUp(new models_1.ShutterSunriseUpCommand(models_1.CommandSource.Initial, 'Initial sunrise up as it is day and at least 1 shutter is down.'));
191
+ }
177
192
  }
178
193
  services_1.TimeCallbackService.addCallback(this.sunriseShutterCallback);
179
194
  }
@@ -43,7 +43,7 @@ class SmartGardenMower extends smartGardenDevice_1.SmartGardenDevice {
43
43
  const stateName = idSplit[5];
44
44
  if (folder.indexOf('SERVICE_MOWER') === 0) {
45
45
  switch (stateName) {
46
- case 'activity_value':
46
+ case 'activity_moving_i':
47
47
  this._actuatorOn = state.val;
48
48
  this.persist();
49
49
  break;