Updated. Please read the next post too. Yak shaving a Pebble
A lot has happened since my last post, almost a year now. I wrote the last post while on parental leave and after the leave I have changed job twice. Well, one could say once as the last change was because the company was acquired. That was an interesting period. I first changed job to Tunigo, a small company making it easier to find good music through human curated playlists. Then after 6 months Tunigo was acquired by Spotify.
But, a month ago I finally received one of all gadgets I happen to order online. A Pebble watch. The first watch I have had on my wrist in many years. I once had a Fossil PalmOS watch, but it had to be charged every day so that didn’t last too long. Though the Fossil was great fun. I could run asciimation on it, a crazy app I made for the Palm many years ago. Can’t stop laughing when I see it. But the Fossil couldn’t run tinyGL which would have been even more crazier. The Pebble is also programmable, but it is not as powerful as the Palm, though it works great as an iPhone companion. There is an SDK available here. The watch can also somewhat connect to the internet with the help of httpebble and the iPhone app httpebble.
I’ve had an idea to write a small watch app to check some online information easily on the watch. I decided to go for an watch app as it would be very easy to just press a button to step through the watchfaces and get the information auto-magically.
But what should the watch show? I decided to make something that showed some stock I like to follow, i.e Elekta. The round trip to gather this information is a number of jumps. First the watch sends a request to the app on the phone, which sends the request to my server on memention.com, which scrapes another server for the information. The informations is packed into a small JSON response and sent back, via phone and finally to the watch.
I could easily fit 5 rows of stock values on the display. I have iterated the code once so it became more flexible. It now makes two requests, one to get the labels and one to get the values, making the app fit more use cases. So for public use I made it get some market indexes like Dow Jones and Nasdaq instead of my own preferred stocks. (I believe it’s 15 min delayed from original server with up to a 5 min local cache on my server)
The Pebble SDK has some quirks as the watch is very limited. But the examples were easy enough to look through to find out necessary steps etc. As always it felt like making the icon was the biggest hurdle. I also recommend reading the SDK carefully as some functions doesn’t actually copy information but rather just keeps the pointer, which means one really need to plan where things live while the app runs.
One thing I stumbled over was that httpebble don’t seem to cope with json responses longer than around 75 bytes. This could perhaps be a limit that exist when sending the dictionary from the phone to the watch.