Remote RPI system monitor

The birth message is used. You could install a mqtt client to check if the birth message is send every x seconds. I use an external mqtt broker so don’t know how the addon works

Sorry, I forgot to mention that I checked it using ‘MQTT Explorer’ and confirmed that birth message is definitely not being received from HA every 2 seconds.

Hi,

what is the correct way to monitor externa usb disk space?
i have this mounting point image
and I’m using this setting config
image

but I can’t get the HDD statistics

image

anyone can help me?

What is the output of df /media/pi/FRIGATESSD

Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 488264704 90963200 397301504 19% /media/pi/FRIGATESSD
pi@frigate-host:~ $

So 0% is wrong :slight_smile:

Any logs from the pi?

trying this script seems to work super but not getting download traffic data any thoughts or help thanks

Logs please

I am trying to run this on a Pi 3b+ and running into the following problem. Can anyone assist? I am following the directions from here:

Running Python 3.7.3

Thanks

pi@raspberrypi:~ $ python3 /opt/RPi-Reporter-MQTT2HA-Daemon/ISP-RPi-mqtt-daemon.py -d -v
[2023-04-04 00:39:58] - (DBG): --------------------------------------------------------------------
[2023-04-04 00:39:58] - ISP-RPi-mqtt-daemon.py v1.8.4
[2023-04-04 00:39:58] - Verbose enabled
[2023-04-04 00:39:58] - (DBG): Debug enabled
[2023-04-04 00:39:58] - (DBG): * init mqtt_client_connected=[False]
[2023-04-04 00:39:59] - (DBG): - RQST daemon_version_list=(['v1.8.4', 'v1.7.2', 'v1.7.3', 'v1.7.4', 'v1.8.3'])
[2023-04-04 00:39:59] - (DBG): * daemon_last_fetch_time=(1680565199.1902242)
[2023-04-04 00:39:59] - (DBG): fqdn_raw=[raspberrypi]
[2023-04-04 00:39:59] - (DBG): rpi_fqdn=[raspberrypi]
[2023-04-04 00:39:59] - (DBG): rpi_hostname=[raspberrypi]
[2023-04-04 00:39:59] - (DBG): rpi_model_raw=[Raspberry Pi 3 Model B Rev 1.2]
[2023-04-04 00:39:59] - (DBG): rpi_model=[RPi 3 Model B r1.2]
[2023-04-04 00:39:59] - (DBG): rpi_connections=[e,w,b]
[2023-04-04 00:39:59] - (DBG): cpu_loads_raw=[['0.05', '0.40', '0.47', '1/118', '2069']]
[2023-04-04 00:39:59] - (DBG): rpi_cpu_tuple=[('BCM2835', 'ARMv7 Processor rev 4 (v7l)', 4, 307.2, '00000000bcd09f27', 1.2, 10.0, 11.8)]
[2023-04-04 00:39:59] - (DBG): rpi_linux_release=[buster]
[2023-04-04 00:39:59] - (DBG): rpi_linux_version=[5.10.103-v7+]
[2023-04-04 00:39:59] - (DBG): getFileSystemDrives() trimmedLines=[['/dev/root           6991  1472      5208  23% /']]
[2023-04-04 00:39:59] - (DBG): lineParts(6)=[['/dev/root', '6991', '1472', '5208', '23%', '/']]
[2023-04-04 00:39:59] - (DBG): percent_field_index=[4]
[2023-04-04 00:39:59] - (DBG): device=[/dev/root]
[2023-04-04 00:39:59] - (DBG): mount_point=[/]
[2023-04-04 00:39:59] - (DBG): newTuple=[('8', '23', '/', '/dev/root')]
[2023-04-04 00:39:59] - (DBG): rpi_filesystem_space=[8GB]
[2023-04-04 00:39:59] - (DBG): rpi_filesystem_percent=[23]
[2023-04-04 00:39:59] - (DBG): rpi_filesystem=[[('8', '23', '/', '/dev/root')]]
[2023-04-04 00:40:02] - (DBG): APT changes=[[]]
[2023-04-04 00:40:02] - APT Avail Updates: (0)
[2023-04-04 00:40:02] - Connecting to MQTT broker ...
[2023-04-04 00:40:02] * NOTIFY: MQTT connection error. Please check your settings in the configuration file "config.ini"
pi@raspberrypi:~ $

This thread is about GitHub - Sennevds/system_sensors: Logging of system sensor specific for the RPI and sending them to a MQTT broker, you are running something else and should probably open a new thread. Please tag me in @nickrout and I will try and lend a hand.

My apologies, please disregard.

I managed to get it working.

Hello.
I am starting to see this error after upgrading to 2023.5.3

error:

Logger: homeassistant.components.mqtt.models
Source: components/sensor/__init__.py:583
Integration: MQTT (documentation, issues)
First occurred: 7:56:23 AM (3 occurrences)
Last logged: 7:56:43 AM

Exception raised when updating state of sensor.ns1_wifi_ssid, topic: 'system-sensors/sensor/ns1/state' with payload: b'{"temperature": "48.3","clock_speed": "600","disk_use": "6.2","memory_use": "27.9","cpu_usage": "1.8","load_1m": "0.03","load_5m": "0.06","load_15m": "0.05","net_tx": "9.73","net_rx": "0.00","swap_usage": "14.9","power_status": "OFF","last_boot": "2022-06-01T08:28:46+09:00","hostname": "ns1","host_ip": "192.168.1.10","host_os": "Raspbian GNU/Linux 10 (buster)","host_arch": "armv7l","last_message": "2023-05-21T07:56:20.411485+09:00","updates": "0","wifi_strength": "0","wifi_ssid": "UNKNOWN","disk_use_drive1": "19.1"}'
Exception raised when updating state of sensor.ms3_wifi_ssid, topic: 'system-sensors/sensor/ms3/state' with payload: b'{"temperature": "51.9","clock_speed": "1000","disk_use": "24.5","memory_use": "25.2","cpu_usage": "80.0","load_1m": "2.01","load_5m": "2.58","load_15m": "2.72","net_tx": "38.10","net_rx": "0.00","swap_usage": "19.5","power_status": "OFF","last_boot": "2023-02-26T20:23:35+09:00","hostname": "ms3","host_ip": "192.168.1.30","host_os": "Raspbian GNU/Linux 10 (buster)","host_arch": "armv6l","last_message": "2023-05-21T07:56:17.892376+09:00","updates": "0","wifi_strength": "-39","wifi_ssid": "UNKNOWN","disk_use_drive1": "19.1"}'
Exception raised when updating state of sensor.ms2_wifi_ssid, topic: 'system-sensors/sensor/ms2/state' with payload: b'{"temperature": "39.0","clock_speed": "1000","disk_use": "23.6","memory_use": "24.8","cpu_usage": "17.5","load_1m": "0.24","load_5m": "0.29","load_15m": "0.27","net_tx": "2.09","net_rx": "0.00","swap_usage": "21.8","power_status": "OFF","last_boot": "2023-01-06T10:25:52+09:00","hostname": "ms2","host_ip": "192.168.1.40","host_os": "Raspbian GNU/Linux 10 (buster)","host_arch": "armv6l","last_message": "2023-05-21T07:56:36.052505+09:00","updates": "0","wifi_strength": "-51","wifi_ssid": "UNKNOWN","disk_use_drive1": "19.1"}'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 579, in state
    numerical_value = int(value)
ValueError: invalid literal for int() with base 10: 'UNKNOWN'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/mqtt/models.py", line 270, in process_write_state_requests
    entity.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 585, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 649, in _async_write_ha_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 591, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 583, in state
    raise ValueError(
ValueError: Sensor sensor.ns1_wifi_ssid has device class signal_strength, state class None unit None and suggested precision None thus indicating it has a numeric value; however, it has the non-numeric value: UNKNOWN (<class 'str'>)

I did a stupid thing today. Instead of deleting an obsolete mqtt device I had, I’ve deleted the whole MQTT integration. Gave me a scared. I just needed to reinstall the mqtt integration under add-on. Everything went back to normal… kinda. I noticed these system sensors were gone in my frontend. Further investigate says the naming have changed. So, I suspect this project will be affected by the mqtt changes with the HA 2024 updates coming.

A quick fix and certainly not correct, but it sure beats having to rename all the sensors one by one. I edit this line in system_sensors.py

From:

+ f'"name":"{deviceNameDisplay} Sensors","model":"{deviceModel}", "manufacturer":"{deviceManufacturer}"}}'

to:

+ f'"name":"","model":"{deviceModel}", "manufacturer":"{deviceManufacturer}"}}'

Stop the service. Open mqtt explorer and delete the device name under sensor and binary_sensor before restarting the service. The names should still be the same as before for all.

Hi,

Just stumbled across this thread and hugely appreciative of the work that’s been done on it - exactly what I was looking for, thank you. I do however have an issue I’m hoping someone has seen before …

I’ve managed to follow the install instructions on a RPi4 and all has gone smoothly including the sensors appearing in MQTT in HA (albeit as ‘Unavailable’). However, I’ve an error message at the final step when running ‘python3 src/system_sensors.py src/settings.yaml’ (which I assume explains the ‘unavailable’ status). The error that is returned is:
Sending config message to host…
Error while attempting to perform inital sensor update: ‘enp1s0’

I think that ‘enp1s0’ is referring to the name of the wired network connection which on my device is called ‘eth0’. I can’t see where in the script / config the network connection is defined. Please let me know if I’m missing something or if there’s another work around anyone knows of.

Thanks :slight_smile:

Defined here system_sensors/src/settings_example.yaml at fae97d74fd6bb527cfdd23090b6d96ca4700b7d6 · Sennevds/system_sensors · GitHub

:man_facepalming: Not sure how I missed that - thank you

It took me a while to find it.

This fails, likely due to paho.mqtt 2 ?

$ python3 ~/system_sensors/src/system_sensors.py src/settings.yaml
/home/mathias/system_sensors/src/system_sensors.py:268: DeprecationWarning: Callback API version 1 is deprecated, update to latest version
  mqttClient = mqtt.Client(mqtt.CallbackAPIVersion.VERSION1, client_id=settings['client_id'])

and the MQTT broker on HA logs:

2024-08-09 16:58:02: New client connected from 172.30.32.1:57003 as 73K5cGF56CqzKq8Jx3qmCG (p2, c1, k60, u'homeassistant').
2024-08-09 16:58:28: New connection from 192.168.0.103:56395 on port 1883.
2024-08-09 16:58:28: Client <unknown> disconnected due to protocol error.
2024-08-09 16:59:35: New connection from 192.168.0.103:38225 on port 1883.
2024-08-09 16:59:35: Client <unknown> disconnected due to protocol error.
2024-08-09 16:59:49: Saving in-memory database to /data//mosquitto.db.

Is there a fix?

Tried updating to resolve MQTT issues pointed out in the logs, but am getting the following when trying to run:

python3 src/system_sensors.py src/settings.yaml
Traceback (most recent call last):
  File "src/system_sensors.py", line 262, in <module>
    if importlib.metadata.version("paho-mqtt")[0] == '1':
NameError: name 'importlib' is not defined

Any ideas?