Daikin AC Integration BRP069C4x

@fredrike as suggested a new post to address the issue using the standard Daikin AC integration with home assistant OS

I have this unit

I had already created github issue

hereby error Debug log:

2021-01-19 20:26:12 ERROR (MainThread) [homeassistant.components.climate] Error adding entities for domain climate with platform daikin
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 316, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 531, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 296, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 320, in _async_write_ha_state
    sstate = self.state
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 173, in state
    return self.hvac_mode
  File "/usr/src/homeassistant/homeassistant/components/daikin/climate.py", line 194, in hvac_mode
    daikin_mode = self._api.device.represent(HA_ATTR_TO_DAIKIN[ATTR_HVAC_MODE])[1]
  File "/usr/local/lib/python3.8/site-packages/pydaikin/daikin_airbase.py", line 107, in represent
    k, val = super().represent(key)
  File "/usr/local/lib/python3.8/site-packages/pydaikin/daikin_base.py", line 295, in represent
    val = self.values[key]
KeyError: 'mode'
2021-01-19 20:26:12 ERROR (MainThread) [homeassistant.components.climate] Error while setting up daikin platform for climate
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 207, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 316, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 531, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 296, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 320, in _async_write_ha_state
    sstate = self.state
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 173, in state
    return self.hvac_mode
  File "/usr/src/homeassistant/homeassistant/components/daikin/climate.py", line 194, in hvac_mode
    daikin_mode = self._api.device.represent(HA_ATTR_TO_DAIKIN[ATTR_HVAC_MODE])[1]
  File "/usr/local/lib/python3.8/site-packages/pydaikin/daikin_airbase.py", line 107, in represent
    k, val = super().represent(key)
  File "/usr/local/lib/python3.8/site-packages/pydaikin/daikin_base.py", line 295, in represent
    val = self.values[key]
KeyError: 'mode'
2 Likes

Enable debug logging and paste the output here…

logger:
  default: info
  logs:
    homeassistant.components.daikin: notset
    pydaikin: notset

see below log

2021-01-20 21:17:26 INFO (MainThread) [homeassistant.components.climate] Setting up climate.daikin
2021-01-20 21:17:26 INFO (MainThread) [homeassistant.components.switch] Setting up switch.daikin
2021-01-20 21:17:27 ERROR (MainThread) [homeassistant.components.climate] Error adding entities for domain climate with platform daikin

Traceback (most recent call last):

  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 316, in async_add_entities

    await asyncio.gather(*tasks)

  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in _async_add_entity

    await entity.add_to_platform_finish()

  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 531, in add_to_platform_finish

    self.async_write_ha_state()

  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 296, in async_write_ha_state

    self._async_write_ha_state()

  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 320, in _async_write_ha_state

    sstate = self.state

  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 173, in state

    return self.hvac_mode

  File "/usr/src/homeassistant/homeassistant/components/daikin/climate.py", line 194, in hvac_mode

    daikin_mode = self._api.device.represent(HA_ATTR_TO_DAIKIN[ATTR_HVAC_MODE])[1]

  File "/usr/local/lib/python3.8/site-packages/pydaikin/daikin_airbase.py", line 107, in represent

    k, val = super().represent(key)

  File "/usr/local/lib/python3.8/site-packages/pydaikin/daikin_base.py", line 295, in represent

    val = self.values[key]

KeyError: 'mode'

2021-01-20 21:17:27 ERROR (MainThread) [homeassistant.components.climate] Error while setting up daikin platform for climate

Traceback (most recent call last):

  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 207, in _async_setup_platform

    await asyncio.gather(*pending)

  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 316, in async_add_entities

    await asyncio.gather(*tasks)

  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in _async_add_entity

    await entity.add_to_platform_finish()

  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 531, in add_to_platform_finish

    self.async_write_ha_state()

  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 296, in async_write_ha_state

    self._async_write_ha_state()

  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 320, in _async_write_ha_state

    sstate = self.state

  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 173, in state

    return self.hvac_mode

  File "/usr/src/homeassistant/homeassistant/components/daikin/climate.py", line 194, in hvac_mode

    daikin_mode = self._api.device.represent(HA_ATTR_TO_DAIKIN[ATTR_HVAC_MODE])[1]

  File "/usr/local/lib/python3.8/site-packages/pydaikin/daikin_airbase.py", line 107, in represent

    k, val = super().represent(key)

  File "/usr/local/lib/python3.8/site-packages/pydaikin/daikin_base.py", line 295, in represent

    val = self.values[key]

KeyError: 'mode'

