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-MyWeather not working with Southern Hemisphere co-ordinates

    Scheduled Pinned Locked Moved Troubleshooting
    18 Posts 4 Posters 6.1k Views 4 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.
    • J Offline
      Jolt02
      last edited by

      Hi all!

      Need help with an odd one. Is anyone else running into issues using MMM-MyWeather for Southern Hemisphere co-ordinates? The module gets stuck on ā€œloadingā€ if lat has a negative value, but works fine for negative value in longitude (eg New York with lat = 40.69 and lon = -74.25).

      The response from the API as provided in the logs is fine in both instances, but it just looks like the module cant parse the json correctly and i can’t figure out why.

      Sample of my config below.

      modules: [
        {
          module: 'MMM-MyWeather',
          position: 'top_right',
          config: {
            apikey: 'xxxxxxxxxxxxx', 
            lat: "-22.27", // 
            lon: "133.77" , // 
            hourly: '1',
            fctext: '1',
            fcdaycount: "5",
            fcdaystart: "0",
            hourlyinterval: "3",
            hourlycount: "2",
            UseCardinals: 0,
            layout: "horizontal",
            debug : 1
          }
        },
      ]
      
      S 2 Replies Last reply Reply Quote 0
      • S Offline
        sdetweil @Jolt02
        last edited by

        @jolt02 remove the quotes from all the numbers

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        J 1 Reply Last reply Reply Quote 0
        • J Offline
          Jolt02 @sdetweil
          last edited by

          @sdetweil that’s not the issue though. using lat = ā€œ22.27ā€ and ā€œ133.77ā€ work even if the rest of numbers are in quotes.

          the code above were copied and pasted the config from the module documentation. i’ve just changed the co-ordinates to be southern hemisphere co-ordinates

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

            @jolt02 said in MMM-MyWeather not working with Southern Hemisphere co-ordinates:

              fcdaycount: "5",
              fcdaystart: "0",
              hourlyinterval: "3",
              hourlycount: "2",
            

            but i don’t care what the author posted… those are strings, that need to be converted to numbers…

            anyhow

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            J 1 Reply Last reply Reply Quote 0
            • J Offline
              Jolt02 @sdetweil
              last edited by Jolt02

              @sdetweil šŸ¤·ā€ā™‚ļø that’s how they built the module and i’m not familiar enough with JS to go through and fix it. Thanks for trying anyways.

              for what it’s worth, I ended up learning to use the console more and figured out something in the moon direction logic was broken because it was looking for there was a condition for lat >= 0. I’ve just gone through and deleted all references to moon phases in the MMM-MyWeather.js file and it’s working fine now.

              probably not the most elegant of solutions, but at least it gives me way more information than ā€œloadingā€¦ā€

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

                @jolt02 said in MMM-MyWeather not working with Southern Hemisphere co-ordinates:

                a condition for lat >= 0

                so, to add to the prior discussion

                if the user had coded lat:ā€œ-16ā€ in config.js

                the comparison would always be true comparing a string to a 0 (all ā€˜string’ objects would be non-zero, regardless of their content)

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                J 1 Reply Last reply Reply Quote 0
                • H Offline
                  harney
                  last edited by harney

                  try taking out the Lon And Lat and use a PWS like for me would be… Perth (IPERTH921). This usually happens when the site can’t match a co-ordinate to a location.

                  I have tried various modules that require Lon and Lat or area and found this happens a lot ā€˜down under’ as there seems to be less active locations than in the northern hemisphere.

                  for my mirror I used default weatherforecast and MMM-OpenmapWeather . Both of these use Open Weather map that has locations rather than co-ordinates.

                  MMM-MyWeather also uses locations (PWS)

                  IMG_9657.jpg

                  J 1 Reply Last reply Reply Quote 0
                  • J Offline
                    Jolt02 @harney
                    last edited by Jolt02

                    @harney hello from Perth as well! how are you finding the accuracy of the OpenWeather data? I was using that initially, but found that it was telling me something different to the results from Google.

                    i used lat long in OpenWeather though and didnt try using the PWS so that might be the difference

                    H 1 Reply Last reply Reply Quote 0
                    • J Offline
                      Jolt02 @sdetweil
                      last edited by

                      @sdetweil from my very basic understanding of how it was developed, i think it was stored it as a string so that it could be concatenated? again, this is based on 5 minutes of Google-fu and no understanding of JS here

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

                        @jolt02 js will convert in either direction automatically, except if u ask, is this a number or a string

                        temp: 1234 is a number
                        temp ā€˜1234’ is a string
                        temp: ā€˜null’ is string
                        temp: null is undefined

                        print temp from above will do 1234, or 1234, or null, or undefined

                        Sam

                        How to add modules

                        learning how to use browser developers window for css changes

                        1 Reply Last reply Reply Quote 0
                        • H Offline
                          harney @Jolt02
                          last edited by

                          @jolt02 All these weather sites use data from private weather enthusiasts that have varying equipment so the accuracy will never be 100% spot on. Im using data from a Bassendean site which is in the proximity of my place. It is ā€œcloseā€ but as there is no official BOM reading for the area, who is to say its wrong. BOM get there Temps for ā€˜Perth’ from their site at the airport and in the city,

                          I find a lot of the ā€œProā€ sites like weather channel, Google etc are using data from sites in the northern Hemisphere. This can make it very hard to know what is the correct temp. I have an API from BOM but haven’t figured out the coding as they don;t use Json.

                          I would like to get data from Windy.com for cloud and wave data but that is expensive

                          S 1 Reply Last reply Reply Quote 0
                          • S Offline
                            Saabman Project Sponsor @harney
                            last edited by

                            @harney thats a pitty the BOM doesnt have close data for your site.
                            I have found that all the regular weather providers (Open weather, darksky etc) forecasts and observations are less than adequate for Oz.

                            So I have been reworking the Weather Module from WallberryTheme to use Aus govs BOM data. getting observations was easier enough as they provide that in JSON format which makes it some what easy but they only provide XML data for forecasts and the format is different for every site :( so my plans to ā€œreleaseā€ my module have stalled. because it has to be customised for each site.

                            H 1 Reply Last reply Reply Quote 1
                            • H Offline
                              harney @Saabman
                              last edited by

                              @saabman yep. I have found the xml to be a problem and out of my range of knowledge. OpenWeather is close to accurate for my location for current conditions,. the particular site location uses excellent monitoring equipment, just a few degrees out, but for forecasting its not that accurate.

                              S S 2 Replies Last reply Reply Quote 0
                              • S Offline
                                sdetweil @harney
                                last edited by sdetweil

                                @harney use a lib to convert to json…

                                google search

                                nodejs xml to json

                                there are a few…
                                some let you target a specific section of the xml

                                Sam

                                How to add modules

                                learning how to use browser developers window for css changes

                                H 1 Reply Last reply Reply Quote 1
                                • H Offline
                                  harney @sdetweil
                                  last edited by

                                  @sdetweil said in MMM-MyWeather not working with Southern Hemisphere co-ordinates:

                                  nodejs xml to json

                                  Thanks Sam, I will see what i can do

                                  "John

                                  1 Reply Last reply Reply Quote 0
                                  • S Offline
                                    Saabman Project Sponsor @harney
                                    last edited by

                                    @harney

                                    yes the XML issue was a problem but I got around that by downloading the XML then as sdetweil suggested using XLM2JS to convert the file to JSON which I could ten search for the relevant fields unfortunately its not very tidy and needs customizing for each site.

                                    IF you want to have a look at how Ive done it the files are here
                                    https://github.com/saabman/WallberryTheme/blob/master/WB-weather/README.md

                                    I am not by any means a programmer - just kept hacking away at the weather module till it did what I wanted - Im sure there are better ways to do it… hopefully it is help full any way

                                    H 1 Reply Last reply Reply Quote 1
                                    • H Offline
                                      harney @Saabman
                                      last edited by

                                      @saabman Legend

                                      S 1 Reply Last reply Reply Quote 0
                                      • S Offline
                                        Saabman Project Sponsor @harney
                                        last edited by

                                        @harney

                                        Unfortunately BOM lately has made changes to their site which is preventing accessing their data claiming it’s scraping but they provide a JSON file which I’m accessing (for part of it anyway) so my module no longer works- I’ve changed things a couple of times to circumvent the issue but it keeps coming back so I’m going to look at other ways to access the data. One that looks promising is WillyWeather. It is a paid service based on the number of access’s billed monthly. But it appears to be very cheap - It looks like for one Magic Mirror accessing data from one weather station and radar image works out at less than $10 a year.
                                        When accessing the BOM currently they return a message to fill in a request form and some one will make contact - I filled in their form a couple of months ago and am yet to receive a response. Maybe when they get the servers sorted out things might change….

                                        1 Reply Last reply Reply Quote 1

                                        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 / 1
                                        • 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