Read the statement by Michael Teeuw here.
How to use Yr as a weather provider
-
as follow up: That was merged today so you find it now in the offical documentation https://docs.magicmirror.builders/modules/weather.html#yr-options
-
My config looks like this:
{ module: "weather", position: "top_right", config: { showHeader: true, weatherProvider: "yr", type: "current", lat: "52.5544", lon: "13.4635", roundTemp: true, } },
But the mirror only says “loading…” all the time.
Any ideas how to deal with that? I use MM v2.24.0
-
@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
-
@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]( image url)
-
@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 infobut 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
-
@sdetweil so I have to use an other weather provider? I really like Yr. They are very precise for Europe.
-
@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…
-
see https://github.com/MichMich/MagicMirror/issues/3189
yr has changed api, the fix comes with next release on Oct.
-
@karsten13 thanks, gotta start checking the changelog .
-
Thank you. I will wait on the next version of MM. :ok_hand: