• Personal Blog

    Posted on January 2nd, 2015

    Written by Denis Finnegan


    Pebble Watch Denis Finnegan

    My First Pebble App

    I had just gotten a Pebble Watch for Christmas and I do love a good gadget. I spent a good chunk of the Christmas week exploring the Pebble App Store looking for any and every app that could be relevent to my life. At present some of my favourites are ones are the Misfit App which tracks my activity and has been giving my Fitbit Flex a real run for its money, Smart Status for displaying my next meeting and Smartwatch+ which can do everything from weather, to take pics remotely on the phone, find my phone and even do http requests. Cards is another great app and there are a few more I load on and off, I won’t bore you now, maybe another time.

    Irish Weather by Denis FinneganIn any case, there were loads of weather apps but it was all symbols and tempratures. Nowhere was there a simple written forcast for the Irish Weather like on the Met Eireann Website iteslf which I thought would be handy. There were quite a few apps that allowed you to connect to RSS feeds so firstly I thought I’d make an RSS feed for MetEireann, especially when on their own FAQ, they say:

    Do you supply an RSS feed of your forecasts?
    This is not something we provide at present, although we hope to do so in the future.

    So I wrote a simple bit of code to try out an RSS Feed using Bottle as a quick little server to host the API and using the framework PyRSS2Gen to Help generate the RSS. Unfortunately, the RSS option just wasn’t working out for me, I believe the framework was too old a standard to work with newer RSS clients and so I said, what the hell, how hard can it be to build an actual App for the Pebble Watch.

    Building the Irish Weather Pebble App

    Firstly, I signed up to the Pebble Developer Website and as luck would have it, in early 2014 after launching the Pebble App Store, the Pebble team launched PebbleJS which lets you write Pebble applications completely in JavaScript. To quote the Pebble.js section on the Pebble Developer site:

    Pebble.js applications run on your phone. They have access to all the resources of your phone (internet connectivity, GPS, almost unlimited memory, etc). Because they are written in JavaScript they are also perfect to make HTTP requests and connect your Pebble to the internet.

    Now, I don’t know Javascript, I know its not easy but I figured, if I could pick up the basics of Python, surely I could do the same for Javascript and with the PebbleJS Kit doing must of the work, it was worth a go. Even better Pebble had the ability to develop their apps in the Cloud (CloudPebble) and push them to your watch on your local network. Very easy! Very Impressive.

    Before I even got to writing my app however, I faced the prospect of having to scrape the met.ie website and an API to call it, then I’d need to host that API on my server and I didn’t yet have Python setup there. Groan… in this case it was the Pebble end of things I was interested in and while I could totally do all this, I really wanted to jump to the exiting bit at the end.


    Kimono Labs

    Kimono Labs

    Enter the Kimono service which can scrape web pages to API services. With Kimono, you can rurn websites into structured APIs from your browser in seconds and it realy is that simple, ok well kind of. Ok it was a bit fiddly but that was due to the met.ie site being a bit all over the place rather than any fault of the service I believe. I had to play around with it a little ad stick in a bit of regex, (for example ‘/()(?:Outlook\s*)(\n.*)()/’ to get the 3 day outlook) to get exactly the bits I wanted but I got there after a while. You can set the service to scrape when you like, I set it to once an hour and then give you a lovely JSON output and URL to call your service from. You can set the type of output even to give CSV and RSS. I really cannot praise this service enough. I think it might be a bit more tricky for something more complex but for simply just repeatidly graping something from a page, it was ideal.

    Ok, Finally, the App

    Ok so we’re getting there, the app. It’s really very basic indeed. I effectively have created a simple menu that at least for the national weather, will pull in a sort of preview off the main menu. I then use cards to display the detail of each forcast and all thos works off PebbleJS’s ability to make direct AJAX calls for the page data. If someone selects one of the regional forecasts, then the weather.js file is called and the today, tonight & tomorrow is all loaded into one card and there is a separate API for each of these forceasts (seemed like the easiest way to do it).

    That’s really it, as you can see there is only around 150 lines of code between the two files which I’ve put up on my GitHub Account which you are welcome to. https://github.com/finmix/IrishWeather/tree/master

    The screen grabs below are of the app itself, all text, nothing fancu as you can see but very functional.

    Irish Weather Pebble App Menu Regional Menu on Irish Weather App Todays Weather on Irish Weather App


    I already have 3 hearts and 12 downloads in the pebble store, I think I might be getting the pebble dev bug! For my next project here I think I might have a go at a Dublin Bus App, I’ve seen a Dart Train one and one that even works for Buseireann but nothing that takes advantage of the Real Time Information from Dublin Bus.

    Really, if you have a pebble, you should definately give this a go, I’ve not had as much fun in a while but that probably says more about me lol!

    This entry is filed under Personal Blog. You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.

    Take a look at some of the responses we have had to this article.

  • Leave a Reply

    Let us know what you thought.

  • Name(required):




    CAPTCHA Image
    Play CAPTCHA Audio
    Reload Image