Nuc System Monitoring Card

Thank you for the help.
All cards installed.
Cleared cache, restarted, but a full reboot took care of the problem.

1 Like

Can you tell me how to get the CPU percentage info from the Ubuntu VM, I’m not able to find that.

Can you post your code for the proxmox? Im trying here but with no success.

Another question is, how did you get the disk, ram, cpu and temperature from proxmox?

Forgive my ignorance, but how do you add multiple instances of these monitors onto one screen?

I use this setup to send my Proxmox stats via MQTT to HA, I just changed to from RPi to Proxmox, which is almost the same:

This is my script in Proxmox:

# Python 2 script to check cpu load, cpu temperature and free space,
# on a Raspberry Pi computer and publish the data to a MQTT server.
# RUN pip install paho-mqtt
# RUN sudo apt-get install python-pip

from __future__ import division
import subprocess, time, socket, os
import paho.mqtt.client as paho
import json
import config

# get device host name - used in mqtt topic
hostname = socket.gethostname()


def check_used_space(path):
                st = os.statvfs(path)
                free_space2 = st.f_bavail * st.f_frsize
                total_space2 = st.f_blocks * st.f_frsize
                used_space = int(100 - ((free_space2 / total_space2) * 100))
                return used_space

def check_free_space(path):
                st = os.statvfs(path)
                free_space = st.f_bavail * st.f_frsize
                #total_space = st.f_blocks * st.f_frsize
                #used_space = int(100 - ((free_space / total_space) * 100))
                gb = 1024 * 1024 * 1024
                return round(float(free_space / gb), 1)

def check_total_space(path):
                st = os.statvfs(path)
                #free_space = st.f_bavail * st.f_frsize
                total_space = st.f_blocks * st.f_frsize
                #used_space = int(100 - ((free_space / total_space) * 100))
                gb = 1024 * 1024 * 1024
                return round(float(total_space / gb), 1)

def check_cpu_load():
                # bash command to get cpu load from uptime command
                p = subprocess.Popen("uptime", shell=True, stdout=subprocess.PIPE).communicate()[0]
                cores = subprocess.Popen("nproc", shell=True, stdout=subprocess.PIPE).communicate()[0]
                cpu_load = p.split("average:")[1].split(",")[0].replace(' ', '')
                cpu_load = float(cpu_load)/int(cores)*100
                cpu_load = round(float(cpu_load), 1)
                return cpu_load

def check_uptime():
                p = subprocess.Popen("uptime -p", shell=True, stdout=subprocess.PIPE).communicate()[0]
                #uptime = p.split("up ")
                uptime = p.replace('up ', '').replace(',', '').replace('\n', '')
                return uptime

def check_voltage():
                full_cmd = "vcgencmd measure_volts | cut -f2 -d= | sed 's/000//'"
                voltage = subprocess.Popen(full_cmd, shell=True, stdout=subprocess.PIPE).communicate()[0]
                voltage = voltage.strip()[:-1]
                return voltage

def check_swap():
                full_cmd = "free -t | awk 'NR == 3 {print $3/$2*100}'"
                swap = subprocess.Popen(full_cmd, shell=True, stdout=subprocess.PIPE).communicate()[0]
                swap = round(float(swap), 1)
                return swap

def check_memory():
                full_cmd = "free -t | awk 'NR == 2 {print $3/$2*100}'"
                memory = subprocess.Popen(full_cmd, shell=True, stdout=subprocess.PIPE).communicate()[0]
                memory = round(float(memory), 1)
                return memory

def check_cpu_temp():
                #full_cmd = "cat /sys/class/thermal/thermal_zone3/temp"
                cpu_temp = subprocess.check_output("cat /sys/class/thermal/thermal_zone5/temp", shell=True)
                #cpu_temp = subprocess.Popen(full_cmd, shell=True, stdout=subprocess.PIPE).communicate()[0]
                #cpu_temp = p.replace('\n', ' ').replace('\r', '').split("=")[1].split("'")[0]
                cpu_temp = [int(i) for i in cpu_temp.split() if i.isdigit()][0]
                return cpu_temp/1000


def check_sys_clock_speed():
                full_cmd = "awk '{printf (\"%0.0f\",$1/1000); }' </sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq"
                return subprocess.Popen(full_cmd, shell=True, stdout=subprocess.PIPE).communicate()[0]


def publish_to_mqtt (cpu_load = 0, cpu_temp = 0, used_space = 0, free_space = 0, uptime = 0, total_space = 0, memory = 0):
                # connect to mqtt server
                client = paho.Client()
                client.username_pw_set(config.mqtt_user, config.mqtt_password)
                client.connect(config.mqtt_host, config.mqtt_port)

                # publish monitored values to MQTT
                if config.cpu_load:
                        client.publish(config.mqtt_topic_prefix+"/"+hostname+"/cpuload", cpu_load, qos=1)
                        time.sleep(config.sleep_time)
                if config.cpu_temp:
                        client.publish(config.mqtt_topic_prefix+"/"+hostname+"/cputemp", cpu_temp, qos=1)
                        time.sleep(config.sleep_time)
                if config.used_space:
                        client.publish(config.mqtt_topic_prefix+"/"+hostname+"/diskusage", used_space, qos=1)
                        time.sleep(config.sleep_time)
                if config.free_space:
                        client.publish(config.mqtt_topic_prefix+"/"+hostname+"/freespace", free_space, qos=1)
                        time.sleep(config.sleep_time)
                if config.total_space:
                        client.publish(config.mqtt_topic_prefix+"/"+hostname+"/totalspace", total_space, qos=1)
                        time.sleep(config.sleep_time)
                if config.memory:
                        client.publish(config.mqtt_topic_prefix+"/"+hostname+"/memory", memory, qos=1)
                        time.sleep(config.sleep_time)
                if config.uptime:
                        client.publish(config.mqtt_topic_prefix+"/"+hostname+"/uptime", uptime, qos=1)
                        time.sleep(config.sleep_time)
                # disconect from mqtt server
                client.disconnect()

def bulk_publish_to_mqtt (cpu_load = 0, cpu_temp = 0, used_space = 0, free_space = 0, uptime = 0, total_space = 0, memory = 0):
                # compose the CSV message containing the measured values

                values = cpu_load, float(cpu_temp), used_space, free_space, uptime, total_space, memory
                values = str(values)[1:-1]

                # connect to mqtt server
                client = paho.Client()
                client.username_pw_set(config.mqtt_user, config.mqtt_password)
                client.connect(config.mqtt_host, config.mqtt_port)

                # publish monitored values to MQTT
                client.publish(config.mqtt_topic_prefix+"/"+hostname, values, qos=1)

                # disconect from mqtt server
                client.disconnect()



if __name__ == '__main__':
                # set all monitored values to False in case they are turned off in the config
                cpu_load = cpu_temp = used_space = free_space = uptime = total_space = memory = False

                # delay the execution of the script
                time.sleep(config.random_delay)

                # collect the monitored values
                if config.cpu_load:
                        cpu_load = check_cpu_load()
                if config.cpu_temp:
                        cpu_temp = check_cpu_temp()
                if config.used_space:
                        used_space = check_used_space('/')
                if config.free_space:
                        free_space = check_free_space('/')
                if config.uptime:
                        uptime = check_uptime()
                if config.total_space:
                        total_space = check_total_space('/')
                if config.memory:
                        memory = check_memory()

                # Publish messages to MQTT
                if config.group_messages:
                        bulk_publish_to_mqtt(cpu_load, cpu_temp, used_space, free_space, uptime, total_space, memory)
                else:
                        publish_to_mqtt(cpu_load, cpu_temp, used_space, free_space, uptime, total_space, memory)



1 Like

I just added more cards to a view. Every card is another template custom card.

I’d like to do get the same data from Proxmox into Home Assistant.
Is this a script you run inside Home Assistant, or in a seperate vm?
Can you please provide more info on this?

