System Monitoring - How does yours look?

Thanks all for the inspiration, now I just need to create a dashboard for everything else

type: custom:stack-in-card
keep:
  border_radius: true
  margin: true
cards:
  - type: custom:button-card
    name: Network Server
    entity_picture: /local/images/raspberry-pi.png
    show_name: true
    show_entity_picture: true
    styles:
      card:
        - padding: 5px
        - border: 0px
      grid:
        - grid-template-areas: '"n i"'
        - grid-template-columns: 3fr 1fr
      name:
        - justify-self: start
        - padding-left: 20px
        - font-size: 30px
        - font-weight: 300
  - type: horizontal-stack
    cards:
      - type: custom:mini-graph-card
        entities:
          - sensor.networkserver_cpu_usage
        hours_to_show: 24
        points_per_hour: 2
        hour24: true
        animate: true
        height: 150
        show:
          extrema: true
          icon: false
          name: false
        color_thresholds:
          - value: 100
            color: '#d32f2f'
          - value: 90
            color: '#ffa000'
          - value: 75
            color: '#388e3c'
        card_mod:
          style: |
            ha-card .states.flex{
              padding-bottom: 0px;
              }
            ha-card .graph{
              margin-top: 0px !important;
            }
            ha-card .graph .graph__legend{
              padding-bottom: 0px !important;
            }
            ha-card .info.flex{
              padding-bottom: 0px !important;
            }
      - type: custom:mini-graph-card
        entities:
          - sensor.networkserver_temperature
        hours_to_show: 24
        points_per_hour: 2
        hour24: true
        animate: true
        height: 150
        show:
          extrema: true
          icon: false
          name: false
        color_thresholds:
          - value: 100
            color: '#d32f2f'
          - value: 85
            color: '#ffa000'
          - value: 60
            color: '#388e3c'
        card_mod:
          style: |
            ha-card .states.flex{
              padding-bottom: 0px;
              }
            ha-card .graph{
              margin-top: 0px !important;
            }
            ha-card .graph .graph__legend{
              padding-bottom: 0px !important;
            }
            ha-card .info.flex{
              padding-bottom: 0px !important;
            }
  - type: horizontal-stack
    cards:
      - type: custom:bar-card
        entities:
          - sensor.networkserver_cpu_usage
        name: CPU Usage
        positions:
          icon: 'off'
          name: inside
          value: inside
          indicator: inside
        severity:
          - color: '#d32f2f'
            from: 90
            to: 100
          - color: '#ffa000'
            from: 75
            to: 90
          - color: '#388e3c'
            from: 0
            to: 75
        card_mod:
          style: |
            bar-card-backgroundbar {
              border-radius: 8px;
            }
            bar-card-currentbar {
              border-radius: 8px;
            }
      - type: custom:bar-card
        entities:
          - sensor.networkserver_temperature
        name: CPU Temp
        positions:
          icon: 'off'
          name: inside
          value: inside
          indicator: inside
        severity:
          - color: '#d32f2f'
            from: 85
            to: 100
          - color: '#ffa000'
            from: 60
            to: 85
          - color: '#388e3c'
            from: 0
            to: 60
        card_mod:
          style: |
            bar-card-backgroundbar {
              border-radius: 8px;
            }
            bar-card-currentbar {
              border-radius: 8px;
            }
  - type: horizontal-stack
    cards:
      - type: custom:bar-card
        entities:
          - entity: sensor.networkserver_load_1m
            name: Load 1m
          - entity: sensor.networkserver_load_5m
            name: Load 5m
          - entity: sensor.networkserver_load_15m
            name: Load 15m
        stack: horizontal
        max: 4
        severity:
          - color: '#d32f2f'
            from: 2
            to: 4
          - color: '#ffa000'
            from: 1
            to: 2
          - color: '#388e3c'
            from: 0
            to: 1
        positions:
          icon: 'off'
          name: inside
          value: inside
          indicator: inside
        card_mod:
          style: |
            bar-card-card{
              margin-right: 20px
            }
            bar-card-backgroundbar {
              border-radius: 8px;
            }
            bar-card-currentbar {
              border-radius: 8px;
            }
  - type: custom:bar-card
    entities:
      - sensor.networkserver_memory_use
    name: Memory Usage
    width: 70%
    positions:
      icon: 'off'
      name: inside
      value: inside
      indicator: inside
    severity:
      - color: '#d32f2f'
        from: 90
        to: 100
      - color: '#ffa000'
        from: 75
        to: 90
      - color: '#388e3c'
        from: 0
        to: 75
    card_mod:
      style: |
        bar-card-backgroundbar {
          border-radius: 8px;
        }
        bar-card-currentbar {
          border-radius: 8px;
        }
  - type: custom:bar-card
    entities:
      - sensor.networkserver_disk_use
    name: Disk Usage
    width: 70%
    positions:
      icon: 'off'
      name: inside
      value: inside
      indicator: inside
    severity:
      - color: '#d32f2f'
        from: 90
        to: 100
      - color: '#ffa000'
        from: 75
        to: 90
      - color: '#388e3c'
        from: 0
        to: 75
    card_mod:
      style: |
        bar-card-backgroundbar {
          border-radius: 8px;
        }
        bar-card-currentbar {
          border-radius: 8px;
        }
  - type: custom:mini-graph-card
    entities:
      - entity: sensor.networkserver_network_download
        color: '#91C0F8'
        name: Download
      - entity: sensor.networkserver_network_upload
        color: '#ffa000'
        name: Upload
        show_state: true
    hours_to_show: 24
    points_per_hour: 2
    height: 75
    animate: true
    line_width: 2.5
    show:
      name: false
      icon: false
    card_mod:
      style: |
        ha-card .graph{
          margin-top: -15px !important;
        }
        ha-card .graph .graph__legend{
          padding-bottom: 0px !important;
        }
  - type: entities
    entities:
      - entity: sensor.networkserver_uptime
        name: Uptime
      - entity: sensor.networkserver_updates
        name: Packages
      - type: custom:fold-entity-row
        head:
          type: section
          label: Server Details
        card_mod:
          style:
            hui-sensor-entity-row:
              $ hui-generic-entity-row $: |
                .pointer{
                  color: #91C0F8;
                }
                .text-content{
                  color: #e1e1e1;
                }
            hui-simple-entity-row:
              $ hui-generic-entity-row $: |
                .pointer{
                  color: #91C0F8;
                }
                .text-content{
                  color: #e1e1e1;
                }
        entities:
          - entity: sensor.networkserver_hostname
            name: Hostname
          - entity: sensor.networkserver_host_ip
            name: IP Address
          - entity: sensor.networkserver_host_os
            name: OS
          - entity: sensor.networkserver_host_kernel
            name: Kernel
          - entity: sensor.networkserver_host_platform
            name: Platform
          - entity: sensor.networkserver_host_architecture
            name: Architecture
          - entity: binary_sensor.networkserver_under_voltage
            name: Power
          - entity: sensor.networkserver_last_message
            name: Last Refresh
    card_mod:
      style:
        hui-sensor-entity-row:
          $ hui-generic-entity-row $: |
            .pointer{
              color: #91C0F8;
            }
            .text-content{
              color: #e1e1e1;
            }
14 Likes

Great looking dashboard, kudos for sharing the code.

me too, would love to see the code plz

You can grab the above code copy+paste it all for the Network Server. Then copy paste for your other 3 servers and change the entities. That’ll make the total of 4.

type: custom:stack-in-card
keep:
  border_radius: true
  margin: true
cards:
  - type: custom:button-card
    name: **Network Server**
    entity_picture: /local/images/raspberry-pi.png
    show_name: true
    show_entity_picture: true
    styles:
etc
etc
etc

Hope to be of some help. Good luck!

2 Likes

I know this old, but can you share how you use the pythonscripts for this?
want to do it with windows and linux systems.
thanks for your help

Sure for the setup you can check this post.

To get the actual sensors, I isolated things in separate configuration file stored in /config/sensors_sys_monitoring.yaml

# 1NUC (Linux machine)
- platform: systemmonitor
  resources:
    - type: disk_use_percent
      arg: /
    - type: disk_use
      arg: /
    - type: disk_free
      arg: /
    - type: memory_use_percent
    - type: memory_use
    - type: memory_free
    - type: swap_use_percent
    - type: swap_use
    - type: swap_free
    - type: processor_use
    - type: processor_temperature
    - type: last_boot

- platform: python_script
  name: 1NUC Updates
  unique_id: "1nuc_updates"
  icon: mdi:package-up
  scan_interval: 120
  file: scripts/remote_ssh_command.py
  host: !secret 1nuc_host
  port: !secret 1nuc_port
  user: "amilino"
  pass: !secret 1nuc_amilino_password
  cmd: >
    cat /home/amilino/updatestatus.log

