[RELEASE] Rain Warden: Context-Aware Rain Detection & Dashboard

"Watch the sky. Ignore the noise."

Most rain automations are "dumb." They wait for a sensor to trip, trigger a switch, and then flap on and off repeatedly as the rain rate fluctuates. Worse, they often trigger false alarms on windy, dry days because your sensor shook on the pole.

Rain Warden is different. It doesn't just read your sensor; it analyzes the environment. It uses humidity, temperature, wind speed, and vapor pressure deficit (VPD) to determine if it is actually raining, if it's just a "ghost tip" caused by wind, or if a storm is imminent.


:star2: Top Features at a Glance

  • :shield: The "Ghost Tip" Filter: Uses a confidence score based on local humidity to block false positives. If your sensor tips but the air is bone-dry (<40% humidity), Rain Warden knows it's likely just wind vibration.
  • :crystal_ball: Predictive Logic: Analyzes humidity trends and wind speed to calculate a "Rain Probability" score. It can alert you that rain is likely before the first drop hits the sensor.
  • :bar_chart: Live HTML Dashboard: A beautiful, self-updating dashboard tile that shows rain rate, event totals, confidence scores, and drying conditions—all locally hosted on your hub.
  • :thermometer: Seasonal Intelligence: Automatically adjusts rain thresholds based on temperature. It understands that "heavy rain" in 95°F heat implies different storm dynamics than in 50°F drizzle.
  • :brain: Smart Hysteresis: Uses a "Schmitt Trigger" logic to prevent switch flapping. Once rain starts, it holds the "Active" state longer to ensure your windows don't open and close repeatedly during showery weather.

:desktop_computer: The Dashboard Tile

Rain Warden creates a dedicated HTML tile for your dashboard that updates live (every 15 seconds) without refreshing the page.

What it displays:

  • Status Banner: Changes color based on state (Green for Ready, Red for Heavy Rain, Blue for Sprinkle) .
  • Hero Metrics: Large, readable Rain Rate with trend indicators (Rising/Falling :arrow_upper_right: :arrow_lower_right:).
  • Dual Scores:
    • Conf (Confidence): The system's trust in the current rain data.
    • Prob (Probability): The likelihood of ongoing/imminent precipitation.
  • VPD (Drying Potential): Calculates Vapor Pressure Deficit to tell you how fast things will dry out once the rain stops.
  • Event Stats: Total rainfall for the current storm, plus peak wind gusts.

:gear: How It Works (The Logic)

1. The Dual Scoring System

Rain Warden doesn't just look at "Rain Rate > 0." It calculates two critical scores every time your sensor reports:

  • Confidence Score (0-100%): If your rain sensor reports rain but the humidity is 30%, the Confidence score drops drastically. The system ignores the rain unless Confidence > 75%.
  • Probability Score (0-100%): If humidity is high (>90%) and rising, and wind is picking up, the Probability score climbs. If it hits 75%, the system can send you a "Heads Up" alert before the rain starts.

2. Smart Switches

The app exposes two virtual switches for your automations:

  • HEAVY RAIN Switch: Turns ON only when rain is confirmed and rate exceeds your threshold (default 0.05 in/hr).
  • SPRINKLE Switch: Turns ON immediately for light precipitation (mist/drizzle). Note: This remains ON during heavy rain, acting as a "Any Precipitation" master switch.

3. VPD & Dry Delays

When the rain stops, the app doesn't just turn off immediately. It calculates the Vapor Pressure Deficit (VPD) using temp/humidity.

  • High VPD (Dry Air): The system resets quickly (5 mins) because surfaces dry fast.
  • Low VPD (Muggy Air): The system extends the "Active" state (15 mins) because surfaces remain wet longer.

:hammer_and_wrench: Installation & Setup

  1. Install the Code: Copy the Groovy code into Apps Code in Hubitat.
  2. Enable OAuth: Crucial Step! Open the app code, click OAuth, and enable it. This is required for the live dashboard tile to function.
  3. Add User App: Go to Apps -> Add User App -> Rain Warden.
  4. Select Sensors:
  • Rain Sensor: Ecowitt, Ambient, or any standard rain device.
  • Humidity/Temp: Required for the logic engine.
  • Wind (Optional): Improves prediction accuracy .

:bell: Notifications & Alerts

Rain Warden includes a robust notification engine. You don't need Rule Machine for alerts.

  • Styles: Choose between "Urgent" (:warning: ALERT), "Standard" (:cloud_with_rain: Heavy Rain), or "Minimal" text styles .
  • Predictive Alerts: Get a ":crystal_ball: RAIN PREDICTED" message when conditions imply a storm is forming.
  • Stale Sensor Watchdog: If your sensor stops reporting for 30 minutes (dead battery/gateway offline), the system will alert you: ":warning: Sensor is OFFLINE/STALE".
  • Quiet Modes: Mute notifications automatically during sleeping hours or specific modes. Includes a "Strict Mute" option to silence even critical alarms if desired .

:bulb: The Inspiration

The driving force behind Rain Warden was the need for a "high-end," proactive solution to home weather awareness. Standard automations are often too reactive—telling you it’s raining only after the patio is soaked.

I built this to solve two specific, daily frustrations:

  1. The Morning Commute: There is nothing worse than getting ready for work, heading out the door, and only then realizing you need an umbrella or a coat. I wanted the house to tell me what was happening before I stepped outside.
  2. Pet Safety: My dogs would often be in the backyard when a harmless sprinkle suddenly escalated into a heavy downpour. By the time I noticed, they were already soaked and muddy.

Rain Warden solves this by tying predictive analytics and "guaranteed" confidence scores to virtual switches. This allows you to trigger specific actions—like playing a polite "It’s sprinkling" MP3 on a smart speaker or sending a high-priority push notification—bridging the gap between "it might rain" and "get the dogs inside now."

3 Likes


:building_construction: Rain Warden: Hub Performance Guide (C-5 vs C-7 vs C-8)

Because Rain Warden is more than just a simple automation—it performs math calculations (VPD, probability), generates complex HTML dashboards, and forces aggressive 1-minute polling during storms—it impacts hub resources differently depending on your hardware.

Here is what you need to know about running this app on your specific hub.


:rocket: The Flagships: Model C-8 & C-8 Pro

If you are running the latest hardware, Rain Warden can run "fully unleashed."

:white_check_mark: The Pros

  • Zero Lag Dashboard: The live HTML dashboard renders instantly, even with the complex CSS gradients and animations.
  • Radio Range: Since weather stations (especially generic Z-Wave ones) are often placed outdoors or at the edge of the property, the C-8's external antennas provide the best reliability for sensor reporting.
  • Raw Power: You can leave Debug Logging ON during a heavy storm with 1-minute polling active, and the C-8 won't even blink.

:x: The Cons

  • Overkill? None. This is the ideal environment for the app.

:tractor: The Workhorse: Model C-7

The C-7 is the baseline standard for this app. It runs perfectly, but you should follow standard best practices.

:white_check_mark: The Pros

  • Fully Capable: Handles the logic engine and predictive math without issues.
  • Reliable Polling: The 1-minute "Active Rain" polling cycle works fine, provided your Z-Wave mesh isn't already critically congested.

:x: The Cons

  • Logging Overhead: While it handles the math fine, writing to the database (Logs) every minute during a storm can generate "System Busy" warnings if you have 50 other apps running.
  • Recommendation: Once you have Rain Warden set up and working, turn OFF "Debug Logging" in the app settings.

:hourglass_flowing_sand: The Legacy: Model C-4 & C-5

Rain Warden is compatible with older hubs, but because it is a computational app (math + UI generation), you need to be mindful of resources.

:white_check_mark: The Pros

  • It Works: The Groovy code is optimized to be lightweight. It does not use "heavy" parent-child device structures that typically bog down older hubs.
  • Extended Life: Gives your older hub modern, "smart weather" capabilities without needing an upgrade.

:x: The Cons

  • The "Active Rain" Impact: When it rains, the app wakes up every 60 seconds to check sensors. On a C-5 with a heavy Z-Wave load, this added traffic plus the logic calculation can cause slight mesh delays (e.g., a light turning on 1 second late).
  • Dashboard Loading: The HTML tile generation might take a split second longer to render.

:warning: Critical Settings for C-4/C-5 Users:

  1. DISABLE Debug Logging: This is mandatory. Do not leave logging on during storms.
  2. Check Your Mesh: If your hub is already slow, consider setting the standard Polling Interval to "15 Minutes" or "30 Minutes" so the app stays quiet when it isn't raining.

:bulb: Summary Table

Feature C-8 / C-8 Pro C-7 C-4 / C-5
Logic Speed Instant Fast Good
Dashboard Instant Load Fast Load Slight Delay
1-Min Polling No Impact Low Impact Medium Impact
Debug Logs Safe to leave ON Turn OFF after setup MUST Turn OFF