def check_cpu_load():
                # bash command to get cpu load from uptime command
                p = subprocess.Popen("uptime", shell=True, stdout=subprocess.PIPE).communicate()[0]
                cores = subprocess.Popen("nproc", shell=True, stdout=subprocess.PIPE).communicate()[0]
                cpu_load = p.split("average:")[1].split(",")[0].replace(' ', '')
                cpu_load = float(cpu_load)/int(cores)*100
                cpu_load = round(float(cpu_load), 1)
                return cpu_load

You need to run the script in Proxmox, so ssh into it. Then follow the guide just like the one for the RPi.
You can run that script on every debian based machine to get its stats.

There is an integration for Proxmox

Having great difficulty as it will only show the last card on my system - Can you share your Lovelace file so I can see what I’m doing wrong!

Thanks :slight_smile:

Sure! Here it is:

  - title: SYSTEM2
    path: system-2
    icon: 'mdi:network'
    visible:
      - user: ###########################
    badges: []
    cards:
      - id: rpi4_status
        type: 'custom:config-template-card'
        variables:
          - 'states[''sensor.rpi4_diskusage''].state'
          - 'states[''sensor.rpi4_memory''].state'
          - 'states[''sensor.rpi4_cpu_load''].state'
          - 'states[''sensor.rpi4_cpu_temp''].state'
          - 'states[''sensor.rpi4_free_space''].state'
          - 'states[''sensor.rpi4_total_space''].state'
          - 'states[''sensor.rpi4_uptime''].state'
        entities:
          - sensor.rpi4_diskusage
          - sensor.rpi4_memory
          - sensor.rpi4_cpu_load
          - sensor.rpi4_cpu_temp
          - sensor.rpi4_free_space
          - sensor.rpi4_total_space
          - sensor.rpi4_uptime
        card:
          type: entities
          show_header_toggle: 'off'
          style: |
            .card-header {
              padding: 0px 0px 0px 0px !important;
            }
          entities:
            - type: section
              label: '${ ''RPi4 --- Raspbian 10 (buster) '' }'
            - type: 'custom:hui-vertical-stack-card'
              cards:
                - type: horizontal-stack
                  cards:
                    - type: picture
                      style: |
                        ha-card { 
                            --paper-card-background-color: 'rgba(0, 0, 0, 0.0)';
                            --ha-card-background: "rgba(0, 0, 0, 0.0)";
                            --ha-card-box-shadow: 'none';
                        }
                      image: /local/images/raspberrypi.jpg
                    - type: 'custom:button-card'
                      layout: icon_name_state2nd
                      show_icon: true
                      show_state: true
                      styles:
                        grid:
                          - grid-template-columns: 50px auto
                        icon:
                          - padding: 0px 0px
                          - height: 30px
                          - width: 30px
                        card:
                          - '--ha-card-background': 'rgba(0, 0, 0, 0.0)'
                          - '--ha-card-box-shadow': none
                        state:
                          - padding: 0px 10px
                          - justify-self: start
                          - font-family: 'Roboto, sans-serif'
                          - font-size: 15px
                        name:
                          - padding: 0px 10px
                          - justify-self: start
                          - color: var(--secondary-text-color)
                      entity: sensor.rpi4_uptime
                      name: Uptime
                      icon: 'mdi:clock-outline'
                - type: 'custom:bar-card'
                  show_icon: true
                  align: split
                  columns: 1
                  max: 100
                  positions:
                    icon: inside
                    indicator: inside
                    name: inside
                    value: inside
                  unit_of_measurement: '%'
                  severity:
                    - value: 50
                      color: '#3498db'
                    - value: 75
                      color: '#f39c12'
                    - value: 100
                      color: '#e45e65'
                  style: |
                    ha-card { 
                        --paper-card-background-color: 'rgba(0, 0, 0, 0.0)';
                        --ha-card-background: "rgba(0, 0, 0, 0.0)";
                        --paper-item-icon-color: 'var(--text-primary-color';
                        --ha-card-box-shadow: 'none';
                    }
                  entities:
                    - entity: sensor.rpi4_diskusage
                  name: '${ ''Disk ('' + vars[4] + ''Gb/'' + vars[5] + ''Gb)'' }'
                  entity_row: true
                - type: horizontal-stack
                  cards:
                    - type: 'custom:bar-card'
                      show_icon: true
                      align: split
                      columns: 1
                      max: 100
                      positions:
                        icon: inside
                        indicator: inside
                        name: inside
                        value: inside
                      unit_of_measurement: '%'
                      severity:
                        - value: 50
                          color: '#3498db'
                        - value: 75
                          color: '#f39c12'
                        - value: 100
                          color: '#e45e65'
                      style: |
                        ha-card { 
                          --paper-card-background-color: 'rgba(0, 0, 0, 0.0)';
                          --ha-card-background: "rgba(0, 0, 0, 0.0)";
                          --paper-item-icon-color: 'var(--text-primary-color';
                          --ha-card-box-shadow: 'none';
                        }
                      entity: sensor.rpi4_memory
                      name: RAM
                      entity_row: true
                    - type: 'custom:bar-card'
                      show_icon: true
                      align: split
                      columns: 1
                      max: 100
                      positions:
                        icon: inside
                        indicator: inside
                        name: inside
                        value: inside
                      unit_of_measurement: '%'
                      severity:
                        - value: 50
                          color: '#3498db'
                        - value: 75
                          color: '#f39c12'
                        - value: 100
                          color: '#e45e65'
                      style: |
                        ha-card { 
                          --paper-card-background-color: 'rgba(0, 0, 0, 0.0)';
                          --ha-card-background: "rgba(0, 0, 0, 0.0)";
                          --paper-item-icon-color: 'var(--text-primary-color';
                          --ha-card-box-shadow: 'none';
                        }
                      entity: sensor.rpi4_cpu_load
                      name: CPU
                      entity_row: true
                - type: 'custom:mini-graph-card'
                  height: 30
                  line_width: 2
                  font_size: 70
                  hours_to_show: 168
                  points_per_hour: 1
                  show:
                    extrema: true
                    fill: true
                  style: |
                    ha-card { 
                      --ha-card-background: "rgba(0, 0, 0, 0.0)";
                      --ha-card-box-shadow: 'none';
                      border-radius: 5px;
                    }
                    .info.flex {
                      font-size: 12px !important;
                    }
                  entities:
                    - sensor.rpi4_cpu_temp
                  name: Temperature
                  color_thresholds:
                    - value: 30
                      color: '#3498db'
                    - value: 50
                      color: '#f39c12'
                    - value: 80
                      color: '#ff0000'
      - id: network_debian_status
        type: 'custom:config-template-card'
        variables:
          - 'states[''sensor.network_debian_diskusage''].state'
          - 'states[''sensor.network_debian_memory''].state'
          - 'states[''sensor.network_debian_cpu_load''].state'
          - 'states[''sensor.network_debian_free_space''].state'
          - 'states[''sensor.network_debian_total_space''].state'
          - 'states[''sensor.network_debian_uptime''].state'
        entities:
          - sensor.network_debian_diskusage
          - sensor.network_debian_memory
          - sensor.network_debian_cpu_load
          - sensor.network_debian_free_space
          - sensor.network_debian_total_space
          - sensor.network_debian_uptime
        card:
          type: entities
          show_header_toggle: 'off'
          style: |
            .card-header {
              padding: 0px 0px 0px 0px !important;
            }
          entities:
            - type: section
              label: '${ ''VM --- Debian 10 (buster)'' }'
            - type: 'custom:hui-vertical-stack-card'
              cards:
                - type: horizontal-stack
                  cards:
                    - type: picture
                      style: |
                        ha-card { 
                            --paper-card-background-color: 'rgba(0, 0, 0, 0.0)';
                            --ha-card-background: "rgba(0, 0, 0, 0.0)";
                            --ha-card-box-shadow: 'none';
                        }
                      image: /local/images/debian.jpg
                    - type: 'custom:button-card'
                      layout: icon_name_state2nd
                      show_icon: true
                      show_state: true
                      styles:
                        grid:
                          - grid-template-columns: 50px auto
                        icon:
                          - padding: 0px 0px
                          - height: 30px
                          - width: 30px
                        card:
                          - '--ha-card-background': 'rgba(0, 0, 0, 0.0)'
                          - '--ha-card-box-shadow': none
                        state:
                          - padding: 0px 10px
                          - justify-self: start
                          - font-family: 'Roboto, sans-serif'
                          - font-size: 15px
                        name:
                          - padding: 0px 10px
                          - justify-self: start
                          - color: var(--secondary-text-color)
                      entity: sensor.network_debian_uptime
                      name: Uptime
                      icon: 'mdi:clock-outline'
                - type: 'custom:bar-card'
                  show_icon: true
                  align: split
                  columns: 1
                  max: 100
                  positions:
                    icon: inside
                    indicator: inside
                    name: inside
                    value: inside
                  unit_of_measurement: '%'
                  severity:
                    - value: 50
                      color: '#3498db'
                    - value: 75
                      color: '#f39c12'
                    - value: 100
                      color: '#e45e65'
                  style: |
                    ha-card { 
                        --paper-card-background-color: 'rgba(0, 0, 0, 0.0)';
                        --ha-card-background: "rgba(0, 0, 0, 0.0)";
                        --paper-item-icon-color: 'var(--text-primary-color';
                        --ha-card-box-shadow: 'none';
                    }
                  entities:
                    - entity: sensor.network_debian_diskusage
                  name: '${ ''Disk ('' + vars[3] + ''GB/'' + vars[4] + ''GB)'' }'
                  entity_row: true
                - type: horizontal-stack
                  cards:
                    - type: 'custom:bar-card'
                      show_icon: true
                      align: split
                      columns: 1
                      max: 100
                      positions:
                        icon: inside
                        indicator: inside
                        name: inside
                        value: inside
                      unit_of_measurement: '%'
                      severity:
                        - value: 50
                          color: '#3498db'
                        - value: 75
                          color: '#f39c12'
                        - value: 100
                          color: '#e45e65'
                      style: |
                        ha-card { 
                          --paper-card-background-color: 'rgba(0, 0, 0, 0.0)';
                          --ha-card-background: "rgba(0, 0, 0, 0.0)";
                          --paper-item-icon-color: 'var(--text-primary-color';
                          --ha-card-box-shadow: 'none';
                        }
                      entity: sensor.network_debian_memory
                      name: RAM
                      entity_row: true
                    - type: 'custom:bar-card'
                      show_icon: true
                      align: split
                      columns: 1
                      max: 100
                      positions:
                        icon: inside
                        indicator: inside
                        name: inside
                        value: inside
                      unit_of_measurement: '%'
                      severity:
                        - value: 50
                          color: '#3498db'
                        - value: 75
                          color: '#f39c12'
                        - value: 100
                          color: '#e45e65'
                      style: |
                        ha-card { 
                          --paper-card-background-color: 'rgba(0, 0, 0, 0.0)';
                          --ha-card-background: "rgba(0, 0, 0, 0.0)";
                          --paper-item-icon-color: 'var(--text-primary-color';
                          --ha-card-box-shadow: 'none';
                        }
                      entity: sensor.network_debian_cpu_load
                      name: CPU
                      entity_row: true
      - id: proxmox_status
        type: 'custom:config-template-card'
        variables:
          - 'states[''sensor.proxmox_diskusage''].state'
          - 'states[''sensor.proxmox_memory''].state'
          - 'states[''sensor.proxmox_cpu_load''].state'
          - 'states[''sensor.proxmox_cpu_temp''].state'
          - 'states[''sensor.proxmox_free_space''].state'
          - 'states[''sensor.proxmox_total_space''].state'
          - 'states[''sensor.proxmox_uptime''].state'
        entities:
          - sensor.proxmox_diskusage
          - sensor.proxmox_memory
          - sensor.proxmox_cpu_load
          - sensor.proxmox_cpu_temp
          - sensor.proxmox_free_space
          - sensor.proxmox_total_space
          - sensor.proxmox_uptime
        card:
          type: entities
          show_header_toggle: 'off'
          style: |
            .card-header {
              padding: 0px 0px 0px 0px !important;
            }
          entities:
            - type: section
              label: '${ ''NUC i7 --- Proxmox VE 6.3-3 '' }'
            - type: 'custom:hui-vertical-stack-card'
              cards:
                - type: horizontal-stack
                  cards:
                    - type: picture
                      style: |
                        ha-card { 
                            --paper-card-background-color: 'rgba(0, 0, 0, 0.0)';
                            --ha-card-background: "rgba(0, 0, 0, 0.0)";
                            --ha-card-box-shadow: 'none';
                        }
                      image: /local/images/proxmox.png
                    - type: 'custom:button-card'
                      layout: icon_name_state2nd
                      show_icon: true
                      show_state: true
                      styles:
                        grid:
                          - grid-template-columns: 50px auto
                        icon:
                          - padding: 0px 0px
                          - height: 30px
                          - width: 30px
                        card:
                          - '--ha-card-background': 'rgba(0, 0, 0, 0.0)'
                          - '--ha-card-box-shadow': none
                        state:
                          - padding: 0px 10px
                          - justify-self: start
                          - font-family: 'Roboto, sans-serif'
                          - font-size: 15px
                        name:
                          - padding: 0px 10px
                          - justify-self: start
                          - color: var(--secondary-text-color)
                      entity: sensor.proxmox_uptime
                      name: Uptime
                      icon: 'mdi:clock-outline'
                - type: 'custom:bar-card'
                  show_icon: true
                  align: split
                  columns: 1
                  max: 100
                  positions:
                    icon: inside
                    indicator: inside
                    name: inside
                    value: inside
                  unit_of_measurement: '%'
                  severity:
                    - value: 50
                      color: '#3498db'
                    - value: 75
                      color: '#f39c12'
                    - value: 100
                      color: '#e45e65'
                  style: |
                    ha-card { 
                        --paper-card-background-color: 'rgba(0, 0, 0, 0.0)';
                        --ha-card-background: "rgba(0, 0, 0, 0.0)";
                        --paper-item-icon-color: 'var(--text-primary-color';
                        --ha-card-box-shadow: 'none';
                    }
                  entities:
                    - entity: sensor.proxmox_diskusage
                  name: '${ ''Disk ('' + vars[4] + ''GB/'' + vars[5] + ''GB)'' }'
                  entity_row: true
                - type: horizontal-stack
                  cards:
                    - type: 'custom:bar-card'
                      show_icon: true
                      align: split
                      columns: 1
                      max: 100
                      positions:
                        icon: inside
                        indicator: inside
                        name: inside
                        value: inside
                      unit_of_measurement: '%'
                      severity:
                        - value: 50
                          color: '#3498db'
                        - value: 75
                          color: '#f39c12'
                        - value: 100
                          color: '#e45e65'
                      style: |
                        ha-card { 
                          --paper-card-background-color: 'rgba(0, 0, 0, 0.0)';
                          --ha-card-background: "rgba(0, 0, 0, 0.0)";
                          --paper-item-icon-color: 'var(--text-primary-color';
                          --ha-card-box-shadow: 'none';
                        }
                      entity: sensor.proxmox_memory
                      name: RAM
                      entity_row: true
                    - type: 'custom:bar-card'
                      show_icon: true
                      align: split
                      columns: 1
                      max: 100
                      positions:
                        icon: inside
                        indicator: inside
                        name: inside
                        value: inside
                      unit_of_measurement: '%'
                      severity:
                        - value: 50
                          color: '#3498db'
                        - value: 75
                          color: '#f39c12'
                        - value: 100
                          color: '#e45e65'
                      style: |
                        ha-card { 
                          --paper-card-background-color: 'rgba(0, 0, 0, 0.0)';
                          --ha-card-background: "rgba(0, 0, 0, 0.0)";
                          --paper-item-icon-color: 'var(--text-primary-color';
                          --ha-card-box-shadow: 'none';
                        }
                      entity: sensor.proxmox_cpu_load
                      name: CPU
                      entity_row: true
                - type: 'custom:mini-graph-card'
                  height: 30
                  line_width: 2
                  font_size: 70
                  hours_to_show: 168
                  points_per_hour: 1
                  show:
                    extrema: true
                    fill: true
                  style: |
                    ha-card { 
                      --ha-card-background: "rgba(0, 0, 0, 0.0)";
                      --ha-card-box-shadow: 'none';
                      border-radius: 5px;
                    }
                    .info.flex {
                      font-size: 12px !important;
                    }
                  entities:
                    - sensor.proxmox_cpu_temp
                  name: Temperature
                  color_thresholds:
                    - value: 30
                      color: '#3498db'
                    - value: 50
                      color: '#f39c12'
                    - value: 80
                      color: '#ff0000'
      - id: network_ubuntu_status
        type: 'custom:config-template-card'
        variables:
          - 'states[''sensor.network_ubuntu_diskusage''].state'
          - 'states[''sensor.network_ubuntu_memory''].state'
          - 'states[''sensor.network_ubuntu_cpu_load''].state'
          - 'states[''sensor.network_ubuntu_free_space''].state'
          - 'states[''sensor.network_ubuntu_total_space''].state'
          - 'states[''sensor.network_ubuntu_uptime''].state'
        entities:
          - sensor.network_ubuntu_diskusage
          - sensor.network_ubuntu_memory
          - sensor.network_ubuntu_cpu_load
          - sensor.network_ubuntu_free_space
          - sensor.network_ubuntu_total_space
          - sensor.network_ubuntu_uptime
        card:
          type: entities
          show_header_toggle: 'off'
          style: |
            .card-header {
              padding: 0px 0px 0px 0px !important;
            }
          entities:
            - type: section
              label: '${ ''VM --- Ubuntu 20.04.1 LTS'' }'
            - type: 'custom:hui-vertical-stack-card'
              cards:
                - type: horizontal-stack
                  cards:
                    - type: picture
                      style: |
                        ha-card { 
                            --paper-card-background-color: 'rgba(0, 0, 0, 0.0)';
                            --ha-card-background: "rgba(0, 0, 0, 0.0)";
                            --ha-card-box-shadow: 'none';
                        }
                      image: /local/images/ubuntu.png
                    - type: 'custom:button-card'
                      layout: icon_name_state2nd
                      show_icon: true
                      show_state: true
                      styles:
                        grid:
                          - grid-template-columns: 50px auto
                        icon:
                          - padding: 0px 0px
                          - height: 30px
                          - width: 30px
                        card:
                          - '--ha-card-background': 'rgba(0, 0, 0, 0.0)'
                          - '--ha-card-box-shadow': none
                        state:
                          - padding: 0px 10px
                          - justify-self: start
                          - font-family: 'Roboto, sans-serif'
                          - font-size: 15px
                        name:
                          - padding: 0px 10px
                          - justify-self: start
                          - color: var(--secondary-text-color)
                      entity: sensor.network_ubuntu_uptime
                      name: Uptime
                      icon: 'mdi:clock-outline'
                - type: 'custom:bar-card'
                  show_icon: true
                  align: split
                  columns: 1
                  max: 100
                  positions:
                    icon: inside
                    indicator: inside
                    name: inside
                    value: inside
                  unit_of_measurement: '%'
                  severity:
                    - value: 50
                      color: '#3498db'
                    - value: 75
                      color: '#f39c12'
                    - value: 100
                      color: '#e45e65'
                  style: |
                    ha-card { 
                        --paper-card-background-color: 'rgba(0, 0, 0, 0.0)';
                        --ha-card-background: "rgba(0, 0, 0, 0.0)";
                        --paper-item-icon-color: 'var(--text-primary-color';
                        --ha-card-box-shadow: 'none';
                    }
                  entities:
                    - entity: sensor.network_ubuntu_diskusage
                  name: '${ ''Disk ('' + vars[3] + ''GB/'' + vars[4] + ''GB)'' }'
                  entity_row: true
                - type: horizontal-stack
                  cards:
                    - type: 'custom:bar-card'
                      show_icon: true
                      align: split
                      columns: 1
                      max: 100
                      positions:
                        icon: inside
                        indicator: inside
                        name: inside
                        value: inside
                      unit_of_measurement: '%'
                      severity:
                        - value: 50
                          color: '#3498db'
                        - value: 75
                          color: '#f39c12'
                        - value: 100
                          color: '#e45e65'
                      style: |
                        ha-card { 
                          --paper-card-background-color: 'rgba(0, 0, 0, 0.0)';
                          --ha-card-background: "rgba(0, 0, 0, 0.0)";
                          --paper-item-icon-color: 'var(--text-primary-color';
                          --ha-card-box-shadow: 'none';
                        }
                      entity: sensor.network_ubuntu_memory
                      name: RAM
                      entity_row: true
                    - type: 'custom:bar-card'
                      show_icon: true
                      align: split
                      columns: 1
                      max: 100
                      positions:
                        icon: inside
                        indicator: inside
                        name: inside
                        value: inside
                      unit_of_measurement: '%'
                      severity:
                        - value: 50
                          color: '#3498db'
                        - value: 75
                          color: '#f39c12'
                        - value: 100
                          color: '#e45e65'
                      style: |
                        ha-card { 
                          --paper-card-background-color: 'rgba(0, 0, 0, 0.0)';
                          --ha-card-background: "rgba(0, 0, 0, 0.0)";
                          --paper-item-icon-color: 'var(--text-primary-color';
                          --ha-card-box-shadow: 'none';
                        }
                      entity: sensor.network_ubuntu_cpu_load
                      name: CPU
                      entity_row: true

