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

weather
smartapp_weather
project_alerts

(Andy - United Kingdom) #1

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


Fire Sprinkler Alarm Integration
12VDC Trigger
Existing Sprinkler System
Multi level float switch
(RH) #2

I look out of the window…

I’M KIDDING!


(Jason "The Enabler" as deemed so by @Smart) #3

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


(Andy - United Kingdom) #4

@rudyinDana
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:


(Andy - United Kingdom) #5

@bamarayne

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


(Andy - United Kingdom) #6

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


(Andy - United Kingdom) #7

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


(Andy) #8

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

https://www.amazon.co.uk/POPP-POPE700168-Popp-Z-Rain-Z-Wave/dp/B06Y3JLLD1/ref=sr_1_178?ie=UTF8&qid=1494188673&sr=8-178&keywords=z+wave


(Andy - United Kingdom) #9

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


(John C) #10

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


(Andy - United Kingdom) #11

@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.


(Andy) #12

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:


(Andy - United Kingdom) #13

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.
e.g.
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:
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  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
 *  
 *  
 */
definition(
    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: "https://s3.amazonaws.com/smartapp-icons/Meta/temp_thermo-switch.png",
    iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Meta/temp_thermo-switch@2x.png"
)

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}"
	initialise()
				}

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

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") {
   log.info "$switch1: $evt.value, Disabling automatic control"
     					     }
    if (state.currS1 == "on") {
   log.info "$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"
    relay1.setLevel(myLevel)
   						   	   }
     if (state.currS2 == "dry") {
   log.info "$water1: $evt.value, Enabling automatic control"
     					     }
      
					 }
                     
                     
// Actions on temperature change (dependant upon switch & sensor settings)

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

	}
				   }
							}

Comments & suggestions welcome :slight_smile:


(Jason "The Enabler" as deemed so by @Smart) #14

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.


(Andy - United Kingdom) #15

@bamarayne
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


(Jason "The Enabler" as deemed so by @Smart) #16

I’m going to use with EchoSistant.

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


(Andy - United Kingdom) #17

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


(Jason "The Enabler" as deemed so by @Smart) #18

I just bought two of these.one 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.


(Andy - United Kingdom) #19

@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


#20

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.