hoffmation-base 2.22.3 → 2.22.5

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.
@@ -100,11 +100,7 @@ class ZigbeeDimmer extends index_1.ZigbeeDevice {
100
100
  return;
101
101
  }
102
102
  if (transitionTime > -1) {
103
- this.ioConn.setState(this._stateIdTransitionTime, transitionTime, (err) => {
104
- if (err) {
105
- this.log(models_1.LogLevel.Error, `Dimmer TransitionTime schalten ergab Fehler: ${err}`);
106
- }
107
- });
103
+ this.setState(this._stateIdTransitionTime, transitionTime);
108
104
  }
109
105
  const dontBlock = sharedFunctions_1.LampUtils.checkUnBlock(this, force, pValue);
110
106
  if (sharedFunctions_1.LampUtils.checkBlockActive(this, force, pValue)) {
@@ -79,19 +79,11 @@ class ZigbeeLedRGBCCT extends zigbeeDimmer_1.ZigbeeDimmer {
79
79
  }
80
80
  this.log(models_1.LogLevel.Debug, `LED Schalten An: ${pValue}\tHelligkeit: ${brightness}%\tFarbe: "${color}"\tColorTemperatur: ${colorTemp}\tTransition Time: ${transitionTime}`);
81
81
  const formattedColor = services_1.Utils.formatHex(color);
82
- if (formattedColor !== null) {
83
- this.ioConn.setState(this._stateIdColor, color, (err) => {
84
- if (err) {
85
- this.log(models_1.LogLevel.Error, `LED Farbe schalten ergab Fehler: ${err}`);
86
- }
87
- });
82
+ if (formattedColor !== null && pValue) {
83
+ this.setState(this._stateIdColor, formattedColor);
88
84
  }
89
- if (colorTemp > -1) {
90
- this.ioConn.setState(this._stateIdColorTemp, colorTemp, (err) => {
91
- if (err) {
92
- this.log(models_1.LogLevel.Error, `LED Farbwärme schalten ergab Fehler: ${err}`);
93
- }
94
- });
85
+ if (colorTemp > -1 && pValue) {
86
+ this.setState(this._stateIdColorTemp, colorTemp);
95
87
  }
96
88
  super.setLight(pValue, timeout, force, brightness, transitionTime);
97
89
  }
@@ -13,4 +13,8 @@ export declare class ZigbeeInnr142C extends ZigbeeLedRGBCCT {
13
13
  protected readonly _stateNameColorTemp: string;
14
14
  protected readonly _debounceStateDelay: number;
15
15
  constructor(pInfo: IoBrokerDeviceInfo);
16
+ /**
17
+ * @inheritDoc
18
+ */
19
+ setLight(pValue: boolean, timeout?: number, force?: boolean, brightness?: number, transitionTime?: number, color?: string, colorTemp?: number): void;
16
20
  }
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ZigbeeInnr142C = void 0;
4
4
  const deviceType_1 = require("../deviceType");
5
5
  const BaseDevices_1 = require("./BaseDevices");
6
+ const models_1 = require("../../../models");
7
+ const services_1 = require("../../services");
6
8
  class ZigbeeInnr142C extends BaseDevices_1.ZigbeeLedRGBCCT {
7
9
  constructor(pInfo) {
8
10
  super(pInfo, deviceType_1.DeviceType.ZigbeeInnr142C);
@@ -11,12 +13,41 @@ class ZigbeeInnr142C extends BaseDevices_1.ZigbeeLedRGBCCT {
11
13
  this._stateNameTransitionTime = 'transition_time';
12
14
  this._stateNameColor = 'color';
13
15
  this._stateNameColorTemp = 'colortemp';
14
- this._debounceStateDelay = 2500;
16
+ this._debounceStateDelay = 3500;
15
17
  this._stateIdBrightness = `${this.info.fullID}.brightness`;
16
18
  this._stateIdColor = `${this.info.fullID}.color`;
17
19
  this._stateIdColorTemp = `${this.info.fullID}.colortemp`;
18
20
  this._stateIdState = `${this.info.fullID}.state`;
19
21
  this._stateIdTransitionTime = `${this.info.fullID}.transition_time`;
20
22
  }
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ setLight(pValue, timeout, force, brightness = -1, transitionTime, color = '', colorTemp = -1) {
27
+ if (this._stateIdState === '') {
28
+ this.log(models_1.LogLevel.Error, `Keine State ID bekannt.`);
29
+ return;
30
+ }
31
+ if (!this.ioConn) {
32
+ this.log(models_1.LogLevel.Error, `Keine Connection bekannt.`);
33
+ return;
34
+ }
35
+ if (pValue && brightness === -1 && this.brightness < 10) {
36
+ brightness = 10;
37
+ }
38
+ this.log(models_1.LogLevel.Debug, `LED Schalten An: ${pValue}\tHelligkeit: ${brightness}%\tFarbe: "${color}"\tColorTemperatur: ${colorTemp}\tTransition Time: ${transitionTime}`);
39
+ super.setLight(pValue, timeout, force, brightness, transitionTime);
40
+ const formattedColor = services_1.Utils.formatHex(color);
41
+ if (!pValue) {
42
+ return;
43
+ }
44
+ // Farben nur beim Einschalten setzen
45
+ if (formattedColor !== null && this.color !== formattedColor) {
46
+ this.setState(this._stateIdColor, formattedColor);
47
+ }
48
+ if (colorTemp > -1 && this.colortemp !== colorTemp) {
49
+ this.setState(this._stateIdColorTemp, colorTemp);
50
+ }
51
+ }
21
52
  }
22
53
  exports.ZigbeeInnr142C = ZigbeeInnr142C;