hoffmation-base 3.0.0-alpha.89 → 3.0.0-alpha.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/models/action/batteryLevelChangeAction.js +2 -2
- package/lib/models/iJsonOmitKeys.d.ts +9 -0
- package/lib/models/iJsonOmitKeys.js +2 -0
- package/lib/models/index.d.ts +1 -0
- package/lib/server/devices/IoBrokerBaseDevice.d.ts +4 -2
- package/lib/server/devices/IoBrokerBaseDevice.js +3 -1
- package/lib/server/devices/baseDeviceInterfaces/iBatteryDevice.d.ts +4 -13
- package/lib/server/devices/baseDeviceInterfaces/iHandleSensor.d.ts +10 -0
- package/lib/server/devices/baseDeviceInterfaces/iHumiditySensor.d.ts +3 -7
- package/lib/server/devices/baseDeviceInterfaces/iTemperatureSensor.d.ts +3 -7
- package/lib/server/devices/dachs/dachs.js +2 -5
- package/lib/server/devices/dachs/dachsTemperatureSensor.d.ts +2 -7
- package/lib/server/devices/dachs/dachsTemperatureSensor.js +9 -31
- package/lib/server/devices/deviceType.d.ts +1 -0
- package/lib/server/devices/deviceType.js +1 -0
- package/lib/server/devices/devices.js +5 -2
- package/lib/server/devices/groups/Window.d.ts +2 -3
- package/lib/server/devices/groups/Window.js +3 -3
- package/lib/server/devices/groups/windowGroup.js +2 -2
- package/lib/server/devices/hmIPDevices/hmIpGriff.d.ts +9 -35
- package/lib/server/devices/hmIPDevices/hmIpGriff.js +27 -171
- package/lib/server/devices/hmIPDevices/hmIpHeizgruppe.d.ts +5 -13
- package/lib/server/devices/hmIPDevices/hmIpHeizgruppe.js +30 -66
- package/lib/server/devices/hmIPDevices/hmIpHeizung.d.ts +4 -14
- package/lib/server/devices/hmIPDevices/hmIpHeizung.js +6 -39
- package/lib/server/devices/hmIPDevices/hmIpPraezenz.d.ts +5 -14
- package/lib/server/devices/hmIPDevices/hmIpPraezenz.js +6 -38
- package/lib/server/devices/hmIPDevices/hmIpRoll.js +2 -2
- package/lib/server/devices/hmIPDevices/hmIpTaster.d.ts +4 -14
- package/lib/server/devices/hmIPDevices/hmIpTaster.js +6 -38
- package/lib/server/devices/hmIPDevices/hmIpTherm.d.ts +4 -14
- package/lib/server/devices/hmIPDevices/hmIpTherm.js +6 -39
- package/lib/server/devices/models/WindowPosition.d.ts +3 -3
- package/lib/server/devices/models/WindowPosition.js +3 -3
- package/lib/server/devices/sharedFunctions/battery.d.ts +31 -0
- package/lib/server/devices/sharedFunctions/battery.js +65 -0
- package/lib/server/devices/sharedFunctions/handleSensor.d.ts +45 -0
- package/lib/server/devices/sharedFunctions/handleSensor.js +150 -0
- package/lib/server/devices/sharedFunctions/humiditySensor.d.ts +18 -0
- package/lib/server/devices/sharedFunctions/humiditySensor.js +46 -0
- package/lib/server/devices/sharedFunctions/index.d.ts +4 -0
- package/lib/server/devices/sharedFunctions/index.js +4 -0
- package/lib/server/devices/sharedFunctions/temperatureSensor.d.ts +31 -0
- package/lib/server/devices/sharedFunctions/temperatureSensor.js +57 -0
- package/lib/server/devices/shelly/shellyTrv.d.ts +5 -16
- package/lib/server/devices/shelly/shellyTrv.js +7 -41
- package/lib/server/devices/smartGarden/smartGardenDevice.d.ts +4 -16
- package/lib/server/devices/smartGarden/smartGardenDevice.js +7 -42
- package/lib/server/devices/smartGarden/smartGardenSensor.d.ts +3 -13
- package/lib/server/devices/smartGarden/smartGardenSensor.js +14 -57
- package/lib/server/devices/velux/veluxShutter.js +2 -2
- package/lib/server/devices/zigbee/BaseDevices/index.d.ts +1 -0
- package/lib/server/devices/zigbee/BaseDevices/index.js +3 -1
- package/lib/server/devices/zigbee/BaseDevices/zigbeeHeater.d.ts +5 -15
- package/lib/server/devices/zigbee/BaseDevices/zigbeeHeater.js +7 -40
- package/lib/server/devices/zigbee/BaseDevices/zigbeeMagnetContact.d.ts +4 -15
- package/lib/server/devices/zigbee/BaseDevices/zigbeeMagnetContact.js +7 -40
- package/lib/server/devices/zigbee/BaseDevices/zigbeeMotionSensor.d.ts +5 -16
- package/lib/server/devices/zigbee/BaseDevices/zigbeeMotionSensor.js +7 -41
- package/lib/server/devices/zigbee/BaseDevices/zigbeeShutter.js +2 -2
- package/lib/server/devices/zigbee/BaseDevices/zigbeeWindowHandle.d.ts +36 -0
- package/lib/server/devices/zigbee/BaseDevices/zigbeeWindowHandle.js +82 -0
- package/lib/server/devices/zigbee/index.d.ts +1 -0
- package/lib/server/devices/zigbee/index.js +1 -0
- package/lib/server/devices/zigbee/zigbeeAquaraVibra.d.ts +4 -16
- package/lib/server/devices/zigbee/zigbeeAquaraVibra.js +7 -41
- package/lib/server/devices/zigbee/zigbeeAquaraWater.d.ts +4 -16
- package/lib/server/devices/zigbee/zigbeeAquaraWater.js +7 -41
- package/lib/server/devices/zigbee/zigbeeHeimanSmoke.d.ts +4 -16
- package/lib/server/devices/zigbee/zigbeeHeimanSmoke.js +7 -41
- package/lib/server/devices/zigbee/zigbeeSodaHandle.d.ts +34 -0
- package/lib/server/devices/zigbee/zigbeeSodaHandle.js +96 -0
- package/lib/server/devices/zigbee/zigbeeSonoffTemp.d.ts +7 -27
- package/lib/server/devices/zigbee/zigbeeSonoffTemp.js +21 -94
- package/lib/server/services/dbo/postgreSqlPersist.js +1 -1
- package/lib/server/services/utils/utils.js +5 -1
- package/lib/server/services/victron/victron-device.d.ts +8 -15
- package/lib/server/services/victron/victron-device.js +22 -51
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HumiditySensor = void 0;
|
|
4
|
+
const services_1 = require("../../services");
|
|
5
|
+
const models_1 = require("../../../models");
|
|
6
|
+
const baseDeviceInterfaces_1 = require("../baseDeviceInterfaces");
|
|
7
|
+
class HumiditySensor {
|
|
8
|
+
constructor(_device) {
|
|
9
|
+
this._device = _device;
|
|
10
|
+
/** @inheritDoc */
|
|
11
|
+
this.jsonOmitKeys = ['_device'];
|
|
12
|
+
this._humidityCallbacks = [];
|
|
13
|
+
this._humidity = baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE;
|
|
14
|
+
this._persistHumiditySensorInterval = services_1.Utils.guardedInterval(() => {
|
|
15
|
+
this.persist();
|
|
16
|
+
}, 5 * 60 * 1000, this, false);
|
|
17
|
+
}
|
|
18
|
+
get humidity() {
|
|
19
|
+
return this._humidity;
|
|
20
|
+
}
|
|
21
|
+
set humidity(val) {
|
|
22
|
+
this._humidity = val;
|
|
23
|
+
for (const cb of this._humidityCallbacks) {
|
|
24
|
+
cb(new models_1.HumiditySensorChangeAction(this._device, val));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
dispose() {
|
|
28
|
+
if (this._persistHumiditySensorInterval) {
|
|
29
|
+
clearInterval(this._persistHumiditySensorInterval);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
persist() {
|
|
33
|
+
var _a;
|
|
34
|
+
(_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistHumiditySensor(this._device);
|
|
35
|
+
}
|
|
36
|
+
addHumidityCallback(pCallback) {
|
|
37
|
+
this._humidityCallbacks.push(pCallback);
|
|
38
|
+
if (this._humidity > 0) {
|
|
39
|
+
pCallback(new models_1.HumiditySensorChangeAction(this._device, this._humidity));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
toJSON() {
|
|
43
|
+
return services_1.Utils.jsonFilter(this, this.jsonOmitKeys);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.HumiditySensor = HumiditySensor;
|
|
@@ -14,4 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./battery"), exports);
|
|
18
|
+
__exportStar(require("./handleSensor"), exports);
|
|
19
|
+
__exportStar(require("./humiditySensor"), exports);
|
|
17
20
|
__exportStar(require("./lampUtils"), exports);
|
|
21
|
+
__exportStar(require("./temperatureSensor"), exports);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { TemperatureSensorChangeAction } from '../../../models';
|
|
2
|
+
import { iTemperatureSensor } from '../baseDeviceInterfaces';
|
|
3
|
+
import { iJsonOmitKeys } from '../../../models/iJsonOmitKeys';
|
|
4
|
+
export declare class TemperatureSensor implements iJsonOmitKeys {
|
|
5
|
+
private readonly _device;
|
|
6
|
+
/** @inheritDoc */
|
|
7
|
+
readonly jsonOmitKeys: string[];
|
|
8
|
+
/**
|
|
9
|
+
* The current room temperature as a number in Celsius
|
|
10
|
+
*/
|
|
11
|
+
roomTemperature: number;
|
|
12
|
+
/**
|
|
13
|
+
* The interval to persist the temperature sensor information
|
|
14
|
+
*/
|
|
15
|
+
private readonly _persistTemperatureSensorInterval;
|
|
16
|
+
private _temperature;
|
|
17
|
+
private _temperaturCallbacks;
|
|
18
|
+
constructor(_device: iTemperatureSensor);
|
|
19
|
+
set temperature(val: number);
|
|
20
|
+
/**
|
|
21
|
+
* Persists the current temperature sensor information to the database
|
|
22
|
+
*/
|
|
23
|
+
persist(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Adds a callback to be called when the temperature changes
|
|
26
|
+
* @param pCallback - The callback to be called
|
|
27
|
+
*/
|
|
28
|
+
addTempChangeCallback(pCallback: (action: TemperatureSensorChangeAction) => void): void;
|
|
29
|
+
dispose(): void;
|
|
30
|
+
toJSON(): Partial<TemperatureSensor>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TemperatureSensor = void 0;
|
|
4
|
+
const services_1 = require("../../services");
|
|
5
|
+
const models_1 = require("../../../models");
|
|
6
|
+
const baseDeviceInterfaces_1 = require("../baseDeviceInterfaces");
|
|
7
|
+
class TemperatureSensor {
|
|
8
|
+
constructor(_device) {
|
|
9
|
+
this._device = _device;
|
|
10
|
+
/** @inheritDoc */
|
|
11
|
+
this.jsonOmitKeys = ['_device'];
|
|
12
|
+
/**
|
|
13
|
+
* The current room temperature as a number in Celsius
|
|
14
|
+
*/
|
|
15
|
+
this.roomTemperature = baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE;
|
|
16
|
+
/**
|
|
17
|
+
* The interval to persist the temperature sensor information
|
|
18
|
+
*/
|
|
19
|
+
this._persistTemperatureSensorInterval = services_1.Utils.guardedInterval(() => {
|
|
20
|
+
this.persist();
|
|
21
|
+
}, 5 * 60 * 1000, this, false);
|
|
22
|
+
this._temperature = baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE;
|
|
23
|
+
this._temperaturCallbacks = [];
|
|
24
|
+
}
|
|
25
|
+
set temperature(val) {
|
|
26
|
+
this._temperature = val;
|
|
27
|
+
for (const cb of this._temperaturCallbacks) {
|
|
28
|
+
cb(new models_1.TemperatureSensorChangeAction(this._device, val));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Persists the current temperature sensor information to the database
|
|
33
|
+
*/
|
|
34
|
+
persist() {
|
|
35
|
+
var _a;
|
|
36
|
+
(_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistTemperatureSensor(this._device);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Adds a callback to be called when the temperature changes
|
|
40
|
+
* @param pCallback - The callback to be called
|
|
41
|
+
*/
|
|
42
|
+
addTempChangeCallback(pCallback) {
|
|
43
|
+
this._temperaturCallbacks.push(pCallback);
|
|
44
|
+
if (this._temperature > baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE) {
|
|
45
|
+
pCallback(new models_1.TemperatureSensorChangeAction(this._device, this._temperature));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
dispose() {
|
|
49
|
+
if (this._persistTemperatureSensorInterval) {
|
|
50
|
+
clearInterval(this._persistTemperatureSensorInterval);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
toJSON() {
|
|
54
|
+
return services_1.Utils.jsonFilter(this, this.jsonOmitKeys);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.TemperatureSensor = TemperatureSensor;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { ShellyDevice } from './shellyDevice';
|
|
2
2
|
import { iBatteryDevice, iHeater } from '../baseDeviceInterfaces';
|
|
3
|
-
import {
|
|
3
|
+
import { HeaterSettings } from '../../../models';
|
|
4
4
|
import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
|
|
5
|
+
import { Battery } from '../sharedFunctions';
|
|
5
6
|
export declare class ShellyTrv extends ShellyDevice implements iHeater, iBatteryDevice {
|
|
7
|
+
/** @inheritDoc */
|
|
8
|
+
readonly battery: Battery;
|
|
6
9
|
/** @inheritDoc */
|
|
7
10
|
settings: HeaterSettings;
|
|
8
11
|
/** @inheritDoc */
|
|
@@ -10,7 +13,6 @@ export declare class ShellyTrv extends ShellyDevice implements iHeater, iBattery
|
|
|
10
13
|
protected _seasonTurnOff: boolean;
|
|
11
14
|
protected _roomTemperature: number;
|
|
12
15
|
private _automaticMode;
|
|
13
|
-
private _battery;
|
|
14
16
|
private _iAutomaticInterval;
|
|
15
17
|
private _initialSeasonCheckDone;
|
|
16
18
|
private _lastRecalc;
|
|
@@ -22,20 +24,15 @@ export declare class ShellyTrv extends ShellyDevice implements iHeater, iBattery
|
|
|
22
24
|
private _desiredTemperatur;
|
|
23
25
|
private _useExternalTemperatureEnabled;
|
|
24
26
|
private _pidController;
|
|
25
|
-
private _lastBatteryPersist;
|
|
26
27
|
private readonly _minumumLevelId;
|
|
27
28
|
private readonly _setAutomaticModeId;
|
|
28
29
|
private readonly _setExternalTempId;
|
|
29
30
|
private readonly _setEnableExternalTempId;
|
|
30
31
|
private readonly _setPointTemperaturID;
|
|
31
32
|
private readonly _valvePosId;
|
|
32
|
-
private _lastBatteryLevel;
|
|
33
|
-
private _batteryLevelCallbacks;
|
|
34
33
|
constructor(pInfo: IoBrokerDeviceInfo);
|
|
35
34
|
/** @inheritDoc */
|
|
36
|
-
get
|
|
37
|
-
/** @inheritDoc */
|
|
38
|
-
get battery(): number;
|
|
35
|
+
get batteryLevel(): number;
|
|
39
36
|
get minimumLevel(): number;
|
|
40
37
|
/** @inheritDoc */
|
|
41
38
|
get seasonTurnOff(): boolean;
|
|
@@ -53,8 +50,6 @@ export declare class ShellyTrv extends ShellyDevice implements iHeater, iBattery
|
|
|
53
50
|
get roomTemperature(): number;
|
|
54
51
|
private set roomTemperatur(value);
|
|
55
52
|
/** @inheritDoc */
|
|
56
|
-
addBatteryLevelCallback(pCallback: (action: BatteryLevelChangeAction) => void): void;
|
|
57
|
-
/** @inheritDoc */
|
|
58
53
|
checkAutomaticChange(): void;
|
|
59
54
|
/** @inheritDoc */
|
|
60
55
|
onTemperaturChange(newTemperatur: number): void;
|
|
@@ -63,8 +58,6 @@ export declare class ShellyTrv extends ShellyDevice implements iHeater, iBattery
|
|
|
63
58
|
/** @inheritDoc */
|
|
64
59
|
update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
|
|
65
60
|
/** @inheritDoc */
|
|
66
|
-
persistBatteryDevice(): void;
|
|
67
|
-
/** @inheritDoc */
|
|
68
61
|
dispose(): void;
|
|
69
62
|
protected getNextPidLevel(): number;
|
|
70
63
|
private checkSeasonTurnOff;
|
|
@@ -74,8 +67,4 @@ export declare class ShellyTrv extends ShellyDevice implements iHeater, iBattery
|
|
|
74
67
|
private setExternalTemperatureEnabled;
|
|
75
68
|
private setValve;
|
|
76
69
|
private setMinimumLevel;
|
|
77
|
-
/**
|
|
78
|
-
* Checks whether the battery level did change and if so fires the callbacks
|
|
79
|
-
*/
|
|
80
|
-
private checkForBatteryChange;
|
|
81
70
|
}
|
|
@@ -8,10 +8,13 @@ const models_1 = require("../../../models");
|
|
|
8
8
|
const liquid_pid_1 = require("../../../liquid-pid");
|
|
9
9
|
const deviceType_1 = require("../deviceType");
|
|
10
10
|
const DeviceCapability_1 = require("../DeviceCapability");
|
|
11
|
+
const sharedFunctions_1 = require("../sharedFunctions");
|
|
11
12
|
class ShellyTrv extends shellyDevice_1.ShellyDevice {
|
|
12
13
|
constructor(pInfo) {
|
|
13
14
|
super(pInfo, deviceType_1.DeviceType.ShellyTrv);
|
|
14
15
|
/** @inheritDoc */
|
|
16
|
+
this.battery = new sharedFunctions_1.Battery(this);
|
|
17
|
+
/** @inheritDoc */
|
|
15
18
|
this.settings = new models_1.HeaterSettings();
|
|
16
19
|
/** @inheritDoc */
|
|
17
20
|
this.persistHeaterInterval = services_1.Utils.guardedInterval(() => {
|
|
@@ -20,7 +23,6 @@ class ShellyTrv extends shellyDevice_1.ShellyDevice {
|
|
|
20
23
|
this._seasonTurnOff = false;
|
|
21
24
|
this._roomTemperature = baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE;
|
|
22
25
|
this._automaticMode = false;
|
|
23
|
-
this._battery = -99;
|
|
24
26
|
this._initialSeasonCheckDone = false;
|
|
25
27
|
this._lastRecalc = 0;
|
|
26
28
|
this._level = 0;
|
|
@@ -40,9 +42,6 @@ class ShellyTrv extends shellyDevice_1.ShellyDevice {
|
|
|
40
42
|
Ki: 1000, // PID: Ki in 1/1000
|
|
41
43
|
Kd: 9, // PID: Kd in 1/1000
|
|
42
44
|
});
|
|
43
|
-
this._lastBatteryPersist = 0;
|
|
44
|
-
this._lastBatteryLevel = -1;
|
|
45
|
-
this._batteryLevelCallbacks = [];
|
|
46
45
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.heater);
|
|
47
46
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.batteryDriven);
|
|
48
47
|
this._setAutomaticModeId = `${this.info.fullID}.tmp.automaticTemperatureControl`;
|
|
@@ -57,12 +56,8 @@ class ShellyTrv extends shellyDevice_1.ShellyDevice {
|
|
|
57
56
|
}, 0, 2, 0));
|
|
58
57
|
}
|
|
59
58
|
/** @inheritDoc */
|
|
60
|
-
get
|
|
61
|
-
return this.
|
|
62
|
-
}
|
|
63
|
-
/** @inheritDoc */
|
|
64
|
-
get battery() {
|
|
65
|
-
return this._battery;
|
|
59
|
+
get batteryLevel() {
|
|
60
|
+
return this.battery.level;
|
|
66
61
|
}
|
|
67
62
|
get minimumLevel() {
|
|
68
63
|
return this._minimumValveLevel;
|
|
@@ -125,10 +120,6 @@ class ShellyTrv extends shellyDevice_1.ShellyDevice {
|
|
|
125
120
|
}
|
|
126
121
|
}
|
|
127
122
|
/** @inheritDoc */
|
|
128
|
-
addBatteryLevelCallback(pCallback) {
|
|
129
|
-
this._batteryLevelCallbacks.push(pCallback);
|
|
130
|
-
}
|
|
131
|
-
/** @inheritDoc */
|
|
132
123
|
checkAutomaticChange() {
|
|
133
124
|
var _a;
|
|
134
125
|
if (!this._initialSeasonCheckDone) {
|
|
@@ -199,26 +190,14 @@ class ShellyTrv extends shellyDevice_1.ShellyDevice {
|
|
|
199
190
|
this._targetTempVal = state.val;
|
|
200
191
|
}
|
|
201
192
|
else if (idSplit[3] === 'bat' && idSplit[4] === 'value') {
|
|
202
|
-
this.
|
|
203
|
-
this.
|
|
204
|
-
this.persistBatteryDevice();
|
|
205
|
-
if (this._battery < 20) {
|
|
193
|
+
this.battery.level = state.val;
|
|
194
|
+
if (this.batteryLevel < 20) {
|
|
206
195
|
this.log(models_1.LogLevel.Warn, 'Das Shelly Gerät hat unter 20% Batterie.');
|
|
207
196
|
}
|
|
208
197
|
}
|
|
209
198
|
super.update(idSplit, state, initial, true);
|
|
210
199
|
}
|
|
211
200
|
/** @inheritDoc */
|
|
212
|
-
persistBatteryDevice() {
|
|
213
|
-
var _a;
|
|
214
|
-
const now = services_1.Utils.nowMS();
|
|
215
|
-
if (this._lastBatteryPersist + 60000 > now) {
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
(_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistBatteryDevice(this);
|
|
219
|
-
this._lastBatteryPersist = now;
|
|
220
|
-
}
|
|
221
|
-
/** @inheritDoc */
|
|
222
201
|
dispose() {
|
|
223
202
|
if (this.persistHeaterInterval) {
|
|
224
203
|
clearInterval(this.persistHeaterInterval);
|
|
@@ -282,18 +261,5 @@ class ShellyTrv extends shellyDevice_1.ShellyDevice {
|
|
|
282
261
|
setMinimumLevel(pidForcedMinimum) {
|
|
283
262
|
this.setState(this._minumumLevelId, pidForcedMinimum);
|
|
284
263
|
}
|
|
285
|
-
/**
|
|
286
|
-
* Checks whether the battery level did change and if so fires the callbacks
|
|
287
|
-
*/
|
|
288
|
-
checkForBatteryChange() {
|
|
289
|
-
const newLevel = this.battery;
|
|
290
|
-
if (newLevel == -1 || newLevel == this._lastBatteryLevel) {
|
|
291
|
-
return;
|
|
292
|
-
}
|
|
293
|
-
for (const cb of this._batteryLevelCallbacks) {
|
|
294
|
-
cb(new models_1.BatteryLevelChangeAction(this));
|
|
295
|
-
}
|
|
296
|
-
this._lastBatteryLevel = newLevel;
|
|
297
|
-
}
|
|
298
264
|
}
|
|
299
265
|
exports.ShellyTrv = ShellyTrv;
|
|
@@ -2,32 +2,20 @@ import { IoBrokerBaseDevice } from '../IoBrokerBaseDevice';
|
|
|
2
2
|
import { iDisposable } from '../../services';
|
|
3
3
|
import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
|
|
4
4
|
import { DeviceType } from '../deviceType';
|
|
5
|
-
import { BatteryLevelChangeAction } from '../../../models';
|
|
6
5
|
import { iBatteryDevice } from '../baseDeviceInterfaces';
|
|
6
|
+
import { Battery } from '../sharedFunctions';
|
|
7
7
|
export declare class SmartGardenDevice extends IoBrokerBaseDevice implements iDisposable, iBatteryDevice {
|
|
8
|
+
/** @inheritDoc */
|
|
9
|
+
readonly battery: Battery;
|
|
8
10
|
protected _criticalBatteryLevel: number;
|
|
9
11
|
protected readonly _deviceSerial: string;
|
|
10
12
|
private _lastUpdate;
|
|
11
|
-
private _lastBatteryLevel;
|
|
12
|
-
private _batteryLevelCallbacks;
|
|
13
|
-
private _lastBatteryPersist;
|
|
14
|
-
private _battery;
|
|
15
13
|
constructor(pInfo: IoBrokerDeviceInfo, pType: DeviceType);
|
|
16
14
|
/** @inheritDoc */
|
|
17
|
-
get
|
|
18
|
-
/** @inheritDoc */
|
|
19
|
-
get battery(): number;
|
|
15
|
+
get batteryLevel(): number;
|
|
20
16
|
get lastUpdate(): Date;
|
|
21
17
|
/** @inheritDoc */
|
|
22
|
-
addBatteryLevelCallback(pCallback: (action: BatteryLevelChangeAction) => void): void;
|
|
23
|
-
/** @inheritDoc */
|
|
24
18
|
update(idSplit: string[], state: ioBroker.State, initial?: boolean, pOverride?: boolean): void;
|
|
25
19
|
/** @inheritDoc */
|
|
26
|
-
persistBatteryDevice(): void;
|
|
27
|
-
/** @inheritDoc */
|
|
28
20
|
dispose(): void;
|
|
29
|
-
/**
|
|
30
|
-
* Checks whether the battery level did change and if so fires the callbacks
|
|
31
|
-
*/
|
|
32
|
-
private checkForBatteryChange;
|
|
33
21
|
}
|
|
@@ -2,37 +2,27 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SmartGardenDevice = void 0;
|
|
4
4
|
const IoBrokerBaseDevice_1 = require("../IoBrokerBaseDevice");
|
|
5
|
-
const services_1 = require("../../services");
|
|
6
5
|
const models_1 = require("../../../models");
|
|
7
6
|
const DeviceCapability_1 = require("../DeviceCapability");
|
|
7
|
+
const sharedFunctions_1 = require("../sharedFunctions");
|
|
8
8
|
class SmartGardenDevice extends IoBrokerBaseDevice_1.IoBrokerBaseDevice {
|
|
9
9
|
constructor(pInfo, pType) {
|
|
10
10
|
super(pInfo, pType);
|
|
11
|
+
/** @inheritDoc */
|
|
12
|
+
this.battery = new sharedFunctions_1.Battery(this);
|
|
11
13
|
this._criticalBatteryLevel = 20;
|
|
12
14
|
this._lastUpdate = new Date(0);
|
|
13
|
-
this._lastBatteryLevel = -1;
|
|
14
|
-
this._batteryLevelCallbacks = [];
|
|
15
|
-
this._lastBatteryPersist = 0;
|
|
16
|
-
this._battery = -99;
|
|
17
15
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.batteryDriven);
|
|
18
16
|
this._deviceSerial = pInfo.devID.replace('DEVICE_', '');
|
|
19
17
|
}
|
|
20
18
|
/** @inheritDoc */
|
|
21
|
-
get
|
|
22
|
-
return this.
|
|
23
|
-
}
|
|
24
|
-
/** @inheritDoc */
|
|
25
|
-
get battery() {
|
|
26
|
-
return this._battery;
|
|
19
|
+
get batteryLevel() {
|
|
20
|
+
return this.battery.level;
|
|
27
21
|
}
|
|
28
22
|
get lastUpdate() {
|
|
29
23
|
return this._lastUpdate;
|
|
30
24
|
}
|
|
31
25
|
/** @inheritDoc */
|
|
32
|
-
addBatteryLevelCallback(pCallback) {
|
|
33
|
-
this._batteryLevelCallbacks.push(pCallback);
|
|
34
|
-
}
|
|
35
|
-
/** @inheritDoc */
|
|
36
26
|
update(idSplit, state, initial = false, pOverride = false) {
|
|
37
27
|
this.log(models_1.LogLevel.DeepTrace, `Smartgarden: ${initial ? 'Initiales ' : ''}Update: ID: ${idSplit.join('.')} JSON: ${JSON.stringify(state)}`);
|
|
38
28
|
if (!pOverride) {
|
|
@@ -50,10 +40,8 @@ class SmartGardenDevice extends IoBrokerBaseDevice_1.IoBrokerBaseDevice {
|
|
|
50
40
|
if (folder.indexOf('SERVICE_COMMON') === 0) {
|
|
51
41
|
switch (stateName) {
|
|
52
42
|
case 'batteryLevel_value':
|
|
53
|
-
this.
|
|
54
|
-
this.
|
|
55
|
-
this.persistBatteryDevice();
|
|
56
|
-
if (this._battery < this._criticalBatteryLevel) {
|
|
43
|
+
this.battery.level = state.val;
|
|
44
|
+
if (this.batteryLevel < this._criticalBatteryLevel) {
|
|
57
45
|
this.log(models_1.LogLevel.Warn, 'This SmartGarden device reached critical battery level.');
|
|
58
46
|
}
|
|
59
47
|
break;
|
|
@@ -68,31 +56,8 @@ class SmartGardenDevice extends IoBrokerBaseDevice_1.IoBrokerBaseDevice {
|
|
|
68
56
|
}
|
|
69
57
|
}
|
|
70
58
|
/** @inheritDoc */
|
|
71
|
-
persistBatteryDevice() {
|
|
72
|
-
var _a;
|
|
73
|
-
const now = services_1.Utils.nowMS();
|
|
74
|
-
if (this._lastBatteryPersist + 60000 > now) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
(_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistBatteryDevice(this);
|
|
78
|
-
this._lastBatteryPersist = now;
|
|
79
|
-
}
|
|
80
|
-
/** @inheritDoc */
|
|
81
59
|
dispose() {
|
|
82
60
|
// Nothing yet
|
|
83
61
|
}
|
|
84
|
-
/**
|
|
85
|
-
* Checks whether the battery level did change and if so fires the callbacks
|
|
86
|
-
*/
|
|
87
|
-
checkForBatteryChange() {
|
|
88
|
-
const newLevel = this.battery;
|
|
89
|
-
if (newLevel == -1 || newLevel == this._lastBatteryLevel) {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
for (const cb of this._batteryLevelCallbacks) {
|
|
93
|
-
cb(new models_1.BatteryLevelChangeAction(this));
|
|
94
|
-
}
|
|
95
|
-
this._lastBatteryLevel = newLevel;
|
|
96
|
-
}
|
|
97
62
|
}
|
|
98
63
|
exports.SmartGardenDevice = SmartGardenDevice;
|
|
@@ -2,16 +2,12 @@ import { iHumiditySensor, iTemperatureSensor } from '../baseDeviceInterfaces';
|
|
|
2
2
|
import { SmartGardenDevice } from './smartGardenDevice';
|
|
3
3
|
import { HumiditySensorChangeAction, TemperatureSensorChangeAction } from '../../../models';
|
|
4
4
|
import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
|
|
5
|
+
import { HumiditySensor, TemperatureSensor } from '../sharedFunctions';
|
|
5
6
|
export declare class SmartGardenSensor extends SmartGardenDevice implements iHumiditySensor, iTemperatureSensor {
|
|
6
7
|
/** @inheritDoc */
|
|
7
|
-
|
|
8
|
+
temperatureSensor: TemperatureSensor;
|
|
8
9
|
/** @inheritDoc */
|
|
9
|
-
|
|
10
|
-
private _humidityCallbacks;
|
|
11
|
-
private _humidity;
|
|
12
|
-
private _roomTemperature;
|
|
13
|
-
private _temperature;
|
|
14
|
-
private _temperaturCallbacks;
|
|
10
|
+
humiditySensor: HumiditySensor;
|
|
15
11
|
constructor(pInfo: IoBrokerDeviceInfo);
|
|
16
12
|
/** @inheritDoc */
|
|
17
13
|
get roomTemperature(): number;
|
|
@@ -19,12 +15,10 @@ export declare class SmartGardenSensor extends SmartGardenDevice implements iHum
|
|
|
19
15
|
set roomTemperature(value: number);
|
|
20
16
|
/** @inheritDoc */
|
|
21
17
|
get humidity(): number;
|
|
22
|
-
private set humidity(value);
|
|
23
18
|
/** @inheritDoc */
|
|
24
19
|
get iTemperature(): number;
|
|
25
20
|
/** @inheritDoc */
|
|
26
21
|
get sTemperature(): string;
|
|
27
|
-
private set temperature(value);
|
|
28
22
|
/** @inheritDoc */
|
|
29
23
|
addHumidityCallback(pCallback: (action: HumiditySensorChangeAction) => void): void;
|
|
30
24
|
/** @inheritDoc */
|
|
@@ -32,10 +26,6 @@ export declare class SmartGardenSensor extends SmartGardenDevice implements iHum
|
|
|
32
26
|
/** @inheritDoc */
|
|
33
27
|
onTemperaturChange(newTemperatur: number): void;
|
|
34
28
|
/** @inheritDoc */
|
|
35
|
-
persistHumiditySensor(): void;
|
|
36
|
-
/** @inheritDoc */
|
|
37
|
-
persistTemperaturSensor(): void;
|
|
38
|
-
/** @inheritDoc */
|
|
39
29
|
update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
|
|
40
30
|
/** @inheritDoc */
|
|
41
31
|
dispose(): void;
|
|
@@ -1,92 +1,53 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SmartGardenSensor = void 0;
|
|
4
|
-
const baseDeviceInterfaces_1 = require("../baseDeviceInterfaces");
|
|
5
4
|
const smartGardenDevice_1 = require("./smartGardenDevice");
|
|
6
|
-
const models_1 = require("../../../models");
|
|
7
5
|
const deviceType_1 = require("../deviceType");
|
|
8
6
|
const DeviceCapability_1 = require("../DeviceCapability");
|
|
9
|
-
const
|
|
7
|
+
const sharedFunctions_1 = require("../sharedFunctions");
|
|
10
8
|
class SmartGardenSensor extends smartGardenDevice_1.SmartGardenDevice {
|
|
11
9
|
constructor(pInfo) {
|
|
12
10
|
super(pInfo, deviceType_1.DeviceType.SmartGardenSensor);
|
|
13
11
|
/** @inheritDoc */
|
|
14
|
-
this.
|
|
15
|
-
this.persistHumiditySensor();
|
|
16
|
-
}, 5 * 60 * 1000, this, false);
|
|
12
|
+
this.temperatureSensor = new sharedFunctions_1.TemperatureSensor(this);
|
|
17
13
|
/** @inheritDoc */
|
|
18
|
-
this.
|
|
19
|
-
this.persistTemperaturSensor();
|
|
20
|
-
}, 5 * 60 * 1000, this, false);
|
|
21
|
-
this._humidityCallbacks = [];
|
|
22
|
-
this._humidity = baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE;
|
|
23
|
-
this._roomTemperature = baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE;
|
|
24
|
-
this._temperature = baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE;
|
|
25
|
-
this._temperaturCallbacks = [];
|
|
14
|
+
this.humiditySensor = new sharedFunctions_1.HumiditySensor(this);
|
|
26
15
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.humiditySensor);
|
|
27
16
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.temperatureSensor);
|
|
28
17
|
}
|
|
29
18
|
/** @inheritDoc */
|
|
30
19
|
get roomTemperature() {
|
|
31
|
-
return this.
|
|
20
|
+
return this.temperatureSensor.roomTemperature;
|
|
32
21
|
}
|
|
33
22
|
/** @inheritDoc */
|
|
34
23
|
set roomTemperature(value) {
|
|
35
|
-
this.
|
|
24
|
+
this.temperatureSensor.roomTemperature = value;
|
|
36
25
|
}
|
|
37
26
|
/** @inheritDoc */
|
|
38
27
|
get humidity() {
|
|
39
|
-
return this.
|
|
40
|
-
}
|
|
41
|
-
set humidity(val) {
|
|
42
|
-
this._humidity = val;
|
|
43
|
-
for (const cb of this._humidityCallbacks) {
|
|
44
|
-
cb(new models_1.HumiditySensorChangeAction(this, val));
|
|
45
|
-
}
|
|
28
|
+
return this.humiditySensor.humidity;
|
|
46
29
|
}
|
|
47
30
|
/** @inheritDoc */
|
|
48
31
|
get iTemperature() {
|
|
49
|
-
return this.
|
|
32
|
+
return this.temperatureSensor.temperature;
|
|
50
33
|
}
|
|
51
34
|
/** @inheritDoc */
|
|
52
35
|
get sTemperature() {
|
|
53
|
-
return `${this.
|
|
54
|
-
}
|
|
55
|
-
set temperature(val) {
|
|
56
|
-
this._temperature = val;
|
|
57
|
-
for (const cb of this._temperaturCallbacks) {
|
|
58
|
-
cb(new models_1.TemperatureSensorChangeAction(this, val));
|
|
59
|
-
}
|
|
36
|
+
return `${this.temperatureSensor.temperature}°C`;
|
|
60
37
|
}
|
|
61
38
|
/** @inheritDoc */
|
|
62
39
|
addHumidityCallback(pCallback) {
|
|
63
|
-
this.
|
|
64
|
-
if (this._humidity > 0) {
|
|
65
|
-
pCallback(new models_1.HumiditySensorChangeAction(this, this._humidity));
|
|
66
|
-
}
|
|
40
|
+
this.humiditySensor.addHumidityCallback(pCallback);
|
|
67
41
|
}
|
|
68
42
|
/** @inheritDoc */
|
|
69
43
|
addTempChangeCallback(pCallback) {
|
|
70
|
-
this.
|
|
71
|
-
if (this._temperature > baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE) {
|
|
72
|
-
pCallback(new models_1.TemperatureSensorChangeAction(this, this._temperature));
|
|
73
|
-
}
|
|
44
|
+
this.temperatureSensor.addTempChangeCallback(pCallback);
|
|
74
45
|
}
|
|
75
46
|
/** @inheritDoc */
|
|
76
47
|
onTemperaturChange(newTemperatur) {
|
|
77
48
|
this.roomTemperature = newTemperatur;
|
|
78
49
|
}
|
|
79
50
|
/** @inheritDoc */
|
|
80
|
-
persistHumiditySensor() {
|
|
81
|
-
var _a;
|
|
82
|
-
(_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistHumiditySensor(this);
|
|
83
|
-
}
|
|
84
|
-
/** @inheritDoc */
|
|
85
|
-
persistTemperaturSensor() {
|
|
86
|
-
var _a;
|
|
87
|
-
(_a = services_1.Utils.dbo) === null || _a === void 0 ? void 0 : _a.persistTemperatureSensor(this);
|
|
88
|
-
}
|
|
89
|
-
/** @inheritDoc */
|
|
90
51
|
update(idSplit, state, initial = false) {
|
|
91
52
|
super.update(idSplit, state, initial, true);
|
|
92
53
|
if (idSplit.length < 6) {
|
|
@@ -97,22 +58,18 @@ class SmartGardenSensor extends smartGardenDevice_1.SmartGardenDevice {
|
|
|
97
58
|
if (folder.indexOf('SERVICE_SENSOR') === 0) {
|
|
98
59
|
switch (stateName) {
|
|
99
60
|
case 'soilHumidity_value':
|
|
100
|
-
this.humidity = state.val;
|
|
61
|
+
this.humiditySensor.humidity = state.val;
|
|
101
62
|
break;
|
|
102
63
|
case 'soilTemperature_value':
|
|
103
|
-
this.temperature = state.val;
|
|
64
|
+
this.temperatureSensor.temperature = state.val;
|
|
104
65
|
break;
|
|
105
66
|
}
|
|
106
67
|
}
|
|
107
68
|
}
|
|
108
69
|
/** @inheritDoc */
|
|
109
70
|
dispose() {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
if (this.persistHumiditySensorInterval) {
|
|
114
|
-
clearInterval(this.persistHumiditySensorInterval);
|
|
115
|
-
}
|
|
71
|
+
this.temperatureSensor.dispose();
|
|
72
|
+
this.humiditySensor.dispose();
|
|
116
73
|
super.dispose();
|
|
117
74
|
}
|
|
118
75
|
}
|
|
@@ -85,13 +85,13 @@ class VeluxShutter extends veluxDevice_1.VeluxDevice {
|
|
|
85
85
|
}
|
|
86
86
|
this.log(models_2.LogLevel.Debug, command.logMessage);
|
|
87
87
|
if (this._window !== undefined) {
|
|
88
|
-
if (this._window.griffeInPosition(models_1.WindowPosition.
|
|
88
|
+
if (this._window.griffeInPosition(models_1.WindowPosition.open) > 0 && command.level < 100) {
|
|
89
89
|
if (!command.skipOpenWarning) {
|
|
90
90
|
this.log(models_2.LogLevel.Alert, 'Not closing the shutter, as the window is open!');
|
|
91
91
|
}
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
|
-
if (this._window.griffeInPosition(models_1.WindowPosition.
|
|
94
|
+
if (this._window.griffeInPosition(models_1.WindowPosition.tilted) > 0 && targetLevel < 50) {
|
|
95
95
|
targetLevel = 50;
|
|
96
96
|
if (!command.skipOpenWarning) {
|
|
97
97
|
this.log(models_2.LogLevel.Alert, 'Not closing the shutter, as the window is half open!');
|
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.ZigbeeLamp = void 0;
|
|
17
|
+
exports.ZigbeeWindowHandle = exports.ZigbeeLamp = void 0;
|
|
18
18
|
__exportStar(require("./ZigbeeActuator"), exports);
|
|
19
19
|
__exportStar(require("./zigbeeDevice"), exports);
|
|
20
20
|
__exportStar(require("./zigbeeDimmer"), exports);
|
|
@@ -26,3 +26,5 @@ __exportStar(require("./zigbeeShutter"), exports);
|
|
|
26
26
|
__exportStar(require("./zigbeeSwitch"), exports);
|
|
27
27
|
var zigbeeLamp_1 = require("./zigbeeLamp");
|
|
28
28
|
Object.defineProperty(exports, "ZigbeeLamp", { enumerable: true, get: function () { return zigbeeLamp_1.ZigbeeLamp; } });
|
|
29
|
+
var zigbeeWindowHandle_1 = require("./zigbeeWindowHandle");
|
|
30
|
+
Object.defineProperty(exports, "ZigbeeWindowHandle", { enumerable: true, get: function () { return zigbeeWindowHandle_1.ZigbeeWindowHandle; } });
|