2021-01-20 21:21:23 INFO (MainThread) [homeassistant.components.climate] Setting up climate.daikin
2021-01-20 21:21:23 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.daikin
2021-01-20 21:21:23 INFO (MainThread) [homeassistant.components.switch] Setting up switch.daikin
2021-01-20 21:21:23 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.daikin entity: sensor.daikin_ac_inside_temperature
2021-01-20 21:21:24 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new climate.daikin entity: climate.daikin_ac
2021-01-20 21:21:24 ERROR (MainThread) [homeassistant.components.climate] Error adding entities for domain climate with platform daikin
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 316, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 531, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 296, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 320, in _async_write_ha_state
    sstate = self.state
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 173, in state
    return self.hvac_mode
  File "/usr/src/homeassistant/homeassistant/components/daikin/climate.py", line 194, in hvac_mode
    daikin_mode = self._api.device.represent(HA_ATTR_TO_DAIKIN[ATTR_HVAC_MODE])[1]
  File "/usr/local/lib/python3.8/site-packages/pydaikin/daikin_airbase.py", line 107, in represent
    k, val = super().represent(key)
  File "/usr/local/lib/python3.8/site-packages/pydaikin/daikin_base.py", line 295, in represent
    val = self.values[key]
KeyError: 'mode'
2021-01-20 21:21:24 ERROR (MainThread) [homeassistant.components.climate] Error while setting up daikin platform for climate
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 207, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 316, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 531, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 296, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 320, in _async_write_ha_state
    sstate = self.state
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 173, in state
    return self.hvac_mode
  File "/usr/src/homeassistant/homeassistant/components/daikin/climate.py", line 194, in hvac_mode
    daikin_mode = self._api.device.represent(HA_ATTR_TO_DAIKIN[ATTR_HVAC_MODE])[1]
  File "/usr/local/lib/python3.8/site-packages/pydaikin/daikin_airbase.py", line 107, in represent
    k, val = super().represent(key)
  File "/usr/local/lib/python3.8/site-packages/pydaikin/daikin_base.py", line 295, in represent
    val = self.values[key]
KeyError: 'mode

In the daikin app it shows the following in the device settings of the unit: BRP069C4x

You might be on to something, I can’t re-add my AC either…

Will investigate some more.

My wrong, I couldn’t add my unit as I entered the wrong IP.

Can you access your unit at http://ip ? Mine answers with this:

ret=OK,type=aircon,reg=eu,dst=1,ver=3_3_6,pow=1,err=0,location=0,name=%4d%6a%c3%b6%76%69%6b,icon=2,method=polling,port=30050,id=fredrike81,pw=bjybaosd,lpw_flag=0,adp_kind=2,pv=1,cpv=0,cpv_minor=00,led=0,en_setzone=1,mac=A408EAF07AFE,adp_mode=run,en_hol=0,grp_name=,en_grp=0

this is what I see

That’s the same as @rospogrigio posted here: Daikin Airconditioning & WiFi module

Your unit is not supported and we have not managed to reverse-engineer the protocol.

I am starting to believe that the new BRP069C4x operates using websockets, which unfortunately I don’t know well. Need to study a bit, and do some sniffing… if @fredrike or anyone else has something to suggest or can push me in any direction I’ll be grateful :wink:

If we could get a wireshark dump of what traffic your app sends (w/o encryption) we probably could de-cipher it.

I tried to sniff the traffic but it all seems to go to the cloud (and not directly to the unit), and it’s all encrypted… how can we decrypt it? How can we determine the encryption keys?
You can download the dump from here:

You need to get it trough your own set of ssl-certs.

Google for ssl-proxy.

I’m trying, but when I start capturing the app says it is offline… trying to understand what I’m doing wrong.
I’m using an app called PCAP remote, and then wireshark to view the packets.
Suggestions?
Thank you

I don’t have any experience with this. Perhaps they are doing some kind of certificate pinning so they don’t accept your certificate.

I did have a look at thessource ccode bbut couldn’t find anything useful from it…

What was the servername tthat tthe aapp is communicating with? Perhaps we could search the source for that and see if we find anything useful from there.

I see attempts of connection to daikin-unicloud-prod.auth.eu-west-1.amazoncognito.com , and *.auth.eu-west-1.amazoncognito.com as dNSName in the Key exchange handshake. Don’t know how to go farther, will google to see if there is a way to do some MITM…

This file have some interesting strings…

DaikinResidentialController_v1.6.0.3607_apkpure.com_source_from_JADX % strings resources/assets/index.android.bundle|less

I see. But how can we use it? I’ve tried to discompile with react-native-decompiler but did not succeed, I’m afraid it’s encrypted too. Sorry but I have very little knowledge of android development… ideas?

@elRadix

Is this the same models: mustang51 / pydaikin / issues / #12 - Support for controller BRP069C4x — Bitbucket

Although it would be fun to build support this is a job that would take ~20h to complete, not sure I’m up to it just for fun…

I have indeed the controller BRP069C4x as shown in my Daikin app
Let me know what you to test it, I can provide the necessary access if needed, send me DM.

Oooooh, this looks very interesting and very promising!! I’ll have a look at this as soon as I have some time, thanks!
Edit: oh no, it looks like the above document is for NA (North America), maybe there is something similar for Europe? Can’t find it though…
Edit 2: I found something similar ( dkn.airzonecloud.com ) but I don’t think it’s the same device we are talking about (BRP069C4x), since I registered and tried to input the details of my device but the MAC address is not recognized. These APIs probably refer to that Airzone adaptor, while my AC has the wifi adapter integrated (it’s not visible). I think we have to find some other API document, assuming they’ll be disclosing it.