From d5f933e13b2d31e374f890a9eff09869db575e83 Mon Sep 17 00:00:00 2001 From: neopholus <39877538+neopholus@users.noreply.github.com> Date: Sat, 16 Mar 2024 13:53:59 +0100 Subject: [PATCH 1/3] Update speech2device.js --- lib/speech2device.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/speech2device.js b/lib/speech2device.js index 6ea43a1..3c0511b 100644 --- a/lib/speech2device.js +++ b/lib/speech2device.js @@ -280,7 +280,10 @@ class Speech2Device { let count = 0; let intervalHandler = setInterval(async () => { count++; - if (count > 20) { + // We are checking every 500 ms, expected length of playback is defined in variable duration in seconds + // Thus, we have to count to duration*2 to be able to wait long enough for the expected playback duration. + // We add an additional second, to cover delays before the playback starts. + if (count > (duration+1)*2) { clearInterval(intervalHandler); intervalHandler = null; this.adapter.log.error(`Error while checking if ${chromecastAnnouncementDev} finished playing announcement: ${announcementJSON}: TIMEOUT`); From b2d921e2304f366395d8d3bae0e67eebe357d5ae Mon Sep 17 00:00:00 2001 From: neopholus <39877538+neopholus@users.noreply.github.com> Date: Sat, 16 Mar 2024 14:02:37 +0100 Subject: [PATCH 2/3] Update speech2device.js fix for issue #299 --- lib/speech2device.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/speech2device.js b/lib/speech2device.js index 3c0511b..0b64d9e 100644 --- a/lib/speech2device.js +++ b/lib/speech2device.js @@ -282,8 +282,8 @@ class Speech2Device { count++; // We are checking every 500 ms, expected length of playback is defined in variable duration in seconds // Thus, we have to count to duration*2 to be able to wait long enough for the expected playback duration. - // We add an additional second, to cover delays before the playback starts. - if (count > (duration+1)*2) { + // We add two additional seconds, to cover delays before the playback starts. + if (count > (duration+2)*2) { clearInterval(intervalHandler); intervalHandler = null; this.adapter.log.error(`Error while checking if ${chromecastAnnouncementDev} finished playing announcement: ${announcementJSON}: TIMEOUT`); From 46bd2d5578ce81819d86bc1b826ab7a74416bc78 Mon Sep 17 00:00:00 2001 From: neopholus <39877538+neopholus@users.noreply.github.com> Date: Sat, 16 Mar 2024 14:16:33 +0100 Subject: [PATCH 3/3] Update speech2device.js Fixed indentation of comment. --- lib/speech2device.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/speech2device.js b/lib/speech2device.js index 0b64d9e..a8b40d5 100644 --- a/lib/speech2device.js +++ b/lib/speech2device.js @@ -280,9 +280,9 @@ class Speech2Device { let count = 0; let intervalHandler = setInterval(async () => { count++; - // We are checking every 500 ms, expected length of playback is defined in variable duration in seconds - // Thus, we have to count to duration*2 to be able to wait long enough for the expected playback duration. - // We add two additional seconds, to cover delays before the playback starts. + // We are checking every 500 ms, expected length of playback is defined in variable duration in seconds + // Thus, we have to count to duration*2 to be able to wait long enough for the expected playback duration. + // We add two additional seconds, to cover delays before the playback starts. if (count > (duration+2)*2) { clearInterval(intervalHandler); intervalHandler = null;