hoffmation-base 3.0.0-alpha.51 → 3.0.0-alpha.52
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.
|
@@ -11,4 +11,8 @@ export interface iSonosSettings {
|
|
|
11
11
|
* @warning This can collide with AC-Control (@see {@link iDaikinSettings.buttonBotRightForAc})
|
|
12
12
|
*/
|
|
13
13
|
buttonBotRightForRadio?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* The hostname to use for initialization (needed in some VLAN situation where discovery is not possible).
|
|
16
|
+
*/
|
|
17
|
+
initialHost?: string;
|
|
14
18
|
}
|
|
@@ -5,6 +5,7 @@ export declare class SonosService {
|
|
|
5
5
|
private static isInitialized;
|
|
6
6
|
private static checkTimeCallback;
|
|
7
7
|
private static reinitializationDevice;
|
|
8
|
+
private static get config();
|
|
8
9
|
static addOwnDevices(snDevices: {
|
|
9
10
|
[name: string]: OwnSonosDevice;
|
|
10
11
|
}, reinitializationDevice?: OwnSonosDevice): void;
|
|
@@ -9,12 +9,15 @@ const Telegram_1 = require("../Telegram");
|
|
|
9
9
|
const time_callback_service_1 = require("../time-callback-service");
|
|
10
10
|
const settings_service_1 = require("../settings-service");
|
|
11
11
|
class SonosService {
|
|
12
|
+
static get config() {
|
|
13
|
+
return settings_service_1.SettingsService.settings.sonos;
|
|
14
|
+
}
|
|
12
15
|
static addOwnDevices(snDevices, reinitializationDevice) {
|
|
13
16
|
this.ownDevices = snDevices;
|
|
14
17
|
this.reinitializationDevice = reinitializationDevice;
|
|
15
18
|
}
|
|
16
19
|
static initialize(reinitialize = false) {
|
|
17
|
-
var _a;
|
|
20
|
+
var _a, _b;
|
|
18
21
|
if (((_a = settings_service_1.SettingsService.settings.mp3Server) === null || _a === void 0 ? void 0 : _a.serverAddress) === undefined) {
|
|
19
22
|
log_service_1.ServerLogService.writeLog(models_1.LogLevel.Alert, 'SonosService needs properly configured mp3Server.');
|
|
20
23
|
}
|
|
@@ -34,14 +37,16 @@ class SonosService {
|
|
|
34
37
|
}, 'Spiele eine kurze Nachricht auf allen Sonos Geräten um diese zu identifizieren'));
|
|
35
38
|
}
|
|
36
39
|
this.sonosManager = new lib_1.SonosManager();
|
|
37
|
-
this.sonosManager
|
|
38
|
-
.
|
|
40
|
+
this.sonosManager.OnNewDevice((d) => {
|
|
41
|
+
log_service_1.ServerLogService.writeLog(models_1.LogLevel.Info, `SonosDevice ${d.Name} joined`);
|
|
42
|
+
SonosService.initializeDevice(d);
|
|
43
|
+
});
|
|
44
|
+
const initialHost = (_b = this.config) === null || _b === void 0 ? void 0 : _b.initialHost;
|
|
45
|
+
(initialHost === undefined
|
|
46
|
+
? this.sonosManager.InitializeWithDiscovery(10)
|
|
47
|
+
: this.sonosManager.InitializeFromDevice(initialHost))
|
|
39
48
|
.then(() => {
|
|
40
49
|
var _a;
|
|
41
|
-
this.sonosManager.OnNewDevice((d) => {
|
|
42
|
-
log_service_1.ServerLogService.writeLog(models_1.LogLevel.Info, `SonosDevice ${d.Name} joined`);
|
|
43
|
-
SonosService.initializeDevice(d);
|
|
44
|
-
});
|
|
45
50
|
log_service_1.ServerLogService.writeLog(models_1.LogLevel.Debug, `${this.sonosManager.Devices.length} Sonos Geräte gefunden.`);
|
|
46
51
|
this.sonosManager.Devices.forEach((d) => {
|
|
47
52
|
SonosService.initializeDevice(d);
|