- platform: python_script
  name: 1NUC Model
  unique_id: "1nuc_model"
  icon: mdi:desktop-tower
  scan_interval: 63072000 #2 Years in seconds
  file: scripts/remote_ssh_command.py
  host: !secret 1nuc_host
  port: !secret 1nuc_port
  user: "amilino"
  pass: !secret 1nuc_amilino_password
  cmd: >
    sudo dmidecode -s system-product-name

- platform: python_script
  name: 1NUC Distribution
  unique_id: "1nuc_distribution"
  icon: mdi:monitor
  scan_interval: 63072000 #2 Years in seconds
  file: scripts/remote_ssh_command.py
  host: !secret 1nuc_host
  port: !secret 1nuc_port
  user: "amilino"
  pass: !secret 1nuc_amilino_password
  cmd: >
    grep -Po "(?<=^PRETTY_NAME=).+" /etc/os-release | sed 's/"//g'

- platform: python_script
  name: 1NUC Kernel
  unique_id: "1nuc_kernel"
  icon: mdi:developer-board
  scan_interval: 63072000 #2 Years in seconds
  file: scripts/remote_ssh_command.py
  host: !secret 1nuc_host
  port: !secret 1nuc_port
  user: "amilino"
  pass: !secret 1nuc_amilino_password
  cmd: >
    uname -msr

- platform: python_script
  name: 1NUC Processor
  unique_id: "1nuc_processor"
  icon: mdi:chip
  scan_interval: 63072000 #2 Years in seconds
  file: scripts/remote_ssh_command.py
  host: !secret 1nuc_host
  port: !secret 1nuc_port
  user: "amilino"
  pass: !secret 1nuc_amilino_password
  cmd: >
    grep -m 1 "model name" /proc/cpuinfo | sed -e "s/^.*: //"

- platform: python_script
  name: 1NUC Processor speed
  unique_id: "1nuc_processor_speed"
  unit_of_measurement: MHz
  icon: mdi:rotate-360
  scan_interval: 15
  file: scripts/remote_ssh_command.py
  host: !secret 1nuc_host
  port: !secret 1nuc_port
  user: "amilino"
  pass: !secret 1nuc_amilino_password
  cmd: >
    lscpu | grep "CPU MHz" | sed -e "s/^.*: //" | awk '{printf("%.f \n",$1)}'

- platform: python_script
  name: 1NUC Processor voltage
  unique_id: "1nuc_processor_voltage"
  unit_of_measurement: V
  icon: mdi:lightning-bolt-outline
  scan_interval: 15
  file: scripts/remote_ssh_command.py
  host: !secret 1nuc_host
  port: !secret 1nuc_port
  user: "amilino"
  pass: !secret 1nuc_amilino_password
  cmd: >
    sudo dmidecode --type processor | grep "Voltage" | grep -Eo "[0-9]+\.[0-9]+"

- platform: python_script
  name: 1NUC Processor mem x86_64
  unique_id: "1nuc_processor_mem_x86_64"
  unit_of_measurement: MiB
  icon: mdi:memory
  scan_interval: 15
  file: scripts/remote_ssh_command.py
  host: !secret 1nuc_host
  port: !secret 1nuc_port
  user: "amilino"
  pass: !secret 1nuc_amilino_password
  cmd: >
    helper_functions -kb2mborgb $(grep "Slab" /proc/meminfo | grep -Eo "[0-9]+") | sed 's/M//' | awk '{printf("%.f \n",$1)}'

- platform: python_script
  name: 1NUC Processor mem gpu
  unique_id: "1nuc_processor_mem_gpu"
  unit_of_measurement: MiB
  icon: mdi:expansion-card
  scan_interval: 15
  file: scripts/remote_ssh_command.py
  host: !secret 1nuc_host
  port: !secret 1nuc_port
  user: "amilino"
  pass: !secret 1nuc_amilino_password
  cmd: >
    lspci -v -s 00:02.0 | grep " prefetchable" | grep -Eo "[0-9]+[0-9]+[0-9]M" | sed 's/M//'

- platform: python_script
  name: 1NUC Processor scaling governor
  unique_id: "1nuc_processor_scaling_governor"
  icon: mdi:scale-balance
  scan_interval: 15
  file: scripts/remote_ssh_command.py
  host: !secret 1nuc_host
  port: !secret 1nuc_port
  user: "amilino"
  pass: !secret 1nuc_amilino_password
  cmd: >
    cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

- platform: python_script
  name: 1NUC Top Processes cpu usage
  unique_id: "1nuc_processes_cpu_usage"
  scan_interval: 15
  file: scripts/remote_ssh_command.py
  host: !secret 1nuc_host
  port: !secret 1nuc_port
  user: "amilino"
  pass: !secret 1nuc_amilino_password
  cmd: >
    top -b -n 1 | grep -ve "jq" -ve "top" | awk 'FNR>=6 && FNR<=10{print $12, $9}' | jq -nR '{"return": [inputs | split(" ") | { "proc": .[0], "usage": .[1] }]}'

- platform: python_script
  name: 1NUC Top Processes memory usage
  unique_id: "1nuc_processes_memory_usage"
  scan_interval: 15
  file: scripts/remote_ssh_command.py
  host: !secret 1nuc_host
  port: !secret 1nuc_port
  user: "amilino"
  pass: !secret 1nuc_amilino_password
  cmd: >
    top -o %MEM -b -n 1 | grep -ve "jq" -ve "top" | awk 'FNR>=6 && FNR<=10{print $12, $10}' | jq -nR '{"return": [inputs | split(" ") | { "proc": .[0], "usage": .[1] }]}'

- platform: python_script
  name: 1NUC Processes
  unique_id: "1nuc_processes"
  scan_interval: 15
  file: scripts/remote_ssh_command.py
  host: !secret 1nuc_host
  port: !secret 1nuc_port
  user: "amilino"
  pass: !secret 1nuc_amilino_password
  cmd: >
    sudo ps -N --format comm,etime,cmd | grep -v grep | grep -w "/usr/bin/kodi\|webgrabplus" | awk '{print $1, $2}' | jq -nR '{"return": [inputs | split(" ") | { "proc": .[0], "etime": .[1] }]}'

- platform: python_script
  name: 1NUC Services
  unique_id: "1nuc_services"
  scan_interval: 15
  file: scripts/remote_ssh_command.py
  host: !secret 1nuc_host
  port: !secret 1nuc_port
  user: "amilino"
  pass: !secret 1nuc_amilino_password
  cmd: > 
    for i in "smbd" "ssh" "xrdp"; do printf "$i\t"; sudo service "$i" status | grep "Active: " | sed -e "s/^.*; //"; done | jq -nR '{"return": [inputs | split("\t") | { "service": .[0], "etime": .[1] }]}'

# 2NUC (Windows machine)
- platform: python_script
  name: 2NUC Processor
  unique_id: "2nuc_processor"
  icon: mdi:chip
  scan_interval: 63072000 #2 Years in seconds
  file: scripts/remote_ssh_command.py
  host: !secret 2nuc_host
  port: !secret 2nuc_port
  user: "amilino"
  pass: !secret 2nuc_amilino_password
  cmd: >
    wmic CPU get NAME | more +1

- platform: python_script
  name: 2NUC Model
  unique_id: "2nuc_model"
  icon: mdi:desktop-tower
  scan_interval: 63072000 #2 Years in seconds
  file: scripts/remote_ssh_command.py
  host: !secret 2nuc_host
  port: !secret 2nuc_port
  user: "amilino"
  pass: !secret 2nuc_amilino_password
  cmd: >
    powershell (Get-WmiObject -Class:Win32_ComputerSystem).Model

- platform: python_script
  name: 2NUC Distribution
  unique_id: "2nuc_distribution"
  icon: mdi:monitor
  scan_interval: 63072000 #2 Years in seconds
  file: scripts/remote_ssh_command.py
  host: !secret 2nuc_host
  port: !secret 2nuc_port
  user: "amilino"
  pass: !secret 2nuc_amilino_password
  cmd: >
    powershell (Get-WmiObject -class Win32_OperatingSystem).Caption

- platform: python_script
  name: 2NUC Processor use
  unique_id: "2nuc_processor_use"
  icon: mdi:cpu-64-bit
  unit_of_measurement: '%'
  scan_interval: 15
  file: scripts/remote_ssh_command.py
  host: !secret 2nuc_host
  port: !secret 2nuc_port
  user: "amilino"
  pass: !secret 2nuc_amilino_password
  cmd: >
    powershell c:\\SystemMonitoring\\processor_use.ps1

- platform: python_script
  name: 2NUC Processor temperature
  unique_id: "2nuc_processor_temperature"
  icon: mdi:thermometer
  unit_of_measurement: 'ºC'
  scan_interval: 15
  file: scripts/remote_ssh_command.py
  host: !secret 2nuc_host
  port: !secret 2nuc_port
  user: "amilino"
  pass: !secret 2nuc_amilino_password
  cmd: >
    powershell c:\\SystemMonitoring\\processor_temperature.ps1

- platform: python_script
  name: 2NUC Memory use percent
  unique_id: "2nuc_memory_use_percent"
  icon: mdi:memory
  unit_of_measurement: '%'
  scan_interval: 15
  file: scripts/remote_ssh_command.py
  host: !secret 2nuc_host
  port: !secret 2nuc_port
  user: "amilino"
  pass: !secret 2nuc_amilino_password
  cmd: >
    powershell c:\\SystemMonitoring\\memory_use_percent.ps1

- platform: python_script
  name: 2NUC Memory use
  unique_id: "2nuc_memory_use"
  icon: mdi:memory
  unit_of_measurement: 'MiB'
  scan_interval: 15
  file: scripts/remote_ssh_command.py
  host: !secret 2nuc_host
  port: !secret 2nuc_port
  user: "amilino"
  pass: !secret 2nuc_amilino_password
  cmd: >
    powershell c:\\SystemMonitoring\\memory_use.ps1

- platform: python_script
  name: 2NUC Memory free
  unique_id: "2nuc_memory_free"
  icon: mdi:memory
  unit_of_measurement: 'MiB'
  scan_interval: 15
  file: scripts/remote_ssh_command.py
  host: !secret 2nuc_host
  port: !secret 2nuc_port
  user: "amilino"
  pass: !secret 2nuc_amilino_password
  cmd: >
    powershell c:\\SystemMonitoring\\memory_free.ps1

- platform: python_script
  name: 2NUC Last boot
  unique_id: "2nuc_last_boot"
  icon: mdi:clock
  scan_interval: 15
  file: scripts/remote_ssh_command.py
  host: !secret 2nuc_host
  port: !secret 2nuc_port
  user: "amilino"
  pass: !secret 2nuc_amilino_password
  cmd: >
    powershell c:\\SystemMonitoring\\last_boot.ps1

After you created file you need to add this into /config/configuration.yaml
sensor sys monitoring: !include sensors_sys_monitoring.yaml

For windows machine I created powershell files on windows machine itself (you also need OpenHardwareMonitor running in the background).
processor_use.ps1

# Check if Open Hardware Monitor is running.
if ((Get-Process -Name OpenHardwareMonitor -ErrorAction SilentlyContinue) -eq $null) {
    write-host 'OpenHardwareMonitor.exe not running!'
    exit 3
}

# Get the temperatures from all the found sensors and check them
$temperatures = Get-WmiObject -Namespace "Root\OpenHardwareMonitor" -Query "SELECT value FROM Sensor WHERE Name LIKE '%CPU Total%' AND Sensortype='Load'" | sort-object Identifier | select -First 1

$temperature_string = foreach ($result in $temperatures){
    '{0}' -f [math]::Round($result.Value)
}
 
write-host "$temperature_string"
exit 00

processor_temperature.ps1

# Check if Open Hardware Monitor is running.
if ((Get-Process -Name OpenHardwareMonitor -ErrorAction SilentlyContinue) -eq $null) {
    write-host 'OpenHardwareMonitor.exe not running!'
    exit 3
}

# Get the temperatures from all the found sensors and check them
$temperatures = Get-WmiObject -Namespace "Root\OpenHardwareMonitor" -Query "SELECT value FROM Sensor WHERE Name LIKE '%CPU Core%' AND Sensortype='Temperature'" | sort-object Identifier | select -First 1

$temperature_string = foreach ($result in $temperatures){
    '{0}' -f $result.Value
}
 
write-host "$temperature_string"
exit 0

memory_use_percent.ps1

# Check if Open Hardware Monitor is running.
if ((Get-Process -Name OpenHardwareMonitor -ErrorAction SilentlyContinue) -eq $null) {
    write-host 'OpenHardwareMonitor.exe not running!'
    exit 3
}

