User Tools

Site Tools


custom_command_tasker

Guide for custom commands integrated with Tasker

Custom commands integrated with Tasker allow to merge the infinite possibilities of Tasker with the powerful voice recognition handling of KLets, giving you the ability to create commands to perform almost everything (from taking a photo, to change the color of the light in a room using a wireless Arduino).

A custom command allows to define which Tasker's task to execute, which variables must be set on it and by which voice commands it is triggered.

In order to use them at their full power, you need to firstly understand how Tasker variables work reading its Online Guide.

Activation phrases

In order to start a command, you need to define by which phrases it can be triggered, and those phrases are called “Activation phrases”. A command can have one or more activation phrases, and KLets will start it when your command match one of these activation phrases.

Variables

A variable, in KLets, is a portion of an “activation phrase” that can change when it is said, or it is an information that can be said separately from the activation phrase itself.

Each activation phrase can have any number of variables. Also, if a variable is needed to execute a command and it is missing from the said activation phrase, KLets can be configured to ask for it.

Values that can be said for a variable depends on its “Type”: it can be a number, a contact name, a contact phone, a phone number, a song name etc, and it can be specified while defining the variable (it is needed because KLets must exactly know which values are allowed for a variable in order to correctly handle voice recognition inaccuracies).

KLets variables can be used from a Tasker's task by their names in lowercase prefixed by a percent. For example, if a variable in KLets is named “SECONDS_TO_WAIT”, it can be used from a task with the name “%seconds_to_wait”. Complex variables like contacts or audio entries are sent to Tasker separated in more variables, each one prefixed with the variable name and with appended information name. Plase check the table below in order to know how complex types they are translated.

Other variable types can return multiple values, like contact name or audio entries variables. KLets can manage these variables in order to sent to Tasker only a single value, asking for which one to send, or it can send all results to Tasker. You can choose how to handle them selected the variable type ending with “(single value)” or “(multiple values)”. Multiple values are sent to Tasker as array variables.

Currently KLets allows to use the following types:

Type Accepted values KLets variable name example Converted Tasker variables examples Description
Numeric Only numeric values SECONDS_TO_WAIT %seconds_to_wait It will contains only digits like “11”, “120” etc.
Phone number Any value compatible with a phone number NUMBER_TO_CALL %number_to_call It will contain a phone number, like “+012345#78*9”
Free text Any value SOME_FREE_TEXT %some_free_text It will contain a textual value like “message to sent to tasker”
Free text (without confirmation) Any value. KLets will not asks for a confirmation SOME_FREE_TEXT %some_free_text It will contain a textual value like “message to sent to tasker”,
Tasker's task name A Tasker's task name TASK_NAME %task_name It will contain an existing Tasker's task name
Time only (relative or absolute) A time value, like “at 11 and 20 minutes”, “in 70 minutes” and so on TIME_VALUE %time_value It will contain a text with the nearest future date matching the given time, formatted like “25/04/2013 22:55:58”
Date with optional absolute time A date with an optional time, like “12 December 2013”, “tomorrow at 12” and so on DATE_VALUE %date_value It will contain a text with the date said, formatted like “25/04/2013 22:55:58”
Application A name of a launcher icon APP_TO_LAUNCH %app_to_launch_name Will contain the name of the launcher icon for the application
%app_to_launch_package_name Will contain the android package name
%app_to_launch_component_name Will contain the component name to use to launch the icon
Audio - Generic media A name of a playlist, an artist, a song or an album. Can be enforced to a specific media type using one of the other type which name starts with “Audio - ” MEDIA_VAR %media_var_name Will contain the name of the matched audio entry
Audio - Artist name Only a name of an artist %media_var_type Will contain the type of matched entry. It can be “ALBUM”, “ARTIST”, “SONG” or “PLAYLIST”
Audio - Song name Only a name of a song %media_var_source Will contain the source of the media info. It can me “STANDARD” or “POWERAMP”.
Audio - Album name Only a name of an album %media_var_media_id Will contain the standard Android media ID when the source is “STANDARD”, otherwise it will contains the Poweramp internal ID.
Audio - Playlist name Only a name of a playlist %media_var_google_music_3_id Will contain the Google Music v3 internal id only when the source is “STANDARD” and Google Music v3 is installed.
Contact A name of a contact saved inside the cotact list CONTACT %contact_name The name displayed inside the contact list for the contact
%contact_contact_id The internal Android id for the contact
Contact - Phone number A name of a contact number. It can be only the contact name, or the name with the number label CONTACT_PHONE %contact_phone_name The name displayed inside the contact list for the contact
%contact_phone_contact_id The internal Android id for the contact
%contact_phone_label The label for the contact phone number as displayed inside the contact list
%contact_phone_number The phone number
Contact - Email address A name of a contact email. It can be only the contact name, or the name with the email label CONTACT_EMAIL %contact_email_name The name displayed inside the contact list for the contact
%contact_email_contact_id The internal Android id for the contact
%contact_email_label The label for the contact email as displayed inside the contact list
%contact_email_mail The email address
Contact - Location address A name of a contact location. It can be only the contact name, or the name with the location label CONTACT_LOCATION %contact_location_name The name displayed inside the contact list for the contact
%contact_location_contact_id The internal Android id for the contact
%contact_location_label The label for the contact address as displayed inside the contact list
%contact_location_address The contact's location address
Contact - Skype account A name of a skype account. CONTACT_SKYPE %contact_skype_name The name displayed inside the contact list for the contact
%contact_skype_contact_id The internal Android id for the contact
%contact_skype_skype The skype account name

"Take photo" Example

This is an example showing how to create a command that take a photo with the rear camera through Tasker, with an optional delay in seconds.

In this example, we will create the Tasker's task that takes the photo, and that will handle a delay in accord to a local variable value if it is set. Then, we will create the custom command in KLets, defining the Tasker's task to execute, the variable to use to handle the seconds for the delay, and two activation phrases to trigger the command (one without the variable and one with the variable for the delay).

  1. Create the task in Tasker that will be triggered by KLets and give it a name like “Photo”
  2. Inside that task:
    1. Add an initial “Wait” action, with seconds set to a variable named “%seconds”, and configured to be executed only if a variable “%seconds” has been set
    2. Add a second “Take Photo” action configured as you like
  3. This is how it will look like:
  4. Go to KLets and create a new custom command for Tasker:
    1. Give it a name like “Take photo”
    2. Set the task to trigger to the one created before (like the one named “Photo”)
    3. Define a variable named “SECONDS” setting its type to “Number - Generic” and leaving it as “not mandatory” (do not check the bottom check box)
    4. Add two activation phrases, one without the delay and one with a delay set:
      • Take a photo
      • Take a photo in [SECONDS] seconds
    5. This is how the final command should be:
    6. And this is how the variable SECONDS should be:
    7. Save the command

That's it. Now, every time you will say a command to KLets, it will try to compare what you said to every activation phrase defined for the custom command just created.

So, when you will say “take a photo”, KLets will trigger the task “Photo”, and because the phrase “take a photo” matched the one that doesn't contain the KLets variable “SECONDS”, KLest will not set the “%seconds” variable on the task (and this will prevent the “wait” action of the task to be executed in accord to the “if” condition configured on it).

Instead, when you will say “take a photo in 4 seconds” or “take a photo in 20 seconds”, KLets will still trigger the task “Photo” but will also set the variable “%seconds” to “4” or “20” (depending on what you said), because the phrase matched the one that contains the KLets variable “SECONDS”.

custom_command_tasker.txt · Last modified: 2013/09/15 13:34 by lukakama

Page Tools