Announcement

Collapse
No announcement yet.

Is it raining today?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Is it raining today?

    I have a number of events that behave differently on days that it's raining and after some recent changes, I'm trying to get this funtionality back again.

    I'd been previously using WeatherPLUG with HS1.7. WeatherPLUG updates virtual devices with lots of weather info including the amount of rain that has fallen "Rain Today". This made it simple to use in scripts.

    Example:

    Dim Rain
    Rain = hs.DeviceValue("w25")
    if Rain =0 then
    hs.writelog "Weather","No rain today"
    elseif Rain >0 then
    hs.writelog "Weather","RAINING TODAY"
    end if

    I'm moving over to HS2 and have switched from WeatherPLUG to the WeatherXLM plug-in for weather info. I've done this for two reasons... the WeatherPLUG plug-in is experiencing some issues with HS2 when pulling data from stations that aren't 100% reliable. The area where I live only has a single station (which is unreliable) with the nearest backup around 25mi away. The local station doesn't provide any "rain" info either, so I was pulling this from the station 25mi away and it was often not very accurate because of the distance.

    WeatherXML provides nice looking info on the Web Interface, but with all the additional icons and text, it's difficult to use this info in scripts (ie. is it warmer than 75 degrees outside?, is it raining?).

    I was able to modify the weathercom_xml.txt script that came with the plug-in to populate a second set of hidden virtual devices that only contain the raw data. This seems to work well as I now have a virtual device that contains only "57" for the temp instead of "Santa Barbara, CA 57 F Which feels like 57 F click thermometer icon to go to weather.com" with the icon.

    THANKS IF YOU'RE STILL WITH ME!

    Back to "is it raining". WeatherXLM pulls data from weather.com which in my case seems to provide much better real-time feedback to rain conditions than I could get using WeatherPLUG. However, it provides it in the "condition" field which can be many things such as:
    • Sunny
    • Fair
    • Cloudy
    • Mostly Cloudy
    • Rain
    • Light Rain
    • Heavy Rain
    • Rain and Windy
    Here's my delima... how does HS know if it's raining? I can probably cobble togehter a scrip that checks to see if my virtual "condition" device W21 equals any of the possible rain conditions (but I'm not even sure how many there are).

    I know lots of others are using this plug-in, has anyone else already tackled this?

    Any advice on how to create a more elegant script to check for rain would be greatly appreciated...

    Cheers,
    Paul

    Click to visit: www.sbsmarthomes.com
    Santa Barbara Smarthomes

    Authorized Russound Dealer & Installer

    Personal HA Website

    HomeSeer User Profile

    #2
    I use PM Weather script for that. It has a device that will say-"It Is Not Raining" "It is Raining". Works fine with HS2.
    Tim
    Attached Files
    FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

    HSTouch Layouts - https://www.facebook.com/media/set/?...5902188&type=3

    Comment


      #3
      AWS (WeatherPLUG and PM Weather) updates the data in near real time so changes in rainfall are easy to determine. WeatherXML is typically hourly so your resolution will not be as good. If the rainfall amount for the daily rain changes between two readings then you know it is raining.

      Comment


        #4
        Fungun & Michael,

        Thanks for the advice, but both WeatherPLUG & PM Weather pull data from Santa Barbara Municipal Airport which doesn't provide any rain information.

        We had several inches of rain over the last few days and these sites don't report any. The nearest site that WeatherPLUG & PM Weather appears to be able to collect info from that reports rain is over 25 miles away and isn't accurate enough.

        I was watching the info that WeatherXML was providing during the storms and off/on rain we've had and even through it only updates once per hour... it seemed to be really accurate. Don't know where Weather.com is collecting their data from. It's obviously not the local airport?

        WeatherXML seems to provide info that's accurate & timely enough for my needs, I just need to dumb it down so I can use it with some of my existing scripts.

        Cheers,
        Paul

        Click to visit: www.sbsmarthomes.com
        Santa Barbara Smarthomes

        Authorized Russound Dealer & Installer

        Personal HA Website

        HomeSeer User Profile

        Comment


          #5
          Could you just search your current "conditions" for the instance of rain using InStr?
          isRain = InStr(1,RainDev,"Rain",1)
          then if isRain is > 0 then you know somesort of rain is in the forcast?
          Jay

          Comment


            #6
            Paul,

            WeatherXML not only sets the devicestring but for the items that have actual number values, it sets the device value. So if the temperature is 50 degrees, then the device value will get set to 50 and the device string will get the text and images.

            I looked through the data that is in the xml file, but didn't see anything for rain in the current values. I've also been looking at NOAA's data as they are now providing xml data as well. It does have a current weather condition that can be checked for the word Rain. I'll try to add NOAA in as an option but I'm not sure when I can get to it.
            --
            Jeff Farmer
            HS 3, HSPhone
            My HS3 Plugins: CFHSExtras, Random, Restart, Tracker, WeatherXML, PanaBluRay
            Other Plugins In Use: APCUPSD, BLOnkyo, Device History, EasyTrigger, HSTouch Server, PHLocation2, Pushover, RFXCom, UltraGCIR3, UltraMon3, UltraPioneerAVR3, X10, Z-Wave

            Hardware: GoControl Irrigation Controler, Schlage Lever Lock, Schlage Deadbolt, Way2Call Hi-Phone, RFXCom RFXrec433 Receiver, WGL 800, TI-103, Z-Net, Pioneer 1120, Pioneer 1021, Pioneer LX302, Panasonic BDT-110, Panasonic BDT-210 x2

            Comment


              #7
              Paul,
              Another fail proof option would be to add a rain guage and a DS9097u and use the free one-wire plugin to actually monitor and measure rain. Hobby Boards has them and they aren't too terribly expensive.

              http://www.hobby-boards.com/catalog/...products_id=81

              AAG has them as well:

              http://www.aagelectronica.com/aag/index.html
              💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

              Comment


                #8
                I downloaded the PM_Weather2 script, but I have one question. What is the purpose of the Z14 device. Is it just to let you know the scrippt is running? It is turned on at the start and off at the end, but I can't find any refrence to it. I looked on the scripts discussion forum but got no hits.

                Thanks,
                Gardner

                Comment


                  #9
                  This is not testest, but should be close. Two devices are used. One is the one created by WeatherXML that holds today's rainfall in the device string. The other is a new device of which the status will contain ON/OFF depending upon if it has rained in the last hour. It will also hold last hour's rainfall amount. Run the script once per hour.

                  Code:
                  Sub IsItRaining()
                  	RainfallTodayDC = "A1"
                  	IsRainingDC = "A2"
                  	
                  	'Get the current and prior rainfall amounts
                  	RainNow = hs.DeviceString(RainfallToday)
                  	RainLastHour = hs.DeviceString(IsRainingDC)
                  
                  	'Handle day transition to start as not raining
                  	if Day(hs.DeviceLastChange(IsRainingDC)) < day(now) then
                  		hs.SetDeviceLastChange IsRainingDC, now
                  		hs.SetDetDeviceStatus IsRainingDC, 3
                  	end if
                  
                  	'See if a change since last hour & set IsRaining Device	
                  	if RainNow <> RainLastHour  then
                  		if hs.IsOff(isRainingDC) then
                  		    hs.SetDetDeviceStatus IsRainingDC, 2
                  		    hs.SetDeviceLastChange IsRainingDC, now
                  		end if
                  		hs.SetDeviceString IsRainingDC, hs.DeviceString(RainfallTodayDC)
                  	Else
                  		if hs.IsOn(isRainingDC) then
                  		    hs.SetDetDeviceStatus IsRainingDC, 3
                  		    hs.SetDeviceLastChange IsRainingDC, now
                  		end if
                  	end if
                  End sub

                  Comment


                    #10
                    Originally posted by DigitalMatrix
                    Could you just search your current "conditions" for the instance of rain using InStr?
                    isRain = InStr(1,RainDev,"Rain",1)
                    then if isRain is > 0 then you know somesort of rain is in the forcast?
                    Jay
                    Jay - My scripting skills are basic, so I've not used InStr before. If I understand correctly, it will determine if something is contained within a string?

                    Your example doesn't quite fit as the WeatherXLM script doesn't provide rain rate or rain fall, it just provides the condition of "rain" or "heavy rain" or "Rain and windy".

                    Sounds like it may be possible to use InStr to tell if "rain" exists anywhere in the device string? If so, I may need a more complete example from someone to get me started.

                    Many thanks,
                    Paul

                    Click to visit: www.sbsmarthomes.com
                    Santa Barbara Smarthomes

                    Authorized Russound Dealer & Installer

                    Personal HA Website

                    HomeSeer User Profile

                    Comment


                      #11
                      Originally posted by CFGuy
                      Paul,

                      WeatherXML not only sets the devicestring but for the items that have actual number values, it sets the device value. So if the temperature is 50 degrees, then the device value will get set to 50 and the device string will get the text and images.

                      I looked through the data that is in the xml file, but didn't see anything for rain in the current values. I've also been looking at NOAA's data as they are now providing xml data as well. It does have a current weather condition that can be checked for the word Rain. I'll try to add NOAA in as an option but I'm not sure when I can get to it.
                      Jeff,

                      Thanks for the explanation that WeatherXML populates each device with device string and device value. From what you are saying, I made this harder than it needed to be and only need to reference "device value" in my scripts instead of "device string" to get the simple numeric values of the weather data.

                      Cool... this makes things easier, I'll give it a try. Now still need to find out to tell if "rain" is present in the current conditions.

                      NOAA does appear to have rain data for my area, so this would likely work well! Please let me know if you have time to add it.

                      Thanks,
                      paul

                      Click to visit: www.sbsmarthomes.com
                      Santa Barbara Smarthomes

                      Authorized Russound Dealer & Installer

                      Personal HA Website

                      HomeSeer User Profile

                      Comment


                        #12
                        Yes, you can use InStr to tell if the text "Rain" is in a string.

                        Check out devguru for how to use it.

                        http://www.devguru.com/technologies/vbscript/13934.asp
                        --
                        Jeff Farmer
                        HS 3, HSPhone
                        My HS3 Plugins: CFHSExtras, Random, Restart, Tracker, WeatherXML, PanaBluRay
                        Other Plugins In Use: APCUPSD, BLOnkyo, Device History, EasyTrigger, HSTouch Server, PHLocation2, Pushover, RFXCom, UltraGCIR3, UltraMon3, UltraPioneerAVR3, X10, Z-Wave

                        Hardware: GoControl Irrigation Controler, Schlage Lever Lock, Schlage Deadbolt, Way2Call Hi-Phone, RFXCom RFXrec433 Receiver, WGL 800, TI-103, Z-Net, Pioneer 1120, Pioneer 1021, Pioneer LX302, Panasonic BDT-110, Panasonic BDT-210 x2

                        Comment


                          #13
                          I just looked at my WeatherXML data stream and confirmed that rainfall is not available. Even current conditions show as "Fair" while the forecast for the last 5 and next 5 days has been rain every day and it is raining now. My assessment is that you are out of luck if you use WeatherXML as the source. The same is true with MSNBC, which I believe actually gets its data from Weather.com.

                          While a full up rain bucket can be installed, a more basic (and more appropriate) hardware solution is a conductor grid that becomes activated with moisture to give a go/nogo on rain. I believe Jon00 has built one and is described on his site. Even a commercial product like waterbug should be able to assess a relatively low amount of moisture in a plastic container. Jeff also provided the easier solution if you have time to wait.

                          Comment


                            #14
                            Originally posted by Rupp
                            Paul,
                            Another fail proof option would be to add a rain guage and a DS9097u and use the free one-wire plugin to actually monitor and measure rain. Hobby Boards has them and they aren't too terribly expensive.

                            http://www.hobby-boards.com/catalog/...products_id=81

                            AAG has them as well:

                            http://www.aagelectronica.com/aag/index.html
                            Hi Rupp,

                            I've thought about a weather station, but where I live the weather doesn't change much (not even temperature) except for 5-7 days a year that it rains. Because of this a personal weather station or even rain guage seems like overkill.

                            I'm happy with the weather info that can be provided from the on-line sources, just need to figure out how to obtain the rain status.

                            Thanks,
                            Paul

                            Click to visit: www.sbsmarthomes.com
                            Santa Barbara Smarthomes

                            Authorized Russound Dealer & Installer

                            Personal HA Website

                            HomeSeer User Profile

                            Comment


                              #15
                              Originally posted by Michael McSharry
                              I just looked at my WeatherXML data stream and confirmed that rainfall is not available. Even current conditions show as "Fair" while the forecast for the last 5 and next 5 days has been rain every day and it is raining now. My assessment is that you are out of luck if you use WeatherXML as the source. The same is true with MSNBC, which I believe actually gets its data from Weather.com.

                              While a full up rain bucket can be installed, a more basic (and more appropriate) hardware solution is a conductor grid that becomes activated with moisture to give a go/nogo on rain. I believe Jon00 has built one and is described on his site. Even a commercial product like waterbug should be able to assess a relatively low amount of moisture in a plastic container. Jeff also provided the easier solution if you have time to wait.
                              Michael,

                              Thanks for your reply's and sample script. I'm trying to keep away from an actual rain detection device as I don't want to install & maintain it. I'm not triggering anything critical when it rains, just convienence stuff like opening the garage door when RFID detects my SUV arrive so I can duck in the garage without getting wet (I park it in the driveway, so normally the garage door doesn't open) and not running the irregation if it's currently raining when it's scheduled to run, etc.

                              I'll see if I can figure out how to use InStr as Jay recommded to poll the current condition from WeatherXML to see if "rain" is present anywhere in the string. If I can get this to work, I think it will be good enough for now and if Jeff can get NOAA added to WeatherXLM down the road, even better!

                              Thanks to everyone for thier posts!
                              Paul

                              Click to visit: www.sbsmarthomes.com
                              Santa Barbara Smarthomes

                              Authorized Russound Dealer & Installer

                              Personal HA Website

                              HomeSeer User Profile

                              Comment

                              Working...
                              X