Add Weather Info to Obsidian Daily Notes

Cover Image for Add Weather Info to Obsidian Daily Notes
Photo from Unsplash
Visit pacebits.com for my recent projects

Problem Statement

I keep my Obsidian daily notes simple: a short plan in the morning and a short journal at night. One thing I wanted to add was the weather. It sounds trivial, but it gives good context when I look back at older notes.

I did not want a heavy plugin or a paid weather API. I only wanted a lightweight way to insert a single line like "Cloudy, 4C" when the daily note is created.

Solution

This is what I ended up with:

  • Obsidian Daily Notes
  • The Templater plugin
  • One Templater user function that retrieve weather info from wttr.in

No API key, no extra services.

Step 1: Configure Templater

Make sure Templater is installed, then enable User system command functions in Templater settings. This lets Templater run a shell command and expose it as a function you can call in templates.

Step 2: Add a system command function

In Templater settings, add a new User system command function. I named mine get_weather and used the following command:

curl http://wttr.in/Vancouver\?format="%l:+%c+%t+feels+like+%f"

Replace Vancouver with your city. You can customize the format if you want more details (see wttr.in help and README).

Step 3: Call it from the daily note template

In your daily note template, insert:

<% tp.user.get_weather() %>

Now every time a daily note is created, the template will call your function and insert the weather.

Notes and tweaks

  • If you do not want to hard-code a city, you can remove the location and let wttr.in use your IP.
  • The format string is the main thing to customize, and wttr.in also provides a few preset formats.

Conclusion

This is a small change, but it makes daily notes more useful when I look back over time. With one Templater function and a single line in the template, I get weather context for free.

glucn.com - Add Weather Info to Obsidian Daily Notes