[Advice Needed] Say() Via VoiceRSS

I’ve searched the forum and not really found the answer. Likely because I’m doing something not many others do.

I have a couple of rules in place that create an announcement, for example I get my weather information from OWM and add that to a line of text. This is built as val sAnnouncement = “Good Morning, currently it’s " + Current_Temp.state + " degrees outside. The expected high is " + Today_Hi.state + " degrees.” I then update the item below, Voice_Announcement.sendCommand(sAnnouncement).

This works fine as it is, however when I then add in my travel time to work, this method doesn’t work so well. As a quick work around I’ve using the Thread::sleep(5000) after each update of Voice_Announcement.

Is there a better way to do this or am I going about it the wrong way altogether?

String Voice_Announcement
rule "Make Voice Announcement"
when
Item Voice_Announcement changed
then
val vAnnouncement = Voice_Announcement.state
say(vAnnouncement)
end

What does “this method doesn’t work so well” mean?

Each binding that uses the “say” command might handle it a bit different, for example the Sonos binding uses a fixed length for the “say” command, for that time the actual played music or whatever ist halted and resumed after that time. An additional command during that timeframe might “not work well”.
Using a “Thread:sleep” however should be avoided!

What I mean by it doesn’t work so well, is that if Voice_Announcement is updated while the say() command is running, this stops and processes the next update instead. The say() command doesn’t finish what it’s doing.

A little difficult to explain, I know.

Sounds like what I said above.
You already have a seperated rule that calls the “say” command, try to use this Desing Pattern.