home assistant sensors configuration
This commit is contained in:
39
README.md
39
README.md
@@ -1,9 +1,8 @@
|
|||||||
# Rapsberry Pi MQTT monitor
|
# 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.
|
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
|
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.
|
||||||
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)
|
|
||||||
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.
|
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:
|
# 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
|
*/2 * * * * /usr/bin/python /home/pi/scripts/rpi-cpu2mqtt.py
|
||||||
|
|
||||||
Home Assistant Integration
|
# Home Assistant Integration
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
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"
|
||||||
|
```
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 23 KiB |
Reference in New Issue
Block a user