Announcement

Collapse
No announcement yet.

Best way to trigger on ANY kind of rain?

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

    Best way to trigger on ANY kind of rain?

    My goal is to act on changes to the current weather summary if it has any type of rain. Using the HS UI, the choices are numerous. In fact there are at least 31 possible conditions that imply liquid water falling from the sky (not all use the word "rain"), so building 31 events isn't really practical. Attached shows some of the options. Any advice on the best way to trigger an event if current conditions: weather summary: changes and becomes "any rain"? One option I can see is to have a new key in the field that isn't a literal device string, but encompasses all rain.

    BTW, you might think I could use humidity as a proxy (it is likely raining if humidity is high), but that is not very accurate since rain can be born above a low humidity region. Right now it's raining and the humidity is 85%, but many days the humidity has been > 95% with no rain.

    Loving rnbWeather so far! I replaced my clumsy web scraping and life is much better.
    Attached Files

    #2
    For a script solution, I created another device called 'rain_device' in the Current Weather group, and set this script to run whenever "weather summary" is updated:
    Code:
    Public Sub Main(ByVal Parms)[INDENT]Dim cond_device as Integer = 354
    Dim rain_device as Integer = 364
    Dim device_string as String = hs.CAPIGetStatus(cond_device).Status
    
    If device_string.Contains("rain") Or device_string.Contains("storm") Or device_string.Contains("drizzle") Or device_string.Contains("shower") Then[/INDENT][INDENT=2]hs.setdevicevaluebyref(rain_device,1,True)[/INDENT][INDENT]Else[/INDENT][INDENT=2]hs.setdevicevaluebyref(rain_device,0,True)[/INDENT][INDENT]End if[/INDENT]
     
     End Sub

    Comment


      #3
      I have a very similiar script using JonOO's NOAA which works fine , but when I substitute to a rnb device -The hs.devicestring () returns empty on any of the rnb devices

      Comment


        #4
        Try hs.CAPIGetStatus(nnnn).Status
        tenholde

        Comment


          #5
          Yeah, what tenholde said. I corrected in the script pasted above

          Comment


            #6
            Worked perfectly- thanks !!

            Comment

            Working...
            X