Created
November 24, 2021 16:10
-
-
Save nixpulvis/42ad6166aa87eec248418ff2b28d6f71 to your computer and use it in GitHub Desktop.
Watching the weather is serious stuff, better use bash.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
alarm() { | |
while :; | |
do | |
play ~/Loud_Alarm_Clock_Buzzer-Muk1984-493547174.wav | |
done | |
} | |
while :; | |
do | |
temp=$(ssh raspberrypi.local 'echo "scale=2; ($(cat /sys/bus/w1/devices/28-05167183beff/temperature) / 1000) * (9/5) + 32" | bc -l') | |
echo $temp | |
if [ $(printf %.0f $temp) -lt 55 ]; then | |
alarm | |
fi | |
sleep 5 | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# TODO: -b, --beep when outside range. | |
# TODO: -c, --color for fun? | |
# TODO: add flag for logging `| tee -a temperature_log` | |
watch -n1 -d 'echo "scale=2; $(cat /sys/bus/w1/devices/28-05167183beff/temperature)/1000 * 9/5 + 32" | bc -l | sed "s/$/°F/"' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment