Hivetool 0.7.3 Bug Reports

24 posts / 0 new
Last post
Adrian
Hivetool 0.7.3 Bug Reports

The new 0.7.3 rev 3-3-16 release of Hivetool has a problem in the default local host graphics trend when trending inside hive temperature;
http://localhost/hive_stats4wDownload.pl?chart=Temperature&new_hive_id=
displays in-hive temperature increasing numbers until the value exceeds the size limit of the field.
The local database contains a null value for temperature, no sensor temp turned on in config.pl
The hivestats3 graphic displays 32 degrees so it won't crash.
The trend pens display do not work, I am using the html download feature to see the values.
Perhaps set the local display link back to hivestats3 which seems to work?
Adrian

Emil
Emil's picture
Upgrade info

Should there be a section in the new image install, about how to upgrade from earlier versions? I think it just contains taking care of hive.conf and maybe database, but it should be mentioned.

Paul
Paul's picture
Upgrade instruction

For the hivetool code, I think hive.conf and the sqlite database (hivetool_raw.db) needs to be saved. BUT, if the database schema has changed, then there may need to be a conversion script to import the old data into the new schema.

Adrian
Sortware Upgrade Option

Emil,
One option for upgrading, (my current preference) not actually an upgrade so much as a new install, is to burn the latest image to a new 16 gig micro SD card, keeping the working one as a spare and source of reference. The new 0.7.3 image is so different with two user interface options and at the moment two databases it might be difficult to list all the steps. Eventually an online github upgrade initiated from the Pi may be possible. This all assumes you have the hive interface board with recommended sensors, sensors are now selected using drop down menus.

Adrian Ogden

Adrian
Hivetool 0.7.3 Bug Reports

Hivetool intermittently logging erroneous temperature & humidity data, results in crashed trend objects when attempting to view.
Request filter to discriminate erroneous readings from database.

Adrian Ogden

Adrian
Hivetool 'Control' 0.7.3 Bug Reports, feature requests

'Control' user interface unable to read DHT22 sensors, TSL2591 lux, Pi Camera code possibly inoperative. Need instructions to access web pages, desktop shortcut.

Adrian Ogden

Emil
Emil's picture
Hivetool 0.7.3 bugs

I have installed and set my hive online today. But what I found out of problems is the following:
crontab need to run sudo to read the DHT22 and TSL2591 sensors, I have changed it to the following:
.../usr/bin/sudo /home/hivetool/hive.sh
Maybe I'm not understanding the sloop and Intercept , but I had to change the Intercept to 0 in config.pl and change the 0 in the end of COUNT to my Intercept in hx711.sh (line 19).
The local database dont work, In hivetool.log I get the message "Error: near ",": syntax error" when inserting to local database.
Can anyone change my bad weight reading from 1000 to 0?

Emil
Emil's picture
crontab setup

I have taking a look at the software image details and it seems that the crontab entries have been set up for the pi user and not root with sudo.
To fix the crontab setup, do a crontab -e and comment out the lines, and do a new sudo crontab -e and put in the lines there.
Still having problem with local database

wwfoste
Hivetool 0.7.3 and Raspberry A+ boot issues

This is from email’s with Paul and Adrian, and they asked me to put it on the forum.

I’m working on getting the Hivetool program loaded onto my Pi A+ but have an issue with the software loading. I downloaded the 0.7.3 version and got it loaded onto my SDHC fine, but when I plug in the Pi, it runs through the boot cycle but at the end when it says auto login where it should open to the OS interface, it goes blank and won’t take any interaction. The MD5 sum is correct and on mine it appears to get all passes on the boot. It worked for Adrian, but Paul recreated the issue with an error message at the end that goes blank before he can read it.

Based upon advice from my brother-in-law, I think I’m going to make a bootable Linux USB drive or use Fuse (Mac) or DiskInternals (Windows) to review the system logs. I will report back if I get that to work.

Overall hardware involved is the Pi A+, and SanDisk 16 GB SDHC, a Belkin USB port, and a HDMI plugged into a TV as the monitor. Also have the Edimax wifi dongle, USB keyboard, and USB mouse. I have USB to micro-USB cables and a serial to USB cable if needed.

Paul
Paul's picture
GPU ram allocation

