hoffmation-base 0.1.1 → 0.1.5
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/.eslintrc.js +27 -27
- package/.github/workflows/npm-publish.yml +50 -0
- package/.prettierrc.js +9 -9
- package/LICENSE +21 -21
- package/index.js +1 -1
- package/models/connectionCallbacks.ts +13 -13
- package/models/daytime.ts +3 -3
- package/models/deviceConfig.ts +8 -8
- package/models/dimmerSettings.ts +5 -5
- package/models/iTemperaturDataPoint.ts +9 -9
- package/models/lampSettings.ts +5 -5
- package/models/ledSettings.ts +19 -19
- package/models/logLevel.ts +9 -9
- package/models/persistence/BasicRoomInfo.ts +3 -3
- package/models/persistence/DailyMovementCount.ts +3 -3
- package/models/persistence/RoomDetailInfo.ts +4 -4
- package/models/persistence/temperaturDataPoint.ts +12 -12
- package/models/persistence/todaysCount.ts +3 -3
- package/models/rooms/RoomBase.ts +357 -357
- package/models/rooms/RoomSettings/RoomSettings.ts +159 -159
- package/models/rooms/RoomSettings/hmIPRoomSettings.ts +53 -53
- package/models/rooms/RoomSettings/iRoomDefaultSettings.ts +17 -17
- package/models/rooms/RoomSettings/readme.md +17 -17
- package/models/rooms/RoomSettings/zigbeeRoomSettings.ts +51 -51
- package/models/rooms/iRoomImportEnforcer.ts +3 -3
- package/models/rooms/readme.md +11 -11
- package/models/temperaturSettings.ts +22 -22
- package/models/timeCallback.ts +90 -90
- package/package.json +1 -1
- package/server/config/config-readme.md +19 -19
- package/server/config/iConfig.ts +53 -53
- package/server/config/private/mainConfig.json +64 -64
- package/server/devices/DeviceInfo.ts +66 -66
- package/server/devices/Griffe.ts +31 -31
- package/server/devices/Heizgruppen.ts +91 -91
- package/server/devices/Rollos.ts +48 -48
- package/server/devices/deviceUpdater.ts +72 -72
- package/server/devices/devices.ts +189 -189
- package/server/devices/groups/fensterGroup.ts +175 -175
- package/server/devices/groups/heatGroup.ts +32 -32
- package/server/devices/groups/lampenGroup.ts +88 -88
- package/server/devices/groups/praesenzGroup.ts +182 -182
- package/server/devices/groups/smokeGroup.ts +16 -16
- package/server/devices/groups/sonosGroup.ts +33 -33
- package/server/devices/groups/tasterGroup.ts +48 -48
- package/server/devices/groups/waterGroup.ts +16 -16
- package/server/devices/hmIPDevices/Fenster.ts +114 -114
- package/server/devices/hmIPDevices/FensterPosition.ts +5 -5
- package/server/devices/hmIPDevices/TuerPosition.ts +4 -4
- package/server/devices/hmIPDevices/hmIpBewegung.ts +126 -126
- package/server/devices/hmIPDevices/hmIpDevice.ts +90 -90
- package/server/devices/hmIPDevices/hmIpDeviceType.ts +14 -14
- package/server/devices/hmIPDevices/hmIpGriff.ts +143 -143
- package/server/devices/hmIPDevices/hmIpHeizgruppe.ts +172 -172
- package/server/devices/hmIPDevices/hmIpHeizung.ts +69 -69
- package/server/devices/hmIPDevices/hmIpLampe.ts +119 -119
- package/server/devices/hmIPDevices/hmIpPraezenz.ts +99 -99
- package/server/devices/hmIPDevices/hmIpRoll.ts +133 -133
- package/server/devices/hmIPDevices/hmIpTaster.ts +82 -73
- package/server/devices/hmIPDevices/hmIpTherm.ts +19 -19
- package/server/devices/hmIPDevices/hmIpTuer.ts +115 -115
- package/server/devices/hmIPDevices/hmIpWippe.ts +55 -55
- package/server/devices/iDeviceUpdater.ts +4 -4
- package/server/devices/iIoBrokerDevice.ts +44 -44
- package/server/devices/iTaster.ts +6 -0
- package/server/devices/{hmIPDevices/hmIpTaste.ts → taste.ts} +84 -72
- package/server/devices/wledDevice.ts +124 -124
- package/server/devices/zigbee/ZigbeeActuator.ts +113 -113
- package/server/devices/zigbee/zigbeeAquaraVibra.ts +171 -171
- package/server/devices/zigbee/zigbeeAquaraWater.ts +94 -94
- package/server/devices/zigbee/zigbeeBlitzShp.ts +77 -77
- package/server/devices/zigbee/zigbeeDevice.ts +115 -115
- package/server/devices/zigbee/zigbeeDeviceType.ts +13 -13
- package/server/devices/zigbee/zigbeeHeimanSmoke.ts +99 -99
- package/server/devices/zigbee/zigbeeIkeaSteckdose.ts +31 -31
- package/server/devices/zigbee/zigbeeIlluActuator.ts +37 -37
- package/server/devices/zigbee/zigbeeIlluDimmer.ts +165 -165
- package/server/devices/zigbee/zigbeeIlluLampe.ts +33 -33
- package/server/devices/zigbee/zigbeeIlluLedRGBCCT.ts +137 -137
- package/server/ioBroker/connection.ts +1655 -1655
- package/server/ioBroker/ioBroker.main.ts +99 -99
- package/server/ioBroker/socketIOAuthInfo.ts +5 -5
- package/server/ioBroker/socketIOConnectOptions.ts +6 -6
- package/server/ioBroker/socketIOLogging.ts +29 -29
- package/server/ioBroker/socketIOVisCommand.ts +11 -11
- package/server/services/HTTPSOptions.ts +14 -14
- package/server/services/Sonos/OwnSonosDevices.ts +9 -0
- package/server/services/Sonos/mp3-server.ts +75 -75
- package/server/services/Sonos/polly-service.ts +100 -100
- package/server/services/Sonos/sonos-service.ts +194 -199
- package/server/services/Telegram/telegram-Commands.ts +237 -215
- package/server/services/Telegram/telegram-service.ts +171 -171
- package/server/services/Telegram/telegramMessageCalback.ts +11 -11
- package/server/services/calendar/muell-tonne.ts +82 -83
- package/server/services/calendar/m/303/274ll-service.ts +147 -146
- package/server/services/dbo/persist.ts +125 -125
- package/server/services/https-service.ts +71 -71
- package/server/services/log-service.ts +69 -69
- package/server/services/news-service.ts +81 -81
- package/server/services/settings-service.ts +15 -15
- package/server/services/time-callback-service.ts +223 -223
- package/server/services/utils/ringstorage.ts +24 -24
- package/server/services/utils/utils.ts +52 -52
- package/server/services/weather/weather-alert.ts +7 -7
- package/server/services/weather/weather-current.ts +26 -26
- package/server/services/weather/weather-daily.ts +22 -22
- package/server/services/weather/weather-feelsLike.ts +6 -6
- package/server/services/weather/weather-hourly.ts +17 -17
- package/server/services/weather/weather-item.ts +6 -6
- package/server/services/weather/weather-minutes.ts +4 -4
- package/server/services/weather/weather-service.ts +277 -277
- package/server/services/weather/weather-temp.ts +8 -8
- package/tsconfig.json +58 -58
package/server/devices/Griffe.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { Devices } from './devices';
|
|
2
|
-
import { FensterPosition } from './hmIPDevices/FensterPosition';
|
|
3
|
-
import { HmIpDeviceType } from './hmIPDevices/hmIpDeviceType';
|
|
4
|
-
import { HmIpGriff } from './hmIPDevices/hmIpGriff';
|
|
5
|
-
|
|
6
|
-
export class Griffe {
|
|
7
|
-
public static getGriffPosition(): string {
|
|
8
|
-
const griffe: HmIpGriff[] = Griffe.getAllGriffe();
|
|
9
|
-
griffe.sort((a, b): number => {
|
|
10
|
-
a.position;
|
|
11
|
-
return b.position - a.position;
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
const response: string[] = [`Dies sind die aktuellen Stellungen der FensterGriffe:`];
|
|
15
|
-
for (const g of griffe) {
|
|
16
|
-
response.push(`${FensterPosition[g.position]} Fenster: "${g.info.customName}"`);
|
|
17
|
-
}
|
|
18
|
-
return response.join('\n');
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
public static getAllGriffe(): HmIpGriff[] {
|
|
22
|
-
const griffe: HmIpGriff[] = [];
|
|
23
|
-
for (const dID in Devices.hmIP) {
|
|
24
|
-
const d = Devices.hmIP[dID];
|
|
25
|
-
if (d.deviceType === HmIpDeviceType.HmIpGriff) {
|
|
26
|
-
griffe.push(d as HmIpGriff);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return griffe;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
1
|
+
import { Devices } from './devices';
|
|
2
|
+
import { FensterPosition } from './hmIPDevices/FensterPosition';
|
|
3
|
+
import { HmIpDeviceType } from './hmIPDevices/hmIpDeviceType';
|
|
4
|
+
import { HmIpGriff } from './hmIPDevices/hmIpGriff';
|
|
5
|
+
|
|
6
|
+
export class Griffe {
|
|
7
|
+
public static getGriffPosition(): string {
|
|
8
|
+
const griffe: HmIpGriff[] = Griffe.getAllGriffe();
|
|
9
|
+
griffe.sort((a, b): number => {
|
|
10
|
+
a.position;
|
|
11
|
+
return b.position - a.position;
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const response: string[] = [`Dies sind die aktuellen Stellungen der FensterGriffe:`];
|
|
15
|
+
for (const g of griffe) {
|
|
16
|
+
response.push(`${FensterPosition[g.position]} Fenster: "${g.info.customName}"`);
|
|
17
|
+
}
|
|
18
|
+
return response.join('\n');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public static getAllGriffe(): HmIpGriff[] {
|
|
22
|
+
const griffe: HmIpGriff[] = [];
|
|
23
|
+
for (const dID in Devices.hmIP) {
|
|
24
|
+
const d = Devices.hmIP[dID];
|
|
25
|
+
if (d.deviceType === HmIpDeviceType.HmIpGriff) {
|
|
26
|
+
griffe.push(d as HmIpGriff);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return griffe;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
import { Persist } from '../services/dbo/persist';
|
|
2
|
-
import { Devices } from './devices';
|
|
3
|
-
import { HmIpDeviceType } from './hmIPDevices/hmIpDeviceType';
|
|
4
|
-
import { HmIpHeizgruppe } from './hmIPDevices/hmIpHeizgruppe';
|
|
5
|
-
import { HmIpHeizung } from './hmIPDevices/hmIpHeizung';
|
|
6
|
-
import { TemperaturDataPoint } from '../../models/persistence/temperaturDataPoint';
|
|
7
|
-
|
|
8
|
-
export class Heizgruppen {
|
|
9
|
-
public static getInfo(): string {
|
|
10
|
-
const gruppen: HmIpHeizgruppe[] = Heizgruppen.getAllGruppen();
|
|
11
|
-
gruppen.sort((a, b): number => {
|
|
12
|
-
return a.info.customName.localeCompare(b.info.customName);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
const response: string[] = [`Dies sind die aktuellen Informationen der Heizungen:`];
|
|
16
|
-
response.push(`Name\t\tLuft Feuchtigkeit\t\tAktuelle Temperatur\t\tSoll Temperatur\t\tVentilstellung`);
|
|
17
|
-
for (const g of gruppen) {
|
|
18
|
-
response.push(
|
|
19
|
-
`${g.info.customName}:\t\t${g.humidity}%\t\t${g.sTemperatur}\t\t${g.desiredTemperatur}°C\t\t${g.sLevel}`,
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
return response.join('\n');
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
public static async getSpecificInfo(pText: string | undefined): Promise<string> {
|
|
26
|
-
if (pText === undefined || !pText.includes('"')) {
|
|
27
|
-
return `Bitte übergeben Sie eine Heizgruppe innerhalb von "". z.B. "EG Flur HeizGr"`;
|
|
28
|
-
}
|
|
29
|
-
const searchText = pText.split('"')[1];
|
|
30
|
-
const group: HmIpHeizgruppe | undefined = this.getSpecificGroup(searchText);
|
|
31
|
-
|
|
32
|
-
if (group === undefined) {
|
|
33
|
-
return `"${searchText}" ist keine gültige Heizgruppe, im Folgenden ist eine Liste aller gültigen Heizgruppen:\n${this.getInfo()}`;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const results: TemperaturDataPoint[] = await Persist.readTemperaturDataPoint(group, 20);
|
|
37
|
-
const response: string[] = [`Dies sind die letzten 20 Messpunkte der Heizgruppe:`];
|
|
38
|
-
response.push(`Zeitpunkt\t\tIst-Temperatur\t\tSoll-Temperatur\t\tVentilstellung`);
|
|
39
|
-
for (const r of results) {
|
|
40
|
-
response.push(
|
|
41
|
-
`${r.date.toLocaleTimeString('de-DE')}:\t\t${r.istTemperatur}°C\t\t${r.sollTemperatur}°C\t\t${r.level}%`,
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
return response.join('\n');
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
public static getProblems(): string {
|
|
48
|
-
const groups: HmIpHeizgruppe[] = this.getAllGruppen();
|
|
49
|
-
|
|
50
|
-
const response: string[] = [`Dies sind die bestehenden Differenzen:`];
|
|
51
|
-
response.push(`Raumname\t\tIst-Temperatur\t\tGerät`);
|
|
52
|
-
for (const g of groups) {
|
|
53
|
-
const heizungen: HmIpHeizung[] = g.getBelongingHeizungen();
|
|
54
|
-
const tempProblem: string[] = [`${g.info.room}\t\t${g.iTemperatur}°C\t\t${g.info.customName}`];
|
|
55
|
-
let print = false;
|
|
56
|
-
for (const h of heizungen) {
|
|
57
|
-
if (h.iTemperatur !== g.iTemperatur) {
|
|
58
|
-
print = true;
|
|
59
|
-
}
|
|
60
|
-
tempProblem.push(`${h.info.room}\t\t${h.iTemperatur}°C\t\t${h.info.customName}`);
|
|
61
|
-
}
|
|
62
|
-
if (print) {
|
|
63
|
-
response.push(tempProblem.join('\n'));
|
|
64
|
-
response.push(' ');
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return response.join('\n');
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
public static getAllGruppen(): HmIpHeizgruppe[] {
|
|
71
|
-
const gruppen: HmIpHeizgruppe[] = [];
|
|
72
|
-
for (const dID in Devices.hmIP) {
|
|
73
|
-
const d = Devices.hmIP[dID];
|
|
74
|
-
if (d.deviceType === HmIpDeviceType.HmIpHeizgruppe) {
|
|
75
|
-
gruppen.push(d as HmIpHeizgruppe);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return gruppen;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
public static getSpecificGroup(name: string): HmIpHeizgruppe | undefined {
|
|
82
|
-
for (const dID in Devices.hmIP) {
|
|
83
|
-
const d = Devices.hmIP[dID];
|
|
84
|
-
if (d.deviceType === HmIpDeviceType.HmIpHeizgruppe && d.info.customName === name) {
|
|
85
|
-
return d as HmIpHeizgruppe;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return undefined;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
1
|
+
import { Persist } from '../services/dbo/persist';
|
|
2
|
+
import { Devices } from './devices';
|
|
3
|
+
import { HmIpDeviceType } from './hmIPDevices/hmIpDeviceType';
|
|
4
|
+
import { HmIpHeizgruppe } from './hmIPDevices/hmIpHeizgruppe';
|
|
5
|
+
import { HmIpHeizung } from './hmIPDevices/hmIpHeizung';
|
|
6
|
+
import { TemperaturDataPoint } from '../../models/persistence/temperaturDataPoint';
|
|
7
|
+
|
|
8
|
+
export class Heizgruppen {
|
|
9
|
+
public static getInfo(): string {
|
|
10
|
+
const gruppen: HmIpHeizgruppe[] = Heizgruppen.getAllGruppen();
|
|
11
|
+
gruppen.sort((a, b): number => {
|
|
12
|
+
return a.info.customName.localeCompare(b.info.customName);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const response: string[] = [`Dies sind die aktuellen Informationen der Heizungen:`];
|
|
16
|
+
response.push(`Name\t\tLuft Feuchtigkeit\t\tAktuelle Temperatur\t\tSoll Temperatur\t\tVentilstellung`);
|
|
17
|
+
for (const g of gruppen) {
|
|
18
|
+
response.push(
|
|
19
|
+
`${g.info.customName}:\t\t${g.humidity}%\t\t${g.sTemperatur}\t\t${g.desiredTemperatur}°C\t\t${g.sLevel}`,
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
return response.join('\n');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public static async getSpecificInfo(pText: string | undefined): Promise<string> {
|
|
26
|
+
if (pText === undefined || !pText.includes('"')) {
|
|
27
|
+
return `Bitte übergeben Sie eine Heizgruppe innerhalb von "". z.B. "EG Flur HeizGr"`;
|
|
28
|
+
}
|
|
29
|
+
const searchText = pText.split('"')[1];
|
|
30
|
+
const group: HmIpHeizgruppe | undefined = this.getSpecificGroup(searchText);
|
|
31
|
+
|
|
32
|
+
if (group === undefined) {
|
|
33
|
+
return `"${searchText}" ist keine gültige Heizgruppe, im Folgenden ist eine Liste aller gültigen Heizgruppen:\n${this.getInfo()}`;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const results: TemperaturDataPoint[] = await Persist.readTemperaturDataPoint(group, 20);
|
|
37
|
+
const response: string[] = [`Dies sind die letzten 20 Messpunkte der Heizgruppe:`];
|
|
38
|
+
response.push(`Zeitpunkt\t\tIst-Temperatur\t\tSoll-Temperatur\t\tVentilstellung`);
|
|
39
|
+
for (const r of results) {
|
|
40
|
+
response.push(
|
|
41
|
+
`${r.date.toLocaleTimeString('de-DE')}:\t\t${r.istTemperatur}°C\t\t${r.sollTemperatur}°C\t\t${r.level}%`,
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
return response.join('\n');
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public static getProblems(): string {
|
|
48
|
+
const groups: HmIpHeizgruppe[] = this.getAllGruppen();
|
|
49
|
+
|
|
50
|
+
const response: string[] = [`Dies sind die bestehenden Differenzen:`];
|
|
51
|
+
response.push(`Raumname\t\tIst-Temperatur\t\tGerät`);
|
|
52
|
+
for (const g of groups) {
|
|
53
|
+
const heizungen: HmIpHeizung[] = g.getBelongingHeizungen();
|
|
54
|
+
const tempProblem: string[] = [`${g.info.room}\t\t${g.iTemperatur}°C\t\t${g.info.customName}`];
|
|
55
|
+
let print = false;
|
|
56
|
+
for (const h of heizungen) {
|
|
57
|
+
if (h.iTemperatur !== g.iTemperatur) {
|
|
58
|
+
print = true;
|
|
59
|
+
}
|
|
60
|
+
tempProblem.push(`${h.info.room}\t\t${h.iTemperatur}°C\t\t${h.info.customName}`);
|
|
61
|
+
}
|
|
62
|
+
if (print) {
|
|
63
|
+
response.push(tempProblem.join('\n'));
|
|
64
|
+
response.push(' ');
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return response.join('\n');
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
public static getAllGruppen(): HmIpHeizgruppe[] {
|
|
71
|
+
const gruppen: HmIpHeizgruppe[] = [];
|
|
72
|
+
for (const dID in Devices.hmIP) {
|
|
73
|
+
const d = Devices.hmIP[dID];
|
|
74
|
+
if (d.deviceType === HmIpDeviceType.HmIpHeizgruppe) {
|
|
75
|
+
gruppen.push(d as HmIpHeizgruppe);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return gruppen;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
public static getSpecificGroup(name: string): HmIpHeizgruppe | undefined {
|
|
82
|
+
for (const dID in Devices.hmIP) {
|
|
83
|
+
const d = Devices.hmIP[dID];
|
|
84
|
+
if (d.deviceType === HmIpDeviceType.HmIpHeizgruppe && d.info.customName === name) {
|
|
85
|
+
return d as HmIpHeizgruppe;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
}
|
package/server/devices/Rollos.ts
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import { Devices } from './devices';
|
|
2
|
-
import { HmIpDeviceType } from './hmIPDevices/hmIpDeviceType';
|
|
3
|
-
import { HmIpRoll } from './hmIPDevices/hmIpRoll';
|
|
4
|
-
import { RoomBase } from '../../models/rooms/RoomBase';
|
|
5
|
-
|
|
6
|
-
export class Rolladen {
|
|
7
|
-
public static getRolladenPosition(): string {
|
|
8
|
-
const rollos: HmIpRoll[] = Rolladen.getAllRollos();
|
|
9
|
-
rollos.sort((a, b): number => {
|
|
10
|
-
return b.currentLevel - a.currentLevel;
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
const response: string[] = [`Dies sind die aktuellen Rollo Positionen:`];
|
|
14
|
-
for (const r of rollos) {
|
|
15
|
-
response.push(`${r.currentLevel}% Rollo: "${r.info.customName}" Gewünschte Position: ${r.desiredFensterLevel}`);
|
|
16
|
-
}
|
|
17
|
-
response.push(`\nDie nächsten Zeiten zum Hochfahren:`);
|
|
18
|
-
const down: string[] = [`\nDie nächsten Zeiten zum Runterfahren:`];
|
|
19
|
-
const rooms: RoomBase[] = RoomBase.allRooms;
|
|
20
|
-
for (const r of rooms) {
|
|
21
|
-
for (const f of r.FensterGroup.fenster) {
|
|
22
|
-
if (f.rollo) {
|
|
23
|
-
response.push(
|
|
24
|
-
`Rollo: "${f.rollo.info.customName}"\t${
|
|
25
|
-
f.noRolloOnSunrise ? 'Hochfahren inaktiv' : r.sonnenAufgangCallback?.nextToDo?.toLocaleTimeString()
|
|
26
|
-
}`,
|
|
27
|
-
);
|
|
28
|
-
down.push(
|
|
29
|
-
`Rollo: "${f.rollo.info.customName}"\t${r.sonnenUntergangCallback?.nextToDo?.toLocaleTimeString()}`,
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
response.push(down.join('\n'));
|
|
35
|
-
return response.join('\n');
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
public static getAllRollos(): HmIpRoll[] {
|
|
39
|
-
const rollos: HmIpRoll[] = [];
|
|
40
|
-
for (const dID in Devices.hmIP) {
|
|
41
|
-
const d = Devices.hmIP[dID];
|
|
42
|
-
if (d.deviceType === HmIpDeviceType.HmIpRoll) {
|
|
43
|
-
rollos.push(d as HmIpRoll);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return rollos;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
1
|
+
import { Devices } from './devices';
|
|
2
|
+
import { HmIpDeviceType } from './hmIPDevices/hmIpDeviceType';
|
|
3
|
+
import { HmIpRoll } from './hmIPDevices/hmIpRoll';
|
|
4
|
+
import { RoomBase } from '../../models/rooms/RoomBase';
|
|
5
|
+
|
|
6
|
+
export class Rolladen {
|
|
7
|
+
public static getRolladenPosition(): string {
|
|
8
|
+
const rollos: HmIpRoll[] = Rolladen.getAllRollos();
|
|
9
|
+
rollos.sort((a, b): number => {
|
|
10
|
+
return b.currentLevel - a.currentLevel;
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const response: string[] = [`Dies sind die aktuellen Rollo Positionen:`];
|
|
14
|
+
for (const r of rollos) {
|
|
15
|
+
response.push(`${r.currentLevel}% Rollo: "${r.info.customName}" Gewünschte Position: ${r.desiredFensterLevel}`);
|
|
16
|
+
}
|
|
17
|
+
response.push(`\nDie nächsten Zeiten zum Hochfahren:`);
|
|
18
|
+
const down: string[] = [`\nDie nächsten Zeiten zum Runterfahren:`];
|
|
19
|
+
const rooms: RoomBase[] = RoomBase.allRooms;
|
|
20
|
+
for (const r of rooms) {
|
|
21
|
+
for (const f of r.FensterGroup.fenster) {
|
|
22
|
+
if (f.rollo) {
|
|
23
|
+
response.push(
|
|
24
|
+
`Rollo: "${f.rollo.info.customName}"\t${
|
|
25
|
+
f.noRolloOnSunrise ? 'Hochfahren inaktiv' : r.sonnenAufgangCallback?.nextToDo?.toLocaleTimeString()
|
|
26
|
+
}`,
|
|
27
|
+
);
|
|
28
|
+
down.push(
|
|
29
|
+
`Rollo: "${f.rollo.info.customName}"\t${r.sonnenUntergangCallback?.nextToDo?.toLocaleTimeString()}`,
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
response.push(down.join('\n'));
|
|
35
|
+
return response.join('\n');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public static getAllRollos(): HmIpRoll[] {
|
|
39
|
+
const rollos: HmIpRoll[] = [];
|
|
40
|
+
for (const dID in Devices.hmIP) {
|
|
41
|
+
const d = Devices.hmIP[dID];
|
|
42
|
+
if (d.deviceType === HmIpDeviceType.HmIpRoll) {
|
|
43
|
+
rollos.push(d as HmIpRoll);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return rollos;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
import { LogLevel } from '../../models/logLevel';
|
|
2
|
-
import { ServerLogService } from '../services/log-service';
|
|
3
|
-
import { Devices } from './devices';
|
|
4
|
-
import { HmIPDevice } from './hmIPDevices/hmIpDevice';
|
|
5
|
-
import { IDeviceUpdater } from './iDeviceUpdater';
|
|
6
|
-
import { ZigbeeDevice } from './zigbee/zigbeeDevice';
|
|
7
|
-
|
|
8
|
-
export class DeviceUpdater implements IDeviceUpdater {
|
|
9
|
-
private static IDENTIFIER_HOMEMATIC: string = 'hm-rpc';
|
|
10
|
-
private static IDENTIFIER_ZIGBEE: string = 'zigbee';
|
|
11
|
-
public devices: Devices;
|
|
12
|
-
|
|
13
|
-
constructor(pDevices: Devices) {
|
|
14
|
-
this.devices = pDevices;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
public updateObject(pId: string, pObj: ioBroker.Object): void {
|
|
18
|
-
const idSplit: string[] = pId.split('.');
|
|
19
|
-
if (idSplit.length < 2) return;
|
|
20
|
-
|
|
21
|
-
if (idSplit[0] === DeviceUpdater.IDENTIFIER_HOMEMATIC) {
|
|
22
|
-
console.log(`Neuer Wert in HomematicIP für ${pId}: ${JSON.stringify(pObj)}`);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public updateState(id: string, state: ioBroker.State, initial: boolean = false): void {
|
|
27
|
-
if (state === null) {
|
|
28
|
-
// Ignore null states
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
const idSplit: string[] = id.split('.');
|
|
32
|
-
if (idSplit.length < 2) return;
|
|
33
|
-
|
|
34
|
-
if (idSplit[0] === DeviceUpdater.IDENTIFIER_HOMEMATIC) {
|
|
35
|
-
try {
|
|
36
|
-
this.updateHomeMaticDevice(idSplit, state, initial);
|
|
37
|
-
} catch (e: any) {
|
|
38
|
-
ServerLogService.writeLog(
|
|
39
|
-
LogLevel.Alert,
|
|
40
|
-
`deviceUpdater.updateState('${id}', '${state}'): Error occured updating Device: ${e} \n ${e.stack}`,
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
} else if (idSplit[0] === DeviceUpdater.IDENTIFIER_ZIGBEE) {
|
|
44
|
-
try {
|
|
45
|
-
this.updateZigbeeDevice(idSplit, state, initial);
|
|
46
|
-
} catch (e: any) {
|
|
47
|
-
ServerLogService.writeLog(
|
|
48
|
-
LogLevel.Alert,
|
|
49
|
-
`deviceUpdater.updateState('${id}', '${state}'): Error occured updating Device: ${e} \n ${e.stack}`,
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
} else {
|
|
53
|
-
ServerLogService.writeLog(LogLevel.DeepTrace, `unbekannter Identifier: "${idSplit[0]}"`);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
private updateHomeMaticDevice(idSplit: string[], state: ioBroker.State, initial: boolean = false) {
|
|
58
|
-
const device: undefined | HmIPDevice = Devices.hmIP[idSplit[2]];
|
|
59
|
-
if (typeof device === 'undefined') {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
device.update(idSplit, state, initial);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
private updateZigbeeDevice(idSplit: string[], state: ioBroker.State, initial: boolean = false) {
|
|
66
|
-
const device: undefined | ZigbeeDevice = Devices.Zigbee[idSplit[2]];
|
|
67
|
-
if (typeof device === 'undefined') {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
device.update(idSplit, state, initial);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
1
|
+
import { LogLevel } from '../../models/logLevel';
|
|
2
|
+
import { ServerLogService } from '../services/log-service';
|
|
3
|
+
import { Devices } from './devices';
|
|
4
|
+
import { HmIPDevice } from './hmIPDevices/hmIpDevice';
|
|
5
|
+
import { IDeviceUpdater } from './iDeviceUpdater';
|
|
6
|
+
import { ZigbeeDevice } from './zigbee/zigbeeDevice';
|
|
7
|
+
|
|
8
|
+
export class DeviceUpdater implements IDeviceUpdater {
|
|
9
|
+
private static IDENTIFIER_HOMEMATIC: string = 'hm-rpc';
|
|
10
|
+
private static IDENTIFIER_ZIGBEE: string = 'zigbee';
|
|
11
|
+
public devices: Devices;
|
|
12
|
+
|
|
13
|
+
constructor(pDevices: Devices) {
|
|
14
|
+
this.devices = pDevices;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public updateObject(pId: string, pObj: ioBroker.Object): void {
|
|
18
|
+
const idSplit: string[] = pId.split('.');
|
|
19
|
+
if (idSplit.length < 2) return;
|
|
20
|
+
|
|
21
|
+
if (idSplit[0] === DeviceUpdater.IDENTIFIER_HOMEMATIC) {
|
|
22
|
+
console.log(`Neuer Wert in HomematicIP für ${pId}: ${JSON.stringify(pObj)}`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public updateState(id: string, state: ioBroker.State, initial: boolean = false): void {
|
|
27
|
+
if (state === null) {
|
|
28
|
+
// Ignore null states
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const idSplit: string[] = id.split('.');
|
|
32
|
+
if (idSplit.length < 2) return;
|
|
33
|
+
|
|
34
|
+
if (idSplit[0] === DeviceUpdater.IDENTIFIER_HOMEMATIC) {
|
|
35
|
+
try {
|
|
36
|
+
this.updateHomeMaticDevice(idSplit, state, initial);
|
|
37
|
+
} catch (e: any) {
|
|
38
|
+
ServerLogService.writeLog(
|
|
39
|
+
LogLevel.Alert,
|
|
40
|
+
`deviceUpdater.updateState('${id}', '${state}'): Error occured updating Device: ${e} \n ${e.stack}`,
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
} else if (idSplit[0] === DeviceUpdater.IDENTIFIER_ZIGBEE) {
|
|
44
|
+
try {
|
|
45
|
+
this.updateZigbeeDevice(idSplit, state, initial);
|
|
46
|
+
} catch (e: any) {
|
|
47
|
+
ServerLogService.writeLog(
|
|
48
|
+
LogLevel.Alert,
|
|
49
|
+
`deviceUpdater.updateState('${id}', '${state}'): Error occured updating Device: ${e} \n ${e.stack}`,
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
} else {
|
|
53
|
+
ServerLogService.writeLog(LogLevel.DeepTrace, `unbekannter Identifier: "${idSplit[0]}"`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
private updateHomeMaticDevice(idSplit: string[], state: ioBroker.State, initial: boolean = false) {
|
|
58
|
+
const device: undefined | HmIPDevice = Devices.hmIP[idSplit[2]];
|
|
59
|
+
if (typeof device === 'undefined') {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
device.update(idSplit, state, initial);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
private updateZigbeeDevice(idSplit: string[], state: ioBroker.State, initial: boolean = false) {
|
|
66
|
+
const device: undefined | ZigbeeDevice = Devices.Zigbee[idSplit[2]];
|
|
67
|
+
if (typeof device === 'undefined') {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
device.update(idSplit, state, initial);
|
|
71
|
+
}
|
|
72
|
+
}
|