MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    MMM-EnvCanada stopped working ...

    Scheduled Pinned Locked Moved Unsolved Troubleshooting
    27 Posts 9 Posters 4.9k Views 9 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • crazylegsC Offline
      crazylegs
      last edited by

      I’m the original author of the envcanada Provider for the default Weather module. Environment Canada has made a significant change to their API and, for some reason, I never saw the notification they sent out a few months ago (I was supposedly on their mailing list). I’ve only taken a very brief look at their changes, so take my assessment with a small grain of salt:

      The change has made it impractical to continue fetching an XML document for whatever location has been configured for weather info. They are, instead, pushing clients to a completely different API that is much more complex to use. The API is basically a pub/sub scheme that is based on the AMPQ protocol. How it all works and whether it will play nice within the MagicMirror ecosystem is still very much TBD.

      Based on what I see, the envcanada Provider and MMM-EnvCanada will pretty much require total rewrites. I can continue poking at this but to be fully transparent, it will be a couple of months before I can give this any significant focused effort.

      S charlesfC 2 Replies Last reply Reply Quote 0
      • S Offline
        sunsetrider @crazylegs
        last edited by sdetweil

        @crazylegs

        Here is my solution to the envCanada issue:

        • used: openweathermap
        • needed to get": apiKey (from openweathermap)
        • needed to get locationID, name, location (from openweathermap)
        • used apiVersion: 2.5 (did not try more recent versions - default version not working)

        following is my config file info (used similar version for weather forecast as well)-

         module: "weather",
        			position: "top_right",
        			header: "Current Weather: ",
        			config: {
        				weatherProvider: "openweathermap",
        				apiVersion: 2.5,
        		//		weatherEndpoint: "",
        				type: "current",
        					locationID: 3924642,
        					name: "Mississauga",
        					location: "Mississauga ON",
        					state: "",
        					country: "CA",
        					coloured: "true",  // not working with this apiVersion
        		//			coord:
        		//			lon: -79.658302,
        		//			lat: 43.578899,
        		//		location: "New York",
        		//		locationID: "5128581", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
        				apiKey: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
        

        Hope this helps somebody.

        D S 2 Replies Last reply Reply Quote 0
        • D Offline
          Dr8ke @sunsetrider
          last edited by

          @sunsetrider TT
          Thanks so much! This really helped me get the weather module backup up and running.

          1 Reply Last reply Reply Quote 0
          • S Offline
            sdetweil @sunsetrider
            last edited by

            @sunsetrider just remember that OW has said they will terminate the 2.5 api

            June/August/October 2024 (last year) … so remember this config when it fails…
            we changed the default config to the new 3.0 api per their annoncements

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            S 1 Reply Last reply Reply Quote 0
            • charlesfC Offline
              charlesf @crazylegs
              last edited by

              @crazylegs I have posted an update on GitHub that works with the new Environment Canada URL convention. I fetch the directory list and look for the most recent forecast xml file for the selected site code and then open the filename found, so I didn’t have to completely rewrite the module. I had issues with my http request to get the directory list that don’t occur when retrieving the xml files – no idea why, but my knowledge of JavaScript is very limited. I found a solution and the module now works.

              I agree it looks like we are being pushed to the other API, so it is hard to know how long this approach of fetching an xml document will continue to work. But it works for now.

              Comments welcome.

              crazylegsC 1 Reply Last reply Reply Quote 2
              • J Offline
                jakabasej4 @sankum
                last edited by

                This post is deleted!
                charlesfC 1 Reply Last reply Reply Quote 0
                • charlesfC Offline
                  charlesf @jakabasej4
                  last edited by

                  @jakabasej4 hmm … I don’t use it, but the author of the provider for the default module support tor Environment Canada posted in this thread that it is also broken. In any case, I have issued an update on GitHub for my MMM-EnvCanada module which supports the new Environment Canada url scheme. Two other users of the module have confirmed it works, so I gave closed the issue.

                  1 Reply Last reply Reply Quote 0
                  • S Offline
                    sunsetrider @sdetweil
                    last edited by

                    @sdIetweil
                    Hello:
                    Thanks for your info.

                    I changed my config file to access apiVersion: 3.0

                    It does not work for me.

                    I did not change any other config values in the weather module calls (current and forecast).

                    Seems someone has updated the envCanada module. I will give it a shot later.

                    Thanks
                    MM

                    S 1 Reply Last reply Reply Quote 0
                    • S Offline
                      sdetweil @sunsetrider
                      last edited by

                      @sunsetrider right. just changing apiVersion back to 3.0 isn’t all that is required…
                      the endpoints changed, and you now need lat and lon,
                      and the header location has to be added manually…

                      api 3.0 requires a credit card , and provides 1000 uncharged api request per day.

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      1 Reply Last reply Reply Quote 0
                      • crazylegsC Offline
                        crazylegs @charlesf
                        last edited by crazylegs

                        @charlesf I took a quick look at your solution and happy to hear that it works! I agree that being able to preserve all the XML parsing is definitely the way to go. To be honest, I was assuming that your approach (parsing the correct file out of the directory listing) was going to be a massive PITA, but I think you did a very nice job! Congrats!

                        And if you don’t mind, I hope to lean on your solution to make updates to the envCanada provider code when I get a chance :)

                        To anyone using the envCanada provider in the default Weather module: I’m the original author of the envCanada provider. I have been traveling and unable to make corrections to the code, but I do hope to get it all working sometime in August (the earlier the better).

                        charlesfC 1 Reply Last reply Reply Quote 0
                        • charlesfC Offline
                          charlesf @crazylegs
                          last edited by

                          @crazylegs Thanks. And by all means use as you see fit. I borrowed heavily from your code when I wrote my module 2 years ago.

                          Perhaps you can educate me: when I fetch the xml file the async process seems to wait till it is done and then the data is available. But if I use the same steps to fetch the directory list, the calling function receives a pending promise. That’s why I implemented the fetching of the xml file within what is effectively a call back - it didn’t work otherwise, but I can’t see what is different between the two cases. But as I said earlier, I don’t know much about this environment - I am am old assembler/C/C++/C# coder from the mists of time.

                          S 1 Reply Last reply Reply Quote 0
                          • S Offline
                            sdetweil @charlesf
                            last edited by

                            @charlesf is the function for the directory list marked async?? if so, then you could await it

                            Sam

                            How to add modules

                            learning how to use browser developers window for css changes

                            charlesfC 1 Reply Last reply Reply Quote 0
                            • charlesfC Offline
                              charlesf @sdetweil
                              last edited by

                              @sdetweil yes, and that is how I started, but it didn’t work.

                              1 Reply Last reply Reply Quote 0

                              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                              With your input, this post could be even better 💗

                              Register Login
                              • 1
                              • 2
                              • 2 / 2
                              • First post
                                Last post
                              Enjoying MagicMirror? Please consider a donation!
                              MagicMirror created by Michael Teeuw.
                              Forum managed by Sam, technical setup by Karsten.
                              This forum is using NodeBB as its core | Contributors
                              Contact | Privacy Policy