hoffmation-base 2.0.1 → 2.0.2

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.
@@ -8,13 +8,13 @@ import { iIdHolder } from '../iIdHolder';
8
8
  export declare class RoomBase implements iRoomBase, iIdHolder {
9
9
  groupMap: Map<GroupType, BaseGroup>;
10
10
  info: RoomInfo;
11
- sonnenAufgangCallback: TimeCallback | undefined;
12
- sonnenUntergangCallback: TimeCallback | undefined;
13
- sonnenAufgangLichtCallback: TimeCallback | undefined;
14
- sonnenUntergangLichtCallback: TimeCallback | undefined;
15
11
  skipNextRolloUp: boolean;
16
12
  settings: RoomSettingsController;
17
13
  constructor(groupMap: Map<GroupType, BaseGroup>, roomName: string, etage?: number);
14
+ get sonnenUntergangLichtCallback(): TimeCallback | undefined;
15
+ get sonnenAufgangLichtCallback(): TimeCallback | undefined;
16
+ get sunriseShutterCallback(): TimeCallback | undefined;
17
+ get sunsetShutterCallback(): TimeCallback | undefined;
18
18
  /**
19
19
  * For Rooms the id is itss name
20
20
  * @returns {string} The Roomname
@@ -19,6 +19,22 @@ class RoomBase {
19
19
  this.settings = new RoomSettings_1.RoomSettingsController(this);
20
20
  server_1.RoomService.addToRoomList(this);
21
21
  }
22
+ get sonnenUntergangLichtCallback() {
23
+ var _a;
24
+ return (_a = this.LampenGroup) === null || _a === void 0 ? void 0 : _a.sonnenUntergangLichtCallback;
25
+ }
26
+ get sonnenAufgangLichtCallback() {
27
+ var _a;
28
+ return (_a = this.LampenGroup) === null || _a === void 0 ? void 0 : _a.sonnenAufgangLichtCallback;
29
+ }
30
+ get sunriseShutterCallback() {
31
+ var _a;
32
+ return (_a = this.WindowGroup) === null || _a === void 0 ? void 0 : _a.sunriseShutterCallback;
33
+ }
34
+ get sunsetShutterCallback() {
35
+ var _a;
36
+ return (_a = this.WindowGroup) === null || _a === void 0 ? void 0 : _a.sunsetShutterCallback;
37
+ }
22
38
  /**
23
39
  * For Rooms the id is itss name
24
40
  * @returns {string} The Roomname
@@ -63,56 +79,23 @@ class RoomBase {
63
79
  return this.info.etage;
64
80
  }
65
81
  initializeBase() {
66
- var _a, _b, _c, _d;
82
+ var _a, _b, _c, _d, _e;
67
83
  this.log(logLevel_1.LogLevel.Debug, `RoomBase Init für ${this.roomName}`);
68
84
  this.recalcTimeCallbacks();
69
85
  (_a = this.PraesenzGroup) === null || _a === void 0 ? void 0 : _a.initCallbacks();
70
86
  (_b = this.WindowGroup) === null || _b === void 0 ? void 0 : _b.initialize();
71
- (_c = this.TasterGroup) === null || _c === void 0 ? void 0 : _c.initCallbacks();
72
- (_d = this.HeatGroup) === null || _d === void 0 ? void 0 : _d.initialize();
73
- if (this.settings.ambientLightAfterSunset && this.settings.lampOffset) {
74
- const cb = new timeCallback_1.TimeCallback(`${this.roomName} Ambient Light after Sunset`, timeCallback_1.TimeCallbackType.SunSet, () => {
75
- var _a;
76
- this.log(logLevel_1.LogLevel.Info, `Draußen wird es dunkel --> Aktiviere Ambientenbeleuchtung`);
77
- (_a = this.LampenGroup) === null || _a === void 0 ? void 0 : _a.switchAll(true);
78
- server_1.Utils.guardedTimeout(() => {
79
- var _a;
80
- this.log(logLevel_1.LogLevel.Info, `Ambientenbeleuchtung um Mitternacht abschalten.`);
81
- (_a = this.LampenGroup) === null || _a === void 0 ? void 0 : _a.switchAll(false);
82
- }, server_1.Utils.timeTilMidnight, this);
83
- }, this.settings.lampOffset.sunset);
84
- this.sonnenUntergangLichtCallback = cb;
85
- server_1.TimeCallbackService.addCallback(cb);
86
- }
87
+ (_c = this.LampenGroup) === null || _c === void 0 ? void 0 : _c.initialize();
88
+ (_d = this.TasterGroup) === null || _d === void 0 ? void 0 : _d.initCallbacks();
89
+ (_e = this.HeatGroup) === null || _e === void 0 ? void 0 : _e.initialize();
87
90
  }
88
91
  persist() {
89
92
  var _a;
90
93
  (_a = server_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.addRoom(this);
91
94
  }
92
95
  recalcTimeCallbacks() {
93
- const now = new Date();
94
- if (this.sonnenAufgangCallback && this.settings.rolloOffset) {
95
- this.sonnenAufgangCallback.minuteOffset = this.settings.rolloOffset.sunrise;
96
- this.sonnenAufgangCallback.sunTimeOffset = this.settings.rolloOffset;
97
- this.sonnenAufgangCallback.recalcNextToDo(now);
98
- }
99
- if (this.sonnenUntergangCallback && this.settings.rolloOffset) {
100
- this.sonnenUntergangCallback.minuteOffset = this.settings.rolloOffset.sunset;
101
- this.sonnenUntergangCallback.sunTimeOffset = this.settings.rolloOffset;
102
- if (this.settings.sonnenUntergangRolloAdditionalOffsetPerCloudiness > 0) {
103
- this.sonnenUntergangCallback.cloudOffset =
104
- server_1.WeatherService.getCurrentCloudiness() * this.settings.sonnenUntergangRolloAdditionalOffsetPerCloudiness;
105
- }
106
- this.sonnenUntergangCallback.recalcNextToDo(now);
107
- }
108
- if (this.sonnenAufgangLichtCallback && this.settings.lampOffset) {
109
- this.sonnenAufgangLichtCallback.minuteOffset = this.settings.lampOffset.sunrise;
110
- this.sonnenAufgangLichtCallback.recalcNextToDo(now);
111
- }
112
- if (this.sonnenUntergangLichtCallback && this.settings.lampOffset) {
113
- this.sonnenUntergangLichtCallback.minuteOffset = this.settings.lampOffset.sunset;
114
- this.sonnenUntergangLichtCallback.recalcNextToDo(now);
115
- }
96
+ var _a, _b;
97
+ (_a = this.WindowGroup) === null || _a === void 0 ? void 0 : _a.recalcTimeCallbacks();
98
+ (_b = this.LampenGroup) === null || _b === void 0 ? void 0 : _b.recalcTimeCallbacks();
116
99
  }
117
100
  /**
118
101
  * Sets the light based on the current time, rollo Position and room Settings
@@ -1,7 +1,7 @@
1
1
  import { TimeCallback } from '../timeCallback';
2
2
  export interface iRoomBase {
3
- sonnenAufgangCallback: TimeCallback | undefined;
4
- sonnenUntergangCallback: TimeCallback | undefined;
3
+ sunriseShutterCallback: TimeCallback | undefined;
4
+ sunsetShutterCallback: TimeCallback | undefined;
5
5
  sonnenAufgangLichtCallback: TimeCallback | undefined;
6
6
  sonnenUntergangLichtCallback: TimeCallback | undefined;
7
7
  skipNextRolloUp: boolean;
@@ -13,7 +13,7 @@ export declare enum TimeOfDay {
13
13
  export declare class TimeCallback {
14
14
  name: string;
15
15
  type: TimeCallbackType;
16
- cFunction: () => void;
16
+ private cFunction;
17
17
  minuteOffset: number;
18
18
  hours?: number | undefined;
19
19
  minutes?: number | undefined;
@@ -23,4 +23,5 @@ export declare class TimeCallback {
23
23
  nextToDo?: Date;
24
24
  constructor(name: string, type: TimeCallbackType, cFunction: () => void, minuteOffset: number, hours?: number | undefined, minutes?: number | undefined, sunTimeOffset?: SunTimeOffsets | undefined, cloudOffset?: number | undefined);
25
25
  recalcNextToDo(now: Date): void;
26
+ perform(): void;
26
27
  }
@@ -84,5 +84,9 @@ class TimeCallback {
84
84
  break;
85
85
  }
86
86
  }
87
+ perform() {
88
+ server_1.ServerLogService.writeLog(logLevel_1.LogLevel.Debug, `Timecallback '${this.name}' fired`);
89
+ this.cFunction();
90
+ }
87
91
  }
88
92
  exports.TimeCallback = TimeCallback;
@@ -1,9 +1,11 @@
1
1
  import { BaseGroup } from './base-group';
2
2
  import { iActuator, iLamp } from '../baseDeviceInterfaces';
3
- import { TimeOfDay } from '../../../models';
3
+ import { TimeCallback, TimeOfDay } from '../../../models';
4
4
  import { WledDevice } from '../wledDevice';
5
5
  import { iLedRgbCct } from '../baseDeviceInterfaces/iLedRgbCct';
6
6
  export declare class LampenGroup extends BaseGroup {
7
+ sonnenAufgangLichtCallback: TimeCallback | undefined;
8
+ sonnenUntergangLichtCallback: TimeCallback | undefined;
7
9
  constructor(roomName: string, lampenIds?: string[], steckerIds?: string[], ledIds?: string[], wledIds?: string[]);
8
10
  anyLightsOn(): boolean;
9
11
  getLampen(): iLamp[];
@@ -17,4 +19,9 @@ export declare class LampenGroup extends BaseGroup {
17
19
  setAllStecker(pValue: boolean, time?: TimeOfDay, force?: boolean): void;
18
20
  setAllLED(pValue: boolean, brightness?: number, color?: string, colortemp?: number): void;
19
21
  setAllWled(pValue: boolean, brightness?: number, preset?: number): void;
22
+ initialize(): void;
23
+ recalcTimeCallbacks(): void;
24
+ toJSON(): Partial<LampenGroup>;
25
+ private reconfigureSunriseTimeCallback;
26
+ private reconfigureSunsetTimeCallback;
20
27
  }
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.LampenGroup = void 0;
4
7
  const services_1 = require("../../services");
@@ -7,6 +10,7 @@ const group_type_1 = require("./group-type");
7
10
  const device_cluster_type_1 = require("../device-cluster-type");
8
11
  const device_list_1 = require("../device-list");
9
12
  const models_1 = require("../../../models");
13
+ const lodash_1 = __importDefault(require("lodash"));
10
14
  class LampenGroup extends base_group_1.BaseGroup {
11
15
  constructor(roomName, lampenIds = [], steckerIds = [], ledIds = [], wledIds = []) {
12
16
  super(roomName, group_type_1.GroupType.Light);
@@ -134,5 +138,66 @@ class LampenGroup extends base_group_1.BaseGroup {
134
138
  w.setWled(pValue, brightness, preset);
135
139
  });
136
140
  }
141
+ initialize() {
142
+ this.recalcTimeCallbacks();
143
+ }
144
+ recalcTimeCallbacks() {
145
+ this.reconfigureSunriseTimeCallback();
146
+ this.reconfigureSunsetTimeCallback();
147
+ }
148
+ toJSON() {
149
+ return services_1.Utils.jsonFilter(lodash_1.default.omit(this, ['_deviceCluster']));
150
+ }
151
+ reconfigureSunriseTimeCallback() {
152
+ const room = this.getRoom();
153
+ if (!room.settings.lichtSonnenAufgangAus || !room.settings.lampOffset) {
154
+ if (this.sonnenAufgangLichtCallback !== undefined) {
155
+ this.log(models_1.LogLevel.Trace, `Remove Sunrise Lamp callback for ${this.roomName}`);
156
+ services_1.TimeCallbackService.removeCallback(this.sonnenAufgangLichtCallback);
157
+ this.sonnenAufgangLichtCallback = undefined;
158
+ }
159
+ return;
160
+ }
161
+ if (this.sonnenAufgangLichtCallback && room.settings.lampOffset) {
162
+ this.sonnenAufgangLichtCallback.minuteOffset = room.settings.lampOffset.sunrise;
163
+ this.sonnenAufgangLichtCallback.recalcNextToDo(new Date());
164
+ }
165
+ if (this.sonnenAufgangLichtCallback === undefined) {
166
+ this.log(models_1.LogLevel.Trace, `Add Sunrise lamp TimeCallback for ${this.roomName}`);
167
+ const cb = new models_1.TimeCallback(`${this.roomName} Morgens Lampe aus`, models_1.TimeCallbackType.Sunrise, () => {
168
+ this.handleSunriseOff();
169
+ }, this.getRoom().settings.lampOffset.sunrise);
170
+ this.sonnenAufgangLichtCallback = cb;
171
+ services_1.TimeCallbackService.addCallback(cb);
172
+ }
173
+ }
174
+ reconfigureSunsetTimeCallback() {
175
+ const room = this.getRoom();
176
+ if (!room.settings.ambientLightAfterSunset || !room.settings.lampOffset) {
177
+ if (this.sonnenUntergangLichtCallback !== undefined) {
178
+ this.log(models_1.LogLevel.Trace, `Remove Sunset Lamp callback for ${this.roomName}`);
179
+ services_1.TimeCallbackService.removeCallback(this.sonnenUntergangLichtCallback);
180
+ this.sonnenUntergangLichtCallback = undefined;
181
+ }
182
+ return;
183
+ }
184
+ if (this.sonnenUntergangLichtCallback && room.settings.lampOffset) {
185
+ this.sonnenUntergangLichtCallback.minuteOffset = room.settings.lampOffset.sunset;
186
+ this.sonnenUntergangLichtCallback.recalcNextToDo(new Date());
187
+ }
188
+ if (this.sonnenUntergangLichtCallback === undefined) {
189
+ this.log(models_1.LogLevel.Trace, `Add Sunset Light TimeCallback for ${this.roomName}`);
190
+ const cb = new models_1.TimeCallback(`${this.roomName} Ambient Light after Sunset`, models_1.TimeCallbackType.SunSet, () => {
191
+ this.log(models_1.LogLevel.Info, `Draußen wird es dunkel --> Aktiviere Ambientenbeleuchtung`);
192
+ this.switchAll(true);
193
+ services_1.Utils.guardedTimeout(() => {
194
+ this.log(models_1.LogLevel.Info, `Ambientenbeleuchtung um Mitternacht abschalten.`);
195
+ this.switchAll(false);
196
+ }, services_1.Utils.timeTilMidnight, this);
197
+ }, this.getRoom().settings.lampOffset.sunset);
198
+ this.sonnenUntergangLichtCallback = cb;
199
+ services_1.TimeCallbackService.addCallback(cb);
200
+ }
201
+ }
137
202
  }
138
203
  exports.LampenGroup = LampenGroup;
@@ -33,14 +33,6 @@ class PraesenzGroup extends base_group_1.BaseGroup {
33
33
  services_1.RoomService.movementHistory.add(`${services_1.Utils.nowString()}: Raum "${this.roomName}" Gerät "${b.info.fullName}"`);
34
34
  });
35
35
  });
36
- if (this.getRoom().settings.lichtSonnenAufgangAus && this.getRoom().settings.lampOffset) {
37
- const cb = new models_1.TimeCallback(`${this.roomName} Morgens Lampe aus`, models_1.TimeCallbackType.Sunrise, () => {
38
- var _a;
39
- (_a = this.getRoom().LampenGroup) === null || _a === void 0 ? void 0 : _a.handleSunriseOff();
40
- }, this.getRoom().settings.lampOffset.sunrise);
41
- this.getRoom().sonnenAufgangLichtCallback = cb;
42
- services_1.TimeCallbackService.addCallback(cb);
43
- }
44
36
  this.addLastLeftCallback(() => {
45
37
  var _a;
46
38
  (_a = this.getRoom().LampenGroup) === null || _a === void 0 ? void 0 : _a.switchAll(false);
@@ -1,15 +1,21 @@
1
+ import { TimeCallback } from '../../../models';
1
2
  import { Window } from './Window';
2
3
  import { BaseGroup } from './base-group';
3
4
  export declare class WindowGroup extends BaseGroup {
4
5
  windows: Window[];
6
+ sunriseShutterCallback: TimeCallback | undefined;
7
+ sunsetShutterCallback: TimeCallback | undefined;
5
8
  constructor(roomName: string, windows: Window[]);
6
9
  allRolloDown(initial?: boolean, savePosition?: boolean): void;
7
10
  allRolloUp(savePosition?: boolean): void;
8
11
  allRolloToLevel(level: number, savePosition?: boolean): void;
9
12
  initialize(): void;
13
+ recalcTimeCallbacks(): void;
10
14
  setRolloByWeatherStatus(): void;
11
15
  sunriseUp(initial?: boolean): void;
12
16
  restoreRolloPosition(recalc?: boolean): void;
13
17
  changeVibrationMotionBlock(block: boolean): void;
14
18
  private sunsetDown;
19
+ private reconfigureSunsetShutterCallback;
20
+ private reconfigureSunriseShutterCallback;
15
21
  }
@@ -36,31 +36,7 @@ class WindowGroup extends base_group_1.BaseGroup {
36
36
  }
37
37
  initialize() {
38
38
  const room = this.getRoom();
39
- if (room.settings.sonnenAufgangRollos && room.settings.rolloOffset) {
40
- this.log(models_1.LogLevel.Trace, `Sonnenaufgang TimeCallback für ${this.roomName} hinzufügen`);
41
- room.sonnenAufgangCallback = new models_1.TimeCallback(`${this.roomName} Sonnenaufgang Rollos`, models_1.TimeCallbackType.Sunrise, () => {
42
- if (room.skipNextRolloUp) {
43
- room.skipNextRolloUp = false;
44
- return;
45
- }
46
- this.sunriseUp();
47
- }, room.settings.rolloOffset.sunrise, undefined, undefined, room.settings.rolloOffset);
48
- if (!services_1.TimeCallbackService.darkOutsideOrNight(services_1.TimeCallbackService.dayType(room.settings.rolloOffset))) {
49
- this.sunriseUp(true);
50
- }
51
- services_1.TimeCallbackService.addCallback(room.sonnenAufgangCallback);
52
- }
53
- if (room.settings.sonnenUntergangRollos && room.settings.rolloOffset) {
54
- room.sonnenUntergangCallback = new models_1.TimeCallback(`${this.roomName} Sonnenuntergang Rollo`, models_1.TimeCallbackType.SunSet, () => {
55
- this.sunsetDown();
56
- }, room.settings.rolloOffset.sunset);
57
- if (services_1.TimeCallbackService.darkOutsideOrNight(services_1.TimeCallbackService.dayType(room.settings.rolloOffset))) {
58
- services_1.Utils.guardedTimeout(() => {
59
- this.allRolloDown(true, true);
60
- }, 60000, this);
61
- }
62
- services_1.TimeCallbackService.addCallback(room.sonnenUntergangCallback);
63
- }
39
+ this.recalcTimeCallbacks();
64
40
  if (room.settings.rolloHeatReduction) {
65
41
  services_1.Utils.guardedInterval(this.setRolloByWeatherStatus, 15 * 60 * 1000, this, false);
66
42
  services_1.Utils.guardedTimeout(this.setRolloByWeatherStatus, 2 * 60 * 1000, this);
@@ -69,6 +45,10 @@ class WindowGroup extends base_group_1.BaseGroup {
69
45
  f.initialize();
70
46
  });
71
47
  }
48
+ recalcTimeCallbacks() {
49
+ this.reconfigureSunriseShutterCallback();
50
+ this.reconfigureSunsetShutterCallback();
51
+ }
72
52
  setRolloByWeatherStatus() {
73
53
  const room = this.getRoom();
74
54
  const timeOfDay = services_1.TimeCallbackService.dayType(room.settings.rolloOffset);
@@ -136,5 +116,66 @@ class WindowGroup extends base_group_1.BaseGroup {
136
116
  (_b = room.LampenGroup) === null || _b === void 0 ? void 0 : _b.switchTimeConditional(services_1.TimeCallbackService.dayType(room.settings.lampOffset));
137
117
  }
138
118
  }
119
+ reconfigureSunsetShutterCallback() {
120
+ const room = this.getRoom();
121
+ if (!room.settings.sonnenUntergangRollos || !room.settings.rolloOffset) {
122
+ if (this.sunsetShutterCallback !== undefined) {
123
+ this.log(models_1.LogLevel.Trace, `Remove Sunset Shutter callback for ${this.roomName}`);
124
+ services_1.TimeCallbackService.removeCallback(this.sunsetShutterCallback);
125
+ this.sunsetShutterCallback = undefined;
126
+ }
127
+ return;
128
+ }
129
+ if (this.sunsetShutterCallback && room.settings.rolloOffset) {
130
+ this.sunsetShutterCallback.minuteOffset = room.settings.rolloOffset.sunset;
131
+ this.sunsetShutterCallback.sunTimeOffset = room.settings.rolloOffset;
132
+ if (room.settings.sonnenUntergangRolloAdditionalOffsetPerCloudiness > 0) {
133
+ this.sunsetShutterCallback.cloudOffset =
134
+ services_1.WeatherService.getCurrentCloudiness() * room.settings.sonnenUntergangRolloAdditionalOffsetPerCloudiness;
135
+ }
136
+ this.sunsetShutterCallback.recalcNextToDo(new Date());
137
+ }
138
+ if (this.sunsetShutterCallback === undefined) {
139
+ this.sunsetShutterCallback = new models_1.TimeCallback(`${this.roomName} Sunset Shutter`, models_1.TimeCallbackType.SunSet, () => {
140
+ this.sunsetDown();
141
+ }, room.settings.rolloOffset.sunset);
142
+ if (services_1.TimeCallbackService.darkOutsideOrNight(services_1.TimeCallbackService.dayType(room.settings.rolloOffset))) {
143
+ services_1.Utils.guardedTimeout(() => {
144
+ this.allRolloDown(true, true);
145
+ }, 60000, this);
146
+ }
147
+ services_1.TimeCallbackService.addCallback(this.sunsetShutterCallback);
148
+ }
149
+ }
150
+ reconfigureSunriseShutterCallback() {
151
+ const room = this.getRoom();
152
+ if (!room.settings.sonnenAufgangRollos || !room.settings.rolloOffset) {
153
+ if (this.sunriseShutterCallback !== undefined) {
154
+ this.log(models_1.LogLevel.Trace, `Remove Sunrise Shutter callback for ${this.roomName}`);
155
+ services_1.TimeCallbackService.removeCallback(this.sunriseShutterCallback);
156
+ this.sunriseShutterCallback = undefined;
157
+ }
158
+ return;
159
+ }
160
+ if (this.sunriseShutterCallback && room.settings.rolloOffset) {
161
+ this.sunriseShutterCallback.minuteOffset = room.settings.rolloOffset.sunrise;
162
+ this.sunriseShutterCallback.sunTimeOffset = room.settings.rolloOffset;
163
+ this.sunriseShutterCallback.recalcNextToDo(new Date());
164
+ }
165
+ if (this.sunriseShutterCallback === undefined) {
166
+ this.log(models_1.LogLevel.Trace, `Add Sunrise shutter TimeCallback for ${this.roomName}`);
167
+ this.sunriseShutterCallback = new models_1.TimeCallback(`${this.roomName} Sonnenaufgang Rollos`, models_1.TimeCallbackType.Sunrise, () => {
168
+ if (room.skipNextRolloUp) {
169
+ room.skipNextRolloUp = false;
170
+ return;
171
+ }
172
+ this.sunriseUp();
173
+ }, room.settings.rolloOffset.sunrise, undefined, undefined, room.settings.rolloOffset);
174
+ if (!services_1.TimeCallbackService.darkOutsideOrNight(services_1.TimeCallbackService.dayType(room.settings.rolloOffset))) {
175
+ this.sunriseUp(true);
176
+ }
177
+ services_1.TimeCallbackService.addCallback(this.sunriseShutterCallback);
178
+ }
179
+ }
139
180
  }
140
181
  exports.WindowGroup = WindowGroup;
@@ -30,8 +30,8 @@ class ShutterService {
30
30
  for (const f of r.WindowGroup.windows) {
31
31
  f.getShutter().forEach((shutter) => {
32
32
  var _a, _b, _c, _d;
33
- response.push(`Rollo: "${shutter.info.customName}"\t${f.noRolloOnSunrise ? 'Hochfahren inaktiv' : (_b = (_a = r.sonnenAufgangCallback) === null || _a === void 0 ? void 0 : _a.nextToDo) === null || _b === void 0 ? void 0 : _b.toLocaleTimeString()}`);
34
- down.push(`Rollo: "${shutter.info.customName}"\t${(_d = (_c = r.sonnenUntergangCallback) === null || _c === void 0 ? void 0 : _c.nextToDo) === null || _d === void 0 ? void 0 : _d.toLocaleTimeString()}`);
33
+ response.push(`Rollo: "${shutter.info.customName}"\t${f.noRolloOnSunrise ? 'Hochfahren inaktiv' : (_b = (_a = r.sunriseShutterCallback) === null || _a === void 0 ? void 0 : _a.nextToDo) === null || _b === void 0 ? void 0 : _b.toLocaleTimeString()}`);
34
+ down.push(`Rollo: "${shutter.info.customName}"\t${(_d = (_c = r.sunsetShutterCallback) === null || _c === void 0 ? void 0 : _c.nextToDo) === null || _d === void 0 ? void 0 : _d.toLocaleTimeString()}`);
35
35
  });
36
36
  }
37
37
  }
@@ -117,12 +117,15 @@ class TimeCallbackService {
117
117
  this._iCheckTimeout = utils_1.Utils.guardedInterval(TimeCallbackService.performCheck.bind(this), 60000);
118
118
  }
119
119
  static addCallback(pCallback) {
120
- TimeCallbackService._callbacks.push(pCallback);
120
+ if (TimeCallbackService._callbacks.has(pCallback.name)) {
121
+ log_service_1.ServerLogService.writeLog(models_1.LogLevel.Info, `Overwriting existing TimeCallback "${pCallback.name}"`);
122
+ }
123
+ TimeCallbackService._callbacks.set(pCallback.name, pCallback);
121
124
  }
122
125
  static performCheck() {
123
126
  log_service_1.ServerLogService.writeLog(models_1.LogLevel.Trace, `Perform TimeCallBackCheck`);
124
127
  const now = new Date();
125
- for (const tc of TimeCallbackService._callbacks) {
128
+ for (const tc of TimeCallbackService._callbacks.values()) {
126
129
  if (tc.nextToDo === undefined || tc.nextToDo < tc.lastDone) {
127
130
  tc.recalcNextToDo(now);
128
131
  }
@@ -130,7 +133,7 @@ class TimeCallbackService {
130
133
  continue;
131
134
  }
132
135
  if (tc.nextToDo < now && tc.nextToDo > TimeCallbackService._lastCheck) {
133
- tc.cFunction();
136
+ tc.perform();
134
137
  tc.lastDone = now;
135
138
  tc.nextToDo = undefined;
136
139
  }
@@ -156,13 +159,11 @@ Next Sunrise: ${TimeCallbackService._nextSunRise.toLocaleString('de-DE')}
156
159
  Next Sunset: ${TimeCallbackService._nextSunSet.toLocaleString('de-DE')}`);
157
160
  }
158
161
  static removeCallback(pCallback) {
159
- for (let i = 0; i < TimeCallbackService._callbacks.length; i++) {
160
- const cb = TimeCallbackService._callbacks[i];
161
- if (cb.name !== pCallback.name) {
162
- continue;
163
- }
164
- TimeCallbackService._callbacks.splice(i, 1);
165
- return;
162
+ if (TimeCallbackService._callbacks.has(pCallback.name)) {
163
+ TimeCallbackService._callbacks.delete(pCallback.name);
164
+ }
165
+ else {
166
+ log_service_1.ServerLogService.writeLog(models_1.LogLevel.Info, `TimeCallback to remove ("${pCallback.name}") doesn't exist.`);
166
167
  }
167
168
  }
168
169
  static updateSunRise(pDay = new Date(), lat, long) {
@@ -176,5 +177,5 @@ Next Sunset: ${TimeCallbackService._nextSunSet.toLocaleString('de-DE')}`);
176
177
  }
177
178
  }
178
179
  exports.TimeCallbackService = TimeCallbackService;
179
- TimeCallbackService._callbacks = [];
180
+ TimeCallbackService._callbacks = new Map();
180
181
  TimeCallbackService._lastCheck = new Date(0);