thomasgermain / vaillant-component

Multimatic integration for Home Assistant (also compatible with sensoAPP)
MIT License
135 stars 24 forks source link

error adding climate.control_dwh #234

Closed LennartPl closed 9 months ago

LennartPl commented 9 months ago

Problem: Error adding the new climate entity for DWH. image

Additional Info: water_heater still working with TIME_CONTROLLED mode: image Target temperature behavior still unchanged (#212)

I guess _MULTIMATIC_TO_HA needs also the TIME_CONTROLLED mode but not sure about concept and API definition... https://github.com/thomasgermain/vaillant-component/blob/a988cd7c9f44ea3bab152716421a4ae66a25482d/custom_components/multimatic/climate.py#L620C5-L628

Version: Core 23.10.1 HACS 1.33.0 multimatic 1.16.0

Logs:

Logger: homeassistant.components.climate
Source: helpers/entity_platform.py:507
Integration: Klima (documentation, issues)
First occurred: 8. Oktober 2023 um 22:36:16 (2 occurrences)
Last logged: 8. Oktober 2023 um 22:45:40

Error adding entities for domain climate with platform multimatic
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 752, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1057, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 779, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 879, in _async_write_ha_state
    state, attr = self._async_generate_attributes()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 820, in _async_generate_attributes
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 785, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 256, in state
    hvac_mode = self.hvac_mode
                ^^^^^^^^^^^^^^
  File "/config/custom_components/multimatic/climate.py", line 683, in hvac_mode
    return DHWClimate._MULTIMATIC_TO_HA[self.active_mode.current][0]
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: OperatingMode(name='TIME_CONTROLLED')
Logger: homeassistant.components.climate
Source: helpers/entity_platform.py:367
Integration: Klima (documentation, issues)
First occurred: 8. Oktober 2023 um 22:36:16 (2 occurrences)
Last logged: 8. Oktober 2023 um 22:45:40

Error while setting up multimatic platform for climate
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 367, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 752, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1057, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 779, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 879, in _async_write_ha_state
    state, attr = self._async_generate_attributes()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 820, in _async_generate_attributes
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 785, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 256, in state
    hvac_mode = self.hvac_mode
                ^^^^^^^^^^^^^^
  File "/config/custom_components/multimatic/climate.py", line 683, in hvac_mode
    return DHWClimate._MULTIMATIC_TO_HA[self.active_mode.current][0]
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: OperatingMode(name='TIME_CONTROLLED')
Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: homeassistant
Source: custom_components/multimatic/climate.py:683
Integration: Multimatic (documentation, issues)
First occurred: 8. Oktober 2023 um 22:36:20 (663 occurrences)
Last logged: 20:43:43

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1187, in _async_registry_updated
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 779, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 879, in _async_write_ha_state
    state, attr = self._async_generate_attributes()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 820, in _async_generate_attributes
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 785, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 256, in state
    hvac_mode = self.hvac_mode
                ^^^^^^^^^^^^^^
  File "/config/custom_components/multimatic/climate.py", line 683, in hvac_mode
    return DHWClimate._MULTIMATIC_TO_HA[self.active_mode.current][0]
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: OperatingMode(name='TIME_CONTROLLED')
thomasgermain commented 9 months ago

Thanks for the feedback.

Really strange that water_heater actually works, because I'm sending 'AUTO' to the API, so somehow the API understands that 'AUTO' is 'TIMED_CONTROL'..

I'll provide a fix

thomasgermain commented 9 months ago

1.16.1 (https://github.com/thomasgermain/vaillant-component/releases/tag/1.16.1) should fix the problem.

Let me know if it works for you

LennartPl commented 9 months ago

Issue solved! Thank you 👍 Screenshot_20231010-213705

212 still unresolved with climate entity :(