TTS on OH3 in Rules and Main-Ui

Okay now it’s getting creepy…I had no errors in the logs, but I decided to reboot…guess what…it works now *facepalm…I absolutely have no Idea why…I normally avoid reboots, as they are masking a problem…I have no Idea what this problem could be…

1 Like

Thanks for all the Help! You really aided me to cross out things…and by the way, this soundeffect in your code is cool! Do you have more of them or know where I can find them? =)

Edit: FOr everyone Interested in the AMazon-Sounds: Alexa Skills Kit Sound Library | Alexa Skills Kit

Should I still send something to you? If yes, what do you need? I want to help to find the cause of this as I have no Idea what it could be but I want to prevent it from happening for others…

Besides the rule with the lights is still not working throughout reboot…

If you have solved this, then its all fine now i don’t need anything. Sound files can be found here:

1 Like

Thank you very much! I’m very happy that this is working now! That sound thing is extremely cool =). Didn’t know that this was possible =). Maybe you have an Idea with the light rule too? =)

You can everything do what is inside the speak tag like this: Speech Synthesis Markup Language (SSML) Reference | Alexa Skills Kit

Maybe this can help:

triggers:
  - id: "1"
    configuration:
      itemName: DimmerKuechenlicht
    type: core.ItemStateChangeTrigger
conditions:
  - inputs: {}
    id: "4"
    configuration:
      itemName: DimmerKuechenlicht
      state: "80"
      operator: ">"
    type: core.ItemStateCondition
actions:
  - inputs: {}
    id: "2"
    configuration:
      itemName: Arbeitsplattenlicht_Switch
      command: ON
    type: core.ItemCommandAction
  - inputs: {}
    id: "3"
    configuration:
      itemName: Dunstabzugshaube
      command: ON
    type: core.ItemCommandAction

thats extremly cool! Great thanks =)

nope…does nothing when I set the dimmer above 80…

Will open up a new thread for this rule :slight_smile: Problem with rule under OH3

Hello Community

I try to let my Google Home Mini speak out what Smoke Detector hit the alarm. Chromecast binding, Google TTS and Default Voice Settings like documented are set.

What is not working is the “say” command in the following rule, I searched a lot in the community but there are no OH3 specific help articles.

I think I need some “Jave.type()” for the TTS say command, do I and when which?

I definded a “ECMAScript”:

var logger = Java.type('org.slf4j.LoggerFactory').getLogger('org.openhab.rule.' + ctx.ruleUID);
var allSmokeDetectors = itemRegistry.getItemsByTag('Smoke')

for (var i_index in allSmokeDetectors) {
  
  state = allSmokeDetectors[i_index].state;
  
  if(state == 'OPEN') {
      
      label = allSmokeDetectors[i_index].label;
    
      //say("<speak>Achtung! <break time=\"3s\"/> is " + label + "</speak>");
      say("Hi", "googletts:deDEWavenetA", "chromecast:audio:f8610c2090")
  
      logger.warn(allSmokeDetectors[i_index].label);
  
  }
}

But I get the following warming in the log:

2021-03-07 22:40:19.006 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'e15056975f' failed: ReferenceError: "say" is not defined in <eval> at line number 15

Thanks :slight_smile: