Difference between revisions of "User talk:Emil"

From HiveTool
Jump to: navigation, search
(Undo revision 2148 by Emil (talk))
(Changes to hive.sh)
Line 6: Line 6:
 
Have found some changes that should be done in 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
+
- Set "LC_NUMERIC" so it works in other country settings than US, the only error is printf output to hivetool.log file<br>
- Get TEMPER2 to work
+
- Get TEMPER2 to work<br>
- Check for wrong readings specially from DHT22
+
- Check for wrong readings specially from DHT22<br>
  
 
# Set LC_NUMERIC to US so printf works
 
# Set LC_NUMERIC to US so printf works

Revision as of 13:27, 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

  1. Set LC_NUMERIC to US so printf works

export LC_NUMERIC="en_US.UTF-8"

  1. 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

  1. 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

  1. 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

==


  1. 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

  1. 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

  1. 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