hoffmation-base 1.0.15 → 1.0.16
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/index.js +1 -1
- package/lib/server/devices/Heizgruppen.d.ts +0 -1
- package/lib/server/devices/Heizgruppen.js +2 -13
- package/lib/server/devices/baseDeviceInterfaces/iHumiditySensor.d.ts +1 -0
- package/lib/server/devices/baseDeviceInterfaces/iHumiditySensor.js +2 -0
- package/lib/server/devices/device-list.d.ts +2 -2
- package/lib/server/devices/device-list.js +6 -6
- package/lib/server/devices/groups/fensterGroup.js +1 -1
- package/lib/server/devices/groups/heatGroup.d.ts +11 -1
- package/lib/server/devices/groups/heatGroup.js +75 -41
- package/lib/server/devices/hmIPDevices/hmIpGriff.js +1 -1
- package/lib/server/devices/hmIPDevices/hmIpHeizgruppe.js +1 -1
- package/lib/server/devices/zigbee/zigbeeSonoffTemp.js +1 -1
- package/lib/server/services/Telegram/telegram-Commands.js +1 -1
- package/lib/server/services/ac/ac-device.d.ts +3 -1
- package/lib/server/services/ac/ac-device.js +3 -2
- package/lib/server/services/ac/acDeviceType.d.ts +4 -0
- package/lib/server/services/ac/acDeviceType.js +8 -0
- package/lib/server/services/ac/daikin-service.d.ts +2 -2
- package/lib/server/services/ac/daikin-service.js +9 -1
- package/lib/server/services/ac/index.d.ts +2 -1
- package/lib/server/services/ac/index.js +4 -2
- package/lib/server/services/ac/own-ac-devices.d.ts +7 -0
- package/lib/server/services/ac/{own-daikin-devices.js → own-ac-devices.js} +4 -4
- package/lib/server/services/ac/own-daikin-device.js +2 -1
- package/lib/server/services/api/api-service.d.ts +3 -3
- package/lib/server/services/api/api-service.js +2 -2
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/lib/server/services/ac/own-daikin-devices.d.ts +0 -7
package/lib/index.js
CHANGED
|
@@ -72,7 +72,7 @@ class HoffmationBase {
|
|
|
72
72
|
server_1.SonosService.initialize();
|
|
73
73
|
}
|
|
74
74
|
if ((_b = server_1.SettingsService.settings.daikin) === null || _b === void 0 ? void 0 : _b.active) {
|
|
75
|
-
server_1.DaikinService.addOwnDevices(server_1.
|
|
75
|
+
server_1.DaikinService.addOwnDevices(server_1.OwnAcDevices.ownDevices);
|
|
76
76
|
server_1.DaikinService.initialize();
|
|
77
77
|
}
|
|
78
78
|
server_1.Utils.guardedNewThread(() => {
|
|
@@ -4,19 +4,8 @@ exports.Heizgruppen = void 0;
|
|
|
4
4
|
const deviceType_1 = require("./deviceType");
|
|
5
5
|
const devices_1 = require("./devices");
|
|
6
6
|
const services_1 = require("../services");
|
|
7
|
+
const groups_1 = require("./groups");
|
|
7
8
|
class Heizgruppen {
|
|
8
|
-
static getInfo() {
|
|
9
|
-
const gruppen = Heizgruppen.getAllGruppen();
|
|
10
|
-
gruppen.sort((a, b) => {
|
|
11
|
-
return a.info.customName.localeCompare(b.info.customName);
|
|
12
|
-
});
|
|
13
|
-
const response = [`Dies sind die aktuellen Informationen der Heizungen:`];
|
|
14
|
-
response.push(`Name\t\tLuft Feuchtigkeit\t\tAktuelle Temperatur\t\tSoll Temperatur\t\tVentilstellung`);
|
|
15
|
-
for (const g of gruppen) {
|
|
16
|
-
response.push(`${g.info.customName}:\t\t${g.humidity}%\t\t${g.sTemperatur}\t\t${g.desiredTemperatur}°C\t\t${g.sLevel}`);
|
|
17
|
-
}
|
|
18
|
-
return response.join('\n');
|
|
19
|
-
}
|
|
20
9
|
static async getSpecificInfo(pText) {
|
|
21
10
|
var _a, _b;
|
|
22
11
|
if (pText === undefined || !pText.includes('"')) {
|
|
@@ -25,7 +14,7 @@ class Heizgruppen {
|
|
|
25
14
|
const searchText = pText.split('"')[1];
|
|
26
15
|
const group = this.getSpecificGroup(searchText);
|
|
27
16
|
if (group === undefined) {
|
|
28
|
-
return `"${searchText}" ist keine gültige Heizgruppe, im Folgenden ist eine Liste aller gültigen Heizgruppen:\n${
|
|
17
|
+
return `"${searchText}" ist keine gültige Heizgruppe, im Folgenden ist eine Liste aller gültigen Heizgruppen:\n${groups_1.HeatGroup.getInfo()}`;
|
|
29
18
|
}
|
|
30
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 : [];
|
|
31
20
|
const response = [`Dies sind die letzten 20 Messpunkte der Heizgruppe:`];
|
|
@@ -3,8 +3,8 @@ import { IBaseDevice } from './baseDeviceInterfaces';
|
|
|
3
3
|
export declare class DeviceList {
|
|
4
4
|
private _ids;
|
|
5
5
|
private readonly _isSonos;
|
|
6
|
-
private readonly
|
|
7
|
-
constructor(_ids?: string[], _isSonos?: boolean,
|
|
6
|
+
private readonly _isAc;
|
|
7
|
+
constructor(_ids?: string[], _isSonos?: boolean, _isAc?: boolean);
|
|
8
8
|
get ids(): string[];
|
|
9
9
|
getDevices(): Array<IBaseDevice | OwnSonosDevice | AcDevice>;
|
|
10
10
|
}
|
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DeviceList = void 0;
|
|
4
4
|
const services_1 = require("../services");
|
|
5
5
|
class DeviceList {
|
|
6
|
-
constructor(_ids = [], _isSonos = false,
|
|
6
|
+
constructor(_ids = [], _isSonos = false, _isAc = false) {
|
|
7
7
|
this._ids = _ids;
|
|
8
8
|
this._isSonos = _isSonos;
|
|
9
|
-
this.
|
|
9
|
+
this._isAc = _isAc;
|
|
10
10
|
// Empty
|
|
11
11
|
}
|
|
12
12
|
get ids() {
|
|
@@ -21,10 +21,10 @@ class DeviceList {
|
|
|
21
21
|
result.push(services_1.OwnSonosDevices.ownDevices[dID]);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
else if (this.
|
|
25
|
-
const
|
|
26
|
-
if (
|
|
27
|
-
result.push(services_1.
|
|
24
|
+
else if (this._isAc) {
|
|
25
|
+
const acDevice = services_1.OwnAcDevices.ownDevices[dID];
|
|
26
|
+
if (acDevice !== undefined) {
|
|
27
|
+
result.push(services_1.OwnAcDevices.ownDevices[dID]);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
@@ -84,7 +84,7 @@ class FensterGroup extends base_group_1.BaseGroup {
|
|
|
84
84
|
}
|
|
85
85
|
let desiredPos = f.desiredPosition;
|
|
86
86
|
if (desiredPos > 0) {
|
|
87
|
-
services_1.WeatherService.weatherRolloPosition(desiredPos, (_b = (_a = room.HeatGroup) === null || _a === void 0 ? void 0 : _a.desiredTemp) !== null && _b !== void 0 ? _b : -99, (_d = (_c = room.HeatGroup) === null || _c === void 0 ? void 0 : _c.
|
|
87
|
+
services_1.WeatherService.weatherRolloPosition(desiredPos, (_b = (_a = room.HeatGroup) === null || _a === void 0 ? void 0 : _a.desiredTemp) !== null && _b !== void 0 ? _b : -99, (_d = (_c = room.HeatGroup) === null || _c === void 0 ? void 0 : _c.temperature) !== null && _d !== void 0 ? _d : -99);
|
|
88
88
|
}
|
|
89
89
|
if (f.griffeInPosition(models_2.FensterPosition.offen) > 0 && desiredPos < 100) {
|
|
90
90
|
return;
|
|
@@ -3,8 +3,18 @@ import { iHeater, iHumiditySensor, iTemperaturSensor } from '../baseDeviceInterf
|
|
|
3
3
|
import { AcDevice } from '../../services';
|
|
4
4
|
export declare class HeatGroup extends BaseGroup {
|
|
5
5
|
constructor(roomName: string, heaterIds: string[], tempSensorIds: string[], humiditySensorIds: string[], acIds: string[]);
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* The current measured temperature of the room in Celsius
|
|
8
|
+
* @returns {number}
|
|
9
|
+
*/
|
|
10
|
+
get humidity(): number;
|
|
11
|
+
/**
|
|
12
|
+
* The current measured temperature of the room in Celsius
|
|
13
|
+
* @returns {number}
|
|
14
|
+
*/
|
|
15
|
+
get temperature(): number;
|
|
7
16
|
get desiredTemp(): number;
|
|
17
|
+
static getInfo(): string;
|
|
8
18
|
getHeater(): iHeater[];
|
|
9
19
|
getTempSensors(): iTemperaturSensor[];
|
|
10
20
|
getHumiditySensors(): iHumiditySensor[];
|
|
@@ -6,6 +6,7 @@ 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 services_1 = require("../../services");
|
|
9
10
|
const models_1 = require("../../../models");
|
|
10
11
|
class HeatGroup extends base_group_1.BaseGroup {
|
|
11
12
|
constructor(roomName, heaterIds, tempSensorIds, humiditySensorIds, acIds) {
|
|
@@ -13,18 +14,64 @@ class HeatGroup extends base_group_1.BaseGroup {
|
|
|
13
14
|
this.deviceCluster.deviceMap.set(device_cluster_type_1.DeviceClusterType.Heater, new device_list_1.DeviceList(heaterIds));
|
|
14
15
|
this.deviceCluster.deviceMap.set(device_cluster_type_1.DeviceClusterType.TemperaturSensor, new device_list_1.DeviceList(tempSensorIds));
|
|
15
16
|
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));
|
|
17
|
+
this.deviceCluster.deviceMap.set(device_cluster_type_1.DeviceClusterType.Ac, new device_list_1.DeviceList(acIds, false, true));
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
/**
|
|
20
|
+
* The current measured temperature of the room in Celsius
|
|
21
|
+
* @returns {number}
|
|
22
|
+
*/
|
|
23
|
+
get humidity() {
|
|
24
|
+
let humidity = baseDeviceInterfaces_1.UNDEFINED_HUMIDITY_VALUE;
|
|
25
|
+
let count = 0;
|
|
26
|
+
this.getHumiditySensors().forEach((sensor) => {
|
|
27
|
+
const sensorValue = sensor.humidity;
|
|
28
|
+
if (sensorValue === baseDeviceInterfaces_1.UNDEFINED_HUMIDITY_VALUE) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (count === 0) {
|
|
32
|
+
count = 1;
|
|
33
|
+
humidity = sensorValue;
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
humidity = (humidity * count + sensorValue) / ++count;
|
|
37
|
+
});
|
|
38
|
+
return humidity;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The current measured temperature of the room in Celsius
|
|
42
|
+
* @returns {number}
|
|
43
|
+
*/
|
|
44
|
+
get temperature() {
|
|
45
|
+
let temp = baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE;
|
|
46
|
+
let count = 0;
|
|
47
|
+
this.getTempSensors().forEach((sensor) => {
|
|
48
|
+
const sensorValue = sensor.iTemperatur;
|
|
49
|
+
if (sensorValue === baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (count === 0) {
|
|
53
|
+
count = 1;
|
|
54
|
+
temp = sensorValue;
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
temp = (temp * count + sensorValue) / ++count;
|
|
58
|
+
});
|
|
59
|
+
this.getHeater().forEach((heaterAsSensor) => {
|
|
60
|
+
if (!heaterAsSensor.settings.useOwnTemperatur) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const sensorValue = heaterAsSensor.iTemperatur;
|
|
64
|
+
if (sensorValue === baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (count === 0) {
|
|
68
|
+
count = 1;
|
|
69
|
+
temp = sensorValue;
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
temp = (temp * count + sensorValue) / ++count;
|
|
73
|
+
});
|
|
74
|
+
return temp;
|
|
28
75
|
}
|
|
29
76
|
get desiredTemp() {
|
|
30
77
|
if (this.getHeater().length === 0) {
|
|
@@ -36,6 +83,21 @@ class HeatGroup extends base_group_1.BaseGroup {
|
|
|
36
83
|
}
|
|
37
84
|
return Math.round((value / this.getHeater().length) * 10) / 10;
|
|
38
85
|
}
|
|
86
|
+
static getInfo() {
|
|
87
|
+
var _a, _b, _c;
|
|
88
|
+
const rooms = Array.from(services_1.API.getRooms().values()).filter((r) => {
|
|
89
|
+
return r.HeatGroup !== undefined;
|
|
90
|
+
});
|
|
91
|
+
rooms.sort((a, b) => {
|
|
92
|
+
return a.roomName.localeCompare(b.roomName);
|
|
93
|
+
});
|
|
94
|
+
const response = [`Dies sind die aktuellen Informationen der Heizungen:`];
|
|
95
|
+
response.push(`Name\t\tLuft Feuchtigkeit\t\tAktuelle Temperatur\t\tSoll Temperatur\t\tVentilstellung`);
|
|
96
|
+
for (const r of rooms) {
|
|
97
|
+
response.push(`${r.roomName}:\t\t${(_a = r.HeatGroup) === null || _a === void 0 ? void 0 : _a.humidity}%\t\t${(_b = r.HeatGroup) === null || _b === void 0 ? void 0 : _b.temperature}\t\t${(_c = r.HeatGroup) === null || _c === void 0 ? void 0 : _c.desiredTemp}°C`);
|
|
98
|
+
}
|
|
99
|
+
return response.join('\n');
|
|
100
|
+
}
|
|
39
101
|
getHeater() {
|
|
40
102
|
return this.deviceCluster.getDevicesByType(device_cluster_type_1.DeviceClusterType.Heater);
|
|
41
103
|
}
|
|
@@ -79,36 +141,8 @@ class HeatGroup extends base_group_1.BaseGroup {
|
|
|
79
141
|
}
|
|
80
142
|
}
|
|
81
143
|
recalcRoomTemperatur() {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
this.getTempSensors().forEach((sensor) => {
|
|
85
|
-
const sensorValue = sensor.iTemperatur;
|
|
86
|
-
if (sensorValue === baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE) {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
if (count === 0) {
|
|
90
|
-
count = 1;
|
|
91
|
-
temp = sensorValue;
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
temp = (temp * count + sensorValue) / ++count;
|
|
95
|
-
});
|
|
96
|
-
this.getHeater().forEach((heaterAsSensor) => {
|
|
97
|
-
if (!heaterAsSensor.settings.useOwnTemperatur) {
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
const sensorValue = heaterAsSensor.iTemperatur;
|
|
101
|
-
if (sensorValue === baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE) {
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
if (count === 0) {
|
|
105
|
-
count = 1;
|
|
106
|
-
temp = sensorValue;
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
temp = (temp * count + sensorValue) / ++count;
|
|
110
|
-
});
|
|
111
|
-
if (temp === baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE) {
|
|
144
|
+
const temp = this.temperature;
|
|
145
|
+
if (temp == baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE) {
|
|
112
146
|
return;
|
|
113
147
|
}
|
|
114
148
|
this.getHeater().forEach((heater) => {
|
|
@@ -75,7 +75,7 @@ class HmIpGriff extends hmIpDevice_1.HmIPDevice {
|
|
|
75
75
|
const heatgroup = (_a = this._fenster) === null || _a === void 0 ? void 0 : _a.getRoom().HeatGroup;
|
|
76
76
|
if (heatgroup !== undefined) {
|
|
77
77
|
const desiredTemp = heatgroup.desiredTemp;
|
|
78
|
-
const currentTemp = heatgroup.
|
|
78
|
+
const currentTemp = heatgroup.temperature;
|
|
79
79
|
const outSideTemp = services_1.WeatherService.getCurrentTemp();
|
|
80
80
|
// Check if any of these values are unavailable
|
|
81
81
|
if (desiredTemp > -99 && currentTemp > -99 && outSideTemp > -99) {
|
|
@@ -19,7 +19,7 @@ class HmIpHeizgruppe extends hmIpDevice_1.HmIPDevice {
|
|
|
19
19
|
this._temperaturCallbacks = [];
|
|
20
20
|
this._seasonTurnOff = false;
|
|
21
21
|
this._temperatur = baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE;
|
|
22
|
-
this._humidity =
|
|
22
|
+
this._humidity = baseDeviceInterfaces_1.UNDEFINED_HUMIDITY_VALUE;
|
|
23
23
|
this._desiredTemperatur = 0;
|
|
24
24
|
this._roomTemperatur = baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE;
|
|
25
25
|
this._setPointTemperaturID = `${this.info.fullID}.1.SET_POINT_TEMPERATURE`;
|
|
@@ -9,7 +9,7 @@ class ZigbeeSonoffTemp extends BaseDevices_1.ZigbeeDevice {
|
|
|
9
9
|
super(pInfo, deviceType_1.DeviceType.ZigbeeSonoffTemp);
|
|
10
10
|
this._humidityCallbacks = [];
|
|
11
11
|
this._temperaturCallbacks = [];
|
|
12
|
-
this._humidity =
|
|
12
|
+
this._humidity = baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE;
|
|
13
13
|
this._temperatur = baseDeviceInterfaces_1.UNDEFINED_TEMP_VALUE;
|
|
14
14
|
}
|
|
15
15
|
get humidity() {
|
|
@@ -69,7 +69,7 @@ class TelegramCommands {
|
|
|
69
69
|
telegram_service_1.TelegramService.addMessageCallback(new telegramMessageCalback_1.TelegramMessageCallback('HeizungCheck', /\/check_temperatur/, async (m) => {
|
|
70
70
|
if (m.from === undefined)
|
|
71
71
|
return false;
|
|
72
|
-
telegram_service_1.TelegramService.sendMessage([m.chat.id], devices_1.
|
|
72
|
+
telegram_service_1.TelegramService.sendMessage([m.chat.id], devices_1.HeatGroup.getInfo());
|
|
73
73
|
return true;
|
|
74
74
|
}, 'Gibt die Namen und aktuellen Werte sämtlicher Heizgruppen aus (aktuelle Temperatur, Soll Temperatur, Ventilstellung).'));
|
|
75
75
|
telegram_service_1.TelegramService.addMessageCallback(new telegramMessageCalback_1.TelegramMessageCallback('HeizungError', /\/temperatur_error/, async (m) => {
|
|
@@ -2,17 +2,19 @@ import { iExcessEnergyConsumer } from '../../devices';
|
|
|
2
2
|
import { ExcessEnergyConsumerSettings, LogLevel, RoomBase } from '../../../models';
|
|
3
3
|
import { AcMode } from './ac-mode';
|
|
4
4
|
import { AcSettings } from '../../../models/deviceSettings/acSettings';
|
|
5
|
+
import { AcDeviceType } from './acDeviceType';
|
|
5
6
|
export declare abstract class AcDevice implements iExcessEnergyConsumer {
|
|
6
7
|
name: string;
|
|
7
8
|
roomName: string;
|
|
8
9
|
ip: string;
|
|
10
|
+
acDeviceType: AcDeviceType;
|
|
9
11
|
currentConsumption: number;
|
|
10
12
|
energyConsumerSettings: ExcessEnergyConsumerSettings;
|
|
11
13
|
acSettings: AcSettings;
|
|
12
14
|
room: RoomBase | undefined;
|
|
13
15
|
protected _activatedByExcessEnergy: boolean;
|
|
14
16
|
protected _blockAutomaticTurnOnMS: number;
|
|
15
|
-
protected constructor(name: string, roomName: string, ip: string);
|
|
17
|
+
protected constructor(name: string, roomName: string, ip: string, acDeviceType: AcDeviceType);
|
|
16
18
|
abstract get on(): boolean;
|
|
17
19
|
isAvailableForExcessEnergy(): boolean;
|
|
18
20
|
calculateDesiredMode(): AcMode;
|
|
@@ -7,10 +7,11 @@ const log_service_1 = require("../log-service");
|
|
|
7
7
|
const ac_mode_1 = require("./ac-mode");
|
|
8
8
|
const acSettings_1 = require("../../../models/deviceSettings/acSettings");
|
|
9
9
|
class AcDevice {
|
|
10
|
-
constructor(name, roomName, ip) {
|
|
10
|
+
constructor(name, roomName, ip, acDeviceType) {
|
|
11
11
|
this.name = name;
|
|
12
12
|
this.roomName = roomName;
|
|
13
13
|
this.ip = ip;
|
|
14
|
+
this.acDeviceType = acDeviceType;
|
|
14
15
|
this.currentConsumption = -1;
|
|
15
16
|
this.energyConsumerSettings = new models_1.ExcessEnergyConsumerSettings();
|
|
16
17
|
this.acSettings = new acSettings_1.AcSettings();
|
|
@@ -32,7 +33,7 @@ class AcDevice {
|
|
|
32
33
|
}
|
|
33
34
|
calculateDesiredMode() {
|
|
34
35
|
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.
|
|
36
|
+
const temp = (_b = (_a = this.room) === null || _a === void 0 ? void 0 : _a.HeatGroup) === null || _b === void 0 ? void 0 : _b.temperature;
|
|
36
37
|
if (temp === undefined) {
|
|
37
38
|
this.log(models_1.LogLevel.Warn, `Can't calculate AC Mode as we have no room temperature`);
|
|
38
39
|
return ac_mode_1.AcMode.Off;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AcDeviceType = void 0;
|
|
4
|
+
var AcDeviceType;
|
|
5
|
+
(function (AcDeviceType) {
|
|
6
|
+
AcDeviceType[AcDeviceType["Unknown"] = 0] = "Unknown";
|
|
7
|
+
AcDeviceType[AcDeviceType["Daikin"] = 1] = "Daikin";
|
|
8
|
+
})(AcDeviceType = exports.AcDeviceType || (exports.AcDeviceType = {}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DaikinAC, DaikinManager } from 'daikin-controller';
|
|
2
|
-
import {
|
|
2
|
+
import { AcDevice } from './ac-device';
|
|
3
3
|
export declare class DaikinService {
|
|
4
4
|
private static _ownDevices;
|
|
5
5
|
private static _daikinManager;
|
|
@@ -7,7 +7,7 @@ export declare class DaikinService {
|
|
|
7
7
|
private static _isInitialized;
|
|
8
8
|
static get isInitialized(): boolean;
|
|
9
9
|
static addOwnDevices(daikinDevices: {
|
|
10
|
-
[name: string]:
|
|
10
|
+
[name: string]: AcDevice;
|
|
11
11
|
}): void;
|
|
12
12
|
static getDevice(name: string): DaikinAC | undefined;
|
|
13
13
|
static initialize(): Promise<void>;
|
|
@@ -9,6 +9,7 @@ const settings_service_1 = require("../settings-service");
|
|
|
9
9
|
const devices_1 = require("../../devices");
|
|
10
10
|
const network_1 = require("../network");
|
|
11
11
|
const utils_1 = require("../utils");
|
|
12
|
+
const acDeviceType_1 = require("./acDeviceType");
|
|
12
13
|
class DaikinService {
|
|
13
14
|
static get daikinManager() {
|
|
14
15
|
return this._daikinManager;
|
|
@@ -17,7 +18,14 @@ class DaikinService {
|
|
|
17
18
|
return this._isInitialized;
|
|
18
19
|
}
|
|
19
20
|
static addOwnDevices(daikinDevices) {
|
|
20
|
-
|
|
21
|
+
const toAdd = {};
|
|
22
|
+
for (const name in daikinDevices) {
|
|
23
|
+
const d = daikinDevices[name];
|
|
24
|
+
if (d.acDeviceType == acDeviceType_1.AcDeviceType.Daikin) {
|
|
25
|
+
toAdd[name] = d;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
this._ownDevices = toAdd;
|
|
21
29
|
}
|
|
22
30
|
static getDevice(name) {
|
|
23
31
|
return this.daikinManager.devices[name];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { AcMode } from './ac-mode';
|
|
2
|
+
export { AcDeviceType } from './acDeviceType';
|
|
2
3
|
export * from './daikin-service';
|
|
3
4
|
export * from './own-daikin-device';
|
|
4
|
-
export * from './own-
|
|
5
|
+
export * from './own-ac-devices';
|
|
5
6
|
export { AcDevice } from './ac-device';
|
|
@@ -14,11 +14,13 @@ 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.AcDevice = exports.AcMode = void 0;
|
|
17
|
+
exports.AcDevice = exports.AcDeviceType = exports.AcMode = void 0;
|
|
18
18
|
var ac_mode_1 = require("./ac-mode");
|
|
19
19
|
Object.defineProperty(exports, "AcMode", { enumerable: true, get: function () { return ac_mode_1.AcMode; } });
|
|
20
|
+
var acDeviceType_1 = require("./acDeviceType");
|
|
21
|
+
Object.defineProperty(exports, "AcDeviceType", { enumerable: true, get: function () { return acDeviceType_1.AcDeviceType; } });
|
|
20
22
|
__exportStar(require("./daikin-service"), exports);
|
|
21
23
|
__exportStar(require("./own-daikin-device"), exports);
|
|
22
|
-
__exportStar(require("./own-
|
|
24
|
+
__exportStar(require("./own-ac-devices"), exports);
|
|
23
25
|
var ac_device_1 = require("./ac-device");
|
|
24
26
|
Object.defineProperty(exports, "AcDevice", { enumerable: true, get: function () { return ac_device_1.AcDevice; } });
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.OwnAcDevices = void 0;
|
|
4
4
|
const log_service_1 = require("../log-service");
|
|
5
5
|
const models_1 = require("../../../models");
|
|
6
|
-
class
|
|
6
|
+
class OwnAcDevices {
|
|
7
7
|
static addDevice(device) {
|
|
8
8
|
log_service_1.ServerLogService.writeLog(models_1.LogLevel.Info, `Device ${device.name} for room "${device.roomName}" addded`);
|
|
9
9
|
this.ownDevices[device.name] = device;
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
exports.
|
|
13
|
-
|
|
12
|
+
exports.OwnAcDevices = OwnAcDevices;
|
|
13
|
+
OwnAcDevices.ownDevices = {};
|
|
@@ -9,9 +9,10 @@ const daikin_service_1 = require("./daikin-service");
|
|
|
9
9
|
const utils_1 = require("../utils");
|
|
10
10
|
const ac_device_1 = require("./ac-device");
|
|
11
11
|
const ac_mode_1 = require("./ac-mode");
|
|
12
|
+
const acDeviceType_1 = require("./acDeviceType");
|
|
12
13
|
class OwnDaikinDevice extends ac_device_1.AcDevice {
|
|
13
14
|
constructor(name, roomName, ip, device) {
|
|
14
|
-
super(name, roomName, ip);
|
|
15
|
+
super(name, roomName, ip, acDeviceType_1.AcDeviceType.Daikin);
|
|
15
16
|
this.desiredState = daikin_controller_1.Power.OFF;
|
|
16
17
|
this.desiredTemp = 21;
|
|
17
18
|
this.desiredHum = 'AUTO';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { IBaseDevice } from '../../devices';
|
|
2
2
|
import { RoomBase } from '../../../models';
|
|
3
3
|
import { LogObject } from '../log-service';
|
|
4
|
-
import {
|
|
4
|
+
import { AcDevice } from '../ac';
|
|
5
5
|
export declare class API {
|
|
6
6
|
/**
|
|
7
|
-
* Gets the instance of an
|
|
7
|
+
* Gets the instance of an Ac Device identified by name
|
|
8
8
|
* @param {string} name
|
|
9
9
|
* @returns {OwnDaikinDevice | undefined}
|
|
10
10
|
*/
|
|
11
|
-
static getAc(name: string):
|
|
11
|
+
static getAc(name: string): AcDevice | undefined;
|
|
12
12
|
static getDevices(): {
|
|
13
13
|
[id: string]: IBaseDevice;
|
|
14
14
|
};
|
|
@@ -8,12 +8,12 @@ const log_service_1 = require("../log-service");
|
|
|
8
8
|
const ac_1 = require("../ac");
|
|
9
9
|
class API {
|
|
10
10
|
/**
|
|
11
|
-
* Gets the instance of an
|
|
11
|
+
* Gets the instance of an Ac Device identified by name
|
|
12
12
|
* @param {string} name
|
|
13
13
|
* @returns {OwnDaikinDevice | undefined}
|
|
14
14
|
*/
|
|
15
15
|
static getAc(name) {
|
|
16
|
-
return ac_1.
|
|
16
|
+
return ac_1.OwnAcDevices.ownDevices[name];
|
|
17
17
|
}
|
|
18
18
|
static getDevices() {
|
|
19
19
|
// console.log(inspect(Devices.alLDevices, false, 3));
|