NVME temperature on Ubuntu

Hi,

I’ve just bought an M2 SSD into my server, which also runs HA.
I’m using Ubuntu 20.04, and can check the temperature with the command:

sudo nvme smart-log /dev/nvme0n1 | grep ‘^temperature’

Tried the command_line platform, which I already use for CPU temp:

  • platform: command_line
    name: CPU Temperature
    command: ‘cat /sys/class/thermal/thermal_zone2/temp’
    unit_of_measurement: ‘°C’
    value_template: ‘{{ value | multiply(0.001) }}’

but it didn’t work out for the nvme drive :confused:

  • platform: command_line
    name: System SSD Temperature
    command: ‘nvme smart-log /dev/nvme0 | grep ‘^temperature’’
    unit_of_measurement: ‘°C’
    value_template: ‘{{ value | multiply(0.001) }}’

Do you guys have any suggestion?

I am also looking for an answer to this. HDDTemp does not appear to be working on my Home Assistant Yellow version 2023.8.4.

Did any of you managed to get it working.

I tried to set up a sensor with both the above nvme command and also by parsing the output the sensors command.

For the later one, the home assistant logs is listing the /bin/sh sensors cannot be found.

I am not sure if this is due to HA running in a Docker container.