hoffmation-base 3.0.0-alpha.51 → 3.0.0-alpha.53
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/server/config/iSonosSettings.d.ts +4 -0
- package/lib/server/services/Sonos/sonos-service.d.ts +1 -0
- package/lib/server/services/Sonos/sonos-service.js +12 -7
- package/lib/server/services/ac/ac-device.js +7 -0
- package/lib/server/services/weather/weather-service.d.ts +1 -0
- package/lib/server/services/weather/weather-service.js +5 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -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);
|
|
@@ -14,6 +14,7 @@ const DeviceCapability_1 = require("../../devices/DeviceCapability");
|
|
|
14
14
|
const settings_service_1 = require("../settings-service");
|
|
15
15
|
const config_1 = require("../../config");
|
|
16
16
|
const blockAutomaticHandler_1 = require("../blockAutomaticHandler");
|
|
17
|
+
const weather_1 = require("../weather");
|
|
17
18
|
class AcDevice {
|
|
18
19
|
/**
|
|
19
20
|
* Whether the AC is allowed to cool (depends on the season
|
|
@@ -27,6 +28,12 @@ class AcDevice {
|
|
|
27
28
|
if (this.settings.noCoolingOnMovement && ((_b = (_a = this.room) === null || _a === void 0 ? void 0 : _a.PraesenzGroup) === null || _b === void 0 ? void 0 : _b.anyPresent())) {
|
|
28
29
|
return false;
|
|
29
30
|
}
|
|
31
|
+
if (weather_1.WeatherService.active &&
|
|
32
|
+
weather_1.WeatherService.todayMaxTemp < 22 && // TODO: Make this value configurable
|
|
33
|
+
weather_1.WeatherService.todayMaxTemp !== devices_1.UNDEFINED_TEMP_VALUE) {
|
|
34
|
+
// As it is quite cold outside there is no need to cool
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
30
37
|
return true;
|
|
31
38
|
}
|
|
32
39
|
/**
|
|
@@ -26,6 +26,7 @@ export declare class WeatherService {
|
|
|
26
26
|
private static longitude;
|
|
27
27
|
private static appID?;
|
|
28
28
|
static addWeatherUpdateCb(name: string, cb: () => void): void;
|
|
29
|
+
static get todayMaxTemp(): number;
|
|
29
30
|
static initialize(config: iWeatherSettings): void;
|
|
30
31
|
static update(): void;
|
|
31
32
|
static stopInterval(): void;
|
|
@@ -11,10 +11,15 @@ const utils_1 = require("../utils");
|
|
|
11
11
|
const log_service_1 = require("../log-service");
|
|
12
12
|
const suncalc_1 = __importDefault(require("suncalc"));
|
|
13
13
|
const time_callback_service_1 = require("../time-callback-service");
|
|
14
|
+
const devices_1 = require("../../devices");
|
|
14
15
|
class WeatherService {
|
|
15
16
|
static addWeatherUpdateCb(name, cb) {
|
|
16
17
|
this._dataUpdateCbs[name] = cb;
|
|
17
18
|
}
|
|
19
|
+
static get todayMaxTemp() {
|
|
20
|
+
var _a, _b, _c;
|
|
21
|
+
return (_c = (_b = (_a = WeatherService.lastResponse) === null || _a === void 0 ? void 0 : _a.daily[0]) === null || _b === void 0 ? void 0 : _b.temp.max) !== null && _c !== void 0 ? _c : devices_1.UNDEFINED_TEMP_VALUE;
|
|
22
|
+
}
|
|
18
23
|
static initialize(config) {
|
|
19
24
|
this.active = true;
|
|
20
25
|
this.longitude = config.longitude;
|