2 Likes

True, but that only returns the state of a VM.

Liamstears,
Your card looks incredible and this is exactly what I’m looking for. It doesn’t appear to work in my HA. I’ve done the following steps:

  1. Installed all the cards from HACS
  2. Setup the sensor.yaml for get systemmonitor entities and verified they exist
  3. Copied your intel-nuc.png file into /local/images
  4. Rebooted
  5. Added a card “manual”
  6. Copied your yaml into the manual card and saved

It just shows up as a blank card. Even the NUC icon doesn’t show up. No error messages. Any ideas? Or maybe I’m not looking in the right place for error messages.

One of the entities at the top of the yaml doesn’t exist on your system

Delete them 1 at a time from both the entities and variables section at the top of the card yaml and the card will show when the entity that doesn’t exist is removed

When you know which one it is you can fix it from there

In chrome, hit f12. Error should be in the lower right corner

Thanks, this worked and I figured it out.

Thanks @Hs82H,

I’m a bit further now and installed the script. Only error is with getting the cpuload.
Any idea what could solve this?

root@proxmox:/home/user/proxmox-monitor# /usr/bin/python3 ./proxmox-monitor.py                                                 
Traceback (most recent call last):                                                                                             
  File "./proxmox-monitor.py", line 140, in <module>                                                                           
    cpu_load = check_cpu_load()                                                                                                
  File "./proxmox-monitor.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'                                                                          
root@proxmox:/home/user/proxmox-monitor#

The code in the script:

def check_cpu_load():
                # bash command to get cpu load from uptime command
                p = subprocess.Popen("uptime", shell=True, stdout=subprocess.PIPE).communicate()[0]
                cores = subprocess.Popen("nproc", shell=True, stdout=subprocess.PIPE).communicate()[0]
                cpu_load = p.split("average:")[1].split(",")[0].replace(' ', '')
                cpu_load = float(cpu_load)/int(cores)*100
                cpu_load = round(float(cpu_load), 1)
                return cpu_load

change your strings to bytes, put a b in front of every string e.g. b'average:', b',', etc