# Get the temperatures from all the found sensors and check them
$values= Get-WmiObject -Namespace "Root\OpenHardwareMonitor" -Query "SELECT value FROM Sensor WHERE Name = 'Memory' AND Sensortype='Load'" | sort-object Identifier | select -First 1

$value_string = foreach ($result in $values){
    '{0}' -f [math]::Round($result.Value,1) -Replace ',','.'
}
 
write-host "$value_string"
exit 0

memory_use.ps1

# Check if Open Hardware Monitor is running.
if ((Get-Process -Name OpenHardwareMonitor -ErrorAction SilentlyContinue) -eq $null) {
    write-host 'OpenHardwareMonitor.exe not running!'
    exit 3
}

# Get the temperatures from all the found sensors and check them
$values= Get-WmiObject -Namespace "Root\OpenHardwareMonitor" -Query "SELECT value FROM Sensor WHERE Name = 'Used Memory' AND Sensortype='Data'" | sort-object Identifier | select -First 1

$value_string = foreach ($result in $values){
    '{0}' -f [math]::Round($result.Value*1024,1) -Replace ',','.'
}
 
write-host "$value_string"
exit 0

memory_free.ps1

# Check if Open Hardware Monitor is running.
if ((Get-Process -Name OpenHardwareMonitor -ErrorAction SilentlyContinue) -eq $null) {
    write-host 'OpenHardwareMonitor.exe not running!'
    exit 3
}

# Get the temperatures from all the found sensors and check them
$values= Get-WmiObject -Namespace "Root\OpenHardwareMonitor" -Query "SELECT value FROM Sensor WHERE Name = 'Available Memory' AND Sensortype='Data'" | sort-object Identifier | select -First 1

$value_string = foreach ($result in $values){
    '{0}' -f [math]::Round($result.Value*1024,1) -Replace ',','.'
}
 
write-host "$value_string"
exit 0

last_boot.ps1

$os = Get-WmiObject -Class win32_operatingsystem 
$os.ConvertToDateTime($os.LastBootUpTime).ToString('yyyy-MM-ddTHH:mm:ss+00:00')

Let me know if you need as well code for the lovelace card.

1 Like

