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.

    CORS policy

    Scheduled Pinned Locked Moved Solved Troubleshooting
    20 Posts 3 Posters 4.1k Views 3 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.
    • S Offline
      sdetweil @bicolorbore586
      last edited by

      @bicolorbore586 custom.css is because it doesn’t exist by default. if u used my install script I create it for you

      touch ~/MagicMirror/css/custom.css

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      B 1 Reply Last reply Reply Quote 0
      • B Offline
        bicolorbore586 @sdetweil
        last edited by

        @sdetweil I used the MagicMirror installation instructions (assuming manual install) to install the software.

        Have just tried your git fetch origin
        But get fatal: Refusing to fetch into current branch refs/heads/develop of none-bare repository.

        (Sorry, you’re probably shaking your head, but I am a complete noob at all this)

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

          @bicolorbore586 there were two choices

          manual install

          git checkout develop
          git pull
          npm install

          or the other

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          karsten13K 1 Reply Last reply Reply Quote 0
          • karsten13K Offline
            karsten13 @sdetweil
            last edited by

            @sdetweil

            I think the cors proxy is not new in the weather module (but in newsfeed) so last release should work.

            The cors proxy was not enabled for all weather providers, only for envcanada and darksky, so it must be enabled in the config for weatherbit by adding useCorsProxy: true, to the weather config.

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

              @karsten13 ah, I thought we went proxy everywhere

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              karsten13K 1 Reply Last reply Reply Quote 0
              • karsten13K Offline
                karsten13 @sdetweil
                last edited by

                @sdetweil

                had to look in the code again … but may we should set default true for all providers …

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

                  @karsten13 getting that way

                  localhost is usually allowed 0.0.0.0 ( I consider to be a bug to send this anywhere) is not

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  B 1 Reply Last reply Reply Quote 0
                  • B Offline
                    bicolorbore586 @sdetweil
                    last edited by

                    @sdetweil @karsten13 have added in the useCorsProxy: true

                    Have since updated MagicMirror, now getting

                    Could not load data … TypeError: Cannot read properties of undefined (reading ‘0’)

                    which when clicked on shows weatherbit.js

                    code_text
                    ```/* global WeatherProvider, WeatherObject */
                    
                    /* MagicMirror²
                     * Module: Weather
                     * Provider: Weatherbit
                     *
                     * By Andrew Pometti
                     * MIT Licensed
                     *
                     * This class is a provider for Weatherbit, based on Nicholas Hubbard's class
                     * for Dark Sky & Vince Peri's class for Weather.gov.
                     */
                    WeatherProvider.register("weatherbit", {
                    	// Set the name of the provider.
                    	// Not strictly required, but helps for debugging.
                    	providerName: "Weatherbit",
                    
                    	// Set the default config properties that is specific to this provider
                    	defaults: {
                    		apiBase: "https://api.weatherbit.io/v2.0",
                    		apiKey: "",
                    		lat: 0,
                    		lon: 0
                    	},
                    
                    	fetchedLocation: function () {
                    		return this.fetchedLocationName || "";
                    	},
                    
                    	fetchCurrentWeather() {
                    		this.fetchData(this.getUrl())
                    			.then((data) => {
                    				if (!data || !data.data[0] || typeof data.data[0].temp === "undefined") {
                    					// No usable data?
                    					return;```
                    

                    Forgive me, again for being a noob, but I didn’t think this required any information in, however having substituted the lat and lon zero’s for my location, still throws up the same and error and points me to the [0] following !data.data

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

                      @bicolorbore586 never edit our code, all config goes in config.js

                      u need lat and long (how else does it know where u are)

                      all numbers and true/false have no quotes
                      anything with a letter or special character does need quotes

                      u need weatherProvider
                      apikey
                      lat
                      lon
                      and type (forecast or current)
                      and

                      useCorsProxy: true

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      B 1 Reply Last reply Reply Quote 0
                      • B Offline
                        bicolorbore586 @sdetweil
                        last edited by

                        @sdetweil
                        ok, have put it back to how it was… that was final “can I get this to work, before I ask for further help”
                        this is my config.js

                        code_text
                        ``` {
                        			module: "weather",
                        			position: "top_right",
                        			config: {
                        				weatherProvider: "weatherbit",
                        				type: "current",
                        				lat: 5,
                        				lon: -1,
                        				apiKey: "ab4",
                        				useCorsProxy: true
                        					}
                        		},
                        		{
                        			module: "weather",
                        			position: "top_right",
                        			header: "Weather Forecast",
                        			config: {
                        				weatherProvider: "weatherbit",
                        				type: "forecast",
                        				lat: 5,
                        				lon: -1,
                        				initialLoadDelay: 1,
                        				apiKey: "ab4",
                        				useCorsProxy: true
                        					}
                        		},
                        S 1 Reply Last reply Reply Quote 0
                        • 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