用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中优雅地处理FileNotFoundexception   java线程卡在BlockingQueue上。无缘无故   类网格程序w/java   StrutsJava:动态应用Velocity脚本   java在运行时重写/禁用方面   java Apache POI无法正确读取Excel单元格中的秒数   具有不同用户权限的Java文件夹/文件创建   java我可以检查Firebase ValueEventListener onDataChanged是否已被调用吗?   尽管获得了用户权限,java Android开发文件权限仍被拒绝   java如何使用JPA映射map<EnumType,Double>?   java是否使用UI线程显示toast消息?   JAVAlang.IllegalArgumentException:不支持的元素:rss   java Android setRequestedOrientation活动和视图生命周期   安卓如何在Java中定义支票盒?   在Java中,对于大输入,字符串解析长期失败   使Java在XP中按计划任务运行读取env用户变量时出现问题   任务“:workflowsjava:NodeDriver”的梯度执行失败。main()   java如何检测是否只设置了部分属性?   在客户端web服务上使用JBossWS时,java无法找到/更改log4j的默认配置   java LibGDX写入文本文件并接收各种错误