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: HS4 Pro Edition 4.2.19.0 (Windows - Running as a Service)
          Home Assistant 2024.3
          Operating System: Microsoft Windows 11 Pro - Desktop
          Z-Wave Devices via two Z-Net G3s
          Zigbee Devices via RaspBee on RPi 3b+
          WiFi Devices via Internal Router.

          Enabled Plug-Ins
          AK GoogleCalendar 4.0.4.16,AK HomeAssistant 4.0.1.23,AK SmartDevice 4.0.5.1,AK Weather 4.0.5.181,AmbientWeather 3.0.1.9,Big6 3.44.0.0,BLBackup 2.0.64.0,BLGData 3.0.55.0,BLLock 3.0.39.0,BLUPS 2.0.26.0,Device History 4.5.1.1,EasyTrigger 3.0.0.76,Harmony Hub 4.0.14.0,HSBuddy 4.51.303.0,JowiHue 4.1.4.0,LG ThinQ 4.0.26.0,ONVIF Events 1.0.0.5,SDJ-Health 3.1.1.9,TPLinkSmartHome4 2022.12.30.0,UltraCID3 3.0.6681.34300,Z-Wave 4.1.3.0

          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


                  #23
                  This has been working great until I switched homeseer systems to new hardware. That was a few months ago but since it was the winter I didn't pay attention to it. It seems to be working accept the virtual device that shows the Index value, just says none. prsmith777 any thoughts?

                  Comment


                    #24
                    Flustar.com has had similar data to import including cough, flu, high fever, and strep that I've been using for a year or so. They just recently added covid levels, which I have successfully incorporated into Homeseer. Covid data is not broken out per zipcode. It's pulled from https://flustar.com/api/map/covid19. You can then pull it per region by searching for your three letter city/region code. I also slightly changed the scripts to include Try Catch logic so when the script fails to pull data it adds an error to the virtual devices.

                    Click image for larger version

Name:	pollen-and-flu.jpg
Views:	67
Size:	71.7 KB
ID:	1386650

                    [ATTACH]n1386651[/ATTACH]
                    [ATTACH]n1386652[/ATTACH]

                    Comment

                    Working...
                    X