通用显示服务器-从mqtt获取值并将结果图像发布到mqtt。
Nikippe的Python项目详细描述
对于用户
安装
核心功能的先决条件是:
sudo apt install python3 python3-pip python-pil sudo pip3 install pelops
通过PIP安装:
sudo pip3 install nikippe
要更新到最新版本,请在 pip3 上面的行。
通过Gitlab安装(可能需要其他软件包):
git clone git@gitlab.com:pelops/nikippe.git cd nikippe sudo python3 setup.py install
这将安装以下shell脚本:* nikippe - 将服务器显示为已注册的shell脚本。
脚本cli参数是:*'-c'/'-config'-config文件 (必需)*'-v'-详细输出(可选)*'-版本'-显示 版本号并退出
yaml配置示例
一个yaml文件必须包含两个根块:*mqtt-mqtt address, MQTT端口和凭据文件的路径凭据文件(文件 包含两个条目:mqtt user、mqtt password)*display server- nikippe应该将生成的图像发布到和更新的主题 行为。*renderer-渲染引擎和 应该显示的元素。
< div >所有元素的可选参数为:* 忽略可用的更新: false -如果存在并设置为true,则 元素不会tri获取更新。例如,您有一个时钟元素 每分钟更新一次,并显示最新收到的 对于MQTTTEXT元素,您可以将此参数设置为true。
配置yaml
配置文件由三个根节点组成:mqtt、display driver和 渲染器。####MQTT
mqtt: mqtt-address: localhost mqtt-port: 1883 credentials-file: ~/credentials.yaml
显示服务器
display-server:
topics-pub-image: /test/image # send image to the display driver
send-on-change: True # send new image to epaper if any element reports that it received an update
send-interval: 60 # seconds. if 0 interval is disabled.
前两个条目是epaper设备驱动程序的主题(请参见 copreus )监听。 更改时发送 和发送间隔 定义更新行为。
渲染器
renderer: width: 250 height: 122 background: ../resources/gui_background_2.13.png # optional background-color: 255 # from 0 to 255. elements:
所有元素的公共属性:
- name: [name] type: [element type] x: 0 # x position in image y: 10 # y position in image width: 242 # width of element height: 77 # height of element foreground-color: 0 # gray value - 0 is black, 255 is white background-color: 255 # gray value - 0 is black, 255 is white transparent-background: True # boolean / optional. If True, background-color will be treated as transparent active: False # if False, entry will be ignored
bar<P> < div >
示例栏
- name: current-humidity type: bar x: 5 y: 5 width: 20 height: 60 foreground-color: 0 background-color: 255 active: True border: True # if true, the whole bar will be surrounded by a single line in foreground-color. orientation: up # up, down, left, right topic-sub: /test/humidity # input value min-value: 5 # displayed bar % = (max(max-value, input) - min-value) / (max-value - min-value) max-value: 23 #
循环艺术
< div >示例循环图
- name: time-chart type: circularchart active: False topic-sub: /test/humidity width: 210 height: 60 x: 30 y: 5 foreground-color: 0 # from 0 to 255. background-color: 255 # from 0 to 255. border-top: False border-bottom: True border-left: True border-right: False connect-values: True # if true - values are connected with lines, other wise they are independent dots pixel-per-value: 2 # a new value/dot is drawn every n-th pixel on the x-axis. must be > 0. draw-cursor: True # draw a cursor at the current time slot time-span: Day # Week, Day, Hour, Minute history-service: group-by: 300 # in seconds. 0==no grouping aggregator: avg # aggregator for group-by. valid values: avg, min, max, median. can be omitted if group-by=0. use-dataservice: True # use the dataservice archippe to fill the chart with persisted data dataservice-request-topic-prefix: /dataservice/request dataservice-response-topic-prefix: /dataservice/response
数字时钟
< div >数字时钟示例
sudo apt install python3 python3-pip python-pil sudo pip3 install pelops0
图像列表
sudo apt install python3 python3-pip python-pil sudo pip3 install pelops1
mqttimage
< div >示例mqttimage