GithubHelp home page GithubHelp logo

hjelev / rpi-mqtt-monitor Goto Github PK

View Code? Open in Web Editor NEW
166.0 10.0 41.0 1.65 MB

Raspberry Pi MQTT Monitor gathers system information and sends it to a MQTT server.

License: GNU General Public License v3.0

Python 82.92% Shell 17.08%
home-assistant homeassistant mqtt sensor monitoring monitoring-scripts monitoring-tool python

rpi-mqtt-monitor's Introduction

Raspberry Pi MQTT Monitor

GitHub release (latest by date) GitHub repo size GitHub issues GitHub closed issues GitHub language count GitHub top language

Raspberry Pi MQTT Monitor

The easiest way to track your Raspberry Pi or Ubuntu computer system health and performance in Home Assistant.

  • Start monitoring your system in just a few minutes.
  • Monitor: cpu load, cpu temperature, free space, used memory, swap usage, uptime, wifi signal quality, voltage and system clock speed.
  • Automatic HASS configuration: Supports discovery messages, so no manual configuration in Home Assistant configuration.yaml is needed.
  • Automated installation and configuration: you can install it and schedule it with a service or cron with just one command from shell.
  • Configurable: You can select what is monitored and how the message(s) is send (separately or as one csv message)
  • Easy update: You can update the script by calling it with command line argument --update

Table of Contents

What is new

  • 2024-03-24: --hass to display configuration for Home Assistant wake on lan switch
  • 2024-02-20: Shutdown button added (only works when running as service)
  • 2024-02-05: System Restart button added (only works when running as service)
  • 2024-01-28: Remote updates via Home Assistant are now available
  • 2024-01-28: Improved error handling for the MQTT connection
  • 2024-01-28: Script version is displayed in home assistant device information
  • 2024-01-28: Update the script by calling it with command line argument --update
  • 2024-01-27: Now you can run the script as a service (systemd) or as a cron job
  • 2024-01-27: Support for command line arguments
  • 2024-01-27: Added a binary sensor for github to monitor for new versions of the script
  • 2024-01-27: Updated the sensors names not to include the device name as per home assistant guidelines
  • 2024-01-10: Added support for Raspberry Pi 5 fan speed monitoring (only works on Raspberry Pi 5 with stock fan)

CLI arguments

usage: rpi-cpu2mqtt.py [-h] [--display] [--service] [--version] [--update]

options:
  -h, --help     show this help message and exit
  --display, -d  display values on screen
  --service, -s  run script as a service
  --version, -v  display version
  --update,  -u  update script and config
  --hass, -H     display Home assistant wake on lan configuration

Installation

Automated

Run this command to use the automated installation:

bash <(curl -s https://raw.githubusercontent.com/hjelev/rpi-mqtt-monitor/master/remote_install.sh)

Raspberry Pi MQTT monitor will be installed 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
  • paho-mqtt

Only python is not automatically installed, the rest of the dependencies should be handled by the auto installation. It will also help you configure the host and credentials for the mqtt server in config.py and create the service or cronjob configuration for you. It is recommended to run the script as a service, this way you can use the restart, shutdown and display control buttons in Home Assistant.

Manual

If you don't like the automated installation here are manual installation instructions (missing the creation of virtual environment).

  1. Install pip if you don't have it:
sudo apt install python-pip
  1. Then install this python module needed for the script:
pip install paho-mqtt==1.6.1
  1. Install git if you don't have it:
apt install git
  1. Clone the repository:
git clone https://github.com/hjelev/rpi-mqtt-monitor.git
  1. 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.

You can also choose what messages are sent and what is the delay (sleep_time is only used for multiple messages) between them. If you are sending a grouped message, and you want to delay the execution of the script you need to use the random_delay variable which is set to 1 by default. This is the default configuration (check the example file for more info):

random_delay = randrange(1)
discovery_messages = True
group_messages = False
sleep_time = 0.5
service_sleep_time = 120
cpu_load = True
cpu_temp = True
used_space = True
voltage = True
sys_clock_speed = True
swap = True
memory = True
uptime = True
uptime_seconds = False
wifi_signal = False
wifi_signal_dbm = False
rpi5_fan_speed = False
display_control = False
shutdown_button = True
restart_button = True

If discovery_messages is set to true, the script will send MQTT Discovery config messages which allows Home Assistant to automatically add the sensors without having to define them in configuration. Note, this setting is only available when group_messages is not used.

If group_messages is set to true the script will send just one message containing all values in CSV format. The group message looks like this:

1.3, 47.1, 12, 1.2, 600, nan, 14.1, 12, 50, -60

Test Raspberry Pi MQTT Monitor

Run Raspberry Pi MQTT Monitor (this will work only if you used the automated installer or created the shortcut manually)

rpi-mqtt-monitor -d

Once you run Raspberry Pi MQTT monitor you should see something like this:

:: rpi-mqtt-monitor
   Version: 0.9.1

:: Device Information
   Model Name:  Intel(R) Pentium(R) Silver J5040 CPU @ 2.00GHz
   Manufacturer:  GenuineIntel
   OS: Ubuntu 23.10
   Hostname: ubuntu-pc
   IP Address: 192.168.0.200
   MAC Address: A8-A1-59-82-57-E7
   Update Check Interval: 3600 seconds

:: Measured values
   CPU Load: 48.5 %
   CPU Temp: 71 °C
   Used Space: 12 %
   Voltage: False V
   CPU Clock Speed: False MHz
   Swap: False %
   Memory: 53 %
   Uptime: 0 days
   Wifi Signal: False %
   Wifi Signal dBm: False
   RPI5 Fan Speed: False RPM
   Update: {"installed_ver": "0.9.1", "new_ver": "0.9.1"}

Schedule Raspberry Pi MQTT Monitor execution as a service

If you want to run Raspberry Pi MQTT Monitor as a service you can use the provided service file. You need to edit the service file and update the path to the script and the user (if you want to use shutdown or restart buttons user needs to be root) that will run it. Then copy the service file to /etc/systemd/system/ and enable it:

sudo cp rpi-mqtt-monitor.service /etc/systemd/system/
sudo systemctl enable rpi-mqtt-monitor.service

To test that the service is working you can run:

sudo service rpi-mqtt-monitor start
sudo service rpi-mqtt-monitor status

Schedule Raspberry Pi MQTT Monitor execution with a cron

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 * * * * cd /home/pi/rpi-mqtt-monitor; /usr/bin/python /home/pi/rpi-mqtt-monitor/rpi-cpu2mqtt.py

How to update

Remote updates via Home Assistant are now available.

To use these you need to have the script running as a service. (the installer now supports this)

Manual update:

cd rpi-mqtt-monitor
python3 src/update.py

Home Assistant Integration

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.

Use '''python3 src/rpi-cpu2mqtt.py --hass''' to display the configuration for Home Assistant wake on lan switch.

moved to wiki

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.

rpi-mqtt-monitor's People

Contributors

ahti123 avatar cfenner avatar hjelev avatar j-broo avatar leaskovski avatar metheos avatar nivg1992 avatar olexs avatar pulpyyyy avatar randy3k avatar sunsided avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rpi-mqtt-monitor's Issues

Unable to get it work on Ubuntu Server

Linux raspberrypi4 5.19.0-1009-raspi #16-Ubuntu SMP PREEMPT Thu Nov 24 13:38:20 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux

``pi@raspberrypi4:~/rpi-mqtt-monitor/src$ /usr/bin/python3 /home/pi/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py
awk: cmd. line:1: (FILENAME=- FNR=1) fatal: division by zero attempted
Traceback (most recent call last):
File "/home/pi/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 318, in
swap = check_swap()
File "/home/pi/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 71, in check_swap
swap = round(float(swap.decode("utf-8").replace(",", ".")), 1)
ValueError: could not convert string to float: ''

Feature request: IP address sensor

Hi, thanks for a fantastic tool. I realise it's pretty much static data, but it would be great if the monitor were able to send the ipv4 and/or ipv6 address of the pi via MQTT.

Feature request: more information about disk

Hello and thank you for this wonderful project.

In my case I use it for my Raspberry Pi 4 with a USB M.2 SSD adapter.
Unfortunately, the hard drive in my setup seems to get quite hot, so I would be interested to know how hot.

Would this be possible?

You could also include further information, such as utilisation or a general indicator for the size of the hard drive.

This could also be interesting with the new Raspberry Pi 5, which supports PCIe and therefore allows even more hard drives to be connected to the Pi via PCIe.

Division by Zero

Tried both manually installing and using the script. Fails to run with a divide by zero error. Thoughts?

awk: cmd. line:1: (FILENAME=- FNR=3) fatal: division by zero attempted
Traceback (most recent call last):
File "/home//rpi-cpu2mqtt.py", line 249, in
swap = check_swap()
File "/home/
/rpi-cpu2mqtt.py", line 51, in check_swap
swap = round(float(swap.decode("utf-8").replace(",", ".")), 1)
ValueError: could not convert string to float: ''

DeprecationWarning: Callback API version 1 is deprecated

I get the following error:

(foobar) pi@meteotux:~/rpi-mqtt-monitor $ python3 /home/pi/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py -d

:: rpi-mqtt-monitor
   Version: 0.8.9

:: Device Information
   Model Name: Raspberry Pi 4 Model B Rev 1.2
   Manufacturer: Raspberry Pi
   OS: Debian GNU/Linux 12 (bookworm)
   Hostname: meteotux
   IP Address: 192.168.1.182
   MAC Address: DC-A6-32-6B-18-84
   Update Check Interval: 3600 seconds

:: Measured values
   CPU Load: 12.0 %
   CPU Temp: 57 °C
   Used Space: 56 %
   Voltage: False V
   CPU Clock Speed: False MHz
   Swap: False %
   Memory: 16 %
   Uptime: 0 days
   Wifi Signal: False %
   Wifi Signal dBm: False
   RPI5 Fan Speed: False RPM
   Update Available: {"installed_ver": "0.8.9", "new_ver": "0.8.9"}
    
/home/pi/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py:398: DeprecationWarning: Callback API version 1 is deprecated, update to latest version
  client = paho.Client(client_id="rpi-mqtt-monitor-" + hostname + str(int(time.time())))
MQTT error:  failed to receive on socket: [Errno 104] Connection reset by peer


Any help to this?

And also this makes no sense:
Update Available: {"installed_ver": "0.8.9", "new_ver": "0.8.9"}

check_memory fails if system language is different than EN

I had system messages in Polish (because I choose pl_PL during installation) and free is generating something like:

                razem       użyte       wolne    dzielone   buf/cache    dostępne
Pamięć:     944092      115280      185976        4816      642836      758460
Wymiana:      102396       34816       67580

And finally check_memory is not able to find what it's looking for.

I switched to en_GB (removing PL entirely) and it works.

Installed rpi-mqtt-monitor version: 0.9.3

ValueError: could not convert string to float: ''

When i try to let the the rpi-cpu2mqqt.py run i get the following error:

Traceback (most recent call last):
File "/root/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 730, in
gather_and_send_info()
File "/root/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 630, in gather_and_send_info
cpu_load, cpu_temp, used_space, voltage, sys_clock_speed, swap, memory, uptime_days, uptime_seconds, wifi_signal, wifi_signal_dbm, rpi5_fan_speed = collect_monitored_values()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 613, in collect_monitored_values
memory = check_memory()
^^^^^^^^^^^^^^
File "/root/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 84, in check_memory
memory = round(float(memory.decode("utf-8").replace(",", ".")))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: could not convert string to float: ''

Change uptime to timestamp

Can I suggest changing uptime, to a last boot timestamp. That way Home Assistant will automatically set the time formatting.
Like this:
image
image

Mqtt auto discovery parameters :

{
  "name": "Last Boot",
  "state_topic": "xxxx",
  "device_class": "timestamp",
  "value_template": "{{ as_datetime(value) }}",
  "unique_id": "xxxx",
   etc,
   etc
  }
}

Illegal discovery topic

rpi-monitor uses full hostname for the device name but according to the linked documentation, object_id (device) can contain only [a-zA-Z0-9_-]

[homeassistant.components.mqtt.discovery] Received message on illegal discovery topic 'homeassistant/sensor/rpi-MQTT-monitor/some.hostname.com_uptime_days/config'. The topic contains not allowed characters. For more information see https://www.home-assistant.io/integrations/mqtt/#discovery-topic

How to monitor externally mounted array

Hello, I use rpi as NAS and have raid0 array. How should I modify the .py script to display (or add mqtt message for) external storage?

/dev/md0 on /RAID3T

Thanks, Jan

Update time

Thanks for your job 😊

if I understand correctly rpi sends data every 5 minutes... is it possible to decrease the time?

Entity update not working

Hi,
The update entity doesn't work. I'm in version 0.9.1 and it still tells me 0.8.9.
image
image
image

However, if I look at the information in rpi-mqtt-monitor, I am in version 0.9.1.
rpi-mqtt-monitor2

The update entity image is missing. If I connect to the image link, it tells me "Folder not found".
I'm using a local image in the meantime.

Is it possible to enter a clientID?

I'm searching my logs and so many clients have random names generated by not using clientID, it would be good to be able to fix it so I can parse logs better.

