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.

    Weather module config

    Scheduled Pinned Locked Moved Troubleshooting
    19 Posts 2 Posters 3.9k Views 2 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.
    • M Offline
      mrlowndes
      last edited by

      Just to clarify, I’m talking about the ‘weather’ module, NOT the ‘current weather’ or 'weather forecast" modules. I have added it to my config.js file with some configurations, as outlined in the documentation for the ‘weather’ module, but it wont run. Question for module configs, do I use "true", or 'true', to encapsulate my values? Its seems to vary depending on what I’m reading. Here is my config.js script:

      /* Magic Mirror Config Sample
       *
       * By Michael Teeuw http://michaelteeuw.nl
       * MIT Licensed.
       *
       * For more information on how you can configure this file
       * See https://github.com/MichMich/MagicMirror#configuration
       *
       */
      
      var config = {
      	address: "localhost", // Address to listen on, can be:
      	                      // - "localhost", "127.0.0.1", "::1" to listen on loopback interface
      	                      // - another specific IPv4/6 to listen on a specific interface
      	                      // - "0.0.0.0", "::" to listen on any interface
      	                      // Default, when address config is left out or empty, is "localhost"
      	port: 8080,
      	ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], // Set [] to allow all IP addresses
      	                                                       // or add a specific IPv4 of 192.168.1.5 :
      	                                                       // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"],
      	                                                       // or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format :
      	                                                       // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"],
      
      	useHttps: false, 		// Support HTTPS or not, default "false" will use HTTP
      	httpsPrivateKey: "", 	// HTTPS private key path, only require when useHttps is true
      	httpsCertificate: "", 	// HTTPS Certificate path, only require when useHttps is true
      
      	language: "en",
      	timeFormat: 24,
      	units: "metric",
      	// serverOnly:  true/false/"local" ,
      			     // local for armv6l processors, default
      			     //   starts serveronly and then starts chrome browser
      			     // false, default for all  NON-armv6l devices
      			     // true, force serveronly mode, because you want to.. no UI on this device
      
      	modules: [
      		{
      			module: "currentweather",
      			position: "top_right",
      			config: {
      				location: "Santa Barbara",
      				locationID: "5392952", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
      				appid: "112847e0ff924d7f26338d5873e7be3d"
      			}
      		},
      		{
      			module: "weatherforecast",
      			position: "top_right",
      			header: "Weather Forecast",
      			config: {
      				location: "Santa Barbara",
      				locationID: "5392952", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
      				appid: "xxxxxxxxxxxxxx"
      			}
      		},
      		{
      		module: "weather",
      		position: "top_left",
      		config: {
      			weatherProvider: "weathergov",
      			units: "metric",
      			roundTemp: "true",
      			degreeLabel: "true",
      			updateInterval" "3600000",
      			colored: "true",
      			showPrecipitationAmount: "true",
      			apiBase: "https://api.weather.gov/points/",
      			weatherEndpoint: "/forecast",
      			lat: "xxx.xxxxxx",
      			lon: "xxx.xxxxxx",
      			type: "forecast"
      		}
      	},
      	]
      
      };
      
      /*************** DO NOT EDIT THE LINE BELOW ***************/
      if (typeof module !== "undefined") {module.exports = config;}
      

      and here are the errors I’m getting:

      [2020-04-28 11:31:59.700] [ERROR]  WARNING! Could not validate config file. Starting with default configuration. Please correct syntax errors at or above this line: /home/pi/MagicMirror/config/config.js:65
      			updateInterval" "3600000",
      			              ^^^
      
      SyntaxError: Unexpected string
          at Module._compile (internal/modules/cjs/loader.js:722:23)
          at Object.Module._extensions..js (internal/modules/cjs/loader.js:798:10)
          at Module.load (internal/modules/cjs/loader.js:645:32)
          at Function.Module._load (internal/modules/cjs/loader.js:560:12)
          at Module.require (internal/modules/cjs/loader.js:685:19)
          at require (internal/modules/cjs/helpers.js:16:16)
          at loadConfig (/home/pi/MagicMirror/js/app.js:69:12)
          at App.start (/home/pi/MagicMirror/js/app.js:210:3)
          at Object.<anonymous> (/home/pi/MagicMirror/js/electron.js:115:7)
          at Module._compile (internal/modules/cjs/loader.js:786:30)
      
      S 1 Reply Last reply Reply Quote 0
      • S Offline
        sdetweil @mrlowndes
        last edited by sdetweil

        @mrlowndes for numbers or true/false, no quotes, all else with quotes, doesn’t matter which kind as long as both ends are the same
        in a list it can be either for each entry, as long as both ends are the same

        updateInterval" “3600000”,

        should be name: value
        so
        updateInterval : “3600000”,

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        1 Reply Last reply Reply Quote 0
        • M Offline
          mrlowndes
          last edited by

          @sdetweil thanks. That got rid of the errors, now when I npm start the weather module seems to be just loading indefinitely. Any ideas?

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

            @mrlowndes did u get an apiid? ‘loading’ means waiting for data … so, the component getting the data did not succeed

            npm start
            then look at the messages

            or possibly open the developers window (f12 or ctrl-shift-i) select the console tab, and scroll up looking for errors…

            Sam

            How to add modules

            learning how to use browser developers window for css changes

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

              @mrlowndes said in Weather module config:

              index):1 Refused to apply style from ‘http://localhost:8080/css/custom.css’ because its MIME type (‘text/html’) is not a supported stylesheet MIME type, and strict MIME checking is enabled.

              ok, don’t know for the slow network.

              but for this one

              do

              touch ~/MagicMirror/css/custom.css
              

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              1 Reply Last reply Reply Quote 0
              • M Offline
                mrlowndes @sdetweil
                last edited by

                @sdetweil Thanks for the tip. The errors were at the bottom. This is what I found:

                Failed to load resource: the server responded with a status of 400 ()
                weathergov.js:55 Could not load data ...  
                XMLHttpRequest
                weather.js:151 New weather information available.
                main.js:301 [Intervention] Slow network is detected. See https://www.chromestatus.com/feature/5636954674692096 for more details. Fallback font will be used while loading: http://localhost:8080/vendor/node_modules/weathericons/font/weathericons-regular-webfont.woff
                api.openweathermap.o…xxxxxxxxxxxxxxxx:1 Failed to load resource: the server responded with a status of 401 (Unauthorized)
                weatherforecast.js:266 weatherforecast: Your AppID does not support long term forecasts. Switching to fallback endpoint.
                (index):1 Refused to apply style from 'http://localhost:8080/css/custom.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled
                
                1 Reply Last reply Reply Quote 0
                • M Offline
                  mrlowndes
                  last edited by

                  @sdetweil do you know where I could get an appid for weathergov? The documentation for the module is very thin

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

                    no key required for that point… only works for US locations

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    M 1 Reply Last reply Reply Quote 0
                    • M Offline
                      mrlowndes @sdetweil
                      last edited by

                      @sdetweil Do you have any suggestions as to what I should try next?

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

                        @mrlowndes u can test that the api works from your location

                        put this in your browser

                        https://api.weather.gov/points/LAT,LON/forecast
                        

                        replace the LAT,LON
                        by the values from the google maps (maps.google.com) of your location…
                        in the url, you will see two numbers xx.yyyyyy,-uu.zzzzzz
                        just cut/paste that whole set of numbers and paste over the LAT,LON (notice the comma comes with the numbers too)

                        Sam

                        How to add modules

                        learning how to use browser developers window for css changes

                        1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 1 / 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