Examples‎ > ‎

Voice Command: With Variables

posted Jan 1, 2015, 2:03 PM by Joshua Lyon   [ updated Mar 1, 2016, 11:47 AM ]

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

  1. Open Tasker
  2. In Profiles, click the "+" icon to add a new profile
  3. Select Event > Plugin > AutoVoice > Recognized
  4. Click the pencil icon to configure the AutoVoice plugin
  5. 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
  6. Check the Use Regex box
  7. Select the checkmark at the top of the screen to save your plugin settings
  8. Press the back button on your phone to save the Tasker event profile
  9. At the prompt to select a Task, select New Task
  10. Leave the optional Task Name blank and click the check mark to continue
  11. Click the + icon at the bottom of the screen to add an action
  12. Choose Plugin > SharpTools> A Thing
  13. Click the pencil icon to configure the SharpTools plugin
  14. Tap the tag icon in the action bar to enter Tasker variable mode
  15. Enter the device name in the Device field (eg. bedroom light)
  16. Enter the command to send: setLevel
  17. From the menu, check the box for `Override Parameters`
    A plus icon appears below the command allowing you to add parameters
  18. Click the `+` icon to add a new parameter and tap the AZ icon to change the variable type to numeric (09)
    Parameter 1: %level
  19. Press Apply
  20. Press the back button on your phone to save the SharpTools Action
  21. Press the back button again to close out the Task Edit
  22. 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.
Comments