diff --git a/README.md b/README.md index 6da2292..c7792d5 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,11 @@ Creates Munin graphs from the data delivered from an attached TEMPer USB Thermom For data collection the `pcsensor` utility is needed (by default it resides in */usr/local/bin/*), it can be obtained in source or binary form from different places like [here](https://github.com/jeroensteenhuis/pcsensor). Script was tested with pcsensor version 1.0.1. +"USB disconnect, device number X" +--------------------------------- + +If you are querying your TEMPerV1.4 device periodically every 5 minutes (I assume), it disconnects from USB bus every 85 minutes (or every ~17 queries) and is instantly reconnected and detected by the kernel. This script compensates this by a retry after a second after a failed invocation of `pcsensor`. + Install ------- diff --git a/pcsensor b/pcsensor index 55d3c17..1c6f66e 100755 --- a/pcsensor +++ b/pcsensor @@ -18,6 +18,10 @@ if [ "${1}" = "config" ]; then echo "temp.label temperatue" echo "temp.type GAUGE" else - echo -n "temp.value " - ${PCSENSOR} -cm | head -n1 + TEMP=`${PCSENSOR} -cm` + if [[ $? != 0 ]]; then + sleep 1 + TEMP=`${PCSENSOR} -cm` + fi + echo "temp.value $TEMP" fi