Sharptools and Tasker

(Rick Johnson) #1

Im using Shartools and tasker to play an mp3 on my android Phone.
I have set one switch up so when its turned on an mp3 is played but it also plays when its turned off how to I prevent that

(Joshua Lyon ( Dashboard)) #2

You can use conditions in your Tasker profile to determine what actions to take based on the device state.

Are you using the Thing State event plugging along with a subscription to the switch?

Here’s a high level article on that approach:

The short version is to use the IF option on whatever action you are taking and use something like IF %st_attr_value ~ on

(Rick Johnson) #3

Thanks I tried your suggestion still does not work I get nothing

Never mind in Tasker Config under Attribute I typed in “on” once I removed all is well

(Joshua Lyon ( Dashboard)) #4

Thanks for the update and glad to hear that it’s working for you. Good point on the Thing State configuration - the attribute either needs to be blank or match the attribute name (eg. switch)

The Tasker article on pattern matching might be helpful for other more complex cases:

Of particular note is the part about case sensitivity:

Matching is case-insensitive (magic will match with MagiC) unless the pattern contains an upper-case letter e.g. Magic* will not match against magically, but it will match against Magic Roundabout

So it’s typically best to use all lower case characters unless you specifically are trying to match for a specific capitalized pattern.

And for anyone else who finds this, note that Tasker’s pattern matching only works with the pattern comparison (eg. '~'). The equality operator is looking for an exact match (eg. '=').