hoffmation-base 1.1.48 → 1.2.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/server/devices/Heizgruppen.d.ts +0 -1
- package/lib/server/devices/Heizgruppen.js +0 -20
- package/lib/server/devices/baseDeviceInterfaces/iBatteryDevice.d.ts +2 -1
- package/lib/server/devices/baseDeviceInterfaces/iHumiditySensor.d.ts +4 -1
- package/lib/server/devices/hmIPDevices/hmIpGriff.d.ts +6 -2
- package/lib/server/devices/hmIPDevices/hmIpGriff.js +18 -3
- package/lib/server/devices/hmIPDevices/hmIpHeizgruppe.d.ts +5 -1
- package/lib/server/devices/hmIPDevices/hmIpHeizgruppe.js +24 -4
- package/lib/server/devices/hmIPDevices/hmIpHeizung.d.ts +3 -1
- package/lib/server/devices/hmIPDevices/hmIpHeizung.js +11 -2
- package/lib/server/devices/hmIPDevices/hmIpPraezenz.d.ts +3 -1
- package/lib/server/devices/hmIPDevices/hmIpPraezenz.js +10 -2
- package/lib/server/devices/hmIPDevices/hmIpTaster.d.ts +3 -1
- package/lib/server/devices/hmIPDevices/hmIpTaster.js +10 -2
- package/lib/server/devices/hmIPDevices/hmIpTherm.d.ts +3 -1
- package/lib/server/devices/hmIPDevices/hmIpTherm.js +11 -2
- package/lib/server/devices/hmIPDevices/hmIpTuer.d.ts +3 -1
- package/lib/server/devices/hmIPDevices/hmIpTuer.js +6 -0
- package/lib/server/devices/jsObject/jsObjectEnergyManager.d.ts +3 -1
- package/lib/server/devices/jsObject/jsObjectEnergyManager.js +10 -0
- package/lib/server/devices/zigbee/BaseDevices/zigbeeDevice.d.ts +12 -4
- package/lib/server/devices/zigbee/BaseDevices/zigbeeDevice.js +31 -11
- package/lib/server/devices/zigbee/BaseDevices/zigbeeHeater.d.ts +4 -1
- package/lib/server/devices/zigbee/BaseDevices/zigbeeHeater.js +21 -6
- package/lib/server/devices/zigbee/BaseDevices/zigbeeMagnetContact.d.ts +4 -1
- package/lib/server/devices/zigbee/BaseDevices/zigbeeMagnetContact.js +18 -3
- package/lib/server/devices/zigbee/BaseDevices/zigbeeMotionSensor.d.ts +3 -1
- package/lib/server/devices/zigbee/BaseDevices/zigbeeMotionSensor.js +11 -3
- package/lib/server/devices/zigbee/zigbeeAquaraVibra.d.ts +3 -1
- package/lib/server/devices/zigbee/zigbeeAquaraVibra.js +11 -3
- package/lib/server/devices/zigbee/zigbeeAquaraWater.d.ts +4 -1
- package/lib/server/devices/zigbee/zigbeeAquaraWater.js +18 -3
- package/lib/server/devices/zigbee/zigbeeHeimanSmoke.d.ts +4 -1
- package/lib/server/devices/zigbee/zigbeeHeimanSmoke.js +18 -3
- package/lib/server/devices/zigbee/zigbeeSonoffTemp.d.ts +6 -1
- package/lib/server/devices/zigbee/zigbeeSonoffTemp.js +27 -3
- package/lib/server/ioBroker/connection.d.ts +3 -1
- package/lib/server/ioBroker/connection.js +10 -0
- package/lib/server/services/Telegram/telegram-Commands.js +0 -6
- package/lib/server/services/dbo/iPersist.d.ts +6 -5
- package/lib/server/services/dbo/postgreSqlPersist.d.ts +6 -5
- package/lib/server/services/dbo/postgreSqlPersist.js +66 -62
- package/lib/server/services/time-callback-service.js +2 -2
- package/lib/server/services/utils/iDisposeable.d.ts +3 -0
- package/lib/server/services/utils/iDisposeable.js +2 -0
- package/lib/server/services/utils/index.d.ts +1 -0
- package/lib/server/services/utils/index.js +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -8
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { HmIpHeizgruppe } from './hmIPDevices';
|
|
2
2
|
export declare class Heizgruppen {
|
|
3
|
-
static getSpecificInfo(pText: string | undefined): Promise<string>;
|
|
4
3
|
static getProblems(): string;
|
|
5
4
|
static getAllGruppen(): HmIpHeizgruppe[];
|
|
6
5
|
static getSpecificGroup(name: string): HmIpHeizgruppe | undefined;
|
|
@@ -3,27 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Heizgruppen = void 0;
|
|
4
4
|
const deviceType_1 = require("./deviceType");
|
|
5
5
|
const devices_1 = require("./devices");
|
|
6
|
-
const services_1 = require("../services");
|
|
7
|
-
const groups_1 = require("./groups");
|
|
8
6
|
class Heizgruppen {
|
|
9
|
-
static async getSpecificInfo(pText) {
|
|
10
|
-
var _a, _b;
|
|
11
|
-
if (pText === undefined || !pText.includes('"')) {
|
|
12
|
-
return `Bitte übergeben Sie eine Heizgruppe innerhalb von "". z.B. "EG Flur HeizGr"`;
|
|
13
|
-
}
|
|
14
|
-
const searchText = pText.split('"')[1];
|
|
15
|
-
const group = this.getSpecificGroup(searchText);
|
|
16
|
-
if (group === undefined) {
|
|
17
|
-
return `"${searchText}" ist keine gültige Heizgruppe, im Folgenden ist eine Liste aller gültigen Heizgruppen:\n${groups_1.HeatGroup.getInfo()}`;
|
|
18
|
-
}
|
|
19
|
-
const results = (_b = (await ((_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.readTemperaturDataPoint(group, 20)))) !== null && _b !== void 0 ? _b : [];
|
|
20
|
-
const response = [`Dies sind die letzten 20 Messpunkte der Heizgruppe:`];
|
|
21
|
-
response.push(`Zeitpunkt\t\tIst-Temperatur\t\tSoll-Temperatur\t\tVentilstellung`);
|
|
22
|
-
for (const r of results) {
|
|
23
|
-
response.push(`${r.date.toLocaleTimeString('de-DE')}:\t\t${r.istTemperatur}°C\t\t${r.sollTemperatur}°C\t\t${r.level}%`);
|
|
24
|
-
}
|
|
25
|
-
return response.join('\n');
|
|
26
|
-
}
|
|
27
7
|
static getProblems() {
|
|
28
8
|
const groups = this.getAllGruppen();
|
|
29
9
|
const response = [`Dies sind die bestehenden Differenzen:`];
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { iRoomDevice } from './iRoomDevice';
|
|
2
3
|
export declare const UNDEFINED_HUMIDITY_VALUE = -1;
|
|
3
4
|
export interface iHumiditySensor extends iRoomDevice {
|
|
4
|
-
|
|
5
|
+
readonly persistHumiditySensorInterval: NodeJS.Timeout;
|
|
6
|
+
readonly humidity: number;
|
|
5
7
|
addHumidityCallback(pCallback: (pValue: number) => void): void;
|
|
8
|
+
persistHumiditySensor(): void;
|
|
6
9
|
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/// <reference types="iobroker" />
|
|
2
|
+
import { iDisposable } from '../../services';
|
|
2
3
|
import { WindowPosition } from '../models';
|
|
3
4
|
import { Window } from '../groups';
|
|
4
5
|
import { IoBrokerBaseDevice } from '../IoBrokerBaseDevice';
|
|
5
6
|
import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
|
|
6
7
|
import { HmIPDevice } from './hmIpDevice';
|
|
7
8
|
import { iBatteryDevice, iHandleSensor } from '../baseDeviceInterfaces';
|
|
8
|
-
export declare class HmIpGriff extends HmIPDevice implements iHandleSensor, iBatteryDevice {
|
|
9
|
-
|
|
9
|
+
export declare class HmIpGriff extends HmIPDevice implements iHandleSensor, iBatteryDevice, iDisposable {
|
|
10
|
+
private _battery;
|
|
11
|
+
get battery(): number;
|
|
10
12
|
position: WindowPosition;
|
|
11
13
|
private _kippCallback;
|
|
12
14
|
private _closedCallback;
|
|
@@ -22,5 +24,7 @@ export declare class HmIpGriff extends HmIPDevice implements iHandleSensor, iBat
|
|
|
22
24
|
addClosedCallback(pCallback: (pValue: boolean) => void): void;
|
|
23
25
|
update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
|
|
24
26
|
updatePosition(pValue: WindowPosition): void;
|
|
27
|
+
persistBatteryDevice(): void;
|
|
28
|
+
dispose(): void;
|
|
25
29
|
toJSON(): Partial<IoBrokerBaseDevice>;
|
|
26
30
|
}
|
|
@@ -14,7 +14,7 @@ const DeviceCapability_1 = require("../DeviceCapability");
|
|
|
14
14
|
class HmIpGriff extends hmIpDevice_1.HmIPDevice {
|
|
15
15
|
constructor(pInfo) {
|
|
16
16
|
super(pInfo, deviceType_1.DeviceType.HmIpGriff);
|
|
17
|
-
this.
|
|
17
|
+
this._battery = -99;
|
|
18
18
|
this.position = models_1.WindowPosition.geschlossen;
|
|
19
19
|
this._kippCallback = [];
|
|
20
20
|
this._closedCallback = [];
|
|
@@ -25,6 +25,9 @@ class HmIpGriff extends hmIpDevice_1.HmIPDevice {
|
|
|
25
25
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.handleSensor);
|
|
26
26
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.batteryDriven);
|
|
27
27
|
}
|
|
28
|
+
get battery() {
|
|
29
|
+
return this._battery;
|
|
30
|
+
}
|
|
28
31
|
set window(value) {
|
|
29
32
|
this._window = value;
|
|
30
33
|
}
|
|
@@ -44,7 +47,8 @@ class HmIpGriff extends hmIpDevice_1.HmIPDevice {
|
|
|
44
47
|
case '0':
|
|
45
48
|
switch (idSplit[4]) {
|
|
46
49
|
case 'OPERATING_VOLTAGE':
|
|
47
|
-
this.
|
|
50
|
+
this._battery = 100 * ((state.val - 0.9) / 0.6);
|
|
51
|
+
this.persistBatteryDevice();
|
|
48
52
|
break;
|
|
49
53
|
}
|
|
50
54
|
break;
|
|
@@ -54,7 +58,8 @@ class HmIpGriff extends hmIpDevice_1.HmIPDevice {
|
|
|
54
58
|
this.updatePosition(state.val);
|
|
55
59
|
break;
|
|
56
60
|
case 'OPERATING_VOLTAGE':
|
|
57
|
-
this.
|
|
61
|
+
this._battery = 100 * ((state.val - 0.9) / 0.6);
|
|
62
|
+
this.persistBatteryDevice();
|
|
58
63
|
break;
|
|
59
64
|
}
|
|
60
65
|
break;
|
|
@@ -132,6 +137,16 @@ class HmIpGriff extends hmIpDevice_1.HmIPDevice {
|
|
|
132
137
|
}, 60000, this);
|
|
133
138
|
}
|
|
134
139
|
}
|
|
140
|
+
persistBatteryDevice() {
|
|
141
|
+
var _a;
|
|
142
|
+
(_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistBatteryDevice(this);
|
|
143
|
+
}
|
|
144
|
+
dispose() {
|
|
145
|
+
if (this._iOpenTimeout) {
|
|
146
|
+
clearInterval(this._iOpenTimeout);
|
|
147
|
+
this._iOpenTimeout = undefined;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
135
150
|
toJSON() {
|
|
136
151
|
return lodash_1.default.omit(super.toJSON(), ['_window']);
|
|
137
152
|
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="iobroker" />
|
|
3
3
|
import { HmIPDevice } from './hmIpDevice';
|
|
4
|
+
import { iDisposable } from '../../services';
|
|
4
5
|
import { HeaterSettings, TemperatureSettings } from '../../../models';
|
|
5
6
|
import { iHeater, iHumiditySensor, iTemperatureSensor } from '../baseDeviceInterfaces';
|
|
6
7
|
import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
|
|
7
|
-
export declare class HmIpHeizgruppe extends HmIPDevice implements iTemperatureSensor, iHumiditySensor, iHeater {
|
|
8
|
+
export declare class HmIpHeizgruppe extends HmIPDevice implements iTemperatureSensor, iHumiditySensor, iHeater, iDisposable {
|
|
8
9
|
readonly persistHeaterInterval: NodeJS.Timeout;
|
|
9
10
|
readonly persistTemperatureSensorInterval: NodeJS.Timeout;
|
|
11
|
+
readonly persistHumiditySensorInterval: NodeJS.Timeout;
|
|
10
12
|
settings: HeaterSettings;
|
|
11
13
|
private _iAutomaticInterval;
|
|
12
14
|
private _initialSeasonCheckDone;
|
|
@@ -46,6 +48,8 @@ export declare class HmIpHeizgruppe extends HmIPDevice implements iTemperatureSe
|
|
|
46
48
|
onTemperaturChange(newTemperatur: number): void;
|
|
47
49
|
persistTemperaturSensor(): void;
|
|
48
50
|
persistHeater(): void;
|
|
51
|
+
persistHumiditySensor(): void;
|
|
49
52
|
private updateBaseInformation;
|
|
50
53
|
private checkSeasonTurnOff;
|
|
54
|
+
dispose(): void;
|
|
51
55
|
}
|
|
@@ -17,6 +17,9 @@ class HmIpHeizgruppe extends hmIpDevice_1.HmIPDevice {
|
|
|
17
17
|
this.persistTemperatureSensorInterval = services_1.Utils.guardedInterval(() => {
|
|
18
18
|
this.persistTemperaturSensor();
|
|
19
19
|
}, 5 * 60 * 1000, this, false);
|
|
20
|
+
this.persistHumiditySensorInterval = services_1.Utils.guardedInterval(() => {
|
|
21
|
+
this.persistHumiditySensor();
|
|
22
|
+
}, 5 * 60 * 1000, this, false);
|
|
20
23
|
this.settings = new models_1.HeaterSettings();
|
|
21
24
|
this._initialSeasonCheckDone = false;
|
|
22
25
|
this._level = 0;
|
|
@@ -134,12 +137,11 @@ class HmIpHeizgruppe extends hmIpDevice_1.HmIPDevice {
|
|
|
134
137
|
}
|
|
135
138
|
}
|
|
136
139
|
checkAutomaticChange() {
|
|
137
|
-
var _a
|
|
140
|
+
var _a;
|
|
138
141
|
if (!this._initialSeasonCheckDone) {
|
|
139
142
|
this.checkSeasonTurnOff();
|
|
140
143
|
}
|
|
141
144
|
if (!this.settings.automaticMode || this.seasonTurnOff) {
|
|
142
|
-
(_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.addTemperaturDataPoint(this);
|
|
143
145
|
return;
|
|
144
146
|
}
|
|
145
147
|
const setting = models_1.TemperatureSettings.getActiveSetting(this._automaticPoints, new Date());
|
|
@@ -150,9 +152,8 @@ class HmIpHeizgruppe extends hmIpDevice_1.HmIPDevice {
|
|
|
150
152
|
}
|
|
151
153
|
if (this._desiredTemperature !== setting.temperature) {
|
|
152
154
|
this.log(models_1.LogLevel.Debug, `Automatische Temperaturanpassung für ${this.info.customName} auf ${setting.temperature}°C`);
|
|
153
|
-
this.desiredTemperature = (
|
|
155
|
+
this.desiredTemperature = (_a = setting.temperature) !== null && _a !== void 0 ? _a : this.settings.automaticFallBackTemperatur;
|
|
154
156
|
}
|
|
155
|
-
(_c = services_1.Utils.dbo) === null || _c === void 0 ? void 0 : _c.addTemperaturDataPoint(this);
|
|
156
157
|
}
|
|
157
158
|
addTempChangeCallback(pCallback) {
|
|
158
159
|
this._temperatureCallbacks.push(pCallback);
|
|
@@ -171,6 +172,10 @@ class HmIpHeizgruppe extends hmIpDevice_1.HmIPDevice {
|
|
|
171
172
|
var _a;
|
|
172
173
|
(_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistHeater(this);
|
|
173
174
|
}
|
|
175
|
+
persistHumiditySensor() {
|
|
176
|
+
var _a;
|
|
177
|
+
(_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistHumiditySensor(this);
|
|
178
|
+
}
|
|
174
179
|
updateBaseInformation(name, state) {
|
|
175
180
|
switch (name) {
|
|
176
181
|
case 'ACTUAL_TEMPERATURE':
|
|
@@ -196,5 +201,20 @@ class HmIpHeizgruppe extends hmIpDevice_1.HmIPDevice {
|
|
|
196
201
|
}
|
|
197
202
|
this._initialSeasonCheckDone = true;
|
|
198
203
|
}
|
|
204
|
+
dispose() {
|
|
205
|
+
if (this.persistTemperatureSensorInterval) {
|
|
206
|
+
clearInterval(this.persistTemperatureSensorInterval);
|
|
207
|
+
}
|
|
208
|
+
if (this.persistHumiditySensorInterval) {
|
|
209
|
+
clearInterval(this.persistHumiditySensorInterval);
|
|
210
|
+
}
|
|
211
|
+
if (this.persistHeaterInterval) {
|
|
212
|
+
clearInterval(this.persistHeaterInterval);
|
|
213
|
+
}
|
|
214
|
+
if (this._iAutomaticInterval) {
|
|
215
|
+
clearInterval(this._iAutomaticInterval);
|
|
216
|
+
this._iAutomaticInterval = undefined;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
199
219
|
}
|
|
200
220
|
exports.HmIpHeizgruppe = HmIpHeizgruppe;
|
|
@@ -3,10 +3,11 @@ import { HmIPDevice } from './hmIpDevice';
|
|
|
3
3
|
import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
|
|
4
4
|
import { iBatteryDevice } from '../baseDeviceInterfaces';
|
|
5
5
|
export declare class HmIpHeizung extends HmIPDevice implements iBatteryDevice {
|
|
6
|
+
private _battery;
|
|
6
7
|
private _temperatur;
|
|
7
8
|
private _level;
|
|
8
9
|
private _adaptionState;
|
|
9
|
-
battery: number;
|
|
10
|
+
get battery(): number;
|
|
10
11
|
constructor(pInfo: IoBrokerDeviceInfo);
|
|
11
12
|
private _desiredTemperatur;
|
|
12
13
|
get desiredTemperatur(): number;
|
|
@@ -14,4 +15,5 @@ export declare class HmIpHeizung extends HmIPDevice implements iBatteryDevice {
|
|
|
14
15
|
get iTemperatur(): number;
|
|
15
16
|
update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
|
|
16
17
|
private updateBaseInformation;
|
|
18
|
+
persistBatteryDevice(): void;
|
|
17
19
|
}
|
|
@@ -5,6 +5,7 @@ const deviceType_1 = require("../deviceType");
|
|
|
5
5
|
const models_1 = require("../../../models");
|
|
6
6
|
const hmIpDevice_1 = require("./hmIpDevice");
|
|
7
7
|
const DeviceCapability_1 = require("../DeviceCapability");
|
|
8
|
+
const services_1 = require("../../services");
|
|
8
9
|
var HmIpHeizungAdaptionStates;
|
|
9
10
|
(function (HmIpHeizungAdaptionStates) {
|
|
10
11
|
HmIpHeizungAdaptionStates[HmIpHeizungAdaptionStates["StateNotAvailable"] = 0] = "StateNotAvailable";
|
|
@@ -20,12 +21,15 @@ var HmIpHeizungAdaptionStates;
|
|
|
20
21
|
class HmIpHeizung extends hmIpDevice_1.HmIPDevice {
|
|
21
22
|
constructor(pInfo) {
|
|
22
23
|
super(pInfo, deviceType_1.DeviceType.HmIpHeizung);
|
|
24
|
+
this._battery = -99;
|
|
23
25
|
this._temperatur = 0;
|
|
24
26
|
this._level = 0;
|
|
25
|
-
this.battery = -99;
|
|
26
27
|
this._desiredTemperatur = 0;
|
|
27
28
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.batteryDriven);
|
|
28
29
|
}
|
|
30
|
+
get battery() {
|
|
31
|
+
return this._battery;
|
|
32
|
+
}
|
|
29
33
|
get desiredTemperatur() {
|
|
30
34
|
return this._desiredTemperatur;
|
|
31
35
|
}
|
|
@@ -42,7 +46,8 @@ class HmIpHeizung extends hmIpDevice_1.HmIPDevice {
|
|
|
42
46
|
case '0':
|
|
43
47
|
switch (idSplit[4]) {
|
|
44
48
|
case 'OPERATING_VOLTAGE':
|
|
45
|
-
this.
|
|
49
|
+
this._battery = 100 * ((state.val - 1.8) / 1.2);
|
|
50
|
+
this.persistBatteryDevice();
|
|
46
51
|
break;
|
|
47
52
|
}
|
|
48
53
|
break;
|
|
@@ -72,5 +77,9 @@ class HmIpHeizung extends hmIpDevice_1.HmIPDevice {
|
|
|
72
77
|
break;
|
|
73
78
|
}
|
|
74
79
|
}
|
|
80
|
+
persistBatteryDevice() {
|
|
81
|
+
var _a;
|
|
82
|
+
(_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistBatteryDevice(this);
|
|
83
|
+
}
|
|
75
84
|
}
|
|
76
85
|
exports.HmIpHeizung = HmIpHeizung;
|
|
@@ -4,11 +4,12 @@ import { MotionSensorSettings } from '../../../models';
|
|
|
4
4
|
import { iBatteryDevice, iIlluminationSensor, iMotionSensor } from '../baseDeviceInterfaces';
|
|
5
5
|
import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
|
|
6
6
|
export declare class HmIpPraezenz extends HmIPDevice implements iIlluminationSensor, iBatteryDevice, iMotionSensor {
|
|
7
|
+
private _battery;
|
|
7
8
|
private static PRESENCE_DETECTION;
|
|
8
9
|
private static CURRENT_ILLUMINATION;
|
|
9
10
|
excludeFromNightAlarm: boolean;
|
|
10
11
|
movementDetected: boolean;
|
|
11
|
-
battery: number;
|
|
12
|
+
get battery(): number;
|
|
12
13
|
settings: MotionSensorSettings;
|
|
13
14
|
private _movementDetectedCallback;
|
|
14
15
|
private initialized;
|
|
@@ -25,4 +26,5 @@ export declare class HmIpPraezenz extends HmIPDevice implements iIlluminationSen
|
|
|
25
26
|
update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
|
|
26
27
|
updatePresence(pVal: boolean): void;
|
|
27
28
|
persistMotionSensor(): void;
|
|
29
|
+
persistBatteryDevice(): void;
|
|
28
30
|
}
|
|
@@ -10,9 +10,9 @@ class HmIpPraezenz extends hmIpDevice_1.HmIPDevice {
|
|
|
10
10
|
constructor(pInfo) {
|
|
11
11
|
var _a;
|
|
12
12
|
super(pInfo, deviceType_1.DeviceType.HmIpPraezenz);
|
|
13
|
+
this._battery = -99;
|
|
13
14
|
this.excludeFromNightAlarm = false;
|
|
14
15
|
this.movementDetected = false;
|
|
15
|
-
this.battery = -99;
|
|
16
16
|
this.settings = new models_1.MotionSensorSettings();
|
|
17
17
|
this._movementDetectedCallback = [];
|
|
18
18
|
// private presenceStateID: string;
|
|
@@ -38,6 +38,9 @@ class HmIpPraezenz extends hmIpDevice_1.HmIPDevice {
|
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
+
get battery() {
|
|
42
|
+
return this._battery;
|
|
43
|
+
}
|
|
41
44
|
get timeSinceLastMotion() {
|
|
42
45
|
return Math.floor((services_1.Utils.nowMS() - this._lastMotionTime) / 1000);
|
|
43
46
|
}
|
|
@@ -65,7 +68,8 @@ class HmIpPraezenz extends hmIpDevice_1.HmIPDevice {
|
|
|
65
68
|
case '0':
|
|
66
69
|
switch (idSplit[4]) {
|
|
67
70
|
case 'OPERATING_VOLTAGE':
|
|
68
|
-
this.
|
|
71
|
+
this._battery = 100 * ((state.val - 1.8) / 1.2);
|
|
72
|
+
this.persistBatteryDevice();
|
|
69
73
|
break;
|
|
70
74
|
}
|
|
71
75
|
break;
|
|
@@ -109,6 +113,10 @@ class HmIpPraezenz extends hmIpDevice_1.HmIPDevice {
|
|
|
109
113
|
var _a;
|
|
110
114
|
(_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistMotionSensor(this);
|
|
111
115
|
}
|
|
116
|
+
persistBatteryDevice() {
|
|
117
|
+
var _a;
|
|
118
|
+
(_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistBatteryDevice(this);
|
|
119
|
+
}
|
|
112
120
|
}
|
|
113
121
|
exports.HmIpPraezenz = HmIpPraezenz;
|
|
114
122
|
// TODO: Add iPresenceSensor
|
|
@@ -4,6 +4,7 @@ import { iBatteryDevice, iButtonSwitch } from '../baseDeviceInterfaces';
|
|
|
4
4
|
import { Button, ButtonPressType } from '../button';
|
|
5
5
|
import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
|
|
6
6
|
export declare class HmIpTaster extends HmIPDevice implements iButtonSwitch, iBatteryDevice {
|
|
7
|
+
private _battery;
|
|
7
8
|
private static readonly BUTTON_CAPABILLITIES;
|
|
8
9
|
buttonTopLeft: Button;
|
|
9
10
|
buttonMidLeft: Button;
|
|
@@ -13,9 +14,10 @@ export declare class HmIpTaster extends HmIPDevice implements iButtonSwitch, iBa
|
|
|
13
14
|
buttonBotRight: Button;
|
|
14
15
|
buttonBot: undefined;
|
|
15
16
|
buttonTop: undefined;
|
|
16
|
-
battery: number;
|
|
17
|
+
get battery(): number;
|
|
17
18
|
constructor(pInfo: IoBrokerDeviceInfo);
|
|
18
19
|
persist(buttonName: string, pressType: ButtonPressType): void;
|
|
19
20
|
update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
|
|
20
21
|
getButtonAssignment(): string;
|
|
22
|
+
persistBatteryDevice(): void;
|
|
21
23
|
}
|
|
@@ -10,9 +10,9 @@ const services_1 = require("../../services");
|
|
|
10
10
|
class HmIpTaster extends hmIpDevice_1.HmIPDevice {
|
|
11
11
|
constructor(pInfo) {
|
|
12
12
|
super(pInfo, deviceType_1.DeviceType.HmIpTaster);
|
|
13
|
+
this._battery = -99;
|
|
13
14
|
this.buttonBot = undefined;
|
|
14
15
|
this.buttonTop = undefined;
|
|
15
|
-
this.battery = -99;
|
|
16
16
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.buttonSwitch);
|
|
17
17
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.batteryDriven);
|
|
18
18
|
this.buttonTopLeft = new button_1.Button('TopLeft', HmIpTaster.BUTTON_CAPABILLITIES);
|
|
@@ -22,6 +22,9 @@ class HmIpTaster extends hmIpDevice_1.HmIPDevice {
|
|
|
22
22
|
this.buttonMidRight = new button_1.Button('MidRight', HmIpTaster.BUTTON_CAPABILLITIES);
|
|
23
23
|
this.buttonBotRight = new button_1.Button('BotRight', HmIpTaster.BUTTON_CAPABILLITIES);
|
|
24
24
|
}
|
|
25
|
+
get battery() {
|
|
26
|
+
return this._battery;
|
|
27
|
+
}
|
|
25
28
|
persist(buttonName, pressType) {
|
|
26
29
|
var _a;
|
|
27
30
|
(_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistSwitchInput(this, pressType, buttonName);
|
|
@@ -34,7 +37,8 @@ class HmIpTaster extends hmIpDevice_1.HmIPDevice {
|
|
|
34
37
|
case '0':
|
|
35
38
|
switch (idSplit[4]) {
|
|
36
39
|
case 'OPERATING_VOLTAGE':
|
|
37
|
-
this.
|
|
40
|
+
this._battery = 100 * ((state.val - 1.8) / 1.2);
|
|
41
|
+
this.persistBatteryDevice();
|
|
38
42
|
break;
|
|
39
43
|
}
|
|
40
44
|
break;
|
|
@@ -105,6 +109,10 @@ class HmIpTaster extends hmIpDevice_1.HmIPDevice {
|
|
|
105
109
|
result.push('____________');
|
|
106
110
|
return result.join('\n');
|
|
107
111
|
}
|
|
112
|
+
persistBatteryDevice() {
|
|
113
|
+
var _a;
|
|
114
|
+
(_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistBatteryDevice(this);
|
|
115
|
+
}
|
|
108
116
|
}
|
|
109
117
|
exports.HmIpTaster = HmIpTaster;
|
|
110
118
|
HmIpTaster.BUTTON_CAPABILLITIES = {
|
|
@@ -3,7 +3,9 @@ import { HmIPDevice } from './hmIpDevice';
|
|
|
3
3
|
import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
|
|
4
4
|
import { iBatteryDevice } from '../baseDeviceInterfaces';
|
|
5
5
|
export declare class HmIpTherm extends HmIPDevice implements iBatteryDevice {
|
|
6
|
-
|
|
6
|
+
private _battery;
|
|
7
|
+
get battery(): number;
|
|
7
8
|
constructor(pInfo: IoBrokerDeviceInfo);
|
|
8
9
|
update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
|
|
10
|
+
persistBatteryDevice(): void;
|
|
9
11
|
}
|
|
@@ -5,12 +5,16 @@ const hmIpDevice_1 = require("./hmIpDevice");
|
|
|
5
5
|
const deviceType_1 = require("../deviceType");
|
|
6
6
|
const models_1 = require("../../../models");
|
|
7
7
|
const DeviceCapability_1 = require("../DeviceCapability");
|
|
8
|
+
const services_1 = require("../../services");
|
|
8
9
|
class HmIpTherm extends hmIpDevice_1.HmIPDevice {
|
|
9
10
|
constructor(pInfo) {
|
|
10
11
|
super(pInfo, deviceType_1.DeviceType.HmIpTherm);
|
|
11
|
-
this.
|
|
12
|
+
this._battery = -99;
|
|
12
13
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.batteryDriven);
|
|
13
14
|
}
|
|
15
|
+
get battery() {
|
|
16
|
+
return this._battery;
|
|
17
|
+
}
|
|
14
18
|
update(idSplit, state, initial = false) {
|
|
15
19
|
this.log(models_1.LogLevel.DeepTrace, `Thermostat Update: ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`);
|
|
16
20
|
super.update(idSplit, state, initial, true);
|
|
@@ -18,11 +22,16 @@ class HmIpTherm extends hmIpDevice_1.HmIPDevice {
|
|
|
18
22
|
case '0':
|
|
19
23
|
switch (idSplit[4]) {
|
|
20
24
|
case 'OPERATING_VOLTAGE':
|
|
21
|
-
this.
|
|
25
|
+
this._battery = 100 * ((state.val - 1.8) / 1.2);
|
|
26
|
+
this.persistBatteryDevice();
|
|
22
27
|
break;
|
|
23
28
|
}
|
|
24
29
|
break;
|
|
25
30
|
}
|
|
26
31
|
}
|
|
32
|
+
persistBatteryDevice() {
|
|
33
|
+
var _a;
|
|
34
|
+
(_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistBatteryDevice(this);
|
|
35
|
+
}
|
|
27
36
|
}
|
|
28
37
|
exports.HmIpTherm = HmIpTherm;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference types="iobroker" />
|
|
2
2
|
import { HmIPDevice } from './hmIpDevice';
|
|
3
|
+
import { iDisposable } from '../../services';
|
|
3
4
|
import { MagnetPosition } from '../models';
|
|
4
5
|
import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
|
|
5
|
-
export declare class HmIpTuer extends HmIPDevice {
|
|
6
|
+
export declare class HmIpTuer extends HmIPDevice implements iDisposable {
|
|
6
7
|
position: MagnetPosition;
|
|
7
8
|
private _closedCallback;
|
|
8
9
|
private _openCallback;
|
|
@@ -13,4 +14,5 @@ export declare class HmIpTuer extends HmIPDevice {
|
|
|
13
14
|
addClosedCallback(pCallback: (pValue: boolean) => void): void;
|
|
14
15
|
update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
|
|
15
16
|
updatePosition(pValue: MagnetPosition): void;
|
|
17
|
+
dispose(): void;
|
|
16
18
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference types="iobroker" />
|
|
2
2
|
import { IoBrokerBaseDevice } from '../IoBrokerBaseDevice';
|
|
3
3
|
import { iEnergyManager, iExcessEnergyConsumer, PhaseState } from '../baseDeviceInterfaces';
|
|
4
|
+
import { iDisposable } from '../../services';
|
|
4
5
|
import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
|
|
5
|
-
export declare class JsObjectEnergyManager extends IoBrokerBaseDevice implements iEnergyManager {
|
|
6
|
+
export declare class JsObjectEnergyManager extends IoBrokerBaseDevice implements iEnergyManager, iDisposable {
|
|
6
7
|
private _excessEnergyConsumer;
|
|
7
8
|
private _iCalculationInterval;
|
|
8
9
|
private _iDatabaseLoggerInterval;
|
|
@@ -54,4 +55,5 @@ export declare class JsObjectEnergyManager extends IoBrokerBaseDevice implements
|
|
|
54
55
|
private persist;
|
|
55
56
|
private turnOnAdditionalConsumer;
|
|
56
57
|
private turnOffAdditionalConsumer;
|
|
58
|
+
dispose(): void;
|
|
57
59
|
}
|
|
@@ -226,5 +226,15 @@ class JsObjectEnergyManager extends IoBrokerBaseDevice_1.IoBrokerBaseDevice {
|
|
|
226
226
|
potentialDevices[0].turnOffDueToMissingEnergy();
|
|
227
227
|
this._lastDeviceChange = { newState: false, device: potentialDevices[0] };
|
|
228
228
|
}
|
|
229
|
+
dispose() {
|
|
230
|
+
if (this._iCalculationInterval) {
|
|
231
|
+
clearInterval(this._iCalculationInterval);
|
|
232
|
+
this._iCalculationInterval = null;
|
|
233
|
+
}
|
|
234
|
+
if (this._iDatabaseLoggerInterval) {
|
|
235
|
+
clearInterval(this._iDatabaseLoggerInterval);
|
|
236
|
+
this._iDatabaseLoggerInterval = null;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
229
239
|
}
|
|
230
240
|
exports.JsObjectEnergyManager = JsObjectEnergyManager;
|
|
@@ -1,12 +1,20 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
/// <reference types="iobroker" />
|
|
2
3
|
import { DeviceType } from '../../deviceType';
|
|
3
4
|
import { IoBrokerBaseDevice } from '../../IoBrokerBaseDevice';
|
|
4
5
|
import { IoBrokerDeviceInfo } from '../../IoBrokerDeviceInfo';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
import { iDisposable } from '../../../services';
|
|
7
|
+
export declare class ZigbeeDevice extends IoBrokerBaseDevice implements iDisposable {
|
|
8
|
+
protected _available: boolean;
|
|
9
|
+
get available(): boolean;
|
|
10
|
+
protected _linkQuality: number;
|
|
11
|
+
readonly persistZigbeeInterval: NodeJS.Timeout;
|
|
12
|
+
get linkQuality(): number;
|
|
13
|
+
private _lastUpdate;
|
|
14
|
+
get lastUpdate(): Date;
|
|
9
15
|
stateMap: Map<string, ioBroker.State>;
|
|
10
16
|
constructor(pInfo: IoBrokerDeviceInfo, pType: DeviceType);
|
|
11
17
|
update(idSplit: string[], state: ioBroker.State, initial?: boolean, pOverride?: boolean): void;
|
|
18
|
+
dispose(): void;
|
|
19
|
+
persistZigbeeDevice(): void;
|
|
12
20
|
}
|
|
@@ -3,35 +3,48 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ZigbeeDevice = void 0;
|
|
4
4
|
const models_1 = require("../../../../models");
|
|
5
5
|
const IoBrokerBaseDevice_1 = require("../../IoBrokerBaseDevice");
|
|
6
|
+
const services_1 = require("../../../services");
|
|
6
7
|
class ZigbeeDevice extends IoBrokerBaseDevice_1.IoBrokerBaseDevice {
|
|
7
8
|
constructor(pInfo, pType) {
|
|
8
9
|
super(pInfo, pType);
|
|
9
|
-
this.
|
|
10
|
-
this.
|
|
11
|
-
this.
|
|
10
|
+
this._available = false;
|
|
11
|
+
this._linkQuality = 0;
|
|
12
|
+
this.persistZigbeeInterval = services_1.Utils.guardedInterval(() => {
|
|
13
|
+
this.persistZigbeeDevice();
|
|
14
|
+
}, 15 * 60 * 1000, this, false);
|
|
15
|
+
this._lastUpdate = new Date(0);
|
|
12
16
|
this.stateMap = new Map();
|
|
13
17
|
}
|
|
18
|
+
get available() {
|
|
19
|
+
return this._available;
|
|
20
|
+
}
|
|
21
|
+
get linkQuality() {
|
|
22
|
+
return this._linkQuality;
|
|
23
|
+
}
|
|
24
|
+
get lastUpdate() {
|
|
25
|
+
return this._lastUpdate;
|
|
26
|
+
}
|
|
14
27
|
update(idSplit, state, initial = false, pOverride = false) {
|
|
15
28
|
this.log(models_1.LogLevel.DeepTrace, `Zigbee: ${initial ? 'Initiales ' : ''}Update: ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`);
|
|
16
29
|
if (!pOverride) {
|
|
17
30
|
this.log(models_1.LogLevel.Warn, `Keine Update Überschreibung:\n\tID: ${idSplit.join('.')}\n\tData: ${JSON.stringify(state)}`);
|
|
18
31
|
}
|
|
32
|
+
if (!initial) {
|
|
33
|
+
this._lastUpdate = new Date();
|
|
34
|
+
}
|
|
19
35
|
switch (idSplit[3]) {
|
|
20
36
|
case 'available':
|
|
21
|
-
this.
|
|
22
|
-
if (!this.
|
|
37
|
+
this._available = state.val;
|
|
38
|
+
if (!this._available) {
|
|
23
39
|
this.log(models_1.LogLevel.Debug, `Das Zigbee Gerät ist nicht erreichbar.`);
|
|
24
40
|
}
|
|
25
41
|
break;
|
|
26
42
|
case 'link_quality':
|
|
27
|
-
this.
|
|
28
|
-
if (this.
|
|
29
|
-
this.log(models_1.LogLevel.Debug, `Das Zigbee Gerät hat eine schlechte Verbindung (${this.
|
|
43
|
+
this._linkQuality = state.val;
|
|
44
|
+
if (this._linkQuality < 5) {
|
|
45
|
+
this.log(models_1.LogLevel.Debug, `Das Zigbee Gerät hat eine schlechte Verbindung (${this._linkQuality}).`);
|
|
30
46
|
}
|
|
31
47
|
break;
|
|
32
|
-
case 'voltage':
|
|
33
|
-
this.voltage = state.val.toString();
|
|
34
|
-
break;
|
|
35
48
|
}
|
|
36
49
|
this.stateMap.set(idSplit[3], state);
|
|
37
50
|
const individualCallbacks = this.individualStateCallbacks.get(idSplit[3]);
|
|
@@ -41,5 +54,12 @@ class ZigbeeDevice extends IoBrokerBaseDevice_1.IoBrokerBaseDevice {
|
|
|
41
54
|
}
|
|
42
55
|
}
|
|
43
56
|
}
|
|
57
|
+
dispose() {
|
|
58
|
+
clearInterval(this.persistZigbeeInterval);
|
|
59
|
+
}
|
|
60
|
+
persistZigbeeDevice() {
|
|
61
|
+
var _a;
|
|
62
|
+
(_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistZigbeeDevice(this);
|
|
63
|
+
}
|
|
44
64
|
}
|
|
45
65
|
exports.ZigbeeDevice = ZigbeeDevice;
|
|
@@ -7,9 +7,10 @@ import { DeviceType } from '../../deviceType';
|
|
|
7
7
|
import { IoBrokerDeviceInfo } from '../../IoBrokerDeviceInfo';
|
|
8
8
|
import { PIDController } from '../../../../liquid-pid';
|
|
9
9
|
export declare class ZigbeeHeater extends ZigbeeDevice implements iHeater, iBatteryDevice {
|
|
10
|
+
protected _battery: number;
|
|
10
11
|
readonly persistHeaterInterval: NodeJS.Timeout;
|
|
11
12
|
settings: HeaterSettings;
|
|
12
|
-
battery: number;
|
|
13
|
+
get battery(): number;
|
|
13
14
|
protected _automaticPoints: {
|
|
14
15
|
[name: string]: TemperatureSettings;
|
|
15
16
|
};
|
|
@@ -44,4 +45,6 @@ export declare class ZigbeeHeater extends ZigbeeDevice implements iHeater, iBatt
|
|
|
44
45
|
update(idSplit: string[], state: ioBroker.State, initial?: boolean, pOverride?: boolean): void;
|
|
45
46
|
protected getNextPidLevel(): number;
|
|
46
47
|
private checkSeasonTurnOff;
|
|
48
|
+
persistBatteryDevice(): void;
|
|
49
|
+
dispose(): void;
|
|
47
50
|
}
|