willasm / obsidian-open-weather

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

Templater Weather Strings not parsing when Open Daily Note #33

Closed mrjeoffrey closed 5 days ago

mrjeoffrey commented 2 months ago

Hi there, thanks so much for this plugin and the straight forward setup guide.

All I'm looking to do is have my local weather show up whenever I create a new daily note. My daily note template has the %weather1% string, but for some reason templatr doesn't parse that code (but parses everything else). Am I missing something here? I noticed the guide doesn't have any more instruction other than insert the string so assuming it should work automatically with no issue. I wonder if other people are having issues here.

Would you be able to provide a demo on how this should work? Thank you!

willasm commented 2 months ago

You should be seeing it converted.. Here is an example added to my template. Templatr does not actually do the replacing, it is done by this plugin when the new note is created. Where are you creating the note? Check the plugins settings and check the exclude folder setting and make sure it is not set to the folder where you are creating the new note.

## Example

%weather1%

%weather2%

%weather3%

%weather4%

and this results in...

## Example

Scattered Clouds • Current Temp: 23°C • Feels Like: 23°C • Temp Min 22 • Temp Max 24 • Winds M/S 4.12 • Winds KM/H 4 Name: Edmonton

Edmonton: July 14 - 5:53 PM
Current Temp: 23°C • Feels Like: 23°C
Wind: 4 km/h from the North
Sunrise: 05:23:08 • Sunset: 21:56:14

<img src=https://openweathermap.org/img/wn/03d.png />&nbsp;July 14 2024 • 5:53 PM • Scattered Clouds
&nbsp;Recorded Temp: 23 • Felt like: 23
&nbsp;Wind: 4 km/h from the North
&nbsp;Sunrise: 05:23:08 • Sunset: 21:56:14

<img src=https://openweathermap.org/img/wn/03d.png />&nbsp;July 14 2024 • 5:53 PM • Scattered Clouds
&nbsp;Current Temp: 23 • Feels like: 23
&nbsp;Wind: 4 km/h from the North
&nbsp;Sunrise: 05:23:08 • Sunset: 21:56:14
mrjeoffrey commented 1 month ago

Thanks! I actually had to set an exclude folder for my templates within OpenWeather plugin. I finally got the string to work properly once I loaded my daily note with it. Logging this troubleshooting hack in case others are experiencing the same thing. I don't know why the exclude would work, but then again my setup is a bit complicated too.

willasm commented 1 month ago

Glad you got it working. The exclude folder should also exclude any sub-folders from whatever you have set. I will re-visit that section of code and see if can be improved. As I recall it would default to "Templates" in the root folder if it existed (Do not remember off hand as I wrote it nearly a year ago).

willasm commented 5 days ago

I just want to inform everyone that this plugin in being discontinued. Open Weather has discontinued the API 2.5 on which this plugin is based. I have however created a new plugin using the Visual Crossing Weather API and it follows the same basic approach to representing the weather as this plugin did so it should be relatively easy to move over to the new plugin. While it is still in development it is almost 100% functional. The documentation however is almost non existent but the list of available macros is complete and is in a nicely formatted table for better viewing. I hope to have it published soon as it is very close to being completed. If you want to try it before it is released you can find it on Github here.

Thank you, William McKeever