From 8ab721d8011b15937aa89f69eafcd67ad537b232 Mon Sep 17 00:00:00 2001 From: Aaron Johnson Date: Wed, 18 Sep 2019 20:26:32 -0500 Subject: [PATCH] Added probe scripts --- probe_scripts/heatbot_gettemp | 14 ++++++++++++++ probe_scripts/heatbot_testrandom | 8 ++++++++ 2 files changed, 22 insertions(+) create mode 100755 probe_scripts/heatbot_gettemp create mode 100755 probe_scripts/heatbot_testrandom diff --git a/probe_scripts/heatbot_gettemp b/probe_scripts/heatbot_gettemp new file mode 100755 index 0000000..4d079a6 --- /dev/null +++ b/probe_scripts/heatbot_gettemp @@ -0,0 +1,14 @@ +#!/usr/bin/env sh + +#Modify this to point to your temperature probe +dir=/sys/bus/w1/devices/[some-hexadecimals] + +# DO NOT MODIFY + +# Sanity check +which bc 2>&1 >/dev/null || { echo "PROBE ERROR: 'bc' not found. Please install bc." >&2; exit 1; } + +# Retrieve temperature in Celsius +raw=$(grep 't=' $dir/w1_slave | awk -F'=' '{print $2}') +echo "scale=3; ${raw}/1000" | bc -l && exit 0 +exit 1 diff --git a/probe_scripts/heatbot_testrandom b/probe_scripts/heatbot_testrandom new file mode 100755 index 0000000..ce3f9b5 --- /dev/null +++ b/probe_scripts/heatbot_testrandom @@ -0,0 +1,8 @@ +#/usr/bin/env sh + +# Symlink this script to heatbot_gettemp if you need to test a probe's connection +# without retrieving real temperature numbers. This is useful in setup such as before +# the sensor hardware is available to use. + +echo $((-20 + $RANDOM % 60)).$((10 + $RANDOM % 89)) || exit 1 +exit 0