How to tell if it's raining or snowing (Without looking outside!)

I have a conservatory that has electric roof vents/windows & I have a SmartApp I wrote that controls them and opens/closes with temperature. (via a Fibaro roller shutter relay)

The problem is… when it rains!
Due to the positioning of my conservatory when it rains the wind blows water into the windows if they are open. This leads to a 0% WAF as the conservatory floor gets wet! (and I get into trouble)

When we are at home, I manually disable the ‘auto’ settings when it rains which automatically closes the windows.

The obvious problem is that we like to leave the house occasionally :slight_smile:
So I had to do something that will detect when it is raining and close the windows.

Searching for some ideas on Google I found this little beauty:

Cheap enough at £27.00 to try and not too expensive if it fails.
Looking at the specs it shows that it runs from 12Vdc and even has a little 1w heater to dry the sensor out when the rain stops.
It’s basically a rain controlled N/O relay with a couple of LEDs to show power and if the relay has tripped. It’s also fully encapsulated meaning no water can get inside.

So… Here it is:

Very easy to connect to SmartThings via a cheap Foxx water sensor. With another app (or a tweak of the one I wrote before) I can control the virtual switch to enable/disable the automatic windows.

As I will use a little plugin 1amp 12vdc supply to run this I thought I might as well power the water sensor too and remove the pain of changing batteries.

If you open the water sensor it is quite easy to discover where to connect the power to.

Obviously I needed a way to drop the 12v to 3v to power the sensor.

Thank you China!

For a previous project, I had bought a number of variable voltage regulators from Ebay which are little circuits with a ‘trim’ screw to set the output voltage.
I set it up on the 12v supply I was going to use and set the voltage with my multi-meter to exactly 3V
A small blob of hot glue to prevent the screw from moving completes that part of the project

Fitted this into a small project box I had lying around (Thanks again China) and hot glued the rain sensor on the top.

I used the sensor plug (cut from the end of the Foxx water sensor cable) to tilt the rain sensor so that rain will run off the surface (as recommended by the manufacturer)
Not very pretty but it does the job and set the rain sensor at what I thought was about the right angle.

A few extra blobs of hot glue to seal the cable entries and I’m done.

Total cost: about £65 if I didn’t have a few bits lying around

I’m lucky enough to have some waterproof boxes outside which have power sockets in them (used for the electric lawnmower etc.) so I just plugged it in and sat the sensor on the top of the socket box.

Now… I’m off to ‘tweak’ my smartapp and pray for rain so I can do a real world test


I look out of the window…


1 Like

Great find! Use a for a real world test… Or just wait five minutes… You are in the UK after All.

Hahaha… I knew I was missing a trick
I would too if I was at home :slight_smile:

I tried using various weather programs but they just told me if rain was expected or raining in my general area
This at least lets me know if there is rain in my garden :slight_smile:

1 Like


Hey! we haven’t had rain since I installed it 10 minutes ago :slight_smile:
Although I live in the North East of the UK so we are guaranteed some this afternoon


Seriously though, I tried it with a wet finger on the sensor plate and it tripped, so it seems quite sensitive.
I may have to tilt it a bit more if it doesn’t dry out quick enough

Tweaked the Z-Wave Water Sensor DTH I was using to make it look right on the ‘Things’ page

By coincidence I came across this whilst searching for something else yesterday;

1 Like

Andy that looks good… I didn’t see that
But I enjoyed making mine (for about £20 cheaper with a guaranteed DTH) :slight_smile:

This is a real clever project. Nicely done! :sunglasses::+1:

1 Like

@Barkis Thanks John

I can’t believe it! - Bright sunshine all afternoon! :frowning:
I tried pouring water over it and it worked perfectly - Drying after about 5 mins of no rain from my garden watering can.


Absolutely, always a better buzz when you make it yourself. I think the Poppy sensor must be a new release as that’s the first time I’ve seen it on Amazon. Also unlike yours I doubt the Poppy will detect snowfall.

I have an unreliable analog system for rain. When my dog appears through the dog flap, comes into the lounge and shakes her wet coat all over everything I know it’s raining.:grinning:


Well I thought as it was just about finished it, I’d post the SmartApp that I wrote for this.
Please bear in mind that this is really for my own situation but I thought it might be a useful starting point for other users. (feel free to modify)

This is configured to open the windows a set level due to increased temperature.
If a temperature sensor reports a certain temp then open the windows to a pre-configured level (10%-90%)
At a higher temp then open the windows fully
As the room cools then do the opposite at the same temps, finally closing when below a set level

Switch - Optional
If a switch is configured - Only operate when that switch is on.
If the switch is turned off then close the windows and don’t automatically open them again.

Rain Sensor - Optional
If a water (rain?) sensor is configured only operate when this shows 'Dry’
If it starts raining then close the windows (disregard temp settings)
A few minutes after it has stopped raining (when the sensor reports ‘Dry’ then the automation starts again

All of this can be configured for different modes and for different days of the week.
I’ve tested it as best I can and it’s now in daily use but if anyone wants to use it and has suggestions/problems then please let me know
So here it is…

 *   Updates
 *  =========
 *  Last Update: 10/05/2017
 *  V1.5 - Added ability to schedule days of the week
 *  V1.4 - Added ability to enable/disable opening with water sensor AND/OR an override switch
 *  V1.3 - Added capability to set 'Partially Open' level
 *  V1.2 - Added capability to enable/disable via water sensor
 *  V1.1 - Added control switch to enable/disable opening 
 *  V1.0 - Original POC
 *  Copyright 2017 SecurEndpoint
 *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 *  in compliance with the License. You may obtain a copy of the License at:
 *  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
 *  on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
 *  for the specific language governing permissions and limitations under the License.
 *  Temp Controlled Windows V1.5
 *  Author: AJ Parker
    name: "Temperature Controlled Windows",
    namespace: "Cobra",
    author: "AJ Parker",
    description: "Monitor the temperature and when it drops above or below your Temp setting set the window level.",
    category: "Convenience",
    iconUrl: "",
    iconX2Url: ""

preferences {

    section("Which window/vent control relay?") {
    input "relay1", "capability.switchLevel" , title: "Select Device", required: true
    section("Enable/Disable Switch") {
    paragraph "Select the switch to to enable/disable"
		input "switch1", "capability.switch", title: "Select switch if using this method to enable/disable", required: false 
    section("Enable/Disable Rain Sensor") {
    paragraph "Select the water sensor to enable/disable"
		 input "water1", "capability.waterSensor", title: "Select Sensor if using this method to enable/disable", required: false

	section("On Which Days") {
        input "days", "enum", title: "Select Days of the Week", required: true, multiple: true, options: ["Monday": "Monday", "Tuesday": "Tuesday", "Wednesday": "Wednesday", "Thursday": "Thursday", "Friday": "Friday", "Saturday": "Saturday", "Sunday": "Sunday"]
	section("Monitor the temperature...") {
		input "temperatureSensor1", "capability.temperatureMeasurement", title: "Select Sensor", required: true
	section("Below this temperature the window/vent should be 100% Closed") {
		input "temperature1", "number", title: "Temperature?" , required: true
	section("Above this temperature window/vent should be Partially Open - MUST be between fully open setting and fully closed setting") {
		input "temperature3", "number", title: "Temperature?" , required: true
	section("Above this temperature the window/vent should be 100% Open") {
		input "temperature2", "number", title: "Temperature?" , required: true
   	section("Patially Open Level") {
		input(name:"halfLevel", type:"enum", title: "% Open", required: true, options: [10,20,30,40,50,60,70,80,90])


 // Processes & Handlers      
def installed() {
	log.debug "Installed with settings: ${settings}"

def updated() {
	log.debug "Updated with settings: ${settings}"

def initialise() {
	subscribe(temperatureSensor1, "temperature", temperatureHandler)
    subscribe(switch1, "switch", switchHandler)
    subscribe(water1, "water", rainHandler)

def switchHandler(evt) {
   state.currS1 = evt.value  // Note: Optional if switch is used to control action
   log.debug "$switch1 = $evt.value"
   if (state.currS1 == "off") { "$switch1: $evt.value, Disabling automatic control"
    if (state.currS1 == "on") { "$switch1: $evt.value, Enabling automatic control"

def rainHandler(evt) {
    state.currS2 = evt.value   // Note: Optional if Rain sensor is used to control actions
    log.debug "$water1 = $evt.value"
    if (state.currS2 == "wet") {
    def myLevel = 0
    log.warn "$water1: $evt.value, It's raining! Setting $relay1 to $myLevel"
     if (state.currS2 == "dry") { "$water1: $evt.value, Enabling automatic control"
// Actions on temperature change (dependant upon switch & sensor settings)

def temperatureHandler(evt) { "temperature: $evt.value, $evt"
  def df = new java.text.SimpleDateFormat("EEEE")
    def day = df.format(new Date())
    def dayCheck = days.contains(day)
    if (dayCheck) { "Today is $day so we can proceed as it is one of the configured days of operation"
if (state.currS1 == "off") { "$switch1 is off so automatic change is not enabled - Not moving $relay1"
if (state.currS2 == "wet") { "$water: $evt.value, so automatic change is not enabled - Not moving $relay1"
    def fullClose = temperature1
    def fullOpen = temperature2
    def halfOpen = temperature3
    if (evt.doubleValue <= fullClose) {
    def myLevel = 0
    log.trace "temperature: $evt.value, Setting $relay1 to $myLevel"
	else if (evt.doubleValue >= fullOpen) {
     def myLevel = 100
     log.trace "temperature: $evt.value, Setting $relay1 to $myLevel"
    else if (evt.doubleValue >= halfOpen) {
    if (evt.doubleValue < fullOpen) {
    def myLevel = halfLevel
    log.trace "temperature: $evt.value, Setting $relay1 to $myLevel"
      else if (evt.doubleValue < halfOpen) {
    if (evt.doubleValue > fullclose) {
    def myLevel = 50
    log.trace "temperature: $evt.value, Setting $relay1 to $myLevel"


Comments & suggestions welcome :slight_smile:

1 Like

I’m building this as soon as I can. I want to use to send alerts via text and my home audio… It will let me know it’s raining and remind me to roll up the windows in the cars.

1 Like

Jason, I’m using it for the same as well as the conservatory windows.
I’m using it with Big Talker and (with a virtual switch) it works great

1 Like

I’m going to use with EchoSistant.

Also, going to use rechargeable batteries and connect it to one of my solar powered garden lights!

1 Like

You will need 12v for the relay and 3v for the water sensor or door contact

I just bought two of for the front and one for the back. I’ll connect it to a contact sensor that I already have for the st integration. I’ll modify the dth for what I need.

This will run off of the solar lights batteries. The solar cell will recharge the batteries during the day.

I’ll keep y’all posted on how well this works out.


@bamarayne I’ll be interested to see how you get on
I am aware that the digital output can’t sink a lot of ma - not sure how you are going to connect a relay

1 Like

I like all of your ideas. However, there is an easier way to know if itr is raining.

Combine what already exists:

Step 1:Solder 2 length of wire or one for each terminal on the water sensor and hot glue the other ends to the inside of the plastic bowl.
Step 2: Silicon weather proof the water sensor.
Step 3: Place everything under the open sky.
Step 4: Setup an Alert with Notify Me app and whola. You have a Rain or Snow sensor with little work.