I have been using similar to your code for several years. They always worked well until 2023.4.x (not sure which release caused it to fail. Does yours still work?

I’m afraid I can’t say. I don’t use that anymore and I haven’t for a long, long time!

1 Like

If have been using the following code for a couple of years with no issues until core 2023.4x was released. Not sure which of the updates cause it to fail.

  - type: markdown
    title: Are Updates Available?
    card_mod:
      style: |
        :host {
          --card-mod-icon-color: #42a5f5;
          font-size: 1.1em;
        }
    content: |
      <ha-icon icon="mdi:home-assistant"></ha-icon>&nbsp;&nbsp;&nbsp;Add-ons needing update: &nbsp;&nbsp; {{ states('sensor.supervisor_updates') | default }}
      > {% for addon in state_attr('sensor.supervisor_updates', 'addons') %}
      >   &nbsp;&nbsp;{{ addon.name }}&nbsp; {{ addon.version }} -> {{ addon.version_latest }}
      > {% endfor %}
      
      <ha-icon icon="hacs:hacs"></ha-icon>&nbsp;&nbsp;&nbsp;HACS updates available: &nbsp;&nbsp; {{ states('sensor.hacs') | default }}
      > {% for repo in state_attr('sensor.hacs', 'repositories') %}
      >   &nbsp;&nbsp;{{ repo.display_name }} {{ repo["installed_version"] }} -> {{ repo["available_version"] }}
      > {% endfor %}
      
      |          |    Current | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Latest |
      |--- |:---: |:---: |:---: |
      | **Supervisor**&nbsp;&nbsp;&nbsp; | {{ state_attr('sensor.supervisor_updates', 'current_version') }} | | {{ state_attr('sensor.supervisor_updates', 'newest_version') }} |
      | **HassOS** | {{ states('sensor.home_assistant_operating_system_version') }} | | {{ states('sensor.home_assistant_operating_system_newest_version') }} |
      | **CORE** | {{ states.sensor.updater_core.attributes.current_version }} | | {{ states.sensor.updater_core.attributes.newest_version }} |
      | **Audio** | {{ states.sensor.updater_audio.attributes.current_version }} | | {{ states.sensor.updater_audio.attributes.newest_version }} |
      | **CLI** | {{ states.sensor.updater_cli.attributes.current_version }} | | {{ states.sensor.updater_cli.attributes.newest_version }} |
      | **DNS** | {{ states.sensor.updater_dns.attributes.current_version }} | | {{ states.sensor.updater_dns.attributes.newest_version }} |
      | **Multicast** | {{ states.sensor.updater_multicast.attributes.current_version }} | | {{ states.sensor.updater_multicast.attributes.newest_version }} |
      | **Observer** | {{ states.sensor.updater_observer.attributes.current_version }} | | {{ states.sensor.updater_observer.attributes.newest_version }} |

As I used many of the examples in this and other forums to build this card, I am not sure what is wrong with the code now. There are no errors in the logs. Just noting but the title showing on my screen. Any ideas on how to fix it?
Thanks.

what does it show in dev templates ?

Personally, I did away with most of these templates, and just added an auto-entities on domain update being on…

the more info HA integrations provide out of the box, the less we need to write our own investigator/monitor.

Not working in dev template. What I liked about it was in a small marked down card I saw the status of everything. I think there was a change and the template sensor no longer gets the correct information. I was pointed yesterday in discord to a GitHub issue talking about this . I have looked at other examples and I have not seen any that are as close to this one.

can you chop it up and provide a smaller template that does not work?

seems a bit weird that templates stopped working all of a sudden, and I cant imagine the whole set doesnt work. Maybe a smaller detail?

first strip al the markdown and then try each template selectively?

I believe it is my template sensors that stopped working not the card. I’ll post them when I get home.

My sensor codes:

sensor:
  # Sensor to track available updates for supervisor & addons
  - 
    platform: command_line
    name: Supervisor updates
    command: 'curl http://supervisor/supervisor/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version,"update_available":.data.update_available,"addons":[.data.addons[] | select(.update_available)]}'''
    value_template: "{{ value_json.addons | length }}"
    unit_of_measurement: pending update(s)
    json_attributes:
    - update_available
    - newest_version
    - current_version
    - addons
    

#end of part 1
#=========================
#----- Command_Line
#========================= 
  - platform: command_line
    name: Updater CLI
    command: 'curl http://supervisor/cli/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version}'''
    value_template: "{% if value_json.newest_version != value_json.current_version %}on{% else %}off{% endif %}"
    json_attributes:
      - newest_version
      - current_version
#=========================
#----- DNS Update
#=========================    
  - platform: command_line
    name: Updater DNS
    command: 'curl http://supervisor/dns/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version}'''
    value_template: "{% if value_json.newest_version != value_json.current_version %}on{% else %}off{% endif %}"
    json_attributes:
    - newest_version
    - current_version
#=========================
#----- Audio Update
#=========================    
  - platform: command_line
    name: Updater Audio
    command: 'curl http://supervisor/audio/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version}'''
    value_template: "{% if value_json.newest_version != value_json.current_version %}on{% else %}off{% endif %}"
    json_attributes:
    - newest_version
    - current_version
#=========================
#----- Multicast Update
#=========================    
  - platform: command_line
    name: Updater Multicast
    command: 'curl http://supervisor/multicast/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version}'''
    value_template: "{% if value_json.newest_version != value_json.current_version %}on{% else %}off{% endif %}"
    json_attributes:
    - newest_version
    - current_version
#=========================
#----- Observer Update
#=========================    
  - platform: command_line
    name: Updater observer
    command: 'curl http://supervisor/observer/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version}'''
    value_template: "{% if value_json.newest_version != value_json.current_version %}on{% else %}off{% endif %}"
    json_attributes:
    - newest_version
    - current_version


#=========================
#----- Core Update
#=========================    
  - platform: command_line
    name: Updater Core
    command: 'curl http://supervisor/core/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version, "update_available":.data.update_available}'''
    value_template: "{% if value_json.update_available %}on{% else %}off{% endif %}"
    json_attributes:
    - update_available
    - newest_version
    - current_version
#========================
#    os_agent
#========================
#  - platform: command_line
#    name: Updater Core
#    command: 'curl http://supervisor/os_agent/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq #''{"newest_version":.data.version_latest,"current_version":.data.version, "update_available":.data.update_available}'''

#========================
#Hacs Update
#=========================
binary_sensor:
  - platform: template
    sensors:
      # True if there's an update available for supervisor
      updater_supervisor:
        friendly_name: 'Updater - Supervisor'
        device_class: problem
#        entity_id:
#fix entity id error        - sensor.supervisor_updates
        value_template: "{{ state_attr('sensor.supervisor_updates', 'current_version') != state_attr('sensor.supervisor_updates', 'newest_version') }}"
        availability_template: "{{ (states('sensor.supervisor_updates') | int(-1)) > -1 }}"

      # True if there's updates available for any HACS components
      updater_hacs:
        friendly_name: 'Updater - HACS'
        device_class: problem
        value_template: "{{ states('sensor.hacs')| int(0) > 0 }}"

      # True if there's updates available for any addons
      updater_addons:
        friendly_name: 'Updater - Addons'
        device_class: problem
        value_template: "{{ states('sensor.supervisor_updates') | int(0) > 0 }}"
alert:

  ha_update_available:
    name: HA has an update
    entity_id: binary_sensor.updater
    state: 'on'
    can_acknowledge: false
    repeat: 
    - 5
    - 360
    title: 'Update for HA available'
    message: "New version is {{ state_attr('binary_sensor.updater', 'newest_version') }}. Currently on {{ states('sensor.current_version') }}"
    notifiers:
    - Pixel XL_4
    data:
      tag: 'ha-update-available'
      url: 'https://192.168.1.48:8123/hassio/addon/core_check_config'

  # Supervisor update is available - un-acknowledgeable, auto-dismiss, me only
  supervisor_update_available:
    name: Supervisor has an update
    entity_id: binary_sensor.updater_supervisor
    state: 'on'
    can_acknowledge: false
    repeat: 360
    title: 'Update for HA Supervisor available'
    message: "New version is {{ state_attr('sensor.supervisor_updates', 'newest_version') }}. Currently on {{ state_attr('sensor.supervisor_updates', 'current_version') }}"
    notifiers:
    - Pixel XL_4
    - 'me'
    data:
      tag: 'supervisor-update-available'
      url: 'https://192.168.1.48:8123/hassio/dashboard'

  # HACS repos have updates available - acknowledgeable, auto-dismiss, me only
  hacs_update_available:
    name: HACS repos have updates
    entity_id: binary_sensor.updater_hacs
    state: 'on'
    can_acknowledge: false
    repeat: 360
    title: "Updates available in {{ states('sensor.hacs') | default (0) }} HACS repo{% if states('sensor.hacs') | default (0) | int(default=0) > 1 %}s{% endif %}"
    message: ""
    notifiers:
    - Pixel XL_4
    - 'me'
    data:
      tag: 'hacs-update-available'
      url: 'https://192.168.1.48:8123/hassio//hacs/installed'
#      ttl: 21600

  # Addons have updates available - acknowledgeable, auto-dismiss, me only
  addon_update_available:
    name: Addons have updates
    entity_id: binary_sensor.updater_addons
    state: 'on'
    can_acknowledge: false
    repeat: 360
    title: "Updates available for {{ states('sensor.supervisor_updates') }} HA addon{% if states('sensor.supervisor_updates') | int(0) > 1 %}s{% endif %}"
    message: ""
    notifiers:
    - Pixel XL_4
    
    data:
      tag: 'addon-update-available'
      url: 'https://192.168.1.48:8123/hassio/hassio/dashboard'

No errors in the log files.

What is the output in developer tools → templates as Marius asked for / recommended? Put the content of your markdown there and just double-check the output.

Be aware some rest sensor issues were noted. Maybe some of these are based on those ?

I mean command_line uses the same resources so maybe related .

Can you at least confirm these sensors to return correct output . If not ofc there is no use templating those

They do not. I’m sure that is the issue. None of the sensors give the correct information on developers tools. Not sure why this was changed?

I can get most of the information other ways, just does not display as well.

I spoke to soon. I believe most of the sensors do still work, just not in the markdown card. Hacs sensor changed but not sure why this would stop the card?

I’m not sure how to test the whole card in Del tools? When I paste the card there I get TypeError: ‘NoneType’ object is not iterable.

The bottom from | current below works in dev tools.

this is somewhat cryptic…

any jinja template that works in dev tools, works in Markdown.

if you have borked command_line sensors, no template based on that will work.

as you stated, most if this info can be had from the core integrations now. You can still template those nicely, or have them show via other means, no issue there.

it would save you some (maybe most) tailor made sensors, who using the built-in supervisor sensors, so why not give that a try? It would release the system just that extra bit :wink:

Guys you are really spamming this thread, what about opening a new one for your issue.

1 Like