BigFoot2020 / daikin_residential_brp069a62

GNU General Public License v3.0
13 stars 4 forks source link

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

Closed mihsu81 closed 1 year ago

mihsu81 commented 2 years ago

Hi @BigFoot2020,

Would you be able to add support for a gas condensing boiler D2CND with gateway DRGATEWAYAA and room thermostat DOTROOMTHEAA? Or at least give me some hints on how i could integrate it? 🙂 At the moment the hot water setpoint and inside temperature are detected, as well as the on/off controls of room and water heating. image

The climate and water_heater entities don't get created because of 2 errors.

Log Details (ERROR)
Logger: homeassistant.components.climate
Source: custom_components/daikin_residential_brp069a62/daikin_base.py:259
Integration: Climate (documentation, issues)
First occurred: 11:14:38 AM (2 occurrences)
Last logged: 11:14:38 AM

Error adding entities for domain climate with platform daikin_residential_brp069a62
Error while setting up daikin_residential_brp069a62 platform for climate
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 514, in _async_add_entity
    capabilities=entity.capability_attributes,
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 226, in capability_attributes
    ATTR_HVAC_MODES: self.hvac_modes,
  File "/config/custom_components/daikin_residential_brp069a62/climate.py", line 173, in hvac_modes
    return self._device.hvac_modes
  File "/config/custom_components/daikin_residential_brp069a62/daikin_base.py", line 259, in hvac_modes
    modes.append(DAIKIN_HVAC_TO_HA[mode])
KeyError: 'heatingDay'
Logger: homeassistant.components.water_heater
Source: custom_components/daikin_residential_brp069a62/daikin_base.py:141
Integration: Water Heater (documentation, issues)
First occurred: 11:14:38 AM (2 occurrences)
Last logged: 11:14:38 AM

Error adding entities for domain water_heater with platform daikin_residential_brp069a62
Error while setting up daikin_residential_brp069a62 platform for water_heater
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 614, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 782, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 539, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 574, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/water_heater/__init__.py", line 204, in state_attributes
    self.current_temperature,
  File "/config/custom_components/daikin_residential_brp069a62/water_heater.py", line 118, in current_temperature
    return self._device.dhw_temperature
  File "/config/custom_components/daikin_residential_brp069a62/daikin_base.py", line 141, in dhw_temperature
    return float(self.getValue(ATTR_DHW_TEMPERATURE))
TypeError: float() argument must be a string or a number, not 'NoneType'

