TTS on OH3 in Rules and Main-Ui

Well formatted code sorry for bad formatted code before

triggers:
  - id: "1"
    configuration:
      itemName: dummyschalter
    type: core.ItemStateChangeTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      itemName: WZEchoTTS
      command: '<speak> <audio
        src="soundbank://soundlibrary/ui/gameshow/amzn_ui_sfx_gameshow_positive_response_01"
        />Hinweis: Waschmaschine ist fertig </speak>'
    type: core.ItemCommandAction

Thatā€™s exactly what I didā€¦the Item seems to recieve the command, but I donā€™t hear anythingā€¦maybe the problem is not in the rule anymoreā€¦

Yes, you will create an itemā€¦ Thats more than badā€¦ Itā€™s a rule! TTS leave it as it is. You must create a rule that this work, not an item.

Yes but for the rule I need an item connected to that channel that than can recieve the rule command no? Thats How I did it in 2.5ā€¦And in your rule, the command is also passed to an itemā€¦

core.ItemCommandAction

Yes like this:




I donā€™t have something like this:

Where come this text from? This looks like an item. I donā€™t have this in my itemā€¦

when I trigger the rule, it appears for a short timeā€¦I secreenshotted right after i pressed play to test the ruleā€¦normally this field is emptyā€¦I just switched on the semantic-tag point and none (like yours instead of emty) still nothingā€¦

The only difference I have in my item is the symbol, and the profile (which was none for me). I switched it to standard, but still donā€™t hear anythingā€¦

Check logs if there is a warning or error. I think itā€™s a fault on your side. Can you send this via script?

No errors or warnings regarding the echo controlā€¦ony this one which relates to a wrong state-description metadata I think:

2021-01-15 15:12:00.467 [WARN ] [dataStateDescriptionFragmentProvider] - Unable to parse the stateDescription from metadata for item ThermostatKuche_Setpointheating, ignoring it

Just for the recordā€¦I also have problems regarding this ruleā€¦itā€™s z-wave so a complete different bindingā€¦here the only-if doesnā€™t apply and the rule never runsā€¦:

triggers:
  - id: "1"
    configuration:
      itemName: DimmerKuechenlicht
    type: core.ItemStateUpdateTrigger
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

Iā€™m trying for five days now and iā€™m completely desperarted as I canā€™t find any cause and as the ā€œoldā€ rules which are written inside the rules folder work perfectlyā€¦Iā€™ts a complete fresh installā€¦

WHat do you mean by that?

DSL or Javascript

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: