hoffmation-base 2.20.5 → 2.21.0
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/models/iIdHolder.d.ts +2 -1
- package/lib/server/devices/baseDeviceInterfaces/iActuator.d.ts +7 -1
- package/lib/server/devices/dachs/dachs.d.ts +6 -1
- package/lib/server/devices/dachs/dachs.js +18 -1
- package/lib/server/devices/hmIPDevices/hmIpLampe.d.ts +2 -2
- package/lib/server/devices/hmIPDevices/hmIpLampe.js +12 -33
- package/lib/server/devices/index.d.ts +1 -0
- package/lib/server/devices/index.js +1 -0
- package/lib/server/devices/sharedFunctions/index.d.ts +1 -0
- package/lib/server/devices/sharedFunctions/index.js +17 -0
- package/lib/server/devices/sharedFunctions/lampUtils.d.ts +10 -0
- package/lib/server/devices/sharedFunctions/lampUtils.js +67 -0
- package/lib/server/devices/wledDevice.d.ts +8 -5
- package/lib/server/devices/wledDevice.js +23 -16
- package/lib/server/devices/zigbee/BaseDevices/ZigbeeActuator.d.ts +4 -4
- package/lib/server/devices/zigbee/BaseDevices/ZigbeeActuator.js +6 -16
- package/lib/server/devices/zigbee/BaseDevices/zigbeeDimmer.d.ts +6 -6
- package/lib/server/devices/zigbee/BaseDevices/zigbeeDimmer.js +19 -38
- package/lib/server/devices/zigbee/zigbeeIlluLampe.js +5 -23
- package/lib/server/devices/zigbee/zigbeeUbisysLampe.js +5 -24
- package/lib/server/services/govee/own-govee-device.d.ts +9 -8
- package/lib/server/services/govee/own-govee-device.js +31 -47
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -6,36 +6,37 @@ const services_1 = require("../../../services");
|
|
|
6
6
|
const index_1 = require("./index");
|
|
7
7
|
const DeviceCapability_1 = require("../../DeviceCapability");
|
|
8
8
|
const blockAutomaticHandler_1 = require("../../../services/blockAutomaticHandler");
|
|
9
|
+
const sharedFunctions_1 = require("../../sharedFunctions");
|
|
9
10
|
class ZigbeeDimmer extends index_1.ZigbeeDevice {
|
|
10
|
-
get lightOn() {
|
|
11
|
-
return this._lightOn;
|
|
12
|
-
}
|
|
13
|
-
get brightness() {
|
|
14
|
-
return this._brightness;
|
|
15
|
-
}
|
|
16
|
-
get transitionTime() {
|
|
17
|
-
return this._transitionTime;
|
|
18
|
-
}
|
|
19
|
-
get actuatorOn() {
|
|
20
|
-
return this.lightOn;
|
|
21
|
-
}
|
|
22
11
|
constructor(pInfo, deviceType) {
|
|
23
12
|
super(pInfo, deviceType);
|
|
24
13
|
this.queuedValue = null;
|
|
25
14
|
this.settings = new models_1.DimmerSettings();
|
|
26
|
-
this.
|
|
15
|
+
this.targetAutomaticState = false;
|
|
27
16
|
this._lastPersist = 0;
|
|
17
|
+
this._brightness = 0;
|
|
28
18
|
this._lightOn = false;
|
|
29
19
|
this._transitionTime = 0;
|
|
30
|
-
this._targetAutomaticState = false;
|
|
31
20
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.lamp);
|
|
32
21
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.dimmablelamp);
|
|
33
22
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.blockAutomatic);
|
|
34
23
|
this.blockAutomationHandler = new blockAutomaticHandler_1.BlockAutomaticHandler(this.restoreTargetAutomaticValue.bind(this));
|
|
35
24
|
}
|
|
25
|
+
get brightness() {
|
|
26
|
+
return this._brightness;
|
|
27
|
+
}
|
|
28
|
+
get lightOn() {
|
|
29
|
+
return this._lightOn;
|
|
30
|
+
}
|
|
31
|
+
get transitionTime() {
|
|
32
|
+
return this._transitionTime;
|
|
33
|
+
}
|
|
34
|
+
get actuatorOn() {
|
|
35
|
+
return this.lightOn;
|
|
36
|
+
}
|
|
36
37
|
restoreTargetAutomaticValue() {
|
|
37
38
|
this.log(models_1.LogLevel.Debug, `Restore Target Automatic value`);
|
|
38
|
-
this.setActuator(this.
|
|
39
|
+
this.setActuator(this.targetAutomaticState);
|
|
39
40
|
}
|
|
40
41
|
update(idSplit, state, initial = false) {
|
|
41
42
|
this.queuedValue = null;
|
|
@@ -104,18 +105,8 @@ class ZigbeeDimmer extends index_1.ZigbeeDevice {
|
|
|
104
105
|
}
|
|
105
106
|
});
|
|
106
107
|
}
|
|
107
|
-
|
|
108
|
-
if (force
|
|
109
|
-
this.settings.resetToAutomaticOnForceOffAfterForceOn &&
|
|
110
|
-
!pValue &&
|
|
111
|
-
this.blockAutomationHandler.automaticBlockActive) {
|
|
112
|
-
dontBlock = true;
|
|
113
|
-
this.log(models_1.LogLevel.Debug, `Reset Automatic Block as we are turning off manually after a force on`);
|
|
114
|
-
this.blockAutomationHandler.liftAutomaticBlock();
|
|
115
|
-
}
|
|
116
|
-
if (!force && this.blockAutomationHandler.automaticBlockActive) {
|
|
117
|
-
this.log(models_1.LogLevel.Debug, `Skip automatic command to ${pValue} as it is locked until ${new Date(this.blockAutomationHandler.automaticBlockedUntil).toLocaleTimeString()}`);
|
|
118
|
-
this._targetAutomaticState = pValue;
|
|
108
|
+
const dontBlock = sharedFunctions_1.LampUtils.checkUnBlock(this, force, pValue);
|
|
109
|
+
if (sharedFunctions_1.LampUtils.checkBlockActive(this, force, pValue)) {
|
|
119
110
|
return;
|
|
120
111
|
}
|
|
121
112
|
if (pValue && brightness === -1 && this.brightness < 10) {
|
|
@@ -151,17 +142,7 @@ class ZigbeeDimmer extends index_1.ZigbeeDevice {
|
|
|
151
142
|
this._lastPersist = now;
|
|
152
143
|
}
|
|
153
144
|
toggleLight(time, force = false, calculateTime = false) {
|
|
154
|
-
|
|
155
|
-
const timeout = newVal && force ? 30 * 60 * 1000 : -1;
|
|
156
|
-
if (newVal && time === undefined && calculateTime && this.room) {
|
|
157
|
-
time = services_1.TimeCallbackService.dayType(this.room.settings.lampOffset);
|
|
158
|
-
}
|
|
159
|
-
if (newVal && time !== undefined) {
|
|
160
|
-
this.setTimeBased(time, timeout, force);
|
|
161
|
-
return true;
|
|
162
|
-
}
|
|
163
|
-
this.setLight(newVal, timeout, force);
|
|
164
|
-
return newVal;
|
|
145
|
+
return sharedFunctions_1.LampUtils.toggleLight(this, time, force, calculateTime);
|
|
165
146
|
}
|
|
166
147
|
}
|
|
167
148
|
exports.ZigbeeDimmer = ZigbeeDimmer;
|
|
@@ -6,6 +6,7 @@ const zigbeeIlluActuator_1 = require("./zigbeeIlluActuator");
|
|
|
6
6
|
const models_1 = require("../../../models");
|
|
7
7
|
const services_1 = require("../../services");
|
|
8
8
|
const DeviceCapability_1 = require("../DeviceCapability");
|
|
9
|
+
const sharedFunctions_1 = require("../sharedFunctions");
|
|
9
10
|
class ZigbeeIlluLampe extends zigbeeIlluActuator_1.ZigbeeIlluActuator {
|
|
10
11
|
constructor(pInfo) {
|
|
11
12
|
super(pInfo, deviceType_1.DeviceType.ZigbeeIlluLampe);
|
|
@@ -25,36 +26,17 @@ class ZigbeeIlluLampe extends zigbeeIlluActuator_1.ZigbeeIlluActuator {
|
|
|
25
26
|
/** @inheritdoc */
|
|
26
27
|
setLight(pValue, timeout = -1, force = false) {
|
|
27
28
|
this.log(models_1.LogLevel.Debug, `Set Light Acutator to "${pValue}"`, services_1.LogDebugType.SetActuator);
|
|
28
|
-
if (this.settings.isStromStoss) {
|
|
29
|
+
if (this.settings.isStromStoss && pValue) {
|
|
29
30
|
timeout = 3000;
|
|
30
|
-
|
|
31
|
-
var _a;
|
|
32
|
-
if ((_a = this.room.PraesenzGroup) === null || _a === void 0 ? void 0 : _a.anyPresent()) {
|
|
33
|
-
this.setLight(true, -1, true);
|
|
34
|
-
}
|
|
35
|
-
}, this.settings.stromStossResendTime * 1000, this);
|
|
31
|
+
sharedFunctions_1.LampUtils.stromStossOn(this);
|
|
36
32
|
}
|
|
37
33
|
super.setActuator(pValue, timeout, force);
|
|
38
34
|
}
|
|
39
35
|
toggleLight(time, force = false, calculateTime = false) {
|
|
40
|
-
|
|
41
|
-
const timeout = newVal && force ? 30 * 60 * 1000 : -1;
|
|
42
|
-
if (newVal && time === undefined && calculateTime) {
|
|
43
|
-
time = services_1.TimeCallbackService.dayType(this.room.settings.lampOffset);
|
|
44
|
-
}
|
|
45
|
-
if (newVal && time !== undefined) {
|
|
46
|
-
this.setTimeBased(time, timeout, force);
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
this.setLight(newVal, timeout, force);
|
|
50
|
-
return newVal;
|
|
36
|
+
return sharedFunctions_1.LampUtils.toggleLight(this, time, force, calculateTime);
|
|
51
37
|
}
|
|
52
38
|
setTimeBased(time, timeout = -1, force = false) {
|
|
53
|
-
|
|
54
|
-
(time === models_1.TimeOfDay.BeforeSunrise && this.settings.dawnOn) ||
|
|
55
|
-
(time === models_1.TimeOfDay.AfterSunset && this.settings.duskOn)) {
|
|
56
|
-
this.setLight(true, timeout, force);
|
|
57
|
-
}
|
|
39
|
+
sharedFunctions_1.LampUtils.setTimeBased(this, time, timeout, force);
|
|
58
40
|
}
|
|
59
41
|
persist() {
|
|
60
42
|
var _a;
|
|
@@ -6,6 +6,7 @@ const models_1 = require("../../../models");
|
|
|
6
6
|
const services_1 = require("../../services");
|
|
7
7
|
const DeviceCapability_1 = require("../DeviceCapability");
|
|
8
8
|
const zigbeeUbisysActuator_1 = require("./zigbeeUbisysActuator");
|
|
9
|
+
const sharedFunctions_1 = require("../sharedFunctions");
|
|
9
10
|
class ZigbeeUbisysLampe extends zigbeeUbisysActuator_1.ZigbeeUbisysActuator {
|
|
10
11
|
constructor(pInfo) {
|
|
11
12
|
super(pInfo, deviceType_1.DeviceType.ZigbeeUbisysLampe);
|
|
@@ -25,37 +26,17 @@ class ZigbeeUbisysLampe extends zigbeeUbisysActuator_1.ZigbeeUbisysActuator {
|
|
|
25
26
|
/** @inheritdoc */
|
|
26
27
|
setLight(pValue, timeout = -1, force = false) {
|
|
27
28
|
this.log(models_1.LogLevel.Debug, `Set Light Acutator to "${pValue}"`, services_1.LogDebugType.SetActuator);
|
|
28
|
-
if (this.settings.isStromStoss) {
|
|
29
|
+
if (this.settings.isStromStoss && pValue) {
|
|
29
30
|
timeout = 3000;
|
|
30
|
-
|
|
31
|
-
var _a;
|
|
32
|
-
if (this.room && ((_a = this.room.PraesenzGroup) === null || _a === void 0 ? void 0 : _a.anyPresent())) {
|
|
33
|
-
this.setLight(true, -1, true);
|
|
34
|
-
}
|
|
35
|
-
}, this.settings.stromStossResendTime * 1000, this);
|
|
31
|
+
sharedFunctions_1.LampUtils.stromStossOn(this);
|
|
36
32
|
}
|
|
37
33
|
super.setActuator(pValue, timeout, force);
|
|
38
34
|
}
|
|
39
35
|
toggleLight(time, force = false, calculateTime = false) {
|
|
40
|
-
|
|
41
|
-
const newVal = this.queuedValue !== null ? !this.queuedValue : !this.lightOn;
|
|
42
|
-
const timeout = newVal && force ? 30 * 60 * 1000 : -1;
|
|
43
|
-
if (newVal && time === undefined && calculateTime && this.room !== undefined) {
|
|
44
|
-
time = services_1.TimeCallbackService.dayType((_a = this.room) === null || _a === void 0 ? void 0 : _a.settings.lampOffset);
|
|
45
|
-
}
|
|
46
|
-
if (newVal && time !== undefined) {
|
|
47
|
-
this.setTimeBased(time, timeout, force);
|
|
48
|
-
return true;
|
|
49
|
-
}
|
|
50
|
-
this.setLight(newVal, timeout, force);
|
|
51
|
-
return newVal;
|
|
36
|
+
return sharedFunctions_1.LampUtils.toggleLight(this, time, force, calculateTime);
|
|
52
37
|
}
|
|
53
38
|
setTimeBased(time, timeout = -1, force = false) {
|
|
54
|
-
|
|
55
|
-
(time === models_1.TimeOfDay.BeforeSunrise && this.settings.dawnOn) ||
|
|
56
|
-
(time === models_1.TimeOfDay.AfterSunset && this.settings.duskOn)) {
|
|
57
|
-
this.setLight(true, timeout, force);
|
|
58
|
-
}
|
|
39
|
+
sharedFunctions_1.LampUtils.setTimeBased(this, time, timeout, force);
|
|
59
40
|
}
|
|
60
41
|
persist() {
|
|
61
42
|
var _a;
|
|
@@ -13,21 +13,22 @@ export declare class OwnGoveeDevice implements iLedRgbCct, iTemporaryDisableAuto
|
|
|
13
13
|
readonly deviceCapabilities: DeviceCapability[];
|
|
14
14
|
readonly blockAutomationHandler: BlockAutomaticHandler;
|
|
15
15
|
on: boolean;
|
|
16
|
+
queuedValue: boolean | null;
|
|
16
17
|
brightness: number;
|
|
18
|
+
targetAutomaticState: boolean;
|
|
17
19
|
constructor(deviceId: string, ownDeviceName: string, roomName: string, device: GoveeDevice | undefined);
|
|
18
20
|
private _color;
|
|
19
|
-
private _colortemp;
|
|
20
|
-
private _targetAutomaticState;
|
|
21
|
-
private _room;
|
|
22
21
|
get color(): string;
|
|
22
|
+
private _colortemp;
|
|
23
23
|
get colortemp(): number;
|
|
24
|
+
private _room;
|
|
25
|
+
get room(): RoomBase;
|
|
24
26
|
get customName(): string;
|
|
25
27
|
get actuatorOn(): boolean;
|
|
26
28
|
get lightOn(): boolean;
|
|
27
29
|
protected _info: DeviceInfo;
|
|
28
30
|
get info(): DeviceInfo;
|
|
29
31
|
set info(info: DeviceInfo);
|
|
30
|
-
get room(): RoomBase;
|
|
31
32
|
get id(): string;
|
|
32
33
|
get name(): string;
|
|
33
34
|
log(level: LogLevel, message: string, debugType?: LogDebugType): void;
|
|
@@ -44,12 +45,12 @@ export declare class OwnGoveeDevice implements iLedRgbCct, iTemporaryDisableAuto
|
|
|
44
45
|
setLight(pValue: boolean, timeout?: number, force?: boolean, brightness?: number, _transitionTime?: number, color?: string, colorTemp?: number): void;
|
|
45
46
|
setActuator(pValue: boolean, timeout?: number, force?: boolean): void;
|
|
46
47
|
restoreTargetAutomaticValue(): void;
|
|
47
|
-
private setBrightness;
|
|
48
|
-
private setColor;
|
|
49
|
-
private turnOn;
|
|
50
|
-
private turnOff;
|
|
51
48
|
persist(): void;
|
|
52
49
|
toggleActuator(_force: boolean): boolean;
|
|
53
50
|
toggleLight(time?: TimeOfDay, _force?: boolean, calculateTime?: boolean): boolean;
|
|
54
51
|
update(data: GoveeDeviceState): void;
|
|
52
|
+
private setBrightness;
|
|
53
|
+
private setColor;
|
|
54
|
+
private turnOn;
|
|
55
|
+
private turnOff;
|
|
55
56
|
}
|
|
@@ -12,7 +12,6 @@ const lodash_1 = __importDefault(require("lodash"));
|
|
|
12
12
|
const DeviceCapability_1 = require("../../devices/DeviceCapability");
|
|
13
13
|
const api_1 = require("../api");
|
|
14
14
|
const blockAutomaticHandler_1 = require("../blockAutomaticHandler");
|
|
15
|
-
const time_callback_service_1 = require("../time-callback-service");
|
|
16
15
|
class OwnGoveeDevice {
|
|
17
16
|
constructor(deviceId, ownDeviceName, roomName, device) {
|
|
18
17
|
this.device = device;
|
|
@@ -25,10 +24,11 @@ class OwnGoveeDevice {
|
|
|
25
24
|
DeviceCapability_1.DeviceCapability.blockAutomatic,
|
|
26
25
|
];
|
|
27
26
|
this.on = false;
|
|
27
|
+
this.queuedValue = null;
|
|
28
28
|
this.brightness = -1;
|
|
29
|
+
this.targetAutomaticState = false;
|
|
29
30
|
this._color = '#fcba32';
|
|
30
31
|
this._colortemp = 500;
|
|
31
|
-
this._targetAutomaticState = false;
|
|
32
32
|
this._room = undefined;
|
|
33
33
|
this.deviceId = deviceId;
|
|
34
34
|
this._info = new devices_1.DeviceInfo();
|
|
@@ -47,6 +47,12 @@ class OwnGoveeDevice {
|
|
|
47
47
|
get colortemp() {
|
|
48
48
|
return this._colortemp;
|
|
49
49
|
}
|
|
50
|
+
get room() {
|
|
51
|
+
if (this._room === undefined) {
|
|
52
|
+
this._room = utils_1.Utils.guard(api_1.API.getRoom(this.info.room));
|
|
53
|
+
}
|
|
54
|
+
return this._room;
|
|
55
|
+
}
|
|
50
56
|
get customName() {
|
|
51
57
|
return this.info.customName;
|
|
52
58
|
}
|
|
@@ -62,12 +68,6 @@ class OwnGoveeDevice {
|
|
|
62
68
|
set info(info) {
|
|
63
69
|
this._info = info;
|
|
64
70
|
}
|
|
65
|
-
get room() {
|
|
66
|
-
if (this._room === undefined) {
|
|
67
|
-
this._room = utils_1.Utils.guard(api_1.API.getRoom(this.info.room));
|
|
68
|
-
}
|
|
69
|
-
return this._room;
|
|
70
|
-
}
|
|
71
71
|
get id() {
|
|
72
72
|
var _a;
|
|
73
73
|
return (_a = this.info.allDevicesKey) !== null && _a !== void 0 ? _a : `govee-${this.info.room}-${this.info.customName}`;
|
|
@@ -135,18 +135,8 @@ class OwnGoveeDevice {
|
|
|
135
135
|
if (formattedColor !== null) {
|
|
136
136
|
this.setColor(color);
|
|
137
137
|
}
|
|
138
|
-
|
|
139
|
-
if (force
|
|
140
|
-
this.settings.resetToAutomaticOnForceOffAfterForceOn &&
|
|
141
|
-
!pValue &&
|
|
142
|
-
this.blockAutomationHandler.automaticBlockActive) {
|
|
143
|
-
dontBlock = true;
|
|
144
|
-
this.log(models_1.LogLevel.Debug, `Reset Automatic Block as we are turning off manually after a force on`);
|
|
145
|
-
this.blockAutomationHandler.liftAutomaticBlock();
|
|
146
|
-
}
|
|
147
|
-
if (!force && this.blockAutomationHandler.automaticBlockActive) {
|
|
148
|
-
this.log(models_1.LogLevel.Debug, `Skip automatic command to ${pValue} as it is locked until ${new Date(this.blockAutomationHandler.automaticBlockedUntil).toLocaleTimeString()}`);
|
|
149
|
-
this._targetAutomaticState = pValue;
|
|
138
|
+
const dontBlock = devices_1.LampUtils.checkUnBlock(this, force, pValue);
|
|
139
|
+
if (devices_1.LampUtils.checkBlockActive(this, force, pValue)) {
|
|
150
140
|
return;
|
|
151
141
|
}
|
|
152
142
|
this.log(models_1.LogLevel.Debug, `Set Light Acutator to "${pValue}" with brightness ${brightness}`, log_service_1.LogDebugType.SetActuator);
|
|
@@ -171,7 +161,25 @@ class OwnGoveeDevice {
|
|
|
171
161
|
}
|
|
172
162
|
restoreTargetAutomaticValue() {
|
|
173
163
|
this.log(models_1.LogLevel.Debug, `Restore Target Automatic value`);
|
|
174
|
-
this.setActuator(this.
|
|
164
|
+
this.setActuator(this.targetAutomaticState);
|
|
165
|
+
}
|
|
166
|
+
persist() {
|
|
167
|
+
var _a;
|
|
168
|
+
(_a = utils_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistActuator(this);
|
|
169
|
+
}
|
|
170
|
+
toggleActuator(_force) {
|
|
171
|
+
this.setLight(!this.on);
|
|
172
|
+
return this.on;
|
|
173
|
+
}
|
|
174
|
+
toggleLight(time, _force = false, calculateTime = false) {
|
|
175
|
+
return devices_1.LampUtils.toggleLight(this, time, _force, calculateTime);
|
|
176
|
+
}
|
|
177
|
+
update(data) {
|
|
178
|
+
this.queuedValue = null;
|
|
179
|
+
this.on = data.isOn === 1;
|
|
180
|
+
this.brightness = data.brightness;
|
|
181
|
+
this._color = `#${data.color.r.toString(16)}${data.color.g.toString(16)}${data.color.b.toString(16)}`;
|
|
182
|
+
this._colortemp = data.colorKelvin;
|
|
175
183
|
}
|
|
176
184
|
setBrightness(brightness, cb) {
|
|
177
185
|
var _a;
|
|
@@ -197,6 +205,7 @@ class OwnGoveeDevice {
|
|
|
197
205
|
if (this.on) {
|
|
198
206
|
return;
|
|
199
207
|
}
|
|
208
|
+
this.queuedValue = true;
|
|
200
209
|
(_a = this.device) === null || _a === void 0 ? void 0 : _a.actions.setOn().then(() => {
|
|
201
210
|
this.log(models_1.LogLevel.Debug, `Govee turned on`, log_service_1.LogDebugType.SetActuator);
|
|
202
211
|
}).catch((error) => {
|
|
@@ -205,37 +214,12 @@ class OwnGoveeDevice {
|
|
|
205
214
|
}
|
|
206
215
|
turnOff() {
|
|
207
216
|
var _a;
|
|
217
|
+
this.queuedValue = false;
|
|
208
218
|
(_a = this.device) === null || _a === void 0 ? void 0 : _a.actions.setOff().then(() => {
|
|
209
219
|
this.log(models_1.LogLevel.Debug, `Govee turned off`, log_service_1.LogDebugType.SetActuator);
|
|
210
220
|
}).catch((error) => {
|
|
211
221
|
this.log(models_1.LogLevel.Error, `Govee turn off resulted in error: ${error}`);
|
|
212
222
|
});
|
|
213
223
|
}
|
|
214
|
-
persist() {
|
|
215
|
-
var _a;
|
|
216
|
-
(_a = utils_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistActuator(this);
|
|
217
|
-
}
|
|
218
|
-
toggleActuator(_force) {
|
|
219
|
-
this.setLight(!this.on);
|
|
220
|
-
return this.on;
|
|
221
|
-
}
|
|
222
|
-
toggleLight(time, _force = false, calculateTime = false) {
|
|
223
|
-
const newVal = !this.lightOn;
|
|
224
|
-
if (newVal && time === undefined && calculateTime) {
|
|
225
|
-
time = time_callback_service_1.TimeCallbackService.dayType(this.room.settings.lampOffset);
|
|
226
|
-
}
|
|
227
|
-
if (newVal && time !== undefined) {
|
|
228
|
-
this.setTimeBased(time);
|
|
229
|
-
return true;
|
|
230
|
-
}
|
|
231
|
-
this.setLight(newVal);
|
|
232
|
-
return newVal;
|
|
233
|
-
}
|
|
234
|
-
update(data) {
|
|
235
|
-
this.on = data.isOn === 1;
|
|
236
|
-
this.brightness = data.brightness;
|
|
237
|
-
this._color = `#${data.color.r.toString(16)}${data.color.g.toString(16)}${data.color.b.toString(16)}`;
|
|
238
|
-
this._colortemp = data.colorKelvin;
|
|
239
|
-
}
|
|
240
224
|
}
|
|
241
225
|
exports.OwnGoveeDevice = OwnGoveeDevice;
|