summaryrefslogtreecommitdiffstats
path: root/modules/temp
diff options
context:
space:
mode:
authorroot <root@krebs>2011-05-01 23:29:58 +0200
committerroot <root@krebs>2011-05-01 23:29:58 +0200
commit85861bc1cd16a37efa8f4c7e35d2350482d6c2e4 (patch)
treeb7ca0f6a3de19a616a54a90080c18bdd167c04bc /modules/temp
parent7bc6b2033d4940635fcc0cc89eee0220fa121b20 (diff)
modules/temp: Innen- & Außentemperatur
Diffstat (limited to 'modules/temp')
-rwxr-xr-xmodules/temp29
1 files changed, 22 insertions, 7 deletions
diff --git a/modules/temp b/modules/temp
index 047dfa5b..4e0c47a2 100755
--- a/modules/temp
+++ b/modules/temp
@@ -6,36 +6,51 @@ main() {
echo "report temperature in K, °C, °R, or °F."
;;
(-C|--celsius)
- echo `temp 'x - 273.15'` Grad Zelsius | to_espeak
+ espeak_inside `inside_temp 'x - 273.15'` Grad Zelsius
+ espeak_outside `outside_temp 'x - 273.15'` Grad Zelsius
;;
(-F|--fahrenheit)
- echo `temp 'x * 9/5 - 459.67'` Grad Fahrenheit | to_espeak
+ espeak_inside `inside_temp 'x * 9/5 - 459.67'` Grad Fahrenheit
+ espeak_outside `outside_temp 'x * 9/5 - 459.67'` Grad Fahrenheit
;;
(-R|--rankine)
- echo `temp 'x * 9/5'` Grad Renkin | to_espeak
+ espeak_inside `inside_temp 'x * 9/5'` Grad Renkin
+ espeak_outside `outside_temp 'x * 9/5'` Grad Renkin
;;
(-K|--kelvin|*)
- echo `temp` Kelvin | to_espeak
+ espeak_inside `inside_temp` Kelvin
+ espeak_outside `outside_temp` Kelvin
;;
esac
}
## temp [<formula with temperature as x>]
## Echo temperature in K. If formula is given then return that result instead.
-temp() {
+inside_temp() {
+ echo "scale=2; x=`/krebs/modules/temper/temper` + 273.15; ${1-x}" | bc
+}
+
+outside_temp() {
echo "scale=2; x=`dig +short txt outside.elwood.temp.citecs.de |
sed 's/^"DEG \([0-9]\+\.[0-9]\+\)"$/\1/'
` + 273.15; ${1-x}" | bc
}
+espeak_inside() {
+ echo Die Krebs-tempera-tur beträgt $@ | to_espeak
+}
+
+espeak_outside() {
+ echo Die Außen-tempera-tur beträgt $@ | to_espeak
+}
+
to_espeak() {
sed '
s/\(\.[0-9]\)0\+/\1/g
s/\(\.[0-9]\)\([0-9]\)[0-9]*/ \1 \2 /;
s/^-/minus /;
s/\./ komma /;
- s:^:/espeak -v Die Außen-tempera-tur beträgt :;
- ' >$NOISE_linefeed
+ ' | tee $NOISE_linefeed
}
main "$@"