Remote RPI system monitor

I have been using this tool on multiple PIs and they work very well. However, two of my devices needed a re-image, and when I reinstalled this library, the sensors remain as “Unavailable”. I believe that the new install was a newer release, so not sure if that is part of the problem.

I have attempted to remove the devices from HA, in an effort to allow mqtt to rediscover them, which it does, but the sensor values do not change.

I can see the messages being received in the logs, and cannot find HA reporting any issue with them.

Any help appreciated.

Maybe you could run a cronjob with only sudo apt-get update?

Since the update to 2021.3.0 I’m having issues with automations that have numeric state triggers that rely on these sensors as they are unavailable until up to 60 seconds after home assistant starts.

Is there a way to set the retained flag on sensor messages to prevent this from happening?


    Error initializing 'GPIO Bridge 1 Memory Monitor Alert' trigger: In 'numeric_state' condition: state of sensor.gpio_bridge_1memoryuse is unavailable
    Error initializing 'GPIO Bridge 2 Memory Monitor Alert' trigger: In 'numeric_state' condition: state of sensor.gpio_bridge_2memoryuse is unavailable

You could change the script to retain the values but I think a better option is to change your automation to a template trigger and check if it’s available

1 Like

I’ll try that. Thanks. :+1:

Worked like a charm. Thank you. No need to test for unavailable state (the float filter converts it to zero):

- alias: 'GPIO Bridge 1 Memory Monitor Alert'
  trigger:
    # platform: numeric_state
    # entity_id: sensor.gpio_bridge_1memoryuse
    # above: 75
    # for:
    #   minutes: 5
    platform: template
    value_template: "{{states('sensor.gpio_bridge_1memoryuse')|float > 75 }}"
    for:
      minutes: 5
1 Like

I had an old version of the Remote PRI system monitor, since I have updated to 1.2.1, there were some changes made to the naming convention. I had fixed some of it, but the one I am having trouble is stated in the error log.

Platform mqtt does not generate unique IDs. ID ws1_sensor_power_status already exists - ignoring binary_sensor.ws1_under_voltage

I think I found the duplicate, but am not sure which is the old name. Can someone tell by going into the mqtt explorer which of the 2 is the old name?

2021-03-16_5-53-07

You could check by checking which topic has the last message

Delete both topics (old and new) with the MQTTExplorer. The “new” and working one will become after a short time. :slight_smile:

@ sennevds

You could check by checking which topic has the last message

Both the topics never updates inself. Stays at retained.

But I figured it out. I had installed the script on another rpi with the latest version. View the topics and looks like this topic is the latest.

power_status

Having a problem with the auto start this option on the raspberry pi. Could you slowly walk me thru this and what we have to do? Got everything working, but this pi gets turned off and on a lot, so I want it to run automatically in the background on raspian.

“edit the path to your script path and settings.yaml. Also make sure you replace pi in “User=pi” with the account from which this script will be run. This is typically ‘pi’ on default raspbian system.”

Nevermind, I got it working. Might want to update the readme to just make sure the set up is pointing to the directories. I felt like we had to change something, but you had it all set up right my man! Gracias!

I’ve tried variations, but the number of updates remains at zero. I can confirm there are update to be install.

crontab:

root apt update
root apt-get update
root /usr/bin/apt update

update: This works

# checks everyday at midnight
0 0 * * * apt update

``

@Sennevds

Thanks for this plugin. I have it working perfectly on a Pi4/8GB. That one is running full Raspbian with a desktop GUI. I have also installed this on a Pi3B+ with no desktop GUI. It is running the Mycroft voice assistant, using this install recipe:

enclosure-picroft/image_recipe.md at afd739ebbaa7ee13204b2bfcf2103c1e5e8aa984 · MycroftAI/enclosure-picroft · GitHub

The MQTT connection works just fine. When I try to make this a system service I get a rpi_bad_power module missing error when checking the service status. Can I just edit your python script to remove the module, or do you have a better solution?

This Pi3B+ system is running Python 3.7.3, and so is the fully functioning Pi4B/8GB

After reading the posts above, this shouldn’t be an issue; also since it works just fine on the other Pi. I can get the broker connection going through SSH, running:

python3 src/system_sensors.py src/settings.yaml

but then it disconnects when I close the session. I tried tmux, but I got rpi_bad_power module errors with that command. I then removed the whitespace in the .py file as you said, and that error doesn’t happen with tmux. So, right now I have a way of running the service even after closing the ssh session. Removing the whitespace didn’t fix the error when running it as a system service.

Ok, this was a pain in the ass, for some reason. I noticed you said to run this command:

/usr/local/bin/python3.8 -m pip install -r requirements.txt

I changed it for python3.7, but it said no file or directory. I then took out the /local part of it, and it installed all the missing dependencies.

/usr/bin/python3.7 -m pip install -r requirements.txt

The system service seems to be running now, with no issues.

(.venv) pi@picroft:~/system_sensors $ sudo systemctl status system_sensors.service
● system_sensors.service - System Sensor service
   Loaded: loaded (/etc/systemd/system/system_sensors.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2021-05-28 17:30:31 CDT; 7s ago
 Main PID: 22028 (python3)
    Tasks: 3 (limit: 2062)
   CGroup: /system.slice/system_sensors.service
           └─22028 /usr/bin/python3 /home/pi/system_sensors/src/system_sensors.py /home/pi/system_sensors/src/settings.yaml

May 28 17:30:31 picroft systemd[1]: Started System Sensor service.
May 28 17:30:32 picroft python3[22028]: send config message
May 28 17:30:32 picroft python3[22028]: Connected to broker
1 Like

Will anyone of these sensors tell me my rpi z W had go offline? I noticed my rpi z w (headless setup) lost connection. I was not able to putty in. I want to create an alert if it goes offline.

Normally they go unavailable.

First of all I really like this script. I use it to monitor my second RPI who is running boinc.
If it is possible I would like to have more settings e.g. switch of the network download and upload speed logging or the host info´s. I already tried to comment the sections out but then the the whole script didn´t send new data.

I like this script and i’m trying to get it dockerized and working with debian nas instead of rpi.
i did few changes, if everything will work good i will share it.

But i’m having a issue… it seems that every 5 second the script looses the connection with mqtt broker and i can see:

Connected to broker
Connected to broker
Connected to broker
Connected to broker

a new line every 5 seconds
but the worst is that the entities in ha keep on flashing from values to ‘unanvailable’

immagine

any ideas?

thank you