hoffmation-base 3.2.31 → 3.3.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.
- package/lib/devices/groups/Window.js +1 -1
- package/lib/devices/groups/windowGroup.js +3 -3
- package/lib/devices/sharedFunctions/lampUtils.js +2 -2
- package/lib/devices/unifi/unifi-access.js +1 -1
- package/lib/devices/unifi/unifi-protect.js +1 -1
- package/lib/interfaces/iRoomSettings.d.ts +8 -0
- package/lib/interfaces/iRoomSettingsController.d.ts +8 -0
- package/lib/models/rooms/RoomSettings/RoomSettingsController.d.ts +2 -0
- package/lib/models/rooms/RoomSettings/RoomSettingsController.js +6 -0
- package/lib/models/rooms/RoomSettings/roomSettings.d.ts +4 -0
- package/lib/models/rooms/RoomSettings/roomSettings.js +17 -15
- package/lib/models/timeCallback.d.ts +1 -0
- package/lib/models/timeCallback.js +7 -0
- package/lib/services/RoomBase.d.ts +3 -2
- package/lib/services/RoomBase.js +17 -3
- package/lib/services/Sonos/sonos-service.js +1 -1
- package/lib/services/time-callback-service.d.ts +2 -2
- package/lib/services/time-callback-service.js +3 -3
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -18
|
@@ -86,7 +86,7 @@ class Window extends base_group_1.BaseGroup {
|
|
|
86
86
|
this.getVibration().forEach((element) => {
|
|
87
87
|
element.vibrationBlockedByHandle = true;
|
|
88
88
|
});
|
|
89
|
-
const timeOfDay = services_1.TimeCallbackService.dayType(this.getRoom().settings.rolloOffset);
|
|
89
|
+
const timeOfDay = services_1.TimeCallbackService.dayType(this.getRoom().settings.rolloOffset, new Date(), this.getRoom().settings.nightStart, this.getRoom().settings.nightEnd);
|
|
90
90
|
(_a = this.getShutter()) === null || _a === void 0 ? void 0 : _a.setLevel(new command_1.ShutterSetLevelCommand(enums_1.CommandSource.Force, services_1.TimeCallbackService.darkOutsideOrNight(timeOfDay) ? 50 : 100, 'Window ajar by handle'));
|
|
91
91
|
});
|
|
92
92
|
griff.addOffenCallback((offen) => {
|
|
@@ -80,7 +80,7 @@ class WindowGroup extends base_group_1.BaseGroup {
|
|
|
80
80
|
}
|
|
81
81
|
setRolloByWeatherStatus(c) {
|
|
82
82
|
const room = this.getRoom();
|
|
83
|
-
const timeOfDay = services_1.TimeCallbackService.dayType(room.settings.rolloOffset);
|
|
83
|
+
const timeOfDay = services_1.TimeCallbackService.dayType(room.settings.rolloOffset, new Date(), room.settings.nightStart, room.settings.nightEnd);
|
|
84
84
|
const darkOutside = services_1.TimeCallbackService.darkOutsideOrNight(timeOfDay);
|
|
85
85
|
this.windows.forEach((f) => {
|
|
86
86
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
@@ -176,7 +176,7 @@ class WindowGroup extends base_group_1.BaseGroup {
|
|
|
176
176
|
this.sunsetShutterCallback = new models_1.TimeCallback(`${this.roomName} Sunset Shutter`, enums_1.TimeCallbackType.SunSet, () => {
|
|
177
177
|
this.sunsetDown(new command_1.ShutterSunsetDownCommand(enums_1.CommandSource.Automatic, 'Time-Callback fired'));
|
|
178
178
|
}, room.settings.rolloOffset.sunset);
|
|
179
|
-
if (services_1.TimeCallbackService.darkOutsideOrNight(services_1.TimeCallbackService.dayType(room.settings.rolloOffset))) {
|
|
179
|
+
if (services_1.TimeCallbackService.darkOutsideOrNight(services_1.TimeCallbackService.dayType(room.settings.rolloOffset, new Date(), room.settings.nightStart, room.settings.nightEnd))) {
|
|
180
180
|
utils_1.Utils.guardedTimeout(() => {
|
|
181
181
|
this.setWindowShutterBaseAutomaticLevel(0);
|
|
182
182
|
this.setDesiredPosition(new command_1.WindowSetDesiredPositionCommand(enums_1.CommandSource.Initial, 0, 'It is dark outside'));
|
|
@@ -219,7 +219,7 @@ class WindowGroup extends base_group_1.BaseGroup {
|
|
|
219
219
|
}
|
|
220
220
|
this.sunriseUp(new command_1.ShutterSunriseUpCommand(enums_1.CommandSource.Automatic, 'Time-Callback fired'));
|
|
221
221
|
}, room.settings.rolloOffset.sunrise, undefined, undefined, room.settings.rolloOffset);
|
|
222
|
-
if (!services_1.TimeCallbackService.darkOutsideOrNight(services_1.TimeCallbackService.dayType(room.settings.rolloOffset))) {
|
|
222
|
+
if (!services_1.TimeCallbackService.darkOutsideOrNight(services_1.TimeCallbackService.dayType(room.settings.rolloOffset, new Date(), room.settings.nightStart, room.settings.nightEnd))) {
|
|
223
223
|
if (!this.anyShutterDown) {
|
|
224
224
|
// Only set new desired position without applying it.
|
|
225
225
|
this.setDesiredPosition(new command_1.WindowSetDesiredPositionCommand(enums_1.CommandSource.Initial, 100, 'It is daytime during restart.', false));
|
|
@@ -47,10 +47,10 @@ class LampUtils {
|
|
|
47
47
|
return dontBlock;
|
|
48
48
|
}
|
|
49
49
|
static toggleLight(device, c) {
|
|
50
|
-
var _a;
|
|
50
|
+
var _a, _b, _c;
|
|
51
51
|
const newVal = device.queuedValue !== null ? !device.queuedValue : !device.actuatorOn;
|
|
52
52
|
if (newVal && c.time === undefined && c.calculateTime && device.room !== undefined) {
|
|
53
|
-
c.time = services_1.TimeCallbackService.dayType((_a = device.room) === null || _a === void 0 ? void 0 : _a.settings.lampOffset);
|
|
53
|
+
c.time = services_1.TimeCallbackService.dayType((_a = device.room) === null || _a === void 0 ? void 0 : _a.settings.lampOffset, new Date(), (_b = device.room) === null || _b === void 0 ? void 0 : _b.settings.nightStart, (_c = device.room) === null || _c === void 0 ? void 0 : _c.settings.nightEnd);
|
|
54
54
|
}
|
|
55
55
|
if (newVal && c.time !== undefined) {
|
|
56
56
|
device.setTimeBased(new command_1.LampSetTimeBasedCommand(c, c.time, '', c.isForceAction ? undefined : null));
|
|
@@ -85,7 +85,7 @@ class UnifiAccess {
|
|
|
85
85
|
// }
|
|
86
86
|
}
|
|
87
87
|
initializeDevice(data) {
|
|
88
|
-
if (!UnifiAccess.ownDoors.has(data.alias)) {
|
|
88
|
+
if (!data.alias || !UnifiAccess.ownDoors.has(data.alias)) {
|
|
89
89
|
logging_1.ServerLogService.writeLog(enums_1.LogLevel.Info, `Unifi-Protect: Ignoring camera ${data.name}`);
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
@@ -100,7 +100,7 @@ class UnifiProtect {
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
initializeCamera(data) {
|
|
103
|
-
if (!UnifiProtect.ownCameras.has(data.name)) {
|
|
103
|
+
if (!data.name || !UnifiProtect.ownCameras.has(data.name)) {
|
|
104
104
|
logging_1.ServerLogService.writeLog(enums_1.LogLevel.Info, `Unifi-Protect: Ignoring camera ${data.name}`);
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
@@ -33,6 +33,14 @@ export interface iRoomSettings extends iObjectSettings {
|
|
|
33
33
|
*
|
|
34
34
|
*/
|
|
35
35
|
movementResetTimer: number;
|
|
36
|
+
/**
|
|
37
|
+
* The custom start of night for this room
|
|
38
|
+
*/
|
|
39
|
+
nightStart?: iTimePair;
|
|
40
|
+
/**
|
|
41
|
+
* The custom end of night for this room
|
|
42
|
+
*/
|
|
43
|
+
nightEnd?: iTimePair;
|
|
36
44
|
/**
|
|
37
45
|
*
|
|
38
46
|
*/
|
|
@@ -63,6 +63,14 @@ export interface iRoomSettingsController extends iRoomDefaultSettings {
|
|
|
63
63
|
*
|
|
64
64
|
*/
|
|
65
65
|
readonly movementResetTimer: number;
|
|
66
|
+
/**
|
|
67
|
+
* The custom start of night for this room
|
|
68
|
+
*/
|
|
69
|
+
readonly nightStart?: iTimePair;
|
|
70
|
+
/**
|
|
71
|
+
* The custom end of night for this room
|
|
72
|
+
*/
|
|
73
|
+
readonly nightEnd?: iTimePair;
|
|
66
74
|
/**
|
|
67
75
|
*
|
|
68
76
|
*/
|
|
@@ -28,6 +28,8 @@ export declare class RoomSettingsController {
|
|
|
28
28
|
get lampenBeiBewegung(): boolean;
|
|
29
29
|
get sonnenUntergangRollos(): boolean;
|
|
30
30
|
get movementResetTimer(): number;
|
|
31
|
+
get nightStart(): iTimePair | undefined;
|
|
32
|
+
get nightEnd(): iTimePair | undefined;
|
|
31
33
|
get sonnenUntergangRolloDelay(): number;
|
|
32
34
|
get sonnenUntergangLampenDelay(): number;
|
|
33
35
|
get sonnenUntergangRolloAdditionalOffsetPerCloudiness(): number;
|
|
@@ -63,6 +63,12 @@ class RoomSettingsController {
|
|
|
63
63
|
get movementResetTimer() {
|
|
64
64
|
return this._settingsContainer.movementResetTimer;
|
|
65
65
|
}
|
|
66
|
+
get nightStart() {
|
|
67
|
+
return this._settingsContainer.nightStart;
|
|
68
|
+
}
|
|
69
|
+
get nightEnd() {
|
|
70
|
+
return this._settingsContainer.nightEnd;
|
|
71
|
+
}
|
|
66
72
|
get sonnenUntergangRolloDelay() {
|
|
67
73
|
return this._settingsContainer.sonnenUntergangRolloDelay;
|
|
68
74
|
}
|
|
@@ -29,6 +29,10 @@ export declare class RoomSettings extends ObjectSettings implements iRoomSetting
|
|
|
29
29
|
* Time in seconds after which detected movement is reseted
|
|
30
30
|
*/
|
|
31
31
|
movementResetTimer: number;
|
|
32
|
+
/** @inheritDoc */
|
|
33
|
+
nightStart?: iTimePair;
|
|
34
|
+
/** @inheritDoc */
|
|
35
|
+
nightEnd?: iTimePair;
|
|
32
36
|
/**
|
|
33
37
|
* Indicates rooms, which are time independent always dark (like basement).
|
|
34
38
|
* This results in lamps beeing turned on at motion regardless of windows and time.
|
|
@@ -82,29 +82,31 @@ class RoomSettings extends settingsObjects_1.ObjectSettings {
|
|
|
82
82
|
this.includeLampsInNormalMovementLightning = settings_service_1.SettingsService.settings.roomDefault.includeLampsInNormalMovementLightning;
|
|
83
83
|
}
|
|
84
84
|
fromPartialObject(_obj) {
|
|
85
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
85
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
86
86
|
this.ambientLightAfterSunset = (_a = _obj.ambientLightAfterSunset) !== null && _a !== void 0 ? _a : this.ambientLightAfterSunset;
|
|
87
87
|
this.lichtSonnenAufgangAus = (_b = _obj.lichtSonnenAufgangAus) !== null && _b !== void 0 ? _b : this.lichtSonnenAufgangAus;
|
|
88
88
|
this.radioUrl = (_c = _obj.radioUrl) !== null && _c !== void 0 ? _c : this.radioUrl;
|
|
89
89
|
this.rolloHeatReduction = (_d = _obj.rolloHeatReduction) !== null && _d !== void 0 ? _d : this.rolloHeatReduction;
|
|
90
90
|
this.lampenBeiBewegung = (_e = _obj.lampenBeiBewegung) !== null && _e !== void 0 ? _e : this.lampenBeiBewegung;
|
|
91
91
|
this.lightIfNoWindows = (_f = _obj.lightIfNoWindows) !== null && _f !== void 0 ? _f : this.lightIfNoWindows;
|
|
92
|
-
this.
|
|
93
|
-
this.
|
|
94
|
-
this.
|
|
95
|
-
this.
|
|
96
|
-
this.
|
|
92
|
+
this.nightStart = (_g = _obj.nightStart) !== null && _g !== void 0 ? _g : this.nightStart;
|
|
93
|
+
this.nightEnd = (_h = _obj.nightEnd) !== null && _h !== void 0 ? _h : this.nightEnd;
|
|
94
|
+
this.movementResetTimer = (_j = _obj.movementResetTimer) !== null && _j !== void 0 ? _j : this.movementResetTimer;
|
|
95
|
+
this.roomIsAlwaysDark = (_k = _obj.roomIsAlwaysDark) !== null && _k !== void 0 ? _k : this.roomIsAlwaysDark;
|
|
96
|
+
this.sonnenAufgangLampenDelay = (_l = _obj.sonnenAufgangLampenDelay) !== null && _l !== void 0 ? _l : this.sonnenAufgangLampenDelay;
|
|
97
|
+
this.sonnenAufgangRolloDelay = (_m = _obj.sonnenAufgangRolloDelay) !== null && _m !== void 0 ? _m : this.sonnenAufgangRolloDelay;
|
|
98
|
+
this.sonnenAufgangRollos = (_o = _obj.sonnenAufgangRollos) !== null && _o !== void 0 ? _o : this.sonnenAufgangRollos;
|
|
97
99
|
this.sonnenUntergangRolloAdditionalOffsetPerCloudiness =
|
|
98
|
-
(
|
|
99
|
-
this.sonnenUntergangRolloMaxTime = (
|
|
100
|
-
this.sonnenAufgangRolloMinTime = (
|
|
101
|
-
this.sonnenUntergangRolloDelay = (
|
|
102
|
-
this.sonnenUntergangLampenDelay = (
|
|
103
|
-
this.sonnenUntergangRollos = (
|
|
104
|
-
this.trilaterationEndPoint = (
|
|
105
|
-
this.trilaterationStartPoint = (
|
|
100
|
+
(_p = _obj.sonnenUntergangRolloAdditionalOffsetPerCloudiness) !== null && _p !== void 0 ? _p : this.sonnenUntergangRolloAdditionalOffsetPerCloudiness;
|
|
101
|
+
this.sonnenUntergangRolloMaxTime = (_q = _obj.sonnenUntergangRolloMaxTime) !== null && _q !== void 0 ? _q : this.sonnenUntergangRolloMaxTime;
|
|
102
|
+
this.sonnenAufgangRolloMinTime = (_r = _obj.sonnenAufgangRolloMinTime) !== null && _r !== void 0 ? _r : this.sonnenAufgangRolloMinTime;
|
|
103
|
+
this.sonnenUntergangRolloDelay = (_s = _obj.sonnenUntergangRolloDelay) !== null && _s !== void 0 ? _s : this.sonnenUntergangRolloDelay;
|
|
104
|
+
this.sonnenUntergangLampenDelay = (_t = _obj.sonnenUntergangLampenDelay) !== null && _t !== void 0 ? _t : this.sonnenUntergangLampenDelay;
|
|
105
|
+
this.sonnenUntergangRollos = (_u = _obj.sonnenUntergangRollos) !== null && _u !== void 0 ? _u : this.sonnenUntergangRollos;
|
|
106
|
+
this.trilaterationEndPoint = (_v = _obj.trilaterationEndPoint) !== null && _v !== void 0 ? _v : this.trilaterationEndPoint;
|
|
107
|
+
this.trilaterationStartPoint = (_w = _obj.trilaterationStartPoint) !== null && _w !== void 0 ? _w : this.trilaterationStartPoint;
|
|
106
108
|
this.includeLampsInNormalMovementLightning =
|
|
107
|
-
(
|
|
109
|
+
(_x = _obj.includeLampsInNormalMovementLightning) !== null && _x !== void 0 ? _x : this.includeLampsInNormalMovementLightning;
|
|
108
110
|
super.fromPartialObject(_obj);
|
|
109
111
|
}
|
|
110
112
|
}
|
|
@@ -25,4 +25,5 @@ export declare class TimeCallback implements ITimeCallback {
|
|
|
25
25
|
constructor(name: string, type: TimeCallbackType, cFunction: () => void, minuteOffset: number, hours?: number | undefined, minutes?: number | undefined, sunTimeOffset?: SunTimeOffsets | undefined, cloudOffset?: number | undefined);
|
|
26
26
|
recalcNextToDo(now: Date): void;
|
|
27
27
|
perform(now?: Date): void;
|
|
28
|
+
toJSON(): Partial<TimeCallback>;
|
|
28
29
|
}
|
|
@@ -1,10 +1,14 @@
|
|
|
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.TimeCallback = void 0;
|
|
4
7
|
const enums_1 = require("../enums");
|
|
5
8
|
const services_1 = require("../services");
|
|
6
9
|
const utils_1 = require("../utils");
|
|
7
10
|
const logging_1 = require("../logging");
|
|
11
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
8
12
|
class TimeCallback {
|
|
9
13
|
get calculationSunrise() {
|
|
10
14
|
var _a;
|
|
@@ -112,5 +116,8 @@ class TimeCallback {
|
|
|
112
116
|
this._calculationSunset = undefined;
|
|
113
117
|
this.cFunction();
|
|
114
118
|
}
|
|
119
|
+
toJSON() {
|
|
120
|
+
return utils_1.Utils.jsonFilter(lodash_1.default.omit(this, ['cFunction']));
|
|
121
|
+
}
|
|
115
122
|
}
|
|
116
123
|
exports.TimeCallback = TimeCallback;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseGroup, DeviceCluster, HeatGroup, TasterGroup, WaterGroup } from '../devices';
|
|
2
2
|
import { RoomSetLightTimeBasedCommand } from '../command';
|
|
3
|
-
import { iIdHolder, iLightGroup, iPresenceGroup, iRoomBase, iSmokeGroup, iSpeakerGroup, ITimeCallback, iTrilaterationPoint, iWindowGroup } from '../interfaces';
|
|
3
|
+
import { iIdHolder, iJsonCustomPrepend, iLightGroup, iPresenceGroup, iRoomBase, iSmokeGroup, iSpeakerGroup, ITimeCallback, iTrilaterationPoint, iWindowGroup } from '../interfaces';
|
|
4
4
|
import { GroupType, LogLevel } from '../enums';
|
|
5
5
|
import { RoomInfo, RoomSettingsController } from '../models';
|
|
6
|
-
export declare class RoomBase implements iRoomBase, iIdHolder {
|
|
6
|
+
export declare class RoomBase implements iRoomBase, iIdHolder, iJsonCustomPrepend {
|
|
7
7
|
groupMap: Map<GroupType, BaseGroup>;
|
|
8
8
|
startPoint?: iTrilaterationPoint | undefined;
|
|
9
9
|
endPoint?: iTrilaterationPoint | undefined;
|
|
@@ -49,6 +49,7 @@ export declare class RoomBase implements iRoomBase, iIdHolder {
|
|
|
49
49
|
*/
|
|
50
50
|
setLightTimeBased(c: RoomSetLightTimeBasedCommand): void;
|
|
51
51
|
isNowLightTime(): boolean;
|
|
52
|
+
customPrepend(): Partial<unknown>;
|
|
52
53
|
toJSON(): Partial<iRoomBase & {
|
|
53
54
|
/**
|
|
54
55
|
* The dictionary representation of the group map
|
package/lib/services/RoomBase.js
CHANGED
|
@@ -135,7 +135,7 @@ class RoomBase {
|
|
|
135
135
|
}
|
|
136
136
|
let timeOfDay = this.settings.roomIsAlwaysDark
|
|
137
137
|
? enums_1.TimeOfDay.Night
|
|
138
|
-
: time_callback_service_1.TimeCallbackService.dayType(this.settings.lampOffset);
|
|
138
|
+
: time_callback_service_1.TimeCallbackService.dayType(this.settings.lampOffset, new Date(), this.settings.nightStart, this.settings.nightEnd);
|
|
139
139
|
if (timeOfDay === enums_1.TimeOfDay.Daylight &&
|
|
140
140
|
((this.settings.lightIfNoWindows && (!this.WindowGroup || this.WindowGroup.windows.length === 0)) ||
|
|
141
141
|
((_a = this.WindowGroup) === null || _a === void 0 ? void 0 : _a.windows.some((f) => {
|
|
@@ -154,7 +154,7 @@ class RoomBase {
|
|
|
154
154
|
}
|
|
155
155
|
let timeOfDay = this.settings.roomIsAlwaysDark
|
|
156
156
|
? enums_1.TimeOfDay.Night
|
|
157
|
-
: time_callback_service_1.TimeCallbackService.dayType(this.settings.lampOffset);
|
|
157
|
+
: time_callback_service_1.TimeCallbackService.dayType(this.settings.lampOffset, new Date(), this.settings.nightStart, this.settings.nightEnd);
|
|
158
158
|
if (timeOfDay === enums_1.TimeOfDay.Daylight &&
|
|
159
159
|
((_a = this.WindowGroup) === null || _a === void 0 ? void 0 : _a.windows.some((f) => {
|
|
160
160
|
var _a;
|
|
@@ -164,8 +164,22 @@ class RoomBase {
|
|
|
164
164
|
}
|
|
165
165
|
return time_callback_service_1.TimeCallbackService.darkOutsideOrNight(timeOfDay);
|
|
166
166
|
}
|
|
167
|
+
customPrepend() {
|
|
168
|
+
return {
|
|
169
|
+
sunriseShutterCallback: this.sunriseShutterCallback,
|
|
170
|
+
sunsetShutterCallback: this.sunsetShutterCallback,
|
|
171
|
+
sonnenUntergangLichtCallback: this.sonnenUntergangLichtCallback,
|
|
172
|
+
sonnenAufgangLichtCallback: this.sonnenAufgangLichtCallback,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
167
175
|
toJSON() {
|
|
168
|
-
|
|
176
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
177
|
+
const result = utils_1.Utils.jsonFilter(lodash_1.default.omit(this, ['_deviceCluster']));
|
|
178
|
+
result['sunriseShutterCallback'] = this.sunriseShutterCallback;
|
|
179
|
+
result['sunsetShutterCallback'] = this.sunsetShutterCallback;
|
|
180
|
+
result['sonnenUntergangLichtCallback'] = this.sonnenUntergangLichtCallback;
|
|
181
|
+
result['sonnenAufgangLichtCallback'] = this.sonnenAufgangLichtCallback;
|
|
182
|
+
return result;
|
|
169
183
|
}
|
|
170
184
|
log(level, message) {
|
|
171
185
|
logging_1.ServerLogService.writeLog(level, message, {
|
|
@@ -89,7 +89,7 @@ class SonosService {
|
|
|
89
89
|
for (const deviceName in this.ownDevices) {
|
|
90
90
|
const snDevice = this.ownDevices[deviceName];
|
|
91
91
|
const room = snDevice.room;
|
|
92
|
-
const timeOfDay = time_callback_service_1.TimeCallbackService.dayType(room.settings.rolloOffset);
|
|
92
|
+
const timeOfDay = time_callback_service_1.TimeCallbackService.dayType(room.settings.rolloOffset, new Date(), room.settings.nightStart, room.settings.nightEnd);
|
|
93
93
|
const volume = timeOfDay == enums_1.TimeOfDay.Night
|
|
94
94
|
? snDevice.settings.defaultNightAnounceVolume
|
|
95
95
|
: snDevice.settings.defaultDayAnounceVolume;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TimeOfDay } from '../enums';
|
|
2
2
|
import { TimeCallback } from '../models';
|
|
3
|
-
import { iSunTimeOffsets, ITimeCallback } from '../interfaces';
|
|
3
|
+
import { iSunTimeOffsets, ITimeCallback, iTimePair } from '../interfaces';
|
|
4
4
|
export declare class TimeCallbackService {
|
|
5
5
|
private static _startTime;
|
|
6
6
|
private static _todaySunRise;
|
|
@@ -13,7 +13,7 @@ export declare class TimeCallbackService {
|
|
|
13
13
|
static get nextSunRise(): Date;
|
|
14
14
|
private static _nextSunSet;
|
|
15
15
|
static get nextSunSet(): Date;
|
|
16
|
-
static dayType(pOffset: iSunTimeOffsets, now?: Date): TimeOfDay;
|
|
16
|
+
static dayType(pOffset: iSunTimeOffsets, now?: Date, customNightStart?: iTimePair, customNightEnd?: iTimePair): TimeOfDay;
|
|
17
17
|
static darkOutsideOrNight(dayType: TimeOfDay): boolean;
|
|
18
18
|
static stopInterval(): void;
|
|
19
19
|
static init(startTime?: Date): void;
|
|
@@ -18,11 +18,11 @@ class TimeCallbackService {
|
|
|
18
18
|
static get nextSunSet() {
|
|
19
19
|
return TimeCallbackService._nextSunSet;
|
|
20
20
|
}
|
|
21
|
-
static dayType(pOffset, now = new Date()) {
|
|
21
|
+
static dayType(pOffset, now = new Date(), customNightStart, customNightEnd) {
|
|
22
22
|
const hours = now.getHours();
|
|
23
23
|
const minutes = now.getMinutes();
|
|
24
|
-
const nightEnd = settings_service_1.SettingsService.settings.timeSettings.nightEnd;
|
|
25
|
-
const nightStart = settings_service_1.SettingsService.settings.timeSettings.nightStart;
|
|
24
|
+
const nightEnd = customNightEnd !== null && customNightEnd !== void 0 ? customNightEnd : settings_service_1.SettingsService.settings.timeSettings.nightEnd;
|
|
25
|
+
const nightStart = customNightStart !== null && customNightStart !== void 0 ? customNightStart : settings_service_1.SettingsService.settings.timeSettings.nightStart;
|
|
26
26
|
if (nightStart.hours < nightEnd.hours) {
|
|
27
27
|
if ((hours < nightEnd.hours && hours > nightStart.hours) ||
|
|
28
28
|
(hours === nightEnd.hours && minutes < nightEnd.minutes) ||
|