Friday, November 20, 2015

Another Bluetooth Button Control Scheme

My post on adding button control to my Digital Dash project ( has turned out to be one of the most popular ones that I've written. (Around here that only means about 550 views, but it's something.)  It's been linked to in a couple of places and over on the AutoApps forum someone asked me if there was a way to make a button continually perform a task as long as it was held down.  It turned out to be pretty easy, so here's an example that controls the Media Volume of a device.

I chose to use the "Media Rewind" keycode to lower the system's media volume because it made sense in the physical layout of the Bluetooth Gamepad I was using, but you can, of course, use any key you want. To make a companion way to increase the volume, just copy the profiles and tasks and rename them with "Up" instead of "Down" in the names and change the "-1" in line A1 of the first task to a "+1". You'll also need to modify the IF clause in line A3 so that it checks for a maximum value rather than a minimum.

Profile: Vo!umeDownStart (437)
Event: AutoInput Key [ Configuration:Keys: Media Rewind
Key Action: Key Down ]
Enter: VolDown (436)
A1: Media Volume [ Level:%VOLM-1 Display:Off Sound:Off ]
A2: Wait [ MS:250 Seconds:0 Minutes:0 Hours:0 Days:0 ]
A3: Goto [ Type:Action Number Number:1 Label: ] If [ %VOLM > 0 ]

Profile: VolumeDownStop (438)
Priority: 11
Event: AutoInput Key [ Configuration:Keys: Media Rewind
Key Action: Key Up ]
Enter: VolDownStop (439)
A1: Stop [ With Error:Off Task:VolDown ]

A couple of things to note: The first profile triggers on the Key Down event and the second one triggers on Key Up. Be sure you bump up the priority for launched tasks in the second profile; it needs to be greater than the the task it's trying to stop. You'll also need to run AutoInput's KeySupress function before you use these profiles and then disable key suppression when you're done. The 250 ms delay in line A2 seems to give a nice response ramp, but if you want something a little faster, just decrease that value.  Finally, you'll probably need to disable "Restore Settings" in the first profile to make the volume changes stick.

Hope this helps someone.

Wednesday, November 18, 2015

Another (Very) Minor Tweak

I have a control on the main screen that allows me to toggle the tablet's AutoBrightness on and off, but it doesn't get used very much.  99% of the time we're driving in the sun with the top down and I want the tablet at full brightness.  About the only time I use it is on those rare occasions  when we are traveling at night.

It occurred to me today, though, that if I do dim the screen on the tablet, the phone will remain at full brightness.  That would be annoying and since I don't really have a control interface on that unit, changing the brightness would be distracting and annoying, requiring me to go into settings and fumble around.

I don't really want to put controls on the phone, so instead I used AutoRemote.  Now when I toggle the screen brightness on the tablet, it sends a direct message to the phone, which causes it to toggle as well.

As I said, a very minor thing, but when I need to use it, it will be handy.

Wednesday, November 11, 2015

Torque and Tasker

If you're interested in getting data from the Torque app into Tasker, take a look at the video I posted on YouTube:

It begins by showing you how to set up Torque, then steps through gathering the information and tools that you need, and finishes up with some actual Tasker code.

Thursday, October 29, 2015

Some More On-Screen Information

I've added a couple more pieces of information to the on-screen display.  Nothing major, just some more things I like to be able to see at a glance without having to interact with the system.

When I first made the Digital Dash, I was using the WeatherAce plugin to query a server and return the nearest local environment temperature.  It worked fine, but when I decided to mount the phone as a secondary screen dedicated to running Waze, I realized that it would be exposed to approximately the same temperature environment as the people in the car would.  So, I set up a task on the phone that would send an AutoRemote message containing data from the phone's built-in temperature sensor over to the tablet about every 30 seconds.  This gave me hyper-localized data, and I figured that if I wanted the surrounding area temp, I could just pull up the Weather Channel app.

But the more I thought about it, the more I realized that I wanted to see both values at any time; essentially an interior and exterior temperature display.  This time, however, instead of using WeatherAce, I decided to just use AutoNotification to scrape the temperature from the Weather Channel's notification.

