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
|
@@ -21,6 +21,7 @@ var DeviceCapability;
|
|
|
21
21
|
DeviceCapability[DeviceCapability["handleSensor"] = 15] = "handleSensor";
|
|
22
22
|
DeviceCapability[DeviceCapability["batteryDriven"] = 16] = "batteryDriven";
|
|
23
23
|
DeviceCapability[DeviceCapability["tv"] = 17] = "tv";
|
|
24
|
+
DeviceCapability[DeviceCapability["ledLamp"] = 18] = "ledLamp";
|
|
24
25
|
DeviceCapability[DeviceCapability["bluetoothDetector"] = 101] = "bluetoothDetector";
|
|
25
26
|
DeviceCapability[DeviceCapability["trackableDevice"] = 102] = "trackableDevice";
|
|
26
27
|
})(DeviceCapability = exports.DeviceCapability || (exports.DeviceCapability = {}));
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { ActuatorSettings } from '../../../models';
|
|
2
2
|
import { iRoomDevice } from './iRoomDevice';
|
|
3
3
|
export interface iActuator extends iRoomDevice {
|
|
4
|
+
/**
|
|
5
|
+
* The settings for this Actuator primarily for controlling it's automatic actions
|
|
6
|
+
*/
|
|
4
7
|
settings: ActuatorSettings;
|
|
5
|
-
|
|
8
|
+
/**
|
|
9
|
+
* The state value of the device
|
|
10
|
+
*/
|
|
11
|
+
readonly actuatorOn: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Persisting the current states of this device to the database
|
|
14
|
+
*/
|
|
6
15
|
persist(): void;
|
|
7
16
|
/**
|
|
8
17
|
* Controls the power state of this actuator
|
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
import { TimeOfDay } from '../../../models';
|
|
2
2
|
import { iActuator } from './iActuator';
|
|
3
3
|
export interface iLamp extends iActuator {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The state value of the device
|
|
6
|
+
*/
|
|
7
|
+
readonly lightOn: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Set's the lamp based on lamp settings for the current time
|
|
10
|
+
* @param {TimeOfDay} time The time to use for calculation of desired state
|
|
11
|
+
* @param {number} timeout If > 0 this is the time after which the lamp reverts to its original state
|
|
12
|
+
* @param {boolean} force To indicate a higher priority than automatic actions (e.g. a user pressing a button)
|
|
13
|
+
*/
|
|
14
|
+
setTimeBased(time: TimeOfDay, timeout?: number, force?: boolean): void;
|
|
15
|
+
/**
|
|
16
|
+
* Toggles the state of the lamp
|
|
17
|
+
* @param {TimeOfDay} time The time to use for calculation of desired state
|
|
18
|
+
* @param {boolean} force To indicate a higher priority than automatic actions (e.g. a user pressing a button)
|
|
19
|
+
* @param {boolean} calculateTime Alternative to "time", if set the time will be calculated by the lamps room and its settings
|
|
20
|
+
*/
|
|
21
|
+
toggleLight(time?: TimeOfDay, force?: boolean, calculateTime?: boolean): void;
|
|
7
22
|
/**
|
|
8
23
|
* This function sets the light to a specific value
|
|
9
24
|
* @param pValue The desired value
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="iobroker" />
|
|
2
|
+
import { LedSettings, TimeOfDay } from '../../../models';
|
|
3
|
+
import { iDimmableLamp } from './iDimmableLamp';
|
|
4
|
+
export interface iLedRgbCct extends iDimmableLamp {
|
|
5
|
+
settings: LedSettings;
|
|
6
|
+
readonly color: string;
|
|
7
|
+
readonly colortemp: number;
|
|
8
|
+
update(idSplit: string[], state: ioBroker.State, initial: boolean): void;
|
|
9
|
+
/**
|
|
10
|
+
* @inheritDoc
|
|
11
|
+
*/
|
|
12
|
+
setTimeBased(time: TimeOfDay, timeout?: number, force?: boolean): void;
|
|
13
|
+
/**
|
|
14
|
+
* @inheritDoc
|
|
15
|
+
* @param pValue
|
|
16
|
+
* @param timeout
|
|
17
|
+
* @param force
|
|
18
|
+
* @param brightness
|
|
19
|
+
* @param transitionTime
|
|
20
|
+
* @param {string} color The desired color in 6 digit hex Code
|
|
21
|
+
* @param {number} colorTemp The desired color Temperature (0 = more White)
|
|
22
|
+
*/
|
|
23
|
+
setLight(pValue: boolean, timeout?: number, force?: boolean, brightness?: number, transitionTime?: number, color?: string, colorTemp?: number): void;
|
|
24
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { ZigbeeIlluLedRGBCCT } from '../zigbee';
|
|
2
1
|
import { BaseGroup } from './base-group';
|
|
3
2
|
import { iActuator, iLamp } from '../baseDeviceInterfaces';
|
|
4
3
|
import { TimeOfDay } from '../../../models';
|
|
5
4
|
import { WledDevice } from '../wledDevice';
|
|
5
|
+
import { iLedRgbCct } from '../baseDeviceInterfaces/iLedRgbCct';
|
|
6
6
|
export declare class LampenGroup extends BaseGroup {
|
|
7
7
|
constructor(roomName: string, lampenIds?: string[], steckerIds?: string[], ledIds?: string[], wledIds?: string[]);
|
|
8
8
|
anyLightsOn(): boolean;
|
|
9
9
|
getLampen(): iLamp[];
|
|
10
|
-
getLED():
|
|
10
|
+
getLED(): iLedRgbCct[];
|
|
11
11
|
getWled(): WledDevice[];
|
|
12
12
|
getStecker(): iActuator[];
|
|
13
13
|
handleSunriseOff(): void;
|
|
@@ -43,7 +43,7 @@ class LampenGroup extends base_group_1.BaseGroup {
|
|
|
43
43
|
return this.deviceCluster.getDevicesByType(device_cluster_type_1.DeviceClusterType.Lamps);
|
|
44
44
|
}
|
|
45
45
|
getLED() {
|
|
46
|
-
return this.deviceCluster.
|
|
46
|
+
return this.deviceCluster.getDevicesByType(device_cluster_type_1.DeviceClusterType.LED);
|
|
47
47
|
}
|
|
48
48
|
getWled() {
|
|
49
49
|
return this.deviceCluster.getIoBrokerDevicesByType(device_cluster_type_1.DeviceClusterType.WLED);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from './ZigbeeActuator';
|
|
2
2
|
export * from './zigbeeDevice';
|
|
3
|
+
export * from './zigbeeDimmer';
|
|
3
4
|
export * from './zigbeeHeater';
|
|
5
|
+
export * from './zigbeeLedRGBCCT';
|
|
4
6
|
export * from './zigbeeMagnetContact';
|
|
5
7
|
export * from './zigbeeMotionSensor';
|
|
6
8
|
export * from './zigbeeShutter';
|
|
@@ -16,7 +16,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./ZigbeeActuator"), exports);
|
|
18
18
|
__exportStar(require("./zigbeeDevice"), exports);
|
|
19
|
+
__exportStar(require("./zigbeeDimmer"), exports);
|
|
19
20
|
__exportStar(require("./zigbeeHeater"), exports);
|
|
21
|
+
__exportStar(require("./zigbeeLedRGBCCT"), exports);
|
|
20
22
|
__exportStar(require("./zigbeeMagnetContact"), exports);
|
|
21
23
|
__exportStar(require("./zigbeeMotionSensor"), exports);
|
|
22
24
|
__exportStar(require("./zigbeeShutter"), exports);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="iobroker" />
|
|
3
|
+
import { DimmerSettings, TimeOfDay } from '../../../../models';
|
|
4
|
+
import { DeviceType } from '../../deviceType';
|
|
5
|
+
import { ZigbeeDevice } from './index';
|
|
6
|
+
import { IoBrokerDeviceInfo } from '../../IoBrokerDeviceInfo';
|
|
7
|
+
import { iDimmableLamp } from '../../baseDeviceInterfaces/iDimmableLamp';
|
|
8
|
+
export declare abstract class ZigbeeDimmer extends ZigbeeDevice implements iDimmableLamp {
|
|
9
|
+
queuedValue: boolean | null;
|
|
10
|
+
settings: DimmerSettings;
|
|
11
|
+
protected _brightness: number;
|
|
12
|
+
protected _lastPersist: number;
|
|
13
|
+
protected _lightOn: boolean;
|
|
14
|
+
protected _transitionTime: number;
|
|
15
|
+
protected _turnOffTime: number;
|
|
16
|
+
protected _turnOffTimeout: NodeJS.Timeout | undefined;
|
|
17
|
+
protected abstract readonly _stateIdBrightness: string;
|
|
18
|
+
protected abstract readonly _stateIdState: string;
|
|
19
|
+
protected abstract readonly _stateIdTransitionTime: string;
|
|
20
|
+
protected abstract readonly _stateNameBrightness: string;
|
|
21
|
+
protected abstract readonly _stateNameState: string;
|
|
22
|
+
protected abstract readonly _stateNameTransitionTime: string;
|
|
23
|
+
get lightOn(): boolean;
|
|
24
|
+
get brightness(): number;
|
|
25
|
+
get transitionTime(): number;
|
|
26
|
+
get actuatorOn(): boolean;
|
|
27
|
+
protected constructor(pInfo: IoBrokerDeviceInfo, deviceType: DeviceType);
|
|
28
|
+
update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
|
|
29
|
+
setTimeBased(time: TimeOfDay, timeout?: number, force?: boolean): void;
|
|
30
|
+
setActuator(pValue: boolean, timeout?: number, force?: boolean): void;
|
|
31
|
+
toggleActuator(force: boolean): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* @inheritDoc
|
|
34
|
+
* @param pValue The desired value
|
|
35
|
+
* @param timeout If > 0 time at which this should be turned off again
|
|
36
|
+
* @param force if it is an user based action which should override automatic ones
|
|
37
|
+
* @param {number} brightness The desired brightness in percent
|
|
38
|
+
* @param {number} transitionTime The transition time for the brightness, to switch smoothly
|
|
39
|
+
*/
|
|
40
|
+
setLight(pValue: boolean, timeout?: number, force?: boolean, brightness?: number, transitionTime?: number): void;
|
|
41
|
+
persist(): void;
|
|
42
|
+
toggleLight(time?: TimeOfDay, force?: boolean, calculateTime?: boolean): boolean;
|
|
43
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ZigbeeDimmer = void 0;
|
|
4
|
+
const models_1 = require("../../../../models");
|
|
5
|
+
const services_1 = require("../../../services");
|
|
6
|
+
const index_1 = require("./index");
|
|
7
|
+
const DeviceCapability_1 = require("../../DeviceCapability");
|
|
8
|
+
class ZigbeeDimmer extends index_1.ZigbeeDevice {
|
|
9
|
+
constructor(pInfo, deviceType) {
|
|
10
|
+
super(pInfo, deviceType);
|
|
11
|
+
this.queuedValue = null;
|
|
12
|
+
this.settings = new models_1.DimmerSettings();
|
|
13
|
+
this._brightness = 0;
|
|
14
|
+
this._lastPersist = 0;
|
|
15
|
+
this._lightOn = false;
|
|
16
|
+
this._transitionTime = 0;
|
|
17
|
+
this._turnOffTime = 0;
|
|
18
|
+
this._turnOffTimeout = undefined;
|
|
19
|
+
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.lamp);
|
|
20
|
+
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.dimmablelamp);
|
|
21
|
+
}
|
|
22
|
+
get lightOn() {
|
|
23
|
+
return this._lightOn;
|
|
24
|
+
}
|
|
25
|
+
get brightness() {
|
|
26
|
+
return this._brightness;
|
|
27
|
+
}
|
|
28
|
+
get transitionTime() {
|
|
29
|
+
return this._transitionTime;
|
|
30
|
+
}
|
|
31
|
+
get actuatorOn() {
|
|
32
|
+
return this.lightOn;
|
|
33
|
+
}
|
|
34
|
+
update(idSplit, state, initial = false) {
|
|
35
|
+
this.queuedValue = null;
|
|
36
|
+
this.log(models_1.LogLevel.DeepTrace, `Dimmer Update: ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`);
|
|
37
|
+
super.update(idSplit, state, initial, true);
|
|
38
|
+
switch (idSplit[3]) {
|
|
39
|
+
case this._stateNameState:
|
|
40
|
+
this.log(models_1.LogLevel.Trace, `Dimmer Update für ${this.info.customName} auf ${state.val}`);
|
|
41
|
+
this._lightOn = state.val;
|
|
42
|
+
this.persist();
|
|
43
|
+
break;
|
|
44
|
+
case this._stateNameBrightness:
|
|
45
|
+
this.log(models_1.LogLevel.Trace, `Dimmer Helligkeit Update für ${this.info.customName} auf ${state.val}`);
|
|
46
|
+
this._brightness = state.val;
|
|
47
|
+
this.persist();
|
|
48
|
+
break;
|
|
49
|
+
case this._stateNameTransitionTime:
|
|
50
|
+
this.log(models_1.LogLevel.Trace, `Dimmer Transition Time Update für ${this.info.customName} auf ${state.val}`);
|
|
51
|
+
this._transitionTime = state.val;
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
setTimeBased(time, timeout = -1, force = false) {
|
|
56
|
+
switch (time) {
|
|
57
|
+
case models_1.TimeOfDay.Night:
|
|
58
|
+
this.setLight(true, timeout, force, this.settings.nightBrightness);
|
|
59
|
+
break;
|
|
60
|
+
case models_1.TimeOfDay.AfterSunset:
|
|
61
|
+
this.setLight(true, timeout, force, this.settings.dawnBrightness);
|
|
62
|
+
break;
|
|
63
|
+
case models_1.TimeOfDay.BeforeSunrise:
|
|
64
|
+
this.setLight(true, timeout, force, this.settings.duskBrightness);
|
|
65
|
+
break;
|
|
66
|
+
case models_1.TimeOfDay.Daylight:
|
|
67
|
+
this.setLight(true, timeout, force, this.settings.dayBrightness);
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
setActuator(pValue, timeout, force) {
|
|
72
|
+
this.setLight(pValue, timeout, force);
|
|
73
|
+
}
|
|
74
|
+
toggleActuator(force) {
|
|
75
|
+
return this.toggleLight(undefined, force);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* @inheritDoc
|
|
79
|
+
* @param pValue The desired value
|
|
80
|
+
* @param timeout If > 0 time at which this should be turned off again
|
|
81
|
+
* @param force if it is an user based action which should override automatic ones
|
|
82
|
+
* @param {number} brightness The desired brightness in percent
|
|
83
|
+
* @param {number} transitionTime The transition time for the brightness, to switch smoothly
|
|
84
|
+
*/
|
|
85
|
+
setLight(pValue, timeout = -1, force = false, brightness = -1, transitionTime = -1) {
|
|
86
|
+
if (this._stateIdState === '') {
|
|
87
|
+
this.log(models_1.LogLevel.Error, `Keine State ID bekannt.`);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (!this.ioConn) {
|
|
91
|
+
this.log(models_1.LogLevel.Error, `Keine Connection bekannt.`);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (transitionTime > -1) {
|
|
95
|
+
this.ioConn.setState(this._stateIdTransitionTime, transitionTime, (err) => {
|
|
96
|
+
if (err) {
|
|
97
|
+
this.log(models_1.LogLevel.Error, `Dimmer TransitionTime schalten ergab Fehler: ${err}`);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
if (!force && services_1.Utils.nowMS() < this._turnOffTime) {
|
|
102
|
+
this.log(models_1.LogLevel.Debug, `Skip automatic command to ${pValue} as it is locked until ${new Date(this._turnOffTime).toLocaleTimeString()}`);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (pValue && brightness === -1 && this.brightness < 10) {
|
|
106
|
+
brightness = 10;
|
|
107
|
+
}
|
|
108
|
+
this.log(models_1.LogLevel.Debug, `Set Light Acutator to "${pValue}" with brightness ${brightness}`, services_1.LogDebugType.SetActuator);
|
|
109
|
+
this.setState(this._stateIdState, pValue);
|
|
110
|
+
this.queuedValue = pValue;
|
|
111
|
+
if (brightness > -1) {
|
|
112
|
+
if (brightness < this.settings.turnOnThreshhold) {
|
|
113
|
+
this.setState(this._stateIdBrightness, this.settings.turnOnThreshhold, () => {
|
|
114
|
+
services_1.Utils.guardedTimeout(() => {
|
|
115
|
+
this.log(models_1.LogLevel.Info, `Delayed reduced brightness on ${this.info.customName}`);
|
|
116
|
+
this.setState(this._stateIdBrightness, brightness);
|
|
117
|
+
}, 1000, this);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
this.setState(this._stateIdBrightness, brightness);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (this._turnOffTimeout !== undefined) {
|
|
125
|
+
clearTimeout(this._turnOffTimeout);
|
|
126
|
+
this._turnOffTimeout = undefined;
|
|
127
|
+
}
|
|
128
|
+
if (timeout < 0 || !pValue) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
this._turnOffTime = services_1.Utils.nowMS() + timeout;
|
|
132
|
+
this._turnOffTimeout = services_1.Utils.guardedTimeout(() => {
|
|
133
|
+
this.log(models_1.LogLevel.Debug, `Delayed Turnoff initiated`);
|
|
134
|
+
this._turnOffTimeout = undefined;
|
|
135
|
+
if (!this.room) {
|
|
136
|
+
this.setLight(false, -1, true);
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
this.room.setLightTimeBased(true);
|
|
140
|
+
}
|
|
141
|
+
}, timeout, this);
|
|
142
|
+
}
|
|
143
|
+
persist() {
|
|
144
|
+
var _a;
|
|
145
|
+
const now = services_1.Utils.nowMS();
|
|
146
|
+
if (this._lastPersist + 1000 < now) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
(_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistActuator(this);
|
|
150
|
+
this._lastPersist = now;
|
|
151
|
+
}
|
|
152
|
+
toggleLight(time, force = false, calculateTime = false) {
|
|
153
|
+
var _a;
|
|
154
|
+
const newVal = this.queuedValue !== null ? !this.queuedValue : !this.lightOn;
|
|
155
|
+
const timeout = newVal && force ? 30 * 60 * 1000 : -1;
|
|
156
|
+
if (newVal && time === undefined && calculateTime && this.room !== undefined) {
|
|
157
|
+
time = services_1.TimeCallbackService.dayType((_a = this.room) === null || _a === void 0 ? void 0 : _a.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;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
exports.ZigbeeDimmer = ZigbeeDimmer;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/// <reference types="iobroker" />
|
|
2
|
+
import { DeviceType } from '../../deviceType';
|
|
3
|
+
import { LedSettings, TimeOfDay } from '../../../../models';
|
|
4
|
+
import { IoBrokerDeviceInfo } from '../../IoBrokerDeviceInfo';
|
|
5
|
+
import { iLedRgbCct } from '../../baseDeviceInterfaces/iLedRgbCct';
|
|
6
|
+
import { ZigbeeDimmer } from './zigbeeDimmer';
|
|
7
|
+
export declare abstract class ZigbeeLedRGBCCT extends ZigbeeDimmer implements iLedRgbCct {
|
|
8
|
+
static DEFAULT_COLOR_WARM: string;
|
|
9
|
+
settings: LedSettings;
|
|
10
|
+
protected abstract readonly _stateIdColor: string;
|
|
11
|
+
protected abstract readonly _stateIdColorTemp: string;
|
|
12
|
+
protected abstract readonly _stateNameColor: string;
|
|
13
|
+
protected abstract readonly _stateNameColorTemp: string;
|
|
14
|
+
protected constructor(pInfo: IoBrokerDeviceInfo, deviceType: DeviceType);
|
|
15
|
+
protected _color: string;
|
|
16
|
+
get color(): string;
|
|
17
|
+
protected _colortemp: number;
|
|
18
|
+
get colortemp(): number;
|
|
19
|
+
update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
|
|
20
|
+
/**
|
|
21
|
+
* @inheritDoc
|
|
22
|
+
*/
|
|
23
|
+
setTimeBased(time: TimeOfDay, timeout?: number, force?: boolean): void;
|
|
24
|
+
/**
|
|
25
|
+
* @inheritDoc
|
|
26
|
+
*/
|
|
27
|
+
setLight(pValue: boolean, timeout?: number, force?: boolean, brightness?: number, transitionTime?: number, color?: string, colorTemp?: number): void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ZigbeeLedRGBCCT = void 0;
|
|
4
|
+
const models_1 = require("../../../../models");
|
|
5
|
+
const DeviceCapability_1 = require("../../DeviceCapability");
|
|
6
|
+
const zigbeeDimmer_1 = require("./zigbeeDimmer");
|
|
7
|
+
class ZigbeeLedRGBCCT extends zigbeeDimmer_1.ZigbeeDimmer {
|
|
8
|
+
constructor(pInfo, deviceType) {
|
|
9
|
+
super(pInfo, deviceType);
|
|
10
|
+
this.settings = new models_1.LedSettings();
|
|
11
|
+
this._color = '#fcba32';
|
|
12
|
+
this._colortemp = 500;
|
|
13
|
+
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.ledLamp);
|
|
14
|
+
// this.effectID = `${this.info.fullID}.effect`;
|
|
15
|
+
}
|
|
16
|
+
get color() {
|
|
17
|
+
return this._color;
|
|
18
|
+
}
|
|
19
|
+
get colortemp() {
|
|
20
|
+
return this._colortemp;
|
|
21
|
+
}
|
|
22
|
+
// private effectID: string = '';
|
|
23
|
+
update(idSplit, state, initial = false) {
|
|
24
|
+
this.log(models_1.LogLevel.DeepTrace, `LED Update: ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`);
|
|
25
|
+
super.update(idSplit, state, initial);
|
|
26
|
+
switch (idSplit[3]) {
|
|
27
|
+
case this._stateNameColor:
|
|
28
|
+
this.log(models_1.LogLevel.Trace, `LED Color Update für ${this.info.customName} auf ${state.val}`);
|
|
29
|
+
this._color = state.val;
|
|
30
|
+
break;
|
|
31
|
+
case this._stateNameColorTemp:
|
|
32
|
+
this.log(models_1.LogLevel.Trace, `LED Color Temp Update für ${this.info.customName} auf ${state.val}`);
|
|
33
|
+
this._colortemp = state.val;
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @inheritDoc
|
|
39
|
+
*/
|
|
40
|
+
setTimeBased(time, timeout = -1, force = false) {
|
|
41
|
+
switch (time) {
|
|
42
|
+
case models_1.TimeOfDay.Night:
|
|
43
|
+
if (this.settings.nightOn) {
|
|
44
|
+
this.setLight(true, timeout, force, this.settings.nightBrightness, undefined, this.settings.nightColor, this.settings.nightColorTemp);
|
|
45
|
+
}
|
|
46
|
+
break;
|
|
47
|
+
case models_1.TimeOfDay.AfterSunset:
|
|
48
|
+
if (this.settings.duskOn) {
|
|
49
|
+
this.setLight(true, timeout, force, this.settings.duskBrightness, undefined, this.settings.duskColor, this.settings.duskColorTemp);
|
|
50
|
+
}
|
|
51
|
+
break;
|
|
52
|
+
case models_1.TimeOfDay.BeforeSunrise:
|
|
53
|
+
if (this.settings.dawnOn) {
|
|
54
|
+
this.setLight(true, timeout, force, this.settings.dawnBrightness, undefined, this.settings.dawnColor, this.settings.dawnColorTemp);
|
|
55
|
+
}
|
|
56
|
+
break;
|
|
57
|
+
case models_1.TimeOfDay.Daylight:
|
|
58
|
+
if (this.settings.dayOn) {
|
|
59
|
+
this.setLight(true, timeout, force, this.settings.dayBrightness, undefined, this.settings.dayColor, this.settings.dayColorTemp);
|
|
60
|
+
}
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* @inheritDoc
|
|
66
|
+
*/
|
|
67
|
+
setLight(pValue, timeout, force, brightness = -1, transitionTime, color = '', colorTemp = -1) {
|
|
68
|
+
if (this._stateIdState === '') {
|
|
69
|
+
this.log(models_1.LogLevel.Error, `Keine State ID bekannt.`);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (!this.ioConn) {
|
|
73
|
+
this.log(models_1.LogLevel.Error, `Keine Connection bekannt.`);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (pValue && brightness === -1 && this.brightness < 10) {
|
|
77
|
+
brightness = 10;
|
|
78
|
+
}
|
|
79
|
+
this.log(models_1.LogLevel.Debug, `LED Schalten An: ${pValue}\tHelligkeit: ${brightness}%\tFarbe: "${color}"\tColorTemperatur: ${colorTemp}`);
|
|
80
|
+
super.setLight(pValue, timeout, force, brightness, transitionTime);
|
|
81
|
+
if (color !== '') {
|
|
82
|
+
this.ioConn.setState(this._stateIdColor, color, (err) => {
|
|
83
|
+
if (err) {
|
|
84
|
+
this.log(models_1.LogLevel.Error, `LED Farbe schalten ergab Fehler: ${err}`);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
if (colorTemp > -1) {
|
|
89
|
+
this.ioConn.setState(this._stateIdColorTemp, colorTemp, (err) => {
|
|
90
|
+
if (err) {
|
|
91
|
+
this.log(models_1.LogLevel.Error, `LED Farbwärme schalten ergab Fehler: ${err}`);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
this.ioConn.setState(this._stateIdState, pValue, (err) => {
|
|
96
|
+
if (err) {
|
|
97
|
+
this.log(models_1.LogLevel.Error, `LED schalten ergab Fehler: ${err}`);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
exports.ZigbeeLedRGBCCT = ZigbeeLedRGBCCT;
|
|
103
|
+
ZigbeeLedRGBCCT.DEFAULT_COLOR_WARM = '#f2b200';
|
|
@@ -87,13 +87,9 @@ class ZigbeeEuroHeater extends BaseDevices_1.ZigbeeHeater {
|
|
|
87
87
|
case 'spz_trv_mode':
|
|
88
88
|
this.log(models_1.LogLevel.Trace, `Euro Valve mode Update for ${this.info.customName} to "${state.val}"`);
|
|
89
89
|
this._mode = state.val;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
else if (this._mode == 1) {
|
|
95
|
-
this.setMode(2);
|
|
96
|
-
}
|
|
90
|
+
const desiredMode = this.settings.controlByPid ? 1 : 2;
|
|
91
|
+
if (!this.settings.seasonalTurnOffActive && this._mode !== desiredMode) {
|
|
92
|
+
this.setMode(desiredMode);
|
|
97
93
|
}
|
|
98
94
|
break;
|
|
99
95
|
case 'target_temperature':
|
|
@@ -1,36 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
import { DimmerSettings, TimeOfDay } from '../../../models';
|
|
3
|
-
import { DeviceType } from '../deviceType';
|
|
4
|
-
import { ZigbeeDevice } from './BaseDevices';
|
|
1
|
+
import { ZigbeeDimmer } from './BaseDevices';
|
|
5
2
|
import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
protected readonly brightnessID: string;
|
|
15
|
-
protected readonly transitionID: string;
|
|
16
|
-
private _turnOffTimeout;
|
|
17
|
-
private turnOffTime;
|
|
18
|
-
private _lastPersist;
|
|
19
|
-
constructor(pInfo: IoBrokerDeviceInfo, deviceType?: DeviceType);
|
|
20
|
-
get actuatorOn(): boolean;
|
|
21
|
-
update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
|
|
22
|
-
setTimeBased(time: TimeOfDay, timeout?: number, force?: boolean): void;
|
|
23
|
-
setActuator(pValue: boolean, timeout?: number, force?: boolean): void;
|
|
24
|
-
toggleActuator(force: boolean): boolean;
|
|
25
|
-
/**
|
|
26
|
-
* @inheritDoc
|
|
27
|
-
* @param pValue The desired value
|
|
28
|
-
* @param timeout If > 0 time at which this should be turned off again
|
|
29
|
-
* @param force if it is an user based action which should override automatic ones
|
|
30
|
-
* @param {number} brightness The desired brightness in percent
|
|
31
|
-
* @param {number} transitionTime The transition time for the brightness, to switch smoothly
|
|
32
|
-
*/
|
|
33
|
-
setLight(pValue: boolean, timeout?: number, force?: boolean, brightness?: number, transitionTime?: number): void;
|
|
34
|
-
persist(): void;
|
|
35
|
-
toggleLight(time?: TimeOfDay, force?: boolean, calculateTime?: boolean): boolean;
|
|
3
|
+
export declare class ZigbeeIlluDimmer extends ZigbeeDimmer {
|
|
4
|
+
protected _stateNameBrightness: string;
|
|
5
|
+
protected _stateNameState: string;
|
|
6
|
+
protected _stateNameTransitionTime: string;
|
|
7
|
+
protected _stateIdBrightness: string;
|
|
8
|
+
protected _stateIdState: string;
|
|
9
|
+
protected _stateIdTransitionTime: string;
|
|
10
|
+
constructor(pInfo: IoBrokerDeviceInfo);
|
|
36
11
|
}
|