Skip to main content

Weather service for the Lunatico AAG CloudWatcher.

Project description

PANOPTES AAG weather reader

codecov

Weather service for the Lunatico AAG CloudWatcher.

This is a simple weather service for the Lunatico AAG CloudWatcher. It is intended to be used with the aag-cloudwatcher.

There are two main components to this project:

  1. The aag-weather command line tool.
  2. FastAPI web service.

The aag-weather command line tool is used to read the weather data from the CloudWatcher and store it in a file.

The web service is used to serve the weather data to a web browser as json, which can be read by various tools. If using POCS you can use the pocs sensor monitor command to read the weather data continuously.

Installation

Install with pip:

pip install panoptes-aag

Or from a local repository:

git clone https://github.com/panoptes/aag-weather
cd aag-weather
pip install -e .

Usage

You can use either the aag-weather command line tool or the web service to read the weather data.

Web service

Starting

The web service can be run with the aag-weather command line tool:

aag-weather serve

The host and port can be specified with the --host and --port options.

Reading

POCS

If you are using POCS you can use the remote sensor utilities:

pocs sensor monitor weather --endpoint http://localhost:8080

:information_source: If you installed POCS via the install script then this is all managed for you.

Command line

The web service will serve the weather data as json. The data can be accessed by going to the /weather endpoint. For example, if the web service is running on localhost on port 8080 then the weather data can be accessed at http://localhost:8000/weather.

The httpie is installed with this package and can be used to read the weather data from the command line:

http :8080/weather

Command line

Starting

The aag-weather command line tool can be used to read the weather data from the CloudWatcher and store it in a file. The aag-weather command line tool can be run with:

aag-weather capture

See aag-weather capture --help for more options.

Reading

When the aag-weather command line tool is running it will write the weather data to a file. The default file is weather.csv in the current directory. You can change the format by specifying a different output file when capturing, for example:

aag-weather capture --output-file weather.json

Configuration

The aag-weather command line tool and web service are pydantic settings and can be configured with environment variables or a config.env file in the directory from which the command is run.

The environment variables are prepended with AAG_. The main configuration options are:

Environment variable Default Description
AAG_SERIAL_PORT /dev/ttyUSB0 The serial port to use to connect to the CloudWatcher.
AAG_SAFETY_DELAY 15 Minutes after an unsafe reading before the system is safe again.
AAG_CAPTURE_DELAY 30 Seconds between readings.
AAG_NUM_READINGS 10 Number of readings to use for averaging.
AAG_IGNORE_UNSAFE None None, otherwise can be a list, e.g. 'rain','cloud','gust','wind'

Additionally, you can set the thresholds options as well as options to control the heater. These options are "nested" and so use a double underscore (e.g. __) to separate the levels.

Environment variable Default Description
AAG_THRESHOLDS__CLOUDY -25 Difference between sky and ambient temperatures in Celsius.
AAG_THRESHOLDS__VERY_CLOUDY -15 Difference between sky and ambient temperatures in Celsius.
AAG_THRESHOLDS__WINDY 50 Wind speed in km/h.
AAG_THRESHOLDS__VERY_WINDY 75 Wind speed in km/h.
AAG_THRESHOLDS__GUSTY 100 Wind gust speed in km/h.
AAG_THRESHOLDS__VERY_GUSTY 125 Wind gust speed in km/h.
AAG_THRESHOLDS__WET 2200 Wetness in Ohms.
AAG_THRESHOLDS__RAINY 1800 Rain in Ohms.
AAG_HEATER__MIN_POWER 0 Minimum power to use for the heater.
AAG_HEATER__LOW_TEMP 0 Temperature in Celsius.
AAG_HEATER__LOW_DELTA 6 Difference between sky and ambient temperatures in Celsius.
AAG_HEATER__HIGH_TEMP 20 Temperature in Celsius.
AAG_HEATER__HIGH_DELTA 4 Difference between sky and ambient temperatures in Celsius.
AAG_HEATER__IMPULSE_TEMP 10 Temperature in Celsius.
AAG_HEATER__IMPULSE_DURATION 60 Duration in seconds.
AAG_HEATER__IMPULSE_CYCLE 600 Cycle in seconds.

Misc

This project has been set up using PyScaffold 4.4.1. For details and usage information on PyScaffold see https://pyscaffold.org/.

Project generated with PyScaffold

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

panoptes-aag-0.0.2.tar.gz (22.2 kB view details)

Uploaded Source

Built Distribution

panoptes_aag-0.0.2-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file panoptes-aag-0.0.2.tar.gz.

File metadata

  • Download URL: panoptes-aag-0.0.2.tar.gz
  • Upload date:
  • Size: 22.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for panoptes-aag-0.0.2.tar.gz
Algorithm Hash digest
SHA256 3282b91d7158c5e10d1aa45662a66d2c48d39f9dc50c7975267bcd120ab97f1e
MD5 bcfe59a3c115bd628b1dde63f15d6e72
BLAKE2b-256 82f99bb5ef8b4790e52288be3e84486207dc58055afec6959bee480bffec59ba

See more details on using hashes here.

File details

Details for the file panoptes_aag-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: panoptes_aag-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for panoptes_aag-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fae6e7c95bf9be9611e9e56f48e7b32e653924c2ac46d5bc231cecd6378e95dd
MD5 86167931639a07a2edb15b3f99a55d29
BLAKE2b-256 8734c0b075c24c7e1b62d3e1ff0acd47ebce6f0a3e80f6f2338c68c0dcc02622

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page