通用显示服务器-从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第三方库


热门话题
关于JSP转发的java问题   强制Oracle驱动程序向java输出带有时区的时间戳。sql。使用getObject时的时间戳   Java中的配置单元UDF在创建表时失败   eclipse怀疑Java上下文加载器使用不再存在的文件   范围如何为我没有在JavaEE中编写的类定义单例对象?   java Eclipse未启动:JVM已终止。退出代码=14   仅存在于子类中的属性的java别名(Hibernate标准)   Java字符串插入错误   无法打开java@PropertySource,因为它不存在   java从多项目Maven配置生成WAR文件   java Hibernate@Lob注释不再有效:不能用几个字符串超过CLOB的总长度?   java jbutton的鼠标侦听器包含if/else循环阻塞的jvm?   java如何删除最近24小时安卓的通话记录   java Android服务+计数器不工作   java如何获取返回结果的服务器的数据,我希望将该结果更新到另一台服务器   java从javax获得“一切”是可能的。命名。初始上下文?   java Spring云门请求超时不适用于路径   java web应用程序会话缓存   java使用dialogflow的响应通过google助手打开我的应用程序   MongoDB添加createAt updatedAt字段java