Voice Command: With Variables
Post date: Jan 01, 2015 10:3:24 PM
In this tutorial, we will briefly demonstrate how to use Tasker, AutoVoice, and SharpTools to use voice commands to control devices in your smart home using variables. If you are looking for a more basic tutorial on controlling your devices, see here - and if you are interested in just the details of dimming a light (without voice control), see here. At the end of the tutorial, you will be able to say Okay Google, Dim the bedroom light to 60 percent. and your phone will send a command to your Bedroom Light to change the dimming level.
Requirements:
Tasker - automation for Android
AutoVoice (Pro) - voice recognition for Tasker
SharpTools - SmartThings control for Tasker
Instructions
Open Tasker
In Profiles, click the "+" icon to add a new profile
Select Event > Plugin > AutoVoice > Recognized
Click the pencil icon to configure the AutoVoice plugin
Tap the Command Filter option and type the following:
Dim the bedroom light to (?<level>.+)%
Note: the (?<level>.+) saves the spoken device name to the %level Tasker variable
Check the Use Regex box
Select the checkmark at the top of the screen to save your plugin settings
Press the back button on your phone to save the Tasker event profile
At the prompt to select a Task, select New Task
Leave the optional Task Name blank and click the check mark to continue
Click the + icon at the bottom of the screen to add an action
Choose Plugin > SharpTools> A Thing
Click the pencil icon to configure the SharpTools plugin
Tap the tag icon in the action bar to enter Tasker variable mode
Enter the device name in the Device field (eg. bedroom light)
Enter the command to send: setLevel
From the menu, check the box for `Override Parameters`
A plus icon appears below the command allowing you to add parameters
Click the `+` icon to add a new parameter and tap the AZ icon to change the variable type to numeric (09)
Parameter 1: %level
Press Apply
Press the back button on your phone to save the SharpTools Action
Press the back button again to close out the Task Edit
Press the back button one more time to back out of Tasker completely and ensure the profile becomes active
Now you should be able to say Okay Google, Dim the bedroom light to [level] percent where [level] is a number between 0 and 100 and the associated light should dim to the desired percentage.
Other Thoughts
This approach can be used with other devices which have commands that accept parameters. Consider the following example for changing the cooling setpoint of your thermostat:
AutoVoice Filter: Change cooling setpoint to (?<temperature>.+) degrees
Device Type: Z-Wave Thermostat
Thing: Downstairs Thermostat
Command: setCoolingSetpoint
Parameter 0: %temperature
Troubleshooting:
Make sure you can manually toggle the desired device from the main SharpTools interface
Check the AutoVoice logs to see what it is recognizing
Turn on the Received Command Toast in AutoVoice for debugging
Make sure the command filter and variable %level are spelled exactly as noted in the instructions
This tutorial assumes you have AutoVoice Google Now Integration already setup
Some devices, like GE Link light bulbs, will only dim when using 1 parameter for setLevel
These devices still report that 2 parameters are required from SmartThings, so you must override the settings
From the 'A Thing' configuration screen, open the menu and check the box for 'Override Parameters'
You should now see 'X' icons show up to the right of each parameter field. Click the 'X' next to Parameter 2.
Follow the instructions above as normal, ignoring Parameter 2.