Say() can not say two or more phrases

Hi, Matt

Could i ask u? I have problem with double and tripple created timers if command comes at the same time.
How did you solved this problem?
Few posts up there is a rule and logs with this problem from me
https://community.openhab.org/t/say-can-not-say-two-or-more-phrases/84805/16?u=thisisio
Thanks!

Hi Michael,

I do not have the situation that TTS text is created at excatly the same time (same millisecond). I have just tested your “scenario” here and get the same issue - multiple timers are created. However, if text is send to the TTSTextToSay item with just 1 ms difference everything seems to be working ok here.
BTW, I am on 2.5 M4 so the issue @wborn mentioned above should not be the problem here. The issue seems to be that if the TTSTextToSay item receives text within the same millisecond, the variable holding the timer handle (timerSpeaker) is still null, hence a second/third timer is created.

If you really need to make sure that text that is receive in the same millisecond is queued properly, maybe you need to look into Rich’s DP for the gatekeeper and use a continuously looping timer instead of creating the timer only when the queue receives the first entry and stopping it when the queue is empty. I have opted not to do this for my TTS queue usecase.
Maybe someone else also has a different approach or idea :wink:

Cheers,
Matt

2 Likes

Thanks a lot, Matt

I have just got pi4 and put there 2.5m4.
Will make some tests top see 8f it still makes problems.

But you can add the sleep there to test whether the problem Wouter mentioned is the same problem you are having. The whole point of adding the sleepes to your test rule is to figure out the source of the problem.

I am using

var Number cmd_wait = ((cmd_Text.state.toString.length() * 70) + 1000)
Thread::sleep(cmd_wait)

Thats working fine for me, for short and for long texts.