hoffmation-base 3.7.1 → 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) => {
@@ -11,6 +11,8 @@ class UnifiLogger {
11
11
  debug(message, ...parameters) {
12
12
  logging_1.ServerLogService.writeLog(enums_1.LogLevel.Debug, (0, node_util_1.format)(message, ...parameters), {
13
13
  source: this.source,
14
+ // Several per second since v5 --> opt-in via logSettings.debugUnifi.
15
+ debugType: enums_1.LogDebugType.UnifiLibrary,
14
16
  });
15
17
  }
16
18
  error(message, ...parameters) {
@@ -9,5 +9,6 @@ export declare enum LogDebugType {
9
9
  DaikinSuccessfullControlInfo = 7,
10
10
  EuroHeaterValveLogging = 8,
11
11
  Trilateration = 9,
12
- DachsUnreach = 10
12
+ DachsUnreach = 10,
13
+ UnifiLibrary = 11
13
14
  }
@@ -14,4 +14,5 @@ var LogDebugType;
14
14
  LogDebugType[LogDebugType["EuroHeaterValveLogging"] = 8] = "EuroHeaterValveLogging";
15
15
  LogDebugType[LogDebugType["Trilateration"] = 9] = "Trilateration";
16
16
  LogDebugType[LogDebugType["DachsUnreach"] = 10] = "DachsUnreach";
17
+ LogDebugType[LogDebugType["UnifiLibrary"] = 11] = "UnifiLibrary";
17
18
  })(LogDebugType || (exports.LogDebugType = LogDebugType = {}));
@@ -44,6 +44,11 @@ export interface iLogSettings {
44
44
  * Whether to log debug messages for trilateration calculations
45
45
  */
46
46
  debugTrilateration?: boolean;
47
+ /**
48
+ * Whether to log debug messages of the Unifi-Protect/Access libraries.
49
+ * @remarks Off by default, as the libraries report every unclassified realtime packet, which is several per second.
50
+ */
51
+ debugUnifi?: boolean;
47
52
  /**
48
53
  * Whether to send telegram messages on "HOST Unreach" of Dachs
49
54
  */
@@ -60,7 +60,7 @@ class ServerLogService {
60
60
  * @returns If the Message should be skipped
61
61
  */
62
62
  static checkDebugLogSkip(debugType) {
63
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
63
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
64
64
  switch (debugType) {
65
65
  case enums_1.LogDebugType.None:
66
66
  return false;
@@ -109,6 +109,11 @@ class ServerLogService {
109
109
  return false;
110
110
  }
111
111
  break;
112
+ case enums_1.LogDebugType.UnifiLibrary:
113
+ if (((_k = this.settingsProvider.settings.logSettings) === null || _k === void 0 ? void 0 : _k.debugUnifi) === true) {
114
+ return false;
115
+ }
116
+ break;
112
117
  }
113
118
  return true;
114
119
  }
@@ -296,12 +296,12 @@ BEGIN
296
296
  END IF;
297
297
 
298
298
  IF (SELECT to_regclass('hoffmation_schema."AirQualitySensorDeviceData"') IS NULL) Then
299
+ -- Deliberately without a foreign key on "DeviceInfo": creating one needs the REFERENCES privilege on
300
+ -- that table, which an existing installation whose tables were created by another role may not grant.
301
+ -- The sibling tables only get away with it because their CREATE is skipped once they exist.
299
302
  create table if not exists hoffmation_schema."AirQualitySensorDeviceData"
300
303
  (
301
- "deviceID" varchar(60) not null
302
- constraint "AirQualitySensorDeviceData_DeviceInfo_null_fk"
303
- references hoffmation_schema."DeviceInfo"
304
- on delete set null,
304
+ "deviceID" varchar(60) not null,
305
305
  aqi double precision,
306
306
  co2 double precision,
307
307
  nox double precision,