hoffmation-base 3.0.0-beta.5 → 3.0.0-beta.6
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/sharedFunctions/temperatureSensor.d.ts +6 -0
- package/lib/server/devices/sharedFunctions/temperatureSensor.js +12 -2
- package/lib/server/devices/zigbee/zigbeeSodaHandle.d.ts +4 -0
- package/lib/server/devices/zigbee/zigbeeSodaHandle.js +5 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -8,6 +8,12 @@ export declare class TemperatureSensor implements iJsonOmitKeys {
|
|
|
8
8
|
* The current room temperature as a number in Celsius
|
|
9
9
|
*/
|
|
10
10
|
roomTemperature: number;
|
|
11
|
+
/**
|
|
12
|
+
* Temperature correction coefficient to mitigate outdoor temperature, e.g. if this is closely placed to a window.
|
|
13
|
+
* @remarks Default: 0 and difference to 21°C
|
|
14
|
+
* @example With outdoor temp of 10°C and a coefficient of 0.5, the temperature correction will be +5.5°C
|
|
15
|
+
*/
|
|
16
|
+
outdoorTemperatureCorrectionCoefficient: number;
|
|
11
17
|
/**
|
|
12
18
|
* The interval to persist the temperature sensor information
|
|
13
19
|
*/
|
|
@@ -13,6 +13,12 @@ class TemperatureSensor {
|
|
|
13
13
|
* The current room temperature as a number in Celsius
|
|
14
14
|
*/
|
|
15
15
|
this.roomTemperature = baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE;
|
|
16
|
+
/**
|
|
17
|
+
* Temperature correction coefficient to mitigate outdoor temperature, e.g. if this is closely placed to a window.
|
|
18
|
+
* @remarks Default: 0 and difference to 21°C
|
|
19
|
+
* @example With outdoor temp of 10°C and a coefficient of 0.5, the temperature correction will be +5.5°C
|
|
20
|
+
*/
|
|
21
|
+
this.outdoorTemperatureCorrectionCoefficient = 0;
|
|
16
22
|
/**
|
|
17
23
|
* The interval to persist the temperature sensor information
|
|
18
24
|
*/
|
|
@@ -23,9 +29,13 @@ class TemperatureSensor {
|
|
|
23
29
|
this._temperaturCallbacks = [];
|
|
24
30
|
}
|
|
25
31
|
set temperature(val) {
|
|
26
|
-
|
|
32
|
+
let correctedValue = val;
|
|
33
|
+
if (this.outdoorTemperatureCorrectionCoefficient !== 0 && services_1.WeatherService.currentTemp !== baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE) {
|
|
34
|
+
correctedValue = val + this.outdoorTemperatureCorrectionCoefficient * (21 - services_1.WeatherService.currentTemp);
|
|
35
|
+
}
|
|
36
|
+
this._temperature = correctedValue;
|
|
27
37
|
for (const cb of this._temperaturCallbacks) {
|
|
28
|
-
cb(new models_1.TemperatureSensorChangeAction(this._device,
|
|
38
|
+
cb(new models_1.TemperatureSensorChangeAction(this._device, correctedValue));
|
|
29
39
|
}
|
|
30
40
|
}
|
|
31
41
|
get temperature() {
|
|
@@ -3,6 +3,10 @@ import { iHumiditySensor, iTemperatureSensor } from '../baseDeviceInterfaces';
|
|
|
3
3
|
import { IoBrokerDeviceInfo } from '../IoBrokerDeviceInfo';
|
|
4
4
|
import { HumiditySensor, TemperatureSensor } from '../sharedFunctions';
|
|
5
5
|
import { HumiditySensorChangeAction, TemperatureSensorChangeAction } from '../../../models';
|
|
6
|
+
/**
|
|
7
|
+
* A smart window handle with integrated temperature and humidity sensor.
|
|
8
|
+
* As the temperature sensor is so close to the window it might be off, which is why the correction coefficient is set to 0.22°C per outdoor diff to 21°C
|
|
9
|
+
*/
|
|
6
10
|
export declare class ZigbeeSodaHandle extends ZigbeeWindowHandle implements iTemperatureSensor, iHumiditySensor {
|
|
7
11
|
/** @inheritDoc */
|
|
8
12
|
temperatureSensor: TemperatureSensor;
|
|
@@ -6,6 +6,10 @@ const deviceType_1 = require("../deviceType");
|
|
|
6
6
|
const DeviceCapability_1 = require("../DeviceCapability");
|
|
7
7
|
const sharedFunctions_1 = require("../sharedFunctions");
|
|
8
8
|
const models_1 = require("../../../models");
|
|
9
|
+
/**
|
|
10
|
+
* A smart window handle with integrated temperature and humidity sensor.
|
|
11
|
+
* As the temperature sensor is so close to the window it might be off, which is why the correction coefficient is set to 0.22°C per outdoor diff to 21°C
|
|
12
|
+
*/
|
|
9
13
|
class ZigbeeSodaHandle extends BaseDevices_1.ZigbeeWindowHandle {
|
|
10
14
|
constructor(pInfo) {
|
|
11
15
|
super(pInfo, deviceType_1.DeviceType.ZigbeeSodaHandle);
|
|
@@ -15,6 +19,7 @@ class ZigbeeSodaHandle extends BaseDevices_1.ZigbeeWindowHandle {
|
|
|
15
19
|
this.humiditySensor = new sharedFunctions_1.HumiditySensor(this);
|
|
16
20
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.humiditySensor);
|
|
17
21
|
this.deviceCapabilities.push(DeviceCapability_1.DeviceCapability.temperatureSensor);
|
|
22
|
+
this.temperatureSensor.outdoorTemperatureCorrectionCoefficient = 0.22;
|
|
18
23
|
}
|
|
19
24
|
/** @inheritDoc */
|
|
20
25
|
get roomTemperature() {
|