tadasdanielius / daikin_altherma

Daikin Altherma custom component for home assistant
MIT License
71 stars 5 forks source link

Support for gas condensing boiler D2CND with gateway DRGATEWAYAA and room thermostat DOTROOMTHEAA #31

Closed mihsu81 closed 1 year ago

mihsu81 commented 1 year ago

Hi @tadasdanielius,

Thank you for the awesome job and the effort you put in.

Would you be able to add support for a gas condensing boiler D2CND with gateway DRGATEWAYAA and room thermostat DOTROOMTHEAA? It is detected in the current state but some entities are unavailable and there are errors in HA thrown every few seconds because LeavingWaterTemperatureCurrent is probably unavailable on my unit.

Based on your troubleshooting recommendations from https://github.com/tadasdanielius/daikin_altherma/issues/28, I've attached the resulting json files zipped. daikin_altherma_x.zip

image

Log Details (ERROR)
This error originated from a custom integration.
Logger: homeassistant
Source: custom_components/daikin_altherma/sensor.py:81
Integration: Daikin Altherma HVAC (documentation, issues)
First occurred: 11:13:39 (14870 occurrences)
Last logged: 19:29:23

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 151, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 110, in async_update_listeners
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 348, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 570, in _async_write_ha_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 388, in state
    value = self.native_value
  File "/config/custom_components/daikin_altherma/sensor.py", line 81, in native_value
    status = sensors[self._sensor]
KeyError: 'LeavingWaterTemperatureCurrent'
tadasdanielius commented 1 year ago

The profile looks different, but I think some of the features should easy to implement. I will try to look at it, but obviously you will have to test it :)

mihsu81 commented 1 year ago

@tadasdanielius1 Thanks a lot for your willingness to look into it. I'll test as soon as you have something ready.

mihsu81 commented 1 year ago

@tadasdanielius Just to update you on the current situation, after updating to v1.2.3 the integration fails to set up and the error changed to: image

