nebulous / infinitude

Open control of Carrier/Bryant thermostats
MIT License
224 stars 50 forks source link

Question about HA yaml for infinitude sensors #172

Closed greggitter closed 1 year ago

greggitter commented 1 year ago

I'm posting this here because there's very little traffic at MizterB /homeassistant-infinitude and I'm not getting any assistance regarding HA config.

Below is the section of my configuration.yaml relating to infinitude. All of these work in 2023.4.x but three stop working in 2023.5. In 2023.4 I was getting warning messages and tried many times over the months to resolve them but never could, but they continued to work. (Note: I had to rollback to 2023.4.x due to other problems that look to be resolved in the upcoming 2023.5.3. and again this config works.) Searching for these messages never yielded a clear solution (or a solution that I could use without causing invalid configs). I'm assuming the problem is NOT the addon itself. Infinitude proxy is fine, no issues with that.

Messages:

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

Obviously, these three sensors have text values...and so maybe my yaml is just wrong...? Any help is greatly appreciated! Thx!

Configuration that works in 2023.4, fails in 2023.5. The three failing items (from the messages above) are hvac_fan_mode (auto, low, med, high), hvac_current_activity, and hvac_humifier_status (off, on). These show as unavailable in 2023.5 with actual error messages (bottom).

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') )}}

Error messages produced in 2023.5.x

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'>)
2023-05-05 13:41:25.706 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 581, in state
    numerical_value = float(value)  # type:ignore[arg-type]
ValueError: could not convert string to float: 'home'

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_current_activity 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: home (<class 'str'>)
2023-05-05 13:41:25.706 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: 'off'

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_humidifier_status 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: off (<class 'str'>)
greggitter commented 1 year ago

Solved, just needed to remove unit_of_measure from the affected sensors.