update regarding group messages

This commit is contained in:
Hristo Jelev
2020-05-03 20:12:31 +03:00
parent 7d305c5908
commit bab814dd83

View File

@@ -1,13 +1,13 @@
# Rapsberry Pi MQTT monitor
Python script to check the cpu load, cpu temperature, free space, used memory, swap usage, voltage and system clock speed
on a Raspberry Pi computer and publish the data to a MQTT server.
on a Raspberry Pi computer and publish the data to a MQTT broker.
I wrote this so I can monitor my raspberries at home with [home assistant](https://www.home-assistant.io/). The script was written and tested on Python 2 but it should work fine on Python 3.
The script if very light, it takes 3 seconds as there are 5 half second sleeps in the code - due to mqtt haveing problems if I shoot the messages with no delay.
Each value measured by the script is send via a separate message for easier craetion of home assistant sensors.
Example message topic:
Example message topic if ```group_messages = False ```:
```
masoko/rpi4/cpuload
```
@@ -15,6 +15,19 @@ masoko/rpi4/cpuload
- second part (pi4) is the host name of the raspberry which is automatically pulled by the script, so you don't have to configure it for each installation (in case you have many raspberries like me).
- third part (cpuload) is the name of the value (these are all values published via MQTT - cpuload, cputemp, diskusage, voltage, sys_clock_speed).
Example message topic if ```group_messages = True ```:
```
masoko/rpi4
```
The csv message looks like this:
```csv
9.0, 43.0, 25, 25, 0.85, 1500, False, False
```
Disabled sensors are represented with False in the message.
# Installation
If you don't have pip installed: