UCTRONICS / UCTRONICS_RM0004_HA

This repository is used for home assistant system
3 stars 6 forks source link

Fixed cpu usage at 101% #6

Open SondreUM opened 6 months ago

SondreUM commented 6 months ago

Changes in get_cpu_message()

Hass.io uses different row name for cpu usage, additionally uses percentage instead of fraction. From Home Assistant:

$ top
Mem: 1786076K used, 2096116K free, 1440K shrd, 103224K buff, 953800K cached
CPU:   0% usr   0% sys   0% nic  98% idle   0% io   0% irq   0% sirq
Load average: 0.84 1.23 1.17 2/570 299
  PID  PPID USER     STAT   VSZ %VSZ CPU %CPU COMMAND
  193   157 root     S     6632   0%   2   0% sshd: root@pts/0

Ubuntu example:

$ top
top - 00:32:20 up 3 days, 55 min,  6 users,  load average: 0.53, 0.38, 0.36
Tasks: 393 total,   1 running, 391 sleeping,   0 stopped,   1 zombie
%Cpu(s):  0.5 us,  1.5 sy,  1.0 ni, 97.1 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :  39023.1 total,  26581.8 free,   7949.3 used,   4492.1 buff/cache
MiB Swap:  16384.0 total,  16384.0 free,      0.0 used.  28497.3 avail Mem

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
   1057 root      32  12 1876104  46452  32000 S   6.2   0.1   1:23.63 containerd

Testet on Raspberry pi 4B with Home Assistant: