Adding a New Branch
Scenario Objective
Enhance your scenario by adding a new branch that allows you to stop the music. In this branch, you will:
- Use a voice command (e.g., "Stop the alarm clock") to stop the scenario.
- Include a test to check if the alarm is already active and, if so, stop it.
- Update the scenario parameters so that the rule call can effectively stop the music.
Steps to Add the New Branch
-
Add a New Branch:
Click theStart
button in the Actions tab to add a new branch to your scenario. -
Configure the
Calendar
Node:
Set theCalendar
node to use a voice rule and add the rule "Stop the alarm clock". -
Add
Javascript
Nodes:- Insert a
Javascript
node between theCalendar
scheduled node and theSpeak
node. - Add a
Javascript
node into the new branch.
- Insert a
-
Configure the
Javascript
Node:
Set up theJavascript
nodes to test whether the alarm is active and stop it accordingly. -
Close the New Branch:
Connect theJavascript
node to theend
node to complete the branch.
With this new branch, your scenario can now be stopped via a voice command, effectively stopping the music and ending the alarm when required.