so it would be:
var String EscadaAcesa = "The ligth is on"
sendHttpGetRequest(String::format(“http://localhost:5005/sala/say/%s/en-gb”, EscadaAcesa.encode(“UTF-8”)))
Also, I was also using the sonos-http-api for a long while but the Sonos binding in OH2 is pretty rock solid and fairly awesome. you could just replace this call with:
say("The light is on")
if you have ‘sala’ as the default audiosink or you could specify the Sonos to ‘say’ it on in the call as a second argument. my example is how I summon the children by playing a sound in their rooms and the tv room:
var summonText = "I summon thee both"
if(summonDinnersReady.state == ON)
{
summonText = String::format("%s for dinner post haste", summonText)
}
say(summonText, "voicerss:enGB", "sonos:PLAY1:RINCON_5CAAFD2A673E01400")
say(summonText, "voicerss:enGB", "sonos:PLAY1:RINCON_5CAAFD4627D401400")
say(summonText, "voicerss:enGB", "sonos:PLAY1:RINCON_5CAAFD159A2A01400")
rule "Lâmpada escada acesa"
when
Item LampadaEscada changed from OFF to ON
then
var String EscadaAcesa = “The ligth is on"
sendHttpGetRequest(String::format(“http://localhost:5005/sala/say/%s/en-gb”, EscadaAcesa.encode(“UTF-8”)))
if (tmJoao==OFF) then
sendNotification("xxxxxx@gmail.com”, “Lampada escada acesa”)
end
end
and get the exacly same result “Theplusligthplusispluson”.
I cannot try the Sonos binding today (bed time for the young girl of the house) and will be out of country for 4 days, so I will try latter this week.
Why don’t you use the say command as suggested? It is the build in version with the binding and it doesn’t need any additional software installed. The website you used dates from before the time the say command was available.
I’m using this command as posted above and it works like a charm, even in my language.I have a textbox on my habpanel in which I type the text, and on the press of the button it is spoken without any “plus”.
Thank you all for your help. I couldn’t try until now.
I’m now using the say command it kinda works
I can ear the message, but the volume is low and the quality is bad, so I can barely understand.
The good side: there is no “plus” on the message now.
This is my rule now:
rule "Lâmpada escada acesa"
when
Item LampadaEscada changed from OFF to ON
var Lacesa = "A lâmpada está acesa"
Lacesa = String::format(summonText)
say(Lacesa , “voicerss:ptPT”, “sonos:PLAY1:sala”)
end
end
My Sonos is now saying all the annoucements. Its odd, as I didn’t change anyting (at least that in this part of the code). I had no time to play with OH latelly, but a couple of days ago I give it a try and enabled the rules and it worked. I really don’t know why it is working now and was not before.
I have a few simple rules, like this one:
rule "Lampada escada acesa"
when
Item LampadaEscada changed from OFF to ON
say(“A lâmpada da escada foi acesa” , “voicerss:ptPT”, “sonos:PLAY1:sala”)
end
The only problem is that I need to code “lâmpada” as “lâmpada” to have the rigth word on Sonos. Is there any solution for this?