hoffmation-base 3.0.0-alpha.88 → 3.0.0-alpha.89
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/victronDeviceSettings.d.ts +5 -0
- package/lib/models/deviceSettings/victronDeviceSettings.js +18 -12
- package/lib/server/services/victron/victron-device.d.ts +1 -0
- package/lib/server/services/victron/victron-device.js +5 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { DeviceSettings } from './deviceSettings';
|
|
2
2
|
export declare class VictronDeviceSettings extends DeviceSettings {
|
|
3
|
+
/**
|
|
4
|
+
* The default time interval in minutes for battery-change reporting regardless of battery level.
|
|
5
|
+
* -1 = disabled
|
|
6
|
+
*/
|
|
7
|
+
batteryReportingInterval: number;
|
|
3
8
|
/**
|
|
4
9
|
* The maximum wattage that the battery can deliver to the house
|
|
5
10
|
* @default 1700
|
|
@@ -6,6 +6,11 @@ const server_1 = require("../../server");
|
|
|
6
6
|
class VictronDeviceSettings extends deviceSettings_1.DeviceSettings {
|
|
7
7
|
constructor() {
|
|
8
8
|
super(...arguments);
|
|
9
|
+
/**
|
|
10
|
+
* The default time interval in minutes for battery-change reporting regardless of battery level.
|
|
11
|
+
* -1 = disabled
|
|
12
|
+
*/
|
|
13
|
+
this.batteryReportingInterval = 30;
|
|
9
14
|
/**
|
|
10
15
|
* The maximum wattage that the battery can deliver to the house
|
|
11
16
|
* @default 1700
|
|
@@ -63,20 +68,21 @@ class VictronDeviceSettings extends deviceSettings_1.DeviceSettings {
|
|
|
63
68
|
this.excessEnergyTurnOffThreshold = 50;
|
|
64
69
|
}
|
|
65
70
|
fromPartialObject(data) {
|
|
66
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
71
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
67
72
|
this.maxBatteryLoadWattage = (_a = data.maxBatteryLoadWattage) !== null && _a !== void 0 ? _a : this.maxBatteryLoadWattage;
|
|
68
|
-
this.
|
|
69
|
-
this.
|
|
70
|
-
this.
|
|
71
|
-
this.
|
|
73
|
+
this.batteryReportingInterval = (_b = data.batteryReportingInterval) !== null && _b !== void 0 ? _b : this.batteryReportingInterval;
|
|
74
|
+
this.hasBattery = (_c = data.hasBattery) !== null && _c !== void 0 ? _c : this.hasBattery;
|
|
75
|
+
this.hasGrid = (_d = data.hasGrid) !== null && _d !== void 0 ? _d : this.hasGrid;
|
|
76
|
+
this.hasSolar = (_e = data.hasSolar) !== null && _e !== void 0 ? _e : this.hasSolar;
|
|
77
|
+
this.minimumNightTimeAcBatteryLevel = (_f = data.minimumNightTimeAcBatteryLevel) !== null && _f !== void 0 ? _f : this.minimumNightTimeAcBatteryLevel;
|
|
72
78
|
this.minimumTransientTimeAcBatteryLevel =
|
|
73
|
-
(
|
|
74
|
-
this.minimumDayTimeAcBatteryLevel = (
|
|
75
|
-
this.batteryCapacityWattage = (
|
|
76
|
-
this.normalBaseConsumptionWattage = (
|
|
77
|
-
this.maximumBatteryDischargeWattage = (
|
|
78
|
-
this.excessEnergyTurnOnThreshold = (
|
|
79
|
-
this.excessEnergyTurnOffThreshold = (
|
|
79
|
+
(_g = data.minimumTransientTimeAcBatteryLevel) !== null && _g !== void 0 ? _g : this.minimumTransientTimeAcBatteryLevel;
|
|
80
|
+
this.minimumDayTimeAcBatteryLevel = (_h = data.minimumDayTimeAcBatteryLevel) !== null && _h !== void 0 ? _h : this.minimumDayTimeAcBatteryLevel;
|
|
81
|
+
this.batteryCapacityWattage = (_j = data.batteryCapacityWattage) !== null && _j !== void 0 ? _j : this.batteryCapacityWattage;
|
|
82
|
+
this.normalBaseConsumptionWattage = (_k = data.normalBaseConsumptionWattage) !== null && _k !== void 0 ? _k : this.normalBaseConsumptionWattage;
|
|
83
|
+
this.maximumBatteryDischargeWattage = (_l = data.maximumBatteryDischargeWattage) !== null && _l !== void 0 ? _l : this.maximumBatteryDischargeWattage;
|
|
84
|
+
this.excessEnergyTurnOnThreshold = (_m = data.excessEnergyTurnOnThreshold) !== null && _m !== void 0 ? _m : this.excessEnergyTurnOnThreshold;
|
|
85
|
+
this.excessEnergyTurnOffThreshold = (_o = data.excessEnergyTurnOffThreshold) !== null && _o !== void 0 ? _o : this.excessEnergyTurnOffThreshold;
|
|
80
86
|
super.fromPartialObject(data);
|
|
81
87
|
}
|
|
82
88
|
toJSON() {
|
|
@@ -22,6 +22,7 @@ export declare class VictronDevice implements iEnergyManager, iBatteryDevice {
|
|
|
22
22
|
private _lastBatteryLevel;
|
|
23
23
|
private _batteryLevelCallbacks;
|
|
24
24
|
private _excessEnergy;
|
|
25
|
+
private _lastBatteryChangeReportMs;
|
|
25
26
|
constructor(opts: VictronMqttConnectionOptions);
|
|
26
27
|
/** @inheritDoc */
|
|
27
28
|
get acBlocked(): boolean;
|
|
@@ -25,6 +25,7 @@ class VictronDevice {
|
|
|
25
25
|
this._lastBatteryLevel = -1;
|
|
26
26
|
this._batteryLevelCallbacks = [];
|
|
27
27
|
this._excessEnergy = 0;
|
|
28
|
+
this._lastBatteryChangeReportMs = 0;
|
|
28
29
|
this.settings = new models_1.VictronDeviceSettings();
|
|
29
30
|
this._info = new devices_1.DeviceInfo();
|
|
30
31
|
this._info.fullName = 'Victron Device';
|
|
@@ -278,9 +279,12 @@ class VictronDevice {
|
|
|
278
279
|
}
|
|
279
280
|
checkForBatteryChange() {
|
|
280
281
|
const newLevel = this.battery;
|
|
281
|
-
if (newLevel == this._lastBatteryLevel
|
|
282
|
+
if (newLevel == this._lastBatteryLevel &&
|
|
283
|
+
(this.settings.batteryReportingInterval < 0 ||
|
|
284
|
+
utils_1.Utils.nowMS() - this._lastBatteryChangeReportMs < this.settings.batteryReportingInterval * 60 * 1000)) {
|
|
282
285
|
return;
|
|
283
286
|
}
|
|
287
|
+
this._lastBatteryChangeReportMs = utils_1.Utils.nowMS();
|
|
284
288
|
for (const cb of this._batteryLevelCallbacks) {
|
|
285
289
|
cb(new models_1.BatteryLevelChangeAction(this));
|
|
286
290
|
}
|