Because I didn't want to make another display element (that I didn't really have room for) I just stacked the two temperatures into a single variable and linked it to the existing display.  In the screenshot, below, the interior (phone temp) is on top and the environmental temp (from the Weather Channel notification) is on the bottom.  There was enough extra room in the element that I didn't even need to change the font size.

The other piece of data I'm now sending to the tablet is the phone's battery level, along with its charging status.

Since the phone is mounted on the driver's "wing" window, and I don't like stringing cables across the car from the utility port, I normally just plug it into my Anker battery pack, which rides in a door pocket right below the phone.  The only problem is that on more than one occasion I've forgotten to push the button on the pack that starts the charging process.  I thought the phone was plugged in and didn't realize I was draining the battery until the phone put up its low battery warning.

Now, however, I can see the battery level and charging status for both the phone and the tablet right on the main screen.  In the screenshot, above, the tablet is the top entry, and the phone is the bottom one.  This also shows that the phone is plugged in and charging because the data is underlined.  (The tablet entry has the same capability.)

To make this work, I set up two new profiles on the phone.  One is a Power ANY profile with both an entry and exit task, and the other is a Battery Changed profile, which only has an entry task.

Here's the Powered profile:

Profile: V3_PoweredCheck (240)
State: Power [ Source:Any ]
State: Variable Value [ %TabletConnected Set ]

Pretty simple.  The profile just watches for a change in charging status.  The secondary context keeps it from firing unless the Digital Dash system is actually running.  The %TabletConnected variable is set when the phone project runs its startup sequence after it receives a command to start Bluetooth tethering from the tablet.  It's the equivalent of the tablet's %V3_DrivingMode.

Enter: V3_Plugged (241)
A1: Variable Set [ Name:%V3_PowerState To:-1 Do Maths:On Append:Off ] 
A2: Perform Task [ Name:V3_SendBatt Priority:%priority Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stop:Off ] 

Exit: V3_Unplugged (242)
A1: Variable Set [ Name:%V3_PowerState To:1 Do Maths:On Append:Off ] 
A2: Perform Task [ Name:V3_SendBatt Priority:%priority Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stop:Off ] 

The entry and and exit tasks are nearly identical.  They both adjust the value of the %V3_PowerState variable and then call the task that actually sends the AutoRemote message to the tablet.

Because I actually need to send two pieces of information in each message, I use a little simple math to concatenate the data.  As you can see, the entry tasks sets the %V3_PoweredState to "-1", while the exit task sets it to just "1".  Before the data gets sent, I multiply this variable by Taskers built-in %BATT (which contains the actual battery charge level).  So, when the phone is plugged in, the data sent is a negative number, and when the phone isn't charging, it sends a positive number.

Over on the tablet, I make a check for these conditions and use the result to decide whether or not to wrap the battery value in html underline tags.

(This seems a bit convoluted, and in theory AutoRemote can send multiple pieces of data in a single message, but I was never able to get that to work.  The messages just stopped going out, with no error indications.  So I went with this scheme instead.)

Profile: V3_BattTracker (244)
Event: Battery Changed
State: Variable Value [ %TabletConnected Set ]

The battery tracking profile is just as simple.  Any time the battery level changes and the tablet is connected, it executes the task that sends the AutoRemote message.  That's the same task called by the charging/not charging profile.

Enter: V3_SendBatt (243)
A1: Variable Set [ Name:%mybatt To:%V3_PowerState*%BATT Do Maths:On Append:Off ] 
A2: Variable Set [ Name:%tempmessage To: AutoRemote Key)&message=%mybatt=:=Batt Do Maths:Off Append:Off ] 
A3: HTTP Post [ Server:Port:%tempmessage Path: Data / File: Cookies: User Agent: Timeout:10 Content Type: Output File: Trust Any Certificate:Off Continue Task After Error:On ] If [ %TabletConnected Set ]

The messaging task does the multiplication I mentioned above and prepares an AutoRemote message.  The preparation must be done in a separate Variable Set action because if you try to add variables directly to the HTTP Post step, they won't be interpreted and only the variable names themselves will be sent.

This task, like the one that sends the phone's temperature, uses AutoRemotes direct messaging option.  I prefer this, because it doesn't need an internet connection to function.

That's it.  Pretty minor modifications, but nice to have.

Tuesday, October 27, 2015

Navigation ETA Information Revisited - Revisited

I had hoped that my solution to the missing information in the Google Maps navigation notification would be a temporary one.  While it does work, it's definitely a kludge and I'm happy to be able to go back to gathering that content via AutoNotification.

Thanks to a user in one of the AutoApps forums, I learned that the ETA information is available in the variable %antextsbig4 under Lollipop. (Formerly it had just been in %antexts.)  With that knowledge I was able to re-do my profile and task and get them working again, so I thought I would post the solution here.

Profile: V3_ETAScrape (109)
Cooldown: 30
Event: AutoNotification Intercept [ Configuration:Event Behaviour: true
Persistency Type: Both
Notification Apps: Maps
Get All Fields : true ]
State: Variable Value [ %V3_DrivingMode Set ]

This is the profile itself.  It triggers when Google Maps puts up a notification AND the %V3_DrivingMode variable is set.  AutoNotification is set as the event handler and configured to look at both created and persistent notifications.  I've also set the flag so that AN will get all the fields in a notification.

The other thing to note is that there is a 30-second Cooldown set on the profile.  This keeps it from constantly firing as Maps updates the notification.  While it does reduce the granularity of the information somewhat, it keeps this profile from blocking other tasks and may make it a bit more stable.

When the profile fires, it gathers the information from the notification and populates a number of AN variables.  However, for this job we only need one of them: %antextsbig4.  It will contain data that looks something like this:

3.2 mi - Continue onto US 20

2 hr 52 min (165 mi) to destination
Estimated arrival at 2:39 PM

If I had enough room on my main screen, I could just display that info in a text box, but I really don't have that kind of real estate available to me, so I need to take it apart and shorten it up.

Enter: V3_NotificationQuery (102)
A1: Variable Set [ Name:%ret To:
Do Maths:Off Append:Off ] 

The first thing the entry task does is define the %ret variable.  Blogger doesn't show it, but the variable is filled simply by hitting the "Enter" key when you create the variable.  This is necessary because we need to split %antextsbig4 based on line returns and Tasker doesn't allow you to enter a return directly in the Variable Split action.

A2: Variable Split [ Name:%antextsbig4 Splitter:%ret Delete Base:Off ] 

As promised, we first use the %ret variable to split %antextsbig4 into its individual lines.  After the split, %antextsbig41 will contain the turn-by-turn info and %antextsbig42 will be a blank line.  I don't care about either of those, so they remain unused.

A3: Variable Split [ Name:%antextsbig43 Splitter:) Delete Base:Off ] 

%antextsbig43 contains the first line of the ETA information.  By splitting it with a parenthesis I can extract just the first part of the line and ignore the "to destination".

A4: Variable Split [ Name:%antextsbig44 Splitter:at Delete Base:Off ] 

Now I split %antextsbig44, which contains the second line of the ETA info. I use the word "at" as the splitter, which isolates the first part of the line,"Estimated arrival", and leaves me with just the arrival time. (Splitters never become part of a variable, so the "at" is gone as well.)

A5: Variable Set [ Name:%V3_ETA To:%antextsbig431)
ETA: %antextsbig443 Do Maths:Off Append:Off ] 

The last step is to populate the %V3_ETA variable, which serves as the source for my onscreen text display.  It's simply a matter of taking the parts of the lines I've split and concatenating them.  Note that I had to add the ) back in because it was used as the splitter in an earlier step and was, therefore, discarded out of the variable.

This is a pretty simple, but very useful addition to the Digital Dash project and I'm glad to have it working properly again.

Saturday, October 03, 2015

Physical Controls for the Digital Dash , Part 2

Well, it took a bit longer than I expected (about six months longer) but I finally got my Flic Bluetooth buttons.  And I like them; see my full review here:

I'm not quite sure what I'm going to do with all of them (I have five), but I have added one on the right-hand side of the center console in the Z3 as a music control.

I also thought about mirroring its functions to another button on the back of the steering wheel, but I've found that the car's cabin is small enough that I can reach the button while driving without even shifting position, so I've dropped that idea for the moment.

Here are the functions the button performs.

When the main screen is showing:

Short Click - Next (random) track when PowerAmp is the music source.  When Pandora is playing instead, Skip the current track.

