hoffmation-base 3.0.0-alpha.82 → 3.0.0-alpha.84
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.
- package/lib/models/deviceSettings/dachsSettings.d.ts +4 -0
- package/lib/models/deviceSettings/dachsSettings.js +4 -0
- package/lib/server/devices/dachs/dachs.d.ts +5 -0
- package/lib/server/devices/dachs/dachs.js +16 -0
- package/lib/server/services/govee/own-govee-device.d.ts +1 -0
- package/lib/server/services/govee/own-govee-device.js +14 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -20,6 +20,10 @@ export declare class DachsDeviceSettings extends ActuatorSettings {
|
|
|
20
20
|
* Defines the battery level above which the dachs should be prevented from starting/running.
|
|
21
21
|
*/
|
|
22
22
|
batteryLevelPreventStartThreshold: number;
|
|
23
|
+
/**
|
|
24
|
+
* Defines the battery level above which the external heating rod should be turned on
|
|
25
|
+
*/
|
|
26
|
+
batteryLevelHeatingRodThreshold: number;
|
|
23
27
|
/**
|
|
24
28
|
* Defines the desired minimum temperature for warm water.
|
|
25
29
|
*/
|
|
@@ -26,6 +26,10 @@ class DachsDeviceSettings extends actuatorSettings_1.ActuatorSettings {
|
|
|
26
26
|
* Defines the battery level above which the dachs should be prevented from starting/running.
|
|
27
27
|
*/
|
|
28
28
|
this.batteryLevelPreventStartThreshold = 70;
|
|
29
|
+
/**
|
|
30
|
+
* Defines the battery level above which the external heating rod should be turned on
|
|
31
|
+
*/
|
|
32
|
+
this.batteryLevelHeatingRodThreshold = 80;
|
|
29
33
|
/**
|
|
30
34
|
* Defines the desired minimum temperature for warm water.
|
|
31
35
|
*/
|
|
@@ -26,6 +26,10 @@ export declare class Dachs implements iBaseDevice, iActuator {
|
|
|
26
26
|
* An external actuator controlling the warm water pump
|
|
27
27
|
*/
|
|
28
28
|
warmWaterPump?: iActuator;
|
|
29
|
+
/**
|
|
30
|
+
* An external actuator controlling the heat rod.
|
|
31
|
+
*/
|
|
32
|
+
heatingRod?: iActuator;
|
|
29
33
|
/**
|
|
30
34
|
* An external actuator to prevent the Dachs from starting.
|
|
31
35
|
*/
|
|
@@ -79,4 +83,5 @@ export declare class Dachs implements iBaseDevice, iActuator {
|
|
|
79
83
|
*/
|
|
80
84
|
private onBatteryLevelChange;
|
|
81
85
|
private onTempChange;
|
|
86
|
+
private checkHeatingRod;
|
|
82
87
|
}
|
|
@@ -12,6 +12,7 @@ const dachsSettings_1 = require("../../../models/deviceSettings/dachsSettings");
|
|
|
12
12
|
const lib_1 = require("./lib");
|
|
13
13
|
const dachsTemperatureSensor_1 = require("./dachsTemperatureSensor");
|
|
14
14
|
const blockAutomaticHandler_1 = require("../../services/blockAutomaticHandler");
|
|
15
|
+
const config_1 = require("../../config");
|
|
15
16
|
class Dachs {
|
|
16
17
|
/** @inheritDoc */
|
|
17
18
|
get customName() {
|
|
@@ -105,6 +106,7 @@ class Dachs {
|
|
|
105
106
|
'warmWaterSensor',
|
|
106
107
|
'heatStorageTempSensor',
|
|
107
108
|
'warmWaterPump',
|
|
109
|
+
'heatingRod',
|
|
108
110
|
'blockDachsStart',
|
|
109
111
|
]));
|
|
110
112
|
}
|
|
@@ -197,6 +199,7 @@ class Dachs {
|
|
|
197
199
|
* @param {BatteryLevelChangeAction} action - The action containing the new level
|
|
198
200
|
*/
|
|
199
201
|
onBatteryLevelChange(action) {
|
|
202
|
+
this.checkHeatingRod(action);
|
|
200
203
|
if (this.blockDachsStart !== undefined) {
|
|
201
204
|
if (action.newLevel > this.settings.batteryLevelPreventStartThreshold) {
|
|
202
205
|
const blockAction = new models_1.ActuatorSetStateCommand(action, true, `Battery reached ${action.newLevel}%, Dachs should not run any more`, null);
|
|
@@ -257,5 +260,18 @@ class Dachs {
|
|
|
257
260
|
const setAction = new models_1.ActuatorSetStateCommand(action, desiredState, reason, null);
|
|
258
261
|
this.warmWaterPump.setActuator(setAction);
|
|
259
262
|
}
|
|
263
|
+
checkHeatingRod(action) {
|
|
264
|
+
var _a;
|
|
265
|
+
if (this.heatingRod === undefined) {
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
const shouldBeOff = ((_a = services_1.SettingsService.settings.heaterSettings) === null || _a === void 0 ? void 0 : _a.mode) === config_1.HeatingMode.Winter ||
|
|
269
|
+
action.newLevel < this.settings.batteryLevelHeatingRodThreshold;
|
|
270
|
+
if (this.heatingRod.actuatorOn !== shouldBeOff) {
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
const setAction = new models_1.ActuatorSetStateCommand(action, !shouldBeOff, `Battery reached ${action.newLevel}%, heating rod should be turned ${shouldBeOff ? 'off' : 'on'}`, null);
|
|
274
|
+
this.heatingRod.setActuator(setAction);
|
|
275
|
+
}
|
|
260
276
|
}
|
|
261
277
|
exports.Dachs = Dachs;
|
|
@@ -29,6 +29,7 @@ export declare class OwnGoveeDevice implements iLedRgbCct, iTemporaryDisableAuto
|
|
|
29
29
|
private _color;
|
|
30
30
|
private _colortemp;
|
|
31
31
|
private _room;
|
|
32
|
+
protected _lastPersist: number;
|
|
32
33
|
constructor(deviceId: string, ownDeviceName: string, roomName: string);
|
|
33
34
|
get color(): string;
|
|
34
35
|
get colortemp(): number;
|
|
@@ -36,6 +36,7 @@ class OwnGoveeDevice {
|
|
|
36
36
|
this._color = '#fcba32';
|
|
37
37
|
this._colortemp = 500;
|
|
38
38
|
this._room = undefined;
|
|
39
|
+
this._lastPersist = 0;
|
|
39
40
|
this.deviceId = deviceId;
|
|
40
41
|
this._info = new devices_1.DeviceInfo();
|
|
41
42
|
this._info.fullName = `Govee ${roomName} ${ownDeviceName}`;
|
|
@@ -147,7 +148,12 @@ class OwnGoveeDevice {
|
|
|
147
148
|
}
|
|
148
149
|
persist() {
|
|
149
150
|
var _a;
|
|
151
|
+
const now = utils_1.Utils.nowMS();
|
|
152
|
+
if (this._lastPersist + 1000 > now) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
150
155
|
(_a = utils_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistActuator(this);
|
|
156
|
+
this._lastPersist = now;
|
|
151
157
|
}
|
|
152
158
|
toggleActuator(c) {
|
|
153
159
|
const setActuatorCommand = models_1.ActuatorSetStateCommand.byActuatorAndToggleCommand(this, c);
|
|
@@ -168,10 +174,18 @@ class OwnGoveeDevice {
|
|
|
168
174
|
}
|
|
169
175
|
update(data) {
|
|
170
176
|
this.queuedValue = null;
|
|
177
|
+
const anyChanged = this._actuatorOn !== data.actuatorOn ||
|
|
178
|
+
this.brightness !== data.brightness ||
|
|
179
|
+
this._color !== data.hexColor ||
|
|
180
|
+
this._colortemp !== data.colortemp;
|
|
181
|
+
if (!anyChanged) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
171
184
|
this._actuatorOn = data.actuatorOn;
|
|
172
185
|
this.brightness = data.brightness;
|
|
173
186
|
this._color = data.hexColor;
|
|
174
187
|
this._colortemp = data.colortemp;
|
|
188
|
+
this.persist();
|
|
175
189
|
}
|
|
176
190
|
setBrightness(brightness, cb) {
|
|
177
191
|
govee_service_1.GooveeService.sendCommand(this, `brightness/${brightness}`).then((result) => {
|