hoffmation-base 2.12.3 → 2.13.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.
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/models/connectionCallbacks.d.ts +0 -2
- package/lib/models/deviceConfig.d.ts +0 -1
- package/lib/models/deviceSettings/acSettings.d.ts +5 -0
- package/lib/models/deviceSettings/acSettings.js +7 -1
- package/lib/models/persistence/EnergyCalculation.d.ts +3 -0
- package/lib/models/persistence/EnergyCalculation.js +22 -0
- package/lib/server/config/iConfig.d.ts +2 -2
- package/lib/server/config/iEnergyManagerSettings.d.ts +5 -0
- package/lib/server/config/iEnergyManagerSettings.js +2 -0
- package/lib/server/config/index.d.ts +1 -0
- package/lib/server/config/index.js +1 -0
- package/lib/server/devices/IoBrokerBaseDevice.d.ts +0 -1
- package/lib/server/devices/baseDeviceInterfaces/iCameraDevice.d.ts +0 -1
- package/lib/server/devices/baseDeviceInterfaces/iEnergyManager.d.ts +3 -0
- package/lib/server/devices/baseDeviceInterfaces/iLedRgbCct.d.ts +0 -1
- package/lib/server/devices/blueIris/blueIrisCoordinator.d.ts +0 -1
- package/lib/server/devices/blueIris/cameraDevice.d.ts +0 -1
- package/lib/server/devices/deviceUpdater.d.ts +0 -2
- package/lib/server/devices/devices.d.ts +2 -1
- package/lib/server/devices/devices.js +5 -2
- package/lib/server/devices/espresense/espresenseCoordinator.d.ts +0 -1
- package/lib/server/devices/espresense/espresenseDevice.d.ts +0 -1
- package/lib/server/devices/hmIPDevices/hmIpAccessPoint.d.ts +0 -1
- package/lib/server/devices/hmIPDevices/hmIpBewegung.d.ts +0 -1
- package/lib/server/devices/hmIPDevices/hmIpDevice.d.ts +0 -1
- package/lib/server/devices/hmIPDevices/hmIpGriff.d.ts +0 -1
- package/lib/server/devices/hmIPDevices/hmIpHeizgruppe.d.ts +0 -1
- package/lib/server/devices/hmIPDevices/hmIpHeizung.d.ts +0 -1
- package/lib/server/devices/hmIPDevices/hmIpLampe.d.ts +0 -1
- package/lib/server/devices/hmIPDevices/hmIpPraezenz.d.ts +0 -1
- package/lib/server/devices/hmIPDevices/hmIpRoll.d.ts +0 -1
- package/lib/server/devices/hmIPDevices/hmIpTaster.d.ts +0 -1
- package/lib/server/devices/hmIPDevices/hmIpTherm.d.ts +0 -1
- package/lib/server/devices/hmIPDevices/hmIpTuer.d.ts +0 -1
- package/lib/server/devices/hmIPDevices/hmIpWippe.d.ts +0 -1
- package/lib/server/devices/iDeviceUpdater.d.ts +0 -2
- package/lib/server/devices/jsObject/jsObjectEnergyManager.d.ts +0 -1
- package/lib/server/devices/jsObject/jsObjectEnergyManager.js +1 -15
- package/lib/server/devices/mqtt/mqttCoordinator.d.ts +0 -1
- package/lib/server/devices/wledDevice.d.ts +0 -1
- package/lib/server/devices/zigbee/BaseDevices/ZigbeeActuator.d.ts +0 -1
- package/lib/server/devices/zigbee/BaseDevices/zigbeeDevice.d.ts +0 -1
- package/lib/server/devices/zigbee/BaseDevices/zigbeeDimmer.d.ts +0 -1
- package/lib/server/devices/zigbee/BaseDevices/zigbeeHeater.d.ts +0 -4
- package/lib/server/devices/zigbee/BaseDevices/zigbeeHeater.js +0 -1
- package/lib/server/devices/zigbee/BaseDevices/zigbeeLedRGBCCT.d.ts +0 -1
- package/lib/server/devices/zigbee/BaseDevices/zigbeeMagnetContact.d.ts +0 -1
- package/lib/server/devices/zigbee/BaseDevices/zigbeeMotionSensor.d.ts +0 -1
- package/lib/server/devices/zigbee/BaseDevices/zigbeeShutter.d.ts +0 -1
- package/lib/server/devices/zigbee/BaseDevices/zigbeeSwitch.d.ts +0 -1
- package/lib/server/devices/zigbee/zigbeeAqaraMagnetContact.d.ts +0 -1
- package/lib/server/devices/zigbee/zigbeeAqaraOpple3Switch.d.ts +0 -1
- package/lib/server/devices/zigbee/zigbeeAquaraMotion.d.ts +0 -1
- package/lib/server/devices/zigbee/zigbeeAquaraVibra.d.ts +0 -1
- package/lib/server/devices/zigbee/zigbeeAquaraWater.d.ts +0 -1
- package/lib/server/devices/zigbee/zigbeeBlitzShp.d.ts +0 -1
- package/lib/server/devices/zigbee/zigbeeEuroHeater.d.ts +0 -1
- package/lib/server/devices/zigbee/zigbeeHeimanSmoke.d.ts +0 -1
- package/lib/server/devices/zigbee/zigbeeIkeaShutter.d.ts +0 -1
- package/lib/server/devices/zigbee/zigbeeIkeaSteckdose.d.ts +0 -1
- package/lib/server/devices/zigbee/zigbeeIlluActuator.d.ts +0 -1
- package/lib/server/devices/zigbee/zigbeeIlluLampe.d.ts +0 -1
- package/lib/server/devices/zigbee/zigbeeIlluShutter.d.ts +0 -1
- package/lib/server/devices/zigbee/zigbeeSMaBiTMagnetContact.d.ts +0 -1
- package/lib/server/devices/zigbee/zigbeeSonoffMotion.d.ts +0 -1
- package/lib/server/devices/zigbee/zigbeeSonoffTemp.d.ts +0 -1
- package/lib/server/devices/zigbee/zigbeeTuyaValve.d.ts +0 -1
- package/lib/server/devices/zigbee/zigbeeUbisysActuator.d.ts +0 -1
- package/lib/server/devices/zigbee/zigbeeUbisysLampe.d.ts +0 -1
- package/lib/server/devices/zigbee/zigbeeUbisysShutter.d.ts +0 -1
- package/lib/server/ioBroker/connection.d.ts +0 -2
- package/lib/server/services/ac/ac-device.js +5 -1
- package/lib/server/services/ac/own-daikin-device.js +1 -0
- package/lib/server/services/victron/victron-device.d.ts +9 -0
- package/lib/server/services/victron/victron-device.js +46 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +21 -14
|
@@ -98,6 +98,10 @@ class AcDevice {
|
|
|
98
98
|
calculateDesiredMode() {
|
|
99
99
|
var _a, _b, _c, _d, _e, _f;
|
|
100
100
|
const acOn = this.on;
|
|
101
|
+
if (this.settings.manualDisabled) {
|
|
102
|
+
acOn && this.log(models_1.LogLevel.Info, `We should turn off now, as manual disable force is set.`);
|
|
103
|
+
return ac_mode_1.AcMode.Off;
|
|
104
|
+
}
|
|
101
105
|
// Check Turn Off Time
|
|
102
106
|
if (!utils_1.Utils.timeWithinBorders(this.settings.minimumHours, this.settings.minimumMinutes, this.settings.maximumHours, this.settings.maximumMinutes)) {
|
|
103
107
|
acOn && this.log(models_1.LogLevel.Info, `We should turn off now, to respect night settings.`);
|
|
@@ -225,7 +229,7 @@ class AcDevice {
|
|
|
225
229
|
this.turnOn();
|
|
226
230
|
}
|
|
227
231
|
onRoomFirstEnter() {
|
|
228
|
-
if (!this.settings.noCoolingOnMovement || !this.on || this.mode
|
|
232
|
+
if (!this.settings.noCoolingOnMovement || !this.on || this.mode === ac_mode_1.AcMode.Heating) {
|
|
229
233
|
return;
|
|
230
234
|
}
|
|
231
235
|
this.log(models_1.LogLevel.Info, `Someone entered the room. Turning off AC`);
|
|
@@ -72,6 +72,7 @@ class OwnDaikinDevice extends ac_device_1.AcDevice {
|
|
|
72
72
|
this.log(models_1.LogLevel.Info, `Turning off`);
|
|
73
73
|
this._activatedByExcessEnergy = false;
|
|
74
74
|
this.desiredState = daikin_controller_1.Power.OFF;
|
|
75
|
+
this._mode = ac_mode_1.AcMode.Off;
|
|
75
76
|
this.setDesiredInfo();
|
|
76
77
|
}
|
|
77
78
|
automaticCheck() {
|
|
@@ -11,6 +11,10 @@ export declare class VictronDevice implements iEnergyManager {
|
|
|
11
11
|
private _excessEnergyConsumer;
|
|
12
12
|
private blockDeviceChangeTime;
|
|
13
13
|
private _lastDeviceChange;
|
|
14
|
+
private _iCalculationInterval;
|
|
15
|
+
private _iDatabaseLoggerInterval;
|
|
16
|
+
private _lastPersistenceCalculation;
|
|
17
|
+
private _nextPersistEntry;
|
|
14
18
|
constructor(opts: VictronMqttConnectionOptions);
|
|
15
19
|
protected _info: DeviceInfo;
|
|
16
20
|
get info(): DeviceInfo;
|
|
@@ -22,6 +26,9 @@ export declare class VictronDevice implements iEnergyManager {
|
|
|
22
26
|
get customName(): string;
|
|
23
27
|
get id(): string;
|
|
24
28
|
addExcessConsumer(device: iExcessEnergyConsumer): void;
|
|
29
|
+
get injectingWattage(): number;
|
|
30
|
+
get drawingWattage(): number;
|
|
31
|
+
get selfConsumingWattage(): number;
|
|
25
32
|
cleanup(): void;
|
|
26
33
|
getReport(): string;
|
|
27
34
|
recalculatePowerSharing(): void;
|
|
@@ -37,4 +44,6 @@ export declare class VictronDevice implements iEnergyManager {
|
|
|
37
44
|
private calculateExcessEnergy;
|
|
38
45
|
private turnOnAdditionalConsumer;
|
|
39
46
|
private turnOffAdditionalConsumer;
|
|
47
|
+
private persist;
|
|
48
|
+
private calculatePersistenceValues;
|
|
40
49
|
}
|
|
@@ -14,6 +14,9 @@ class VictronDevice {
|
|
|
14
14
|
this.deviceType = devices_1.DeviceType.Victron;
|
|
15
15
|
this._excessEnergyConsumer = [];
|
|
16
16
|
this.blockDeviceChangeTime = -1;
|
|
17
|
+
this._iCalculationInterval = null;
|
|
18
|
+
this._iDatabaseLoggerInterval = null;
|
|
19
|
+
this._lastPersistenceCalculation = utils_1.Utils.nowMS();
|
|
17
20
|
this._excessEnergy = 0;
|
|
18
21
|
this.settings = new models_1.VictronDeviceSettings();
|
|
19
22
|
this._info = new devices_1.DeviceInfo();
|
|
@@ -25,6 +28,13 @@ class VictronDevice {
|
|
|
25
28
|
this.persistDeviceInfo();
|
|
26
29
|
this.loadDeviceSettings();
|
|
27
30
|
this._victronConsumer = new victron_mqtt_consumer_1.VictronMqttConsumer(opts);
|
|
31
|
+
this._iCalculationInterval = utils_1.Utils.guardedInterval(() => {
|
|
32
|
+
this.calculateExcessEnergy();
|
|
33
|
+
}, 5 * 1000, this);
|
|
34
|
+
this._iDatabaseLoggerInterval = utils_1.Utils.guardedInterval(() => {
|
|
35
|
+
this.persist();
|
|
36
|
+
}, 15 * 60 * 1000, this);
|
|
37
|
+
this._nextPersistEntry = new models_1.EnergyCalculation(utils_1.Utils.nowMS());
|
|
28
38
|
}
|
|
29
39
|
get info() {
|
|
30
40
|
return this._info;
|
|
@@ -51,8 +61,28 @@ class VictronDevice {
|
|
|
51
61
|
addExcessConsumer(device) {
|
|
52
62
|
this._excessEnergyConsumer.push(device);
|
|
53
63
|
}
|
|
64
|
+
get injectingWattage() {
|
|
65
|
+
var _a;
|
|
66
|
+
return Math.min((_a = this.victronConsumer.data.grid.power) !== null && _a !== void 0 ? _a : 0, 0) * -1;
|
|
67
|
+
}
|
|
68
|
+
get drawingWattage() {
|
|
69
|
+
var _a;
|
|
70
|
+
return Math.max((_a = this.victronConsumer.data.grid.power) !== null && _a !== void 0 ? _a : 0, 0);
|
|
71
|
+
}
|
|
72
|
+
get selfConsumingWattage() {
|
|
73
|
+
var _a;
|
|
74
|
+
return Math.max((_a = this.victronConsumer.data.system.power) !== null && _a !== void 0 ? _a : 0, 0) - this.drawingWattage;
|
|
75
|
+
}
|
|
54
76
|
cleanup() {
|
|
55
77
|
this._victronConsumer.disconnect();
|
|
78
|
+
if (this._iDatabaseLoggerInterval !== null) {
|
|
79
|
+
clearInterval(this._iDatabaseLoggerInterval);
|
|
80
|
+
this._iDatabaseLoggerInterval = null;
|
|
81
|
+
}
|
|
82
|
+
if (this._iCalculationInterval !== null) {
|
|
83
|
+
clearInterval(this._iCalculationInterval);
|
|
84
|
+
this._iCalculationInterval = null;
|
|
85
|
+
}
|
|
56
86
|
}
|
|
57
87
|
getReport() {
|
|
58
88
|
return '';
|
|
@@ -126,6 +156,7 @@ class VictronDevice {
|
|
|
126
156
|
this.data.battery.soc > (hoursTilSunset > 4 ? 0.7 : 0.8)) {
|
|
127
157
|
this._excessEnergy = this.settings.maximumBatteryDischargeWattage - Math.max(this.data.battery.dcPower, 0);
|
|
128
158
|
}
|
|
159
|
+
this.calculatePersistenceValues();
|
|
129
160
|
}
|
|
130
161
|
turnOnAdditionalConsumer() {
|
|
131
162
|
const result = utils_1.EnergyManagerUtils.turnOnAdditionalConsumer(this._excessEnergyConsumer, this._lastDeviceChange);
|
|
@@ -153,5 +184,20 @@ class VictronDevice {
|
|
|
153
184
|
this._lastDeviceChange = result;
|
|
154
185
|
}
|
|
155
186
|
}
|
|
187
|
+
persist() {
|
|
188
|
+
const obj = JSON.parse(JSON.stringify(this._nextPersistEntry));
|
|
189
|
+
if (!models_1.EnergyCalculation.persist(obj, this._lastPersistenceCalculation, this.log.bind(this))) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
this._nextPersistEntry = new models_1.EnergyCalculation(this._lastPersistenceCalculation);
|
|
193
|
+
}
|
|
194
|
+
calculatePersistenceValues() {
|
|
195
|
+
const now = utils_1.Utils.nowMS();
|
|
196
|
+
const duration = now - this._lastPersistenceCalculation;
|
|
197
|
+
this._nextPersistEntry.drawnKwH += utils_1.Utils.kWh(this.drawingWattage, duration);
|
|
198
|
+
this._nextPersistEntry.injectedKwH += utils_1.Utils.kWh(this.injectingWattage, duration);
|
|
199
|
+
this._nextPersistEntry.selfConsumedKwH += utils_1.Utils.kWh(this.selfConsumingWattage, duration);
|
|
200
|
+
this._lastPersistenceCalculation = now;
|
|
201
|
+
}
|
|
156
202
|
}
|
|
157
203
|
exports.VictronDevice = VictronDevice;
|