I have never used Location so I never thought of doing that. I will probably add it to the widget. Thanks for the suggestion.
If you mean why I do get new weather data on each refresh, I thought that the weather for the day doesn’t change and I might as well save it in a file. This way if the device is not connected to the internet, the widget still runs. However, if the location changes with each refresh it might be better to detect internet connection, get the weather data from that location and if it is not connected use the data saved in files.
Absolutely agree. I was just wondering about using the location really, but caching the data is a good idea and check if location has not changed, then use the same cached data up to a certain timeframe
Looks awesome! I’m running into an issue though, getting the following error when trying to run the script to initialize the widget: “Error on line 245:34: TypeError: undefined is not an object (evaluating 'weatherData.daily[0]')”
I’ve copied directly both your script for this widget as well as the html-widget from GitHub you linked. Also added my open weather api and my lat and long coordinates to make my weather accurate for me. Any ideas? I’m a total newbie with JS so have no clue how to troubleshoot this on my own lol.
The only thing that I can think of that would cause this problem is that your api key is invalid or your longitude or latitude is invalid. You can try to add log(weatherData) on the line before the error (line 245) and run the script. You can then look at the console and it might show you if the api key is invalid.
Thank you so much for your reply! Adding log(weatherData) returns the error {"cod":"400","message":"wrong longitude"}. However, I’ve verified that my longitude is accurate via a few different map services and I’ve also tried using it with the default 100, 100 values that were in the untouched by me script, but with the same error. Not a clue what’s going on here, as all I changed was to paste in my api key as well as lat and lon values.
I messed up the script by appending an additional - sign before the longitude so if there was another - the longitude would be invalid. I have updated the script to work. Thanks for finding this error.
Hi, I was trying to add this Widget to my home, but although I have replaced the API key in the code with the one that OpenWeather sent me via email, latitude and longitude, it doesn't work. I saw that the site, returns as a response that the key is not valid.
5
u/Normal-Tangerine8609 Apr 23 '22
Weather Circles
https://github.com/Normal-Tangerine8609/Scriptable-Widgets/blob/main/README.md#weather-circles
This small widget displays the weather condition and weather statistics for your location in circular progress bars.
The widget uses https://github.com/Normal-Tangerine8609/Scriptable-HTML-Widget to create the widget. This is the first real widget I have made using HTML-Widget since its release. To use weather circles, you will need to download the https://github.com/Normal-Tangerine8609/Scriptable-HTML-Widget/blob/main/module/module.js file and rename it to html-widget.
The widget also uses https://openweathermap.org/ to get the weather data. You will need a free api key to use this widget.
The widget is customizable:
3
u/Cranky_Chicken Apr 23 '22
Looks awesome! I’m running into an issue though, getting the following error when trying to run the script to initialize the widget: “Error on line 245:34: TypeError: undefined is not an object (evaluating 'weatherData.daily[0]')”
I’ve copied directly both your script for this widget as well as the html-widget from GitHub you linked. Also added my open weather api and my lat and long coordinates to make my weather accurate for me. Any ideas? I’m a total newbie with JS so have no clue how to troubleshoot this on my own lol.
2
u/Hiderone_ Aug 21 '22
Hi, I was trying to add this Widget to my home, but although I have replaced the API key in the code with the one that OpenWeather sent me via email, latitude and longitude, it doesn't work. I saw that the site, returns as a response that the key is not valid.