hoffmation-base 0.1.41-1 → 0.1.41-13
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 -2
- package/lib/index.js +5 -4
- package/lib/models/deviceSettings/index.d.ts +1 -0
- package/lib/models/deviceSettings/index.js +1 -0
- package/lib/models/deviceSettings/motionSensorSettings.d.ts +9 -0
- package/lib/models/deviceSettings/motionSensorSettings.js +16 -0
- package/lib/models/deviceSettings/shutterSettings.d.ts +6 -0
- package/lib/models/deviceSettings/shutterSettings.js +6 -0
- package/lib/models/rooms/RoomBase.d.ts +7 -17
- package/lib/models/rooms/RoomBase.js +27 -32
- package/lib/models/rooms/RoomSettings/RoomSettings.js +1 -0
- package/lib/models/timeCallback.d.ts +7 -1
- package/lib/models/timeCallback.js +16 -10
- package/lib/server/devices/Heizgruppen.d.ts +1 -1
- package/lib/server/devices/Heizgruppen.js +3 -3
- package/lib/server/devices/IoBrokerBaseDevice.d.ts +11 -12
- package/lib/server/devices/IoBrokerBaseDevice.js +36 -38
- package/lib/server/devices/button.d.ts +1 -1
- package/lib/server/devices/button.js +5 -6
- package/lib/server/devices/device-cluster.d.ts +5 -4
- package/lib/server/devices/device-cluster.js +3 -2
- package/lib/server/devices/device-list.d.ts +4 -4
- package/lib/server/devices/device-list.js +5 -5
- package/lib/server/devices/deviceType.d.ts +1 -0
- package/lib/server/devices/deviceType.js +1 -0
- package/lib/server/devices/deviceUpdater.js +4 -4
- package/lib/server/devices/devices.d.ts +6 -7
- package/lib/server/devices/devices.js +78 -108
- package/lib/server/devices/groups/Fenster.d.ts +6 -6
- package/lib/server/devices/groups/Fenster.js +22 -24
- package/lib/server/devices/groups/fensterGroup.d.ts +2 -1
- package/lib/server/devices/groups/fensterGroup.js +42 -36
- package/lib/server/devices/groups/heatGroup.d.ts +2 -2
- package/lib/server/devices/groups/heatGroup.js +8 -8
- package/lib/server/devices/groups/lampenGroup.d.ts +3 -4
- package/lib/server/devices/groups/lampenGroup.js +12 -12
- package/lib/server/devices/groups/praesenzGroup.d.ts +6 -7
- package/lib/server/devices/groups/praesenzGroup.js +45 -40
- package/lib/server/devices/groups/tasterGroup.d.ts +1 -1
- package/lib/server/devices/groups/tasterGroup.js +3 -3
- package/lib/server/devices/hmIPDevices/hmIpBewegung.d.ts +12 -8
- package/lib/server/devices/hmIPDevices/hmIpBewegung.js +31 -26
- package/lib/server/devices/hmIPDevices/hmIpHeizgruppe.d.ts +8 -8
- package/lib/server/devices/hmIPDevices/hmIpHeizgruppe.js +40 -43
- package/lib/server/devices/hmIPDevices/hmIpLampe.d.ts +1 -2
- package/lib/server/devices/hmIPDevices/hmIpLampe.js +11 -13
- package/lib/server/devices/hmIPDevices/hmIpPraezenz.d.ts +5 -5
- package/lib/server/devices/hmIPDevices/hmIpPraezenz.js +17 -17
- package/lib/server/devices/iBaseDevice.d.ts +11 -0
- package/lib/server/devices/iBaseDevice.js +2 -0
- package/lib/server/devices/iButtonSwitch.d.ts +2 -2
- package/lib/server/devices/iEnergyManager.d.ts +18 -2
- package/lib/server/devices/iEnergyManager.js +28 -0
- package/lib/server/devices/iExcessEnergyConsumer.d.ts +3 -3
- package/lib/server/devices/iHeater.d.ts +3 -3
- package/lib/server/devices/iHumiditySensor.d.ts +2 -2
- package/lib/server/devices/iLamp.d.ts +3 -5
- package/lib/server/devices/iMotionSensor.d.ts +13 -0
- package/lib/server/devices/iMotionSensor.js +2 -0
- package/lib/server/devices/iShutter.d.ts +3 -3
- package/lib/server/devices/iTemperaturSensor.d.ts +2 -2
- package/lib/server/devices/iVibrationSensor.d.ts +9 -0
- package/lib/server/devices/iVibrationSensor.js +2 -0
- package/lib/server/devices/index.d.ts +3 -0
- package/lib/server/devices/index.js +3 -0
- package/lib/server/devices/jsObject/jsObjectEnergyManager.d.ts +36 -24
- package/lib/server/devices/jsObject/jsObjectEnergyManager.js +79 -39
- package/lib/server/devices/zigbee/index.d.ts +1 -0
- package/lib/server/devices/zigbee/index.js +1 -0
- package/lib/server/devices/zigbee/zigbeeAquaraMotion.d.ts +4 -4
- package/lib/server/devices/zigbee/zigbeeAquaraMotion.js +15 -16
- package/lib/server/devices/zigbee/zigbeeAquaraVibra.d.ts +11 -5
- package/lib/server/devices/zigbee/zigbeeAquaraVibra.js +48 -32
- package/lib/server/devices/zigbee/zigbeeIlluDimmer.d.ts +1 -2
- package/lib/server/devices/zigbee/zigbeeIlluDimmer.js +23 -25
- package/lib/server/devices/zigbee/zigbeeIlluLampe.d.ts +2 -2
- package/lib/server/devices/zigbee/zigbeeIlluLampe.js +7 -8
- package/lib/server/devices/zigbee/zigbeeIlluLedRGBCCT.d.ts +1 -2
- package/lib/server/devices/zigbee/zigbeeIlluLedRGBCCT.js +18 -20
- package/lib/server/devices/zigbee/zigbeeIlluShutter.d.ts +0 -2
- package/lib/server/devices/zigbee/zigbeeIlluShutter.js +26 -24
- package/lib/server/devices/zigbee/zigbeeMotionSensor.d.ts +8 -6
- package/lib/server/devices/zigbee/zigbeeMotionSensor.js +22 -21
- package/lib/server/devices/zigbee/zigbeeShutter.d.ts +13 -11
- package/lib/server/devices/zigbee/zigbeeShutter.js +43 -34
- package/lib/server/devices/zigbee/zigbeeUbisysShutter.d.ts +9 -0
- package/lib/server/devices/zigbee/zigbeeUbisysShutter.js +26 -0
- package/lib/server/services/ShutterService.d.ts +1 -2
- package/lib/server/services/ShutterService.js +6 -5
- package/lib/server/services/Telegram/telegram-service.d.ts +1 -1
- package/lib/server/services/Telegram/telegram-service.js +13 -11
- package/lib/server/services/api/api-service.d.ts +5 -5
- package/lib/server/services/api/api-service.js +5 -5
- package/lib/server/services/calendar/m/303/274ll-service.d.ts +4 -4
- package/lib/server/services/calendar/m/303/274ll-service.js +18 -14
- package/lib/server/services/dbo/postgreSqlPersist.d.ts +9 -9
- package/lib/server/services/dbo/postgreSqlPersist.js +13 -13
- package/lib/server/services/room-service/room-service.d.ts +5 -6
- package/lib/server/services/room-service/room-service.js +29 -30
- package/lib/server/services/time-callback-service.d.ts +9 -15
- package/lib/server/services/time-callback-service.js +39 -45
- package/lib/server/services/utils/utils.d.ts +2 -0
- package/lib/server/services/utils/utils.js +6 -10
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -14
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export interface iHeater extends
|
|
1
|
+
import { TemperaturSettings } from '../../models';
|
|
2
|
+
import { IBaseDevice } from './iBaseDevice';
|
|
3
|
+
export interface iHeater extends IBaseDevice {
|
|
4
4
|
readonly desiredTemperatur: number;
|
|
5
5
|
readonly iLevel: number;
|
|
6
6
|
readonly iTemperatur: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export interface iHumiditySensor extends
|
|
1
|
+
import { IBaseDevice } from './iBaseDevice';
|
|
2
|
+
export interface iHumiditySensor extends IBaseDevice {
|
|
3
3
|
humidity: number;
|
|
4
4
|
addHumidityCallback(pCallback: (pValue: number) => void): void;
|
|
5
5
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { ActuatorSettings } from '../../models';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { IoBrokerBaseDevice } from './IoBrokerBaseDevice';
|
|
5
|
-
export interface iLamp extends IoBrokerBaseDevice {
|
|
1
|
+
import { ActuatorSettings, RoomBase, TimeOfDay } from '../../models';
|
|
2
|
+
import { IBaseDevice } from './iBaseDevice';
|
|
3
|
+
export interface iLamp extends IBaseDevice {
|
|
6
4
|
settings: ActuatorSettings;
|
|
7
5
|
lightOn: boolean;
|
|
8
6
|
room: RoomBase | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MotionSensorSettings } from '../../models';
|
|
2
|
+
import { IBaseDevice } from './iBaseDevice';
|
|
3
|
+
export interface iMotionSensor extends IBaseDevice {
|
|
4
|
+
settings: MotionSensorSettings;
|
|
5
|
+
movementDetected: boolean;
|
|
6
|
+
readonly timeSinceLastMotion: number;
|
|
7
|
+
detectionsToday: number;
|
|
8
|
+
/**
|
|
9
|
+
* Adds a callback for when a motion state has changed.
|
|
10
|
+
* @param pCallback Function that accepts the new state as parameter
|
|
11
|
+
*/
|
|
12
|
+
addMovementCallback(pCallback: (newState: boolean) => void): void;
|
|
13
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Fenster } from './groups
|
|
2
|
-
import {
|
|
3
|
-
export interface iShutter extends
|
|
1
|
+
import { Fenster } from './groups';
|
|
2
|
+
import { IBaseDevice } from './iBaseDevice';
|
|
3
|
+
export interface iShutter extends IBaseDevice {
|
|
4
4
|
currentLevel: number;
|
|
5
5
|
desiredFensterLevel: number;
|
|
6
6
|
fenster: Fenster | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export interface iTemperaturSensor extends
|
|
1
|
+
import { IBaseDevice } from './iBaseDevice';
|
|
2
|
+
export interface iTemperaturSensor extends IBaseDevice {
|
|
3
3
|
iTemperatur: number;
|
|
4
4
|
sTemperatur: string;
|
|
5
5
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IBaseDevice } from './iBaseDevice';
|
|
2
|
+
export interface iVibrationSensor extends IBaseDevice {
|
|
3
|
+
vibrationBlockedByGriff: boolean;
|
|
4
|
+
vibrationBlockedByGriffTimeStamp: number;
|
|
5
|
+
vibrationBlockedByMotion: boolean;
|
|
6
|
+
vibrationBlockedByMotionTimeStamp: number;
|
|
7
|
+
vibration: boolean;
|
|
8
|
+
alarmCheck(): void;
|
|
9
|
+
}
|
|
@@ -13,6 +13,7 @@ export * from './deviceType';
|
|
|
13
13
|
export * from './deviceUpdater';
|
|
14
14
|
export * from './Griffe';
|
|
15
15
|
export * from './Heizgruppen';
|
|
16
|
+
export * from './iBaseDevice';
|
|
16
17
|
export * from './iButtonSwitch';
|
|
17
18
|
export * from './iDeviceUpdater';
|
|
18
19
|
export * from './iEnergyManager';
|
|
@@ -21,7 +22,9 @@ export * from './iHumiditySensor';
|
|
|
21
22
|
export * from './iHeater';
|
|
22
23
|
export * from './iIlluminationSensor';
|
|
23
24
|
export * from './iLamp';
|
|
25
|
+
export * from './iMotionSensor';
|
|
24
26
|
export * from './IoBrokerBaseDevice';
|
|
25
27
|
export * from './iShutter';
|
|
26
28
|
export * from './iTemperaturSensor';
|
|
29
|
+
export * from './iVibrationSensor';
|
|
27
30
|
export * from './wledDevice';
|
|
@@ -29,6 +29,7 @@ __exportStar(require("./deviceType"), exports);
|
|
|
29
29
|
__exportStar(require("./deviceUpdater"), exports);
|
|
30
30
|
__exportStar(require("./Griffe"), exports);
|
|
31
31
|
__exportStar(require("./Heizgruppen"), exports);
|
|
32
|
+
__exportStar(require("./iBaseDevice"), exports);
|
|
32
33
|
__exportStar(require("./iButtonSwitch"), exports);
|
|
33
34
|
__exportStar(require("./iDeviceUpdater"), exports);
|
|
34
35
|
__exportStar(require("./iEnergyManager"), exports);
|
|
@@ -37,7 +38,9 @@ __exportStar(require("./iHumiditySensor"), exports);
|
|
|
37
38
|
__exportStar(require("./iHeater"), exports);
|
|
38
39
|
__exportStar(require("./iIlluminationSensor"), exports);
|
|
39
40
|
__exportStar(require("./iLamp"), exports);
|
|
41
|
+
__exportStar(require("./iMotionSensor"), exports);
|
|
40
42
|
__exportStar(require("./IoBrokerBaseDevice"), exports);
|
|
41
43
|
__exportStar(require("./iShutter"), exports);
|
|
42
44
|
__exportStar(require("./iTemperaturSensor"), exports);
|
|
45
|
+
__exportStar(require("./iVibrationSensor"), exports);
|
|
43
46
|
__exportStar(require("./wledDevice"), exports);
|
|
@@ -1,42 +1,54 @@
|
|
|
1
1
|
/// <reference types="iobroker" />
|
|
2
2
|
import { IoBrokerBaseDevice } from '../IoBrokerBaseDevice';
|
|
3
|
-
import { iEnergyManager } from '../iEnergyManager';
|
|
3
|
+
import { iEnergyManager, PhaseState } from '../iEnergyManager';
|
|
4
4
|
import { iExcessEnergyConsumer } from '../iExcessEnergyConsumer';
|
|
5
5
|
import { DeviceInfo } from '../DeviceInfo';
|
|
6
6
|
export declare class JsObjectEnergyManager extends IoBrokerBaseDevice implements iEnergyManager {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
**/
|
|
19
|
-
get excessEnergyConsumerConsumption(): number;
|
|
20
|
-
get excessEnergy(): number;
|
|
7
|
+
private _excessEnergyConsumer;
|
|
8
|
+
private _iCalculationInterval;
|
|
9
|
+
private _iDatabaseLoggerInterval;
|
|
10
|
+
private _lastPersistenceCalculation;
|
|
11
|
+
private _nextPersistEntry;
|
|
12
|
+
private _powerValuePhaseA;
|
|
13
|
+
private _powerValuePhaseB;
|
|
14
|
+
private _powerValuePhaseC;
|
|
15
|
+
constructor(info: DeviceInfo);
|
|
16
|
+
private _currentProduction;
|
|
17
|
+
get currentProduction(): number;
|
|
21
18
|
get baseConsumption(): number;
|
|
22
19
|
get totalConsumption(): number;
|
|
23
20
|
get injectingWattage(): number;
|
|
24
21
|
get drawingWattage(): number;
|
|
25
22
|
get selfConsumingWattage(): number;
|
|
26
|
-
get
|
|
27
|
-
private _currentProduction;
|
|
28
|
-
private _excessEnergy;
|
|
23
|
+
get excessEnergy(): number;
|
|
29
24
|
private _excessEnergyConsumerConsumption;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Example:
|
|
27
|
+
* ________________________________________
|
|
28
|
+
* | ExcessEnergyA | 200W | 200W | -500W |
|
|
29
|
+
* | ExcessEnergyB | 300W | 300W | -200W |
|
|
30
|
+
* | ExcessEnergyC | 100W | -100W | -300W |
|
|
31
|
+
* | Production P | 500W | 500W | 0W |
|
|
32
|
+
* | Production | 1500W | 1500W | 0W |
|
|
33
|
+
* ________________________________________
|
|
34
|
+
* | Consumption | 900W | 1100W | 1000W |
|
|
35
|
+
* | Injecting | 600W | 500W | 0W |
|
|
36
|
+
* | drawing | 0W | 100W | 1000W |
|
|
37
|
+
* | selfConsume | 900W | 1000W | 0W |
|
|
38
|
+
* ________________________________________
|
|
39
|
+
**/
|
|
40
|
+
get excessEnergyConsumerConsumption(): number;
|
|
41
|
+
private _phaseAState;
|
|
42
|
+
get phaseAState(): PhaseState;
|
|
43
|
+
private _phaseBState;
|
|
44
|
+
get phaseBState(): PhaseState;
|
|
45
|
+
private _phaseCState;
|
|
46
|
+
get phaseCState(): PhaseState;
|
|
35
47
|
cleanup(): void;
|
|
36
48
|
addExcessConsumer(device: iExcessEnergyConsumer): void;
|
|
37
49
|
recalculatePowerSharing(): void;
|
|
38
50
|
update(idSplit: string[], state: ioBroker.State, initial: boolean, pOverride?: boolean): void;
|
|
39
|
-
private
|
|
51
|
+
private calculateExcessEnergy;
|
|
40
52
|
private calculatePersistenceValues;
|
|
41
53
|
private persist;
|
|
42
54
|
}
|
|
@@ -2,66 +2,95 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.JsObjectEnergyManager = void 0;
|
|
4
4
|
const IoBrokerBaseDevice_1 = require("../IoBrokerBaseDevice");
|
|
5
|
+
const iEnergyManager_1 = require("../iEnergyManager");
|
|
5
6
|
const deviceType_1 = require("../deviceType");
|
|
6
7
|
const models_1 = require("../../../models");
|
|
7
8
|
const services_1 = require("../../services");
|
|
8
|
-
const index_1 = require("../../../index");
|
|
9
9
|
class JsObjectEnergyManager extends IoBrokerBaseDevice_1.IoBrokerBaseDevice {
|
|
10
10
|
constructor(info) {
|
|
11
11
|
super(info, deviceType_1.DeviceType.JsEnergyManager);
|
|
12
|
-
this._currentProduction = -1;
|
|
13
|
-
this._excessEnergy = -1;
|
|
14
|
-
this._excessEnergyConsumerConsumption = 0;
|
|
15
12
|
this._excessEnergyConsumer = [];
|
|
13
|
+
this._iCalculationInterval = null;
|
|
16
14
|
this._iDatabaseLoggerInterval = null;
|
|
17
15
|
this._lastPersistenceCalculation = services_1.Utils.nowMS();
|
|
16
|
+
this._powerValuePhaseA = -1;
|
|
17
|
+
this._powerValuePhaseB = -1;
|
|
18
|
+
this._powerValuePhaseC = -1;
|
|
19
|
+
this._currentProduction = -1;
|
|
20
|
+
this._excessEnergyConsumerConsumption = 0;
|
|
21
|
+
this._phaseAState = new iEnergyManager_1.PhaseState(0, 0);
|
|
22
|
+
this._phaseBState = new iEnergyManager_1.PhaseState(0, 0);
|
|
23
|
+
this._phaseCState = new iEnergyManager_1.PhaseState(0, 0);
|
|
18
24
|
this.log(models_1.LogLevel.Info, `Creating Energy Manager Device`);
|
|
25
|
+
this._iCalculationInterval = services_1.Utils.guardedInterval(() => {
|
|
26
|
+
this.calculateExcessEnergy();
|
|
27
|
+
}, 5 * 1000, this);
|
|
19
28
|
this._iDatabaseLoggerInterval = services_1.Utils.guardedInterval(() => {
|
|
20
29
|
this.persist();
|
|
21
30
|
}, 15 * 60 * 1000, this);
|
|
22
|
-
this._nextPersistEntry = new
|
|
31
|
+
this._nextPersistEntry = new models_1.EnergyCalculation(services_1.Utils.nowMS());
|
|
23
32
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
* ________________________________________
|
|
27
|
-
* | ExcessEnergy | 500W | -500W | -500W |
|
|
28
|
-
* | Production | 1500W | 500W | 0W |
|
|
29
|
-
* _______________________________________
|
|
30
|
-
* | Consumption | 1000W | 1000W | 500W |
|
|
31
|
-
* | Injecting | 500W | 0W | 0W |
|
|
32
|
-
* | drawing | 0W | 500W | 500W |
|
|
33
|
-
* | selfConsume | 1000W | 500W | 0W |
|
|
34
|
-
* ________________________________________
|
|
35
|
-
**/
|
|
36
|
-
get excessEnergyConsumerConsumption() {
|
|
37
|
-
return this._excessEnergyConsumerConsumption;
|
|
38
|
-
}
|
|
39
|
-
get excessEnergy() {
|
|
40
|
-
return this._excessEnergy;
|
|
33
|
+
get currentProduction() {
|
|
34
|
+
return this._currentProduction;
|
|
41
35
|
}
|
|
42
36
|
get baseConsumption() {
|
|
43
37
|
return this.totalConsumption - this._excessEnergyConsumerConsumption;
|
|
44
38
|
}
|
|
45
39
|
get totalConsumption() {
|
|
46
|
-
return this.
|
|
40
|
+
return (this.phaseAState.totalConsumptionWattage +
|
|
41
|
+
this.phaseBState.totalConsumptionWattage +
|
|
42
|
+
this.phaseCState.totalConsumptionWattage);
|
|
47
43
|
}
|
|
48
44
|
get injectingWattage() {
|
|
49
|
-
return
|
|
45
|
+
return this.phaseAState.injectingWattage + this.phaseBState.injectingWattage + this.phaseCState.injectingWattage;
|
|
50
46
|
}
|
|
51
47
|
get drawingWattage() {
|
|
52
|
-
return
|
|
48
|
+
return this.phaseAState.drawingWattage + this.phaseBState.drawingWattage + this.phaseCState.drawingWattage;
|
|
53
49
|
}
|
|
54
50
|
get selfConsumingWattage() {
|
|
55
|
-
return
|
|
51
|
+
return (this.phaseAState.selfConsumingWattage +
|
|
52
|
+
this.phaseBState.selfConsumingWattage +
|
|
53
|
+
this.phaseCState.selfConsumingWattage);
|
|
56
54
|
}
|
|
57
|
-
get
|
|
58
|
-
return this.
|
|
55
|
+
get excessEnergy() {
|
|
56
|
+
return this._powerValuePhaseA + this._powerValuePhaseB + this._powerValuePhaseC;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Example:
|
|
60
|
+
* ________________________________________
|
|
61
|
+
* | ExcessEnergyA | 200W | 200W | -500W |
|
|
62
|
+
* | ExcessEnergyB | 300W | 300W | -200W |
|
|
63
|
+
* | ExcessEnergyC | 100W | -100W | -300W |
|
|
64
|
+
* | Production P | 500W | 500W | 0W |
|
|
65
|
+
* | Production | 1500W | 1500W | 0W |
|
|
66
|
+
* ________________________________________
|
|
67
|
+
* | Consumption | 900W | 1100W | 1000W |
|
|
68
|
+
* | Injecting | 600W | 500W | 0W |
|
|
69
|
+
* | drawing | 0W | 100W | 1000W |
|
|
70
|
+
* | selfConsume | 900W | 1000W | 0W |
|
|
71
|
+
* ________________________________________
|
|
72
|
+
**/
|
|
73
|
+
get excessEnergyConsumerConsumption() {
|
|
74
|
+
return this._excessEnergyConsumerConsumption;
|
|
75
|
+
}
|
|
76
|
+
get phaseAState() {
|
|
77
|
+
return this._phaseAState;
|
|
78
|
+
}
|
|
79
|
+
get phaseBState() {
|
|
80
|
+
return this._phaseBState;
|
|
81
|
+
}
|
|
82
|
+
get phaseCState() {
|
|
83
|
+
return this._phaseCState;
|
|
59
84
|
}
|
|
60
85
|
cleanup() {
|
|
61
86
|
if (this._iDatabaseLoggerInterval !== null) {
|
|
62
87
|
clearInterval(this._iDatabaseLoggerInterval);
|
|
63
88
|
this._iDatabaseLoggerInterval = null;
|
|
64
89
|
}
|
|
90
|
+
if (this._iCalculationInterval !== null) {
|
|
91
|
+
clearInterval(this._iCalculationInterval);
|
|
92
|
+
this._iCalculationInterval = null;
|
|
93
|
+
}
|
|
65
94
|
}
|
|
66
95
|
addExcessConsumer(device) {
|
|
67
96
|
this._excessEnergyConsumer.push(device);
|
|
@@ -72,9 +101,17 @@ class JsObjectEnergyManager extends IoBrokerBaseDevice_1.IoBrokerBaseDevice {
|
|
|
72
101
|
update(idSplit, state, initial, pOverride = false) {
|
|
73
102
|
this.log(models_1.LogLevel.DeepTrace, `EnergyManager: ${initial ? 'Initial ' : ''} update: ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}, override: ${pOverride}`);
|
|
74
103
|
switch (idSplit[3]) {
|
|
75
|
-
case '
|
|
76
|
-
this.log(models_1.LogLevel.Trace, `Current excess
|
|
77
|
-
this.
|
|
104
|
+
case 'CurrentExcessEnergyPhaseA':
|
|
105
|
+
this.log(models_1.LogLevel.Trace, `Current excess energyA update to ${state.val}`);
|
|
106
|
+
this._powerValuePhaseA = state.val;
|
|
107
|
+
break;
|
|
108
|
+
case 'CurrentExcessEnergyPhaseB':
|
|
109
|
+
this.log(models_1.LogLevel.Trace, `Current excess energyB update to ${state.val}`);
|
|
110
|
+
this._powerValuePhaseB = state.val;
|
|
111
|
+
break;
|
|
112
|
+
case 'CurrentExcessEnergyPhaseC':
|
|
113
|
+
this.log(models_1.LogLevel.Trace, `Current excess energyC update to ${state.val}`);
|
|
114
|
+
this._powerValuePhaseC = state.val;
|
|
78
115
|
break;
|
|
79
116
|
case 'CurrentProduction':
|
|
80
117
|
this.log(models_1.LogLevel.Trace, `Current Production Update to ${state.val}`);
|
|
@@ -82,8 +119,11 @@ class JsObjectEnergyManager extends IoBrokerBaseDevice_1.IoBrokerBaseDevice {
|
|
|
82
119
|
break;
|
|
83
120
|
}
|
|
84
121
|
}
|
|
85
|
-
|
|
86
|
-
this.
|
|
122
|
+
calculateExcessEnergy() {
|
|
123
|
+
const phaseProduction = this._currentProduction / 3.0;
|
|
124
|
+
this._phaseAState = new iEnergyManager_1.PhaseState(this._powerValuePhaseA, phaseProduction);
|
|
125
|
+
this._phaseBState = new iEnergyManager_1.PhaseState(this._powerValuePhaseB, phaseProduction);
|
|
126
|
+
this._phaseCState = new iEnergyManager_1.PhaseState(this._powerValuePhaseC, phaseProduction);
|
|
87
127
|
this.calculatePersistenceValues();
|
|
88
128
|
this.recalculatePowerSharing();
|
|
89
129
|
}
|
|
@@ -96,21 +136,21 @@ class JsObjectEnergyManager extends IoBrokerBaseDevice_1.IoBrokerBaseDevice {
|
|
|
96
136
|
this._lastPersistenceCalculation = now;
|
|
97
137
|
}
|
|
98
138
|
persist() {
|
|
99
|
-
var _a;
|
|
139
|
+
var _a, _b;
|
|
100
140
|
const obj = JSON.parse(JSON.stringify(this._nextPersistEntry));
|
|
101
141
|
if (obj.drawnKwH === 0 && obj.injectedKwH === 0 && obj.selfConsumedKwH === 0) {
|
|
102
142
|
this.log(models_1.LogLevel.Warn, `Not persisting energy Data, as all values are 0.`);
|
|
103
143
|
return;
|
|
104
144
|
}
|
|
105
|
-
this._nextPersistEntry = new
|
|
145
|
+
this._nextPersistEntry = new models_1.EnergyCalculation(this._lastPersistenceCalculation);
|
|
106
146
|
obj.endMs = this._lastPersistenceCalculation;
|
|
107
|
-
obj.earnedInjected = services_1.Utils.round(obj.injectedKwH * ((_a =
|
|
108
|
-
obj.savedSelfConsume = services_1.Utils.round(obj.selfConsumedKwH *
|
|
109
|
-
obj.costDrawn = services_1.Utils.round(obj.drawnKwH *
|
|
147
|
+
obj.earnedInjected = services_1.Utils.round(obj.injectedKwH * ((_a = services_1.SettingsService.settings.injectWattagePrice) !== null && _a !== void 0 ? _a : 0.06), 4);
|
|
148
|
+
obj.savedSelfConsume = services_1.Utils.round(obj.selfConsumedKwH * services_1.SettingsService.settings.wattagePrice, 4);
|
|
149
|
+
obj.costDrawn = services_1.Utils.round(obj.drawnKwH * services_1.SettingsService.settings.wattagePrice, 4);
|
|
110
150
|
obj.injectedKwH = services_1.Utils.round(obj.injectedKwH, 4);
|
|
111
151
|
obj.selfConsumedKwH = services_1.Utils.round(obj.selfConsumedKwH, 4);
|
|
112
152
|
obj.drawnKwH = services_1.Utils.round(obj.drawnKwH, 4);
|
|
113
|
-
|
|
153
|
+
(_b = services_1.Utils.dbo) === null || _b === void 0 ? void 0 : _b.persistEnergyManager(obj);
|
|
114
154
|
this.log(models_1.LogLevel.Info, `Persisting energy Manager Data.`);
|
|
115
155
|
}
|
|
116
156
|
}
|
|
@@ -36,3 +36,4 @@ __exportStar(require("./zigbeeSMaBiTMagnetContact"), exports);
|
|
|
36
36
|
__exportStar(require("./zigbeeSonoffMotion"), exports);
|
|
37
37
|
__exportStar(require("./zigbeeSonoffTemp"), exports);
|
|
38
38
|
__exportStar(require("./zigbeeSwitch"), exports);
|
|
39
|
+
__exportStar(require("./zigbeeUbisysShutter"), exports);
|
|
@@ -4,12 +4,12 @@ import { iIlluminationSensor } from '../iIlluminationSensor';
|
|
|
4
4
|
import { ZigbeeMotionSensor } from './zigbeeMotionSensor';
|
|
5
5
|
export declare class ZigbeeAquaraMotion extends ZigbeeMotionSensor implements iIlluminationSensor {
|
|
6
6
|
private _illuminance;
|
|
7
|
-
private _motionTimeout;
|
|
8
7
|
private occupancyTimeoutID;
|
|
9
|
-
|
|
10
|
-
private
|
|
8
|
+
constructor(pInfo: DeviceInfo);
|
|
9
|
+
private _motionTimeout;
|
|
11
10
|
get motionTimeout(): number;
|
|
12
11
|
set motionTimeout(value: number);
|
|
13
|
-
|
|
12
|
+
get currentIllumination(): number;
|
|
13
|
+
private set currentIllumination(value);
|
|
14
14
|
update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
|
|
15
15
|
}
|
|
@@ -2,27 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ZigbeeAquaraMotion = void 0;
|
|
4
4
|
const deviceType_1 = require("../deviceType");
|
|
5
|
-
const
|
|
6
|
-
const logLevel_1 = require("../../../models/logLevel");
|
|
5
|
+
const models_1 = require("../../../models");
|
|
7
6
|
const zigbeeMotionSensor_1 = require("./zigbeeMotionSensor");
|
|
8
|
-
const
|
|
7
|
+
const services_1 = require("../../services");
|
|
9
8
|
class ZigbeeAquaraMotion extends zigbeeMotionSensor_1.ZigbeeMotionSensor {
|
|
10
9
|
constructor(pInfo) {
|
|
11
10
|
super(pInfo, deviceType_1.DeviceType.ZigbeeAquaraMotion);
|
|
12
11
|
this._illuminance = 0;
|
|
13
|
-
this._motionTimeout = 0;
|
|
14
12
|
this.occupancyTimeoutID = `occupancy_timeout`;
|
|
13
|
+
this._motionTimeout = 0;
|
|
15
14
|
this.occupancyTimeoutID = `${this.info.fullID}.${this.occupancyTimeoutID}`;
|
|
16
15
|
}
|
|
17
|
-
// Currently measured brightness in lux
|
|
18
|
-
get currentIllumination() {
|
|
19
|
-
return this._illuminance;
|
|
20
|
-
}
|
|
21
|
-
set currentIllumination(value) {
|
|
22
|
-
var _a, _b, _c;
|
|
23
|
-
this._illuminance = value;
|
|
24
|
-
index_1.dbo === null || index_1.dbo === void 0 ? void 0 : index_1.dbo.persistCurrentIllumination(new CurrentIlluminationDataPoint_1.CurrentIlluminationDataPoint(this.info.room, this.info.devID, value, new Date(), (_c = (_b = (_a = this.room) === null || _a === void 0 ? void 0 : _a.LampenGroup) === null || _b === void 0 ? void 0 : _b.anyLightsOwn()) !== null && _c !== void 0 ? _c : false));
|
|
25
|
-
}
|
|
26
16
|
// Time after the last trigger until a motion event gets triggered again
|
|
27
17
|
get motionTimeout() {
|
|
28
18
|
return this._motionTimeout;
|
|
@@ -34,16 +24,25 @@ class ZigbeeAquaraMotion extends zigbeeMotionSensor_1.ZigbeeMotionSensor {
|
|
|
34
24
|
console.log(`Error occurred while setting motion timeout: ${err}`);
|
|
35
25
|
});
|
|
36
26
|
}
|
|
27
|
+
// Currently measured brightness in lux
|
|
28
|
+
get currentIllumination() {
|
|
29
|
+
return this._illuminance;
|
|
30
|
+
}
|
|
31
|
+
set currentIllumination(value) {
|
|
32
|
+
var _a, _b, _c, _d;
|
|
33
|
+
this._illuminance = value;
|
|
34
|
+
(_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistCurrentIllumination(new models_1.CurrentIlluminationDataPoint(this.info.room, this.info.devID, value, new Date(), (_d = (_c = (_b = this.room) === null || _b === void 0 ? void 0 : _b.LampenGroup) === null || _c === void 0 ? void 0 : _c.anyLightsOwn()) !== null && _d !== void 0 ? _d : false));
|
|
35
|
+
}
|
|
37
36
|
update(idSplit, state, initial = false) {
|
|
38
|
-
this.log(
|
|
37
|
+
this.log(models_1.LogLevel.DeepTrace, `Motion update: ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`);
|
|
39
38
|
super.update(idSplit, state, initial, true);
|
|
40
39
|
switch (idSplit[3]) {
|
|
41
40
|
case 'illuminance':
|
|
42
|
-
this.log(
|
|
41
|
+
this.log(models_1.LogLevel.Trace, `Motion sensor: Update for illuminance of ${this.info.customName}: ${state.val}`);
|
|
43
42
|
this.currentIllumination = state.val;
|
|
44
43
|
break;
|
|
45
44
|
case 'occupancy_timeout':
|
|
46
|
-
this.log(
|
|
45
|
+
this.log(models_1.LogLevel.Trace, `Motion sensor: Update for motion timeout of ${this.info.customName}: ${state.val}`);
|
|
47
46
|
this._motionTimeout = state.val;
|
|
48
47
|
break;
|
|
49
48
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/// <reference types="iobroker" />
|
|
2
2
|
import { DeviceInfo } from '../DeviceInfo';
|
|
3
|
+
import { iVibrationSensor } from '../iVibrationSensor';
|
|
3
4
|
import { ZigbeeDevice } from './zigbeeDevice';
|
|
4
|
-
export declare class ZigbeeAquaraVibra extends ZigbeeDevice {
|
|
5
|
+
export declare class ZigbeeAquaraVibra extends ZigbeeDevice implements iVibrationSensor {
|
|
5
6
|
sensitivity: string;
|
|
6
7
|
tiltAngle: number;
|
|
7
8
|
tiltAngleX: number;
|
|
@@ -11,13 +12,18 @@ export declare class ZigbeeAquaraVibra extends ZigbeeDevice {
|
|
|
11
12
|
tiltAngleZ: number;
|
|
12
13
|
tilt: boolean;
|
|
13
14
|
vibration: boolean;
|
|
14
|
-
|
|
15
|
+
vibrationBlockedByGriffTimeStamp: number;
|
|
16
|
+
vibrationBlockedByMotionTimeStamp: number;
|
|
15
17
|
private _idSensitivity;
|
|
16
|
-
private _vibrationBlocked;
|
|
17
18
|
private _alarmMessage;
|
|
18
19
|
constructor(pInfo: DeviceInfo);
|
|
19
|
-
|
|
20
|
+
private _vibrationBlockedByGriff;
|
|
21
|
+
get vibrationBlockedByGriff(): boolean;
|
|
22
|
+
set vibrationBlockedByGriff(pVal: boolean);
|
|
23
|
+
private _vibrationBlockedByMotion;
|
|
24
|
+
get vibrationBlockedByMotion(): boolean;
|
|
25
|
+
set vibrationBlockedByMotion(pVal: boolean);
|
|
20
26
|
update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
|
|
21
27
|
setSensitivity(pVal: number): void;
|
|
22
|
-
|
|
28
|
+
alarmCheck(): void;
|
|
23
29
|
}
|