OK, I think this may be the problem (or at least one problem).
The 0.7.3 image has the GPU/CPU memory split set to 256 Meg for the GPU. This
was done to stream video.

I had to look it up, but according to Wikipedia, the Pi memory for different models is:
256 MB model A, A+, B rev 1
512 MB model B rev 2, B+, CM, Zero
1 GB Pi 2, Pi 3

Using raspi-config (command line is 9. Advanced Features->Memory Split), I set the GPU memory to 64 MB and it boots OK.
You can go as low as 16 or 32 GB.

The problem was it was continuously swapping (thrashing) and the system appeared (or really was) frozen .

I haven't tested all functionality (I need to plug in a USB hub), but it seems to work.
How this can be modified without booting the image on a B+ or 2 Pi, I am not sure.

OK, here is how:
https://www.raspberrypi.org/documentation/configuration/config-txt.md

You need to edit /boot/config.txt and change GPU_MEM=256 to 16 32 or 64.

BUT, using GPU_MEM_256, GPU_MEM_512, and GPU_MEM_1024, we can make the GPU/CPU mem split different for different memory sizes.

wwfoste
GPU Ram Allocation fixed

I don’t have another Pi, but I was able to edit the config.txt file and change the line to GPU_MEM=64 on my MacBook. That allowed the interface to come up after a pause. I don’t follow this part though "BUT, using GPU_MEM_256, GPU_MEM_512, and GPU_MEM_1024, we can make the GPU/CPU mem split different for different memory sizes.”

Is there something more I need to do? If not, thanks for the help.

It sounds like if decide to add a camera I will need to upgrade to a B+ or better.

wwfoste
How to update config.txt file on MacBook Pro

To edit the config.txt file, I just went to Disk Utility -> Debug -> Show All Partitions. This allows you to see the hidden files on the SDHC. Then I went and found the config file and changed the GPU_MEM number at the bottom.

Emil
Emil's picture
Local database

It seems that the local database import fails because the BATTERY_VOLTAGE is not set (maybe unless using hive2.sh?)
After putting in the following line in hive.sh (new line 26) it seems to add the entrys in local database
BATTERY_VOLTAGE=0
The error message "The local database dont work, In hivetool.log I get the message "Error: near ",": syntax error" when inserting to local database" disappear

There is also some strange things in database HIVE_DATA, it seems that it hasn't been made with some manually added items
Query used to create this table
CREATE TABLE "HIVE_DATA" ( `row_id` int(11) DEFAULT NULL, `hive_id` int(11) NOT NULL, `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `hive_observation_time_local` datetime DEFAULT NULL, `hive_observation_time_utc` datetime DEFAULT NULL, `hive_weight_lbs` decimal(5,2) DEFAULT NULL, `hive_weight_lbs_delta` decimal(5,2) DEFAULT NULL, `hive_weight_lbs_delta_daily` decimal(5,2) DEFAULT NULL, `hive_weight_lbs_filtered` decimal(5,2) DEFAULT NULL, `hive_manipulation_change_lbs` decimal(5,2) DEFAULT NULL, `hive_weight_kgs` decimal(5,2) DEFAULT NULL, `hive_weight_kgs_delta` decimal(5,2) DEFAULT NULL, `hive_weight_kgs_delta_daily` decimal(5,2) DEFAULT NULL, `hive_weight_kgs_filtered` decimal(5,2) DEFAULT NULL, `hive_manipulation_change_kgs` decimal(5,2) DEFAULT NULL, `hive_temp_f` decimal(4,1) DEFAULT NULL, `hive_temp_c` decimal(4,1) DEFAULT NULL, `hive_humidity` decimal(4,1) DEFAULT NULL, `ambient_temp_f` decimal(4,1) DEFAULT NULL, `ambient_temp_c` decimal(4,1) DEFAULT NULL, `ambient_humidity` decimal(4,1) DEFAULT NULL, `ambient_luminance` int(11) DEFAULT NULL, `ambient_precip_in` int(11) DEFAULT NULL, `wx_station_id` char(40) DEFAULT NULL, `wx_observation_time_rfc822` datetime DEFAULT NULL, `wx_temp_f` decimal(4,1) DEFAULT NULL, `wx_temp_c` decimal(4,1) DEFAULT NULL, `wx_relative_humidity` decimal(4,1) DEFAULT NULL, `wx_wind_dir` char(6) DEFAULT NULL, `wx_wind_degrees` decimal(4,1) DEFAULT NULL, `wx_wind_mph` decimal(4,1) DEFAULT NULL, `wx_wind_gust_mph` decimal(4,1) DEFAULT NULL, `wx_pressure_mb` decimal(5,1) DEFAULT NULL, `wx_pressure_in` decimal(4,1) DEFAULT NULL, `wx_dewpoint_f` decimal(4,1) DEFAULT NULL, `wx_dewpoint_c` decimal(4,1) DEFAULT NULL, `wx_solar_radiation` decimal(4,1) DEFAULT NULL, `wx_precip_1hr_in` decimal(5,2) DEFAULT NULL, `wx_precip_1hr_metric` decimal(5,2) DEFAULT NULL, `wx_precip_today_in` decimal(5,2) DEFAULT NULL, `wx_precip_today_metric` decimal(5,2) DEFAULT NULL, `quality` int(2) NOT NULL DEFAULT '5', 'HIVE_BATTERY_VOLTAGE' NUMERIC, PRIMARY KEY (`hive_observation_time_local`) )
Query used to create this table

and not with the script in create_hivetool_sqlite.sql
CREATE TABLE "HIVE_DATA" ( `row_id` int(11) DEFAULT NULL, `hive_id` int(11) NOT NULL, `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `hive_observation_time_local` datetime DEFAULT NULL, `hive_observation_time_utc` datetime DEFAULT NULL, `hive_weight_lbs` decimal(5,2) DEFAULT NULL, `hive_weight_lbs_delta` decimal(5,2) DEFAULT NULL, `hive_weight_lbs_delta_daily` decimal(5,2) DEFAULT NULL, `hive_weight_lbs_filtered` decimal(5,2) DEFAULT NULL, `hive_manipulation_change_lbs` decimal(5,2) DEFAULT NULL, `hive_weight_kgs` decimal(5,2) DEFAULT NULL, `hive_weight_kgs_delta` decimal(5,2) DEFAULT NULL, `hive_weight_kgs_delta_daily` decimal(5,2) DEFAULT NULL, `hive_weight_kgs_filtered` decimal(5,2) DEFAULT NULL, `hive_manipulation_change_kgs` decimal(5,2) DEFAULT NULL, `hive_temp_f` decimal(4,1) DEFAULT NULL, `hive_temp_c` decimal(4,1) DEFAULT NULL, `hive_humidity` decimal(4,1) DEFAULT NULL, `hive_battery_voltage` decimal(5,2) DEFAULT NULL, `ambient_temp_f` decimal(4,1) DEFAULT NULL, `ambient_temp_c` decimal(4,1) DEFAULT NULL, `ambient_humidity` decimal(4,1) DEFAULT NULL, `ambient_luminance` int(11) DEFAULT NULL, `ambient_precip_in` int(11) DEFAULT NULL, `wx_station_id` char(40) DEFAULT NULL, `wx_observation_time_rfc822` datetime DEFAULT NULL, `wx_temp_f` decimal(4,1) DEFAULT NULL, `wx_temp_c` decimal(4,1) DEFAULT NULL, `wx_relative_humidity` decimal(4,1) DEFAULT NULL, `wx_wind_dir` char(6) DEFAULT NULL, `wx_wind_degrees` decimal(4,1) DEFAULT NULL, `wx_wind_mph` decimal(4,1) DEFAULT NULL, `wx_wind_gust_mph` decimal(4,1) DEFAULT NULL, `wx_pressure_mb` decimal(5,1) DEFAULT NULL, `wx_pressure_in` decimal(4,1) DEFAULT NULL, `wx_dewpoint_f` decimal(4,1) DEFAULT NULL, `wx_dewpoint_c` decimal(4,1) DEFAULT NULL, `wx_solar_radiation` decimal(4,1) DEFAULT NULL, `wx_precip_1hr_in` decimal(5,2) DEFAULT NULL, `wx_precip_1hr_metric` decimal(5,2) DEFAULT NULL, `wx_precip_today_in` decimal(5,2) DEFAULT NULL, `wx_precip_today_metric` decimal(5,2) DEFAULT NULL, `quality` int(2) NOT NULL DEFAULT '5', PRIMARY KEY (`hive_observation_time_local`) )

