Category Archives: How To

Time Tracking with Tasker (Driving & Sleep Time)

I listen to the podcast Cortex when I’m driving, and they got me interesting in looking up time tracking and how maybe this would benefit me. I already use Rescuetime with Exist as a measure of sleep, productivity, social media posts, and other things that correlate to these like the weather, the length of the day, and more. It’s pretty neat and I look at it several times a week.


One metric it misses is driving time. As someone who drove 17,000 miles in the last 12 months for work this is pretty key to me. Apparently rescuetime can do it with an expensive add on, but that only works in the US so that’s no good.

I had a look through the rest of the Exist integrations and nothing really supports what I want. So, I’ve found another way of recording this information directly. Sadly it won’t be with the rest of my Exist data but aTimeLogger generates its own fancy graphs and allows me to export the data to standard formats.

Screenshot of aTimeLogger

Android Auto –> Tasker –> aTimeLogger

Basically the flow is as follows. You could also automate this based on connecting to a certain bluetooth radio, or even just an NFC tag you have stuck to your dashboard.

  1. Plug my phone into my car with Android Auto.
  2. Tasker notices the change in UI mode
  3. Tasker sends an intent to aTimeLogger to start timing.
  4. Disconnect from my car
  5. Tasker notices the change
  6. Tasker sends another intent to aTimeLogger to stop timing.

To get this working, add your groupings to aTimeLogger. I added a top level grouping of transportation with train and driving inside this grouping. I guess I’ll add flying to this at some point too.

Once this is done, go into Tasker and create two new tasks. One for when you plug your phone in, and one for when you disconnect.  The task below is for when you connect your phone, and is explained line by line:

  • A1: Wait for 3 seconds for the connection to stabilise and the radio in the car to sort itself out.
  • A2: Using the aTimeLogger plugin in tasker, stop the Driving task if running and start it again.
  • A3: Wait another 4 seconds, same reasoning as above.
  • A4: Announce over the speakers that tracking is working. This seems to be able to talk over radio just like Google Maps can so is good if you’re not actively listening to Spotify or something.
Start Tracking Driving (2)
	A1: Wait [ MS:0 Seconds:3 Minutes:0 Hours:0 Days:0 ] 
	A2: aTimeLogger [ Configuration:Stop running and start Driving Timeout (Seconds):0 ] 
	A3: Wait [ MS:0 Seconds:4 Minutes:0 Hours:0 Days:0 ] 
	A4: Say [ Text:I'm tracking your driving now Engine:Voice:default:default Stream:3 Pitch:5 Speed:5 Respect Audio Focus:On Network:Off Continue Task Immediately:Off ] 

The stop driving task is pretty much the same, but A2 is reversed so it’s Stop driving. Pretty simple. Make sure you actually save your changes as I managed to close them without saving.

Now you need to create some profiles that trigger based on Android Auto being active or not. The best way I found to do this was checking the variable %UIMODE and seeing if it was set to ‘car’ or not. This is set by Android Auto so its a good indicator as to whether I am in the car or not! Maybe there’s a better way but this works for me.  Let me know in the comments?


Profile: Car Active (7)
	State: Variable Value  [ %UIMODE ~ car ]
Profile: Car Not Active (8)
	State: Variable Value  [ %UIMODE neq car ]

Both of these profiles are then linked to the above tasks which we previously set up. Now next time you connect your phone to Android Auto it should start time tracking in aTimeLogger and announce over your speakers that it’s doing so. As soon as you disconnect (I have to turn the ignition off, and open the drivers door before the phone fully disconnects) it will stop and save that time log. You shouldn’t have to do anything further! Enjoy the data.

You might have noticed in some of the screenshots that I am also doing something similar with sleep tracking. To do this, I am using SleepAsAndroid alarm clock with its Android Wear add-on to actually track my sleep.

Tasker is listening for the intents from SleepAsAndroid and starting the timer in aTimeLogger then stopping it for me in the morning when I stop my alarm.


How to scrobble to with Spotify Connect

June 2018 Update now natively supports scrobbling from Spotify Connect. The Listenz service has now been discontinue.

To enable this, head to your account settings and open the Applications tab. Connect to Spotify here (Spotify Scrobbling) and you’ll be good to Scrobble from Android Auto, Bose Soundtouch, PS4 and other Spotify connect applications.

Screen Shot 2018-06-09 at 15.21.05

The rest of this post is left as an archive.

It’s pretty much impossible to scrobble songs you listen to via Spotify Connect via the standard spotify apps. However, recently Spotify released an updated API that allows the retrieval of the currently playing track. Some kind soul has therefore made the Spotify Scrobbler‘ Listenz (they had to change the name to avoid the spotify trademark, apparently.)

Spotify Scrobbler - Scrobbling for Spotify Connect

This means you can now track your plays from the PS4, and other devices that utilise Spotify Connect such as the Bose Soundtouch speaker range. Fantastic! It also means you can disable the unreliable scrobbling from each Spotify app you use as they break at least once a week for seemingly no reason. Super fantastic.

Removing Duplicate Scrobbles on

So, my account/spotify went mental last week and logged a single song 1000 times in a row. Since is currently in the throes of dying and removing every last useful feature from their site, I was wondering how I could fix this.

Well, sk22 on Github has provided a handy piece of javascript that works perfectly. Simply navigate to the page and enter the script into your address bar (or add it to a bookmark on the bookmark bar) and enjoy your duplicate free library!

Screen Shot 2017-08-15 at 20.29.16

Add to your bookmark bar for easy one click reduplication!