diff --git a/README.md b/README.md index c9ebfa5..eda7840 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,8 @@ # Rapsberry Pi MQTT monitor -Python 2 script to check cpu load, cpu temperature, free space, voltage and system clock speed +Python script to check cpu load, cpu temperature, free space, voltage and system clock speed on a Raspberry Pi computer and publish the data to a MQTT server. -I wrote this so I can monitor my raspberries at home with home assistant. The script is writen for python 2 -as when I wrote it one of the used python modules was not available for python 3. (if the modules are available for python 3 now the script shuold have no problems running on python 3 - plan to check that in the near feature) +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 4 seconds as there are 4 one second sleeps in the code - due to mqtt have problems if I shoot the messages with no delay. # Installation: @@ -26,6 +25,36 @@ Create a cron entry like this (you might need to update the path on the cron ent */2 * * * * /usr/bin/python /home/pi/scripts/rpi-cpu2mqtt.py -Home Assistant Integration +# Home Assistant Integration -![Rapsberry Pi MQTT monitor in Home Assistant](images/rpi-cpu2mqtt-hass.jpg) \ No newline at end of file +![Rapsberry Pi MQTT monitor in Home Assistant](images/rpi-cpu2mqtt-hass.jpg) + +Once you installed the script on your raspberry you need to create some sensors in home assistant. + +This is the sensors configuration assuming your sensors are separated in sensors.yaml file. +```yaml + - platform: mqtt + state_topic: "masoko/rpi4/cpuload" + name: rpi 4 cpu load + unit_of_measurement: "%" + + - platform: mqtt + state_topic: "masoko/rpi4/cputemp" + name: rpi 4 cpu temp + unit_of_measurement: "°C" + + - platform: mqtt + state_topic: "masoko/rpi4/diskusage" + name: rpi 4 diskusage + unit_of_measurement: "%" + + - platform: mqtt + state_topic: "masoko/rpi4/voltage" + name: rpi 4 voltage + unit_of_measurement: "V" + + - platform: mqtt + state_topic: "masoko/rpi4/sys_clock_speed" + name: rpi 4 sys clock speed + unit_of_measurement: "hz" +``` \ No newline at end of file diff --git a/images/rpi-cpu2mqtt-hass.jpg b/images/rpi-cpu2mqtt-hass.jpg index 4f4a941..87966f7 100644 Binary files a/images/rpi-cpu2mqtt-hass.jpg and b/images/rpi-cpu2mqtt-hass.jpg differ