用led在树莓pi上可视化metar数据。

rpi-metar的Python项目详细描述


关于

受一些DIY项目的启发,这个脚本允许您快速识别 通过改变LED的颜色来反映当前的天气状况 元信息。你需要一个覆盆子PI,一些WS281X发光二极管,和 你感兴趣的机场的四个字母的标志。

此代码假定您已连接到gpio 18(pwm0)并已添加 blacklist snd_bcm2835/etc/modprobe.d/snd-blacklist.conf 文件。

不想自己动手做吗?这是驱动Aviation Weather Maps产品的代码。享受一份早餐 产品,还是继续阅读和快乐修补!

安装

sudo su
apt install python3-venv
python3 -m venv /opt/rpi_metar
source /opt/rpi_metar/bin/activate
pip install rpi_metar

配置

您需要告诉rpi_metar哪些LED对应于哪些机场。 您可以通过创建/etc/rpi_metar.conf文件来完成此操作。一定有 是机场代码分配给的[airports]部分 发光二极管。例如:

[airports]
KDEN = 0
KBOS = 1

LED索引可以跳过,不需要连续。如果你 没有与机场相关联的LED,不需要 进入。

程序的行为可以通过包含^{tt6}来调整$ 配置文件中的节。这些配置值可以是 设置:

OptionDefaultDescription
brightness128An 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_gammaFalseA 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_fadeTrueA boolean controlling whether or not stations will fade into their new color during a transition. If ^{tt7}$, they will just abruptly change colors.
lightningTrueA 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_dura tion1.0A float controlling how long a station blinks white before returning to its original color.
max_wind30An 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_rate5An integer that controls how frequently (in minutes) the METAR information is polled.
papertrailTrueA boolean controlling if logs are sent to a centralized system. Only METAR information and processing results are logged.
windTrueA 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_duration1.0A float controlling how long a station blinks yellow before returning to its original color.
unknown_offTrueA boolean that controls whether or not stations that are not reporting data will just turn off. If set to ^{tt7}$, after three attempts (during which time they appear as yellow), they will instead turn to orange.

例如,要降低LED的亮度:

[settings]
brightness = 85

自动启动

使用创建/etc/systemd/system/rpi_metar.service文件 以下内容:

[Unit]
Description=METAR Display

[Service]
ExecStart=/opt/rpi_metar/bin/rpi_metar
User=root
Group=root
Restart=always

[Install]
WantedBy=multi-user.target

使systemd知道这些更改:

systemctl daemon-reload

确保设置为在启动时运行:

systemctl enable rpi_metar

启动服务:

systemctl start rpi_metar

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
Java中是否有数字的默认类型   java调用一个类的方法来使用另一个类的实例   java HtmlUnit不适用于javascript处理   java需要帮助才能连接MongoDB   java如何从Maven中的src/main/resources复制文件?   java保存Int值(共享首选项)   从另一个类调用方法时,java Autowired组件出现空指针异常   java Spring JPA:PropertyAccessException 1:。。。MethodInvocationException:。'driverClassName'。。。org/postgresql/Driver:不支持的专业。次要版本52.0   java使用增强的JDO模型类在Eclipse中运行Junit测试   java如何使用eclipse IDE为junit创建可运行的jar文件   java如何在安卓中检测应用程序的启动和退出   java在其他线程可以访问静态映射时从数据库更新静态映射   java@Entitty和@EntityScan不起作用。我正在使用SpringBoot和jpa存储库,发生了很多次   java如何与google日历集成?