hoffmation-base 3.0.0-alpha.81 → 3.0.0-alpha.82

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,23 +100,25 @@ class VeluxShutter extends veluxDevice_1.VeluxDevice {
100
100
  }
101
101
  this._setLevel = targetLevel;
102
102
  this.log(models_2.LogLevel.Debug, `Fahre Rollo auf Position ${targetLevel}`);
103
- this.setState(this._setLevelSwitchID, targetLevel);
103
+ // Level is inverted for Velux Adapter (100 = 0, 0 = 100, 25 = 75, etc.)
104
+ this.setState(this._setLevelSwitchID, Math.abs(targetLevel - 100));
104
105
  }
105
106
  toJSON() {
106
107
  return lodash_1.default.omit(super.toJSON(), ['_window']);
107
108
  }
108
109
  setCurrentLevel(value, initial = false) {
109
- if (value !== this._setLevel && services_1.Utils.nowMS() - this._setLevelTime < 60 * 10000) {
110
- value = this._setLevel;
110
+ let correctedValue = Math.abs(value - 100);
111
+ if (correctedValue !== this._setLevel && services_1.Utils.nowMS() - this._setLevelTime < 60 * 10000) {
112
+ correctedValue = this._setLevel;
111
113
  }
112
- if (value !== this._currentLevel && this._window && !initial) {
114
+ if (correctedValue !== this._currentLevel && this._window && !initial) {
113
115
  services_1.Utils.guardedNewThread(() => {
114
116
  var _a;
115
- (_a = this._window) === null || _a === void 0 ? void 0 : _a.rolloPositionChange(new models_2.ShutterPositionChangedAction(this, value));
117
+ (_a = this._window) === null || _a === void 0 ? void 0 : _a.rolloPositionChange(new models_2.ShutterPositionChangedAction(this, correctedValue));
116
118
  }, this);
117
119
  this.persist();
118
120
  }
119
- this._currentLevel = value;
121
+ this._currentLevel = correctedValue;
120
122
  }
121
123
  }
122
124
  exports.VeluxShutter = VeluxShutter;