String argument in Exec Binding


So I have been fiddeling around with the exec bindning to trigger a TTS in the command line. Everything works fine but there is one problem.

I want to run: talk “my speech string is great!” but what gets run is: talk my.

The log says: executed commandLine 'talk “my speech string is great” ’ <— Which is correct. But that is obviously not what is actually being run.

Is there some way to pass a string properly in the Exec binding or what’s up?!?!


it seems your “Talk” programm can’t cope with double quotes. Have you tried the whole thing from the commandline?
Maybe you need single quotes around your sentence. Or double-double quotes, like talk ““Lorem ipsum dolor amed””

Manually doing it in the command line results in the following:

talk “my sentence 123” <— Success

talk ‘my sentence 123’ <—Success

Copying the output from the openhab log: executed commandLine 'talk “my speech string is great”'
is the same as the first one of these two examples, right?

executeCommandLine(‘talk “Dimming the light”’) <— results in it saying: Dimming.
executeCommandLine(“talk “Dimming the light””) <— results in it saying: Dimming.

Try single quotes instead of double quotes for your text String.

If that doesn’t work try passing escapes for the spaces.

"talk \'Dimming\\ the\\ light\'"

Nope, can’t get it to work :confused: What you wrote in that post just gives “Dimming backslash”. Double or single quotes doesn’t seem to make a difference, tried multiple ways.

You can try replacing the spaces with ‘@@’. That is the last idea I have to make it work.

Using @@ works fine as long as i do it manually in the command line but when openhab does it, it fails completely.

I’m starting to feel it must be the exec binding that parses stuff strangely…

Edit: Or not… it works using say (other TTS software). It must be my program after all but don’t get how… Will look over later.

Edit2: Say works because it can take arguments like: say dimming the light <— without quotes.
Will probably just add support for this in my program even though it should be possible to pass a string within quotes.

Fixed this using $* in my bash program. Making it take all arguments as one string. Still believe the exec binding has some issues though. This was more of a work around.