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.

    How to use Yr as a weather provider

    Scheduled Pinned Locked Moved Solved Troubleshooting
    12 Posts 3 Posters 2.2k 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.
    • S Offline
      sdetweil @MajorC
      last edited by sdetweil

      @MajorC said in How to use Yr as a weather provider:

        		type: "current",
        		lat: "52.5544",
        		lon: "13.4635",
      

      numbers and true/false do not use quotes…

      open the developers window, ctrl-shift-i on the MM page,
      select the console tab and put,

      wea 
      

      in the filter field to see only messages from the weather module

      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
        MajorC Project Sponsor @sdetweil
        last edited by MajorC

        @sdetweil you are absolute right. But still:

        yr.js:311 Could not load weather data. SyntaxError: Unexpected non-whitespace character after JSON at position 4 (line 1 column 5)
            at JSON.parse (<anonymous>)
            at performWebRequest (utils.js:27:29)
        (anonymous) @ yr.js:311
        Promise.catch (async)
        getStellarDataFromYr @ yr.js:310
        getStellarDataFromYrOrCache @ yr.js:268
        (anonymous) @ yr.js:231
        getStellarData @ yr.js:213
        getCurrentWeather @ yr.js:47
        fetchCurrentWeather @ yr.js:35
        (anonymous) @ weather.js:190
        setTimeout (async)
        scheduleUpdate @ weather.js:187
        start @ weather.js:99
        startModules @ loader.js:25
        loadNextModule @ loader.js:218
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadModules @ loader.js:221
        init @ main.js:471
        await in init (async)
        (anonymous) @ main.js:593
        yr.js:285 Error: SyntaxError: Unexpected non-whitespace character after JSON at position 4 (line 1 column 5)
            at yr.js:312:11
        (anonymous) @ yr.js:285
        Promise.catch (async)
        getStellarDataFromYrOrCache @ yr.js:284
        (anonymous) @ yr.js:231
        getStellarData @ yr.js:213
        getCurrentWeather @ yr.js:47
        fetchCurrentWeather @ yr.js:35
        (anonymous) @ weather.js:190
        setTimeout (async)
        scheduleUpdate @ weather.js:187
        start @ weather.js:99
        startModules @ loader.js:25
        loadNextModule @ loader.js:218
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadModules @ loader.js:221
        init @ main.js:471
        await in init (async)
        (anonymous) @ main.js:593
        yr.js:41 Unable to get stellar data from Yr.
        (anonymous) @ yr.js:41
        Promise.catch (async)
        fetchCurrentWeather @ yr.js:40
        (anonymous) @ weather.js:190
        setTimeout (async)
        scheduleUpdate @ weather.js:187
        start @ weather.js:99
        startModules @ loader.js:25
        loadNextModule @ loader.js:218
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadNextModule @ loader.js:211
        await in loadNextModule (async)
        loadModules @ loader.js:221
        init @ main.js:471
        await in init (async)
        (anonymous) @ main.js:593
        yr.js:42 Uncaught (in promise) Error: Unable to get stellar data from Yr.
            at yr.js:42:11
        

        with config:

        	{
        			module: "weather",
        			position: "top_right",
        			config: {
        				showHeader: true,
        				weatherProvider: "yr",
        				type: "current",
        				lat: 52.5544,
        				lon: 13.4635,
        				//roundTemp: true
        			}
        		},
        

        ![alt text](c76fa3d6-3ee0-4a86-af34-ab263cea8040-image.png image url)

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

          @MajorC the api returned data the module did not expect and did not handle the error…

          the exact cause of the error is unknown as the code did not report it…

          i have seen quite a lot of sloppy api programming lately…

          the rules are pretty clear

          rc=200 means all good
          other errors 300/400/500 families provide specific info

          but a lot of apis return 200 even for error cases and THEN the code has to decode the TEXT of the ‘good’ data message…

          sloppy, lazy…

          because the error calls out an ‘unexpected non-whitepace’ (a colon maybe) , I suspect this api is one of these

          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
            MajorC Project Sponsor @sdetweil
            last edited by MajorC

            @sdetweil so I have to use an other weather provider? I really like Yr. They are very precise for Europe.

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

              @MajorC not what I said… its broken as you are using it, but I don’t know why. I am not the provider author… you can post an issue to the MM github page…

              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

                see https://github.com/MichMich/MagicMirror/issues/3189

                yr has changed api, the fix comes with next release on Oct.

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

                  @karsten13 thanks, gotta start checking the changelog .

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    MajorC Project Sponsor
                    last edited by

                    Thank you. I will wait on the next version of MM. :ok_hand:

                    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