hoffmation-base 1.0.12 → 1.0.15
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/deviceSettings/acSettings.d.ts +15 -0
- package/lib/models/deviceSettings/acSettings.js +15 -0
- package/lib/models/rooms/RoomBase.d.ts +1 -2
- package/lib/models/rooms/RoomBase.js +0 -3
- package/lib/server/devices/groups/heatGroup.d.ts +9 -1
- package/lib/server/devices/groups/heatGroup.js +29 -1
- package/lib/server/devices/groups/index.d.ts +0 -1
- package/lib/server/devices/groups/index.js +0 -1
- package/lib/server/devices/groups/tasterGroup.js +4 -4
- package/lib/server/services/ac/ac-device.d.ts +4 -2
- package/lib/server/services/ac/ac-device.js +34 -9
- package/lib/server/services/ac/ac-mode.d.ts +4 -3
- package/lib/server/services/ac/ac-mode.js +4 -3
- package/lib/server/services/ac/own-daikin-device.js +5 -4
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/lib/server/devices/groups/acGroup.d.ts +0 -12
- package/lib/server/devices/groups/acGroup.js +0 -38
|
@@ -4,4 +4,19 @@ export declare class AcSettings extends DeviceSettings {
|
|
|
4
4
|
minimumMinutes: number;
|
|
5
5
|
maximumHours: number;
|
|
6
6
|
maximumMinutes: number;
|
|
7
|
+
/**
|
|
8
|
+
* The temperatur below which cooling should be stopped
|
|
9
|
+
* @type {number}
|
|
10
|
+
*/
|
|
11
|
+
stopCoolingTemperatur: number;
|
|
12
|
+
/**
|
|
13
|
+
* The temperatur above which heating should be stopped
|
|
14
|
+
* @type {number}
|
|
15
|
+
*/
|
|
16
|
+
stopHeatingTemperatur: number;
|
|
17
|
+
/**
|
|
18
|
+
* Heating can be forbidden completly e.g. for summer season
|
|
19
|
+
* @type {boolean}
|
|
20
|
+
*/
|
|
21
|
+
heatingAllowed: boolean;
|
|
7
22
|
}
|
|
@@ -9,6 +9,21 @@ class AcSettings extends deviceSettings_1.DeviceSettings {
|
|
|
9
9
|
this.minimumMinutes = 0;
|
|
10
10
|
this.maximumHours = 24;
|
|
11
11
|
this.maximumMinutes = 0;
|
|
12
|
+
/**
|
|
13
|
+
* The temperatur below which cooling should be stopped
|
|
14
|
+
* @type {number}
|
|
15
|
+
*/
|
|
16
|
+
this.stopCoolingTemperatur = 22;
|
|
17
|
+
/**
|
|
18
|
+
* The temperatur above which heating should be stopped
|
|
19
|
+
* @type {number}
|
|
20
|
+
*/
|
|
21
|
+
this.stopHeatingTemperatur = 21.0;
|
|
22
|
+
/**
|
|
23
|
+
* Heating can be forbidden completly e.g. for summer season
|
|
24
|
+
* @type {boolean}
|
|
25
|
+
*/
|
|
26
|
+
this.heatingAllowed = false;
|
|
12
27
|
}
|
|
13
28
|
}
|
|
14
29
|
exports.AcSettings = AcSettings;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TimeCallback } from '../timeCallback';
|
|
2
|
-
import {
|
|
2
|
+
import { BaseGroup, DeviceCluster, FensterGroup, GroupType, HeatGroup, LampenGroup, PraesenzGroup, SmokeGroup, SonosGroup, TasterGroup, WaterGroup } from '../../server';
|
|
3
3
|
import { RoomSettings } from './RoomSettings';
|
|
4
4
|
import { iRoomBase } from './iRoomBase';
|
|
5
5
|
import { RoomInfo } from './roomInfo';
|
|
@@ -15,7 +15,6 @@ export declare class RoomBase implements iRoomBase {
|
|
|
15
15
|
constructor(roomName: string, settings: RoomSettings, groups: Map<GroupType, BaseGroup>);
|
|
16
16
|
protected _deviceCluster: DeviceCluster;
|
|
17
17
|
get deviceCluster(): DeviceCluster;
|
|
18
|
-
get AcGroup(): AcGroup | undefined;
|
|
19
18
|
get FensterGroup(): FensterGroup | undefined;
|
|
20
19
|
get PraesenzGroup(): PraesenzGroup | undefined;
|
|
21
20
|
get LampenGroup(): LampenGroup | undefined;
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import { BaseGroup } from './base-group';
|
|
2
2
|
import { iHeater, iHumiditySensor, iTemperaturSensor } from '../baseDeviceInterfaces';
|
|
3
|
+
import { AcDevice } from '../../services';
|
|
3
4
|
export declare class HeatGroup extends BaseGroup {
|
|
4
|
-
constructor(roomName: string, heaterIds: string[], tempSensorIds: string[], humiditySensorIds: string[]);
|
|
5
|
+
constructor(roomName: string, heaterIds: string[], tempSensorIds: string[], humiditySensorIds: string[], acIds: string[]);
|
|
5
6
|
get currentTemp(): number;
|
|
6
7
|
get desiredTemp(): number;
|
|
7
8
|
getHeater(): iHeater[];
|
|
8
9
|
getTempSensors(): iTemperaturSensor[];
|
|
9
10
|
getHumiditySensors(): iHumiditySensor[];
|
|
11
|
+
getOwnAcDevices(): AcDevice[];
|
|
10
12
|
initialize(): void;
|
|
13
|
+
/**
|
|
14
|
+
* Sets all ACs to new desired Value
|
|
15
|
+
* @param {boolean} newDesiredState
|
|
16
|
+
* @param {boolean} force Whether this was a manual trigger, thus blocking automatic changes for 1 hour
|
|
17
|
+
*/
|
|
18
|
+
setAc(newDesiredState: boolean, force?: boolean): void;
|
|
11
19
|
private recalcRoomTemperatur;
|
|
12
20
|
}
|
|
@@ -6,12 +6,14 @@ const group_type_1 = require("./group-type");
|
|
|
6
6
|
const device_cluster_type_1 = require("../device-cluster-type");
|
|
7
7
|
const device_list_1 = require("../device-list");
|
|
8
8
|
const baseDeviceInterfaces_1 = require("../baseDeviceInterfaces");
|
|
9
|
+
const models_1 = require("../../../models");
|
|
9
10
|
class HeatGroup extends base_group_1.BaseGroup {
|
|
10
|
-
constructor(roomName, heaterIds, tempSensorIds, humiditySensorIds) {
|
|
11
|
+
constructor(roomName, heaterIds, tempSensorIds, humiditySensorIds, acIds) {
|
|
11
12
|
super(roomName, group_type_1.GroupType.Heating);
|
|
12
13
|
this.deviceCluster.deviceMap.set(device_cluster_type_1.DeviceClusterType.Heater, new device_list_1.DeviceList(heaterIds));
|
|
13
14
|
this.deviceCluster.deviceMap.set(device_cluster_type_1.DeviceClusterType.TemperaturSensor, new device_list_1.DeviceList(tempSensorIds));
|
|
14
15
|
this.deviceCluster.deviceMap.set(device_cluster_type_1.DeviceClusterType.HumiditySensor, new device_list_1.DeviceList(humiditySensorIds));
|
|
16
|
+
this.deviceCluster.deviceMap.set(device_cluster_type_1.DeviceClusterType.Ac, new device_list_1.DeviceList(acIds));
|
|
15
17
|
}
|
|
16
18
|
get currentTemp() {
|
|
17
19
|
if (this.getHeater().length === 0) {
|
|
@@ -43,12 +45,38 @@ class HeatGroup extends base_group_1.BaseGroup {
|
|
|
43
45
|
getHumiditySensors() {
|
|
44
46
|
return this.deviceCluster.getDevicesByType(device_cluster_type_1.DeviceClusterType.HumiditySensor);
|
|
45
47
|
}
|
|
48
|
+
getOwnAcDevices() {
|
|
49
|
+
return this.deviceCluster.getDevicesByType(device_cluster_type_1.DeviceClusterType.Ac);
|
|
50
|
+
}
|
|
46
51
|
initialize() {
|
|
47
52
|
this.getTempSensors().forEach((sensor) => {
|
|
48
53
|
sensor.addTempChangeCallback((_newVal) => {
|
|
49
54
|
this.recalcRoomTemperatur();
|
|
50
55
|
});
|
|
51
56
|
});
|
|
57
|
+
this.getOwnAcDevices().forEach((acDev) => {
|
|
58
|
+
acDev.room = this.getRoom();
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Sets all ACs to new desired Value
|
|
63
|
+
* @param {boolean} newDesiredState
|
|
64
|
+
* @param {boolean} force Whether this was a manual trigger, thus blocking automatic changes for 1 hour
|
|
65
|
+
*/
|
|
66
|
+
setAc(newDesiredState, force = false) {
|
|
67
|
+
const devs = this.getOwnAcDevices();
|
|
68
|
+
this.log(models_1.LogLevel.Debug, `set ${devs.length} Ac's to new State: ${newDesiredState}`);
|
|
69
|
+
for (const dev of devs) {
|
|
70
|
+
if (newDesiredState) {
|
|
71
|
+
dev.turnOn();
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
if (force) {
|
|
75
|
+
dev.deactivateAutomaticTurnOn(60 * 60 * 1000);
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
dev.turnOff();
|
|
79
|
+
}
|
|
52
80
|
}
|
|
53
81
|
recalcRoomTemperatur() {
|
|
54
82
|
let temp = baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE;
|
|
@@ -14,7 +14,6 @@ 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("./acGroup"), exports);
|
|
18
17
|
__exportStar(require("./base-group"), exports);
|
|
19
18
|
__exportStar(require("./Fenster"), exports);
|
|
20
19
|
__exportStar(require("./fensterGroup"), exports);
|
|
@@ -54,13 +54,13 @@ class TasterGroup extends base_group_1.BaseGroup {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
if (((_j = services_1.SettingsService.settings.daikin) === null || _j === void 0 ? void 0 : _j.buttonBotRightForAc) === true) {
|
|
57
|
-
const
|
|
58
|
-
if (
|
|
57
|
+
const heatGroup = this.getRoom().HeatGroup;
|
|
58
|
+
if (heatGroup !== undefined && heatGroup.getOwnAcDevices().length > 0) {
|
|
59
59
|
(_k = t.buttonBotRight) === null || _k === void 0 ? void 0 : _k.addCb(button_1.ButtonPressType.short, (pValue) => {
|
|
60
|
-
pValue &&
|
|
60
|
+
pValue && heatGroup.setAc(true);
|
|
61
61
|
});
|
|
62
62
|
(_l = t.buttonBotRight) === null || _l === void 0 ? void 0 : _l.addCb(button_1.ButtonPressType.long, (pValue) => {
|
|
63
|
-
pValue &&
|
|
63
|
+
pValue && heatGroup.setAc(false, true);
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { iExcessEnergyConsumer } from '../../devices';
|
|
2
|
-
import { ExcessEnergyConsumerSettings, LogLevel } from '../../../models';
|
|
2
|
+
import { ExcessEnergyConsumerSettings, LogLevel, RoomBase } from '../../../models';
|
|
3
3
|
import { AcMode } from './ac-mode';
|
|
4
4
|
import { AcSettings } from '../../../models/deviceSettings/acSettings';
|
|
5
5
|
export declare abstract class AcDevice implements iExcessEnergyConsumer {
|
|
@@ -9,12 +9,13 @@ export declare abstract class AcDevice implements iExcessEnergyConsumer {
|
|
|
9
9
|
currentConsumption: number;
|
|
10
10
|
energyConsumerSettings: ExcessEnergyConsumerSettings;
|
|
11
11
|
acSettings: AcSettings;
|
|
12
|
+
room: RoomBase | undefined;
|
|
12
13
|
protected _activatedByExcessEnergy: boolean;
|
|
13
14
|
protected _blockAutomaticTurnOnMS: number;
|
|
14
|
-
private turnOffTimeout;
|
|
15
15
|
protected constructor(name: string, roomName: string, ip: string);
|
|
16
16
|
abstract get on(): boolean;
|
|
17
17
|
isAvailableForExcessEnergy(): boolean;
|
|
18
|
+
calculateDesiredMode(): AcMode;
|
|
18
19
|
/**
|
|
19
20
|
* Disable automatic Turn-On for given amount of ms and turn off immediately.
|
|
20
21
|
* @param {number} timeout
|
|
@@ -27,4 +28,5 @@ export declare abstract class AcDevice implements iExcessEnergyConsumer {
|
|
|
27
28
|
turnOffDueToMissingEnergy(): void;
|
|
28
29
|
log(level: LogLevel, message: string): void;
|
|
29
30
|
wasActivatedByExcessEnergy(): boolean;
|
|
31
|
+
private automaticCheck;
|
|
30
32
|
}
|
|
@@ -4,6 +4,7 @@ exports.AcDevice = void 0;
|
|
|
4
4
|
const models_1 = require("../../../models");
|
|
5
5
|
const utils_1 = require("../utils");
|
|
6
6
|
const log_service_1 = require("../log-service");
|
|
7
|
+
const ac_mode_1 = require("./ac-mode");
|
|
7
8
|
const acSettings_1 = require("../../../models/deviceSettings/acSettings");
|
|
8
9
|
class AcDevice {
|
|
9
10
|
constructor(name, roomName, ip) {
|
|
@@ -15,7 +16,7 @@ class AcDevice {
|
|
|
15
16
|
this.acSettings = new acSettings_1.AcSettings();
|
|
16
17
|
this._activatedByExcessEnergy = false;
|
|
17
18
|
this._blockAutomaticTurnOnMS = -1;
|
|
18
|
-
this.
|
|
19
|
+
utils_1.Utils.guardedInterval(this.automaticCheck, 60000, this, true);
|
|
19
20
|
}
|
|
20
21
|
isAvailableForExcessEnergy() {
|
|
21
22
|
if (utils_1.Utils.nowMS() < this._blockAutomaticTurnOnMS) {
|
|
@@ -24,7 +25,25 @@ class AcDevice {
|
|
|
24
25
|
const minimumStart = utils_1.Utils.dateByTimeSpan(this.acSettings.minimumHours, this.acSettings.minimumMinutes);
|
|
25
26
|
const maximumEnd = utils_1.Utils.dateByTimeSpan(this.acSettings.maximumHours, this.acSettings.maximumMinutes);
|
|
26
27
|
const now = new Date();
|
|
27
|
-
|
|
28
|
+
if (now < minimumStart || now > maximumEnd) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
return this.calculateDesiredMode() !== ac_mode_1.AcMode.Off;
|
|
32
|
+
}
|
|
33
|
+
calculateDesiredMode() {
|
|
34
|
+
var _a, _b;
|
|
35
|
+
const temp = (_b = (_a = this.room) === null || _a === void 0 ? void 0 : _a.HeatGroup) === null || _b === void 0 ? void 0 : _b.currentTemp;
|
|
36
|
+
if (temp === undefined) {
|
|
37
|
+
this.log(models_1.LogLevel.Warn, `Can't calculate AC Mode as we have no room temperature`);
|
|
38
|
+
return ac_mode_1.AcMode.Off;
|
|
39
|
+
}
|
|
40
|
+
if (temp > this.acSettings.stopCoolingTemperatur) {
|
|
41
|
+
return ac_mode_1.AcMode.Cooling;
|
|
42
|
+
}
|
|
43
|
+
if (temp < this.acSettings.stopHeatingTemperatur && this.acSettings.heatingAllowed) {
|
|
44
|
+
return ac_mode_1.AcMode.Heating;
|
|
45
|
+
}
|
|
46
|
+
return ac_mode_1.AcMode.Off;
|
|
28
47
|
}
|
|
29
48
|
/**
|
|
30
49
|
* Disable automatic Turn-On for given amount of ms and turn off immediately.
|
|
@@ -39,14 +58,8 @@ class AcDevice {
|
|
|
39
58
|
return;
|
|
40
59
|
}
|
|
41
60
|
this._activatedByExcessEnergy = true;
|
|
61
|
+
this.setDesiredMode(this.calculateDesiredMode(), false);
|
|
42
62
|
this.turnOn();
|
|
43
|
-
if (this.acSettings.maximumHours < 24 && this.turnOffTimeout === null) {
|
|
44
|
-
this.turnOffTimeout = utils_1.Utils.guardedTimeout(() => {
|
|
45
|
-
if (this._activatedByExcessEnergy) {
|
|
46
|
-
this.turnOff();
|
|
47
|
-
}
|
|
48
|
-
}, Math.min(utils_1.Utils.dateByTimeSpan(this.acSettings.maximumHours, this.acSettings.maximumMinutes).getTime() - utils_1.Utils.nowMS(), 1000), this);
|
|
49
|
-
}
|
|
50
63
|
}
|
|
51
64
|
turnOffDueToMissingEnergy() {
|
|
52
65
|
this.turnOff();
|
|
@@ -57,5 +70,17 @@ class AcDevice {
|
|
|
57
70
|
wasActivatedByExcessEnergy() {
|
|
58
71
|
return this._activatedByExcessEnergy;
|
|
59
72
|
}
|
|
73
|
+
automaticCheck() {
|
|
74
|
+
if (!this.on) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const desiredMode = this.calculateDesiredMode();
|
|
78
|
+
const maximumEnd = utils_1.Utils.dateByTimeSpan(this.acSettings.maximumHours, this.acSettings.maximumMinutes);
|
|
79
|
+
const now = new Date();
|
|
80
|
+
if (now > maximumEnd || (this._activatedByExcessEnergy && desiredMode == ac_mode_1.AcMode.Off)) {
|
|
81
|
+
this.turnOff();
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
60
85
|
}
|
|
61
86
|
exports.AcDevice = AcDevice;
|
|
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AcMode = void 0;
|
|
4
4
|
var AcMode;
|
|
5
5
|
(function (AcMode) {
|
|
6
|
-
AcMode[AcMode["
|
|
7
|
-
AcMode[AcMode["
|
|
8
|
-
AcMode[AcMode["
|
|
6
|
+
AcMode[AcMode["Off"] = 0] = "Off";
|
|
7
|
+
AcMode[AcMode["Auto"] = 1] = "Auto";
|
|
8
|
+
AcMode[AcMode["Cooling"] = 2] = "Cooling";
|
|
9
|
+
AcMode[AcMode["Heating"] = 3] = "Heating";
|
|
9
10
|
})(AcMode = exports.AcMode || (exports.AcMode = {}));
|
|
@@ -91,7 +91,7 @@ class OwnDaikinDevice extends ac_device_1.AcDevice {
|
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
93
93
|
else if (err.message.includes('ret=PARAM NG') && !retry) {
|
|
94
|
-
this.handleParamNg();
|
|
94
|
+
this.handleParamNg(changeObject);
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
97
|
}
|
|
@@ -113,12 +113,13 @@ class OwnDaikinDevice extends ac_device_1.AcDevice {
|
|
|
113
113
|
}, 5000, this);
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
|
-
handleParamNg() {
|
|
116
|
+
handleParamNg(changeObject) {
|
|
117
117
|
var _a;
|
|
118
|
-
this.log(models_1.LogLevel.Error, `Detected Param Ng for ${this.name}(${this.ip}), will try reloading Control Info`);
|
|
118
|
+
this.log(models_1.LogLevel.Error, `Detected Param Ng for ${this.name}(${this.ip}), will try reloading Control Info. Change Object: ${changeObject}`);
|
|
119
119
|
(_a = this._device) === null || _a === void 0 ? void 0 : _a.getACControlInfo((err) => {
|
|
120
|
+
var _a;
|
|
120
121
|
if (err === null) {
|
|
121
|
-
this.log(models_1.LogLevel.Warn, `Device Info loaded successfull will try setting Control Info again`);
|
|
122
|
+
this.log(models_1.LogLevel.Warn, `Device Info loaded successfull will try setting Control Info again: ${(_a = this._device) === null || _a === void 0 ? void 0 : _a.currentACControlInfo}`);
|
|
122
123
|
this.setDesiredInfo(true);
|
|
123
124
|
}
|
|
124
125
|
});
|