Announcement

Collapse
No announcement yet.

WebClient header error

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

  • WebClient header error

    I worked around the Log issue by creating a directory called "Logs." and the plugin then started logging. Here is what I found:

    6/30/2017 20:23:21.778 Debug WebClientEx.DownloadDataIfAvailable - WebClient is busy, waiting 100ms... (100)
    6/30/2017 20:23:21.781 Debug WebClientEx.DownloadDataIfAvailable - Downloading data from 'https://mytotalconnectcomfort.com/portal/Device/CheckDataSession/2782478?_=1498879402'
    6/30/2017 20:23:21.783 Debug WebClientEx.GetWebRequest - Getting WebRequest for 'https://mytotalconnectcomfort.com/portal/Device/CheckDataSession/2782478?_=1498879402'
    6/30/2017 20:23:21.785 Error HWConnection.GetData - Error retrieving data for device 2782478: An error occurred performing a WebClient request.
    System.Net.WebException: An error occurred performing a WebClient request. ---> System.ArgumentException: This header must be modified with the appropiate property.
    at System.Net.WebHeaderCollection.CheckRestrictedHeader (System.String headerName) [0x00000] in <filename unknown>:0
    at System.Net.WebHeaderCollection.Add (System.String name, System.String value) [0x00000] in <filename unknown>:0
    at System.Net.HttpWebRequest.set_Headers (System.Net.WebHeaderCollection value) [0x00000] in <filename unknown>:0
    at System.Net.WebClient.SetupRequest (System.Uri uri) [0x00000] in <filename unknown>:0
    at System.Net.WebClient.DownloadDataCore (System.Uri address, System.Object userToken) [0x00000] in <filename unknown>:0
    --- End of inner exception stack trace ---
    at System.Net.WebClient.DownloadDataCore (System.Uri address, System.Object userToken) [0x00000] in <filename unknown>:0
    at System.Net.WebClient.DownloadData (System.Uri address) [0x00000] in <filename unknown>:0
    at System.Net.WebClient.DownloadData (System.String address) [0x00000] in <filename unknown>:0
    at HSPI_SKWARE_HW_WIFI_TSTAT.WebClientEx.DownloadDataIfAvailabl e (System.String strURL) [0x00000] in <filename unknown>:0
    at (wrapper remoting-invoke-with-check) HSPI_SKWARE_HW_WIFI_TSTAT.WebClientExownloadDataIfAvailable (string)
    at HSPI_SKWARE_HW_WIFI_TSTAT.HWConnection.GetData (System.String strDeviceID, HSPI_SKWARE_HW_WIFI_TSTAT.ThermostatData& objCurrentData) [0x00000] in <filename unknown>:0
    6/30/2017 20:23:21.800 Error ThermostatCommand.ProcessUpdateResults - Failed to retrieve thermostat data - error occurred, will retry
    6/30/2017 20:23:21.803 Debug PluginLogic.m_objTimer_Elapsed - Timer interval reset to 3000, should fire again soon.
    6/30/2017 20:23:24.803 Debug PluginLogic.m_objTimer_Elapsed - Queue is empty - stopping processor.
    6/30/2017 20:23:24.804 Debug PluginLogic.m_objTimer_Elapsed - Timer interval reset to 3000, should fire again soon.
    6/30/2017 20:23:33.616 Debug ThermostatDevice.RequestUpdate - Scheduling update of thermostat 'Media Room' (2782568)
    6/30/2017 20:23:36.618 Debug PluginLogic.m_objTimer_Elapsed - Timer interval temporarily set to 2147483647, should not fire again for a while.
    6/30/2017 20:23:36.619 Debug CommandQueue.CheckDuplicate - Checking for duplicate command scheduled in the future...
    6/30/2017 20:23:36.621 Debug CommandQueue.Dequeue - Retrieved Update command.
    6/30/2017 20:23:36.623 Debug PluginLogic.m_objTimer_Elapsed - Retrieved a command - processing...
    6/30/2017 20:23:36.624 Debug ThermostatCommand.Execute - Processing Update command object
    6/30/2017 20:23:36.626 Debug HWConnection.LoginIfNeeded - Last Login: 6/30/2017 20:17:03.385
    6/30/2017 20:23:36.728 Debug WebClientEx.DownloadDataIfAvailable - WebClient is busy, waiting 100ms... (100)
    6/30/2017 20:23:36.730 Debug WebClientEx.DownloadDataIfAvailable - Downloading data from 'https://mytotalconnectcomfort.com/portal/Device/CheckDataSession/2782568?_=1498879417'
    6/30/2017 20:23:36.732 Debug WebClientEx.GetWebRequest - Getting WebRequest for 'https://mytotalconnectcomfort.com/portal/Device/CheckDataSession/2782568?_=1498879417'
    6/30/2017 20:23:36.734 Error HWConnection.GetData - Error retrieving data for device 2782568: An error occurred performing a WebClient request.
    System.Net.WebException: An error occurred performing a WebClient request. ---> System.ArgumentException: This header must be modified with the appropiate property.
    at System.Net.WebHeaderCollection.CheckRestrictedHeader (System.String headerName) [0x00000] in <filename unknown>:0
    at System.Net.WebHeaderCollection.Add (System.String name, System.String value) [0x00000] in <filename unknown>:0
    at System.Net.HttpWebRequest.set_Headers (System.Net.WebHeaderCollection value) [0x00000] in <filename unknown>:0
    at System.Net.WebClient.SetupRequest (System.Uri uri) [0x00000] in <filename unknown>:0
    at System.Net.WebClient.DownloadDataCore (System.Uri address, System.Object userToken) [0x00000] in <filename unknown>:0
    --- End of inner exception stack trace ---
    at System.Net.WebClient.DownloadDataCore (System.Uri address, System.Object userToken) [0x00000] in <filename unknown>:0
    at System.Net.WebClient.DownloadData (System.Uri address) [0x00000] in <filename unknown>:0
    at System.Net.WebClient.DownloadData (System.String address) [0x00000] in <filename unknown>:0
    at HSPI_SKWARE_HW_WIFI_TSTAT.WebClientEx.DownloadDataIfAvailabl e (System.String strURL) [0x00000] in <filename unknown>:0
    at (wrapper remoting-invoke-with-check) HSPI_SKWARE_HW_WIFI_TSTAT.WebClientExownloadDataIfAvailable (string)
    at HSPI_SKWARE_HW_WIFI_TSTAT.HWConnection.GetData (System.String strDeviceID, HSPI_SKWARE_HW_WIFI_TSTAT.ThermostatData& objCurrentData) [0x00000] in <filename unknown>:0
    6/30/2017 20:23:36.742 Error ThermostatCommand.ProcessUpdateResults - Failed to retrieve thermostat data - error occurred, will retry
    6/30/2017 20:23:36.745 Debug PluginLogic.m_objTimer_Elapsed - Timer interval reset to 3000, should fire again soon.
    6/30/2017 20:23:39.746 Debug PluginLogic.m_objTimer_Elapsed - Queue is empty - stopping processor.
    6/30/2017 20:23:39.747 Debug PluginLogic.m_objTimer_Elapsed - Timer interval reset to 3000, should fire again soon.

    This article lists the restricted headers: https://stackoverflow.com/questions/...net-webrequest

    Solution is to check if the header exists already or is restricted (WebHeaderCollection.IsRestricted(key)) before calling add (and use the modifier if it already exists vs adding it)

  • #2
    Never run into that before, but will look into it next week after I return from vacation.

    Comment


    • #3
      Originally posted by shill View Post
      Never run into that before, but will look into it next week after I return from vacation.
      Thank you! Developer here as well, so happy to do any splunking you might need on the system when you get to it.

      Comment


      • #4
        I saw a new version was posted, but getting the same header error (guessing that build was for other issues, but an FYI in case you had made a change for this issue)

        Comment


        • #5
          Originally posted by bsobel View Post
          I saw a new version was posted, but getting the same header error (guessing that build was for other issues, but an FYI in case you had made a change for this issue)
          Yeah, in addition to the log file error you found, there was also an issue with HS build .333 that affected several of us, so I had to fix that first. I just posted it before running out to catch a flight so I didn't get the release notes added to this forum, but they're in the doc.

          Client headers plus an issue with simulated auto mode and changing set points is up as soon as I get home Sunday, hopefully for a Monday release.

          Comment


          • #6
            Thanks! Travel safe!

            Comment


            • #7
              Can you provide some more information about your environment? OS, Mono version (if Linux), HS3 build, etc.

              While I certainly understand the error message and can put in code to work around it, I'm stumped that this has never happened to anyone else. Seems like something that would fail consistently based on the details of the error...

              Comment


              • #8
                Literally brand new HS SEL. Updated to latest non-beta release bInstalled a few other unrelated addins. Installed yours, had errors so cane to forum. Found instructions to update mono. Did that then got these errors. Can't explain the difference unless isp is doing something on headers your not seeing elsewhere ;but that is a long shot and pure conjecture)

                Comment


                • #9
                  HomeSeer:
                  Current Date/Time: 7/17/2017 10:15:27 PM PDT
                  HomeSeer Version: HS3 Pro Edition 3.0.0.318 (Linux)
                  HomeSeer: Is Registered
                  System Uptime: 6 Days 5 Hours 2 Minutes 38 Seconds

                  Mono:
                  Mono JIT compiler version 3.8.0 (tarball Thu Sep 4 12:24:26 UTC 2014)
                  Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
                  TLS: __thread
                  SIGSEGV: altstack
                  Notifications: epoll
                  Architecture: x86
                  Disabled: none
                  Misc: softdebug
                  LLVM: supported, not enabled.
                  GC: sgen

                  Comment


                  • #10
                    I update mono to 4.8 from 3.8 and the plugin started working, so the issue appears mono 3.x related.

                    Best
                    Bill

                    Comment


                    • #11
                      Originally posted by bsobel View Post
                      I update mono to 4.8 from 3.8 and the plugin started working, so the issue appears mono 3.x related.

                      Best
                      Bill
                      Are all your events firing correctly? I know there were some issues with mono 4.X that prevented certain types of triggers from working... (not plugin specific, but general to HS overall).

                      Comment


                      • #12
                        I had to rebuild them all. Plus side of a new install there was only about 2 dozen to do....

                        Comment

                        Working...
                        X