summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--publishTemperature.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/publishTemperature.sh b/publishTemperature.sh
new file mode 100644
index 0000000..0299db9
--- /dev/null
+++ b/publishTemperature.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+# Extract raspi GPU/CPU temperatures and publish them on MQTT
+# SJP 9 Jan 2018
+# Designed to be called from a timer service.
+#
+cpuTemp=echo "scale=1; $(cat /sys/class/thermal/thermal_zone0/temp)/1000" | bc
+
+mosquitto_pub -h stan -t stan/test/cpu/${cpuTemp}
+