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.
Unfortunately, last year magicseaweed.com was acquired by a rival surf forecasting site surfline.com, and earlier this year the API was closed and the app no longer works. I have found a way to get it up and running again using other sources to get the data, but the drawback is still the limitation on the size of responses the watch can handle, and also that web requests from the watch go via bluetooth using a connected smartphone and can be quite slow. There is a way around this, which would be using a service to collate all the information I need together, format it in as brief a way as possible, and host it cached somewhere for the watch to get it quickly in a single request, and that will be the next project to get the app up and running again!