💾 Archived View for jlk.flounder.online › gemlog › 2014-11-09.gmi captured on 2024-05-12 at 15:10:05. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-12-17)
-=-=-=-=-=-=-
This is an article I have published in 2014 on blogger platform. As I still find the original idea appealing, in 2021 I have migrated the post to this gemlog. I don't use the MUI anymore, in the meantime I have built Telegram bot running on R for this...
I guess the idea is rather old - so old that even Google cannot find it. You mail requests to a remote computer, and it mails you back the results.
I needed a computer to run 24/7, so I chose Raspberry Pi for its low-power consumption and no moving parts. So far, I did not succeed in installing R 3.x, as its back ports to Debian have some unresolved dependencies. Limited to R 2.15 I am using two packages: edeR for reading incoming mail and mailR for sending back the results. On R 3.x one could use package gmailr, which gives you full access to Gmail API, for both tasks.
The basic setup is elementary - there is a task scheduled that checks a dedicated Gmail account every 15 minutes and parses subjects of the last 20 mails. If it finds unresolved mail (combination of time and subject) it looks for keywords to run specific scripts. The scripts send back the data to a fixed email address. In future version I plan to send the results back to the address, the email came from.
So far, I have two scripts running:
The first one scrapes data from Czech Hydro-meteorological Institute about water levels and temperature of Jizera river near my cottage and sends back a chart with a week's history and 36 hours prediction of future development. I use it to estimate whether I need to move everything upstairs because the flood is coming or not. As there is very low coverage of GSM in the area, the email request and data delivery is the most reliable way to do this.
The second script is from the area of data collection and result analysis. We have a young cat with heart problems. There are periods when the problems are worse, and he needs to get bolus of diuretics. It seems to be weather related. So, I made a small script that collects the data about his problems (I simply send an email with the subject "cat coughs"). The script assumes that on days when no mail arrived the cat was fine. It downloads weather data for the period from the first recorded attack and runs logit regression on the data. It sends back analysis, which weather conditions seem to affect him the most. So far, it seems that it is a cloudy weather and changes in pressure and temperature...
I quite like the idea of running smart tasks based on email trigger because email is so universal interface. Of course - the most often I send and receive the data using my mobile, but even for that I find it very efficient as the email client takes care of communication attempts when the signal is low quality, and it reduces data flow to the necessary minimum. With the analytical capabilities of R and its wide range of libraries the possibilities of tasks that can remotely triggered are endless.