Meteostick readout with Linux shellscripts

All about the cool new device that can read RF data directly from Davis® weather stations

Moderator: Mattk

Post Reply
CFJH
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: Sat Oct 22, 2016 6:39 pm

Meteostick readout with Linux shellscripts

Post by CFJH » Thu Oct 27, 2016 11:38 pm

Hello,

I've a meteostock and want to read it out with plain Linux shellscripts to integrate it in my own software.

My current way ist ro read the data for five minutes in a plain text file,then start an new file and process the previous file. I use an init-script to initialisze the /dev/ttyUSB device, then initialisize the meteostick and al least start the read out.

the init-script looks like

Code: Select all

stty 115200 cs8 -parenb -crtscts -cstopb -echo -F /dev/meteostick

sleep 5
echo -e "t2" >/dev/meteostick
sleep 2
echo -e "o1" >/dev/meteostick
sleep 1
echo -e "m1" >/dev/meteostick
sleep 1
The read-script is

Code: Select all

# read
datetime=`date "+%Y%m%d%H%M"`
myTTY="/dev/meteostick"
myLOG="meteostick.txt"
myDATA="meteostick.dat"
cd /home/cfjh/projects/wst/meteostick/
killall cat
mv $myDATA meteostick$datetime.txt
sleep 1
./setup.sh &
cat <$myTTY | awk '{print strftime("%Y%m%d%H%M%S"),$1,$2,$3,$4,$5 | "tee -a $myLOG" ; }' >$myDATA
# cat $myTTY > $myLOG
The awk-stuff is to generate a timestamp to reach line in the text file.
The read script ist started every 5 minutes via cron.

My problem is, that I'm getting some 'unknown commands' and lots of empty lines in the output and can't get the reason why.

An output example

Code: Select all

20160826203504 # MeteoStick Version 2.3b1 (Apr
20160826203504
20160826203504 # License Information:
20160826203504
20160826203504 # MeteoStick (c) 2014-2015 by
20160826203504
20160826203504 ?
20160826203504
20160826203504 # Meteostick Version 2.3b1
20160826203504
20160826203507 t2
20160826203507
20160826203507 # listening to transmitter 2
20160826203507
20160826203507
20160826203507
20160826203507 # unknown command[
20160826203507
20160826203509 o1
20160826203509
20160826203509 # output computed values
20160826203509
20160826203509
20160826203509
20160826203509 # unknown command
20160826203509
20160826203510 m1
20160826203510
20160826203510 # chip authentication ok: 14
20160826203510
20160826203510 # frequency band 868MHz (EU)
20160826203510
20160826203510 B 30.0 1010.21
20160826203510
20160826203510
20160826203510
20160826203510 # unknown command
20160826203510
20160826203517 L 2 1 0 -56
20160826203517
20160826203520 L 2 2 0 -56
20160826203520
20160826203522 O 2 1 28.1 -57
20160826203522
20160826203525 O 2 2 27.1 -56
20160826203525
20160826203533 L 2 1 0 -56
Question: Why are the 'unknown command' and empty lines are generated ?

Jürgen

Post Reply