No announcement yet.

Plugs that show outdoor air quality conditions

  • 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?

    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"


    • #17
      I have this working-thanks!


      • #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.


        • #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)

          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
          Operating System: Microsoft Windows 10 Pro - Work Station

          Enabled Plug-Ins:
 AmbientWeather | BLLock | BLUPS | Device History | EasyTrigger | MeiHarmonyHub | 3.0.6681.34300: UltraCID3 | 3.0.6644.26753: UltraLog3 | 3.0.6554.33094: UltraMon3 | weatherXML | Z-Wave | 3.0.51: HS Touch Designer | Z-Seer+


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


            • #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.


              • #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("")
                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
                devID = 284
                End If
                html = "<img src=""/images/Pollen/" & allergenType & ".png"" height=""32""> " & allergenName
                hs.SetDeviceString(devID, html, True)
                hs.SetDeviceLastChange(devID, now)
                hs.SetDeviceString(284, "None", True)
                hs.SetDeviceLastChange(284, now)

                End If

                End If

                End Sub