Monday, January 26, 2026

Ambient Weather Rain Gauge

About 8 years ago, I bought an Ambient Weather weather station so that I could monitor the weather at my home while I was away. I have had it set up at three different homes in the same area since then and it has worked very well for me. It collects the information and then sends it to the "cloud" once a minute. I can then look on their website and see the current and historical information. I have loved this, especially when we have had some significant weather events, like a glancing blow from a hurricane (direct hits mess with the power and internet access, so data is lost then. 


 Although the device gives me this data on their website, I decided I wanted the current data in a different format on my phone where it would all be on one dashboard. The data can be queried through an API they provide and I have become well versed in writing Java apps for my Android device over many years, so this was easy for me to do. In the past year, I realized the weather event I was most interested was rainfall. The device measures it well and keeps charts and graphs of events over a one month period and less detailed information over a year. I wanted to have up-to-date rain information at a glance in my home, so I created a rain gauge app to work on an Android tablet and placed that on the wall. It alarms when rain starts and ends so I am alerted to the changing weather outside. 


 Since the rainfall totals accumulated only extend to the month, I also wanted to keep yearly and (meteorological) seasonal totals. To do this, I created an app for my Windows laptop that would store the historic data by day, week, month, year and season in a file. It could then distribute this information via messaging (MQTT) to the tablet gauge so all of this info is available at a glance. 

 As I am always looking for a new programming challenge, I decided to see if I could get this information to an even closer, personal device; my watch. I've had several Android smart watches over the years, but I've never tried putting an app of my own on them. Android Studio, which is my programming platform, has Wear OS capabilities. So I created an app and started working on what I wanted it to do. 

 When I started, I discovered that Java is not the programming language that is desired for Wear OS apps, rather Kotlin. I had not programmed in Kotlin before, so I had to do some studying on the differences between Kotlin and Java. As it turns out, Android Studio is very good at helping out with syntax and coding. I was able to import modules I had already composed in Java and convert them to Kotlin. Except for small changes I had to make, this was very simple.

Android Studio was also able to create companion Wear and Mobile apps, something needed to get the watch and phone to communicate with each other. I was then able to create a Rain Gauge App for my watch that displayed all the same info as the wall rain gauge.


As I was doing this, I discovered another aspect of smart watches I had not encountered; complications. Although it sounds daunting by its name, these are areas of the watch face that contain information other than the time. They can have pictures, text, and range data. I realized that I could go one step further with my personalization of the rain data by putting it right on the watch face. Android Studio heled me a lot with this coding as well. Soon I had the data right there to see at a glance. Also, tapping on the complication info brings the entire rain gauge app to the display.


I can get notifications on my phone when it starts or stops raining, notifications if one of the data feeds stops sending in data, and even, something I have had trouble with, a notification when my watch battery is running down. Although the watch is supposed to do this itself, it has only worked sporadically at best.

This has been a real adventure in programming for me and I can't wait until the next feature I decide to add.