Announcement

Collapse
No announcement yet.

Environment Canada Weather Map Downloads are Failing

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

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

    Leave a comment:


  • sparkman
    replied
    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.

    Leave a comment:


  • captlu1
    replied
    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.

    Leave a comment:


  • paul
    replied
    Thanks sparkman, I'll give that a try!

    Leave a comment:


  • sparkman
    replied
    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

    Leave a comment:


  • sparkman
    replied
    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

    Leave a comment:


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

    Leave a comment:


  • sparkman
    replied
    Hi Jeff CFGuy, any thoughts on this?

    Thanks
    Al

    Leave a comment:


  • sparkman
    started a topic Environment Canada Weather Map Downloads are Failing

    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
Working...
X