Weather logging

So been experimenting with some of the options for ansiweather, partly as schools need to teach data logging as part of the national curriculum computing, however not all schools have the kit required.

As I have this running on a Raspberry Pi, I thought it may be possible to set one up to log just the location and temperature.

ansiweather -l paignton -p false -h false  -w false -i false >temponly.txt

so the above will display the location and temperature, but exclude pressure, humidity, wind and UV index.

now=$(date +"%m_%d_%Y")
echo "Filename : /nas/backup_$weather.csv"
echo $(date "+ %D, %T"), $(ansiweather -l Paignton -a false) >> weather_$now.csv

Control what is sent to stdout.

now=$(date +"%m_%d_%Y")
echo "Filename : /nas/backup_$weather.csv"
echo $(date "+ %D, %T"), $(ansiweather -l torquay -p false -h false  -w false -i false) >> torquay_$now.csv

Final script

now=$(date +"%m_%d_%Y")
echo "Filename : /nas/backup_$weather.csv"
echo $(date "+ %D, %T"), $(ansiweather -l torquay -p false -h false  -w false -i false) >> torquay_$now.csv

Tags

#Bash,#BashScripting,#Logging,#Data


Mastodon ShellLabs Join Mastodon
AI statement : Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity. Consent CANNOT be assumed, it has to be granted.

Donate using Liberapay