A small script that is capable of reading the Lunatico AAG Cloud Watcher weather station data, including the anemometer.
Clone the repository and then run either:
python setup.py install
pip install -r requirements.txt pip install -e .
scripts/read-aag.py file is responsible for reading the serial data from the AAG. It requires
a config file in order to properly read from the AAG, with default values provided by
If you require any values to change (for instance the
serial_address or the threshold values), then
you can copy the config file to another location and specify it on the command line.
➜ scripts/read-aag.py --help usage: read-aag.py [-h] --config-file CONFIG_FILE [--store-result] [--db-file DB_FILE] [--db-table DB_TABLE] [--serial-address SERIAL_ADDRESS] [--verbose] Read an AAG CloudWatcher optional arguments: -h, --help show this help message and exit --config-file CONFIG_FILE Config file that contains the AAG params. --store-result If data entries should be saved to db, default False. --db-file DB_FILE Name of sqlite3 db file to use. --db-table DB_TABLE Name of db table to use. --serial-address SERIAL_ADDRESS USB serial address to use. If None, value from config will be used. --verbose Output data on the command line.
Serve AAG data
⚠️NOTE: There has been no attempt made to make this secure and Flask runs the development server out of the box. This is suitable for testing and a minimal network implementation but should never be used on an unsecure network (aren't they all?) and never in a "production" environment. Use at your own risk.
A minimal flask server is included with the repository that can be used to serve the latest results over the network.
The flask server provides two endpoints:
/latest.json: This will serve the latest weather records returned as JSON. By default will only return the most recent record, but
num_records=5can be used to return more records.
/download-db: Will send the
weather.dbas a file attachment for downloading.
Configure Flask Server
The Flask server uses
python-dotenv for configuration. To configure, create a
in the main directory and add the absolute path to the database file. If a relative path
is given then the
latest.json endpoint will still work but the database will not be available
If you would like to make the server available at your public IP address, add the host to
.env file, e.g.:
⚠️ 🐉 ⚠️Use at your own risk.
Running Flask Server
The Flask server uses the Flask command line interface. To start, run the following from the root of the repository: