Announcement

Collapse
No announcement yet.

Integration with Weather Underground?

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

    Integration with Weather Underground?

    Michael,

    What are the odds of integrating posting data to Weather Underground? I wrote a script to do it manually thru an event, but has some limitations (ie loses decimals on data points.) It's a pretty simple post to them; if interested, feel free to use my script as a starting point:
    http://forums.homeseer.com/showthread.php?t=107801

    Thanks!

    -Mike

    #2
    mcsTemperature does support APRS as an upload format. I'll decline on weatherunderground at this time due to constraints on the number of controls that are allowed on a form. When a web interface exists then it will be possible to add more to the user interface.

    The code segment below will return the numeric portion of the device strings so you can use DeviceString rather than DeviceValue and capture the fractional portion of the number.

    Number = StripHTML(hs.DeviceString("A1"))

    Code:
    Function StripHTML(strText)
        
        'remove text between < >
        Dim k
        Dim j
        Dim Text
        
        Text = Replace(Replace(strText, "&nbsp;", "", 1, -1, vbTextCompare), "&nbsp", "", 1, -1, vbTextCompare)
        Do
            k = InStr(1, Text, "<")
            If k > 0 Then
                j = InStr(k + 1, Text, ">")
                If j > 0 Then
                    If k = 1 Then
                        Text = Mid(Text, j + 1)
                    ElseIf j < Len(Text) Then
                        Text = Left(Text, k - 1) & Mid(Text, j + 1)
                    Else
                        Text = Left(Text, k - 1)
                    End If
                Else
                    Exit Do
                End If
            Else
                Exit Do
            End If
        Loop
    End Function

    Comment


      #3
      Michael,

      Thanks for the reply and the function! I didn't realize that it supported APRS, learned something new

      -Mike

      Comment


        #4
        APRS was a user request a few years ago. The companion I always use with the striphtml is the following. I needed this because the standard functions did not deal properly with international formats.

        Number = MakeNumber(StripHTML(hs.DeviceString("A1")))

        Code:
        Function MakeNumber(data)
        
            Dim i
            Dim j
            Dim sData
            Dim Prefix
            
            i = Len(data)
            j = 1
            Do While j <= i
                If IsNumeric(Mid(data, j, 1)) Then
                    Exit Do
                Else
                    If Mid(data, j, 1) = "-" Then
                        If j < i Then
                            If IsNumeric(Mid(data, j + 1, 1)) Then
                                Exit Do
                            End If
                        End If
                    End If
                End If
                j = j + 1
            Loop
        
            If j > i Then
                MakeNumber = "0"
            Else
                If Mid(data, j, 1) = "-" Then
                    Prefix = "-"
                    sData = Mid(data, j + 1)
                Else
                    sData = Mid(data, j)
                    Prefix = ""
                End If
                i = Len(sData)
                Do While i > 0
                    If IsNumeric(Left(sData, i)) Then
                        j = i
                        Exit Do
                    End If
                    i = i - 1
                Loop
                If i > 0 Then
                    MakeNumber = Prefix & Trim(Left(sData, j))
                Else
                    MakeNumber = "0"
                End If
            End If
        End Function

        Comment

        Working...
        X