Announcement

Collapse
No announcement yet.

Plugs that show outdoor air quality conditions

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

  • #16
    Originally posted by ewkearns View Post

    I did this, but no joy. I'm a little confused by the delimiter(s) and instructions. Should the delimiters be a comma, a semicolon, or both?

    [Settings]
    ScriptingReferences=System.Web;System.Web.dll,System.Web.Ext ensions;System.Web.Extensions.dll

    I am making changes to the file HS3/Config/settings.ini, is that the right one?
    That all looks correct except you have a space in "Ext ensions" should read "Extensions"

    Comment


    • #17
      I have this working-thanks!

      Comment


      • #18
        Originally posted by Dweber85rc View Post
        I have this working-thanks!
        Great ! I use the virtual devices to announce a morning pollen report. I only announce the flu data if its high or very high. Works well.

        Comment


        • #19
          Originally posted by prsmith777 View Post

          That all looks correct except you have a space in "Ext ensions" should read "Extensions"
          Actually, I don't.. or I don't think I do. When I copy and paste, it looks fine, when I hit [return] the space appears. I have removed the entire line and retyped, expecting some kind of odd character to be overwritten, one that doesn't show up in any editor I have used.... this is odd.

          ScriptingReferences=System.Web;System.Web.dll;System.Web.Ext ensions;System.Web.Extensions.dll (and it still shows up).

          Test (Copy and Past from 4 year old config)
          ScriptingReferences=System.Web;System.web.dll

          Test 2 (Typed addition to Cut & Paste)
          ScriptingReferences=System.Web;System.Web.dll;System.Web.Ext ensions;System.Web.Extensions.dll

          Test 3 (Typed from scratch)
          ScriptingReferences=System.Web;System.Web.dll;System.Web.Ext ensions;System.Web.Extensions.dll


          ...... and it added the [space] when I hit post...

          Additional attempt:
          ScriptingReferences=xxxSystem.Web;System.Web.dll ;System.Web.Extensions;System.Web.Extensions.dll

          HomeSeer Version: HS3 Pro Edition 3.0.0.500
          Operating System: Microsoft Windows 10 Pro - Work Station

          Enabled Plug-Ins:
          2.1.0.119: AmbientWeather | 3.0.21.0: BLLock | 2.0.24.0: BLUPS | 1.3.6.0: Device History | 3.0.0.56: EasyTrigger | 3.1.0.7: MeiHarmonyHub | 3.0.6681.34300: UltraCID3 | 3.0.6644.26753: UltraLog3 | 3.0.6554.33094: UltraMon3 | 3.0.0.91: weatherXML | 3.0.1.245: Z-Wave | 3.0.51: HS Touch Designer | 3.0.0.40 Z-Seer+

          Comment


          • #20
            That is strange. Perhaps try shutting down Homeseer and then editing the file and see if that helps.

            Comment


            • #21
              Originally posted by prsmith777 View Post

              Great ! I use the virtual devices to announce a morning pollen report. I only announce the flu data if its high or very high. Works well.

              I am allergic to pretty much all types of pollen. Now that I have it working the goal is to create events to be able to turn off my air exchanger so I'm not sucking that junk inside and turn on my furnace fan to circulate air in my home through the whole home electronic air cleaner filtration system attached to my furnace.

              Comment


              • #22
                I'm trying to get this to work but I keep getting this error "Running script /usr/local/HomeSeer/scripts/pollen.vb :Exception has been thrown by the target of an invocation.Invalid JSON string"

                I'm using this on a RaspberryPi3b with HS3, I've added the Polen.json file to the /user/local/HomeSeer/html/json folder.

                I have also added the three image files to the html/images/Pollen folder.
                I have also created 4 devices called Today's Pollen Level, Allergen 1,Allergen 2, Allergen 3.

                This is what my script looks like.........


                Imports System.Web.Script.Serialization

                Sub Main(ByVal Parms As Object)

                Dim devID as integer
                Dim allergenName as String
                Dim allergenType as String
                Dim allergenTypeValue as Integer
                Dim html as String
                Dim pollenRating As String
                Dim pollenIndex As Decimal


                ' Create a WebRequest to the remote site, specifying Referer and UserAgent
                Dim getRequest As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("https://www.pollen.com/forecast/current/pollen/60634")
                getRequest.Referer="https://www.pollen.com/forecast/current/pollen/60634"
                getRequest.UserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"
                Dim getResponse As System.Net.HttpWebResponse = getRequest.GetResponse()

                If getResponse.StatusCode = System.Net.HttpStatusCode.OK Then
                ' Parse the contents from the response to a stream object
                Dim stream As System.IO.Stream = getResponse.GetResponseStream()

                ' Create a reader for the stream object
                Dim reader As New System.IO.StreamReader(stream)

                ' Read from the stream object using the reader, put the contents in a string
                Dim contents As String = reader.ReadToEnd()

                ' Save JSON string into a JSON file
                My.Computer.FileSystem.WriteAllText(hs.GetAppPath & "\html\json\Pollen.json", contents, False)

                ' Convert JSON string to object
                Dim jsonData As Object = New JavaScriptSerializer().Deserialize(Of Object)(contents)

                ' Get Pollen Index value
                pollenIndex = CDec(jsonData("Location")("periods")("1")("Index"))

                hs.SetDeviceValuebyRef (281, pollenIndex, True)
                hs.SetDeviceString(281, pollenIndex & " out of 12", True)
                hs.SetDeviceLastChange(281, now)



                For i As Integer = 0 To 2
                If i <= UBound(jsonData("Location")("periods")("1")("Triggers")) Then
                allergenName = jsonData("Location")("periods")("1")("Triggers")(Cstr(i))("N ame")
                allergenType = jsonData("Location")("periods")("1")("Triggers")(Cstr(i))("P lantType")
                allergenTypeValue = 0
                Select Case allergenType
                Case "Tree"
                allergenTypeValue = 1
                Case "Grass"
                allergenTypeValue = 2
                Case "Ragweed"
                allergenTypeValue = 3
                End Select
                If i = 0 Then
                devID = 281
                Elseif i = 1 Then
                devID = 283
                Else
                devID = 284
                End If
                html = "<img src=""/images/Pollen/" & allergenType & ".png"" height=""32""> " & allergenName
                hs.SetDeviceString(devID, html, True)
                hs.SetDeviceLastChange(devID, now)
                Else
                hs.SetDeviceString(284, "None", True)
                hs.SetDeviceLastChange(284, now)

                End If
                Next

                End If

                End Sub

                Comment

                Working...
                X