Voice Query: Is the bedroom light on?

Post date: Jan 01, 2015 9:35:27 PM

In this tutorial, we will briefly demonstrate how to use Tasker, AutoVoice, and SharpTools to query the status of devices in your home. At the end of the tutorial, you will be able to say Okay Google, is the bedroom light on? and your phone will check the status of the light and say the status as a voice response (eg. "The bedroom light is on" or "The bedroom light is off").



    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 Speak Filter option and say the following when prompted:

    6. Is the bedroom light on

  1. Select the option that matches your query from the list that is presented to you.

  2. Note: AutoVoice will attempt convert your voice command into text and will display the list of options with the most likely option in the first position.

    1. Check the Exact Command box

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

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

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

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

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

    7. Choose Plugin > SharpTools> Thing: Get Attribute

    8. Click the pencil icon to configure the SharpTools plugin

  3. Select the 'Thing' you want to check the status of

    1. Example: Bedroom Light

    2. Select the attribute

    3. Example: switch

    4. Press Apply

    5. Note: the names of the Tasker variables that will be set are displayed at this point

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

    7. Click the + icon at the bottom of the screen to add another action

    8. Choose Alert > Say

    9. In the Text field, enter: The bedroom light is %st_attr_value

    10. Press the back button on your phone to save the Say Action

    11. At the bottom of the screen, press the play icon to test the Task

    12. Note: With Tasker 4.6+ you will see a play icon next to each Action in the task as it is executed

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

    14. Press the back button one more time to back out of Tasker completely and ensure the profile becomes active

Other Thoughts:

This approach can be used to answer other queries like:

  • What temperature is the AC set to?

      • AutoVoice filter: What temperature is the AC set to

      • Thing: Downstairs AC

      • Attribute: thermostatSetpoint

    • Is the front door locked?

      • AutoVoice filter: Is the front door locked

      • Thing: Front Door

      • Attribute: lock

    • Did I leave the garage open?

      • AutoVoice filter: Did I leave the garage open

      • Thing: Garage

      • Attribute: contact or door or switch (depends on device type)

The same concept applies as was used in the instructions above. Simply swap out the AutoVoice filter for your updated query and replace the thing and attribute in the Thing: Get Attribute configuration.

If you don't want to have the response spoken aloud, you might consider using the Alert > Notify or Alert > Flash action to have the result of the attribute query displayed on screen.

Many devices have several different attributes that may be of interest to you, so play around and see what's out there. For example, in addition to pulling in the thermostatSetpoint, you might also be interested in pulling in the thermostatMode to see if it is set to heat or cool.

Dynamic Queries

You can also use the `Thing: Get Attribute` plugin with variables to get the current status of many of your things at once or to use variables to get the status of a desired device. To do this, tap the tag icon in the top action bar to switch to variable mode.

Once you have switched the plugin into variable mode, you can either directly enter a string into the fields or you can use a Tasker variable (eg. %device)

For example, if we wanted to setup a profile that allowed us to ask 'Is the [device] on?', we could change the voice query from above to use AutoVoice's RegEx feature to allow us to dynamically ask if a device is on using a query like:

  • AutoVoice Filter: (?<q>Is|Are) the (?<device>.+?) (?<onoff>on|off|on or off|off or on)

Note: Make sure the "Use RegEx" box is checked in AutoVoice when using this approach -- this will convert the funky groups in parenthesis to variables that get captured.

Then in the `Thing: Get Attribute` plugin we would use the following configuration:

  • Thing: %device

  • Attribute: switch

And finally, we could spit out the result using an action like Alert > Flash:

  • Text: The %device is %st_attr_values(1)

Important: When you are using `Thing: Get Attribute` in variable mode, the response changes from a set of single-value strings to a set of string arrays.

When you are using `Thing: Get Attribute` for a single device (Eg. with the drop-downs), you'll get the following variables:

  • %st_attr_name

  • %st_attr_value

  • %st_thing_id

  • %st_thing_name

When you use `Thing: Get Attribute` in variable mode, you'll get the following variables (which are each arrays):

  • %st_attr_names()

  • %st_attr_values()

  • %st_thing_ids()

  • %st_thing_names()

For more information on variable arrays in Tasker, see the documentation linked below:



    • Make sure you can manually toggle the desired device from the main SharpTools interface

    • Check the AutoVoice logs

    • Make sure the %st_attr_value variable is spelled correctly as it must be exact