https://github.com/scaytrase/vgencmd-mqtt-publisher
Gather stats with vgencmd and publish them to the MQTT
https://github.com/scaytrase/vgencmd-mqtt-publisher
home-assistant monitoring mqtt raspberry raspberry-pi raspberrypi vcgencmd
Last synced: about 2 months ago
JSON representation
Gather stats with vgencmd and publish them to the MQTT
- Host: GitHub
- URL: https://github.com/scaytrase/vgencmd-mqtt-publisher
- Owner: scaytrase
- License: mit
- Created: 2022-11-10T22:09:36.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-03-06T00:23:48.000Z (over 2 years ago)
- Last Synced: 2025-02-14T04:48:05.302Z (4 months ago)
- Topics: home-assistant, monitoring, mqtt, raspberry, raspberry-pi, raspberrypi, vcgencmd
- Language: Python
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vgencmd-mqtt-publisher
Gather stats with vgencmd and publish them to the MQTT in Home Assistant compatible format# Installation
1. Checkout
2. `pip install -r requirements.txt`
3. ```ln -s `pwd`/publisher.py /usr/bin/mqtt-sensors```
4. `cp mqtt-sensors.service /etc/systemd/system/mqtt-sensors.service`
5. `systemctl edit mqtt-sensors.service````
[Service]
Environment="TZ=Europe/Moscow"
Environment="MQTT_HOST=mqtt.local"
Environment="MQTT_PORT=1883"
Environment="MQTT_USER="
Environment="MQTT_PASS="
Environment="DEVICE_NAME=st-node-3"
Environment="WAIT_TIME_SECONDS=15"
Environment="TRACKED_MOUNTS=root:/;docker:/docker"
```6. `systemctl enable mqtt-sensors.service`
7. `systemctl start mqtt-sensors.service`
8. Enjoy# Testing
You can modify `publisher.py` and test it without messing with systemctl first
1. Put you envs into `test.env` file
```
TZ=Europe/Moscow
MQTT_HOST=mqtt.local
MQTT_PORT=1883
MQTT_USER=
MQTT_PASS=
DEVICE_NAME=st-node-3
WAIT_TIME_SECONDS=15
TRACKED_MOUNTS=root:/;docker:/docker
```
2. Run `test.sh`# Screenshots
Script uploads values according to default HA settings in order to create entity around given host

# Credits
Based on gist https://gist.github.com/Sennevds/1ff538ba80978810019af3d5da92118f by @Sennevds
# Other thougts
Tried to make it a docker container, but failed. A ton of volumes is required for container to properly monitor host stats, also there is a trouble getting vcgencmd command working in python:3-alpine or python:3-slim images