Hey everyone,
I wanted to share a custom weather application I built to solve a very specific, annoying problem: Standard smart rain gauges are reactive, not proactive. If you are relying on a physical rain gauge to trigger your smart home rules (like closing windows, retracting awnings, or pausing irrigation), you usually have to wait for the physical "bucket" to tip. By the time that happens, your patio cushions are already wet, and a light, misty drizzle might never tip the bucket despite ruining your outdoor plans.
Advanced Rain Detection is a predictive logic engine that acts as the meteorological brain for your hub. It takes standard local data from your Ecowitt sensors (Temp, Humidity, Pressure, Lux, Wind) and applies advanced meteorological math to predict rain, track mist/drizzle before it registers on a gauge, and calculate exactly when the ground will dry afterward.
Here is a breakdown of what it does, the science behind it, and how you can use it.
Key Features & Home Automation Use Cases
1. Mutually Exclusive "Precipitation State" Virtual Switches The app exposes two virtual switches: Sprinkling and Heavy Rain. Only one can be active at a time.
- Use Case: Tie your Rule Machine rules to these switches. If
Heavy Rainturns on, close the motorized windows and retract the awning. IfSprinklingturns on, just change the LED strip colors on the patio to blue to warn guests.
2. Built-in State Debounce Weather is erratic. The app uses a customizable debounce timer (e.g., 5 minutes) for downgrading states. Upgrades (Clear -> Raining) are instant, but if the rain stops for 30 seconds and starts again, the app won't rapidly flip your virtual switches.
- Use Case: Prevents your motorized awnings from grinding themselves to death by opening and closing repeatedly during a passing, patchy shower.
3. Predictive Probability Setpoints & Notifications You can set a custom "Rain Probability Setpoint" (e.g., 75%). When the internal math decides a storm is highly likely, it sends a push notification before the rain actually starts.
- Use Case: Get a notification on your phone saying "Rain probability has reached 80%" so you have 10 minutes to bring the dog inside before the bottom falls out.
4. 7-Day History, Midnight Rollovers & All-Time Records The app has a custom dashboard UI that builds a CSS bar graph of your last 7 days of rainfall. It handles midnight rollovers natively (since Ecowitt resets daily totals at midnight) and keeps a permanent log of your "All-Time Record" rainfall day.
- Use Case: Gives you an instant visual of how saturated your yard is over the last week without needing to export data to Grafana or InfluxDB.
The Science: How the Engine Actually Works
To make this hyper-accurate, the app doesn't just look at humidity; it actively tracks the rate of change across multiple data points over rolling 1-to-3-hour windows.
Dew Point Spread (The Ultimate Predictor) Relative Humidity is a flawed metric because it changes with temperature. Instead, the app calculates the exact Dew Point using the Magnus-Tetens formula. It then tracks the Spread (Temperature minus Dew Point). When the spread drops below 1.5°F, the air is physically saturated.
- The Magic: If the spread is near zero, the app will trigger the
Sprinklingswitch even if the physical rain gauge reads 0.0. It successfully detects dense mist, fog, and drizzle that standard rules completely miss.
Cloud Front & Gust Front Detection The app tracks 10-minute historical deltas for Solar Radiation (Lux) and Wind.
- If Solar Radiation plummets by >60% in a few minutes while the sun is still up, a thick storm cloud just rolled over.
- If the wind spikes by >10mph simultaneously, the app recognizes a thunderstorm "gust front." Rain probability skyrockets instantly.
Rapid Cooling & Pressure Drops A sudden temperature drop of 6°F or more within 15 minutes, paired with a barometric pressure drop of >0.03 inHg/hr, is a textbook indicator of a severe storm downdraft. The app catches this and warns you.
Evapotranspiration & Drying Potential What happens after the rain stops? The app uses VPD (Vapor Pressure Deficit)—a scientific measurement of how much moisture the air can absorb—combined with wind speed and solar radiation to calculate the live "Drying Rate."
- If the rain stops but the air is still totally saturated with no wind, the dashboard will display Very Low (Ground stays wet). If the sun comes out and the wind picks up, it changes to Very High (Rapid evaporation). This is incredibly useful for knowing exactly when to un-pause your irrigation schedules!
Open Source & Free to Use
I built this to solve a problem on my own hub, and I want the community to have it.
This application is 100% open source, completely free to use, and free to dissect. Please feel free to copy the code, tear it apart, reverse-engineer the math, and adapt the logic into your own custom apps, drivers, or weather projects.




