通用显示服务器-从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 >
每个元素必须至少具有以下参数:* 名称: 湿度表 -可自由选择的名称-不在内部使用 * 类型:图表 -元素类型。必须是[Bar,Circhart, 数字时钟,图像列表,MQTTIMAGE,MQTTTEXT,序列图, staticimage,statictext]* x:30 -在渲染图像中的位置 (上/左)* y:5 -在渲染图像中的位置(上/左)* 宽度:256 -元件尺寸* 高度:60 -元件尺寸 元素* 前景色: 0 -介于0(黑色)和255之间 (白色)。* 背景色: 255 -介于0(黑色)和255之间 (白色)。
* 活动:true -如果设置为false,则忽略此项。

所有元素的可选参数为:* 忽略可用的更新: 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 > Example Digital Clock

数字时钟示例

sudo apt install python3 python3-pip python-pil
sudo pip3 install pelops
0

图像列表

example imagelist clockexample imagelist dayExample ImageList Morning

sudo apt install python3 python3-pip python-pil
sudo pip3 install pelops
1

mqttimage

< div > example mqttimage

示例mqttimage

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

推荐PyPI第三方库


热门话题
java密钥适配器在JComponent中不工作   动态编程我试图在java中使用递归自顶向下DP实现TSP。逻辑是正确的,但答案不同   java当我在BundleActivator中注册Servlet而不使用web时,“TransportGuarrance”的等价物是什么。xml?   java膨胀视图与膨胀元素   用zxing从图像中检测二维码的java   使用GroupLayout将java组件呈现在彼此的顶部   Java Android:如何在一秒钟内添加15次数组?   tomcat无法查找java邮件会话的JNDI资源。无法连接到主机,端口:localhost,25;超时1;   spring如何使用org。springframework。网状物滤器CharacterEncodingFilter以更正字符编码?   数据集的java并发处理   爪哇反应堆:如何从标准丁烷中产生助焊剂?   java在本地运行storm NoClassDefFoundError   为用户定义的类使用setDate的数组。。JAVA   如何将节点附加到java中现有的XML文件中