core icon indicating copy to clipboard operation
core copied to clipboard

hp_ilo integration is reporting that the temperature sensors do not have a device class

Open dennislv opened this issue 2 years ago • 4 comments

The problem

hp_ilo integration is reporting that the temperature sensors do not have a device class

What version of Home Assistant Core has the issue?

Home Assistant 2022.4.7

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

hp_ilo

Link to integration documentation on our website

https://www.home-assistant.io/integrations/hp_ilo/

Diagnostics information

hp_ilo integration is reporting temperature sensors are defined without device_class generating warnings about being depreciated/removed in the near future.

Manually adding

Example YAML snippet

- platform: hp_ilo
    host: 192.168.x.x
    username: ha
    password: xxxxxxxxxxxx
    scan_interval: 120
    monitored_variables:
      - name: power_status
        sensor_type: server_power_status
      - name: power_readings
        sensor_type: server_power_readings

      - name: bios_hardware
        sensor_type: server_health
        value_template: "{{ ilo_data.health_at_a_glance['bios_hardware']['status'] }}"

      - name: fan_status
        sensor_type: server_health
        value_template: "{{ ilo_data.health_at_a_glance['fans']['status'] }}"

      - name: memory_status
        sensor_type: server_health
        value_template: "{{ ilo_data.health_at_a_glance['memory']['status'] }}"

      - name: network_status
        sensor_type: server_health
        value_template: "{{ ilo_data.health_at_a_glance['network']['status'] }}"

      - name: processor_status
        sensor_type: server_health
        value_template: "{{ ilo_data.health_at_a_glance['processor']['status'] }}"

      - name: storage_status
        sensor_type: server_health
        value_template: "{{ ilo_data.health_at_a_glance['storage']['status'] }}"

      - name: temperature_status
        sensor_type: server_health
        value_template: "{{ ilo_data.health_at_a_glance['temperature']['status'] }}"

      - name: temperature_inlet
        sensor_type: server_health
        unit_of_measurement: '°C'
        value_template: "{{ ilo_data.temperature['01-Inlet Ambient'].currentreading[0] }}"

      - name: temperature_cpu1_
        sensor_type: server_health
        unit_of_measurement: '°C'
        value_template: "{{ ilo_data.temperature['02-CPU 1'].currentreading[0] }}"

      - name: CPU fanspeed
        sensor_type: server_health
        unit_of_measurement: "%"
        value_template: '{{ ilo_data.fans["Fan 1"].speed[0] }}'

Anything in the logs that might be useful for us?

2022-05-03 20:27:40 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.hp_ilo_temperature_inlet (<class 'homeassistant.components.hp_ilo.sensor.HpIloSensor'>) 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+hp_ilo%22
2022-05-03 20:27:41 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.hp_ilo_temperature_cpu1 (<class 'homeassistant.components.hp_ilo.sensor.HpIloSensor'>) 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 config--uration 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+hp_ilo%22

Additional information

Manually adding 'device_class: temperature' anywhere in the hp_ilo config section causes the following error:

At the top of the hp_ilo options: 2022-05-03 21:59:32 ERROR (MainThread) [homeassistant.config] Invalid config for [sensor.hp_ilo]: [device_class] is an invalid option for [sensor.hp_ilo]. Check: sensor.hp_ilo->device_class. (See /config/configuration.yaml, line 143). Please check the docs at https://www.home-assistant.io/integrations/hp_ilo

At the individual sensor/variable 2022-05-03 21:54:18 ERROR (MainThread) [homeassistant.config] Invalid config for [sensor.hp_ilo]: [device_class] is an invalid option for [sensor.hp_ilo]. Check: sensor.hp_ilo->monitored_variables->9->device_class. (See /config/configuration.yaml, line 143). Please check the docs at https://www.home-assistant.io/integrations/hp_ilo

dennislv avatar May 04 '22 05:05 dennislv

hp_ilo documentation hp_ilo source (message by IssueLinks)

Hi, I also suffer from this problem.

This is the errormessage I get

Logger: homeassistant.components.sensor
Source: helpers/template.py:411
Integration: Sensor ([documentation](https://www.home-assistant.io/integrations/sensor), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+sensor%22))
First occurred: 16:08:12 (2 occurrences)
Last logged: 16:08:37

hp_ilo: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 409, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1859, in _render_with_context
    return template.render(**kwargs)
  File "/usr/local/lib/python3.9/site-packages/jinja2/environment.py", line 1291, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.9/site-packages/jinja2/environment.py", line 926, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 1, in top-level template code
  File "/usr/local/lib/python3.9/site-packages/jinja2/sandbox.py", line 326, in getattr
    value = getattr(obj, attribute)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1885, in _fail_with_undefined_error
    raise ex
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1876, in _fail_with_undefined_error
    return super()._fail_with_undefined_error(*args, **kwargs)
jinja2.exceptions.UndefinedError: 'dict object' has no attribute '01-Inlet Ambient'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 736, in async_device_update
    await task
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/hp_ilo/sensor.py", line 169, in update
    ilo_data = self._sensor_value_template.render(
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 378, in render
    return run_callback_threadsafe(
  File "/usr/local/lib/python3.9/concurrent/futures/_base.py", line 445, in result
    return self.__get_result()
  File "/usr/local/lib/python3.9/concurrent/futures/_base.py", line 390, in __get_result
    raise self._exception
  File "/usr/src/homeassistant/homeassistant/util/async_.py", line 64, in run_callback
    future.set_result(callback(*args))
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 411, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: UndefinedError: 'dict object' has no attribute '01-Inlet Ambient'

Also I get this one

Logger: homeassistant.helpers.template
Source: helpers/template.py:1879
First occurred: 16:08:12 (2 occurrences)
Last logged: 16:08:37

Template variable error: 'dict object' has no attribute '01-Inlet Ambient' when rendering '{{ ilo_data.temperature['01-Inlet Ambient'].currentreading[0] }}'
Template variable error: 'dict object' has no attribute '02-CPU 1' when rendering '{{ ilo_data.temperature['02-CPU 1'].currentreading[0] }}'

If I remove the sensors that make problems I keep getting an error saying that hp_ilo sensors take more than 10 seconds to update.. Ive set the scan interval to 300s

NicciZar avatar May 11 '22 14:05 NicciZar

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Aug 09 '22 15:08 github-actions[bot]

Still broken in the latest version

dennislv avatar Aug 09 '22 21:08 dennislv

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.