hoffmation-base 2.20.0-beta.3 → 2.20.0
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.
|
@@ -19,6 +19,7 @@ class OwnGoveeDevice {
|
|
|
19
19
|
this.settings = new models_1.LedSettings();
|
|
20
20
|
this.deviceType = devices_1.DeviceType.GoveeLed;
|
|
21
21
|
this.deviceCapabilities = [
|
|
22
|
+
DeviceCapability_1.DeviceCapability.ledLamp,
|
|
22
23
|
DeviceCapability_1.DeviceCapability.lamp,
|
|
23
24
|
DeviceCapability_1.DeviceCapability.dimmablelamp,
|
|
24
25
|
DeviceCapability_1.DeviceCapability.blockAutomatic,
|
|
@@ -126,7 +127,6 @@ class OwnGoveeDevice {
|
|
|
126
127
|
* @inheritDoc
|
|
127
128
|
*/
|
|
128
129
|
setLight(pValue, timeout = -1, force, brightness = -1, _transitionTime, color = '', colorTemp = -1) {
|
|
129
|
-
var _a;
|
|
130
130
|
if (pValue && brightness === -1 && this.brightness < 10) {
|
|
131
131
|
brightness = 10;
|
|
132
132
|
}
|
|
@@ -161,7 +161,6 @@ class OwnGoveeDevice {
|
|
|
161
161
|
else {
|
|
162
162
|
this.turnOff();
|
|
163
163
|
}
|
|
164
|
-
(_a = this.device) === null || _a === void 0 ? void 0 : _a.actions.setOn();
|
|
165
164
|
if (timeout > -1 && !dontBlock) {
|
|
166
165
|
this.blockAutomationHandler.disableAutomatic(timeout, models_1.CollisionSolving.overrideIfGreater);
|
|
167
166
|
}
|
|
@@ -205,9 +204,6 @@ class OwnGoveeDevice {
|
|
|
205
204
|
}
|
|
206
205
|
turnOff() {
|
|
207
206
|
var _a;
|
|
208
|
-
if (!this.on) {
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
207
|
(_a = this.device) === null || _a === void 0 ? void 0 : _a.actions.setOff().then(() => {
|
|
212
208
|
this.log(models_1.LogLevel.Debug, `Govee turned off`, log_service_1.LogDebugType.SetActuator);
|
|
213
209
|
}).catch((error) => {
|
|
@@ -137,23 +137,25 @@ class VictronDevice {
|
|
|
137
137
|
// Step 1: Calculate battery need
|
|
138
138
|
const hoursTilSunset = time_callback_service_1.TimeCallbackService.hoursTilSunset();
|
|
139
139
|
let neededBatteryWattage = 0;
|
|
140
|
-
|
|
140
|
+
const timeOfDay = time_callback_service_1.TimeCallbackService.dayType(new time_callback_service_1.SunTimeOffsets());
|
|
141
|
+
if (this.settings.hasBattery && timeOfDay !== models_1.TimeOfDay.AfterSunset && timeOfDay !== models_1.TimeOfDay.Night) {
|
|
141
142
|
if (this.data.battery.soc == null) {
|
|
142
143
|
this.log(models_1.LogLevel.Debug, `No battery data available from Victron device.`);
|
|
143
144
|
return;
|
|
144
145
|
}
|
|
145
146
|
neededBatteryWattage = ((1 - this.data.battery.soc) * this.settings.batteryCapacityWattage) / hoursTilSunset;
|
|
147
|
+
// Step 2: Calculate expected solar output
|
|
148
|
+
const solarOutput = (_a = this.data.pvInverter.power) !== null && _a !== void 0 ? _a : 0;
|
|
149
|
+
// Step 3: Calculate expected base consumption
|
|
150
|
+
const baseConsumption = this.settings.normalBaseConsumptionWattage;
|
|
151
|
+
// Step 4: Combine to get currently excess energy
|
|
152
|
+
this._excessEnergy = solarOutput - neededBatteryWattage - baseConsumption;
|
|
146
153
|
}
|
|
147
|
-
// Step 2: Calculate expected solar output
|
|
148
|
-
const solarOutput = (_a = this.data.pvInverter.power) !== null && _a !== void 0 ? _a : 0;
|
|
149
|
-
// Step 3: Calculate expected base consumption
|
|
150
|
-
const baseConsumption = this.settings.normalBaseConsumptionWattage;
|
|
151
|
-
// Step 4: Combine to get currently excess energy
|
|
152
|
-
this._excessEnergy = solarOutput - neededBatteryWattage - baseConsumption;
|
|
153
154
|
// Whilst calculated spare energy is more precise, we don't mind using the battery as a buffer, if it is full enough.
|
|
154
155
|
if (this.data.battery.dcPower !== null &&
|
|
155
156
|
this.data.battery.soc !== null &&
|
|
156
|
-
this.data.battery.soc >
|
|
157
|
+
this.data.battery.soc >
|
|
158
|
+
(hoursTilSunset > 4 && timeOfDay !== models_1.TimeOfDay.AfterSunset && timeOfDay !== models_1.TimeOfDay.Night ? 0.7 : 0.8)) {
|
|
157
159
|
this._excessEnergy = this.settings.maximumBatteryDischargeWattage - Math.max(this.data.battery.dcPower, 0);
|
|
158
160
|
}
|
|
159
161
|
this.calculatePersistenceValues();
|