Fuse is a Telemetrics Platform for Your Car: Trips on Your Calendar


Summary

Fuse is more than just a connected-car app. Fuse is a telemetrics platform for your car. This post shows how I was able to, in a few hours, create an iCalendar feed for the trips that my truck takes and automatically put them on my calendar. This illustrates why I believe calendars will be one of the key UI components of the Internet of Things.

fuse trio

When I describe Fuse to people, I often say it's three things:

  1. A device that plugs into the OBD II port on your car, has a GPS and cellular connection, and constantly stream data from your car.
  2. A mobile app for interacting with the data.
  3. A personal cloud platform, under the car owner's control, where the data is stored and processed.

I talk about them in this order because I usually go on to emphasize that what's really important here is the personal cloud. Put another way, Fuse isn't a OBD II device and an app. Rather, Fuse is a telemetrics platform for your car. More importantly, it's your telemetrics platform.

In Fuse, the vehicle sends data to its micro-cloud (what I call a "pico") whenever something changes (the fuel is low, the battery is low, there's a diagnostic code, the ignition turned off, and so on). The pico stores and organizes that data. Other things, like an app or a Web site allow the owner to interact with that data.

fuse-flow-app

Yesterday I had an idea that shows the power of viewing Fuse as vehicle telemetrics system instead of a mere connected-car app. One of the things that makes data useful is putting it in context. It occurred to me that the right context for the trip data from my car is my calendar.

To show you what I mean, here's a screenshot of my calendar with the trips I made Tuesday. Note that there's a trip of 7.2 miles from 9:43am to 9:58am. The context, of course, is the Fuse team meeting I had at the UVU BRC right after it (in blue). I can see at a glance that this trip was connected to the Fuse meeting at 10am. The interleaving of my trips with my appointments makes the reason for the trip clear. (I've put a red box around the two appointments I'm talking about so you can see them in the small image. Click thru to see the full size calendar.)

Trips on my calendar

Another thing that's clear from putting my trips on a calendar is that I can see how much of my day was spent in the car. This was a particularly heavy day since I went to the airport to pick up my brother and it shows.

As an added feature, the appointment includes a URL to the Google Map for the trip. Here's the map for that trip to UVU:

Trip from my calendar

This works using a iCalendar feed from my truck's pico (the micro-cloud that is storing the data). I installed a function in the pico that uses the stored trips to generate an iCalendar feed on demand. I simply subscribe to the URL for that function from my calendar. My calendar updates the appointments as I drive my truck. For example, I just got back from picking up my daughter at school and the trip's sitting there on my calendar. This illustrates why I believe calendars will be one of the key UI components of the Internet of Things.

We can modify the flow I showed earlier to take this new element into account:

fuse-flow-calendar

The data is now used by my calendar in addition to the app. And of course, there's no limit to the ways we can use the vehicle's data. Picos are programmable and each one can be customized as its owner requires—just like a PC in the good old days. As a result, they create a flexible substrate for Fuse. Using that programmability, I was able to create a iCalendar subscription from my Fuse data in an afternoon. This isn't just possible for me because I'm building the Fuse API; this power is available to anyone. One of the things that makes Fuse unique is that not only does it have an API, but that API is extensible by anyone willing to learn how picos work and program a little KRL.

The Technical Details

If you're curious about the KRL that creates the iCalendar feed, here's the actual function that does the job:

ical_for_vehicle = function(search){
  num_trips = 25; // return last 25 trips
  sort_opt = {
    "path" : ["endTime"],
    "reverse": true,
    "compare" : "datetime"
  };
  sorted_keys = this2that:transform(ent:trip_summaries, sort_opt)
                  .slice(0,num_trips-1);
  t = sorted_keys
      .map(function(k) {
         e = ent:trip_summaries{k};
	 start = waypointToArray(e{"startWaypoint"}).join(",");
	 dest = waypointToArray(e{"endWaypoint"}).join(",");
	 miles = e{"mileage"} || "unknown";
	 url = "http://maps.google.com/maps?saddr=#{start}&daddr=#{dest}";
         {"dtstart" : e{"startTime"},
	  "dtend" : e{"endTime"},
	  "summary" : "Trip of #{miles} miles",
	  "url": url,
	  "description": "Trip ID: " + e{"id"},
	  "uid": "http://fuse.to/ical/v1/trip/" + $e{"id"}  
	 }
      });
  vdata = vehicle:vehicleSummary();
  meta_data = {"name": vdata{"label"}, 
               "desc": "Calendar of trips for " + vdata{"label"}}
  ical:from_array(t, meta_data);
};

As KRL functions go, this one's pretty complicated, but it's basically creating a sorted list of keys from the trip data (sorted_keys) and then using those keys (k) in a map() to access trips (ent:trip_summaries) and create a JSON version of an iCalendar entry (t) that we feed to ical:from_array() to generate the actual iCalendar data.

Because of how the Sky Cloud meta-API works in a pico, I'm able to expose this function via a URL and that becomes the iCalendar subscription URL.


Please leave comments using the Hypothes.is sidebar.

Last modified: Mon Feb 10 18:43:31 2020.