System Monitoring - How does yours look?

Nice to know, the GPU is an on-chip graphics processing unit (GPU) according to Wikipedia so temps are always going to be pretty much the same.

I’m using glances and HA dockermon.

- platform: glances
  host: localhost
  name: CoreOS
  version: 3
  resources:
    - 'disk_use'
    - 'disk_use_percent'
    - 'disk_free'
    - 'cpu_temp'
    - 'processor_load'
    - 'memory_use'
    - 'memory_use_percent'
    - 'memory_free'
    - 'docker_active'
    - 'docker_cpu_use'
    - 'docker_memory_use'
3 Likes

Relevant thread I found very helpful.

Edit. Just realized @klogg already posted in this thread!

I found glances to be very useful to monitor which addons were dogging the system on Hassio. It’s also the only way I’ve found to get the CPU temp with Hassio on an RPi. I don’t run it all the time though because I found it tended it be a bit of a resource hog itself.

configuration file: https://github.com/Limych/HomeAssistantConfiguration/blob/master/lovelace/30_system_info_view.yaml

5 Likes

I stand corrected thanks @klogg. This works with no muss, no fuss.

  - platform: command_line
    name: RPi CPU Temperature
    command: "cat /sys/class/thermal/thermal_zone0/temp"
    value_template: "{{ value | multiply(0.001) | round(2) }}"
2 Likes

@cwhits what is the yaml code for locking the service on the right side of your card?

@ghvader
Allow me…
It is the toggle-lock-entity-row - GitHub - thomasloven/lovelace-toggle-lock-entity-row
Look at some of @thomasloven other cards, they are all excellent.

It’s a pleasure, I wish I could say it was my idea… I forget now who I got that from.

1 Like

Can you share the sensors as well :slight_smile:?
Also, where do you save the Rpi and HA uptime?

1 Like

@Yoinkz

#============
#=== Sensors
#============
sensor:

  #===========================================
  #=== Latest Sonoff Tasmota firmware version
  #===========================================
  - platform: command_line
    name: Tasmota Current Version
    command: "curl -s https://github.com/arendst/Sonoff-Tasmota/releases/latest | cut -d'\"' -f2 | rev | cut -d'/' -f1 | rev"
    scan_interval: 86400

  #==============================
  #=== Installed hass.io version
  #==============================
  - platform: version
    name: Installed Version
    source: local


  #================================
  #=== Latest Available HA Version
  #================================
  - platform: version
    name: Latest Available Version
    beta: false
    image: raspberrypi3
    source: hassio


  #=======================
  #=== Raspberry Pi Power
  #=======================
  - platform: rpi_power
    text_state: True


  #=============================================
  #=== Last boot time, Disk, memory & CPU usage
  #=============================================
  - platform: systemmonitor
    resources:
      - type: last_boot
      - type: disk_use_percent
        arg: /
      - type: memory_use_percent
      - type: processor_use

  
  #====================
  #=== CPU Temperature
  #====================
  - platform: command_line
    name: CPU Temp
    command: "cat /sys/class/thermal/thermal_zone0/temp"
    unit_of_measurement: "°C"
    value_template: '{{ value | multiply(0.001) | round(0) }}'


  #===================
  #=== System Up Time
  #===================
  - platform: uptime


  - platform: template
    sensors:

      #==========================
      #=== Home Assistant uptime
      #==========================
      ha_uptime:
        friendly_name: HA Uptime
        value_template: >
          {% if states('sensor.uptime') == '0.0' %} 
            Just restarted...
          {% else %}
            {% macro phrase(value, name) %}
            {%- set value = value | int %}
            {%- set end = 's' if value > 1 else '' %}
            {{- '{} {}{}'.format(value, name, end) if value | int > 0 else '' }}
            {%- endmacro %}
            
            {% set weeks = (states('sensor.uptime') | int / 7) | int %}
            {% set days = (states('sensor.uptime') | int) - (weeks * 7) %}
            {% set hours = (states('sensor.uptime') | float - states('sensor.uptime') | int) * 24 %}
            {% set minutes = (hours - hours | int) * 60 %}

            {{ [ phrase(weeks, 'week'), phrase(days, 'day'), phrase(hours, 'hr'), phrase(minutes, 'min') ] | select('!=','') | list | join(', ') }}
          {% endif %}


      #=========================================
      #=== Raspberry Pi last boot date and time
      #=========================================
      last_boot_date_time:
        friendly_name: Last Boot
        value_template: >
          {% set date = as_timestamp(states('sensor.last_boot')) | timestamp_custom('%d') %}
          {% set date = '{:01}'.format(date | int) %}
          {% if date in ('1', '21', '31') %}
            {% set date = date ~ 'st' %}
          {% elif date in ('2', '22') %}
            {% set date = date ~ 'nd' %}
          {% elif date in ('3', '23') %}
            {% set date = date ~ 'rd' %}
          {% else %}
            {% set date = date ~ 'th' %}
          {% endif %}

          {{ as_timestamp(states('sensor.last_boot')) | timestamp_custom('%H:%M on %a') }} {{ date }} {{ as_timestamp(states('sensor.last_boot')) | timestamp_custom('%b %Y') }}


      #=========================
      #=== Raspberry Pi Up Time
      #=========================
      rpi_uptime:
        friendly_name: RPi Uptime
        entity_id: sensor.time
        value_template: >
          {% set up_time = as_timestamp(now()) - as_timestamp(states('sensor.last_boot')) %}

          {% set minutes = (up_time // 60) | int %}
          {% set hours = (minutes // 60) %}
          {% set days = (hours // 24) %}
          {% set weeks = (days // 7) %}

          {% set minutes = (minutes % 60) %}
          {% set hours =  (hours % 24) %}
          {% set days = (days % 7) %}

          {% macro phrase(value, name) %}
                    {%- set value = value %}
                    {%- set end = 's' if value > 1 else '' %}
                    {{- '{} {}{}'.format(value, name, end) if value | int > 0 else '' }}
          {%- endmacro %}
                    
          {% set text = [ phrase(weeks, 'week'), phrase(days, 'day'), phrase(hours, 'hr'), phrase(minutes, 'min') ] | select('!=','') | list | join(', ') %}
          {% set last_comma = text.rfind(',') %}
          {% if last_comma != -1 %}
            {% set text = text[:last_comma] + ' and' + text[last_comma + 1:] %}
          {% endif %}
          
          {{ text }}
18 Likes

How did you do your component count? Thats a great idea

EDIT: A much better way, courtesy of @petro is further down this thread.
Here --> System Monitoring - How does your look?


#====================================
#=== Home Assistant Component counts
#====================================
sensor:
  - platform: template
    sensors:

    #----- Count Automations
      count_automations:
        entity_id: sensor.date
        value_template: >
          {%- set domains = ['automation'] -%}
          {%- for domain in domains -%}
            {%- for item in states[domain] -%}
              {% if loop.first %}
                {{loop.length}}
              {% endif %}
            {%- endfor -%}
          {%- endfor -%}

    #----- Count Scripts
      count_scripts:
        entity_id: sensor.date
        value_template: >
          {%- set domains = ['script'] -%}
          {%- for domain in domains -%}
            {%- for item in states[domain] -%}
              {% if loop.first %}
                {{loop.length}}
              {% endif %}
            {%- endfor -%}
          {%- endfor -%}

    #----- Count Device Trackers
      count_device_trackers:
        entity_id: sensor.date
        value_template: >
          {%- set domains = ['device_tracker'] -%}
          {%- for domain in domains -%}
            {%- for item in states[domain] -%}
              {% if loop.first %}
                {{loop.length}}
              {% endif %}
            {%- endfor -%}
          {%- endfor -%}        

    #----- Count Binary Sensors
      count_binary_sensors:
        entity_id: sensor.date
        value_template: >
          {%- set domains = ['binary_sensor'] -%}
          {%- for domain in domains -%}
            {%- for item in states[domain] -%}
              {% if loop.first %}
                {{loop.length}}
              {% endif %}
            {%- endfor -%}
          {%- endfor -%}

    #----- Count Sensors
      count_sensors:
        entity_id: sensor.date
        value_template: >
          {%- set domains = ['sensor'] -%}
          {%- for domain in domains -%}
            {%- for item in states[domain] -%}
              {% if loop.first %}
                {{loop.length}}
              {% endif %}
            {%- endfor -%}
          {%- endfor -%}

    #----- Count Switches
      count_switches:
        entity_id: sensor.date
        value_template: >
          {%- set domains = ['switch'] -%}
          {%- for domain in domains -%}
            {%- for item in states[domain] -%}
              {% if loop.first %}
                {{loop.length}}
              {% endif %}
            {%- endfor -%}
          {%- endfor -%}

    #----- Count Zones
      count_zones:
        entity_id: sensor.date
        value_template: >
          {%- set domains = ['zone'] -%}
          {%- for domain in domains -%}
            {%- for item in states[domain] -%}
              {% if loop.first %}
                {{loop.length}}
              {% endif %}
            {%- endfor -%}
          {%- endfor -%}

    #----- Input Booleans
      count_input_booleans:
        entity_id: sensor.date
        value_template: >
          {%- set domains = ['input_boolean'] -%}
          {%- for domain in domains -%}
            {%- for item in states[domain] -%}
              {% if loop.first %}
                {{loop.length}}
              {% endif %}
            {%- endfor -%}
          {%- endfor -%}

    #----- Input Numbers
      count_input_numbers:
        entity_id: sensor.date
        value_template: >
          {%- set domains = ['input_number'] -%}
          {%- for domain in domains -%}
            {%- for item in states[domain] -%}
              {% if loop.first %}
                {{loop.length}}
              {% endif %}
            {%- endfor -%}
          {%- endfor -%}

    #----- Input Texts
      count_input_texts:
        entity_id: sensor.date
        value_template: >
          {%- set domains = ['input_text'] -%}
          {%- for domain in domains -%}
            {%- for item in states[domain] -%}
              {% if loop.first %}
                {{loop.length}}
              {% endif %}
            {%- endfor -%}
          {%- endfor -%}

    #----- Input Selects
      count_input_selects:
        entity_id: sensor.date
        value_template: >
          {%- set domains = ['input_select'] -%}
          {%- for domain in domains -%}
            {%- for item in states[domain] -%}
              {% if loop.first %}
                {{loop.length}}
              {% endif %}
            {%- endfor -%}
          {%- endfor -%}

    #----- Input Date Times
      count_input_datetimes:
        entity_id: sensor.date
        value_template: >
          {%- set domains = ['input_datetime'] -%}
          {%- for domain in domains -%}
            {%- for item in states[domain] -%}
              {% if loop.first %}
                {{loop.length}}
              {% endif %}
            {%- endfor -%}
          {%- endfor -%}
17 Likes

Your memory usage if quite low compared to mine, are you using the free command to get memory usage or some other way?

@klogg

Thanks - much appreciated !

1 Like

No, not as far as I know! I am running hassio on an RPi3 so even if I new Linux I wouldn’t be able to run any native commands.

Gives me this error:

Platform not found: sensor.rpi_power

you’ll have to install the component manually

4 Likes

:wink: Thanks!

What about your icons (customize.yaml)?

I think they are all set in Lovelace… which ones are you missing?