💾 Archived View for idiomdrottning.org › weather-checker captured on 2024-05-12 at 16:02:00. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-12-03)

-=-=-=-=-=-=-

weather-checker

In my continued quest to release stuff I’d normally just use myself and then never release because it’s probably not useful to anyone else, here is weather-checker.

It’s a Chicken Scheme thing that finds out the local temperature by asking a weather service, and then if it’s cold out it tells me to open the windows and if it’s hot out it ask me to close it up. If it hasn’t already done so, of course.

This means that all throughout the winter it’s gonna stay silent because it remembers that the last thing that happened as the summer froze to ice is that it said that it was cold.

Credentials file

In ~/.weathercheck.rc there are three lines. API key, latitude, and longitude.

History

Before running it the first time, do

echo whatever > ~/.lastweatherask

So that there is something there. After the first run, it should remember what it last asked you to do.

Todo

This is the part that makes this version probably not useful to anyone else but me yet… ho hum.

I have an org-mode file that it can grep, and remove lines from.

This first release, since I made this lil thing for my own use, I kinda ran out of steam and hardcoded the todo file’s location:

(define (home path) (string-append (sixth (user-information (current-user-id))) path))
(define todo (home "/gtd/projekt.org"))

I implemented querying it and removing from it, but to add to it I got super lazy and instead just shell out to a shell script I already had:

(define (add str)
  (run
   (zshrun skabara ,str)))

So in order for this to be of any use to anyone else, they are gonna need to hack on it.♥

Architecture

It’s your basic compose pipe line. Last line, right-to-left. It reads credentials, turns that into a temperature, turns to a request (i.e. close or open my windows), and then ask me to do that request.

Source code

For a repo,

git clone https://idiomdrottning.org/weather-checker