Nuc System Monitoring Card

My apologies, it’s totally true. Thank you @petro :wink:

1 Like

I’ve finally found the time to start tweaking my styles. Thanks for all the ideas (and code) in this thread. I’ve got this card working, but with a pretty big caveat. I’m sure I have something set completely out of bounds, but I have yet to find it.

It started off looking great, with the exception of the refresh every ~15-30 seconds. I didn’t think too much about it, and just kept tweaking things. It became more than an annoyance when I noticed it was started to affect my workstation. It managed to gobble up at least 6G of RAM in a short period of time. I removed the card and the RAM was immediately returned to me.

The first thing I did to troubleshoot was hit F12 in my browser and have a peak at the console. There was a very thoughtful message from card-mod telling me I should probably load this in the frontend, so I did.

/config/configuration.yaml

frontend:
  extra_module_url:
    - /hacsfiles/lovelace-card-mod/card-mod.js

I did a hard refresh in my browser and didn’t notice any difference. This is when I removed the card, created this gist with the contents of the RAM stealing card I concocted, and wrote this post.

Any tips on how to resolve this are much appreciated. Note: It’s late and I have not re-read all the various card manuals I have recently installed. I may very well be missing something obvious.

TIA

This card is a combination of many custom cards, many of them are not maintained by the dev team. They may have bugs, like a memory leak. Remove pieces of the card until the memory leak goes away. then add things back until it appears again. This will help you figure out where the leak is coming from. Once you figure that out, you can start to correct the leak. Correcting the leak may require you to notify the developer of the custom card that’s causing the problem. Last time I used this setup (~late 2019), there was no memory leak.

1 Like

Hi.
I used your code… It’s funny that when I create the card I get the “custom element doesn’t exist: hui-vertical-stack-card” message. However if I save the card anyway and press the “Add Card” button so the cards menu appear, and cancel right after it apears, the NUC monitor card appears… BUT… If I refresh the browser the “custom element doesn’t exist: hui-vertical-stack-card” message appears again… and so on… Any ideas?

The sensor “sensor.cpu_speed” dont work in the new HA Version :frowning:
What is the new name?

The fix was found here: UPS System Monitoring Card
by barsurfer

Basically install “hui-element” on HACS then change:

    - type: custom:hui-vertical-stack-card

to:

    - type: custom:hui-element
      card_type: vertical-stack
1 Like

Excellent tutorial, thank you very much I have a wonderful monitoring card.

Hi all,

the card look amazing!

But I have one issue:
Everytime the states update the whole card flashes and it is very annoying for the eyes.
Does somebody have a solution for that? Can I somehow delay the update for the whole card?
So it updates all states at once after a minute or so? That would make it a little better.

Regards Adrian

I dont know why in one window it is correct and in another window same browser same computer it shows an error.

any advise ?

2 Likes

That’s cache related, clear the cache on the non working one.

very nice dashboard! can you share your code?

The card is a great one but i have a small problem :slight_smile: the card is HUGE :slight_smile: and can’t make it smaller … where is the problem ?

1 Like

Hi Guys, I’m trying to using the Script to get System stats of my Nuc10i7 with Proxmox running into HA.
What I did so far is getting rid of the byte-like object with this. Then corrected the ThermalZone to “4” instead of five, but there is another error, which I cannot deal with. Maybe someone could help me:

Traceback (most recent call last):
  File "/home/./rpi-cpu2mqtt2.py", line 150, in <module>
    if config.free_space:
AttributeError: module 'config' has no attribute 'free_space'

Hey i know its a late reply but I am having troubles running your script. Could you help me out?
I am getting an error as follows:

root@pve:~# /usr/bin/python3 rpi-mqtt-monitor/src/rpi-cpu2mqtt.py
Traceback (most recent call last):
  File "/root/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 140, in <module>
    cpu_load = check_cpu_load()
  File "/root/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 38, in check_cpu_load
    cpu_load = p.split("average:")[1].split(",")[0].replace(' ', '')
TypeError: a bytes-like object is required, not 'str'

the output from p is most likely a byte array, so that code won’t work unless you feed it bytes or convert the response to a string.

Sure, what do uptime and nproc give

I am not sure what you are exactly asking.
When I try to run the script I receive an error in terminal.

1 Like

Do you know/understand python?

Execute both commands in your Proxmox shell, I assume using SSH.

Here it is

root@pve:~# uptime
 14:31:47 up 39 days, 22:19,  1 user,  load average: 0.34, 0.36, 0.36
root@pve:~# nproc
4

I have fixed str error cpu_load but now i receive new error

root@pve:~# /usr/bin/python3 rpi-mqtt-monitor/src/rpi-cpu2mqtt.py
cat: /sys/class/thermal/thermal_zone5/temp: No such file or directory
Traceback (most recent call last):
  File "/root/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 142, in <module>
    cpu_temp = check_cpu_temp()
  File "/root/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py", line 69, in check_cpu_temp
    cpu_temp = subprocess.check_output("cat /sys/class/thermal/thermal_zone5/temp", shell=True)
  File "/usr/lib/python3.9/subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'cat /sys/class/thermal/thermal_zone5/temp' returned non-zero exit status 1.

@petro to some extent

Just to clarify things, I run Proxmox on NUC 11