Compensate periodic USB disconnects of TEMPer

This commit is contained in:
cn 2014-12-30 18:01:19 +01:00
parent 71fd2c6c64
commit abc7c11732
2 changed files with 11 additions and 2 deletions

View File

@ -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
-------

View File

@ -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