jmcollin78 / versatile_thermostat

A full featured Thermostat for Home Assistant: presets, window, motion, presence and overpowering management
MIT License
330 stars 35 forks source link

_is_aux_heat error #89

Closed gioele-antoci closed 1 year ago

gioele-antoci commented 1 year ago

Version of the custom_component

3.2.5

Debug Log

2023-06-24 19:15:19.901 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/versatile_thermostat/climate.py", line 1390, in _async_temperature_changed
    self.recalculate()
  File "/config/custom_components/versatile_thermostat/climate.py", line 2247, in recalculate
    self.update_custom_attributes()
  File "/config/custom_components/versatile_thermostat/climate.py", line 2367, in update_custom_attributes
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 590, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 656, in _async_write_ha_state
    attr.update(self.state_attributes or {})
                ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 344, in state_attributes
    data[ATTR_AUX_HEAT] = STATE_ON if self.is_aux_heat else STATE_OFF
                                      ^^^^^^^^^^^^^^^^
  File "/config/custom_components/versatile_thermostat/climate.py", line 1038, in is_aux_heat
    return self.underlying_entity(0).is_aux_heat
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'UnderlyingClimate' object has no attribute 'is_aux_heat'

Describe the bug

When creating a new thermostat using a climate override I get this error when accessing the custom thermostat. The custom entity thermostat appears unavailable and all sensors are undefined. If it can help I am using a heat pump as a heat/cool air source, configured via Midea HACS

gioele-antoci commented 1 year ago

The class UnderlyingClimate does indeed not have such attribute...?

EDIT: looking at my climate entities, the attribute is_aux_heat is not present while aux_heat is

jmcollin78 commented 1 year ago

Hello, I will fix this rapidly. Thank you for your report.

jmcollin78 commented 1 year ago

@gioele-antoci because I don't have any auxiliary heater, i was not able to test it on my side.

jmcollin78 commented 1 year ago

Release have been published: https://github.com/jmcollin78/versatile_thermostat/releases/tag/3.2.6

gioele-antoci commented 1 year ago

Release fixed the issue