hoffmation-base 4.0.0 → 4.1.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/action/index.d.ts +1 -0
- package/lib/action/index.js +3 -1
- package/lib/action/soilSensorChangeAction.d.ts +16 -0
- package/lib/action/soilSensorChangeAction.js +15 -0
- package/lib/devices/device-cluster.js +7 -0
- package/lib/devices/devices.js +3 -0
- package/lib/devices/sharedFunctions/index.d.ts +1 -0
- package/lib/devices/sharedFunctions/index.js +1 -0
- package/lib/devices/sharedFunctions/soilSensor.d.ts +23 -0
- package/lib/devices/sharedFunctions/soilSensor.js +58 -0
- package/lib/devices/zigbee/BaseDevices/index.d.ts +1 -0
- package/lib/devices/zigbee/BaseDevices/index.js +1 -0
- package/lib/devices/zigbee/BaseDevices/zigbeeSoilSensor.d.ts +33 -0
- package/lib/devices/zigbee/BaseDevices/zigbeeSoilSensor.js +62 -0
- package/lib/devices/zigbee/index.d.ts +1 -0
- package/lib/devices/zigbee/index.js +1 -0
- package/lib/devices/zigbee/zigbeeCooloSoilSensor.d.ts +44 -0
- package/lib/devices/zigbee/zigbeeCooloSoilSensor.js +81 -0
- package/lib/enums/DeviceCapability.d.ts +1 -0
- package/lib/enums/DeviceCapability.js +1 -0
- package/lib/enums/commandType.d.ts +1 -0
- package/lib/enums/commandType.js +1 -0
- package/lib/enums/device-cluster-type.d.ts +2 -1
- package/lib/enums/device-cluster-type.js +1 -0
- package/lib/enums/deviceType.d.ts +1 -0
- package/lib/enums/deviceType.js +1 -0
- package/lib/interfaces/baseDevices/iSoilCollector.d.ts +23 -0
- package/lib/interfaces/baseDevices/iSoilCollector.js +2 -0
- package/lib/interfaces/baseDevices/iSoilSensor.d.ts +32 -0
- package/lib/interfaces/baseDevices/iSoilSensor.js +2 -0
- package/lib/interfaces/baseDevices/index.d.ts +3 -0
- package/lib/interfaces/baseDevices/index.js +3 -0
- package/lib/interfaces/baseDevices/undefinedSoilMoistureValue.d.ts +6 -0
- package/lib/interfaces/baseDevices/undefinedSoilMoistureValue.js +9 -0
- package/lib/interfaces/iPersist.d.ts +18 -1
- package/lib/interfaces/iSoilMoistureSample.d.ts +13 -0
- package/lib/interfaces/iSoilMoistureSample.js +2 -0
- package/lib/interfaces/iWeatherDaySummary.d.ts +12 -0
- package/lib/interfaces/index.d.ts +1 -0
- package/lib/interfaces/index.js +1 -0
- package/lib/services/dbo/postgreSqlPersist.d.ts +5 -1
- package/lib/services/dbo/postgreSqlPersist.js +102 -7
- package/lib/services/dbo/soil-moisture-row.d.ts +14 -0
- package/lib/services/dbo/soil-moisture-row.js +2 -0
- package/lib/services/dbo/weather-day-summary-row.d.ts +2 -0
- package/lib/services/weather/open-weather-day-summary.d.ts +4 -0
- package/lib/services/weather/weather-history-backfill.d.ts +6 -0
- package/lib/services/weather/weather-history-backfill.js +21 -2
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/lib/action/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export { MotionSensorAction } from './motionSensorAction';
|
|
|
5
5
|
export { PresenceGroupLastLeftAction } from './presenceGroupLastLeftAction';
|
|
6
6
|
export { PresenceGroupFirstEnterAction } from './presenceGroupFirstEnterAction';
|
|
7
7
|
export { ShutterPositionChangedAction } from './shutterPositionChangedAction';
|
|
8
|
+
export { SoilSensorChangeAction } from './soilSensorChangeAction';
|
|
8
9
|
export { TemperatureSensorChangeAction } from './temperatureSensorChangeAction';
|
|
9
10
|
export { ActuatorChangeAction } from './actuatorChangeAction';
|
|
10
11
|
export { BatteryLevelChangeAction } from './batteryLevelChangeAction';
|
package/lib/action/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DingSensorAction = exports.HandleChangeAction = exports.PresenceGroupAnyMovementAction = exports.BatteryLevelChangeAction = exports.ActuatorChangeAction = exports.TemperatureSensorChangeAction = exports.ShutterPositionChangedAction = exports.PresenceGroupFirstEnterAction = exports.PresenceGroupLastLeftAction = exports.MotionSensorAction = exports.HumiditySensorChangeAction = exports.BaseAction = exports.AirQualitySensorChangeAction = void 0;
|
|
3
|
+
exports.DingSensorAction = exports.HandleChangeAction = exports.PresenceGroupAnyMovementAction = exports.BatteryLevelChangeAction = exports.ActuatorChangeAction = exports.TemperatureSensorChangeAction = exports.SoilSensorChangeAction = exports.ShutterPositionChangedAction = exports.PresenceGroupFirstEnterAction = exports.PresenceGroupLastLeftAction = exports.MotionSensorAction = exports.HumiditySensorChangeAction = exports.BaseAction = exports.AirQualitySensorChangeAction = void 0;
|
|
4
4
|
var airQualitySensorChangeAction_1 = require("./airQualitySensorChangeAction");
|
|
5
5
|
Object.defineProperty(exports, "AirQualitySensorChangeAction", { enumerable: true, get: function () { return airQualitySensorChangeAction_1.AirQualitySensorChangeAction; } });
|
|
6
6
|
var baseAction_1 = require("./baseAction");
|
|
@@ -15,6 +15,8 @@ var presenceGroupFirstEnterAction_1 = require("./presenceGroupFirstEnterAction")
|
|
|
15
15
|
Object.defineProperty(exports, "PresenceGroupFirstEnterAction", { enumerable: true, get: function () { return presenceGroupFirstEnterAction_1.PresenceGroupFirstEnterAction; } });
|
|
16
16
|
var shutterPositionChangedAction_1 = require("./shutterPositionChangedAction");
|
|
17
17
|
Object.defineProperty(exports, "ShutterPositionChangedAction", { enumerable: true, get: function () { return shutterPositionChangedAction_1.ShutterPositionChangedAction; } });
|
|
18
|
+
var soilSensorChangeAction_1 = require("./soilSensorChangeAction");
|
|
19
|
+
Object.defineProperty(exports, "SoilSensorChangeAction", { enumerable: true, get: function () { return soilSensorChangeAction_1.SoilSensorChangeAction; } });
|
|
18
20
|
var temperatureSensorChangeAction_1 = require("./temperatureSensorChangeAction");
|
|
19
21
|
Object.defineProperty(exports, "TemperatureSensorChangeAction", { enumerable: true, get: function () { return temperatureSensorChangeAction_1.TemperatureSensorChangeAction; } });
|
|
20
22
|
var actuatorChangeAction_1 = require("./actuatorChangeAction");
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseAction } from './baseAction';
|
|
2
|
+
import { CommandType } from '../enums';
|
|
3
|
+
import { iSoilCollector } from '../interfaces';
|
|
4
|
+
export declare class SoilSensorChangeAction extends BaseAction {
|
|
5
|
+
/** @inheritDoc */
|
|
6
|
+
type: CommandType;
|
|
7
|
+
/**
|
|
8
|
+
* The new soil moisture in percent
|
|
9
|
+
*/
|
|
10
|
+
readonly newSoilMoisture: number;
|
|
11
|
+
/**
|
|
12
|
+
* The sensor that triggered the action
|
|
13
|
+
*/
|
|
14
|
+
readonly sensor: iSoilCollector;
|
|
15
|
+
constructor(sensor: iSoilCollector, newSoilMoisture: number);
|
|
16
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SoilSensorChangeAction = void 0;
|
|
4
|
+
const baseAction_1 = require("./baseAction");
|
|
5
|
+
const enums_1 = require("../enums");
|
|
6
|
+
class SoilSensorChangeAction extends baseAction_1.BaseAction {
|
|
7
|
+
constructor(sensor, newSoilMoisture) {
|
|
8
|
+
super(enums_1.CommandSource.Automatic, `${sensor.customName} detected ${newSoilMoisture}% soil moisture`);
|
|
9
|
+
/** @inheritDoc */
|
|
10
|
+
this.type = enums_1.CommandType.SoilSensorChangeAction;
|
|
11
|
+
this.newSoilMoisture = newSoilMoisture;
|
|
12
|
+
this.sensor = sensor;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.SoilSensorChangeAction = SoilSensorChangeAction;
|
|
@@ -58,6 +58,13 @@ class DeviceCluster {
|
|
|
58
58
|
clusterTypes.push(enums_1.DeviceClusterType.TemperaturSensor);
|
|
59
59
|
clusterTypes.push(enums_1.DeviceClusterType.HumiditySensor);
|
|
60
60
|
break;
|
|
61
|
+
case enums_1.DeviceType.ZigbeeCooloSoilSensor:
|
|
62
|
+
// Counts towards the room aggregates as well: this sensor sits in a pot indoors, so its air readings
|
|
63
|
+
// are readings of the room air. A sensor in a bed or a lawn would only get the soil cluster.
|
|
64
|
+
clusterTypes.push(enums_1.DeviceClusterType.SoilSensor);
|
|
65
|
+
clusterTypes.push(enums_1.DeviceClusterType.TemperaturSensor);
|
|
66
|
+
clusterTypes.push(enums_1.DeviceClusterType.HumiditySensor);
|
|
67
|
+
break;
|
|
61
68
|
case enums_1.DeviceType.HmIpGriff:
|
|
62
69
|
clusterTypes.push(enums_1.DeviceClusterType.Handle);
|
|
63
70
|
break;
|
package/lib/devices/devices.js
CHANGED
|
@@ -229,6 +229,9 @@ class Devices {
|
|
|
229
229
|
case 'BlitzShp':
|
|
230
230
|
d = new zigbee_1.ZigbeeBlitzShp(zigbeeInfo);
|
|
231
231
|
break;
|
|
232
|
+
case 'CooloSoil':
|
|
233
|
+
d = new zigbee_1.ZigbeeCooloSoilSensor(zigbeeInfo);
|
|
234
|
+
break;
|
|
232
235
|
case 'HeimanSmoke':
|
|
233
236
|
d = new zigbee_1.ZigbeeHeimanSmoke(zigbeeInfo);
|
|
234
237
|
break;
|
|
@@ -20,4 +20,5 @@ __exportStar(require("./handleSensor"), exports);
|
|
|
20
20
|
__exportStar(require("./humiditySensor"), exports);
|
|
21
21
|
__exportStar(require("./lampUtils"), exports);
|
|
22
22
|
__exportStar(require("./shutterUtils"), exports);
|
|
23
|
+
__exportStar(require("./soilSensor"), exports);
|
|
23
24
|
__exportStar(require("./temperatureSensor"), exports);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { iSoilCollector, iSoilSensor } from '../../interfaces';
|
|
2
|
+
import { SoilSensorChangeAction } from '../../action';
|
|
3
|
+
export declare class SoilSensor implements iSoilSensor {
|
|
4
|
+
private readonly _device;
|
|
5
|
+
/** @inheritDoc */
|
|
6
|
+
readonly jsonOmitKeys: string[];
|
|
7
|
+
private _soilMoistureCallbacks;
|
|
8
|
+
private _soilMoisture;
|
|
9
|
+
private readonly _persistSoilSensorInterval;
|
|
10
|
+
constructor(_device: iSoilCollector);
|
|
11
|
+
/** @inheritDoc */
|
|
12
|
+
get soilMoisture(): number;
|
|
13
|
+
/** @inheritDoc */
|
|
14
|
+
set soilMoisture(val: number);
|
|
15
|
+
/** @inheritDoc */
|
|
16
|
+
persist(): void;
|
|
17
|
+
/** @inheritDoc */
|
|
18
|
+
addSoilMoistureCallback(pCallback: (action: SoilSensorChangeAction) => void): void;
|
|
19
|
+
/** @inheritDoc */
|
|
20
|
+
dispose(): void;
|
|
21
|
+
/** @inheritDoc */
|
|
22
|
+
toJSON(): Partial<SoilSensor>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SoilSensor = void 0;
|
|
4
|
+
const interfaces_1 = require("../../interfaces");
|
|
5
|
+
const action_1 = require("../../action");
|
|
6
|
+
const utils_1 = require("../../utils");
|
|
7
|
+
const services_1 = require("../../services");
|
|
8
|
+
class SoilSensor {
|
|
9
|
+
constructor(_device) {
|
|
10
|
+
this._device = _device;
|
|
11
|
+
/** @inheritDoc */
|
|
12
|
+
this.jsonOmitKeys = ['_device'];
|
|
13
|
+
this._soilMoistureCallbacks = [];
|
|
14
|
+
this._soilMoisture = interfaces_1.UNDEFINED_SOIL_MOISTURE_VALUE;
|
|
15
|
+
this._persistSoilSensorInterval = utils_1.Utils.guardedInterval(() => {
|
|
16
|
+
this.persist();
|
|
17
|
+
}, 5 * 60 * 1000, this, false);
|
|
18
|
+
}
|
|
19
|
+
/** @inheritDoc */
|
|
20
|
+
get soilMoisture() {
|
|
21
|
+
return this._soilMoisture;
|
|
22
|
+
}
|
|
23
|
+
/** @inheritDoc */
|
|
24
|
+
set soilMoisture(val) {
|
|
25
|
+
this._soilMoisture = val;
|
|
26
|
+
for (const cb of this._soilMoistureCallbacks) {
|
|
27
|
+
cb(new action_1.SoilSensorChangeAction(this._device, val));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/** @inheritDoc */
|
|
31
|
+
persist() {
|
|
32
|
+
var _a;
|
|
33
|
+
if (this._soilMoisture === interfaces_1.UNDEFINED_SOIL_MOISTURE_VALUE) {
|
|
34
|
+
// Nothing was ever reported --> persisting would only write a row of the sentinel, which reads like a
|
|
35
|
+
// measured -1 % in every later query.
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
(_a = services_1.Persistence.dbo) === null || _a === void 0 ? void 0 : _a.persistSoilSensor(this._device);
|
|
39
|
+
}
|
|
40
|
+
/** @inheritDoc */
|
|
41
|
+
addSoilMoistureCallback(pCallback) {
|
|
42
|
+
this._soilMoistureCallbacks.push(pCallback);
|
|
43
|
+
if (this._soilMoisture !== interfaces_1.UNDEFINED_SOIL_MOISTURE_VALUE) {
|
|
44
|
+
pCallback(new action_1.SoilSensorChangeAction(this._device, this._soilMoisture));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/** @inheritDoc */
|
|
48
|
+
dispose() {
|
|
49
|
+
if (this._persistSoilSensorInterval) {
|
|
50
|
+
clearInterval(this._persistSoilSensorInterval);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/** @inheritDoc */
|
|
54
|
+
toJSON() {
|
|
55
|
+
return utils_1.Utils.jsonFilter(this, this.jsonOmitKeys);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.SoilSensor = SoilSensor;
|
|
@@ -6,6 +6,7 @@ export * from './zigbeeLedRGBCCT';
|
|
|
6
6
|
export * from './zigbeeMagnetContact';
|
|
7
7
|
export * from './zigbeeMotionSensor';
|
|
8
8
|
export * from './zigbeeShutter';
|
|
9
|
+
export * from './zigbeeSoilSensor';
|
|
9
10
|
export * from './zigbeeSwitch';
|
|
10
11
|
export { ZigbeeLamp } from './zigbeeLamp';
|
|
11
12
|
export { ZigbeeWindowHandle } from './zigbeeWindowHandle';
|
|
@@ -23,6 +23,7 @@ __exportStar(require("./zigbeeLedRGBCCT"), exports);
|
|
|
23
23
|
__exportStar(require("./zigbeeMagnetContact"), exports);
|
|
24
24
|
__exportStar(require("./zigbeeMotionSensor"), exports);
|
|
25
25
|
__exportStar(require("./zigbeeShutter"), exports);
|
|
26
|
+
__exportStar(require("./zigbeeSoilSensor"), exports);
|
|
26
27
|
__exportStar(require("./zigbeeSwitch"), exports);
|
|
27
28
|
var zigbeeLamp_1 = require("./zigbeeLamp");
|
|
28
29
|
Object.defineProperty(exports, "ZigbeeLamp", { enumerable: true, get: function () { return zigbeeLamp_1.ZigbeeLamp; } });
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { iBatteryDevice, iSoilCollector, iSoilSensor } from '../../../interfaces';
|
|
2
|
+
import { BatteryLevelChangeAction, SoilSensorChangeAction } from '../../../action';
|
|
3
|
+
import { ZigbeeDevice } from './zigbeeDevice';
|
|
4
|
+
import { Battery } from '../../sharedFunctions';
|
|
5
|
+
import { IoBrokerDeviceInfo } from '../../IoBrokerDeviceInfo';
|
|
6
|
+
import { DeviceType } from '../../../enums';
|
|
7
|
+
/**
|
|
8
|
+
* The common part of every zigbee device measuring the moisture of the soil it sits in.
|
|
9
|
+
*
|
|
10
|
+
* Carries the smallest honest contract: soil moisture and battery, the two states every such sensor reports.
|
|
11
|
+
* Ambient temperature and humidity are deliberately NOT here - a sensor that only reads the soil would then
|
|
12
|
+
* claim capabilities it does not have. A device that measures them adds those axes itself, see
|
|
13
|
+
* {@link ZigbeeCooloSoilSensor}.
|
|
14
|
+
*/
|
|
15
|
+
export declare class ZigbeeSoilSensor extends ZigbeeDevice implements iSoilCollector, iBatteryDevice {
|
|
16
|
+
/** @inheritDoc */
|
|
17
|
+
soilSensor: iSoilSensor;
|
|
18
|
+
/** @inheritDoc */
|
|
19
|
+
battery: Battery;
|
|
20
|
+
constructor(pInfo: IoBrokerDeviceInfo, pType: DeviceType);
|
|
21
|
+
/** @inheritDoc */
|
|
22
|
+
get batteryLevel(): number;
|
|
23
|
+
/** @inheritDoc */
|
|
24
|
+
get soilMoisture(): number;
|
|
25
|
+
/** @inheritDoc */
|
|
26
|
+
addBatteryLevelCallback(pCallback: (action: BatteryLevelChangeAction) => void): void;
|
|
27
|
+
/** @inheritDoc */
|
|
28
|
+
addSoilMoistureCallback(pCallback: (action: SoilSensorChangeAction) => void): void;
|
|
29
|
+
/** @inheritDoc */
|
|
30
|
+
update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
|
|
31
|
+
/** @inheritDoc */
|
|
32
|
+
dispose(): void;
|
|
33
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ZigbeeSoilSensor = void 0;
|
|
4
|
+
const zigbeeDevice_1 = require("./zigbeeDevice");
|
|
5
|
+
const sharedFunctions_1 = require("../../sharedFunctions");
|
|
6
|
+
const enums_1 = require("../../../enums");
|
|
7
|
+
/**
|
|
8
|
+
* The common part of every zigbee device measuring the moisture of the soil it sits in.
|
|
9
|
+
*
|
|
10
|
+
* Carries the smallest honest contract: soil moisture and battery, the two states every such sensor reports.
|
|
11
|
+
* Ambient temperature and humidity are deliberately NOT here - a sensor that only reads the soil would then
|
|
12
|
+
* claim capabilities it does not have. A device that measures them adds those axes itself, see
|
|
13
|
+
* {@link ZigbeeCooloSoilSensor}.
|
|
14
|
+
*/
|
|
15
|
+
class ZigbeeSoilSensor extends zigbeeDevice_1.ZigbeeDevice {
|
|
16
|
+
constructor(pInfo, pType) {
|
|
17
|
+
super(pInfo, pType);
|
|
18
|
+
/** @inheritDoc */
|
|
19
|
+
this.soilSensor = new sharedFunctions_1.SoilSensor(this);
|
|
20
|
+
/** @inheritDoc */
|
|
21
|
+
this.battery = new sharedFunctions_1.Battery(this);
|
|
22
|
+
this.deviceCapabilities.push(enums_1.DeviceCapability.soilSensor);
|
|
23
|
+
this.deviceCapabilities.push(enums_1.DeviceCapability.batteryDriven);
|
|
24
|
+
}
|
|
25
|
+
/** @inheritDoc */
|
|
26
|
+
get batteryLevel() {
|
|
27
|
+
return this.battery.level;
|
|
28
|
+
}
|
|
29
|
+
/** @inheritDoc */
|
|
30
|
+
get soilMoisture() {
|
|
31
|
+
return this.soilSensor.soilMoisture;
|
|
32
|
+
}
|
|
33
|
+
/** @inheritDoc */
|
|
34
|
+
addBatteryLevelCallback(pCallback) {
|
|
35
|
+
this.battery.addBatteryLevelCallback(pCallback);
|
|
36
|
+
}
|
|
37
|
+
/** @inheritDoc */
|
|
38
|
+
addSoilMoistureCallback(pCallback) {
|
|
39
|
+
this.soilSensor.addSoilMoistureCallback(pCallback);
|
|
40
|
+
}
|
|
41
|
+
/** @inheritDoc */
|
|
42
|
+
update(idSplit, state, initial = false) {
|
|
43
|
+
super.update(idSplit, state, initial, true);
|
|
44
|
+
switch (idSplit[3]) {
|
|
45
|
+
case 'battery':
|
|
46
|
+
this.battery.level = state.val;
|
|
47
|
+
if (this.batteryLevel < 20) {
|
|
48
|
+
this.log(enums_1.LogLevel.Warn, 'Das Zigbee Gerät hat unter 20% Batterie.');
|
|
49
|
+
}
|
|
50
|
+
break;
|
|
51
|
+
case 'soil_moisture':
|
|
52
|
+
this.soilSensor.soilMoisture = state.val;
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/** @inheritDoc */
|
|
57
|
+
dispose() {
|
|
58
|
+
this.soilSensor.dispose();
|
|
59
|
+
super.dispose();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.ZigbeeSoilSensor = ZigbeeSoilSensor;
|
|
@@ -6,6 +6,7 @@ export * from './zigbeeAqaraPresence';
|
|
|
6
6
|
export * from './zigbeeAquaraVibra';
|
|
7
7
|
export * from './zigbeeAquaraWater';
|
|
8
8
|
export * from './zigbeeBlitzShp';
|
|
9
|
+
export * from './zigbeeCooloSoilSensor';
|
|
9
10
|
export * from './zigbeeEuroHeater';
|
|
10
11
|
export * from './zigbeeHeimanSmoke';
|
|
11
12
|
export * from './zigbeeIkeaSteckdose';
|
|
@@ -23,6 +23,7 @@ __exportStar(require("./zigbeeAqaraPresence"), exports);
|
|
|
23
23
|
__exportStar(require("./zigbeeAquaraVibra"), exports);
|
|
24
24
|
__exportStar(require("./zigbeeAquaraWater"), exports);
|
|
25
25
|
__exportStar(require("./zigbeeBlitzShp"), exports);
|
|
26
|
+
__exportStar(require("./zigbeeCooloSoilSensor"), exports);
|
|
26
27
|
__exportStar(require("./zigbeeEuroHeater"), exports);
|
|
27
28
|
__exportStar(require("./zigbeeHeimanSmoke"), exports);
|
|
28
29
|
__exportStar(require("./zigbeeIkeaSteckdose"), exports);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { iHumidityCollector, iHumiditySensor, iTemperatureCollector } from '../../interfaces';
|
|
2
|
+
import { HumiditySensorChangeAction, TemperatureSensorChangeAction } from '../../action';
|
|
3
|
+
import { ZigbeeSoilSensor } from './BaseDevices';
|
|
4
|
+
import { TemperatureSensor } from '../sharedFunctions';
|
|
5
|
+
import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
|
|
6
|
+
/**
|
|
7
|
+
* The COOLO CS-201Z soil sensor.
|
|
8
|
+
*
|
|
9
|
+
* Beyond the soil moisture and battery of {@link ZigbeeSoilSensor} it measures the air around it, so it adds
|
|
10
|
+
* the ambient temperature and humidity axes. Those are three separate quantities: `soil_moisture` and
|
|
11
|
+
* `humidity` are both percentages and can be told apart by nothing but which state they arrived on - the
|
|
12
|
+
* device reported 15 % soil against 91 % air on the same message.
|
|
13
|
+
*
|
|
14
|
+
* The configuration states the device exposes (`soil_calibration`, `soil_warning`, `temperature_calibration`,
|
|
15
|
+
* `temperature_sampling`, `soil_sampling`, `temperature_unit`) and the `dry` flag it derives from its own
|
|
16
|
+
* threshold are deliberately not mapped. They stay reachable through `stateMap` and `send_payload`.
|
|
17
|
+
*/
|
|
18
|
+
export declare class ZigbeeCooloSoilSensor extends ZigbeeSoilSensor implements iTemperatureCollector, iHumidityCollector {
|
|
19
|
+
/** @inheritDoc */
|
|
20
|
+
temperatureSensor: TemperatureSensor;
|
|
21
|
+
/** @inheritDoc */
|
|
22
|
+
humiditySensor: iHumiditySensor;
|
|
23
|
+
constructor(pInfo: IoBrokerDeviceInfo);
|
|
24
|
+
/** @inheritDoc */
|
|
25
|
+
get roomTemperature(): number;
|
|
26
|
+
/** @inheritDoc */
|
|
27
|
+
set roomTemperature(value: number);
|
|
28
|
+
/** @inheritDoc */
|
|
29
|
+
get humidity(): number;
|
|
30
|
+
/** @inheritDoc */
|
|
31
|
+
get iTemperature(): number;
|
|
32
|
+
/** @inheritDoc */
|
|
33
|
+
get sTemperature(): string;
|
|
34
|
+
/** @inheritDoc */
|
|
35
|
+
addHumidityCallback(pCallback: (action: HumiditySensorChangeAction) => void): void;
|
|
36
|
+
/** @inheritDoc */
|
|
37
|
+
addTempChangeCallback(pCallback: (action: TemperatureSensorChangeAction) => void): void;
|
|
38
|
+
/** @inheritDoc */
|
|
39
|
+
onTemperaturChange(newTemperatur: number): void;
|
|
40
|
+
/** @inheritDoc */
|
|
41
|
+
update(idSplit: string[], state: ioBroker.State, initial?: boolean): void;
|
|
42
|
+
/** @inheritDoc */
|
|
43
|
+
dispose(): void;
|
|
44
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ZigbeeCooloSoilSensor = void 0;
|
|
4
|
+
const BaseDevices_1 = require("./BaseDevices");
|
|
5
|
+
const sharedFunctions_1 = require("../sharedFunctions");
|
|
6
|
+
const enums_1 = require("../../enums");
|
|
7
|
+
/**
|
|
8
|
+
* The COOLO CS-201Z soil sensor.
|
|
9
|
+
*
|
|
10
|
+
* Beyond the soil moisture and battery of {@link ZigbeeSoilSensor} it measures the air around it, so it adds
|
|
11
|
+
* the ambient temperature and humidity axes. Those are three separate quantities: `soil_moisture` and
|
|
12
|
+
* `humidity` are both percentages and can be told apart by nothing but which state they arrived on - the
|
|
13
|
+
* device reported 15 % soil against 91 % air on the same message.
|
|
14
|
+
*
|
|
15
|
+
* The configuration states the device exposes (`soil_calibration`, `soil_warning`, `temperature_calibration`,
|
|
16
|
+
* `temperature_sampling`, `soil_sampling`, `temperature_unit`) and the `dry` flag it derives from its own
|
|
17
|
+
* threshold are deliberately not mapped. They stay reachable through `stateMap` and `send_payload`.
|
|
18
|
+
*/
|
|
19
|
+
class ZigbeeCooloSoilSensor extends BaseDevices_1.ZigbeeSoilSensor {
|
|
20
|
+
constructor(pInfo) {
|
|
21
|
+
super(pInfo, enums_1.DeviceType.ZigbeeCooloSoilSensor);
|
|
22
|
+
/** @inheritDoc */
|
|
23
|
+
this.temperatureSensor = new sharedFunctions_1.TemperatureSensor(this);
|
|
24
|
+
/** @inheritDoc */
|
|
25
|
+
this.humiditySensor = new sharedFunctions_1.HumiditySensor(this);
|
|
26
|
+
this.deviceCapabilities.push(enums_1.DeviceCapability.temperatureSensor);
|
|
27
|
+
this.deviceCapabilities.push(enums_1.DeviceCapability.humiditySensor);
|
|
28
|
+
}
|
|
29
|
+
/** @inheritDoc */
|
|
30
|
+
get roomTemperature() {
|
|
31
|
+
return this.temperatureSensor.roomTemperature;
|
|
32
|
+
}
|
|
33
|
+
/** @inheritDoc */
|
|
34
|
+
set roomTemperature(value) {
|
|
35
|
+
this.temperatureSensor.roomTemperature = value;
|
|
36
|
+
}
|
|
37
|
+
/** @inheritDoc */
|
|
38
|
+
get humidity() {
|
|
39
|
+
return this.humiditySensor.humidity;
|
|
40
|
+
}
|
|
41
|
+
/** @inheritDoc */
|
|
42
|
+
get iTemperature() {
|
|
43
|
+
return this.temperatureSensor.temperature;
|
|
44
|
+
}
|
|
45
|
+
/** @inheritDoc */
|
|
46
|
+
get sTemperature() {
|
|
47
|
+
return `${this.temperatureSensor.temperature}°C`;
|
|
48
|
+
}
|
|
49
|
+
/** @inheritDoc */
|
|
50
|
+
addHumidityCallback(pCallback) {
|
|
51
|
+
this.humiditySensor.addHumidityCallback(pCallback);
|
|
52
|
+
}
|
|
53
|
+
/** @inheritDoc */
|
|
54
|
+
addTempChangeCallback(pCallback) {
|
|
55
|
+
this.temperatureSensor.addTempChangeCallback(pCallback);
|
|
56
|
+
}
|
|
57
|
+
/** @inheritDoc */
|
|
58
|
+
onTemperaturChange(newTemperatur) {
|
|
59
|
+
this.roomTemperature = newTemperatur;
|
|
60
|
+
}
|
|
61
|
+
/** @inheritDoc */
|
|
62
|
+
update(idSplit, state, initial = false) {
|
|
63
|
+
// The base class handles `soil_moisture` and `battery`; these two are the air around the pot.
|
|
64
|
+
super.update(idSplit, state, initial);
|
|
65
|
+
switch (idSplit[3]) {
|
|
66
|
+
case 'humidity':
|
|
67
|
+
this.humiditySensor.humidity = state.val;
|
|
68
|
+
break;
|
|
69
|
+
case 'temperature':
|
|
70
|
+
this.temperatureSensor.temperature = state.val;
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/** @inheritDoc */
|
|
75
|
+
dispose() {
|
|
76
|
+
this.temperatureSensor.dispose();
|
|
77
|
+
this.humiditySensor.dispose();
|
|
78
|
+
super.dispose();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.ZigbeeCooloSoilSensor = ZigbeeCooloSoilSensor;
|
|
@@ -28,6 +28,7 @@ var DeviceCapability;
|
|
|
28
28
|
DeviceCapability[DeviceCapability["magnetSensor"] = 22] = "magnetSensor";
|
|
29
29
|
DeviceCapability[DeviceCapability["airQualitySensor"] = 23] = "airQualitySensor";
|
|
30
30
|
DeviceCapability[DeviceCapability["fossilGenerator"] = 24] = "fossilGenerator";
|
|
31
|
+
DeviceCapability[DeviceCapability["soilSensor"] = 25] = "soilSensor";
|
|
31
32
|
DeviceCapability[DeviceCapability["bluetoothDetector"] = 101] = "bluetoothDetector";
|
|
32
33
|
DeviceCapability[DeviceCapability["trackableDevice"] = 102] = "trackableDevice";
|
|
33
34
|
DeviceCapability[DeviceCapability["scene"] = 103] = "scene";
|
|
@@ -29,6 +29,7 @@ export declare enum CommandType {
|
|
|
29
29
|
RoomRestoreLightCommand = "RoomRestoreLightCommand",
|
|
30
30
|
RoomSetLightTimeBasedCommand = "RoomSetLightTimeBasedCommand",
|
|
31
31
|
ShutterPositionChangedAction = "ShutterPositionChangedAction",
|
|
32
|
+
SoilSensorChangeAction = "SoilSensorChangeAction",
|
|
32
33
|
ShutterSetLevelCommand = "ShutterSetLevelCommand",
|
|
33
34
|
ShutterSunriseUpCommand = "ShutterSunriseUpCommand",
|
|
34
35
|
SunsetDownCommand = "SunsetDownCommand",
|
package/lib/enums/commandType.js
CHANGED
|
@@ -33,6 +33,7 @@ var CommandType;
|
|
|
33
33
|
CommandType["RoomRestoreLightCommand"] = "RoomRestoreLightCommand";
|
|
34
34
|
CommandType["RoomSetLightTimeBasedCommand"] = "RoomSetLightTimeBasedCommand";
|
|
35
35
|
CommandType["ShutterPositionChangedAction"] = "ShutterPositionChangedAction";
|
|
36
|
+
CommandType["SoilSensorChangeAction"] = "SoilSensorChangeAction";
|
|
36
37
|
CommandType["ShutterSetLevelCommand"] = "ShutterSetLevelCommand";
|
|
37
38
|
CommandType["ShutterSunriseUpCommand"] = "ShutterSunriseUpCommand";
|
|
38
39
|
CommandType["SunsetDownCommand"] = "SunsetDownCommand";
|
|
@@ -24,4 +24,5 @@ var DeviceClusterType;
|
|
|
24
24
|
DeviceClusterType[DeviceClusterType["WLED"] = 19] = "WLED";
|
|
25
25
|
DeviceClusterType[DeviceClusterType["Tv"] = 20] = "Tv";
|
|
26
26
|
DeviceClusterType[DeviceClusterType["Camera"] = 21] = "Camera";
|
|
27
|
+
DeviceClusterType[DeviceClusterType["SoilSensor"] = 22] = "SoilSensor";
|
|
27
28
|
})(DeviceClusterType || (exports.DeviceClusterType = DeviceClusterType = {}));
|
package/lib/enums/deviceType.js
CHANGED
|
@@ -45,6 +45,7 @@ var DeviceType;
|
|
|
45
45
|
DeviceType[DeviceType["ZigbeeSodaHandle"] = 227] = "ZigbeeSodaHandle";
|
|
46
46
|
DeviceType[DeviceType["ZigbeeTuyaMotion"] = 228] = "ZigbeeTuyaMotion";
|
|
47
47
|
DeviceType[DeviceType["ZigbeeAqaraPresence"] = 229] = "ZigbeeAqaraPresence";
|
|
48
|
+
DeviceType[DeviceType["ZigbeeCooloSoilSensor"] = 230] = "ZigbeeCooloSoilSensor";
|
|
48
49
|
DeviceType[DeviceType["JsEnergyManager"] = 301] = "JsEnergyManager";
|
|
49
50
|
DeviceType[DeviceType["RoomScene"] = 401] = "RoomScene";
|
|
50
51
|
DeviceType[DeviceType["ShellyTrv"] = 402] = "ShellyTrv";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { iRoomDevice } from './iRoomDevice';
|
|
2
|
+
import { SoilSensorChangeAction } from '../../action';
|
|
3
|
+
import { iSoilSensor } from './iSoilSensor';
|
|
4
|
+
/**
|
|
5
|
+
* This interface represents a device measuring the moisture of the soil it sits in.
|
|
6
|
+
*
|
|
7
|
+
* For devices with {@link DeviceCapability.soilSensor} capability.
|
|
8
|
+
*/
|
|
9
|
+
export interface iSoilCollector extends iRoomDevice {
|
|
10
|
+
/**
|
|
11
|
+
* Service which handles common aspects of the soil sensor like persisting
|
|
12
|
+
*/
|
|
13
|
+
readonly soilSensor: iSoilSensor;
|
|
14
|
+
/**
|
|
15
|
+
* The current soil moisture in percent
|
|
16
|
+
*/
|
|
17
|
+
readonly soilMoisture: number;
|
|
18
|
+
/**
|
|
19
|
+
* Add a callback that is called when the soil moisture changes
|
|
20
|
+
* @param pCallback - The callback to fire
|
|
21
|
+
*/
|
|
22
|
+
addSoilMoistureCallback(pCallback: (action: SoilSensorChangeAction) => void): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { iJsonOmitKeys } from '../iJsonOmitKeys';
|
|
2
|
+
import { SoilSensorChangeAction } from '../../action';
|
|
3
|
+
/**
|
|
4
|
+
* Common handling for a device measuring the moisture of the soil it sits in.
|
|
5
|
+
*
|
|
6
|
+
* Deliberately its own axis rather than a second {@link iHumiditySensor}: a device can measure the moisture of
|
|
7
|
+
* the soil and the humidity of the air around it at the same time, and those are two different quantities that
|
|
8
|
+
* happen to share a unit. Sharing the slot would force one of the two readings out.
|
|
9
|
+
*/
|
|
10
|
+
export interface iSoilSensor extends iJsonOmitKeys {
|
|
11
|
+
/**
|
|
12
|
+
* The current soil moisture in percent, or {@link UNDEFINED_SOIL_MOISTURE_VALUE} while nothing was reported
|
|
13
|
+
*/
|
|
14
|
+
soilMoisture: number;
|
|
15
|
+
/**
|
|
16
|
+
* Persists the current soil moisture to the database
|
|
17
|
+
*/
|
|
18
|
+
persist(): void;
|
|
19
|
+
/**
|
|
20
|
+
* Adds a callback to be called when the soil moisture changes
|
|
21
|
+
* @param pCallback - The callback to be called
|
|
22
|
+
*/
|
|
23
|
+
addSoilMoistureCallback(pCallback: (action: SoilSensorChangeAction) => void): void;
|
|
24
|
+
/**
|
|
25
|
+
* Frees up the resources of this sensor
|
|
26
|
+
*/
|
|
27
|
+
dispose(): void;
|
|
28
|
+
/**
|
|
29
|
+
* @returns The serializable representation of this sensor
|
|
30
|
+
*/
|
|
31
|
+
toJSON(): Partial<iSoilSensor>;
|
|
32
|
+
}
|
|
@@ -15,8 +15,11 @@ export * from './iHeater';
|
|
|
15
15
|
export * from './iAirQualityCollector';
|
|
16
16
|
export * from './iAirQualityReadings';
|
|
17
17
|
export * from './iAirQualitySensor';
|
|
18
|
+
export * from './iSoilCollector';
|
|
19
|
+
export * from './iSoilSensor';
|
|
18
20
|
export * from './undefinedAirQualityValue';
|
|
19
21
|
export * from './undefinedHumidityValue';
|
|
22
|
+
export * from './undefinedSoilMoistureValue';
|
|
20
23
|
export * from './undefinedTempValue';
|
|
21
24
|
export * from './iHumidityCollector';
|
|
22
25
|
export * from './iIlluminationSensor';
|
|
@@ -30,8 +30,11 @@ __exportStar(require("./iHeater"), exports);
|
|
|
30
30
|
__exportStar(require("./iAirQualityCollector"), exports);
|
|
31
31
|
__exportStar(require("./iAirQualityReadings"), exports);
|
|
32
32
|
__exportStar(require("./iAirQualitySensor"), exports);
|
|
33
|
+
__exportStar(require("./iSoilCollector"), exports);
|
|
34
|
+
__exportStar(require("./iSoilSensor"), exports);
|
|
33
35
|
__exportStar(require("./undefinedAirQualityValue"), exports);
|
|
34
36
|
__exportStar(require("./undefinedHumidityValue"), exports);
|
|
37
|
+
__exportStar(require("./undefinedSoilMoistureValue"), exports);
|
|
35
38
|
__exportStar(require("./undefinedTempValue"), exports);
|
|
36
39
|
__exportStar(require("./iHumidityCollector"), exports);
|
|
37
40
|
__exportStar(require("./iIlluminationSensor"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UNDEFINED_SOIL_MOISTURE_VALUE = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The value reported while a device has no soil moisture reading of its own yet.
|
|
6
|
+
*
|
|
7
|
+
* Negative on purpose: soil moisture is a percentage, so no reading the sensor can take collides with it.
|
|
8
|
+
*/
|
|
9
|
+
exports.UNDEFINED_SOIL_MOISTURE_VALUE = -1;
|