Difference between revisions of "User talk:Emil"
(→Changes to hive.sh) |
(→Changes to hive.sh) |
||
Line 9: | Line 9: | ||
- Get TEMPER2 to work<br> | - Get TEMPER2 to work<br> | ||
- Check for wrong readings specially from DHT22<br> | - Check for wrong readings specially from DHT22<br> | ||
− | + | <pre> | |
# Set LC_NUMERIC to US so printf works | # Set LC_NUMERIC to US so printf works | ||
export LC_NUMERIC="en_US.UTF-8" | export LC_NUMERIC="en_US.UTF-8" | ||
Line 15: | Line 15: | ||
# | # | ||
DATE=`date +"%Y-%m-%d %H:%M:%S"` | DATE=`date +"%Y-%m-%d %H:%M:%S"` | ||
+ | </pre> | ||
− | + | Get TEMPER2 to work | |
− | + | <pre> | |
− | |||
− | |||
− | |||
− | |||
case "$HIVE_TEMP_SENSOR" in | case "$HIVE_TEMP_SENSOR" in | ||
TEMPerHUM) | TEMPerHUM) | ||
Line 56: | Line 53: | ||
;; | ;; | ||
esac | esac | ||
+ | </pre> | ||
− | + | Check for wrong temp readings | |
− | + | <pre> | |
− | |||
− | |||
− | |||
− | |||
if [ $HIVE_TEMP != "NULL" ] | if [ $HIVE_TEMP != "NULL" ] | ||
then | then | ||
Line 89: | Line 83: | ||
HIVE_HUMIDITY="NULL" | HIVE_HUMIDITY="NULL" | ||
fi | fi | ||
+ | </pre> | ||
− | + | TEMPER2 outside settings | |
− | + | <pre> | |
− | |||
− | |||
− | |||
− | |||
# Read outside temp and humidity | # Read outside temp and humidity | ||
# | # | ||
Line 128: | Line 119: | ||
;; | ;; | ||
esac | esac | ||
+ | </pre> | ||
− | + | Ambient temp checking | |
− | + | <pre> | |
− | |||
− | |||
− | |||
if [ "$AMBIENT_TEMP" != "NULL" ] | if [ "$AMBIENT_TEMP" != "NULL" ] | ||
then | then | ||
Line 161: | Line 150: | ||
AMBIENT_HUMIDITY="NULL" | AMBIENT_HUMIDITY="NULL" | ||
fi | fi | ||
+ | </pre> |
Revision as of 13:44, 5 January 2016
Changes to hive.sh
Changes to hive.sh
Have found some changes that should be done in hive.sh
- Set "LC_NUMERIC" so it works in other country settings than US, the only error is printf output to hivetool.log file
- Get TEMPER2 to work
- Check for wrong readings specially from DHT22
# Set LC_NUMERIC to US so printf works export LC_NUMERIC="en_US.UTF-8" # Get the date and time # DATE=`date +"%Y-%m-%d %H:%M:%S"`
Get TEMPER2 to work
case "$HIVE_TEMP_SENSOR" in TEMPerHUM) TEMPerHUM=$(/home/hivetool/temperhum.sh -d $HIVE_TEMP_DEV) set -- junk $TEMPerHUM shift HIVE_TEMP=$1 HIVE_HUMIDITY=$2 if [ -z "$HIVE_TEMP" ] then HIVE_TEMP="NULL" HIVE_HUMIDITY="NULL" fi # Check TEMPer2 /home/downloads/hidapi/hidtest/hidtest-hidraw | grep TEMPer2 > /dev/null if [ "$?" = "0" ] then AMBIENT_TEMP_SENSOR=TEMPER2 TEMPER2_TEMP=$HIVE_HUMIDITY HIVE_HUMIDITY="NULL" fi ;; DHT22) TEMPerHUM=$(nice --20 /usr/local/bin/Seeed_DHT22 $HIVE_TEMP_DEV S) set -- junk $TEMPerHUM shift HIVE_TEMP=$1 HIVE_HUMIDITY=$2 ;; *) HIVE_TEMP="NULL" HIVE_HUMIDITY="NULL" ;; esac
Check for wrong temp readings
if [ $HIVE_TEMP != "NULL" ] then HIVE_TEMP=`echo "scale=2; (($HIVE_TEMP*$HIVE_TEMP_SLOPE)+$HIVE_TEMP_INTERCEPT)" | bc` fi if [ $HIVE_HUMIDITY != "NULL" ] then HIVE_HUMIDITY=`echo "scale=2; (($HIVE_HUMIDITY*$HIVE_HUMIDITY_SLOPE)+$HIVE_HUMIDITY_INTERCEPT)" | bc` fi # Check for totally wrong temp if [ `echo $HIVE_TEMP | cut -d. -f1` -lt -50 ] then HIVE_TEMP="NULL" elif [ `echo $HIVE_TEMP | cut -d. -f1` -gt 100 ] then HIVE_TEMP="NULL" fi # Check for totally wrong Humidity if [ `echo $HIVE_HUMIDITY | cut -d. -f1` -lt -50 ] then HIVE_HUMIDITY="NULL" elif [ `echo $HIVE_HUMIDITY | cut -d. -f1` -gt 150 ] then HIVE_HUMIDITY="NULL" fi
TEMPER2 outside settings
# Read outside temp and humidity # case "$AMBIENT_TEMP_SENSOR" in TEMPerHUM) TEMPerHUM=$(/home/hivetool/temperhum.sh -d $AMBIENT_TEMP_DEV) set -- junk $TEMPerHUM shift AMBIENT_TEMP=$1 AMBIENT_HUMIDITY=$2 if [ -z "$AMBIENT_TEMP" ] then AMBIENT_TEMP="NULL" AMBIENT_HUMIDITY="NULL" fi ;; DHT22) TEMPerHUM=$(nice --20 /usr/local/bin/Seeed_DHT22 $AMBIENT_TEMP_DEV S) set -- junk $TEMPerHUM shift AMBIENT_TEMP=$1 AMBIENT_HUMIDITY=$2 ;; ''TEMPER2) AMBIENT_TEMP=$TEMPER2_TEMP AMBIENT_HUMIDITY="NULL" ;;'' *) AMBIENT_TEMP="NULL" AMBIENT_HUMIDITY="NULL" ;; esac
Ambient temp checking
if [ "$AMBIENT_TEMP" != "NULL" ] then AMBIENT_TEMP=`echo "scale=2; (($AMBIENT_TEMP*$AMBIENT_TEMP_SLOPE)+$AMBIENT_TEMP_INTERCEPT)" | bc` fi if [ $AMBIENT_HUMIDITY != "NULL" ] then AMBIENT_HUMIDITY=`echo "scale=2; (($AMBIENT_HUMIDITY*$AMBIENT_HUMIDITY_SLOPE)+$AMBIENT_HUMIDITY_INTERCEPT)" | bc` fi # Check for totally wrong temp if [ `echo $AMBIENT_TEMP | cut -d. -f1` -lt -50 ] then AMBIENT_TEMP="NULL" elif [ `echo $AMBIENT_TEMP | cut -d. -f1` -gt 100 ] then AMBIENT_TEMP="NULL" fi # Check for totally wrong Humidity if [ `echo $AMBIENT_HUMIDITY | cut -d. -f1` -lt -50 ] then AMBIENT_HUMIDITY="NULL" elif [ `echo $AMBIENT_HUMIDITY | cut -d. -f1` -gt 150 ] then AMBIENT_HUMIDITY="NULL" fi