AWS-X GSM weather station daemon
Python
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
LICENSE
README
awsxd.1
awsxd.conf.sample
awsxd.py
table_structure.sql
tests.txt

README

Dependencies:
- Python (tested with v2.6)
- MySQL interface for python (python-mysqldb on debian, MySQL-python on Fedora/Red Hat) 

Installation:
1) Setup a database and proper privileges for it (awsxd needs INSERT-rights)
2) Initialize the awsx table using the supplied scheme (table_layout.sql).
	
	mysql -u YOUR_USER -p YOUR_PASSWORD YOUR_DATABASE < table_layout.sql

3) Edit the awsxd config (awsxd.conf) to reflect your database settings. There is an
example config file included called awsxd.conf.sample.

4) Start the AWS-X deamon

	awsxd.py -h <listen_ip> -p <listen_port>

5) Configure your AWS-X weather station to transmit packets to your host. Check
the manual for details: 
	
	http://www.dpspro.com/docs/pdf/awx_1v1_en.pdf
	
The TCS OS (which runs on the AWS-X motherboard) also lists a few commands:
	
	http://www.dpspro.com/tcs_commands/tcsos_list.html

All configuration is carried out through SMS to your device. Short summary:

    Configure APN:
    --------------
    This will configure the APN (Access Point Name) which is an operator-specific
    setting. Contact your mobile operator for details.

    #PWD<6-digit-password>#APN<apn>#
    Example: #PWD123456#APNonline.telia.se# (set APN to online.telia.com)

    Configure packet destination:
    -----------------------------
    It's important that you zeropad your IP, so it's always xxx.yyy.zzz.vvv, for
    example 8.8.8.8 should be 008.008.008.008.

    #PWD<6-digit-password>#UIP<listen_ip>:<listen_port>#
    Example: #PWD123456#UIP083.168.059.029:9999# (transmit to 83.168.59.29:9999)

    Configure sample interval:
    --------------------------
    #PWD<6-digit-password>#DSI<1-60 minutes>
    Example: #PWD123456#DSI10	(sample every 10 minutes)

    Configure transmission interval:
    --------------------------------
    #PWD<6-digit-password>#LGG<1-60 minutes>#
    This should always be equal or bigger than the sample interval
    Example: #PWD123456#LGG10	(transmit every 10 minutes)

    Configure windspeed measurement unit:
    -------------------------------------
    #PWD<6-digit-password>#SWU<unit>#
    Where <unit> is a number 0-3; 0=Km/h, 1=Mph, 2=Knots, 3=m/s
    Example: #PWD123456#SWU3#

6) (Optional) It is also possible to specify a callback file which is executed
each time new data arrives on the socket. This is useful if you want to generate
output from the data without polling the database on a regular basis. 
The application is called with the relevant station name as its command line 
argument, so you can choose to only update content for that station.

Example:
awsxd.py -c mycallback.sh

mycallback.sh:
#!/bin/sh
echo "Station $* just sent us new data .. "

7) (Optional) If you want to chain all received packets to another host, you may
enable the awsxd packet replication support. When enabled, awsxd will replicate
all valid (verified) packets, package it into a new UDP packet and send it to a
host of your choice. Invalid packets will be discarded.

This feature is useful because the AWS-X station itself only supports
transmission to a single host. If multiple systems contend for the sensor data,
the only way to share is by opening up your MySQL database. This is not
recommended as clients must rely on polling to detect new samples. It is also
not recommended to expose your MySQL instance to the public network.

Instead it is recommended to run multiple instances of awsxd, possibly on
different machines and networks, which each maintain a database of samples. This
is possible using the packet replication feature.

As packet replication also functions locally on a single machine, it may be used
to logically separate two systems and feed them individually. This is useful if
you want to run both your prototype and production environment with live data.

Example:
awsxd.py -r myhost.com:9405