I have an Arduino project with a TV outside of the room running an Android box. I recently decided I could take this a step further with the HC-06 module, which had the potential to display messages on the TV. I hit a snag when I figured out how hard it is to get the communication going. I'm pretty fluent in Tasker, but sadly there are not BT data options. I looked at getting a 1sheeld, but they are still developing their Tasker integration. Then I discovered AI2, and its ability to send/receive BT data. Did some more research, used the ActivityStarter to send messages to Tasker, then hit the "background activity" wall that everyone else has hit with AI2. It would only work when my app was in the foreground. Bummer. But I finally figured it out! AI2's SaveFile saved the day! The app will run in the background and still trigger Tasker events.
In AI2:
Add a File item, it's in the Storage tab
In your event block, add a SaveFile block
text is whatever text you want saved/sent to Tasker
file is the file name, /file.txt will save the file to the SD card (makes it easier to find in Tasker)
In Tasker:
New Tasker Profile > Event > File > File Modified
Click the magnifying glass to browse for your file
New Task > File > Read File
Choose your file, give it a Variable name (I used lower case, use upper if you need this to be a global variable to use in other tasks/profiles)
Then add whatever tasks you want! The variable you set will allow you to perform tasks based on the data sent from AI2/Arduino.
In the task you want to trigger
click the If checkbox > click the tags icon > select your variable > type in the ~ text (~ means your text matches the variable)
Now, even if your AI2 app is running in the background, it will save this file with whatever text you tell it to. Tasker will know this file has been modified, will read it, and will trigger a task based on the text. If there's an easier way to do this, please let me know. I couldn't find anything other than the ActivityStarter, which doesn't work in the background. Also, if anyone needs help using AI2 with the Arduino/Bluetooth combo, I would be more than happy to help!