The problem with high measurement items seems to be much better when using NASA filter (haven't used this before),

Emil
Emil's picture
Problem with bad readings from DHT22

After installing 0.7.3 I have had several bad readings from DHT22. I think this comes from the thing we have discussed before with too small gap between each reading. I have run the 0.7.2 with a sleep 5 between each readings, and almost have had none bad readings for several months. After installing 0.7.3 the faulty readings comes again. I now put in a sleep 2 in hive.sh after the first and last DHT22 reading. Will check again tomorrow whats happens.

DHT22)
TEMPerHUM=$(nice --20 /usr/local/bin/Seeed_DHT22 $HIVE_TEMP_DEV S)
set -- junk $TEMPerHUM
shift
HIVE_TEMP=$1
HIVE_HUMIDITY=$2
sleep 2
;;

DHT22)
TEMPerHUM=$(nice --20 /usr/local/bin/Seeed_DHT22 $AMBIENT_TEMP_DEV S)
set -- junk $TEMPerHUM
shift
AMBIENT_TEMP=$1
AMBIENT_HUMIDITY=$2
sleep 2
;;

Paul
Paul's picture
YES!!! Thank you.

I thought we (you) had this problem solved. I forgot to put the fix in. Maybe because I don't understand way it works.

Also, I want to add a shell script named dht22.sh that is called from hive.sh that will sanity check the values and will sleep 5 seconds and retry up to 5 or 10 times like temper.sh does.

Thanks! Adrian will be most appreciative.

Nate
Nate's picture
Upgrade Info

I know there was mention a while ago about starting to use Github, but nothing came of it -

From a non-programmer standpoint... the current method of having to re-download and reconfigure everything does not seem like a sustainable way to manage the application. In addition, having no code management process is going to make maintaining a good code base nearly impossible if more than one developer is actually working on code.

I've got my next raspberry pi 3 sitting waiting on my desk to be my second hivetool... just waiting for a couple of these bugs to be worked out

Much like Paul taking some significant time to setup these forums to better facilitate communications, I think it would make sense to take the time to setup a github site and work through setting up the online upgrade capability along with the ability for multiple users to easily contribute to the code. I say all that without actually knowing anything about getting it setup, so it may be a more difficult task that I'm imagining.

Emil
Emil's picture
DHT22 still having problems

I still have problems with bad readings so I now just have imported the DHT22 readings that I had in 0.7.2, hope tis works.
Have attached the hive.sh as hive.txt
This is the code I have been using for a long time that have been working OK. Maybe someone can rewrite it so it's easier.

Image: 
File: 
Nate
Nate's picture
Temp Sanity Check

Isn't there already a sanity check in the code for temp? I don't fully understand all of the syntax, but... If that is the intention.... I don't think it's working. It looks like he's reporting a temp of 1832F

if [ $HIVE_TEMP != "NULL" ]
then
HIVE_TEMP=`echo "scale=2; (($HIVE_TEMP*$HIVE_TEMP_SLOPE)+$HIVE_TEMP_INTERCEPT)" | bc`
# Check for totally wrong temp
if [ `echo $HIVE_TEMP | cut -d. -f1` -lt -40 ]
then
TEMPOK=0
elif [ `echo $HIVE_TEMP | cut -d. -f1` -gt 80 ]
then
TEMPOK=0
else
TEMPOK=1
fi
fi

Paul
Paul's picture
Where did this code come from?

Hey Nate, Where did you get the above code? It doesn't look familiar.

Emil
Emil's picture
Temp and Humidity sanity check

This check is new and included by me, the old code is just the 5 lines commented out after DHT22)
# TEMPerHUM=$(nice --20 /usr/local/bin/Seeed_DHT22 $HIVE_TEMP_DEV S)
# set -- junk $TEMPerHUM
# shift
# HIVE_TEMP=$1
# HIVE_HUMIDITY=$2
It checks for extreme high or low temperature and humidity

You can also see my changes for battery in line 26, This does so the local database works.

The other thing I have done is:
- intercept (see reply 6), this is a workaround and needs to be fixed. But it works for now

$ crontab -l
copy the last 5 lines
$ sudo crontab -e
paste the 5 lines to the bottom, and remove # from the hive.sh line

Good luck with your Pi3

Paul
Paul's picture
My fix for DHT22 readings

First, I created a new shell script, dht22.sh, based on temperhum.sh which has been working. It will retry about 10 times, increasing the delay between reads each time.

#!/bin/bash
# read the dht22

while getopts d: option
do
case "${option}"
in
d) DEVICE=${OPTARG};;
esac
done

DATA_GOOD=0
COUNTER=1
while [ $COUNTER -lt 11 ] && [ $DATA_GOOD -eq 0 ]
do
DATE2=`date +"%Y/%m/%d %H:%M:%S"`
TEMPerHUM=$(nice --20 /usr/local/bin/Seeed_DHT22 $DEVICE S)
echo -ne "$DATE2 $COUNTER $? $TEMPerHUM \n" >> /home/hivetool/dht22.log

if [[ -n $TEMPerHUM ]]
then
set -- junk $TEMPerHUM
shift
TEMP=$1
HUMIDITY=$2

HUMIDITY_TEST=`echo "$HUMIDITY < 0" | bc` # These limits should be user configurable
HUMIDITY_TEST2=`echo "$HUMIDITY > 120" | bc`
TEMP_TEST=`echo "$TEMP > -40" | bc`
TEMP_TEST2=`echo "$TEMP < 65" | bc`

if [ $HUMIDITY_TEST -eq 0 ] && [ $HUMIDITY_TEST2 -eq 0 ] && [ $TEMP_TEST -ne 0 ] && [ $TEMP_TEST2 -ne 0 ]
then
DATA_GOOD=1
else
HUMIDITY="NULL"
TMEP="NULL"
fi
fi
let "COUNTER += 1"
sleep $COUNTER
done

if [[ $COUNTER -gt 11 ]]
then
echo "$DATE2 ERROR reading $DEVICE" >> /home/hivetool/error.log
fi

if test $COUNTER -gt 2
then
echo "$DATE WARNING reading $DEVICE: retried $COUNTER" >> /home/hivetool/error.log
fi

echo $TEMP $HUMIDITY

Then I modified the TEMP/RH section of hive.sh (this must be done 2 places, for inside and outside:

#
# Read temp and humidity inside hive
#
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
;;
DHT22)
TEMPerHUM=$(/home/hivetool/dht22.sh -d $HIVE_TEMP_DEV)
set -- junk $TEMPerHUM
shift
HIVE_TEMP=$1
HIVE_HUMIDITY=$2
sleep 4 # fixes a weirdness with bad readings when reading 2 DHT22's in a row. (only necessary if 2 DHT22s installed).
# this should be moved to between the Read temp and humidity inside hive and outside hive
# and made conditional on both $HIVE_TEMP_SENSOR and $AMBIENT_TEMP_SENSOR both DHT22s
;;
*)
HIVE_TEMP="NULL"
HIVE_HUMIDITY="NULL"
;;
esac

Nate
Nate's picture
Is this in the posted image?

Hi Paul, I corrupted my running hivetool - so I guess it's time to start over. I was trying to get my raspberry PI camera working and managed to screw up the web server.

Is this code to fix the DHT22 readings in the posted image, or should I wait for a while to download?

Is the posted version stable and ready to use, or are there issues with it that need to be worked out?

Emil
Emil's picture
Battery voltage check

There is a comment in the release notes for 0.7.3 that battery voltage is supported, but as you see there seems to be a missing entry in hive.sh, but is there a README for how to use the battery check and how to calibrate the output?

Paul
Paul's picture
Reading battery voltage

In /home/downloads/hx711 there is code to read channel B of the HX711:

An executable: hx711wp_chanB and the source code: hx711wp_chanB.c

hx711wp means it is hx711 code that uses the Wiring Pi libraries and _chanB means it reads channel B in stead of the hx711wp code which reads channel A.

Calibration is similar to the weight. Get the counts for two different voltages (could be 0 and 12 or 8 and 14) and the calculate the slope and intercept.

It looks like 0.7.4 is coming soon and I will try to hook that up.

Log in to post comments