hoffmation-base 0.1.3 → 0.1.4
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/models/persistence/temperaturDataPoint.ts +1 -1
- package/package.json +1 -1
- package/server/ioBroker/ioBroker.main.ts +1 -1
- package/server/services/Sonos/OwnSonosDevices.ts +9 -0
- package/server/services/Sonos/sonos-service.ts +13 -18
- package/server/services/calendar/muell-tonne.ts +1 -2
- package/server/services/calendar/m/303/274ll-service.ts +1 -1
- package/server/services/dbo/persist.ts +1 -1
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@ import { IOBrokerConnection } from './connection';
|
|
|
8
8
|
import { ConnectionCallbacks } from '../../models/connectionCallbacks';
|
|
9
9
|
import { RoomBase } from '../../models/rooms/RoomBase';
|
|
10
10
|
import { Utils } from '../services/utils/utils';
|
|
11
|
-
import { SettingsService } from
|
|
11
|
+
import { SettingsService } from '../services/settings-service';
|
|
12
12
|
|
|
13
13
|
export class ioBrokerMain {
|
|
14
14
|
private static roomConstructors: { [roomName: string]: { new (): RoomBase } } = {};
|
|
@@ -13,11 +13,7 @@ export class OwnSonosDevice {
|
|
|
13
13
|
public playTestMessage() {
|
|
14
14
|
SonosService.speakOnDevice(`Ich bin ${this.name}`, this);
|
|
15
15
|
}
|
|
16
|
-
public constructor(
|
|
17
|
-
public name: string,
|
|
18
|
-
public roomName: string,
|
|
19
|
-
public device: SonosDevice | undefined,
|
|
20
|
-
) {};
|
|
16
|
+
public constructor(public name: string, public roomName: string, public device: SonosDevice | undefined) {}
|
|
21
17
|
}
|
|
22
18
|
|
|
23
19
|
export class SonosService {
|
|
@@ -32,7 +28,7 @@ export class SonosService {
|
|
|
32
28
|
|
|
33
29
|
public static addOwnDevices(
|
|
34
30
|
snDevices: { [name: string]: OwnSonosDevice },
|
|
35
|
-
reinitializationDevice?: OwnSonosDevice
|
|
31
|
+
reinitializationDevice?: OwnSonosDevice,
|
|
36
32
|
): void {
|
|
37
33
|
this.ownDevices = snDevices;
|
|
38
34
|
this.reinitializationDevice = reinitializationDevice;
|
|
@@ -71,7 +67,7 @@ export class SonosService {
|
|
|
71
67
|
this.speakOnDevice(
|
|
72
68
|
`Sonos System initialisiert und bereit für Sprachausgaben.`,
|
|
73
69
|
this.reinitializationDevice,
|
|
74
|
-
30
|
|
70
|
+
30,
|
|
75
71
|
);
|
|
76
72
|
}
|
|
77
73
|
})
|
|
@@ -83,18 +79,18 @@ export class SonosService {
|
|
|
83
79
|
try {
|
|
84
80
|
for (const deviceName in this.ownDevices) {
|
|
85
81
|
currentDevice = this.ownDevices[deviceName];
|
|
86
|
-
if(currentDevice?.device === undefined) {
|
|
82
|
+
if (currentDevice?.device === undefined) {
|
|
87
83
|
throw `${currentDevice?.name} is missing`;
|
|
88
84
|
}
|
|
89
85
|
await currentDevice.device.GetState();
|
|
90
86
|
}
|
|
91
|
-
if(currentDevice !== undefined) {
|
|
87
|
+
if (currentDevice !== undefined) {
|
|
92
88
|
ServerLogService.writeLog(LogLevel.Info, `Alle Geräte okay --> Last checked ${currentDevice.name}`);
|
|
93
89
|
}
|
|
94
90
|
} catch (e) {
|
|
95
91
|
ServerLogService.writeLog(
|
|
96
92
|
LogLevel.Error,
|
|
97
|
-
`Atleast one device failed --> Last checked ${
|
|
93
|
+
`Atleast one device failed --> Last checked ${currentDevice?.name ?? 'undefined'}`,
|
|
98
94
|
);
|
|
99
95
|
TelegramService.inform(`Sonos device is failing --> Reinitialize whole system`);
|
|
100
96
|
this.initialize(true);
|
|
@@ -107,14 +103,14 @@ export class SonosService {
|
|
|
107
103
|
}
|
|
108
104
|
PollyService.tts(pMessage, (networkPath: string, duration: number) => {
|
|
109
105
|
const hours: number = new Date().getHours();
|
|
110
|
-
|
|
106
|
+
const volume: number = hours < 10 || hours > 22 ? 40 : 80;
|
|
111
107
|
|
|
112
108
|
for (const deviceName in this.ownDevices) {
|
|
113
109
|
SonosService.playOnDevice(
|
|
114
110
|
this.ownDevices[deviceName],
|
|
115
111
|
networkPath,
|
|
116
112
|
duration,
|
|
117
|
-
|
|
113
|
+
volumeOverride > -1 ? volumeOverride : Math.min(volume, this.ownDevices[deviceName].maxPlayOnAllVolume),
|
|
118
114
|
);
|
|
119
115
|
}
|
|
120
116
|
});
|
|
@@ -139,12 +135,14 @@ export class SonosService {
|
|
|
139
135
|
notificationFired: (played) => {
|
|
140
136
|
ServerLogService.writeLog(
|
|
141
137
|
LogLevel.Trace,
|
|
142
|
-
`Sonos Notification ("${mp3Name}") was${played ? '' : "n't"} played in ${
|
|
138
|
+
`Sonos Notification ("${mp3Name}") was${played ? '' : "n't"} played in ${
|
|
139
|
+
ownSnDevice.roomName
|
|
140
|
+
} (duration: "${specificTimeout}")`,
|
|
143
141
|
);
|
|
144
142
|
},
|
|
145
143
|
};
|
|
146
144
|
try {
|
|
147
|
-
const device: SonosDevice| undefined = ownSnDevice.device;
|
|
145
|
+
const device: SonosDevice | undefined = ownSnDevice.device;
|
|
148
146
|
if (device === undefined) {
|
|
149
147
|
ServerLogService.writeLog(LogLevel.Alert, `Sonos Geräte ${ownSnDevice.name} ist nicht initialisiert`);
|
|
150
148
|
Utils.guardedTimeout(
|
|
@@ -156,10 +154,7 @@ export class SonosService {
|
|
|
156
154
|
);
|
|
157
155
|
return;
|
|
158
156
|
}
|
|
159
|
-
ServerLogService.writeLog(
|
|
160
|
-
LogLevel.Trace,
|
|
161
|
-
`Spiele nun die Ausgabe für "${mp3Name}" auf "${ownSnDevice.name}"`,
|
|
162
|
-
);
|
|
157
|
+
ServerLogService.writeLog(LogLevel.Trace, `Spiele nun die Ausgabe für "${mp3Name}" auf "${ownSnDevice.name}"`);
|
|
163
158
|
device.PlayNotificationTwo(options).then((played) => {
|
|
164
159
|
ServerLogService.writeLog(
|
|
165
160
|
LogLevel.Debug,
|
|
@@ -8,8 +8,7 @@ export class MuellTonne {
|
|
|
8
8
|
public nextDate: Date | undefined = undefined;
|
|
9
9
|
public dates: Date[] = [];
|
|
10
10
|
|
|
11
|
-
public constructor(public name: string, public ownSonosDevice?: OwnSonosDevice) {
|
|
12
|
-
}
|
|
11
|
+
public constructor(public name: string, public ownSonosDevice?: OwnSonosDevice) {}
|
|
13
12
|
|
|
14
13
|
public sortDates(): void {
|
|
15
14
|
this.dates = this.dates.sort((a, b) => a.getTime() - b.getTime());
|
|
@@ -84,7 +84,7 @@ export class MuellService {
|
|
|
84
84
|
continue;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
this.alleTonnen.push({name: ev.summary, date: ev.start});
|
|
87
|
+
this.alleTonnen.push({ name: ev.summary, date: ev.start });
|
|
88
88
|
switch (ev.summary) {
|
|
89
89
|
case this.gelbeTonne.name:
|
|
90
90
|
this.gelbeTonne.dates.push(ev.start);
|
|
@@ -9,7 +9,7 @@ import { RoomBase } from '../../../models/rooms/RoomBase';
|
|
|
9
9
|
import { BasicRoomInfo } from '../../../models/persistence/BasicRoomInfo';
|
|
10
10
|
import { RoomDetailInfo } from '../../../models/persistence/RoomDetailInfo';
|
|
11
11
|
import { DailyMovementCount } from '../../../models/persistence/DailyMovementCount';
|
|
12
|
-
import { iTemperaturDataPoint } from
|
|
12
|
+
import { iTemperaturDataPoint } from '../../../models/iTemperaturDataPoint';
|
|
13
13
|
|
|
14
14
|
export const TemperatureHistoryCollection = new Mongo.Collection<TemperaturDataPoint>('TemperaturData');
|
|
15
15
|
export const HeatGroupCollection = new Mongo.Collection<TemperaturDataPoint>('HeatGroupCollection');
|