[SOLVED] Jython script for TTS using VoiceManager's say method

Hi there!

Has someone a working example of a Jython script calling the smarthome:voice VoiceManager say function? That is, in I’d like to speak a text on the default audio sink with the default TTS and voice. (I’d also like to be able to specify audio sink and voice)

I guess I should import the VoiceManager into my script but I’m not quite sure what it should look like.

Any help will surely be appreciated. Thanks!

Sorry for the monologue.

I found a way to do this using openhab.actions

from org.eclipse.smarthome.core.library.types import PercentType
from openhab.actions import Voice
Voice.say("Nu ska vi se", "pollytts:Astrid", "sonos:One:RINCON_XXXXXX", PercentType(50)) # Kitchen Left

:smiley:

Sound clips can be played in a similar way:

from org.eclipse.smarthome.core.library.types import PercentType
from openhab.actions import Audio
Audio.playSound('sonos:PLAY1:RINCON_XXXX', 'Hello.mp3', PercentType(50))

Sound clips reside in /etc/openhab2/sounds/