From 6742608de4eba1688ad769be1d7549ecd3b304be Mon Sep 17 00:00:00 2001 From: hjelev Date: Sun, 5 Feb 2023 15:42:44 +0200 Subject: [PATCH] update readme --- README.md | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 031b668..f1f38b7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Raspberry Pi MQTT Monitor - ![GitHub release (latest by date)](https://img.shields.io/github/v/release/hjelev/rpi-mqtt-monitor) ![GitHub repo size](https://img.shields.io/github/repo-size/hjelev/rpi-mqtt-monitor) ![GitHub issues](https://img.shields.io/github/issues/hjelev/rpi-mqtt-monitor) ![GitHub closed issues](https://img.shields.io/github/issues-closed/hjelev/rpi-mqtt-monitor) ![GitHub language count](https://img.shields.io/github/languages/count/hjelev/rpi-mqtt-monitor) ![GitHub top language](https://img.shields.io/github/languages/top/hjelev/rpi-mqtt-monitor) + ![GitHub release (latest by date)](https://img.shields.io/github/v/release/hjelev/rpi-mqtt-monitor) ![GitHub repo size](https://img.shields.io/github/repo-size/hjelev/rpi-mqtt-monitor) ![GitHub issues](https://img.shields.io/github/issues/hjelev/rpi-mqtt-monitor) ![GitHub closed issues](https://img.shields.io/github/issues-closed/hjelev/rpi-mqtt-monitor) ![GitHub language count](https://img.shields.io/github/languages/count/hjelev/rpi-mqtt-monitor) ![GitHub top language](https://img.shields.io/github/languages/top/hjelev/rpi-mqtt-monitor) The easiest way to track your Raspberry PI or Ubuntu computer system health and performance with Home Assistant. @@ -9,7 +9,7 @@ Monitor: cpu load, cpu temperature, free space, used memory, swap usage, uptime, Raspberry Pi MQTT Monitor supports discovery messages so no manuall configuration in [Home Assistant](https://www.home-assistant.io/) configuration.yaml is needed. You can install it with just one command from shell. - + Configurable: You can select what is monitored and how the message is sned (separetely or as a bulk csv message) # Installation @@ -21,9 +21,11 @@ Run this command to use the automated installation: ```bash bash <(curl -s https://raw.githubusercontent.com/hjelev/rpi-mqtt-monitor/master/remote_install.sh) ``` + Raspberry Pi MQTT monitor will be intalled in the location where the installer is called, inside a folder named rpi-mqtt-monitor. The auto-installer needs the software below and will install it if its not found: + * python (2 or 3) * python-pip * git @@ -33,27 +35,37 @@ Only python is not automatically installed, the rest of the dependancies should It will also help you configure the host and credentials for the mqtt server in config.py and create the cronjob configuration for you. ## Manual + If you don't like the automated installation here are manuall installation instructions: 1. Install pip if you don't have it: + ```bash -$ sudo apt install python-pip +sudo apt install python-pip ``` + 2. Then install this python module needed for the script: + ```bash -$ pip3 install paho-mqtt +pip3 install paho-mqtt ``` + 3. Install git if you don't have it: + ```bash -$ apt install git +apt install git ``` + 4. Clone the repository: + ```bash -$ git clone https://github.com/hjelev/rpi-mqtt-monitor.git +git clone https://github.com/hjelev/rpi-mqtt-monitor.git ``` + 5. Rename ```src/config.py.example``` to ```src/config.py``` ## Configuration + (only needed for manual installation) Populate the variables for MQTT host, user, password and main topic in ```src/config.py```. @@ -93,16 +105,21 @@ The group message looks like this: ## Test Raspberry Pi MQTT Monitor Run Raspberry Pi MQTT Monitor (you might need to update the path in the command below, depending on where you installled it) + ```bash -$ /usr/bin/python3 /home/pi/rpi-mqtt-monitor/rpi-cpu2mqtt.py +/usr/bin/python3 /home/pi/rpi-mqtt-monitor/rpi-cpu2mqtt.py ``` + Once you run Raspberry Pi MQTT monitor there will be no output if it run OK, but you should get 8 or more messages via the configured MQTT server (the messages count depends on your configuration). ## Schedule Raspberry Pi MQTT Monitor execution + Create a cron entry like this (you might need to update the path in the cron entry below, depending on where you installed it): + ``` */2 * * * * /usr/bin/python /home/pi/rpi-mqtt-monitor/rpi-cpu2mqtt.py ``` + ## Home Assistant Integration ![Rapsberry Pi MQTT monitor in Home Assistant](images/rpi-cpu2mqtt-hass.jpg) @@ -111,6 +128,7 @@ Once you installed the script on your raspberry you need to create some sensors If you are using ```discovery_messages```, then this step is not required as a new MQTT device will be automatically created in Home Assistant and all you need to do is add it to a dashboard. This is the sensors configuration if ```group_messages = True``` assuming your sensors are separated in ```sensors.yaml``` file. + ```yaml - platform: mqtt name: 'rpi4 cpu load' @@ -174,6 +192,7 @@ This is the sensors configuration if ```group_messages = True``` assuming your s ``` This is the sensors configuration if ```group_messages = False``` assuming your sensors are separated in ```sensors.yaml``` file. + ```yaml - platform: mqtt state_topic: "masoko/rpi4/cpuload" @@ -269,7 +288,9 @@ entities: ``` # To Do -- maybe add network traffic monitoring via some third party software (for now I can't find a way to do it without additional software) -# Feature request: -If you want to suggest a new feature or improvement don't hesitate to open an issue or pull request. \ No newline at end of file +- maybe add network traffic monitoring via some third party software (for now I can't find a way to do it without additional software) + +# Feature request + +If you want to suggest a new feature or improvement don't hesitate to open an issue or pull request.