For the climate entity, operationMode would have to be sent as heating instead of heatingDay and heatingNight.

                "operationMode": {
                    "settable": true,
                    "value": "heatingNight",
                    "values": [
                        "heatingDay",
                        "heatingNight"
                    ]

Here's the json file. daikin_puredata.zip

Thanks in advance.

BigFoot2020 commented 2 years ago

Hello!

I have not been able to figure out how to make this component work for other setups, not enough time or motivation (as I'm currnetly using another component with local control). I can give you hints how to get climate entity working. For water heater entity, it looks like your device does not have tank, but flow-through without temp sensor, so could be difficult to get working. Also it does not have "Powerful" mode, which could cause additional errors if not disabled in code.

Hints for changing code for climate entity (so files in /config/custom_components/daikin_residential_brp069a62 folder):

In const.py: lines 57-59, replace with

ATTR_HVAC_MODE_COOL = "heatingDay"
ATTR_HVAC_MODE_HEAT = "heatingDay"
ATTR_HVAC_MODE_AUTO = "heatingNight"

In climate.py: line 127, replace: return self._device.leavingWater_temperature with: return self._device.inside_temperature

In daikin_base.py: line 268, replace: return await self.setValue(ATTR_TARGET_TEMPERATURE, int(value)) with: return await self.setValue(ATTR_TARGET_TEMPERATURE, float(value))

In device.py line 218, replace + str(type(descr["value"])) with + str(type(descr["stepValue"]))

For water heater you may try: In water_heater.py: line 118, replace: return self._device.dhw_temperature with: return self._device.dhw_target_temperature

Let me know how it goes.

mihsu81 commented 2 years ago

Thanks a lot @BigFoot2020. It worked fine. Now I'll have to find a way to match the Day/Night schedule of my specific setup, remove the cooling part and adjust the water heater.

mihsu81 commented 2 years ago

Hi @BigFoot2020,

tadasdanielius was able to implement support for this gas boiler in his "Daikin Altherma" integration (which I think you're using as well). https://github.com/tadasdanielius/daikin_altherma/issues/31 For the sake of availability, would you be willing/available to implement his changes in your integration? Thanks in advance.

BigFoot2020 commented 2 years ago

I would be willing to implement this, but I simply lack the knowledge needed to do that. My current opinion is that with current architecture it is not possible to properly support different setups. That probably was the main reason why I had to create this repository, as it was too difficult to add support for my device to original repository.

As I see there is 2 options:

  1. Create a fork (or new repository as I did) for your setup and implement needed changes there. I'm willing to help as much as I can.
  2. Rebuild from scratch so that new implementation would support different devices (theoretically any device that is supported Daikin ONECTA app). Unfortunately this would be way too difficult for me, so unless you know a developer would could help it's not going to happen.
BigFoot2020 commented 1 year ago

In case interested Daikin Residential for Altherma now supports BRP069A62. You may want try if it also works for your system.

jwillemsen commented 1 year ago

It looks there is a custom schedule in the json provided, that seems to change the available operation modes. At the moment you want HA to control your alterma don't use a schedule at the daikin side, let HA control your altherma completely.

mihsu81 commented 1 year ago

It looks like with https://github.com/speleolontra/daikin_residential_altherma/ the gas boiler is not detected at all. There aren't any warnings or errors in System/Logs.

jwillemsen commented 1 year ago

Can you try https://github.com/jwillemsen/daikin_residential_altherma/tree/jwi-energyconsumption, it looks your device has NDJ as model, the data looks similar. Please enable debug logging of the integration, see the readme for how to do that.

jwillemsen commented 1 year ago

Please enable debug logging, see https://github.com/speleolontra/daikin_residential_altherma#setting-the-log-level, restart HA and attach your HA log

jwillemsen commented 1 year ago

That is the json file, I need the debug log, you can get it from settings/system/logs/download full log

mihsu81 commented 1 year ago

Whoops. 😁 home-assistant_2023-03-24T09-16-42.450Z.log

jwillemsen commented 1 year ago

Did you checkout my test branch, you log says

2023-03-24 11:05:49.819 INFO (MainThread) [custom_components.daikin_residential_altherma.daikin_api] Found device 'NDJ' with gateway model 'DRGATEWAYAA'
2023-03-24 11:05:49.819 INFO (MainThread) [custom_components.daikin_residential_altherma.daikin_api] Device 'NDJ' with gateway model 'DRGATEWAYAA' is filtered out because it is not an Altherma model

But I changed the error message to contain out because it is not a supported model

BigFoot2020 commented 1 year ago

2 integrations (BRP... and Althrema) would be trying to add same device with same name, this may cause issues (confirmed this on my test HA). Would it be possible for you to set up separate test HA with only daikin_residential_altherma added? If not, then you may want to remove daikin_residential_brp069a62 first.

jwillemsen commented 1 year ago

Please attach the log, that should give me some more ideas

mihsu81 commented 1 year ago

Sorry, I thought I did. home-assistant_2023-03-24T14-18-16.197Z.log home-assistant_2023-03-24T14-21-24.882Z.log.txt

jwillemsen commented 1 year ago

Both logs don't have "it is not a supported model", but the old message "because it is not an Altherma model", are you sure you checked out my branch on your system?

mihsu81 commented 1 year ago

In HACS appears your fork, but when i check it in Devices & Services after adding it, I see the main integration from speleolontra. Do I have to do anything else except adding https://github.com/jwillemsen/daikin_residential_altherma/tree/jwi-energyconsumption as a custom repo in HACS and downloading it? image

jwillemsen commented 1 year ago

I don't use HACS regulary, I use git directly, you can use git clone --branch jwi-energyconsumption https://github.com/jwillemsen/daikin_residential_altherma to clone the source code, take the files you get in the new daikin_residential_altherma directory and replace the files that HACS has put on disc, and restart HA

BigFoot2020 commented 1 year ago

I have "Samba share" add-on enabled in HA. So I download repo as zip, extract and copy needed file to share, then restart HA.

jwillemsen commented 1 year ago

Ok, on https://github.com/jwillemsen/daikin_residential_altherma/tree/jwi-energyconsumption you can download the zip, attach the logs here again, let us see what happens when we relax the check for the model

mihsu81 commented 1 year ago

The device gets created after replacing the files, but it's missing the controls because of climate restrictions.

Log Details (ERROR)
Logger: homeassistant.components.climate
Source: custom_components/daikin_residential_altherma/daikin_base.py:157
Integration: Climate ([documentation](https://www.home-assistant.io/integrations/climate), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+climate%22))
First occurred: 16:20:24 (4 occurrences)
Last logged: 16:21:36

Error adding entities for domain climate with platform daikin_residential_altherma
Error while setting up daikin_residential_altherma platform for climate
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 442, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 629, in _async_add_entity
    capabilities=entity.capability_attributes,
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 262, in capability_attributes
    ATTR_HVAC_MODES: self.hvac_modes,
  File "/config/custom_components/daikin_residential_altherma/climate.py", line 307, in hvac_modes
    return self._device.hvac_modes
  File "/config/custom_components/daikin_residential_altherma/daikin_base.py", line 157, in hvac_modes
    modes.append(DAIKIN_HVAC_TO_HA[mode])
KeyError: 'heatingDay'

image

jwillemsen commented 1 year ago

Can you pull my branch and try again, made a small addition for the special operation modes, see https://github.com/speleolontra/daikin_residential_altherma/pull/139/commits/5ab50b541d439aeb5381c78c010ac1dbaf37b61a

jwillemsen commented 1 year ago

One question, is heatingDay/heatingNight a custom schedule you have or is that something standard for this device? If this is your custom schedule, can you try to remove it so that you just heave heating as operation mode

mihsu81 commented 1 year ago

The climate entity gets created now but both actions are Heat.

heatingDay and heatingNight are the 2 working modes of the device.

There are also 2 possible schedules which can be enabled on the boiler.

image

jwillemsen commented 1 year ago

Ok, made another change to just have one heat. Day/night is something that very likely something that should be a preset_mode, but that is too much work at this moment, need to think about how to add that in a clean way. Shall I merge the changes I have now, that at least gives you some support?

mihsu81 commented 1 year ago

Thanks a lot guys for all the work you put into this.

I only get Heat and Off now and I can adjust the temperature.

image

The water_heater device is not added by the integration.

image

This is another approach to control the gas boiler from the local integration. https://github.com/tadasdanielius/daikin_altherma

image

jwillemsen commented 1 year ago

Please attach a new log, maybe the watertank is just a small issue

mihsu81 commented 1 year ago

Here it is. home-assistant_2023-03-24T17-14-21.248Z.log

jwillemsen commented 1 year ago

@mihsu81 Ok, there are two issues for the water tank, one is easy, there is no separate tankTemperature sensor, so I can check the availability of the management point. But, the management point for your device is called domesticHotWaterFlowThrough and with the altherma3 it is domesticHotWaterTank. The way the code is currently structured this is not a simple change, it requires https://github.com/speleolontra/daikin_residential_altherma/issues/86 to be implemented which is a large structural change, not sure when I get enough spare time to try that.

mihsu81 commented 1 year ago

Ok, then I guess we can go ahead with support in the current state and will add more as you have time.

jwillemsen commented 1 year ago

Yes, maybe some time next week to try the new approach for just the water tank