:question: Frequently Asked Questions (FAQ)

Troubleshooting & Dashboard

Q: My dashboard tile shows 0.00 or "Loading..." and never updates. A: This is almost always a "Mixed Content" security block by your web browser.

  • The Cause: The live dashboard fetches data from your hub using a local HTTP address (e.g., http://192.168.1.50). If you are viewing the Hubitat interface via HTTPS, your browser blocks the "insecure" local data.
  • The Fix: Access your dashboard using the http:// prefix in your browser address bar. Alternatively, configure your browser's site settings to "Allow Insecure Content" for your hub's IP address.

Q: I see an error in the logs saying "OAuth not enabled." A: The app cannot create the public access token required for the dashboard unless you manually enable it.

  • The Fix:
    1. Go to Apps Code -> Rain Warden.
    2. Click the OAuth button (top right).
    3. Click "Enable OAuth in App" and then Update.
    4. Click Save on the code again.

Q: Why does the "Custom Link" button trap me in the Hubitat Mobile App?

A: The custom link at the bottom of the dashboard opens in the current window (_self ).

  • Advisory: If you use the Hubitat Mobile App, clicking this may navigate the internal webview away from your dashboard. Since the mobile app has no "Back" button in full-screen mode, you may have to force-close the app to return. This feature works best on desktop or tablet browsers.

Logic & Behavior

Q: Why did my "Rain Event" total reset to 0 while it is still raining?

A: Rain Warden reports the raw rainEvent value sent by your physical sensor.

  • Context: Many weather stations (especially Ecowitt and Ambient) have internal firmware logic that resets the "Event" counter if the rain rate drops to 0 for a specific time (e.g., 1 hour), even if the storm isn't over.
  • Workaround: If you need a number that strictly increases all day, rely on the Daily Rain value instead.

Q: Why didn't I get a "Predictive Rain" alert for the second storm today? A: The predictive system uses a "Latch" to prevent spamming you every time the wind gusts.

  • The Logic: Once a predictive alert fires (Probability > 75%), the system "latches" and will not send another alert until the probability drops significantly (below 60%) .
  • Scenario: If humidity stays extremely high (e.g., 95%) between two storms, the probability score may never drop below 60%, so the system assumes the first alert is still valid.

Q: I live in a desert/arid climate. Will this app work? A: Yes, but you should check the Ghost Tip Filter setting.

  • The Issue: The default logic penalizes rain confidence if humidity is below 40%. In a desert, valid rain can occur at 30% humidity.
  • The Fix: If you miss real rain alerts, go to settings and turn OFF "Enable Strict Ghost Tip Filter." This disables the dry-air penalty.

Switches & Automation

Q: Does the "Sprinkle Switch" turn off when the "Heavy Rain Switch" turns on? A: No. The logic is additive.

  • Behavior: When heavy rain starts, BOTH the Sprinkle Switch and Heavy Rain Switch will be ON.
  • Reasoning: "Heavy Rain" implies that it is also "Sprinkling." This ensures that automations triggering on "Any Precipitation" (via the Sprinkle switch) stay active throughout the entire storm.

Q: My "Heavy Rain" switch seems to trigger late. Why? A: This is intentional to prevent false alarms.

  • The Threshold: The rain rate must exceed your configured Rain Threshold (default 0.05 in/hr) AND the Confidence Score must be >75%.
  • The Delay: It may take 1 or 2 sensor reading cycles (approx. 60-120 seconds) for the calculated rate to breach these thresholds. If you want faster reaction times, lower your Rain Threshold to 0.02.

Performance

Q: Will this slow down my older Hubitat (C4/C5)? A: It is optimized, but "Active Rain" mode is intensive.

  • Behavior: During rain, the app forces a poll every 1 minute to capture peak rates. On older hubs with heavy Z-Wave meshes, this can use CPU resources.
  • Mitigation: If your hub feels sluggish during storms, go to the app settings and turn OFF "Enable Debug Logging". Writing logs is often more "expensive" than the math itself.

Q: What does the "Sensor Stale" alert mean? A: This is a safety watchdog.

  • Trigger: If your rain sensor has not updated its "Last Activity" timestamp in 30 minutes (customizable), the app assumes the device is dead, offline, or out of battery.
  • Action: It sends a critical alert and disables the system to prevent stuck switches. Check your sensor's batteries or gateway connection.
1 Like