From 4f698695e5618533b29f63f809dbb39690a782c9 Mon Sep 17 00:00:00 2001 From: Pierre-Gilles Leymarie Date: Mon, 3 Jun 2024 14:31:23 +0200 Subject: [PATCH] Sonos.playNotification : Increase timout + add delayMs + more logs to getTTSApiUrl (#2089) --- server/lib/gateway/gateway.getTTSApiUrl.js | 2 +- server/services/sonos/lib/sonos.setValue.js | 4 +++- server/test/services/sonos/lib/sonos.setValue.test.js | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/server/lib/gateway/gateway.getTTSApiUrl.js b/server/lib/gateway/gateway.getTTSApiUrl.js index 94227716ec..2b1db9f393 100644 --- a/server/lib/gateway/gateway.getTTSApiUrl.js +++ b/server/lib/gateway/gateway.getTTSApiUrl.js @@ -16,7 +16,7 @@ async function getTTSApiUrl(body) { const response = await this.gladysGatewayClient.ttsGetToken(body); return response; } catch (e) { - logger.debug(e); + logger.warn(e); const status = get(e, 'response.status'); const message = get(e, 'response.data.error_message'); if (status === 403) { diff --git a/server/services/sonos/lib/sonos.setValue.js b/server/services/sonos/lib/sonos.setValue.js index 8d5e18688c..d24064f7f5 100644 --- a/server/services/sonos/lib/sonos.setValue.js +++ b/server/services/sonos/lib/sonos.setValue.js @@ -31,7 +31,9 @@ async function setValue(device, deviceFeature, value) { trackUri: value, onlyWhenPlaying: false, volume: 45, // Set the volume for the notification (and revert back afterwards) - timeout: 10, + timeout: 20, // If the events don't work (to see when it stops playing) or if you turned on a stream, + // it will revert back after this amount of seconds. + delayMs: 700, // Pause between commands in ms, (when sonos fails to play sort notification sounds). }); } } diff --git a/server/test/services/sonos/lib/sonos.setValue.test.js b/server/test/services/sonos/lib/sonos.setValue.test.js index 74ef8475cd..b1e332a53f 100644 --- a/server/test/services/sonos/lib/sonos.setValue.test.js +++ b/server/test/services/sonos/lib/sonos.setValue.test.js @@ -191,9 +191,10 @@ describe('SonosHandler.setValue', () => { await sonosHandler.setValue(device, deviceFeature, 'http://test.com'); assert.calledWith(devicePlayNotification, { onlyWhenPlaying: false, - timeout: 10, + timeout: 20, trackUri: 'http://test.com', volume: 45, + delayMs: 700, }); }); });