Log Details (ERROR)
This error originated from a custom integration.
Logger: homeassistant.config_entries
Source: custom_components/daikin_altherma/__init__.py:148
Integration: Daikin Altherma HVAC ([documentation](https://github.com/tadasdanielius/daikin_altherma), [issues](https://github.com/tadasdanielius/daikin_altherma/issues))
First occurred: 16:26:48 (2 occurrences)
Last logged: 16:36:36

Error setting up entry Daikin HVAC controller (180400597) for daikin_altherma
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 357, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/config/custom_components/daikin_altherma/__init__.py", line 68, in async_setup_entry
    hass.data[DOMAIN][entry.entry_id] = api = await setup_api_instance(
  File "/config/custom_components/daikin_altherma/__init__.py", line 47, in setup_api_instance
    await api.api_init()
  File "/config/custom_components/daikin_altherma/__init__.py", line 148, in api_init
    self._climate_control_powered = await self._device.climate_control.is_turned_on
AttributeError: 'NoneType' object has no attribute 'is_turned_on'
tadasdanielius commented 1 year ago

Weird, I wonder if you restart just integration would that help?

mihsu81 commented 1 year ago

It was caused by the boiler. Looks like after a while its API becomes unresponsive to the integration even if it still replies to ping. If I cut the power of the thermostat and the boiler, it comes back to life.

tadasdanielius commented 1 year ago

That is something odd. Do you see any additional errors in the log?

BTW, I am implementing the features based on your profile. I have published pre-release v1.3.0. I have no idea whatever it is going to work or not. So, if you have some time you can try and test it. Redownload the repo and make sure the show beta is switched on. As I said, I have no idea if it works or not, so try and post every log you see related to daikin_altherma integration.

image
mihsu81 commented 1 year ago

@tadasdanielius Good progress so far. πŸ‘ After applying v1.3.0, the integration loads and Operation Mode appears as _heatingday and _heatingnight and the Target Temperatures for day and night appeared, as well as Indoor Temperature and Unit State.

image

There are a few warnings in HA, because of the hot water tank which doesn't get created. This is actually the "Domestic Hot Water" functionality of this gas boiler.

Log Details (WARNING)

This error originated from a custom integration.

Logger: pyaltherma.controllers
Source: custom_components/daikin_altherma/__init__.py:33
Integration: Daikin Altherma HVAC (documentation, issues)
First occurred: 01:13:45 (1 occurrences)
Last logged: 01:13:45

Discovered unrecognized unit with id: 2 function/DomesticHotWater
Log Details (WARNING)

This error originated from a custom integration.

Logger: custom_components.daikin_altherma.water_heater
Source: custom_components/daikin_altherma/water_heater.py:31
Integration: Daikin Altherma HVAC (documentation, issues)
First occurred: 01:13:48 (1 occurrences)
Last logged: 01:13:48

Cannot find daikin hot water tank unit.
Log Details (WARNING)

This error originated from a custom integration.

Logger: custom_components.daikin_altherma.number
Source: custom_components/daikin_altherma/number.py:34
Integration: Daikin Altherma HVAC (documentation, issues)
First occurred: 01:13:48 (1 occurrences)
Last logged: 01:13:48

Added Target Temperature Day
Log Details (WARNING)

This error originated from a custom integration.

Logger: custom_components.daikin_altherma.number
Source: custom_components/daikin_altherma/number.py:45
Integration: Daikin Altherma HVAC (documentation, issues)
First occurred: 01:13:48 (1 occurrences)
Last logged: 01:13:48

Added Target Temperature Night

Turning on/ff the Climate Control switch works fine and is reflected in the ONECTA application. Changing Operation Mode from _heatingnight to _heatingday throws an error _Failed to call service select/select_option. 'heatingday' is not a valid ClimateControlMode and it's logged as:

Log Details (ERROR)

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/daikin_altherma/select.py:49
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 01:45:52 (1 occurrences)
Last logged: 01:45:52

[140261880963776] 'heating_day' is not a valid ClimateControlMode
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 199, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1713, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1750, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 676, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 930, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 713, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/select/__init__.py", line 54, in async_select_option
    await entity.async_select_option(option)
  File "/config/custom_components/daikin_altherma/select.py", line 49, in async_select_option
    new_op = ClimateControlMode(option)
  File "/usr/local/lib/python3.10/enum.py", line 385, in __call__
    return cls.__new__(cls, value)
  File "/usr/local/lib/python3.10/enum.py", line 710, in __new__
    raise ve_exc
ValueError: 'heating_day' is not a valid ClimateControlMode

Changing the temperature in Target Temperature night or Target Temperature day again returns an error: _Failed to call service number/setvalue. 'settable' and is logged as:

Log Details (ERROR)

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/daikin_altherma/number.py:101
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 01:49:46 (2 occurrences)
Last logged: 01:49:51

[140261880963776] 'settable'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 199, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1713, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1750, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 676, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 930, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 713, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/number/__init__.py", line 111, in async_set_value
    await entity.async_set_native_value(native_value)
  File "/config/custom_components/daikin_altherma/number.py", line 101, in async_set_native_value
    await self._api.device.climate_control.call_operation(self._operation, int(value))
  File "/usr/local/lib/python3.10/site-packages/pyaltherma/controllers.py", line 111, in call_operation
    valid = conf['settable'] and conf['minValue'] <= value <= conf['maxValue']
KeyError: 'settable'
tadasdanielius commented 1 year ago

pre-released new version 1.3.1. It should pick the boiler now and allow to set the values. Let's see how it works this time.

mihsu81 commented 1 year ago

With 1.3.1 , the Hot Water Tank get's added but the entities are Unavailable because of the below 2 errors.

image

Log Details (ERROR)

Logger: homeassistant.components.water_heater
Source: custom_components/daikin_altherma/water_heater.py:101
Integration: Water Heater (documentation, issues)
First occurred: 09:30:28 (2 occurrences)
Last logged: 09:30:28

Error adding entities for domain water_heater with platform daikin_altherma
Error while setting up daikin_altherma platform for water_heater
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 673, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 776, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 572, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/water_heater/__init__.py", line 216, in state_attributes
    self.current_temperature,
  File "/config/custom_components/daikin_altherma/water_heater.py", line 101, in current_temperature
    current_temperature = status[
KeyError: 'TankTemperature'
Log Details (ERROR)

Logger: homeassistant.components.binary_sensor
Source: custom_components/daikin_altherma/binary_sensor.py:59
Integration: Binary sensor (documentation, issues)
First occurred: 09:30:28 (2 occurrences)
Last logged: 09:30:28

Error adding entities for domain binary_sensor with platform daikin_altherma
Error while setting up daikin_altherma platform for binary_sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 673, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 776, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 570, in _async_write_ha_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/binary_sensor/__init__.py", line 209, in state
    if (is_on := self.is_on) is None:
  File "/config/custom_components/daikin_altherma/binary_sensor.py", line 56, in is_on
    return self._is_problem_state()
  File "/config/custom_components/daikin_altherma/binary_sensor.py", line 59, in _is_problem_state
    unit_status = self._api.status[f'function/{self._unit_ref}']
KeyError: 'function/DomesticHotWaterTank'

Setting the temperature and operation mode returns: Failed to call service number/set_value. 'TankTemperature' and are both logged as:

Log Details (ERROR)

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/daikin_altherma/water_heater.py:101
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 09:37:50 (8 occurrences)
Last logged: 09:57:14

[139909619291792] 'TankTemperature'
[139908550211712] 'TankTemperature'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 199, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1713, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1750, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 676, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 930, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 713, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/number/__init__.py", line 111, in async_set_value
    await entity.async_set_native_value(native_value)
  File "/config/custom_components/daikin_altherma/number.py", line 99, in async_set_native_value
    await self.coordinator.async_request_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 158, in async_request_refresh
    await self._debounced_refresh.async_call()
  File "/usr/src/homeassistant/homeassistant/helpers/debounce.py", line 82, in async_call
    await task
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 182, in async_refresh
    await self._async_refresh(log_failures=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 110, in async_update_listeners
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 348, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 572, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/water_heater/__init__.py", line 216, in state_attributes
    self.current_temperature,
  File "/config/custom_components/daikin_altherma/water_heater.py", line 101, in current_temperature
    current_temperature = status[
KeyError: 'TankTemperature'
Log Details (ERROR)

This error originated from a custom integration.

Logger: homeassistant
Source: custom_components/daikin_altherma/water_heater.py:101
Integration: Daikin Altherma HVAC (documentation, issues)
First occurred: 09:35:28 (805 occurrences)
Last logged: 09:57:22

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 151, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 110, in async_update_listeners
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 348, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 572, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/water_heater/__init__.py", line 216, in state_attributes
    self.current_temperature,
  File "/config/custom_components/daikin_altherma/water_heater.py", line 101, in current_temperature
    current_temperature = status[
KeyError: 'TankTemperature'
tadasdanielius commented 1 year ago

And how about Space Heating, can you set Operation Mode and Temperatures?

mihsu81 commented 1 year ago

Sorry, I wasn't clear. Setting the Operation Mode and Temperatures for Space Heating throws the last 2 errors I've mentioned in my last message. I'm adding them in this message just to avoid confusion.

Log Details (ERROR)

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/daikin_altherma/water_heater.py:101
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 09:37:50 (8 occurrences)
Last logged: 09:57:14

[139909619291792] 'TankTemperature'
[139908550211712] 'TankTemperature'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 199, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1713, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1750, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 676, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 930, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 713, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/number/__init__.py", line 111, in async_set_value
    await entity.async_set_native_value(native_value)
  File "/config/custom_components/daikin_altherma/number.py", line 99, in async_set_native_value
    await self.coordinator.async_request_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 158, in async_request_refresh
    await self._debounced_refresh.async_call()
  File "/usr/src/homeassistant/homeassistant/helpers/debounce.py", line 82, in async_call
    await task
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 182, in async_refresh
    await self._async_refresh(log_failures=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 110, in async_update_listeners
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 348, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 572, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/water_heater/__init__.py", line 216, in state_attributes
    self.current_temperature,
  File "/config/custom_components/daikin_altherma/water_heater.py", line 101, in current_temperature
    current_temperature = status[
KeyError: 'TankTemperature'
Log Details (ERROR)

This error originated from a custom integration.

Logger: homeassistant
Source: custom_components/daikin_altherma/water_heater.py:101
Integration: Daikin Altherma HVAC (documentation, issues)
First occurred: 09:35:28 (805 occurrences)
Last logged: 09:57:22

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 151, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 110, in async_update_listeners
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 348, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 572, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/water_heater/__init__.py", line 216, in state_attributes
    self.current_temperature,
  File "/config/custom_components/daikin_altherma/water_heater.py", line 101, in current_temperature
    current_temperature = status[
KeyError: 'TankTemperature'
tadasdanielius commented 1 year ago

I meant Space Heating (Climate Control) - as the actual heating (separate device which controls room heating :)), not the water tank. So, I pre-released v1.3.2 it should address Water Tank issues. There is one difference to get the current temperature. I am not sure why your device does not have sensor for current temperature. So, I put some extra logging to see what response is coming back from the device. So it should throw lot of warnings (that is ok). Let's see how this will work.

mihsu81 commented 1 year ago

I meant Space Heating (Climate Control) - as the actual heating (separate device which controls room heating :)), not the water tank. So, I pre-released v1.3.2 it should address Water Tank issues. There is one difference to get the current temperature. I am not sure why your device does not have sensor for current temperature. So, I put some extra logging to see what response is coming back from the device. So it should throw lot of warnings (that is ok). Let's see how this will work.

Yes, controlling the Space Heating device was throwing errors about the Hot Water Tank. 😁 I'll check it now and let you know.

mihsu81 commented 1 year ago

Setting the Operation Mode and Temperatures for day and night for Space Heating (called Climate Control in ONECTA) is working fine now. Changing the Operation Mode to _heatingday during the day, turns on the schedule in ONECTA, and changing it to _heatingnight turns off the schedule in ONECTA. Maybe you'll be able to implement a schedule as well, even though HA might not support it yet.

Domestic Hot Water Tank gets created now as water heater, as well as its State sensor. Increasing and decreasing the temperature works fine, but setting the mode doesn't work. Changing the Operation Mode to on or powerful throws the error: Failed to call service water_heater/set_operation_mode. 'powerful' and it's logged as:

This error originated from a custom integration.

Logger: custom_components.daikin_altherma.water_heater
Source: custom_components/daikin_altherma/water_heater.py:101
Integration: Daikin Altherma HVAC (documentation, issues)
First occurred: 13:45:12 (1757 occurrences)
Last logged: 15:07:53

Hot Water status: {'sensors': {}, 'operations': {'Power': 'standby', 'OperationMode': 'heating', 'SensorTemperature': None, 'TargetTemperature': 46.0, 'DomesticHotWaterTemperatureHeating': 46.0}, 'states': {'ErrorState': False, 'WarningState': False}, 'consumption': {}}
Hot Water status: {'sensors': {}, 'operations': {'Power': 'standby', 'OperationMode': 'heating', 'SensorTemperature': None, 'TargetTemperature': 47.0, 'DomesticHotWaterTemperatureHeating': 47.0}, 'states': {'ErrorState': False, 'WarningState': False}, 'consumption': {}}
Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/daikin_altherma/__init__.py:321
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 14:19:32 (3 occurrences)
Last logged: 15:15:21

[139778342889136] 'powerful'
[139778716584016] 'powerful'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 199, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1713, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1750, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 676, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 930, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 713, in _handle_entity_call
    await result
  File "/config/custom_components/daikin_altherma/water_heater.py", line 60, in async_set_operation_mode
    await self._api.async_set_water_tank_state(operation_mode)
  File "/config/custom_components/daikin_altherma/__init__.py", line 321, in async_set_water_tank_state
    await self.device.hot_water_tank.set_powerful(False)
  File "/usr/local/lib/python3.10/site-packages/pyaltherma/controllers.py", line 224, in set_powerful
    await self.call_operation('Powerful', int(value))
  File "/usr/local/lib/python3.10/site-packages/pyaltherma/controllers.py", line 101, in call_operation
    conf = self._unit.operation_config[key]
KeyError: 'powerful'
This error originated from a custom integration.

Logger: homeassistant
Source: custom_components/daikin_altherma/__init__.py:302
Integration: Daikin Altherma HVAC (documentation, issues)
First occurred: 14:19:37 (1102 occurrences)
Last logged: 15:20:19

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 151, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 110, in async_update_listeners
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 348, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 570, in _async_write_ha_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/water_heater/__init__.py", line 179, in state
    return self.current_operation
  File "/config/custom_components/daikin_altherma/water_heater.py", line 120, in current_operation
    return self._api.water_tank_operation
  File "/config/custom_components/daikin_altherma/__init__.py", line 302, in water_tank_operation
    state = ops["powerful"]
KeyError: 'powerful'

Changing the temperature in HA, turns on the Domestic Hot Water Tank (called Hot Water in ONECTA). Irrespectively of the mode set in ONECTA, HA always shows off. In ONECTA the Domestic Hot Water Tank can only be turned on or off and the Mode is always set to Heating and grayed out. Screenshot_2022-08-20-15-08-17-50_4bcafe9f204dac669a9d9795053a31bd Screenshot_2022-08-20-15-13-48-91_c3a231c25ed346e59462e84656a70e50 Screenshot_2022-08-20-15-14-02-77_c3a231c25ed346e59462e84656a70e50

When loading the _waterheater component an error gets logged:

Logger: homeassistant.components.water_heater
Source: custom_components/daikin_altherma/__init__.py:302
Integration: Water Heater (documentation, issues)
First occurred: 15:26:36 (2 occurrences)
Last logged: 15:26:36

Error adding entities for domain water_heater with platform daikin_altherma
Error while setting up daikin_altherma platform for water_heater
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 673, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 776, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 570, in _async_write_ha_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/water_heater/__init__.py", line 179, in state
    return self.current_operation
  File "/config/custom_components/daikin_altherma/water_heater.py", line 120, in current_operation
    return self._api.water_tank_operation
  File "/config/custom_components/daikin_altherma/__init__.py", line 302, in water_tank_operation
    state = ops["powerful"]
KeyError: 'powerful'

The error you mentioned about loading all components is the below:

This error originated from a custom integration.

Logger: custom_components.daikin_altherma
Source: components/system_log/__init__.py:96
Integration: Daikin Altherma HVAC (documentation, issues)
First occurred: 14:03:35 (1 occurrences)
Last logged: 14:03:35

Unexpected error fetching daikin_altherma_coordinator data: not all arguments converted during string formatting
Traceback (most recent call last):
  File "/config/custom_components/daikin_altherma/__init__.py", line 190, in async_update
    self._status = await self.device.get_current_state()
  File "/usr/local/lib/python3.10/site-packages/pyaltherma/controllers.py", line 398, in get_current_state
    unit_status = await unit.get_current_state()
  File "/usr/local/lib/python3.10/site-packages/pyaltherma/controllers.py", line 130, in get_current_state
    operations = await self.read_operations()
  File "/usr/local/lib/python3.10/site-packages/pyaltherma/controllers.py", line 94, in read_operations
    results[operation] = await self.read_operation(operation)
  File "/usr/local/lib/python3.10/site-packages/pyaltherma/controllers.py", line 70, in read_operation
    return await self.read(query_type='Operation', prop=operation)
  File "/usr/local/lib/python3.10/site-packages/pyaltherma/controllers.py", line 49, in read
    result = await self._connection.request(destination)
  File "/usr/local/lib/python3.10/site-packages/pyaltherma/comm.py", line 46, in request
    response_str = await self._client.receive_str(timeout=self._timeout)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client_ws.py", line 275, in receive_str
    raise TypeError(f"Received message {msg.type}:{msg.data!r} is not str")
TypeError: Received message 8:1007 is not str

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 164, in _async_update_data
    return await self.update_method()
  File "/config/custom_components/daikin_altherma/__init__.py", line 57, in async_update_data
    await _api.async_update()
  File "/config/custom_components/daikin_altherma/__init__.py", line 214, in async_update
    _LOGGER.error(f'Failed to update the device status with error {e}', e)
  File "/usr/local/lib/python3.10/logging/__init__.py", line 1506, in error
    self._log(ERROR, msg, args, **kwargs)
  File "/usr/local/lib/python3.10/logging/__init__.py", line 1624, in _log
    self.handle(record)
  File "/usr/local/lib/python3.10/logging/__init__.py", line 1634, in handle
    self.callHandlers(record)
  File "/usr/local/lib/python3.10/logging/__init__.py", line 1696, in callHandlers
    hdlr.handle(record)
  File "/usr/local/lib/python3.10/logging/__init__.py", line 968, in handle
    self.emit(record)
  File "/usr/src/homeassistant/homeassistant/components/system_log/__init__.py", line 179, in emit
    entry = LogEntry(
  File "/usr/src/homeassistant/homeassistant/components/system_log/__init__.py", line 96, in __init__
    self.message = deque([record.getMessage()], maxlen=5)
  File "/usr/local/lib/python3.10/logging/__init__.py", line 368, in getMessage
    msg = msg % self.args
TypeError: not all arguments converted during string formatting
tadasdanielius commented 1 year ago

Schedules are a bit messy, so I leave it on the bottom of the roadmap. I drafted new pre-release which should remove powerful and hopefully this should solve the issues. One thing is still unclear to me? Do you see the current temperature of the water tank in the ONECTA app? Or just the target temperature?

mihsu81 commented 1 year ago

The Domestic Hot Water Tank component works fine now. I can change the Operation Mode to on (would look better if it appeared as On) and Off. ONECTA only displays the target temperature for the water tank. This water is used for washing, not heating the house. Would it be possible to enable EcoMode for Space Heating?

image

Is extra logging still enabled? HA seems slow to start.

tadasdanielius commented 1 year ago

Operation Mode for Hot Water Tank is implemented as HotWaterEntity. The whole UI is done by HA and "on" is outside the integration. So, probably, not the straightforward fix. Well, it's weird that Water Tank does not provide current temperature, only target. Anyway, going back to EcoMode. is EcoMode settable? Or is it just binary flag showing the mode? Most of the additional logging has been removed. Only few changes has been made to check whatever powerful mode is supported nothing else. So, I am not sure what could have caused performance degradation.

mihsu81 commented 1 year ago

Then maybe changing Off to off if that's possible. My question was more about consistency, than anything else. 😁 The stats of the water tank show the mode as off.

min_temp: 35
max_temp: 60
operation_list:
  - 'off'
  - 'on'
current_temperature: null
temperature: 47
target_temp_high: null
target_temp_low: null
operation_mode: 'on'
icon: mdi:bathtub-outline
friendly_name: Domestic Hot Water Tank
supported_features: 3

The Water Tank does provide the current water temperature but through the OpenTherm integration when using an OpenTherm gateway (the last screenshot). So I guess it's more about Daikin not providing the current domestic hot water temperature in the application. EcoMode (Economy mode) is settable in ONECTA, so i guess it should be settable through Websockets.

Home assistant integrations do start in about 1 minute, as they previously did, but afterwards HA is stuck for another 4 minutes with the message: Wrapping up startup, not everything will be available until it is finished. image

image

mihsu81 commented 1 year ago

A quick update, the additional loading times were unrelated to your integration. Sorry for the confusion. 😊

mihsu81 commented 1 year ago

Hi @tadasdanielius, Will you be able to add the EcoMode switch?

tadasdanielius commented 1 year ago

Yes, it's on my backlog :) Will try to add once I find some time.

eduardkirkosa commented 1 year ago

D2CND Altherma3RF

I have this 2 visible, would be possible to get info when : D2CND - change status from idle/running ? Altherma3RF - when pump/compressor starts ?

So' i can use it to start the recirculating pump ( the power outlet on/off ).

eduardkirkosa commented 1 year ago

Hi @tadasdanielius . would be possible to try add for Altherma the actuator status ( Pump/Compresor/BackupHeather/... ) ?

tadasdanielius commented 1 year ago

@mihsu81 Can you try EcoMode? I have pushed pre-release which should add ecomode switch

tadasdanielius commented 1 year ago

@eduardkirkosa unless you see in daikin app, I don't think it is possible to get that info (like Altherma the actuator status) from the ethernet controller, unfortunately.

mehmetu61 commented 1 year ago

Screenshot_20221109_074945

Hello, i have only this entity, is this correct or missing entitys?

mihsu81 commented 1 year ago

@tadasdanielius I've updated to v1.3.4 and the switch EcoMode appeared, but it throws errors when toggling it.

Log Details (ERROR)
Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/daikin_altherma/switch.py:58
Integration: Home Assistant WebSocket API ([documentation](https://www.home-assistant.io/integrations/websocket_api), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+websocket_api%22))
First occurred: 08:52:37 (2 occurrences)
Last logged: 08:52:47

[139720061232480] Invalid argument 0 for operation Power or operation is not settable.
[139720061232480] Invalid argument 1 for operation Power or operation is not settable.
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 200, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1744, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1781, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 208, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 678, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 943, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 715, in _handle_entity_call
    await result
  File "/config/custom_components/daikin_altherma/switch.py", line 53, in async_turn_on
    await self._set_state(self._states[0])
  File "/config/custom_components/daikin_altherma/switch.py", line 58, in _set_state
    await controller.call_operation(self._operation, state)
  File "/usr/local/lib/python3.10/site-packages/pyaltherma/controllers.py", line 118, in call_operation
    raise AlthermaException(
pyaltherma.errors.AlthermaException: Invalid argument 0 for operation Power or operation is not settable.
tadasdanielius commented 1 year ago

Ah silly mistake. Can you go to your config/custom_components/daikin_altherma/switch.py file and replace line 23 from

operation='Power',

to

operation='EcoMode',

and restart HA?

mihsu81 commented 1 year ago

Working fine now, but it needs to be inverted. When it is switched on in Daikin ONECTA, it appears switched off in HA, and viceversa.

tadasdanielius commented 1 year ago

Change line https://github.com/tadasdanielius/daikin_altherma/blob/5a2f749813cd509807201ea7661c55ffe5b66cec/custom_components/daikin_altherma/switch.py#L25

To

states=['1', '0'],
mihsu81 commented 1 year ago

Thanks a lot. Now it displays correctly the status of EcoMode. One more thing I've noticed over the past months since using the integration, is that the target temperature cannot be changed in steps of 0.5. But I'm able to adjust it from ONECTA and it is displayed properly in HA.

tadasdanielius commented 1 year ago

Thanks a lot. Now it displays correctly the status of EcoMode. One more thing I've noticed over the past months since using the integration, is that the target temperature cannot be changed in steps of 0.5. But I'm able to adjust it from ONECTA and it is displayed properly in HA.

Try to copy whole number.py file

https://github.com/tadasdanielius/daikin_altherma/blob/e374ffbc25a02e2fc0337561b3fe4e107af51795/custom_components/daikin_altherma/number.py

let's see if that helps

mihsu81 commented 1 year ago

Thanks a lot. Now it displays correctly the status of EcoMode. One more thing I've noticed over the past months since using the integration, is that the target temperature cannot be changed in steps of 0.5. But I'm able to adjust it from ONECTA and it is displayed properly in HA.

Try to copy whole number.py file

https://github.com/tadasdanielius/daikin_altherma/blob/e374ffbc25a02e2fc0337561b3fe4e107af51795/custom_components/daikin_altherma/number.py

let's see if that helps

It didn't help unfortunately. I've set the temperature to 23.5 from HA and after about 30 seconds it appeared as 23 in ONECTA. After about another 30 seconds it also appeared in HA as 23.

tadasdanielius commented 1 year ago

Ok how about now? Copy this file https://github.com/tadasdanielius/daikin_altherma/blob/d864f29bcb74697425587faa7db7bfde7af4b269/custom_components/daikin_altherma/number.py again

mihsu81 commented 1 year ago

Ok how about now? Copy this file https://github.com/tadasdanielius/daikin_altherma/blob/d864f29bcb74697425587faa7db7bfde7af4b269/custom_components/daikin_altherma/number.py again

This worked perfectly. Thanks a lot. I guess the implementation of the schedule is still not possible for the time being, because of HA's limitation.

tadasdanielius commented 1 year ago

Ok how about now? Copy this file https://github.com/tadasdanielius/daikin_altherma/blob/d864f29bcb74697425587faa7db7bfde7af4b269/custom_components/daikin_altherma/number.py again

This worked perfectly. Thanks a lot. I guess the implementation of the schedule is still not possible for the time being, because of HAs limitation.

AFAIK, dealing with daikin device schedules isn't straightforward thing. Personally, I never even tried to use device schedules :). So, too much work with not so much benefit. Especially, that we can use HA schedules and get rid of device schedules.

mihsu81 commented 1 year ago

I absolutely agree with you. I was mentioning it more for the sake of completeness than usability. 😁 Unless you disagree, I'll be closing the issue as completed.

tadasdanielius commented 1 year ago

Sure, you can close that.