SWAP

Hi whats the swap?

Not all devices have a vendor in cpuinfo

Hello

Thanks for the good tool, I was able to run it on my TV box running Armbian.
But I had to make an edit because not all processors have vendor information in them; receiving the manufactory fails with an error.

Could you add a check for this situation or provide an alternative option for obtaining data, for example, use model name instead of vendor.

Below is the error trace:

Traceback (most recent call last):
File "/root/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 711, in
gather_and_send_info()
File "/root/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 617, in gather_and_send_info
print_measured_values(cpu_load, cpu_temp, used_space, voltage, sys_clock_speed, swap, memory, uptime_days, uptime_seconds, wifi_signal, wifi_signal_dbm, rpi5_fan_speed)
File "/root/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 205, in print_measured_values
""".format(config.version, check_model_name(), get_manufacturer(), get_os(), hostname, get_network_ip(), get_mac_address())
^^^^^^^^^^^^^^^^^^
File "/root/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 143, in get_manufacturer
pretty_name = pretty_name.split(':')[1].replace('\n', '')
~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range

ValueError: could not convert string to float:

I get this error:

pi@Homebridge:~ $ rpi-mqtt-monitor -d
Traceback (most recent call last):
  File "/home/pi/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 780, in <module>
    gather_and_send_info()
  File "/home/pi/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 673, in gather_and_send_info
    cpu_load, cpu_temp, used_space, voltage, sys_clock_speed, swap, memory, uptime_days, uptime_seconds, wifi_signal, wifi_signal_dbm, rpi5_fan_speed = collect_monitored_values()
                                                                                                                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pi/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 656, in collect_monitored_values
    memory = check_memory()
             ^^^^^^^^^^^^^^
  File "/home/pi/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 90, in check_memory
    memory = round(float(memory.decode("utf-8").replace(",", ".")))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: could not convert string to float: ''

System Info:

PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Operating System: Debian GNU/Linux 12 (bookworm)
Kernel: Linux 6.6.20+rpt-rpi-v8
Architecture: arm64

Linux Homebridge 6.6.20+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.20-1+rpt1 (2024-03-07) aarch64 GNU/Linux

May 24 2024 15:30:04
Copyright (c) 2012 Broadcom
version 4942b7633c0ff1af1ee95a51a33b56a9dae47529 (clean) (release) (start)

Homeassistant Name convention

Hello,
i use your script with Home Assistant. It's working fine :)
But HA has a naming convention that the Hostname should not be in the Entity name.

suggestion:
provide an HA Version of your script and remove "hostname" from the Description lines.
data["name"] = hostname + " CPU Usage" ...
Thanks

Naming of MQTT Entities
https://rc.home-assistant.io/integrations/mqtt/

Warning Message in home-asssistant.log
[homeassistant.components.mqtt.mixins] MQTT entity name starts with the device name in your config {'state_topic': 'mqtt-monitor/pi-alarm/uptime_days', 'icon': 'mdi:calendar', 'name': 'pi-alarm Uptime', 'unique_id': 'pi-alarm_uptime_days', 'unit_of_measurement': 'days', 'device': {'identifiers': ['pi-alarm'], 'manufacturer': 'Raspberry Pi', 'model': 'Raspberry Pi 4 Model B Rev 1.2\x00', 'name': 'pi-alarm', 'sw_version': 'Debian GNU/Linux 12 (bookworm)\n', 'connections': []}, 'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>, 'force_update': False, 'encoding': 'utf-8', 'enabled_by_default': True, 'payload_available': 'online', 'payload_not_available': 'offline', 'qos': 0, 'availability_mode': 'latest'}, this is not expected. Please correct your configuration. The device name prefix will be stripped off the entity name and becomes 'Uptime'

check_cpu_load can't parse float

I don't know if it is because I use FR locales but check_cpu_load won't work as it should.
Uptime returns 0,91 instead of 0.91

To fix it, change line 27 from this :
cpu_load = p.split("average:")[1].split(",")[0].replace(' ', '')
to that to change "," in "." :
cpu_load = p.split("average:")[1].split(", ")[0].replace(' ', '').replace(',', '.')

help troubleshoot: cpu temperature not available

Hi. I've installed the script on a Ubuntu 22.04 OS. The cpu temperature isn't available when I try running below cat. Any idea why it is not displaying?? I am using a Beelink mini pc.

ser@ser:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.3 LTS
Release: 22.04
Codename: jammy
ser@ser:~$ cat /sys/class/thermal/thermal_zone*/temp 2> /dev/null | sed 's/\(.\)..$//' | tail -n 1
ser@ser:~$ cat /sys/devices/virtual/thermal/thermal_zone0*/temp 2> /dev/null | sed 's/\(.\)..$//' | tail -n 1
ser@ser:~$ sudo systemctl status rpi-mqtt-monitor.service
● rpi-mqtt-monitor.service - System Sensors Monitor
 Loaded: loaded (/etc/systemd/system/rpi-mqtt-monitor.service; disabled; vendor preset: enabled)
 Active: active (running) since Tue 2024-02-13 07:56:53 JST; 46min ago
 Main PID: 58972 (python3)
 Tasks: 4 (limit: 15302)
 Memory: 22.5M
 CPU: 2.542s
 CGroup: /system.slice/rpi-mqtt-monitor.service
 └─58972 /usr/bin/python3 /srv/git/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py --service

Feb 13 07:56:53 ser systemd[1]: Started System Sensors Monitor.

free -t not available on Alpine Linux

I'm running Alpine on my Raspi 5, it's free command doesn't support the "total" option -t. When using the Memory or Swap reporting, the script fails with the following error

BusyBox v1.36.1 (2023-11-07 18:53:09 UTC) multi-call binary.

Usage: free [-bkmgh]

Display free and used memory
Traceback (most recent call last):
  File "/home/markus/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 712, in <module>
    gather_and_send_info()
  File "/home/markus/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 612, in gather_and_send_info
    cpu_load, cpu_temp, used_space, voltage, sys_clock_speed, swap, memory, uptime_days, uptime_seconds, wifi_signal, wifi_signal_dbm, rpi5_fan_speed = collect_monitored_values()
                                                                                                                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/markus/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 595, in collect_monitored_values
    memory = check_memory()
             ^^^^^^^^^^^^^^
  File "/home/markus/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 86, in check_memory
    memory = round(float(memory.decode("utf-8").replace(",", ".")))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: could not convert string to float: ''

Here's an example output of free as-is:

              total        used        free      shared  buff/cache   available
Mem:        8132632     5525592      156444      292000     2450596     2232356
Swap:             0           0           0

I can get it to work when removing the -t and filtering by Mem:

free | grep -i mem | awk 'NR == 1 {print $3/$2*100}'

For Swap, I also get the same issue as #11 (Division by Zero).

Raspian 12 Value Error

When i try to let the the rpi-cpu2mqqt.py run i get the following error:

Traceback (most recent call last):
File "/root/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 730, in
gather_and_send_info()
File "/root/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 630, in gather_and_send_info
cpu_load, cpu_temp, used_space, voltage, sys_clock_speed, swap, memory, uptime_days, uptime_seconds, wifi_signal, wifi_signal_dbm, rpi5_fan_speed = collect_monitored_values()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 613, in collect_monitored_values
memory = check_memory()
^^^^^^^^^^^^^^
File "/root/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 84, in check_memory
memory = round(float(memory.decode("utf-8").replace(",", ".")))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: could not convert string to float: ''

Feature request: option to switch a display

Would it be possible to have a switch similar to the power off but only turn off/on the display. I am currently using the shell command 'xset -display :0 dpms force off' or 'xset -display :0 dpms force on'.
The mqtt option would avoid the ssh authentication issue.
I am trying to automate the touchscreen connected to the pi.
Thank you

vcgencmd: not found

Hello

Im running RPi4 with Ubuntu fpr RPI and this is the error Im getting. Any idea what is wrong?

ubuntu@ubuntu:~/rpimonitor$ /usr/bin/python3.8 rpi-cpu2mqtt.py
/bin/sh: 1: vcgencmd: not found
Traceback (most recent call last):
File "rpi-cpu2mqtt.py", line 198, in
cpu_temp = check_cpu_temp()
File "rpi-cpu2mqtt.py", line 54, in check_cpu_temp
cpu_temp = str(p).replace('\n', ' ').replace('\r', '').split("=")[1].split("'")[0]

Minor typo in documentation

The service examples in the Readme reference a service file called rpi-cpu2mqtt.service, however the filename in the distribution seems to have been changed to rpi-mqtt-monitor.service

Examples should read
sudo cp rpi-mqtt-monitor.service /etc/systemd/system/ ; sudo systemctl enable rpi-mqtt-monitor.service
and
sudo service rpi-mqtt-monitor start ; sudo service rpi-mqtt-monitor status
respectively

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.