In this post I'm going over all the automations I've set up on my home server to notify me of a couple of things that are important to me.
The server itself is just a simple Pine 64 SBC that lives in the basement, hardly drawing any power.
Personally I've turned off automatic notifications on my phone for pretty much anything (Pull over Push messaging is a big life improvement).
However I do like to get notifications about some things that are important to me, for which I've set up automated reporting.
Each of these scripts sends a message to a channel in slack.
Notification example:
Battery has been charged up to 89%
Solar panels and a battery are great, but to get the most out of it, I'd like to know when the home battery (which is charged from the solar panels) is almost full.
This allows me know when to plug in some more power hungry appliances (electric car, oven, etc.)
How this works:
A python script runs every 30 minutes, checking the state of the home battery, if it goes over 85%, a notification is sent.
fusion-solary-py libraryNotification example:
Home from daycare! 2 naps today (01:35h, 01:44h), 5x new diapers
Every day, when my kid gets home from daycare, a pdf is sent over email. It contains allot of data, but all I'm interested in, is knowing if he took naps, how many diapers changes (so we know when to supply new ones) and any messages from the staff.
How it works:
All email from the daycare gets forwarded to a separate mailbox, a python script accesses this mailbox through imap and checks if there is a mail with pdf attachment from the current date.
The pdf gets converted to text using pdftotext and then some regexes are run to extract the sleeping time, diaper change count and messages from the staff.
All that is then sent in one notification to the slack channel.
imap-tools library pdftotext command line utilityNotification example:
Your favorite bakery now has 2 leftover packages available!
In the region we live, there's an app called Too Good To Go; With this, local grocery shops can indicate by end of day that they have some leftovers available which you can purchase at a reduced price.
The only annoying thing is, is that you have to manually check if something is available by opening the app and keep refreshing to see if something got listed.
Fortunately this can be automated using a python package, once it finds something at one of my favorite shops, a notification is sent.
tgtg client libraryNotification example:
Cycling days: Tuesday Wednesday Thursday Friday Sunday
Star spotting days:
Thursday: 22,23
Friday: 0,1,2,3,4,5,6,7
Sunny days:
🌞 Wednesday (8, 9, 10, 12)
🌞 Thursday (11, 12, 13, 14, 15)
🌞 Friday (8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18)
Every day around lunch time, this notification is sent. It informs me about:
- when it would be a good day to go cycling (criteria: not freezing and not more than limited rainfall)
- which hours on which days it's good for star spotting (criteria: minimal cloud cover)
- sunny days ahead (criteria: sun, no clouds)
To get the cycling days, an api call is done to openweathermap.org
For the star spotting days and sunny days ahead, cloud coverage information is needed, which we can get from clearoutside.com, the needed info is scraped through BeautifulSoup.
Notification example:
🔥 <Server Name> is down! 🔥
I've got a couple of cloud servers for my business and it's important to keep them running. So if any one of those go down, I'd like to know about it.
Every 15 minutes a script runs the following command:
curl "https://server.com" -s -f -o /dev/null
If that command fails with an error, a notification is sent.
Let me know if you have some things that you automate around the house, always looking for inspiration!
You can get in touch through Mastodon:
@rxpz@social.linux.pizzaScripts to automate my day was published on 2024-03-05