Skip to content

Commit

Permalink
Don't force initial shutter up, if shutter is e.g. half open due to h…
Browse files Browse the repository at this point in the history
…eat reduction.
  • Loading branch information
theimo1221 committed May 12, 2024
1 parent fd8dd1b commit b060d97
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
## **WORK IN PROGRESS**
* (theimo1221) Update packages
-->
## 3.0.0-alpha.64 (2024-05-12)

* (theimo1221) Fix potentional crash in smart-garden update logic.
## **WORK IN PROGRESS**

* (theimo1221) Don't force initial shutter up, if shutter is e.g. half open due to heat reduction.

## 3.0.0

Expand Down
10 changes: 10 additions & 0 deletions src/server/devices/groups/Window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ export class Window extends BaseGroup {
return this._desiredPosition;
}

/**
* Checks if any shutter is down (0%)
* @returns {boolean} true if any shutter is down
*/
public get anyShutterDown(): boolean {
return this.getShutter().some((s: iShutter) => {
return s.currentLevel === 0;
});
}

public constructor(
roomName: string,
public readonly handleIds: string[] = [],
Expand Down
22 changes: 20 additions & 2 deletions src/server/devices/groups/windowGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ export class WindowGroup extends BaseGroup {
*/
public sunsetShutterCallback: TimeCallback | undefined;

/**
* Checks if any Shutter of any window is down
* @returns {boolean} True if there is atleast one shutte with level of 0%.
*/
public get anyShutterDown(): boolean {
return this.windows.some((w: Window) => {
w.anyShutterDown;
});
}

public constructor(
roomName: string,
public windows: Window[],
Expand Down Expand Up @@ -250,8 +260,16 @@ export class WindowGroup extends BaseGroup {
undefined,
room.settings.rolloOffset,
);
if (!TimeCallbackService.darkOutsideOrNight(TimeCallbackService.dayType(room.settings.rolloOffset))) {
this.sunriseUp(new ShutterSunriseUpCommand(CommandSource.Initial, 'Initial sunrise up as it is day'));
if (
!TimeCallbackService.darkOutsideOrNight(TimeCallbackService.dayType(room.settings.rolloOffset)) &&
this.anyShutterDown
) {
this.sunriseUp(
new ShutterSunriseUpCommand(
CommandSource.Initial,
'Initial sunrise up as it is day and at least 1 shutter is down.',
),
);
}
TimeCallbackService.addCallback(this.sunriseShutterCallback);
}
Expand Down

0 comments on commit b060d97

Please sign in to comment.