# About
Inspired by some DIY projects, this script allows you to quickly discern weather conditions by
changing the colors of LEDs to reflect the current METAR information. You will need a Raspberry
Pi, some WS281X LEDs, and the four letter designators of the airports you are interested in.
This code assumes you've connected to GPIO 18 (PWM0) and have added `blacklist snd_bcm2835` to the
`/etc/modprobe.d/snd-blacklist.conf` file.
Don't want to DIY it? This is the code that powers the
[Aviation Weather Maps](https://aviationweathermaps.com) products. Enjoy a premade product, or
continue reading and happy tinkering!
# Install
```
sudo su
apt install python3-venv python3-dev
python3 -m venv /opt/rpi_metar
source /opt/rpi_metar/bin/activate
pip install wheel
pip install rpi_metar
```
# Configuration
You need to tell `rpi_metar` which LEDs correspond to which airports. You may do this by
creating the `/etc/rpi_metar.conf` file. There must be an `[airports]` section where the airport
codes are assigned to LEDs. For example:
```
[airports]
KDEN = 0
KBOS = 1
```
The LED indexes can be skipped and do not need to be continuous. If you don't have an LED
associated with an airport, it does not need to be entered.
Airports may also be repeated at different indexes, though to enable this the keys must be unique:
```
# this displays KDEN at both 3 and 45
[airports]
KDEN1 = 3
KDEN2 = 45
```
The behavior of the program can be tweaked by including a `settings` section in the configuration
file. These configuration values can be set:
| Option | Default | Description |
|--------------------|---------|-----------------------------------------------------------------|
| brightness | 128 | An integer (from 0 to 255) controlling the intensity of the LEDs appear. In a well lit room, 75 or 85 are recommended. In a bright room, try 128. |
| disable_gamma | False | A boolean that will allow you to disable the gamma correction. You may need this if using LEDs from different manufacturers / batches in a single run. |
| do_fade | True | A boolean controlling whether or not stations will fade into their new color during a transition. If `False`, they will just abruptly change colors. |
| lightning | True | A boolean that controls if thunderstorm conditions should be visually indicated. They will appear as short blinks of white before going back to the station's original color. |
| lightning_duration | 1.0 | A float controlling how long a station blinks white before returning to its original color. |
| max_wind | 30 | An integer that sets the threshold for max wind speed in knots. Any steady or gusting winds above this value will result in yellow blinking lights. |
| metar_refresh_rate | 300 | An integer that controls how frequently (in seconds) the METAR information is polled. |
| sources | NOAA,NOAABackup,SkyVector | The data sources to be used. A comma separated list of class names from the sources.py file. `BOM` is another source for Australian stations. `IFIS` is a source for New Zealand stations that requires further configuration.|
| wind | True | A boolean that controls if high wind speeds should be visually indicated. They will appear as short blinks of yellow before going back to the station's original color. |
| wind_duration | 1.0 | A float controlling how long a station blinks yellow before returning to its original color. |
| unknown_off | True | A boolean that controls whether or not stations that are not reporting data will just turn off. If set to `False`, after three attempts (during which time they appear as yellow), they will instead turn to orange. |
For example, to reduce the brightness of the LEDs:
```
[settings]
brightness = 85
```
Another feature includes setting up a legend. These are a series of lights that will always
display their assigned static color. Similar to setting up the airports by LED index, you can
assign flight categories to LED indexes:
```
[legend]
VFR = 10
IFR = 11
LIFR = 12
MVFR = 13
WIND = 14
LIGHTNING = 15
UNKNOWN = 16
OFF = 17
MISSING = 18
```
For the `IFIS` data source, credentials are required for logging into the service. They may be provided thusly:
```
[ifis]
username = your_username
password = your_password
```
The colors of the LEDs themselves along with their association to flight categories / behaviors can also be
modified. To adjust individual colors, a 3-int tuple can be provided in GRB format:
```
[colors]
GREEN = (250, 0, 0) # Overriding a default color value.
NAVY_BLUE = (22, 22, 22) # A new value, not overriding a default.
```
Then, if you wanted to associate these new color definitions to behaviors, you can do the following:
```
[flight_categories]
LIFR = NAVY_BLUE # LIFR will now show as (22, 22, 22)
IFR = (66, 66, 66) # You can also just provide a new 3-int tuple without having given it a name.
```
Though not explicitly listed in that `flight_categories` section, since VFR defaults to GREEN, it will
now be displayed using our modified `(250, 0, 0)` parameters.
# Autostart
Create the `/etc/systemd/system/rpi_metar.service` file with the following contents:
```
[Unit]
Description=METAR Display
Wants=network-online.target
After=network.target network-online.target
[Service]
ExecStart=/opt/rpi_metar/bin/rpi_metar
User=root
Group=root
Restart=always
[Install]
WantedBy=multi-user.target
```
Make systemd aware of the changes:
```
systemctl daemon-reload
```
Make sure it's set to run at boot:
```
systemctl enable rpi_metar
```
Start the service:
```
systemctl start rpi_metar
```
Raw data
{
"_id": null,
"home_page": "https://github.com/ScottSturdivant/rpi_metar",
"name": "rpi-metar",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3",
"maintainer_email": "",
"keywords": "METAR,Raspberry Pi",
"author": "Scott Sturdivant",
"author_email": "scott.sturdivant@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/12/09/d67bef455d043fbe184ab8e60a5a388c057e242ce0d570c062ccff0cb912/rpi_metar-0.4.2.tar.gz",
"platform": null,
"description": "# About\n\nInspired by some DIY projects, this script allows you to quickly discern weather conditions by\nchanging the colors of LEDs to reflect the current METAR information. You will need a Raspberry\nPi, some WS281X LEDs, and the four letter designators of the airports you are interested in.\n\nThis code assumes you've connected to GPIO 18 (PWM0) and have added `blacklist snd_bcm2835` to the\n`/etc/modprobe.d/snd-blacklist.conf` file.\n\nDon't want to DIY it? This is the code that powers the\n[Aviation Weather Maps](https://aviationweathermaps.com) products. Enjoy a premade product, or\ncontinue reading and happy tinkering!\n\n# Install\n\n```\nsudo su\napt install python3-venv python3-dev\npython3 -m venv /opt/rpi_metar\nsource /opt/rpi_metar/bin/activate\npip install wheel\npip install rpi_metar\n```\n\n# Configuration\n\nYou need to tell `rpi_metar` which LEDs correspond to which airports. You may do this by\ncreating the `/etc/rpi_metar.conf` file. There must be an `[airports]` section where the airport\ncodes are assigned to LEDs. For example:\n\n```\n[airports]\nKDEN = 0\nKBOS = 1\n```\n\nThe LED indexes can be skipped and do not need to be continuous. If you don't have an LED\nassociated with an airport, it does not need to be entered.\n\nAirports may also be repeated at different indexes, though to enable this the keys must be unique:\n\n```\n# this displays KDEN at both 3 and 45\n[airports]\nKDEN1 = 3\nKDEN2 = 45\n```\n\nThe behavior of the program can be tweaked by including a `settings` section in the configuration\nfile. These configuration values can be set:\n\n| Option | Default | Description |\n|--------------------|---------|-----------------------------------------------------------------|\n| brightness | 128 | An integer (from 0 to 255) controlling the intensity of the LEDs appear. In a well lit room, 75 or 85 are recommended. In a bright room, try 128. |\n| disable_gamma | False | A boolean that will allow you to disable the gamma correction. You may need this if using LEDs from different manufacturers / batches in a single run. |\n| do_fade | True | A boolean controlling whether or not stations will fade into their new color during a transition. If `False`, they will just abruptly change colors. |\n| lightning | True | A boolean that controls if thunderstorm conditions should be visually indicated. They will appear as short blinks of white before going back to the station's original color. |\n| lightning_duration | 1.0 | A float controlling how long a station blinks white before returning to its original color. |\n| max_wind | 30 | An integer that sets the threshold for max wind speed in knots. Any steady or gusting winds above this value will result in yellow blinking lights. |\n| metar_refresh_rate | 300 | An integer that controls how frequently (in seconds) the METAR information is polled. |\n| sources | NOAA,NOAABackup,SkyVector | The data sources to be used. A comma separated list of class names from the sources.py file. `BOM` is another source for Australian stations. `IFIS` is a source for New Zealand stations that requires further configuration.|\n| wind | True | A boolean that controls if high wind speeds should be visually indicated. They will appear as short blinks of yellow before going back to the station's original color. |\n| wind_duration | 1.0 | A float controlling how long a station blinks yellow before returning to its original color. |\n| unknown_off | True | A boolean that controls whether or not stations that are not reporting data will just turn off. If set to `False`, after three attempts (during which time they appear as yellow), they will instead turn to orange. |\n\nFor example, to reduce the brightness of the LEDs:\n\n```\n[settings]\nbrightness = 85\n```\n\nAnother feature includes setting up a legend. These are a series of lights that will always\ndisplay their assigned static color. Similar to setting up the airports by LED index, you can\nassign flight categories to LED indexes:\n\n```\n[legend]\nVFR = 10\nIFR = 11\nLIFR = 12\nMVFR = 13\nWIND = 14\nLIGHTNING = 15\nUNKNOWN = 16\nOFF = 17\nMISSING = 18\n```\n\nFor the `IFIS` data source, credentials are required for logging into the service. They may be provided thusly:\n\n```\n[ifis]\nusername = your_username\npassword = your_password\n```\n\nThe colors of the LEDs themselves along with their association to flight categories / behaviors can also be\nmodified. To adjust individual colors, a 3-int tuple can be provided in GRB format:\n\n```\n[colors]\nGREEN = (250, 0, 0) # Overriding a default color value.\nNAVY_BLUE = (22, 22, 22) # A new value, not overriding a default.\n```\n\nThen, if you wanted to associate these new color definitions to behaviors, you can do the following:\n\n```\n[flight_categories]\nLIFR = NAVY_BLUE # LIFR will now show as (22, 22, 22)\nIFR = (66, 66, 66) # You can also just provide a new 3-int tuple without having given it a name.\n```\n\nThough not explicitly listed in that `flight_categories` section, since VFR defaults to GREEN, it will\nnow be displayed using our modified `(250, 0, 0)` parameters.\n\n# Autostart\n\nCreate the `/etc/systemd/system/rpi_metar.service` file with the following contents:\n\n```\n[Unit]\nDescription=METAR Display\nWants=network-online.target\nAfter=network.target network-online.target\n\n[Service]\nExecStart=/opt/rpi_metar/bin/rpi_metar\nUser=root\nGroup=root\nRestart=always\n\n[Install]\nWantedBy=multi-user.target\n```\n\nMake systemd aware of the changes:\n\n```\nsystemctl daemon-reload\n```\n\nMake sure it's set to run at boot:\n\n```\nsystemctl enable rpi_metar\n```\n\nStart the service:\n\n```\nsystemctl start rpi_metar\n```",
"bugtrack_url": null,
"license": "MIT",
"summary": "Visualizing METAR data on a Raspberry Pi with LEDs.",
"version": "0.4.2",
"project_urls": {
"Homepage": "https://github.com/ScottSturdivant/rpi_metar"
},
"split_keywords": [
"metar",
"raspberry pi"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1209d67bef455d043fbe184ab8e60a5a388c057e242ce0d570c062ccff0cb912",
"md5": "db1393b696c9cb0e4de55212d8c861fb",
"sha256": "93bee0e821fb0f8d6de4752bd1194f637ed11420956215b48316eb2d8449dac8"
},
"downloads": -1,
"filename": "rpi_metar-0.4.2.tar.gz",
"has_sig": false,
"md5_digest": "db1393b696c9cb0e4de55212d8c861fb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3",
"size": 360198,
"upload_time": "2023-10-26T02:54:52",
"upload_time_iso_8601": "2023-10-26T02:54:52.222502Z",
"url": "https://files.pythonhosted.org/packages/12/09/d67bef455d043fbe184ab8e60a5a388c057e242ce0d570c062ccff0cb912/rpi_metar-0.4.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-26 02:54:52",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ScottSturdivant",
"github_project": "rpi_metar",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "rpi-metar"
}