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,21 +1,23 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="iobroker" />
|
|
3
3
|
import { DeviceType } from '../deviceType';
|
|
4
|
-
import { DeviceInfo } from '../DeviceInfo';
|
|
5
4
|
import { ZigbeeDevice } from './zigbeeDevice';
|
|
6
|
-
|
|
5
|
+
import { MotionSensorSettings } from '../../../models';
|
|
6
|
+
import { DeviceInfo } from '../DeviceInfo';
|
|
7
|
+
import { iMotionSensor } from '../iMotionSensor';
|
|
8
|
+
export declare class ZigbeeMotionSensor extends ZigbeeDevice implements iMotionSensor {
|
|
9
|
+
settings: MotionSensorSettings;
|
|
7
10
|
movementDetected: boolean;
|
|
8
|
-
excludeFromNightAlarm: boolean;
|
|
9
|
-
protected _timeSinceLastMotion: number;
|
|
10
|
-
protected _detectionsToday: number;
|
|
11
11
|
protected _initialized: boolean;
|
|
12
12
|
protected _movementDetectedCallback: Array<(pValue: boolean) => void>;
|
|
13
13
|
protected _needsMovementResetFallback: boolean;
|
|
14
14
|
protected _fallBackTimeout: NodeJS.Timeout | undefined;
|
|
15
|
+
constructor(pInfo: DeviceInfo, type: DeviceType);
|
|
16
|
+
protected _timeSinceLastMotion: number;
|
|
15
17
|
get timeSinceLastMotion(): number;
|
|
18
|
+
protected _detectionsToday: number;
|
|
16
19
|
get detectionsToday(): number;
|
|
17
20
|
set detectionsToday(pVal: number);
|
|
18
|
-
constructor(pInfo: DeviceInfo, type: DeviceType);
|
|
19
21
|
/**
|
|
20
22
|
* Adds a callback for when a motion state has changed.
|
|
21
23
|
* @param pCallback Function that accepts the new state as parameter
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ZigbeeMotionSensor = void 0;
|
|
4
|
-
const utils_1 = require("../../services/utils/utils");
|
|
5
4
|
const zigbeeDevice_1 = require("./zigbeeDevice");
|
|
6
|
-
const
|
|
7
|
-
const
|
|
5
|
+
const models_1 = require("../../../models");
|
|
6
|
+
const services_1 = require("../../services");
|
|
8
7
|
class ZigbeeMotionSensor extends zigbeeDevice_1.ZigbeeDevice {
|
|
9
8
|
constructor(pInfo, type) {
|
|
9
|
+
var _a;
|
|
10
10
|
super(pInfo, type);
|
|
11
|
+
this.settings = new models_1.MotionSensorSettings();
|
|
11
12
|
this.movementDetected = false;
|
|
12
|
-
this.excludeFromNightAlarm = false;
|
|
13
|
-
this._timeSinceLastMotion = 0;
|
|
14
|
-
this._detectionsToday = 0;
|
|
15
13
|
this._initialized = false;
|
|
16
14
|
this._movementDetectedCallback = [];
|
|
17
15
|
this._needsMovementResetFallback = true;
|
|
18
|
-
|
|
16
|
+
this._timeSinceLastMotion = 0;
|
|
17
|
+
this._detectionsToday = 0;
|
|
18
|
+
(_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.getCount(this).then((todayCount) => {
|
|
19
19
|
this.detectionsToday = todayCount.counter;
|
|
20
|
-
this.log(
|
|
20
|
+
this.log(models_1.LogLevel.Debug, `Preinitialized movement counter with ${this.detectionsToday}`);
|
|
21
21
|
this._initialized = true;
|
|
22
22
|
}).catch((err) => {
|
|
23
23
|
var _a;
|
|
24
|
-
this.log(
|
|
24
|
+
this.log(models_1.LogLevel.Warn, `Failed to initialize movement counter, err ${(_a = err === null || err === void 0 ? void 0 : err.message) !== null && _a !== void 0 ? _a : err}`);
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
// Time since last motion in seconds
|
|
@@ -32,9 +32,10 @@ class ZigbeeMotionSensor extends zigbeeDevice_1.ZigbeeDevice {
|
|
|
32
32
|
return this._detectionsToday;
|
|
33
33
|
}
|
|
34
34
|
set detectionsToday(pVal) {
|
|
35
|
+
var _a;
|
|
35
36
|
const oldVal = this._detectionsToday;
|
|
36
37
|
this._detectionsToday = pVal;
|
|
37
|
-
|
|
38
|
+
(_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistTodayCount(this, pVal, oldVal);
|
|
38
39
|
}
|
|
39
40
|
/**
|
|
40
41
|
* Adds a callback for when a motion state has changed.
|
|
@@ -45,14 +46,14 @@ class ZigbeeMotionSensor extends zigbeeDevice_1.ZigbeeDevice {
|
|
|
45
46
|
}
|
|
46
47
|
updateMovement(newState) {
|
|
47
48
|
if (!this._initialized && newState) {
|
|
48
|
-
this.log(
|
|
49
|
-
|
|
49
|
+
this.log(models_1.LogLevel.Trace, `Movement recognized, but database initialization has not finished yet --> delay.`);
|
|
50
|
+
services_1.Utils.guardedTimeout(() => {
|
|
50
51
|
this.updateMovement(newState);
|
|
51
52
|
}, 1000, this);
|
|
52
53
|
return;
|
|
53
54
|
}
|
|
54
55
|
if (newState === this.movementDetected) {
|
|
55
|
-
this.log(
|
|
56
|
+
this.log(models_1.LogLevel.Debug, `Skip movement because state is already ${newState}`);
|
|
56
57
|
if (newState) {
|
|
57
58
|
// Wenn ein Sensor sich nicht von alleine zurücksetzt, hier erzwingen.
|
|
58
59
|
this.resetFallbackTimeout();
|
|
@@ -62,33 +63,33 @@ class ZigbeeMotionSensor extends zigbeeDevice_1.ZigbeeDevice {
|
|
|
62
63
|
}
|
|
63
64
|
this.resetFallbackTimeout();
|
|
64
65
|
this.movementDetected = newState;
|
|
65
|
-
this.log(
|
|
66
|
+
this.log(models_1.LogLevel.Debug, `New movement state: ${newState}`);
|
|
66
67
|
if (newState) {
|
|
67
68
|
this.startFallbackTimeout();
|
|
68
69
|
this.detectionsToday++;
|
|
69
|
-
this.log(
|
|
70
|
+
this.log(models_1.LogLevel.Trace, `This is movement no. ${this.detectionsToday}`);
|
|
70
71
|
}
|
|
71
72
|
for (const c of this._movementDetectedCallback) {
|
|
72
73
|
c(newState);
|
|
73
74
|
}
|
|
74
75
|
}
|
|
75
76
|
update(idSplit, state, initial = false, pOverride = false) {
|
|
76
|
-
this.log(
|
|
77
|
+
this.log(models_1.LogLevel.DeepTrace, `Motion update: ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`);
|
|
77
78
|
super.update(idSplit, state, initial, pOverride);
|
|
78
79
|
switch (idSplit[3]) {
|
|
79
80
|
case 'occupancy':
|
|
80
|
-
this.log(
|
|
81
|
+
this.log(models_1.LogLevel.Trace, `Motion sensor: Update for motion state of ${this.info.customName}: ${state.val}`);
|
|
81
82
|
this.updateMovement(state.val);
|
|
82
83
|
break;
|
|
83
84
|
case 'no_motion':
|
|
84
|
-
this.log(state.val < 100 ?
|
|
85
|
+
this.log(state.val < 100 ? models_1.LogLevel.Trace : models_1.LogLevel.DeepTrace, `Motion sensor: Update for time since last motion of ${this.info.customName}: ${state.val}`);
|
|
85
86
|
this._timeSinceLastMotion = state.val;
|
|
86
87
|
break;
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
90
|
resetFallbackTimeout() {
|
|
90
91
|
if (this._fallBackTimeout) {
|
|
91
|
-
this.log(
|
|
92
|
+
this.log(models_1.LogLevel.Trace, `Fallback Timeout zurücksetzen`);
|
|
92
93
|
clearTimeout(this._fallBackTimeout);
|
|
93
94
|
}
|
|
94
95
|
}
|
|
@@ -96,8 +97,8 @@ class ZigbeeMotionSensor extends zigbeeDevice_1.ZigbeeDevice {
|
|
|
96
97
|
if (!this._needsMovementResetFallback) {
|
|
97
98
|
return;
|
|
98
99
|
}
|
|
99
|
-
this._fallBackTimeout =
|
|
100
|
-
this.log(
|
|
100
|
+
this._fallBackTimeout = services_1.Utils.guardedTimeout(() => {
|
|
101
|
+
this.log(models_1.LogLevel.Debug, `Benötige Fallback Bewegungs Reset`);
|
|
101
102
|
this._fallBackTimeout = undefined;
|
|
102
103
|
this.updateMovement(false);
|
|
103
104
|
}, 270000, this);
|
|
@@ -1,32 +1,34 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
/// <reference types="iobroker" />
|
|
2
3
|
import { DeviceType } from '../deviceType';
|
|
3
4
|
import { DeviceInfo } from '../DeviceInfo';
|
|
5
|
+
import { ShutterCalibration, ShutterSettings } from '../../../models';
|
|
4
6
|
import { ZigbeeDevice } from './zigbeeDevice';
|
|
5
7
|
import { iShutter } from '../iShutter';
|
|
6
|
-
import { Fenster } from '../groups
|
|
8
|
+
import { Fenster } from '../groups';
|
|
7
9
|
import { IoBrokerBaseDevice } from '../IoBrokerBaseDevice';
|
|
8
|
-
import { ShutterSettings } from '../../../models/deviceSettings/shutterSettings';
|
|
9
|
-
import { ShutterCalibration } from '../../../models/persistence/ShutterCalibration';
|
|
10
10
|
export declare class ZigbeeShutter extends ZigbeeDevice implements iShutter {
|
|
11
11
|
settings: ShutterSettings;
|
|
12
|
-
|
|
13
|
-
set currentLevel(value: number);
|
|
14
|
-
get desiredFensterLevel(): number;
|
|
15
|
-
get fenster(): Fenster | undefined;
|
|
16
|
-
set fenster(value: Fenster | undefined);
|
|
17
|
-
protected _currentLevel: number;
|
|
18
|
-
protected _fenster?: Fenster;
|
|
12
|
+
protected _iMovementFinishTimeout: NodeJS.Timeout | null;
|
|
19
13
|
protected _firstCommandRecieved: boolean;
|
|
20
14
|
protected _setLevel: number;
|
|
21
15
|
protected _setLevelTime: number;
|
|
22
16
|
protected _shutterCalibrationData: ShutterCalibration;
|
|
23
17
|
constructor(pInfo: DeviceInfo, pType: DeviceType);
|
|
18
|
+
protected _currentLevel: number;
|
|
19
|
+
get currentLevel(): number;
|
|
20
|
+
set currentLevel(value: number);
|
|
21
|
+
protected _fenster?: Fenster;
|
|
22
|
+
get fenster(): Fenster | undefined;
|
|
23
|
+
set fenster(value: Fenster | undefined);
|
|
24
|
+
get desiredFensterLevel(): number;
|
|
24
25
|
update(idSplit: string[], state: ioBroker.State, initial?: boolean, pOverride?: boolean): void;
|
|
25
26
|
setLevel(pPosition: number, initial?: boolean, skipOpenWarning?: boolean): void;
|
|
27
|
+
toJSON(): Partial<IoBrokerBaseDevice>;
|
|
26
28
|
protected moveToPosition(pPosition: number): void;
|
|
27
29
|
protected getAverageUp(): number;
|
|
28
30
|
protected getAverageDown(): number;
|
|
29
31
|
protected isCalibrated(): boolean;
|
|
30
32
|
protected persistCalibrationData(): void;
|
|
31
|
-
|
|
33
|
+
protected initializeMovementFinishTimeout(duration: number, endPosition: number): void;
|
|
32
34
|
}
|
|
@@ -4,29 +4,28 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ZigbeeShutter = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const services_1 = require("../../services");
|
|
8
|
+
const models_1 = require("../../../models");
|
|
9
9
|
const zigbeeDevice_1 = require("./zigbeeDevice");
|
|
10
|
-
const
|
|
10
|
+
const models_2 = require("../models");
|
|
11
11
|
const lodash_1 = __importDefault(require("lodash"));
|
|
12
|
-
const shutterSettings_1 = require("../../../models/deviceSettings/shutterSettings");
|
|
13
|
-
const ShutterCalibration_1 = require("../../../models/persistence/ShutterCalibration");
|
|
14
|
-
const index_1 = require("../../../index");
|
|
15
12
|
class ZigbeeShutter extends zigbeeDevice_1.ZigbeeDevice {
|
|
16
13
|
constructor(pInfo, pType) {
|
|
14
|
+
var _a;
|
|
17
15
|
super(pInfo, pType);
|
|
18
|
-
this.settings = new
|
|
19
|
-
this.
|
|
16
|
+
this.settings = new models_1.ShutterSettings();
|
|
17
|
+
this._iMovementFinishTimeout = null;
|
|
20
18
|
this._firstCommandRecieved = false;
|
|
21
19
|
this._setLevel = -1;
|
|
22
20
|
this._setLevelTime = -1;
|
|
23
|
-
this._shutterCalibrationData = new
|
|
24
|
-
|
|
21
|
+
this._shutterCalibrationData = new models_1.ShutterCalibration(this.info.fullID, 0, 0, 0, 0);
|
|
22
|
+
this._currentLevel = -1;
|
|
23
|
+
(_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.getShutterCalibration(this).then((calibrationData) => {
|
|
25
24
|
this._shutterCalibrationData = calibrationData;
|
|
26
|
-
this.log(
|
|
25
|
+
this.log(models_1.LogLevel.DeepTrace, `ZigbeeShutter initialized with calibration data`);
|
|
27
26
|
}).catch((err) => {
|
|
28
27
|
var _a;
|
|
29
|
-
this.log(
|
|
28
|
+
this.log(models_1.LogLevel.Warn, `Failed to initialize Calibration data, err ${(_a = err === null || err === void 0 ? void 0 : err.message) !== null && _a !== void 0 ? _a : err}`);
|
|
30
29
|
});
|
|
31
30
|
}
|
|
32
31
|
get currentLevel() {
|
|
@@ -36,29 +35,29 @@ class ZigbeeShutter extends zigbeeDevice_1.ZigbeeDevice {
|
|
|
36
35
|
return this._currentLevel;
|
|
37
36
|
}
|
|
38
37
|
set currentLevel(value) {
|
|
39
|
-
if (value !== this._setLevel &&
|
|
38
|
+
if (value !== this._setLevel && services_1.Utils.nowMS() - this._setLevelTime < 60 * 10000) {
|
|
40
39
|
value = this._setLevel;
|
|
41
40
|
}
|
|
42
41
|
if (value !== this._currentLevel && this._fenster) {
|
|
43
|
-
|
|
42
|
+
services_1.Utils.guardedNewThread(() => {
|
|
44
43
|
var _a;
|
|
45
44
|
(_a = this._fenster) === null || _a === void 0 ? void 0 : _a.rolloPositionChange(value);
|
|
46
45
|
}, this);
|
|
47
46
|
}
|
|
48
47
|
this._currentLevel = value;
|
|
49
48
|
}
|
|
50
|
-
get desiredFensterLevel() {
|
|
51
|
-
if (this._fenster === undefined) {
|
|
52
|
-
return -1;
|
|
53
|
-
}
|
|
54
|
-
return this._fenster.desiredPosition;
|
|
55
|
-
}
|
|
56
49
|
get fenster() {
|
|
57
50
|
return this._fenster;
|
|
58
51
|
}
|
|
59
52
|
set fenster(value) {
|
|
60
53
|
this._fenster = value;
|
|
61
54
|
}
|
|
55
|
+
get desiredFensterLevel() {
|
|
56
|
+
if (this._fenster === undefined) {
|
|
57
|
+
return -1;
|
|
58
|
+
}
|
|
59
|
+
return this._fenster.desiredPosition;
|
|
60
|
+
}
|
|
62
61
|
update(idSplit, state, initial = false, pOverride = false) {
|
|
63
62
|
super.update(idSplit, state, initial, pOverride);
|
|
64
63
|
}
|
|
@@ -67,33 +66,36 @@ class ZigbeeShutter extends zigbeeDevice_1.ZigbeeDevice {
|
|
|
67
66
|
this._firstCommandRecieved = true;
|
|
68
67
|
}
|
|
69
68
|
else if (this._firstCommandRecieved && initial) {
|
|
70
|
-
this.log(
|
|
69
|
+
this.log(models_1.LogLevel.Debug, `Skipped initial Rollo to ${pPosition} as we recieved a command already`);
|
|
71
70
|
return;
|
|
72
71
|
}
|
|
73
72
|
if (this.currentLevel === pPosition) {
|
|
74
|
-
this.log(
|
|
73
|
+
this.log(models_1.LogLevel.Debug, `Skip Rollo command to Position ${pPosition} as this is the current one`);
|
|
75
74
|
return;
|
|
76
75
|
}
|
|
77
76
|
if (this._fenster !== undefined) {
|
|
78
|
-
if (this._fenster.griffeInPosition(
|
|
77
|
+
if (this._fenster.griffeInPosition(models_2.FensterPosition.offen) > 0 && pPosition < 100) {
|
|
79
78
|
if (!skipOpenWarning) {
|
|
80
|
-
this.log(
|
|
79
|
+
this.log(models_1.LogLevel.Alert, `Fahre Rollo nicht runter, weil das Fenster offen ist!`);
|
|
81
80
|
}
|
|
82
81
|
return;
|
|
83
82
|
}
|
|
84
|
-
if (this._fenster.griffeInPosition(
|
|
83
|
+
if (this._fenster.griffeInPosition(models_2.FensterPosition.kipp) > 0 && pPosition < 50) {
|
|
85
84
|
pPosition = 50;
|
|
86
85
|
if (!skipOpenWarning) {
|
|
87
|
-
this.log(
|
|
86
|
+
this.log(models_1.LogLevel.Alert, `Fahre Rollo nicht runter, weil das Fenster auf Kipp ist!`);
|
|
88
87
|
}
|
|
89
88
|
}
|
|
90
89
|
}
|
|
91
90
|
this._setLevel = pPosition;
|
|
92
|
-
this.log(
|
|
91
|
+
this.log(models_1.LogLevel.Debug, `Move to position ${pPosition}`);
|
|
93
92
|
this.moveToPosition(pPosition);
|
|
94
93
|
}
|
|
94
|
+
toJSON() {
|
|
95
|
+
return lodash_1.default.omit(super.toJSON(), ['_fenster']);
|
|
96
|
+
}
|
|
95
97
|
moveToPosition(pPosition) {
|
|
96
|
-
this.log(
|
|
98
|
+
this.log(models_1.LogLevel.Error, `Implement own moveToPosition(${pPosition}) Function`);
|
|
97
99
|
}
|
|
98
100
|
getAverageUp() {
|
|
99
101
|
if (this._shutterCalibrationData.averageUp > 0) {
|
|
@@ -102,7 +104,7 @@ class ZigbeeShutter extends zigbeeDevice_1.ZigbeeDevice {
|
|
|
102
104
|
if (this.settings.msTilTop > 0) {
|
|
103
105
|
return this.settings.msTilTop;
|
|
104
106
|
}
|
|
105
|
-
return
|
|
107
|
+
return 30000;
|
|
106
108
|
}
|
|
107
109
|
getAverageDown() {
|
|
108
110
|
if (this._shutterCalibrationData.averageDown > 0) {
|
|
@@ -111,17 +113,24 @@ class ZigbeeShutter extends zigbeeDevice_1.ZigbeeDevice {
|
|
|
111
113
|
if (this.settings.msTilBot > 0) {
|
|
112
114
|
return this.settings.msTilBot;
|
|
113
115
|
}
|
|
114
|
-
return
|
|
116
|
+
return 30000;
|
|
115
117
|
}
|
|
116
118
|
isCalibrated() {
|
|
117
119
|
return this.getAverageDown() > 0 && this.getAverageUp() > 0;
|
|
118
120
|
}
|
|
119
121
|
persistCalibrationData() {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
+
var _a;
|
|
123
|
+
this.log(models_1.LogLevel.Trace, `Persiting Calibration Data. Average Up: ${this._shutterCalibrationData.averageUp}, Down: ${this._shutterCalibrationData.averageDown}`);
|
|
124
|
+
(_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistShutterCalibration(this._shutterCalibrationData);
|
|
122
125
|
}
|
|
123
|
-
|
|
124
|
-
|
|
126
|
+
initializeMovementFinishTimeout(duration, endPosition) {
|
|
127
|
+
if (this._iMovementFinishTimeout !== null) {
|
|
128
|
+
clearTimeout(this._iMovementFinishTimeout);
|
|
129
|
+
}
|
|
130
|
+
this._iMovementFinishTimeout = services_1.Utils.guardedTimeout(() => {
|
|
131
|
+
this.currentLevel = endPosition;
|
|
132
|
+
this._iMovementFinishTimeout = null;
|
|
133
|
+
}, duration, this);
|
|
125
134
|
}
|
|
126
135
|
}
|
|
127
136
|
exports.ZigbeeShutter = ZigbeeShutter;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="iobroker" />
|
|
2
|
+
import { ZigbeeShutter } from './zigbeeShutter';
|
|
3
|
+
import { DeviceInfo } from '../DeviceInfo';
|
|
4
|
+
export declare class ZigbeeUbisysShutter extends ZigbeeShutter {
|
|
5
|
+
private _positionStateId;
|
|
6
|
+
constructor(pInfo: DeviceInfo);
|
|
7
|
+
update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
|
|
8
|
+
protected moveToPosition(pPosition: number): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ZigbeeUbisysShutter = void 0;
|
|
4
|
+
const zigbeeShutter_1 = require("./zigbeeShutter");
|
|
5
|
+
const deviceType_1 = require("../deviceType");
|
|
6
|
+
const models_1 = require("../../../models");
|
|
7
|
+
class ZigbeeUbisysShutter extends zigbeeShutter_1.ZigbeeShutter {
|
|
8
|
+
constructor(pInfo) {
|
|
9
|
+
super(pInfo, deviceType_1.DeviceType.ZigbeeUbisysShutter);
|
|
10
|
+
this._positionStateId = `${this.info.fullID}.position`;
|
|
11
|
+
// this.presenceStateID = `${this.info.fullID}.1.${HmIpPraezenz.PRESENCE_DETECTION}`;
|
|
12
|
+
}
|
|
13
|
+
update(idSplit, state, initial = false) {
|
|
14
|
+
switch (idSplit[3]) {
|
|
15
|
+
case 'position':
|
|
16
|
+
this.log(models_1.LogLevel.Trace, `Shutter Update for ${this.info.customName} to "${state.val}"`);
|
|
17
|
+
this.currentLevel = state.val;
|
|
18
|
+
break;
|
|
19
|
+
}
|
|
20
|
+
super.update(idSplit, state, initial, true);
|
|
21
|
+
}
|
|
22
|
+
moveToPosition(pPosition) {
|
|
23
|
+
this.setState(this._positionStateId, pPosition);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.ZigbeeUbisysShutter = ZigbeeUbisysShutter;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { iShutter } from '../devices
|
|
2
|
-
import { Fenster } from '../devices/groups/Fenster';
|
|
1
|
+
import { Fenster, iShutter } from '../devices';
|
|
3
2
|
export declare class ShutterService {
|
|
4
3
|
static anyRolloDown(rollo: iShutter[]): boolean;
|
|
5
4
|
static getRolladenPosition(): string;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ShutterService = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const api_service_1 = require("./api/api-service");
|
|
4
|
+
const devices_1 = require("../devices");
|
|
5
|
+
const api_1 = require("./api");
|
|
7
6
|
class ShutterService {
|
|
8
7
|
static anyRolloDown(rollo) {
|
|
9
8
|
for (let i = 0; i < rollo.length; i++) {
|
|
@@ -24,7 +23,7 @@ class ShutterService {
|
|
|
24
23
|
}
|
|
25
24
|
response.push(`\nDie nächsten Zeiten zum Hochfahren:`);
|
|
26
25
|
const down = [`\nDie nächsten Zeiten zum Runterfahren:`];
|
|
27
|
-
for (const r of
|
|
26
|
+
for (const r of api_1.API.getRooms().values()) {
|
|
28
27
|
if (!r.FensterGroup) {
|
|
29
28
|
continue;
|
|
30
29
|
}
|
|
@@ -43,7 +42,9 @@ class ShutterService {
|
|
|
43
42
|
const rollos = [];
|
|
44
43
|
for (const dID in devices_1.Devices.alLDevices) {
|
|
45
44
|
const d = devices_1.Devices.alLDevices[dID];
|
|
46
|
-
if (d.deviceType ===
|
|
45
|
+
if (d.deviceType === devices_1.DeviceType.HmIpRoll ||
|
|
46
|
+
d.deviceType === devices_1.DeviceType.ZigbeeIlluShutter ||
|
|
47
|
+
d.deviceType === devices_1.DeviceType.ZigbeeUbisysShutter) {
|
|
47
48
|
rollos.push(d);
|
|
48
49
|
}
|
|
49
50
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import TelegramBot from 'node-telegram-bot-api';
|
|
2
2
|
import { TelegramMessageCallback } from './telegramMessageCalback';
|
|
3
|
-
import { iTelegramSettings } from '../../config
|
|
3
|
+
import { iTelegramSettings } from '../../config';
|
|
4
4
|
export declare class TelegramService {
|
|
5
5
|
static subscribedIDs: number[];
|
|
6
6
|
private static token;
|
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.TelegramService = void 0;
|
|
7
7
|
const node_telegram_bot_api_1 = __importDefault(require("node-telegram-bot-api"));
|
|
8
8
|
const telegramMessageCalback_1 = require("./telegramMessageCalback");
|
|
9
|
-
const log_service_1 = require("../log-service
|
|
10
|
-
const utils_1 = require("../utils
|
|
11
|
-
const
|
|
9
|
+
const log_service_1 = require("../log-service");
|
|
10
|
+
const utils_1 = require("../utils");
|
|
11
|
+
const models_1 = require("../../../models");
|
|
12
12
|
class TelegramService {
|
|
13
13
|
static addMessageCallback(pCallback, reset = false) {
|
|
14
14
|
if (!reset) {
|
|
@@ -20,7 +20,7 @@ class TelegramService {
|
|
|
20
20
|
}
|
|
21
21
|
pCallback.callback(msg);
|
|
22
22
|
});
|
|
23
|
-
log_service_1.ServerLogService.writeLog(
|
|
23
|
+
log_service_1.ServerLogService.writeLog(models_1.LogLevel.Debug, `Telegram Callback mit Namen ${pCallback.name} für Nachrichten mit "${pCallback.identifier}" hinzugefügt`);
|
|
24
24
|
}
|
|
25
25
|
static initialize(settings) {
|
|
26
26
|
if (!settings && this.settings === undefined) {
|
|
@@ -42,8 +42,8 @@ class TelegramService {
|
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
*/
|
|
45
|
-
log_service_1.ServerLogService.writeLog(
|
|
46
|
-
log_service_1.ServerLogService.writeLog(
|
|
45
|
+
log_service_1.ServerLogService.writeLog(models_1.LogLevel.Debug, `Telegram Polling Error: ${e.message}`);
|
|
46
|
+
log_service_1.ServerLogService.writeLog(models_1.LogLevel.Trace, `Telegram Polling Error stack: ${e.stack}`);
|
|
47
47
|
});
|
|
48
48
|
TelegramService.addMessageCallback(new telegramMessageCalback_1.TelegramMessageCallback('helpCommand', /\/help/, async (m) => {
|
|
49
49
|
var _a;
|
|
@@ -70,8 +70,10 @@ class TelegramService {
|
|
|
70
70
|
.replace(/\\/g, '');
|
|
71
71
|
commands.push({ command: commandIdentifier, description: telegramCb.helpMessage });
|
|
72
72
|
}
|
|
73
|
-
log_service_1.ServerLogService.writeLog(
|
|
74
|
-
TelegramService.bot.setMyCommands(commands)
|
|
73
|
+
log_service_1.ServerLogService.writeLog(models_1.LogLevel.Debug, `New Telegram Commands: "${JSON.stringify(commands)}"`);
|
|
74
|
+
TelegramService.bot.setMyCommands(commands).catch((e) => {
|
|
75
|
+
log_service_1.ServerLogService.writeLog(models_1.LogLevel.Error, `Setting Telegram Commands failed with error: ${e}`);
|
|
76
|
+
});
|
|
75
77
|
}
|
|
76
78
|
static inform(message) {
|
|
77
79
|
this.sendMessage(this.subscribedIDs, message);
|
|
@@ -87,7 +89,7 @@ class TelegramService {
|
|
|
87
89
|
for (const id of ids) {
|
|
88
90
|
utils_1.Utils.guardedTimeout(() => {
|
|
89
91
|
this.bot.sendMessage(id, message.substring(i * 4095, i * 4095 + 4095)).catch((r) => {
|
|
90
|
-
log_service_1.ServerLogService.writeLog(
|
|
92
|
+
log_service_1.ServerLogService.writeLog(models_1.LogLevel.Warn, `Send Telegram Message to ${id} failed: ${r}`);
|
|
91
93
|
});
|
|
92
94
|
}, 200 * i, this);
|
|
93
95
|
}
|
|
@@ -96,10 +98,10 @@ class TelegramService {
|
|
|
96
98
|
static checkAuthorized(msg) {
|
|
97
99
|
var _a;
|
|
98
100
|
if (msg.from !== undefined && this.allowedIDs.includes((_a = msg.from) === null || _a === void 0 ? void 0 : _a.id)) {
|
|
99
|
-
log_service_1.ServerLogService.writeLog(
|
|
101
|
+
log_service_1.ServerLogService.writeLog(models_1.LogLevel.Debug, `Authorisierte Telegram Message erhalten: ${JSON.stringify(msg)}`);
|
|
100
102
|
return true;
|
|
101
103
|
}
|
|
102
|
-
log_service_1.ServerLogService.writeLog(
|
|
104
|
+
log_service_1.ServerLogService.writeLog(models_1.LogLevel.Alert, `Fremden Telegram Nutzer erkannt. Nachricht "${JSON.stringify(msg)}"`);
|
|
103
105
|
TelegramService.sendMessage([msg.chat.id], "Hello stranger,\nExcuse me, but you're not yet on the guest list.\nPlease contact our manager.\nHave a great day");
|
|
104
106
|
return false;
|
|
105
107
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { LogObject } from '../log-service
|
|
1
|
+
import { IBaseDevice } from '../../devices';
|
|
2
|
+
import { RoomBase } from '../../../models';
|
|
3
|
+
import { LogObject } from '../log-service';
|
|
4
4
|
export declare class API {
|
|
5
5
|
static getDevices(): {
|
|
6
|
-
[id: string]:
|
|
6
|
+
[id: string]: IBaseDevice;
|
|
7
7
|
};
|
|
8
|
-
static getDevice(id: string):
|
|
8
|
+
static getDevice(id: string): IBaseDevice;
|
|
9
9
|
static getRooms(): Map<string, RoomBase>;
|
|
10
10
|
static getRoom(id: string): RoomBase | undefined;
|
|
11
11
|
static getLog(): LogObject[];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.API = void 0;
|
|
4
|
-
const devices_1 = require("../../devices
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
4
|
+
const devices_1 = require("../../devices");
|
|
5
|
+
const models_1 = require("../../../models");
|
|
6
|
+
const room_service_1 = require("../room-service");
|
|
7
|
+
const log_service_1 = require("../log-service");
|
|
8
8
|
class API {
|
|
9
9
|
static getDevices() {
|
|
10
10
|
// console.log(inspect(Devices.alLDevices, false, 3));
|
|
@@ -13,7 +13,7 @@ class API {
|
|
|
13
13
|
static getDevice(id) {
|
|
14
14
|
const d = devices_1.Devices.alLDevices[id];
|
|
15
15
|
if (d === undefined) {
|
|
16
|
-
log_service_1.ServerLogService.writeLog(
|
|
16
|
+
log_service_1.ServerLogService.writeLog(models_1.LogLevel.Warn, `Api.getDevice() --> "${id}" not found`);
|
|
17
17
|
}
|
|
18
18
|
return devices_1.Devices.alLDevices[id];
|
|
19
19
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { TimeCallback } from '../../../models
|
|
2
|
-
import { iMuellSettings } from '../../config
|
|
3
|
-
import { OwnSonosDevice } from '../Sonos
|
|
1
|
+
import { TimeCallback } from '../../../models';
|
|
2
|
+
import { iMuellSettings } from '../../config';
|
|
3
|
+
import { OwnSonosDevice } from '../Sonos';
|
|
4
4
|
import { MuellTonne } from './muell-tonne';
|
|
5
5
|
export declare class MuellService {
|
|
6
6
|
static alleTonnen: Array<{
|
|
@@ -13,11 +13,11 @@ export declare class MuellService {
|
|
|
13
13
|
static brauneTonne: MuellTonne;
|
|
14
14
|
static updateTimeCallback: TimeCallback;
|
|
15
15
|
static checkTimeCallback: TimeCallback;
|
|
16
|
+
static months: string[];
|
|
16
17
|
private static lastCheck;
|
|
17
18
|
private static _calendarURL;
|
|
18
19
|
private static _active;
|
|
19
20
|
private static defaultSonosDevice;
|
|
20
|
-
static months: string[];
|
|
21
21
|
static intialize(config: iMuellSettings, defaultSonosDevice: OwnSonosDevice | undefined): void;
|
|
22
22
|
static updateCalendar(checkAfterwards?: boolean): void;
|
|
23
23
|
static checkAll(pRetries?: number): void;
|