posted Dec 7, 2014, 9:50 PM by Joshua Lyon
updated Feb 9, 2016, 7:10 PM
As of version 1.07, SharpTools has a Tasker Event plugin called Thing State which can be used to trigger events in Tasker when a subscribed Thing's state changes. For example, you can choose to subscribe to the Temperature of an Aeon Multisensor and have an Event trigger if the temperature is too low or high. Or you might subscribe to the 'switch' state of a light switch and trigger an event when the light turns on or off.
You may also be interested in the following articles:
Whenever an event is triggered, the following local variables are set in Tasker:
%st_thing_id = The internal Thing ID of the Thing that triggered the event.
%st_thing_name = The user friendly name/label of the Thing that triggered the event.
%st_attr_name = The attribute name that triggered the event. (eg. 'switch', 'level', 'temperature')
%st_attr_value = The value of the attribute that triggered the event (eg. 'on', '100', '72')
Subscribe to a Thing's State
To use the Thing State plugin in Tasker, you must first subscribe to the state of a Thing.
- Open SharpTools
- Make sure you are using the default SmartApp provider
- Change to the 'Things' screen
- Long press on the desired Thing
- From the Subscriptions menu that pops up, select the state you would like to subscribe to
Upon successfully subscribing to a thing, you should see a confirmation message. The very first time you subscribe to any device, SharpTools will register your device with Google for push messages and will respond with a 'Device registered with GCM' message.
React to Thing State changes in Tasker
After subscribing to a Thing's state within the main SharpTools application, you can configure Tasker to react to state changes:
- Open Tasker
- On the Profiles tab, click the '+' icon to add a new Profile
- Select Event > Plugin: Thing State
- Click the pencil icon to edit the Configuration
- Fill in the optional filters and click Apply
- Press the back button on your mobile device to continue setting up the Tasker
- Select the 'New Task' option
- Leave the New Task Name blank and press the checkmark
- Click + at the bottom of the screen to add an action
- Choose Alert > Notify
- In the title field, enter
- In the Text field enter
- Press back to save the Action, back again to save the Task, and back again to exit Tasker
Now whenever a subscribed device's state change, a notification will appear showing the Thing Name as the title and the Attribute Name and Value as the text.
Tasker: Thing State Event Filters
The Tasker Event plugin, Thing State, has a set of filters that allow you to determine which events to react to.
- If either field is left blank, the field is treated as a wildcard and all things or attributes are matched.
- If both fields are left blank, the system will match all events that are triggered
- If the Thing field is filled in and the Attribute field is left blank, the system will match all events for a particular thing name
- If the Attribute field is filled in and the Thing field is left blank, all events for the particular Attribute will be matched.
- For example, Attribute = "Switch" and Thing = blank would match all switch events (eg. on/off events)
- Each field performs a partial content match.
- For example, if the Thing field has the word
hall entered, the system will match all things with hall in their name (eg. Upstairs Hall, Downstairs Hall, Shallow Light)
- These fields also accept Tasker variables as parameters
- Tasker variables start with a % symbol such as %myvariable or
- In the Voice Control Things example, the local variables
%device are parsed from AutoVoice and passed to the SharpTools Tasker plugin.