Hi All,
I’m loving the new interface and semantic model in OH3.
I’m building a parallel OH3 server to replace my running OH2 server and have got most of the items (all bar z-wave) into the new OH3 and am now working on porting across the old rules and moving them into JS.
I understand the docs aren’t there yet and that’s fine, but I’ve got a couple of basic questions.
-
Now that we have an official release of OH3, are the helper core libraries still needed. I have seen examples that use the helper core libraries, but have also seen examples that reference for example - org.openhab.core.model.script.actions.Voice. I’m unclear as to how I should proceed.
-
I can’t find any examples of references for how to use the OH Cloud connector in JS. I have rules that used the old sendBroadcastNotification(“Alert”) and can’t see a way to get this working in the new model. Anyone got any helpful pointers?
In the spirit of giving as well as taking, whilst it might not be useful to many, I have completed the move of the functionality that scans through a group of Echo Last commands, finds the first echo showing a specific command and plays a message to it. This is useful when you want to trigger a specific OH script through Alexa and play the response to the script through the same Alexa. It obviously has issues though if more than one Alexa has the same last voice command. Our Echo’s get enough use that in the real world this hasn’t been a major issue. I’m sure it’s not perfect, but may point people in the right direction
var EchoMembers = Java.from(itemRegistry.getItem(itemGroupName).getAllMembers());
for(var i in EchoMembers)
{
// logger.info("1 Echo Last Command " + EchoMembers[i].getName());
if(EchoMembers[i].getState().toString() == "who is home")
{
// logger.info("2 Echo Last Command " + EchoMembers[i].getName());
var EchoLastVoiceCommand = EchoMembers[i].getName();
var EchoName = EchoLastVoiceCommand.substring(0, EchoLastVoiceCommand.length - 16);
events.sendCommand(EchoName + "SpeakVolume", 50)
events.sendCommand(EchoName + "Speak", TTSAnnounce)
// logger.info("3 Echo TTS " + EchoName);
EchoFound = True
break;
}
}
Thanks