Merewether Weather, Merewether Tides and Solar Power Monitoring for Merewether, NSW, Australia - Newcastle Weather

Twitter Contact Login Search

Main

XTIDE to MQTT Python Bridge

Date:
By Mangrove Mike
Category: Linux Code

I love MQTT and learning very quickly to love Python.

For a while I've been publishing the tide data from XTIDE (http://www.flaterco.com/xtide/) on both my Merewether Weather site and the Manning Point Fishing Classic site but thought it would be great to get it into MQTT.

Yesterday I whipped together a quick Python routine to get tide, moon rise/set and sun rise/set data from XTIDE  and publish it to my local Mosquitto MQTT server.

The gist is below.

 

I can think of a few reasons to use this - initially though I want to get all my weather data as well as tides, sunrise/set etc into my Merewether Weather app via MQTT rather than the absurd path I'm taking via Weather Underground (it was easy at the time ;-) )   

You could create a cool tide notification system (for taking the traitors out through the cellar gate at low tide) , maybe a fishing calendar, a glowing orb that wakes you according to sunrise in another city or country (the Jetlag-inator). The ideas are bursting.

So here it is - have fun, of course alter for whatever area you need the tides. I have an old post on installing XTIDE on OSX ( Getting XTIDE working on Mac Server ) and have had it running for years on various Linux ports.  Lots of details on that at the XTIDe site.

Thanks for inspiration from my usual MQTT mentors and gurus (@andypiper, @andsc, @ralight, @knolleary, @kylegordon) and the David Flater for XTIDE.

Also (the ADULT warning) the tide data is informational only and should not be used for navigation or any other important things.  

It is also woth reading David's trials and tribulations on creating and supporting the harmonics data used by XTIDE (http://www.flaterco.com/xtide/faq.html#60)  . Shouldn't stuff like this be freely available ??????