Difference between revisions of "User talk:Emil"
(→Changes to hive.sh) |
|||
Line 1: | Line 1: | ||
== Changes to hive.sh == | == Changes to hive.sh == | ||
− | + | == Changes to hive.sh == | |
Line 7: | Line 7: | ||
- Set "LC_NUMERIC" so it works in other country settings than US, the only error is printf output to hivetool.log file | - 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 | - Get TEMPER2 to work | ||
− | |||
- Check for wrong readings specially from DHT22 | - Check for wrong readings specially from DHT22 | ||
Line 15: | Line 13: | ||
export LC_NUMERIC="en_US.UTF-8" | export LC_NUMERIC="en_US.UTF-8" | ||
# Get the date and time | # Get the date and time | ||
+ | # | ||
+ | DATE=`date +"%Y-%m-%d %H:%M:%S"` | ||
− | Get TEMPER2 to work | + | |
+ | == Get TEMPER2 to work | ||
+ | == | ||
Line 56: | Line 58: | ||
− | |||
+ | |||
+ | == Check for wrong temp readings | ||
+ | == | ||
if [ $HIVE_TEMP != "NULL" ] | if [ $HIVE_TEMP != "NULL" ] | ||
Line 87: | Line 91: | ||
− | TEMPER2 outside settings | + | |
+ | == TEMPER2 outside settings | ||
+ | == | ||
+ | |||
# Read outside temp and humidity | # Read outside temp and humidity | ||
Line 123: | Line 130: | ||
− | Ambient temp checking | + | == Ambient temp checking |
+ | == | ||
+ | |||
if [ "$AMBIENT_TEMP" != "NULL" ] | if [ "$AMBIENT_TEMP" != "NULL" ] | ||
Line 151: | Line 160: | ||
then | then | ||
AMBIENT_HUMIDITY="NULL" | AMBIENT_HUMIDITY="NULL" | ||
− | fi | + | fi |
Revision as of 13:23, 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