I’m running HA on a RPi4, using HA OS.
I have a command_line sensor for my RPi’s CPU temp, which I got from the community:
sensor:
- platform: command_line
name: CPU Temperature
command: "cat /sys/class/thermal/thermal_zone0/temp"
# Doesn't work: device_class: "temperature"
unit_of_measurement: "°C"
value_template: '{{ value | multiply(0.001) | round(1) }}'
scan_interval: 10
When scanning my Core logs I see this error:
Entity sensor.cpu_temperature (<class ‘homeassistant.components.command_line.sensor.CommandSensor’>) with device_class None reports a temperature in °C which will be converted to °F. Temperature conversion for entities without correct device_class is deprecated and will be removed from Home Assistant Core 2022.3. …
So I tried to add device_class: "temperature"
to it, but that’s invalid according to the checker:
Invalid config for [sensor.command_line]: [device_class] is an invalid option for [sensor.command_line]. Check: sensor.command_line->device_class. (See ?, line ?).
So what’s the best way to create this command_line sensor as a temperature? How can I set a device_class
on it? (And bigger question: is there a reference for configuration.yaml where I could go to see what’s legal with what?)