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:

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:

    6. Dim the bedroom light to (?<level>.+)%

    7. Note: the (?<level>.+) saves the spoken device name to the %level Tasker variable

  1. Check the Use Regex box

    1. Select the checkmark at the top of the screen to save your plugin settings

    2. Press the back button on your phone to save the Tasker event profile

    3. At the prompt to select a Task, select New Task

    4. Leave the optional Task Name blank and click the check mark to continue

    5. Click the + icon at the bottom of the screen to add an action

    6. Choose Plugin > SharpTools> A Thing

    7. Click the pencil icon to configure the SharpTools plugin

    8. Tap the tag icon in the action bar to enter Tasker variable mode

  2. Enter the device name in the Device field (eg. bedroom light)

  3. Enter the command to send: setLevel

  4. From the menu, check the box for `Override Parameters`

  5. A plus icon appears below the command allowing you to add parameters

    1. Click the `+` icon to add a new parameter and tap the AZ icon to change the variable type to numeric (09)

    2. Parameter 1: %level

    3. Press Apply

    4. Press the back button on your phone to save the SharpTools Action

  1. Press the back button again to close out the Task Edit

    1. 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.