willasm / obsidian-open-weather

Obsidian plugin for OpenWeather API
MIT License
47 stars 3 forks source link

[Mobile] "TypeError: undefined is not an object" when ins #15

Closed Knochi closed 10 months ago

Knochi commented 1 year ago

I added the OpenWeatherPlugin to my mobile Obsidian Fault and when i tried to insert weather format 1 i got this error message

Failed to fetch weather data TypeError: undefined is not an object (evaluating 'json.weater[0]')

City is "Oberhausen, DE" and language is "german" Weather format 2,3,4 are working but not fully translated and with some \  strings in it.

### Format2
Oberhausen: September 07 - 2:07 PM
Current Temp: 30°C • Feels Like: 30°C
Wind: 13 km/h from the Southeast with gusts up to 18 km/h
Sunrise: 06:54:15 • Sunset: 20:07:43

### Format3
<img src=https://openweathermap.org/img/w/03d.png />&nbsp;September 07 2023 • 2:07 PM • Mäßig 
Bewölkt<br>&nbsp;Recorded Temp: 30 • Felt like: 30<br>&nbsp;Wind: 13 km/h from the Southeast with gusts up to 18 
km/h<br>&nbsp;Sunrise: 06:54:15 • Sunset: 20:07:43

### Format4
<img src=https://openweathermap.org/img/w/03d.png />&nbsp;September 07 2023 • 2:07 PM • Mäßig 
Bewölkt<br>&nbsp;Current Temp: 30 • Feels like: 30<br>&nbsp;Wind: 13 km/h from the Southeast with gusts up to 18 
km/h<br>&nbsp;Sunrise: 06:54:15 • Sunset: 20:07:43
willasm commented 11 months ago

Sorry for the late reply, I have been without a pc for quite some time but finally managed to complete a new build recently. Not sure why format 1 is not working on mobile? It works fine on my pc but will test it on my phone and see if I can find the problem. Formats 3 and 4 have the   as they are meant to be inserted as html. You can see how this works in the example.md file. If you want to use them as plain text you can edit them in the settings and remove the html tags. It has been a long time since I have worked on this but I plan to make some updates to it this week and will add this to my todo list. The translation is actually provided from the Open Weather API for some internally used keywords returned by the API. The format templates however are in English and you would have to edit the text for them directly in the settings. I will update the readme with this information.

Thank you for the bug report, William.

Knochi commented 10 months ago

Thanks for coming back. in the meantime i figured it out. Would be nice if the templates change as well, when you select a different language.