How to display a system status in Home Assistant

It is handy to have system information easily accessible. Manual checking (via SSH) can become annoying quickly. However, thanks to Home Assistant’s built-in integration Command line Sensor, it is easy to set up in-app system monitoring in a matter of minutes.


At first you have to prepare a data source. On GNU/Linux, you can use e.g. lm-sensors package to get information about temperatures, fan speeds, etc. To install the package on Ubuntu, run:

sudo apt install lm-sensors

Now you need to scan the system for available sensors.

sudo sensors-detect

To use recommended options, press Enter on every question except the last one (see below). The default value will be used (always in CAPITAL letters). This is 100% safe, however, it could happen that some sensors will not be available. For every sensor there will be a description and potential risks, so decide for yourself to install or not.

Answer the last question yes:

Do you want to add these lines automatically? (yes/NO)

Now reboot and check whether the installation was successful:


Depending on the hardware the output will look like this:

Adapter: PCI adapter
temp1:        +53.5°C  (high = +100.0°C, hyst = +95.0°C)
                       (crit = +110.0°C)

Adapter: ISA adapter
Vcore:       912.00 mV (min =  +0.00 V, max =  +1.74 V)
in1:         872.00 mV (min =  +1.37 V, max =  +0.37 V)  ALARM
AVCC:          3.38 V  (min =  +2.98 V, max =  +3.63 V)
+3.3V:         3.38 V  (min =  +2.98 V, max =  +3.63 V)
in4:           1.14 V  (min =  +0.36 V, max =  +0.82 V)  ALARM
in5:         880.00 mV (min =  +0.33 V, max =  +1.06 V)
in6:         864.00 mV (min =  +0.30 V, max =  +1.00 V)

We will use JSON output format to get the data easily:

sensors -j

Now it is easy to push these values to the HA.

Home Assistant configuration

Warning: it is dangerous to run sensors multiple times at once, it can crash the system. To read multiple values, we will save the sensors output to a file and read from the file instead.

Open configuration.yml and add these lines:

  - platform: command_line
    name: sensors_read #Pick a name for the sensor.
    command: sensors -j > "$HOME"/sensors.txt #This will save sensors output in JSON to the HA's home directory.
    scan_interval: 30
    command_timeout: 30

This is just a dummy sensor to save actual values to a file. Now you can add one on more actual ‘sensors’ below the block we just added.

  - platform: command_line
    name: temp_cpu0_core0 #Pick a name for the sensor.
    command: cat "$HOME"/sensors.txt #This will load the entire file.
    value_template: '{{ value_json["intel5500-pci-00a3"]["temp1"]["temp1_input"] }}'  #This will get a specific value - see below.
    scan_interval: 30
    command_timeout: 30
    unit_of_measurement: '°C'

To get a value from JSON, you need to use value_json and access the keys with . or ["bracket notation"] if the key contains spaces. In the example I read a temperature of the chipset, which looks like this in the source JSON:

    "Adapter": "PCI adapter",
        "temp1_input": 53.500,
        "temp1_max": 100.000,
        "temp1_max_hyst": 95.000,
        "temp1_crit": 110.000,
        "temp1_max_alarm": 0.000,
        "temp1_crit_alarm": 0.000

After you add all of the needed sensors, check the configuration in HA in settings and restart the HA.

Adding sensors to Lovelace

After restarting the HA, all sensors should be available (if not, wait for a time specified in the config: scan_interval + command_timeout). The sensors are just like any other entities, so pick e.g. Sensor Card and add your sensors. Now it is easy to see nice graphs right in the HA app without logging to SSH and checking the values manually!

System status monitoring in HA.