willasm / obsidian-open-weather

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

Weather string not returning data #21

Closed mituller closed 7 months ago

mituller commented 7 months ago

I am attempting to add weather to a template and in following the documentation, I would think this would return the current weather.

%weather1%

The weather string is returned as a text string. I know OpenWeather is working as I have it displaying in the statusbar and it is correct. Also, if I run the command "OpenWeather: Replace template string" it will change to the right weather. From what I understand if I have %weather1% in the template and add it to a new file, it would display the weather. Is there something that I am doing or are my expectations wrong? Shouldn't it automatically convert?

willasm commented 7 months ago

It only automatically converts it when creating a new note from a template. If inserting into an existing you will need to run the command OpenWeather: Replace template string to have it replaced with the current weather. Obsidian itself does not have a command built in to create a new note from a template. You would need to use the templater plugin to do that. This is interesting as you are the first person to ask this with over 6k downloads for the plugin. I will look into this and see if it is even possible to watch for the insert template command being run. If I can catch the event for the command I could then convert it to the weather string. To be honest with you I assumed everyone would be using this with templater templates, but I should have considered using it like this.

Once again, I'll look into this and see if it is possible, William.

willasm commented 7 months ago

I should have also mentioned that if you just want to insert it into the current document you can use the command OpenWeather: Insert weather string one which will insert the current weather format of the first string defined in the settings.

mituller commented 7 months ago

Thanks. I'm just starting with Obsidian so was confusing. I will look at creating a new note from a template.

willasm commented 7 months ago

That makes sense. I do suggest playing around with the built in core plugin templates until you get a good understanding of how they work, then add the templater plugin. It offers a lot more options than the core template plugin does and it is one of the most popular plugins used in Obsidian.

mituller commented 7 months ago

Thank you for your help.

On Thu, Feb 29, 2024 at 8:48 PM William McKeever @.***> wrote:

That makes sense. I do suggest playing around with the built in core plugin templates until you get a good understanding of how they work, then add the templater plugin. It offers a lot more options than the core template plugin does and it is one of the most popular plugins used in Obsidian.

— Reply to this email directly, view it on GitHub https://github.com/willasm/obsidian-open-weather/issues/21#issuecomment-1972369937, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABRXSIEWNMHIJBIZVPI5E3YV7UBJAVCNFSM6AAAAABD7CH4UKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZSGM3DSOJTG4 . You are receiving this because you authored the thread.Message ID: @.***>

willasm commented 7 months ago

I am going to close this issue but feel free to re-open it or create another if you have any questions or problems you need help with.