Python守护进程,从psutil获取信息到mqtt代理以集成Home Assistant。
项目描述
ps2mqtt
Python守护进程,从psutil获取信息到mqtt代理以集成Home Assistant。
安装
您可以从PyPI安装ps2mqtt
$ pip install ps2mqtt
如果您希望通过systemd运行ps2mqtt,请从本存储库下载ps2mqtt.service文件,并根据您的系统进行编辑。
然后将文件复制到systemd路径,并在启动前启用该服务
$ sudo cp ps2mqtt.service /etc/systemd/system/
$ sudo systemctl enable ps2mqtt.service 
$ systemctl start ps2mqtt.service 
选项
ps2mqtt有几个命令行选项,您应该在自定义ps2mqtt.service时使用它们
  -h, --help                                  show this help message and exit
  --config CONFIG                             configuration file, will be created if non existing
  --period PERIOD                             updates period in seconds
  --mqtt-server MQTT_SERVER                   MQTT server
  --mqtt-port MQTT_PORT                       MQTT port
  --mqtt-username MQTT_USERNAME               MQTT username
  --mqtt-password MQTT_PASSWORD               MQTT password
  --mqtt-base-topic MQTT_BASE_TOPIC           MQTT base topic
  --ha-discover-prefix HA_DISCOVER_PREFIX     HA discover mqtt prefix
  --ha-status-topic HA_STATUS_TOPIC           HA status mqtt topic
您还可以将所有选项存储在一个文件中,只需运行所有选项加上--config /etc/ps2mqtt.yaml即可将所有参数存储在配置文件中。下次运行时,只需使用--config /etc/ps2mqtt.yaml。