Double Click - Replay the Previous Track (PowerAmp only; no function for Pandora).

Long Click - Display the Favorite Songs menu with a cursor used to highlight selections.

When the Favorite Songs Menu is showing:

Short Click - Cause the music cursor to step down the list to the next entry.  If the bottom of the list is reached, the cursor wraps around back to the top of the list.

Long Click - Select the song under the cursor and have PowerAmp begin playing the track. This causes PowerAmp to display the album art for the song.  After about 5 seconds, the system returns to the main Digital Dash screen automatically.

Double Click - Cancels the Favorite Song menu and removes it from the screen without selecting any track.

If you read the first part of the physical controls documentation, you might recognize those functions as also being performed by the Bluetooth Gamepad that I've re-purposed into a sidearm controller.

In fact, I just reused the same code I wrote for that.  In order to make the Flic perform those functions, all I had to do was create the profiles that caught the various activations.  Once I had done that, I just linked to the existing tasks.  I don't think that it took me 10 minutes to get everything working.

We've taken a few drives and tried out the Flic and it has worked beautifully.  It's much easier (and safer) to click the button than it is to try hit the on-screen controls.

Monday, September 28, 2015

Flic Bluetooth Button Review

I had mentioned the flic Bluetooth buttons earlier when I was talking about adding physical controls to my Digital Dash Project (  I had been an early backer of the project on Indiegogo with the idea of using them specifically for that system.  I ended up ordering five of them, and four were delivered over the weekend. (Not sure what happened to the fifth one, but it was a late addition and may not come for a while.)

Although I won't be using them entirely as I planned, I've installed one in the car and will be experimenting with the others.  Since these are new, I thought I'd do a review.

What is a flic?

A flic is a self-contained Bluetooth button that can be connected to both Android and IOS devices to perform tasks when pressed.  The free flic software has direct integration with a number of apps and can be used with both IFTT and Tasker (Android only) to control nearly any action that you care to automate. Each flic can recognize three different activation types (Click, Double-Click, and Hold).  You can program these separately, so each button can essentially do three things.

Flics are the brainchild of a Swedish company, Shortcut Labs, who used Indiegogo to crowd fund the startup.  They reached their initial funding goal in only 30 hours and ended up with over $900,000 in pledges; 801% of their original goal.


The flics arrived in an attractive box that has a thank you message to Indiegogo backers on the bottom.  The Flics themselves are nestled in custom foam cutouts inside the box.  There are two layers of these, and each one can hold three flics, so each box can contain six buttons.  The foam rests on a cardboard stand which has some space underneath where the optional clips are stored.  

There was also an insert directing you to the website (, and a large round sticker that  you can use to show your support.

All in all, the packaging provides a nice presentation and holds the contents securely and safely.


Each flic is slightly larger than a U.S. quarter and just over a quarter-inch thick.  The body is covered with a textured, velvety rubber embossed with the cursive version of the name from the logo.  

The back is hard plastic that comes covered with thin transparent shield.  Removing that exposes the reusable adhesive that you use to stick the flic to a non-porous surface. If the adhesive loses its stickiness, you can just clean it with water and it will regain its holding power.  I had originally intended to mount a couple of these to the back of the steering wheel in my car, but I don't think the adhesive would be up to that task; it holds the button just fine on the console, however.

The unit is entirely self-contained and powered by a button cell battery that the company claims will last up to five years.  They also claim that the battery is common item and can be easily replaced, although there are no instructions that tell you what to get or how to change it.

Flics come in black, white, green, yellow, turquoise, but I choose all black ones for my application.

The button is light, but it has very nice tactile experience and a satisfying physical "click" when pressed.

There's also a small clip that you can attach to your flic so that you can clip the button to clothing.  The company suggests you might want to do this for personal safety or to provide a way of faking a phone call to get out of a bad Tinder date.


The free flic app is available in both the Apple and Google app stores and is required for operation.  It is used for pairing the button to your device, assigning actions, and changing settings.  You do need a free flic account to use the software.

The flic app is also where you start and stop the flic service.  This service must be running in order to use a flic on your device.  By default, it runs as a foreground service that starts when your device does and puts up a persistent notification.  You can use it as a background service as well, but then it is subject to be killed by memory management.  There doesn't seem to be any appreciable battery drain from this service when it isn't being used, so there's really no need to ever turn it off, but you can if you'd really like to.  

Once you've set up a flic (See Operation, below) you can access the individual functions.  There are 46 built-in app integrations and most of them give you several options to choose from.  You have free rein to set things up as you wish.  That is, one button can control up to three different apps: a single-click might turn on your Phillips Hue lights, while a double-click might send a text message, and a hold command could start a Skype call.

More sophisticated options such as IFTT and "Send Intent" allow for even greater control.  (And, of course, there's Tasker, integration, which means you can do anything you want.  Tasker is covered separately, below.)

I won't cover all the settings, but there is one that I particularly like.  By default, a flic will play pleasant sounding chimes through your device to indicate that it has been pressed.  Each action type has a different chime associated with it, so you know right away if your press has been registered.  For my Digital Dash project, this is ideal and I've left it enabled, but you can turn it off if you wish.

Finally, the app also has a help section that explains most functions, but it also has context sensitive help that walks you through most operations.

This is a nice, simple piece of software that gets the job done.  It has a clean and open look that make it easy to navigate and use.


Here are the basic steps to using a flic.


Pairing is a simple operation.  Just open the flic app and press the button once.  The app generates a key and links the button to your device.  Once that is done, the process is automatic from then on.  Flic appears to use Bluetooth Near to detect the button and activate it.  You don't need to turn it on, wake it up, or do anything else; it's just there when you need it. Once it's in range, it's active.  Once the button is paired, you can go ahead and rename it and configure it.


Open the app and touch the button entry on the screen.  It will then take you to another screen where you can add actions for each type of button press.  Just tap the plus sign to get a list of programs.  Click one of those and the system will guide you through the steps to get everything set up.  If you already have an action, there is a standard "three dot" menu that allows you to Remove, Edit, or Execute the action.

Use with Tasker

When I first opened the flic app and began scrolling through the list of possible integrations, I was a bit concerned because I didn't see Tasker anywhere on the list.  I was afraid it didn't make the initial release cut and that I'd need to wait before I could use it.

However, on a hunch, I went into Tasker itself, created an Event profile, and chose the Plugin category.  Sure enough, there was flic.  Installing the app also installed the Tasker plugin.

Using it is very simple.  Once you chosen flic as the Event handler, you just click the standard Tasker plugin configuration icon and you are taken to a screen where you choose the flic you are programming and which of the three activation types you are trying to capture.  Once you've done that, you link the profile to the task you want to execute.  In other words, it's just like every other Tasker plugin you've ever used.  Note that the plugin gives you a few more options, such as triggering on either the up or down portion of a press and executing a task based on the button connecting or disconnecting.

It only took me a few minutes to program the flic to act as a Next Track button for both Pandora and PowerAmp.  In the next day or two I'll be programming its other functions to provide additional music control and I'm confident that it will work as expected.

Notes and Observations

Here are a few random things about using the flic.

You can have up to eight (8) flics connected to a single device.

A flic can only be paired to one device at a time.  If you want to use it with a new mobile, you need to disconnect it from the old one first and move it to the new one by opening the flic app on the new device and pressing and holding the button for at least seven seconds.  The app will connect to the flic servers and download the button's key.  Since all this is stored in your flic account, it will also download the configuration for the button, so your programmed actions come over as well.

Response time is excellent.  When my Digital Dash project is in full swing, it really works the tablet; running turn-by-turn navigation, regularly querying web servers via Bluetooth tethering, running Torque (which is also writing it's own log file), sending and receiving AutoRemote messages, handling interactive screen overlays, playing music, and more.  Despite all that, there was never any lag between pressing the the flic and hearing the confirmation chime.  This is a very fast implementation.

There is a "Providers" screen under settings where you can disable apps or services that you don't use or configure the ones you do.


I like these little buttons a lot. There were some delays in getting them out, but I'm glad the company chose to delay and release a product that they were happy with rather than putting out something that wasn't quite finished.  I feel that they delivered exactly what they promised and I have no regrets about backing them.

As of the time of this review, flics are not yet shipping to the general public.  However you can pre-order them on their website ( with an estimated time delivery of about eight weeks.

If you need or want a simple physical control for a project, flics are a good choice.