hoffmation-base 3.7.2 → 3.7.3

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.
@@ -42,6 +42,11 @@ export declare class OwnGoveeDevice extends RoomBaseDevice implements iLedRgbCct
42
42
  update(data: GoveeDeviceData): void;
43
43
  private setBrightness;
44
44
  private setColor;
45
+ /**
46
+ * Sets the white color temperature of the device. Only devices with white leds (RGBWW/RGBICWW) react to this.
47
+ * @param colorTemp - The desired color temperature in Kelvin (1000-9000), as that is the unit Govee devices use.
48
+ */
49
+ private setColorTemp;
45
50
  private turnOn;
46
51
  private turnOff;
47
52
  }
@@ -70,9 +70,15 @@ class OwnGoveeDevice extends RoomBaseDevice_1.RoomBaseDevice {
70
70
  this.log(enums_1.LogLevel.Debug, c.logMessage, enums_1.LogDebugType.SetActuator);
71
71
  if (c.on) {
72
72
  // Changing the color turns the device on as well --> Only change color on turn on actions
73
- const formattedColor = utils_1.Utils.formatHex(c.color);
74
- if (formattedColor !== null) {
75
- this.setColor(c.color);
73
+ if (c.colorTemp > -1) {
74
+ // A Govee device is either in color or in white mode, so a desired color temperature replaces the color.
75
+ this.setColorTemp(c.colorTemp);
76
+ }
77
+ else {
78
+ const formattedColor = utils_1.Utils.formatHex(c.color);
79
+ if (formattedColor !== null) {
80
+ this.setColor(c.color);
81
+ }
76
82
  }
77
83
  }
78
84
  const dontBlock = sharedFunctions_1.LampUtils.checkUnBlock(this, c);
@@ -166,6 +172,20 @@ class OwnGoveeDevice extends RoomBaseDevice_1.RoomBaseDevice {
166
172
  }
167
173
  });
168
174
  }
175
+ /**
176
+ * Sets the white color temperature of the device. Only devices with white leds (RGBWW/RGBICWW) react to this.
177
+ * @param colorTemp - The desired color temperature in Kelvin (1000-9000), as that is the unit Govee devices use.
178
+ */
179
+ setColorTemp(colorTemp) {
180
+ govee_service_1.GooveeService.sendCommand(this, `colortemp/${colorTemp}`).then((result) => {
181
+ if (!result) {
182
+ this.log(enums_1.LogLevel.Error, 'Govee set color temperature resulted in error');
183
+ }
184
+ else {
185
+ this.log(enums_1.LogLevel.Debug, `Govee set color temperature to ${colorTemp}K`, enums_1.LogDebugType.SetActuator);
186
+ }
187
+ });
188
+ }
169
189
  turnOn() {
170
190
  this.queuedValue = true;
171
191
  govee_service_1.GooveeService.sendCommand(this, `on/true`).then((result) => {