Smartwatch surf forecasts via magicseaweed’s API

When I bought my garmin smartwatch, I was impressed by how many different apps there where already available for it, but also dissapointed that I couldn’t find one that could give me the surf forecast for my local beaches. So of course I decided to code one myself.

I found that magicseaweed.com (a popular surf forecasting website) had an API available to provide their surf data in a json format, they only offered API keys on request and required that any app using them carried various logos and links back to their site, copyright notices and such. On a smartwatch it’s difficult to fit all these things on such a small screen but I emailed them anyway explaining that I just wanted to use it on my own watch and wasn’t intending to release the app publicly, and as luck would have it the guy responding to the requests for API keys was based not all that far from me and had himself recently bought a garmin watch. He agreed to give me an API key to obtain surf data for my local break only, and asked if I could compile a version for his model of watch and send it to him too once completed.

The API gave data on predicted wave sizes, wind speed/direction, and swell size/period/direction predictions for 3 hour periods for up to 5 days, a lot of data, and I found the watches in this range have a limitation of 40kB for web requests. Also due to the way the garmin “monkey C” coding language handles the json responses and converts them into it’s own dictionary type variables, the limited memory on the device is rapidly filled up so the request had to be split into 2 or 3 seperate filtered requests to avoid the app running out of available memory and being halted.

The app itself runs as a “widget”, one of many available screens which can be scrolled through from the main watch face. Widgets can be “entered” when they are visible with one of the side buttons (or a tap on touchscreen models) in order to show more data, so there was room for a large easy to read screen with the current conditions showing on the widget, and then a scrollable list of 5 screens showing the forecasted conditions for the next 5 days. In later models of watch a “glance” widget was introduced – a smaller widget view allowing 3 “glance” widgets to be on screen at once.

Leave a Reply

Your email address will not be published. Required fields are marked *