Reading CPU and HDD temp will give 'unkown' error on 'native HASS'

Tested before the Hass in a container solution … but for different parts of hardware I have build the HASS native on the Raspberry PI.
I could read the CPU temperature in the first situation (container solution) but not anymore in the ‘native linux’ install.

I used the installation manual from this site:
a. https://www.home-assistant.io/docs/installation/raspberry-pi/
b. https://www.instructables.com/id/Setup-Home-Assistant-on-Raspberry-Pi/

And the result is very fine … the HASS software is up and running.
The first thing I always do is to make the small script to see how ‘hot’ the CPU will be.
I used the samll configuration script like:

CPU temperature

  • platform: command_line
    name: CPU Temperature
    command: “cat /sys/class/thermal/thermal_zone0/temp”
    unit_of_measurement: “°C”
    value_template: “{{ (value | multiply(0.001)) | round(1) }}”

But always what I try to fix … the end result is ‘unkown’ temperature in the webscreen of HASS.

Dit anyone see this also before ?

I think something it will be about user rights, hidden python script or what else …
I will check the log files … may be I will see more information why this script will not show the correct temperature …

Note: tested this in the CLI-Shell … everything works fine.

The CPU temp. sensor is working good for me with the following config:

configuration.yaml:

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

and in card:

entities:
  - entity: sensor.rpi_cpu_temperature

It’s working on my Pi3 on Hassio and on the other Pi3 with hassio install in docker.

change to:

name: "CPU Temperature"

and this

value_template: “{{ (value | multiply(0.001)) | round(1) }}”

to

value_template: '{{ (value | multiply(0.001)) | round(1) }}'

Thanks for reply … in the log it shows me:
Command failed: cat /sys/class/thermal/thermal_zone0/temp
3:23 PM components/command_line/sensor.py (ERROR)

Looking on the systeem … no sensor.py ??

The other error is:
2019-11-15 14:23:00 ERROR (SyncWorker_5) [homeassistant.components.command_line.sensor] Command failed: cat /sys/class/thermal/thermal_zone0/temp

Check your code:

value_template: “{{ (value | multiply(0.001)) | round(1) }}

There’s a open bracket in front of value. Remove it.

The command action failed … not the next line … ( I changed correct, thanks) … it seems that the native HASS needs an area same as ‘sudo shell’ … it don’t understand the commands given from the virtual HASS system …

I can not find the sensor.py file on the rpi … do you know how to find the file sensor.py ?

Sorry, than I have to pass. Don’t know where this file is located. There was no need for me to check, cause everything is running well on the Raspi’s.

Maybe somebody else can help?

Found the solution !

Something was wrong with the rights in the folder:
/home/homeassistant/.homeassistant/.storage/

I found this because the ‘auto start’ file ‘[email protected]’ was not activated anymore.
And their where a few files who are changed with user rights to root … but that must be homeassistant ( the default user ).

Now I see the temperature and other things in correct order.
Thanks for your replies …

:+1: cool, have fun