question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Command line sensor warns about needing `device_class` set with temperature `unit_of_measurement` but does not support it

See original GitHub issue

The problem

It appears that command line sensors don’t support the device_class tag and is throwing a warning about needing them for temperature values. Adding the device class to the customize.yaml also doesn’t fix the warning.

What is version of Home Assistant Core has the issue?

2021.9.7

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Command Line Sensor

Link to integration documentation on our website

https://www.home-assistant.io/integrations/sensor.command_line/

Example YAML snippet

configuration.yaml

    - platform: command_line
      name: cpu_0_temperature
      command: cat /config/cpu0temp.txt
      unit_of_measurement: "°C"
    
    - platform: command_line
      name: P8J8XDVR_Temperature
      command: cat /config/P8J8XDVRtemp.txt
      unit_of_measurement: "°C"

    - platform: command_line
      name: 200703809989_Temperature
      command: cat /config/200703809989temp.txt
      unit_of_measurement: "°C"

    - platform: command_line
      name: P8G1G7YR_Temperature
      command: cat /config/P8G1G7YRtemp.txt
      unit_of_measurement: "°C"

    - platform: command_line
      name: ST4000VN008_Temperature
      command: cat /config/ST4000VN008temp.txt
      unit_of_measurement: "°C"

customize.yaml

sensor.cpu_0_temperature:
  friendly_name: CPU temperature
  device_class: temperature
sensor.p8g1g7yr_temperature:
  device_class: temperature
sensor.st4000vn008_temperature:
  device_class: temperature
sensor.p8j8xdvr_temperature:
  device_class: temperature
sensor.200703809989_temperature:
  device_class: temperature

Anything in the logs that might be useful for us?

Entity sensor.cpu_0_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. Please update your configuration if device_class is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+command_line%22
Entity sensor.p8g1g7yr_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. Please update your configuration if device_class is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+command_line%22
Entity sensor.st4000vn008_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. Please update your configuration if device_class is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+command_line%22
Entity sensor.200703809989_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. Please update your configuration if device_class is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+command_line%22
Entity sensor.p8j8xdvr_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. Please update your configuration if device_class is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+command_line%22

Additional information

No response

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:4
  • Comments:21 (7 by maintainers)

github_iconTop GitHub Comments

4reactions
bdr99commented, Mar 25, 2022

This is still an issue in 2022.3.7. It can be easily reproduced with the following config:

sensor:
  - platform: command_line
    name: Test Command Line Sensor
    command: echo 1
    unit_of_measurement: "°C"

which results in the following log output:

2022-03-25 14:54:19 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.test_command_line_sensor (<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. Please update your configuration if device_class is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+command_line%22

but it is not possible to do what the log entry asks because there is no device_class attribute for command line sensors.

2reactions
bdracocommented, Nov 16, 2021

I changed the title so its clear its about the warning.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Command Line Sensor Device Class error? - Configuration
I've been using a command line sensor to track my server temperature. It's pretty darn close to the example in the documentation.
Read more >
Carbon Black Cloud: How to Collect Sensor Diagnost...
Objective. For 3.8+ sensors, there is a new command built in to RepCLI which is designed to collect a large variety of data...
Read more >
NetBotz Rack Monitor 250 User Guide - eAnixter
The information presented in this manual is not warranted by APC by Schneider ... Temperature and humidity sensors (with or without digital displays)....
Read more >
Templates and Custom Sensors in Home Assistant - YouTube
Templates and Custom Sensors are a more advanced feature in Home Assistant. With Templates and Custom Sensors you can format and convert ...
Read more >
System Manual - SIMOCODE pro - Industry Support Siemens
The SIMOCODE basic units in the 24 V DC version do not include galvanic isolation. ... Temperature in the respective sensor measuring circuits,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found