hoffmation-base 2.22.10 → 2.22.11

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.
@@ -41,4 +41,5 @@ export declare abstract class ZigbeeDimmer extends ZigbeeDevice implements iDimm
41
41
  setLight(pValue: boolean, timeout?: number, force?: boolean, brightness?: number, transitionTime?: number): void;
42
42
  persist(): void;
43
43
  toggleLight(time?: TimeOfDay, force?: boolean, calculateTime?: boolean): boolean;
44
+ private setBrightnessState;
44
45
  }
@@ -106,7 +106,7 @@ class ZigbeeDimmer extends index_1.ZigbeeDevice {
106
106
  if (sharedFunctions_1.LampUtils.checkBlockActive(this, force, pValue)) {
107
107
  return;
108
108
  }
109
- if (pValue && brightness === -1 && this.brightness < 10) {
109
+ if (pValue && brightness <= 0 && this.brightness < 10) {
110
110
  brightness = 10;
111
111
  }
112
112
  this.log(models_1.LogLevel.Debug, `Set Light Acutator to "${pValue}" with brightness ${brightness}`, services_1.LogDebugType.SetActuator);
@@ -120,13 +120,13 @@ class ZigbeeDimmer extends index_1.ZigbeeDevice {
120
120
  return;
121
121
  }
122
122
  if (brightness >= this.settings.turnOnThreshhold) {
123
- this.setState(this._stateIdBrightness, brightness);
123
+ this.setBrightnessState(brightness);
124
124
  return;
125
125
  }
126
- this.setState(this._stateIdBrightness, this.settings.turnOnThreshhold, () => {
126
+ this.setBrightnessState(this.settings.turnOnThreshhold, () => {
127
127
  services_1.Utils.guardedTimeout(() => {
128
128
  this.log(models_1.LogLevel.Info, `Delayed reduced brightness on ${this.info.customName}`);
129
- this.setState(this._stateIdBrightness, brightness);
129
+ this.setBrightnessState(brightness);
130
130
  }, 1000, this);
131
131
  });
132
132
  }
@@ -142,5 +142,8 @@ class ZigbeeDimmer extends index_1.ZigbeeDevice {
142
142
  toggleLight(time, force = false, calculateTime = false) {
143
143
  return sharedFunctions_1.LampUtils.toggleLight(this, time, force, calculateTime);
144
144
  }
145
+ setBrightnessState(brightness, onSuccess) {
146
+ this.setState(this._stateIdBrightness, Math.max(0, Math.min(brightness, 100)), onSuccess);
147
+ }
145
148
  }
146
149
  exports.ZigbeeDimmer = ZigbeeDimmer;
@@ -15,6 +15,9 @@ class GooveeService {
15
15
  discover: true,
16
16
  discoverInterval: 300000,
17
17
  });
18
+ this.goveeApi.on(govee_lan_controller_1.GoveeEventTypes.Scan, (data) => {
19
+ log_service_1.ServerLogService.writeLog(models_1.LogLevel.Info, `GoveeDevice ${data.ip} scanned`);
20
+ });
18
21
  this.goveeApi.on(govee_lan_controller_1.GoveeEventTypes.Ready, () => {
19
22
  log_service_1.ServerLogService.writeLog(models_1.LogLevel.Info, `Govee ready`);
20
23
  });
@@ -25,6 +28,13 @@ class GooveeService {
25
28
  log_service_1.ServerLogService.writeLog(models_1.LogLevel.Trace, `GoveeDevice ${device.id} joined`);
26
29
  GooveeService.initializeDevice(device);
27
30
  });
31
+ this.goveeApi.on(govee_lan_controller_1.GoveeEventTypes.UnknownDevice, (_data) => {
32
+ log_service_1.ServerLogService.writeLog(models_1.LogLevel.Warn, `GoveeDevice unknown`);
33
+ });
34
+ this.goveeApi.on(govee_lan_controller_1.GoveeEventTypes.UnknownMessage, (data) => {
35
+ log_service_1.ServerLogService.writeLog(models_1.LogLevel.Warn, `GoveeDevice unknown message: ${data}`);
36
+ });
37
+ this.goveeApi.discover();
28
38
  }
29
39
  static initializeDevice(d) {
30
40
  this.devicesDict[d.id] = d;