hoffmation-base 1.1.39 → 1.1.41
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/server/devices/DeviceCapability.d.ts +1 -0
- package/lib/server/devices/DeviceCapability.js +1 -0
- package/lib/server/devices/baseDeviceInterfaces/iActuator.d.ts +10 -1
- package/lib/server/devices/baseDeviceInterfaces/iLamp.d.ts +18 -3
- package/lib/server/devices/baseDeviceInterfaces/iLedRgbCct.d.ts +24 -0
- package/lib/server/devices/baseDeviceInterfaces/iLedRgbCct.js +2 -0
- package/lib/server/devices/devices.js +1 -1
- package/lib/server/devices/groups/lampenGroup.d.ts +2 -2
- package/lib/server/devices/groups/lampenGroup.js +1 -1
- package/lib/server/devices/zigbee/BaseDevices/index.d.ts +2 -0
- package/lib/server/devices/zigbee/BaseDevices/index.js +2 -0
- package/lib/server/devices/zigbee/BaseDevices/zigbeeDimmer.d.ts +43 -0
- package/lib/server/devices/zigbee/BaseDevices/zigbeeDimmer.js +167 -0
- package/lib/server/devices/zigbee/BaseDevices/zigbeeLedRGBCCT.d.ts +28 -0
- package/lib/server/devices/zigbee/BaseDevices/zigbeeLedRGBCCT.js +103 -0
- package/lib/server/devices/zigbee/zigbeeEuroHeater.js +3 -7
- package/lib/server/devices/zigbee/zigbeeIlluDimmer.d.ts +9 -34
- package/lib/server/devices/zigbee/zigbeeIlluDimmer.js +10 -158
- package/lib/server/devices/zigbee/zigbeeIlluLedRGBCCT.d.ts +12 -13
- package/lib/server/devices/zigbee/zigbeeIlluLedRGBCCT.js +12 -85
- package/lib/server/services/api/api-service.d.ts +12 -0
- package/lib/server/services/api/api-service.js +22 -0
- package/lib/server/services/settings-service.d.ts +2 -0
- package/lib/server/services/settings-service.js +20 -0
- package/lib/server/services/time-callback-service.js +8 -8
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,165 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ZigbeeIlluDimmer = void 0;
|
|
4
|
-
const models_1 = require("../../../models");
|
|
5
|
-
const deviceType_1 = require("../deviceType");
|
|
6
|
-
const services_1 = require("../../services");
|
|
7
4
|
const BaseDevices_1 = require("./BaseDevices");
|
|
8
|
-
const
|
|
9
|
-
class ZigbeeIlluDimmer extends BaseDevices_1.
|
|
10
|
-
constructor(pInfo
|
|
11
|
-
super(pInfo,
|
|
12
|
-
this.
|
|
13
|
-
this.
|
|
14
|
-
this.
|
|
15
|
-
this.
|
|
16
|
-
this.
|
|
17
|
-
this.
|
|
18
|
-
this.brightnessID = 'brightness';
|
|
19
|
-
this.transitionID = 'transition_time';
|
|
20
|
-
this._turnOffTimeout = undefined;
|
|
21
|
-
this.turnOffTime = 0;
|
|
22
|
-
this._lastPersist = 0;
|
|
23
|
-
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.lamp);
|
|
24
|
-
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.dimmablelamp);
|
|
25
|
-
this.stateID = `${this.info.fullID}.state`;
|
|
26
|
-
this.brightnessID = `${this.info.fullID}.brightness`;
|
|
27
|
-
this.transitionID = `${this.info.fullID}.transition_time`;
|
|
28
|
-
}
|
|
29
|
-
get actuatorOn() {
|
|
30
|
-
return this.lightOn;
|
|
31
|
-
}
|
|
32
|
-
update(idSplit, state, initial = false) {
|
|
33
|
-
this.queuedValue = null;
|
|
34
|
-
this.log(models_1.LogLevel.DeepTrace, `Dimmer Update: ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`);
|
|
35
|
-
super.update(idSplit, state, initial, true);
|
|
36
|
-
switch (idSplit[3]) {
|
|
37
|
-
case 'state':
|
|
38
|
-
this.log(models_1.LogLevel.Trace, `Dimmer Update für ${this.info.customName} auf ${state.val}`);
|
|
39
|
-
this.lightOn = state.val;
|
|
40
|
-
this.persist();
|
|
41
|
-
break;
|
|
42
|
-
case 'brightness':
|
|
43
|
-
this.log(models_1.LogLevel.Trace, `Dimmer Helligkeit Update für ${this.info.customName} auf ${state.val}`);
|
|
44
|
-
this.brightness = state.val;
|
|
45
|
-
this.persist();
|
|
46
|
-
break;
|
|
47
|
-
case 'transition_time':
|
|
48
|
-
this.log(models_1.LogLevel.Trace, `Dimmer Transition Time Update für ${this.info.customName} auf ${state.val}`);
|
|
49
|
-
this.transitionTime = state.val;
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
setTimeBased(time, timeout = -1, force = false) {
|
|
54
|
-
switch (time) {
|
|
55
|
-
case models_1.TimeOfDay.Night:
|
|
56
|
-
this.setLight(true, timeout, force, this.settings.nightBrightness);
|
|
57
|
-
break;
|
|
58
|
-
case models_1.TimeOfDay.AfterSunset:
|
|
59
|
-
this.setLight(true, timeout, force, this.settings.dawnBrightness);
|
|
60
|
-
break;
|
|
61
|
-
case models_1.TimeOfDay.BeforeSunrise:
|
|
62
|
-
this.setLight(true, timeout, force, this.settings.duskBrightness);
|
|
63
|
-
break;
|
|
64
|
-
case models_1.TimeOfDay.Daylight:
|
|
65
|
-
this.setLight(true, timeout, force, this.settings.dayBrightness);
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
setActuator(pValue, timeout, force) {
|
|
70
|
-
this.setLight(pValue, timeout, force);
|
|
71
|
-
}
|
|
72
|
-
toggleActuator(force) {
|
|
73
|
-
return this.toggleLight(undefined, force);
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* @inheritDoc
|
|
77
|
-
* @param pValue The desired value
|
|
78
|
-
* @param timeout If > 0 time at which this should be turned off again
|
|
79
|
-
* @param force if it is an user based action which should override automatic ones
|
|
80
|
-
* @param {number} brightness The desired brightness in percent
|
|
81
|
-
* @param {number} transitionTime The transition time for the brightness, to switch smoothly
|
|
82
|
-
*/
|
|
83
|
-
setLight(pValue, timeout = -1, force = false, brightness = -1, transitionTime = -1) {
|
|
84
|
-
if (this.stateID === '') {
|
|
85
|
-
this.log(models_1.LogLevel.Error, `Keine State ID bekannt.`);
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
if (!this.ioConn) {
|
|
89
|
-
this.log(models_1.LogLevel.Error, `Keine Connection bekannt.`);
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
if (transitionTime > -1) {
|
|
93
|
-
this.ioConn.setState(this.transitionID, transitionTime, (err) => {
|
|
94
|
-
if (err) {
|
|
95
|
-
this.log(models_1.LogLevel.Error, `Dimmer TransitionTime schalten ergab Fehler: ${err}`);
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
if (!force && services_1.Utils.nowMS() < this.turnOffTime) {
|
|
100
|
-
this.log(models_1.LogLevel.Debug, `Skip automatic command to ${pValue} as it is locked until ${new Date(this.turnOffTime).toLocaleTimeString()}`);
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
if (pValue && brightness === -1 && this.brightness < 10) {
|
|
104
|
-
brightness = 10;
|
|
105
|
-
}
|
|
106
|
-
this.log(models_1.LogLevel.Debug, `Set Light Acutator to "${pValue}" with brightness ${brightness}`, services_1.LogDebugType.SetActuator);
|
|
107
|
-
this.setState(this.stateID, pValue);
|
|
108
|
-
this.queuedValue = pValue;
|
|
109
|
-
if (brightness > -1) {
|
|
110
|
-
if (brightness < this.settings.turnOnThreshhold) {
|
|
111
|
-
this.setState(this.brightnessID, this.settings.turnOnThreshhold, () => {
|
|
112
|
-
services_1.Utils.guardedTimeout(() => {
|
|
113
|
-
this.log(models_1.LogLevel.Info, `Delayed reduced brightness on ${this.info.customName}`);
|
|
114
|
-
this.setState(this.brightnessID, brightness);
|
|
115
|
-
}, 1000, this);
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
this.setState(this.brightnessID, brightness);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
if (this._turnOffTimeout !== undefined) {
|
|
123
|
-
clearTimeout(this._turnOffTimeout);
|
|
124
|
-
this._turnOffTimeout = undefined;
|
|
125
|
-
}
|
|
126
|
-
if (timeout < 0 || !pValue) {
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
this.turnOffTime = services_1.Utils.nowMS() + timeout;
|
|
130
|
-
this._turnOffTimeout = services_1.Utils.guardedTimeout(() => {
|
|
131
|
-
this.log(models_1.LogLevel.Debug, `Delayed Turnoff initiated`);
|
|
132
|
-
this._turnOffTimeout = undefined;
|
|
133
|
-
if (!this.room) {
|
|
134
|
-
this.setLight(false, -1, true);
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
this.room.setLightTimeBased(true);
|
|
138
|
-
}
|
|
139
|
-
}, timeout, this);
|
|
140
|
-
}
|
|
141
|
-
persist() {
|
|
142
|
-
var _a;
|
|
143
|
-
const now = services_1.Utils.nowMS();
|
|
144
|
-
if (this._lastPersist + 1000 < now) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
(_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistActuator(this);
|
|
148
|
-
this._lastPersist = now;
|
|
149
|
-
}
|
|
150
|
-
toggleLight(time, force = false, calculateTime = false) {
|
|
151
|
-
var _a;
|
|
152
|
-
const newVal = this.queuedValue !== null ? !this.queuedValue : !this.lightOn;
|
|
153
|
-
const timeout = newVal && force ? 30 * 60 * 1000 : -1;
|
|
154
|
-
if (newVal && time === undefined && calculateTime && this.room !== undefined) {
|
|
155
|
-
time = services_1.TimeCallbackService.dayType((_a = this.room) === null || _a === void 0 ? void 0 : _a.settings.lampOffset);
|
|
156
|
-
}
|
|
157
|
-
if (newVal && time !== undefined) {
|
|
158
|
-
this.setTimeBased(time, timeout, force);
|
|
159
|
-
return true;
|
|
160
|
-
}
|
|
161
|
-
this.setLight(newVal, timeout, force);
|
|
162
|
-
return newVal;
|
|
5
|
+
const deviceType_1 = require("../deviceType");
|
|
6
|
+
class ZigbeeIlluDimmer extends BaseDevices_1.ZigbeeDimmer {
|
|
7
|
+
constructor(pInfo) {
|
|
8
|
+
super(pInfo, deviceType_1.DeviceType.ZigbeeIlluDimmer);
|
|
9
|
+
this._stateNameBrightness = 'brightness';
|
|
10
|
+
this._stateNameState = 'state';
|
|
11
|
+
this._stateNameTransitionTime = 'transition_time';
|
|
12
|
+
this._stateIdState = `${this.info.fullID}.state`;
|
|
13
|
+
this._stateIdBrightness = `${this.info.fullID}.brightness`;
|
|
14
|
+
this._stateIdTransitionTime = `${this.info.fullID}.transition_time`;
|
|
163
15
|
}
|
|
164
16
|
}
|
|
165
17
|
exports.ZigbeeIlluDimmer = ZigbeeIlluDimmer;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
/// <reference types="iobroker" />
|
|
2
|
-
import { LedSettings, TimeOfDay } from '../../../models';
|
|
3
1
|
import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
|
|
4
|
-
import {
|
|
5
|
-
export declare class ZigbeeIlluLedRGBCCT extends
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
import { ZigbeeLedRGBCCT } from './BaseDevices';
|
|
3
|
+
export declare class ZigbeeIlluLedRGBCCT extends ZigbeeLedRGBCCT {
|
|
4
|
+
protected readonly _stateIdBrightness: string;
|
|
5
|
+
protected readonly _stateIdColor: string;
|
|
6
|
+
protected readonly _stateIdColorTemp: string;
|
|
7
|
+
protected readonly _stateIdState: string;
|
|
8
|
+
protected readonly _stateIdTransitionTime: string;
|
|
9
|
+
protected readonly _stateNameBrightness: string;
|
|
10
|
+
protected readonly _stateNameState: string;
|
|
11
|
+
protected readonly _stateNameTransitionTime: string;
|
|
12
|
+
protected readonly _stateNameColor: string;
|
|
13
|
+
protected readonly _stateNameColorTemp: string;
|
|
12
14
|
constructor(pInfo: IoBrokerDeviceInfo);
|
|
13
|
-
update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
|
|
14
|
-
setTimeBased(time: TimeOfDay, timeout?: number, force?: boolean): void;
|
|
15
|
-
setLight(pValue: boolean, timeout?: number, force?: boolean, brightness?: number, transitionTime?: number, color?: string, colorTemp?: number): void;
|
|
16
15
|
}
|
|
@@ -2,93 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ZigbeeIlluLedRGBCCT = void 0;
|
|
4
4
|
const deviceType_1 = require("../deviceType");
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
class ZigbeeIlluLedRGBCCT extends zigbeeIlluDimmer_1.ZigbeeIlluDimmer {
|
|
8
|
-
// private effectID: string = '';
|
|
5
|
+
const BaseDevices_1 = require("./BaseDevices");
|
|
6
|
+
class ZigbeeIlluLedRGBCCT extends BaseDevices_1.ZigbeeLedRGBCCT {
|
|
9
7
|
constructor(pInfo) {
|
|
10
8
|
super(pInfo, deviceType_1.DeviceType.ZigbeeIlluLedRGBCCT);
|
|
11
|
-
this.
|
|
12
|
-
this.
|
|
13
|
-
this.
|
|
14
|
-
this.
|
|
15
|
-
this.
|
|
16
|
-
this.
|
|
17
|
-
this.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
this.log(models_1.LogLevel.DeepTrace, `LED Update: ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`);
|
|
22
|
-
super.update(idSplit, state, initial);
|
|
23
|
-
switch (idSplit[3]) {
|
|
24
|
-
case 'color':
|
|
25
|
-
this.log(models_1.LogLevel.Trace, `LED Color Update für ${this.info.customName} auf ${state.val}`);
|
|
26
|
-
this.color = state.val;
|
|
27
|
-
break;
|
|
28
|
-
case 'colortemp':
|
|
29
|
-
this.log(models_1.LogLevel.Trace, `LED Color Update für ${this.info.customName} auf ${state.val}`);
|
|
30
|
-
this.colortemp = state.val;
|
|
31
|
-
break;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
setTimeBased(time, timeout = -1, force = false) {
|
|
35
|
-
switch (time) {
|
|
36
|
-
case models_1.TimeOfDay.Night:
|
|
37
|
-
if (this.settings.nightOn) {
|
|
38
|
-
this.setLight(true, timeout, force, this.settings.nightBrightness, undefined, this.settings.nightColor, this.settings.nightColorTemp);
|
|
39
|
-
}
|
|
40
|
-
break;
|
|
41
|
-
case models_1.TimeOfDay.AfterSunset:
|
|
42
|
-
if (this.settings.duskOn) {
|
|
43
|
-
this.setLight(true, timeout, force, this.settings.duskBrightness, undefined, this.settings.duskColor, this.settings.duskColorTemp);
|
|
44
|
-
}
|
|
45
|
-
break;
|
|
46
|
-
case models_1.TimeOfDay.BeforeSunrise:
|
|
47
|
-
if (this.settings.dawnOn) {
|
|
48
|
-
this.setLight(true, timeout, force, this.settings.dawnBrightness, undefined, this.settings.dawnColor, this.settings.dawnColorTemp);
|
|
49
|
-
}
|
|
50
|
-
break;
|
|
51
|
-
case models_1.TimeOfDay.Daylight:
|
|
52
|
-
if (this.settings.dayOn) {
|
|
53
|
-
this.setLight(true, timeout, force, this.settings.dayBrightness, undefined, this.settings.dayColor, this.settings.dayColorTemp);
|
|
54
|
-
}
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
setLight(pValue, timeout, force, brightness = -1, transitionTime, color = '', colorTemp = -1) {
|
|
59
|
-
if (this.stateID === '') {
|
|
60
|
-
this.log(models_1.LogLevel.Error, `Keine State ID bekannt.`);
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
if (!this.ioConn) {
|
|
64
|
-
this.log(models_1.LogLevel.Error, `Keine Connection bekannt.`);
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
if (pValue && brightness === -1 && this.brightness < 10) {
|
|
68
|
-
brightness = 10;
|
|
69
|
-
}
|
|
70
|
-
this.log(models_1.LogLevel.Debug, `LED Schalten An: ${pValue}\tHelligkeit: ${brightness}%\tFarbe: "${color}"\tColorTemperatur: ${colorTemp}`);
|
|
71
|
-
super.setLight(pValue, timeout, force, brightness, transitionTime);
|
|
72
|
-
if (color !== '') {
|
|
73
|
-
this.ioConn.setState(this.colorID, color, (err) => {
|
|
74
|
-
if (err) {
|
|
75
|
-
this.log(models_1.LogLevel.Error, `LED Farbe schalten ergab Fehler: ${err}`);
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
if (colorTemp > -1) {
|
|
80
|
-
this.ioConn.setState(this.colorTempID, colorTemp, (err) => {
|
|
81
|
-
if (err) {
|
|
82
|
-
this.log(models_1.LogLevel.Error, `LED Farbwärme schalten ergab Fehler: ${err}`);
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
this.ioConn.setState(this.stateID, pValue, (err) => {
|
|
87
|
-
if (err) {
|
|
88
|
-
this.log(models_1.LogLevel.Error, `LED schalten ergab Fehler: ${err}`);
|
|
89
|
-
}
|
|
90
|
-
});
|
|
9
|
+
this._stateNameBrightness = 'brightness';
|
|
10
|
+
this._stateNameState = 'state';
|
|
11
|
+
this._stateNameTransitionTime = 'transition_time';
|
|
12
|
+
this._stateNameColor = 'color';
|
|
13
|
+
this._stateNameColorTemp = 'colortemp';
|
|
14
|
+
this._stateIdBrightness = `${this.info.fullID}.brightness`;
|
|
15
|
+
this._stateIdColor = `${this.info.fullID}.color`;
|
|
16
|
+
this._stateIdColorTemp = `${this.info.fullID}.colortemp`;
|
|
17
|
+
this._stateIdState = `${this.info.fullID}.state`;
|
|
18
|
+
this._stateIdTransitionTime = `${this.info.fullID}.transition_time`;
|
|
91
19
|
}
|
|
92
20
|
}
|
|
93
21
|
exports.ZigbeeIlluLedRGBCCT = ZigbeeIlluLedRGBCCT;
|
|
94
|
-
ZigbeeIlluLedRGBCCT.DEFAULT_COLOR_WARM = '#f2b200';
|
|
@@ -53,6 +53,18 @@ export declare class API {
|
|
|
53
53
|
* @returns {Error | null} In case it failed the Error containing the reason
|
|
54
54
|
*/
|
|
55
55
|
static setDimmer(deviceId: string, state: boolean, timeout?: number, brightness?: number, transitionTime?: number): Error | null;
|
|
56
|
+
/**
|
|
57
|
+
* Changes the status of a given actuator
|
|
58
|
+
* @param {string} deviceId The device Id of the actuator
|
|
59
|
+
* @param {boolean} state The desired new state
|
|
60
|
+
* @param timeout A chosen Timeout after which the light should be reset
|
|
61
|
+
* @param brightness The desired brightness
|
|
62
|
+
* @param transitionTime The transition time during turnOn/turnOff
|
|
63
|
+
* @param {string} color The desired color in 6 digit hex Code
|
|
64
|
+
* @param {number} colorTemp The desired color Temperature (0 = more White)
|
|
65
|
+
* @returns {Error | null} In case it failed the Error containing the reason
|
|
66
|
+
*/
|
|
67
|
+
static setLedLamp(deviceId: string, state: boolean, timeout?: number, brightness?: number, transitionTime?: number, color?: string, colorTemp?: number): Error | null;
|
|
56
68
|
static setShutter(deviceId: string, level: number): Error | null;
|
|
57
69
|
static speakOnDevice(deviceId: string, message: string, volume?: number): Error | null;
|
|
58
70
|
}
|
|
@@ -125,6 +125,28 @@ class API {
|
|
|
125
125
|
d.setLight(state, timeout, true, brightness, transitionTime);
|
|
126
126
|
return null;
|
|
127
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* Changes the status of a given actuator
|
|
130
|
+
* @param {string} deviceId The device Id of the actuator
|
|
131
|
+
* @param {boolean} state The desired new state
|
|
132
|
+
* @param timeout A chosen Timeout after which the light should be reset
|
|
133
|
+
* @param brightness The desired brightness
|
|
134
|
+
* @param transitionTime The transition time during turnOn/turnOff
|
|
135
|
+
* @param {string} color The desired color in 6 digit hex Code
|
|
136
|
+
* @param {number} colorTemp The desired color Temperature (0 = more White)
|
|
137
|
+
* @returns {Error | null} In case it failed the Error containing the reason
|
|
138
|
+
*/
|
|
139
|
+
static setLedLamp(deviceId, state, timeout, brightness, transitionTime, color, colorTemp) {
|
|
140
|
+
const d = this.getDevice(deviceId);
|
|
141
|
+
if (d === undefined) {
|
|
142
|
+
return new Error(`Device with ID ${deviceId} not found`);
|
|
143
|
+
}
|
|
144
|
+
if (!d.deviceCapabilities.includes(DeviceCapability_1.DeviceCapability.ledLamp)) {
|
|
145
|
+
return new Error(`Device with ID ${deviceId} is no dimmablelamp`);
|
|
146
|
+
}
|
|
147
|
+
d.setLight(state, timeout, true, brightness, transitionTime, color, colorTemp);
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
128
150
|
static setShutter(deviceId, level) {
|
|
129
151
|
const d = this.getDevice(deviceId);
|
|
130
152
|
if (d === undefined) {
|
|
@@ -5,6 +5,8 @@ export declare class SettingsService {
|
|
|
5
5
|
static get Mp3Active(): boolean;
|
|
6
6
|
static initialize(config: iConfig): void;
|
|
7
7
|
static get heatMode(): HeatingMode;
|
|
8
|
+
static get latitude(): number;
|
|
9
|
+
static get longitude(): number;
|
|
8
10
|
/**
|
|
9
11
|
* @deprecated Only use in unit tests
|
|
10
12
|
* @returns {iConfig}
|
|
@@ -16,6 +16,26 @@ class SettingsService {
|
|
|
16
16
|
var _a, _b, _c;
|
|
17
17
|
return (_c = (_b = (_a = this.settings) === null || _a === void 0 ? void 0 : _a.heaterSettings) === null || _b === void 0 ? void 0 : _b.mode) !== null && _c !== void 0 ? _c : config_1.HeatingMode.None;
|
|
18
18
|
}
|
|
19
|
+
static get latitude() {
|
|
20
|
+
var _a, _b;
|
|
21
|
+
if (((_b = (_a = this.settings) === null || _a === void 0 ? void 0 : _a.weather) === null || _b === void 0 ? void 0 : _b.lattitude) !== undefined) {
|
|
22
|
+
const lat = parseFloat(this.settings.weather.lattitude);
|
|
23
|
+
if (!Number.isNaN(lat)) {
|
|
24
|
+
return lat;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return 51.529556852253826;
|
|
28
|
+
}
|
|
29
|
+
static get longitude() {
|
|
30
|
+
var _a, _b;
|
|
31
|
+
if (((_b = (_a = this.settings) === null || _a === void 0 ? void 0 : _a.weather) === null || _b === void 0 ? void 0 : _b.longitude) !== undefined) {
|
|
32
|
+
const longitude = parseFloat(this.settings.weather.longitude);
|
|
33
|
+
if (!Number.isNaN(longitude)) {
|
|
34
|
+
return longitude;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return 7.097266042276687;
|
|
38
|
+
}
|
|
19
39
|
/**
|
|
20
40
|
* @deprecated Only use in unit tests
|
|
21
41
|
* @returns {iConfig}
|
|
@@ -146,8 +146,8 @@ class TimeCallbackService {
|
|
|
146
146
|
TimeCallbackService._lastCheck = now;
|
|
147
147
|
}
|
|
148
148
|
static recalcSunTimes(calculationDate = new Date()) {
|
|
149
|
-
TimeCallbackService._todaySunRise = (0, sunrise_sunset_js_1.getSunrise)(
|
|
150
|
-
TimeCallbackService._todaySunSet = (0, sunrise_sunset_js_1.getSunset)(
|
|
149
|
+
TimeCallbackService._todaySunRise = (0, sunrise_sunset_js_1.getSunrise)(settings_service_1.SettingsService.latitude, settings_service_1.SettingsService.longitude, calculationDate);
|
|
150
|
+
TimeCallbackService._todaySunSet = (0, sunrise_sunset_js_1.getSunset)(settings_service_1.SettingsService.latitude, settings_service_1.SettingsService.longitude, calculationDate);
|
|
151
151
|
TimeCallbackService.updateSunSet();
|
|
152
152
|
TimeCallbackService.updateSunRise();
|
|
153
153
|
log_service_1.ServerLogService.writeLog(models_1.LogLevel.Info, `Nächster Sonnenaufgang um ${TimeCallbackService.nextSunRise.toLocaleTimeString('de-DE')}
|
|
@@ -163,14 +163,14 @@ Nächster Sonnenuntergang um ${TimeCallbackService._nextSunSet.toLocaleTimeStrin
|
|
|
163
163
|
return;
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
-
static updateSunRise(pDay = new Date(), lat
|
|
167
|
-
TimeCallbackService._nextSunRise = (0, sunrise_sunset_js_1.getSunrise)(lat, long, pDay);
|
|
166
|
+
static updateSunRise(pDay = new Date(), lat, long) {
|
|
167
|
+
TimeCallbackService._nextSunRise = (0, sunrise_sunset_js_1.getSunrise)(lat !== null && lat !== void 0 ? lat : settings_service_1.SettingsService.latitude, long !== null && long !== void 0 ? long : settings_service_1.SettingsService.longitude, pDay);
|
|
168
168
|
}
|
|
169
|
-
static updateSunSet(pDay = new Date(), lat
|
|
170
|
-
TimeCallbackService._nextSunSet = this.getSunsetForDate(pDay, lat, long);
|
|
169
|
+
static updateSunSet(pDay = new Date(), lat, long) {
|
|
170
|
+
TimeCallbackService._nextSunSet = this.getSunsetForDate(pDay, lat !== null && lat !== void 0 ? lat : settings_service_1.SettingsService.latitude, long !== null && long !== void 0 ? long : settings_service_1.SettingsService.longitude);
|
|
171
171
|
}
|
|
172
|
-
static getSunsetForDate(pDay = new Date(), lat
|
|
173
|
-
return (0, sunrise_sunset_js_1.getSunset)(lat, long, pDay);
|
|
172
|
+
static getSunsetForDate(pDay = new Date(), lat, long) {
|
|
173
|
+
return (0, sunrise_sunset_js_1.getSunset)(lat !== null && lat !== void 0 ? lat : settings_service_1.SettingsService.latitude, long !== null && long !== void 0 ? long : settings_service_1.SettingsService.longitude, pDay);
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
exports.TimeCallbackService = TimeCallbackService;
|