The short answer is that you can’t run another rule using Rules DSL. You will have to use any of the other rules languages. @JimT showed how it works in jRuby. You already know how it works in JS Scripting.
I apologize for my English - I probably couldn’t describe my idea well.
I’m aware that I can’t reference other rules in Rule DSL. My idea is to create a “workaround” for this.
Since I now have the rule from @JimT, I don’t need this anymore. Any change in the String Item StartRule now triggers the corresponding scene from Rule DSL. This “new rule” is, so to speak, the interface.
I’m putting this together so that someone looking for it understands what I was looking for in the first post.
For those who also don’t know JRuby: I created the following rule via the UI:
String StartRule "receives a string and starts this rule or scene"
Group:Switch:OR(ON,OFF) Szenenschalter "Group with one switch for each scene e.g. for Alexa"
Switch StartScene_UID1 "Trigges the scene with the uid: UID1"
Switch StartScene_UID2 "Trigges the scene with the uid: UID2"
Member of Szenenschalter received command ON
// Stringmanipulation in order to get the uid out of the item name
val String CommandString = triggeringItemName.toString.split('_').get(1)
//Starting the scene
The one additional JRuby-rule made in the UI as proposed by @JimT from here is still required, but appart from that, I can now start scenes from Rule DSL:
It that’s all you are after, other alternative approaches include:
You can set the action of a widget in MainUI to execute a rule directly. There is an issue open to add something similar for Sitemaps but I don’t think any work has started on that yet.
If you want to be sneaky, you can click on the “Code” tab of the Scene and manually insert a trigger. You’d still have your StartRule Item but you wouldn’t need the separate rule.
You can create separate rules for each scene and not have to write any code at all. Set the StartRule trigger and possibly the condition and the use the call rule action.
As shown above, use a single rule to call the Scenes. This approach is pretty simple if the command is the rule UID of the scene to call. If can become more complicated if not. In Blockly it would look like this.