Hre is the rule:
import org.openhab.core.library.types.*
import org.openhab.model.script.actions.*
import org.joda.time.*
import java.util.regex.Matcher
import java.util.regex.Pattern
rule "Synthèse vocale"
when
Item TTSCommand received command
then
logInfo("TTS","TTSCommand=" + TTSCommand.state.toString)
var params = TTSCommand.state.toString.split(",")
var String room = params.get(0)
var String command = params.get(1)
logInfo("TTS","room=" + room + " command=" + command)
var item = SonosSalonId
if (room == "salon") {
item = SonosSalonId
}
else if (room == "chambre") {
item = SonosChambreId
}
else {
item = null
}
if (command == "heure") {
var int heure = now.getHourOfDay
var int minute = now.getMinuteOfHour
var String msg
if (heure == 0) {
msg = String::format("Il est minuit %d.", minute)
}
else if (heure == 1) {
msg = String::format("Il est une heure %d.", minute)
}
else {
msg = String::format("Il est %1$d heures %2$d.", heure, minute)
}
try {
msg = msg.encode("UTF-8")
}
catch (Exception e) {
}
sendMiosAction(item, "Sonos/Say", newArrayList('Text' -> msg, 'Language' -> 'fr', 'GroupZones' -> 'Current', 'Volume' -> 50))
}
end
SonosSalonId and SonosChambreId are two of my items in my items file.
I get this error:
21:47:30.508 [ERROR] [.script.engine.ScriptExecutionThread] - Error during the execution of rule 'Synthèse vocale': Cannot resolve proxy: java:/Objects/org.openhab.core.items.Item#org.openhab.core.items.Item
What could be wrong ?