Announcement

Collapse
No announcement yet.

Environment Canada Weather Map Downloads are Failing

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

    Environment Canada Weather Map Downloads are Failing

    Hi Jeff,

    Environment Canada made a change a few weeks ago and maps from there are no longer downloading:

    Code:
    Dec-24 9:06:01 AM         weatherXML Error    downloadMapImage: A web exception has occured [https://weather.gc.ca/data/jet_stream/tempmapwx_e.gif] for device 3274. System returned: The underlying connection was closed: An unexpected error occurred on a send.
    Dec-24 9:06:00 AM         weatherXML Error    downloadMapImage: A web exception has occured [https://weather.gc.ca/data/satellite/goes_wcan_1070_100.jpg] for device 3272. System returned: The underlying connection was closed: An unexpected error occurred on a send.
    My understanding is that they no longer support older versions of TLS. Any way you could update WeatherXML to use the newer version of TLS?

    Thanks
    Al
    HS 4.2.8.0: 2134 Devices 1252 Events
    Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

    #2
    Hi Jeff CFGuy, any thoughts on this?

    Thanks
    Al
    HS 4.2.8.0: 2134 Devices 1252 Events
    Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

    Comment


      #3
      CFGuy I'd sure be interested as well - I was just looking into this same issue and came across this thread...

      Comment


        #4
        CFGuy

        Hi Jeff, I was testing one of my own scripts that accesses the Environment Canada website and all I need to do was set the security protocol before retrieving data to TLS1.2. This can be done with one line before the retrieve:

        Code:
            System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12
        Let me know if this is something you can add to the code.

        Thanks
        Al
        HS 4.2.8.0: 2134 Devices 1252 Events
        Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

        Comment


          #5
          paul Here's a script you can use to download the Env Canada maps as a workaround. You'll need to edit it for your own maps and paths. If you download more than 2, just repeat the marked section as needed.

          Code:
          Imports System.IO
          Imports System.Net
          Imports System.Drawing
          
          Sub Main(ByVal Parms As String)
          
              Dim logName As String = "Env Canada Maps"                        'set log type for HS log
              Dim Debug As Boolean = True
          
              Dim hs_path As String = hs.GetAppPath
              Dim MyImage As System.Drawing.Image
          
              Dim webReq As System.Net.HttpWebRequest
              Dim webResp As System.Net.HttpWebResponse
          
          'repeat this section as needed
              Try
                  Dim FileName As String = hs_path & "\html\images\weatherXML\downloadMap_1.jpg"
                  Dim strURL As String = "https://weather.gc.ca/data/satellite/goes_wcan_1070_100.jpg"
                  System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12
          
                  webReq = System.Net.WebRequest.Create(strURL)
                  webResp = CType(webReq.GetResponse, System.Net.WebResponse)
                  If webReq.HaveResponse Then 'Did we really get a response?
                      If webResp.StatusCode = Net.HttpStatusCode.OK Then 'Is the status code 200? (You can check for more)
                          MyImage = System.Drawing.Image.FromStream(webResp.GetResponseStream)
                          If MyImage is Nothing Then 
                              If Debug Then hs.writelog(logName,"No Image Retrieved")
                          Else
                              If Debug Then hs.writelog(logName,FileName)
                              MyImage.Save(FileName,System.Drawing.Imaging.ImageFormat.Jpeg)
                          End If
                      End If
                  End If
              Catch ex As Exception
                  Dim errMessage As String = ex.Message.ToString
                  hs.writelog(logName, "Error:  " & errMessage)
              End Try
              MyImage = Nothing
          'section end
          
          'repeat this section as needed
              Try
                  Dim FileName As String = hs_path & "\html\images\weatherXML\downloadMap_2.gif"
                  Dim strURL As String = "https://weather.gc.ca/data/jet_stream/tempmapwx_e.gif"
                  System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12
          
                  webReq = System.Net.WebRequest.Create(strURL)
                  webResp = CType(webReq.GetResponse, System.Net.WebResponse)
                  If webReq.HaveResponse Then 'Did we really get a response?
                      If webResp.StatusCode = Net.HttpStatusCode.OK Then 'Is the status code 200? (You can check for more)
                          MyImage = System.Drawing.Image.FromStream(webResp.GetResponseStream)
                          If MyImage is Nothing Then 
                              If Debug Then hs.writelog(logName,"No Image Retrieved")
                          Else
                              If Debug Then hs.writelog(logName,FileName)
                              MyImage.Save(FileName,System.Drawing.Imaging.ImageFormat.Gif)
                          End If
                      End If
                  End If
              Catch ex As Exception
                  Dim errMessage As String = ex.Message.ToString
                  hs.writelog(logName, "Error:  " & errMessage)
              End Try
              MyImage = Nothing
          'section end
          
          End Sub
          HS 4.2.8.0: 2134 Devices 1252 Events
          Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

          Comment


            #6
            Thanks sparkman, I'll give that a try!

            Comment


              #7
              I'm new to Homeseer and I'm searching for a plug-in for Canada weather. Can someone confirm WaetherXML works with Canada. And give me some guidance on where to start. I installed the plug-in but don't know which FREE service to pull the information from. Seems like Weather Underground and World Weather are paid services?
              Thank you in advanced.

              Comment


                #8
                captlu1 One option is the Environment Canada plugin which can be downloaded here: https://sites.google.com/site/b123cdd/. It has less features than WeatherXML, but the data source (Environment Canada) is free. It also pulls down weather alerts, which the data sources for WeatherXML do not have for Canada.

                The discussion thread for it is here: https://forums.homeseer.com/forum/we...her-plugin-hs3

                WeatherXML works well (other than the issue with downloading Environment Canada images), and is full featured. I have a personal weather station which uploads data to Weather Underground, so I still get data for free.
                HS 4.2.8.0: 2134 Devices 1252 Events
                Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                Comment


                  #9
                  Thank You! The Environment Canada one does exactly what I need it to. Give me outside temp, to trigger an event for my thermostat.

                  Comment

                  Working...
                  X