hoffmation-base 2.22.0 → 2.22.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.
@@ -4,4 +4,8 @@ export interface iIobrokerSettigns {
4
4
  * This allows to detect states which crash the Websocket Payload limit
5
5
  */
6
6
  useSplitInitialization?: boolean;
7
+ /**
8
+ * Whether the new/advanced zigbee2mqtt adapter is used
9
+ */
10
+ useZigbee2mqtt?: boolean;
7
11
  }
@@ -90,6 +90,7 @@ class ZigbeeDimmer extends index_1.ZigbeeDevice {
90
90
  * @param {number} transitionTime The transition time for the brightness, to switch smoothly
91
91
  */
92
92
  setLight(pValue, timeout = -1, force = false, brightness = -1, transitionTime = -1) {
93
+ var _a;
93
94
  if (this._stateIdState === '') {
94
95
  this.log(models_1.LogLevel.Error, `Keine State ID bekannt.`);
95
96
  return;
@@ -113,24 +114,25 @@ class ZigbeeDimmer extends index_1.ZigbeeDevice {
113
114
  brightness = 10;
114
115
  }
115
116
  this.log(models_1.LogLevel.Debug, `Set Light Acutator to "${pValue}" with brightness ${brightness}`, services_1.LogDebugType.SetActuator);
116
- this.setState(this._stateIdState, pValue);
117
- this.queuedValue = pValue;
118
- if (brightness > -1) {
119
- if (brightness < this.settings.turnOnThreshhold) {
120
- this.setState(this._stateIdBrightness, this.settings.turnOnThreshhold, () => {
121
- services_1.Utils.guardedTimeout(() => {
122
- this.log(models_1.LogLevel.Info, `Delayed reduced brightness on ${this.info.customName}`);
123
- this.setState(this._stateIdBrightness, brightness);
124
- }, 1000, this);
125
- });
126
- }
127
- else {
128
- this.setState(this._stateIdBrightness, brightness);
129
- }
130
- }
131
117
  if (timeout > -1 && !dontBlock) {
132
118
  this.blockAutomationHandler.disableAutomatic(timeout, models_1.CollisionSolving.overrideIfGreater);
133
119
  }
120
+ if (((_a = services_1.SettingsService.settings.ioBroker) === null || _a === void 0 ? void 0 : _a.useZigbee2mqtt) && !pValue) {
121
+ // With zigbee2mqtt to turn on only setting brighness>0 is needed, so we need state only for turning off
122
+ this.setState(this._stateIdState, pValue);
123
+ this.queuedValue = pValue;
124
+ return;
125
+ }
126
+ if (brightness >= this.settings.turnOnThreshhold) {
127
+ this.setState(this._stateIdBrightness, brightness);
128
+ return;
129
+ }
130
+ this.setState(this._stateIdBrightness, this.settings.turnOnThreshhold, () => {
131
+ services_1.Utils.guardedTimeout(() => {
132
+ this.log(models_1.LogLevel.Info, `Delayed reduced brightness on ${this.info.customName}`);
133
+ this.setState(this._stateIdBrightness, brightness);
134
+ }, 1000, this);
135
+ });
134
136
  }
135
137
  persist() {
136
138
  var _a;
@@ -77,7 +77,7 @@ class ZigbeeLedRGBCCT extends zigbeeDimmer_1.ZigbeeDimmer {
77
77
  if (pValue && brightness === -1 && this.brightness < 10) {
78
78
  brightness = 10;
79
79
  }
80
- this.log(models_1.LogLevel.Debug, `LED Schalten An: ${pValue}\tHelligkeit: ${brightness}%\tFarbe: "${color}"\tColorTemperatur: ${colorTemp}`);
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
82
  if (formattedColor !== null) {
83
83
  this.ioConn.setState(this._stateIdColor, color, (err) => {