Solved: Help with YAML warning/error messages for three sensors (infinitude add-on)

Hi, hoping someone can help with yaml formatting (assuming that’s the problem).

I have three sensors for which I receive warning messages in 2023.4.x but those changed to fatal error messages in 2023.5 and stopped working (sensors became unavailable). I think it’s likely a yaml error on my part, but maybe it’s related to the add-on itself (Inifinitude).

I’ve spent hours trying to track down this message and haven’t been successful. Unlike the other sensors for this add-on, these three sensors return a string value, current_activity, fan_status (auto, low, med, high) and humidifier_status (off, on). The warning messages I’m receiving are these:

2023-05-08 23:16:13.709 WARNING (MainThread) [homeassistant.components.sensor] Sensor sensor.hvac_fan_mode has device class None, state class None and unit  thus indicating it has a numeric value; however, it has the non-numeric value: low (<class 'str'>); Please update your configuration if your entity 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+template%22

2023-05-08 23:16:13.713 WARNING (MainThread) [homeassistant.components.sensor] Sensor sensor.hvac_current_activity has device class None, state class None and unit  thus indicating it has a numeric value; however, it has the non-numeric value: sleep (<class 'str'>); Please update your configuration if your entity 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+template%22

2023-05-08 23:16:13.716 WARNING (MainThread) [homeassistant.components.sensor] Sensor sensor.hvac_humidifier_status has device class None, state class None and unit  thus indicating it has a numeric value; however, it has the non-numeric value: off (<class 'str'>); Please update your configuration if your entity 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+template%22

The snippet of yaml code is this (note, all other sensors in this section work fine):

template:
  - sensor:
      - name: "HVAC Action"
        unique_id: hvac_action
        icon: mdi:air-conditioner
        state: >
          {{(state_attr('climate.infinity', 'hvac_action') )}}

      - name: "HVAC Airflow CFM"
        unique_id: hvac_fan_speed
        icon: mdi:fan
        unit_of_measurement: "cfm"
        state: >
          {{(state_attr('climate.infinity', 'airflow_cfm') )}}

      - name: "HVAC Current Temp"
        unique_id: hvac_current_temp
        icon: mdi:thermometer
        unit_of_measurement: "°F"
        state: >
          {{(state_attr('climate.infinity', 'current_temperature') )}}

      - name: "HVAC Outdoor Temp"
        unique_id: hvac_outdoor_temp
        icon: mdi:thermometer
        unit_of_measurement: "°F"
        state: >
          {{(state_attr('climate.infinity', 'outdoor_temperature') )}}

      - name: "HVAC Current Humidity"
        unique_id: current_humidity
        icon: mdi:thermometer
        unit_of_measurement: "%"
        state: >
          {{(state_attr('climate.infinity', 'current_humidity') )}}

      - name: "HVAC Fan Mode"
        unique_id: fan_mode
        icon: mdi:fan
        unit_of_measurement: ""
        state: >
          {{(state_attr('climate.infinity', 'fan_mode') )}}

      - name: "HVAC Current Activity"
        unique_id: current_activity
        icon: mdi:thermometer
        unit_of_measurement: ""
        state: >
          {{(state_attr('climate.infinity', 'current_activity') )}}

      - name: "HVAC IDU Modulation"
        unique_id: idu_modulation
        icon: mdi:thermometer
        unit_of_measurement: "%"
        state: >
          {{(state_attr('climate.infinity', 'idu_modulation') )}}

      - name: "HVAC Humidifier Status"
        unique_id: humid
        icon: mdi:thermometer
        unit_of_measurement: ""
        state: >
          {{(state_attr('climate.infinity', 'humid') )}}

      - name: "HVAC Air Filter Level"
        unique_id: filtrlvl
        icon: mdi:air-filter
        unit_of_measurement: "%"
        state: >
          {{(state_attr('climate.infinity', 'filtrlvl') )}}

      - name: "HVAC Humidifier Filter Level"
        unique_id: humlvl
        icon: mdi:air-filter
        unit_of_measurement: "%"
        state: >
          {{(state_attr('climate.infinity', 'humlvl') )}}

I’m relatively new to HA, but I’ve gone through the documentation on what I think is the relevant section and still come up blank. I posted this question on the github linked above but it’s low-traffic and no one has replied.

Due to some other problems with 2023.5.x I’ve restored to 2023.4.x. If I can get these warning messages solved, I think the fatal errors in 2023.5.x will also be solved. The fatal message(s) is this (all are similar so here is one). Perhaps it’s a problem with the add-on…?

2023-05-05 13:41:25.697 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 579, in state
    numerical_value = int(value)
ValueError: invalid literal for int() with base 10: 'low'

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

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template_entity.py", line 379, in _async_template_startup
    result_info.async_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 953, in async_refresh
    self._refresh(None)
  File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 1133, in _refresh
    self.hass.async_run_hass_job(self._job, event, updates)
  File "/usr/src/homeassistant/homeassistant/core.py", line 607, in async_run_hass_job
    hassjob.target(*args)
  File "/usr/src/homeassistant/homeassistant/helpers/template_entity.py", line 348, in _handle_results
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 585, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 649, in _async_write_ha_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 591, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 583, in state
    raise ValueError(
ValueError: Sensor sensor.hvac_fan_mode has device class None, state class None unit  and suggested precision None thus indicating it has a numeric value; however, it has the non-numeric value: low (<class 'str'>)

Any help is greatly appreciated! Thanks!

Remove the unit_of_measurement: "" from the sensors listed in the error message.

Well that was easy…thank you very much! :slight_smile:

Cheers!