[SOLVED] Daikin BRP072C42 can't connect to home assistant

Adapter Model: BRP072C42 A/C Unit Model: FTKM18SV2S
I can ping the device from the home assistant container
I can control the device from the daikin app
I already put in the API key from the sticker field labeled “KEY”
I have an BRP069B41 in the same A/C model that works just fine with this integration

Stack Trace:

2021-01-18 10:01:12 ERROR (MainThread) [homeassistant.components.daikin.config_flow] ClientError
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 969, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs) # type: ignore # noqa
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1025, in create_connection
raise exceptions[0]
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1010, in create_connection
sock = await self._connect_sock(
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 924, in _connect_sock
await self.sock_connect(sock, address)
File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 496, in sock_connect
return await fut
File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 528, in _sock_connect_cb
raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 111] Connect call failed ('192.168.0.133', 80)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/daikin/config_flow.py", line 73, in _create_device
device = await Appliance.factory(
File "/usr/local/lib/python3.8/site-packages/pydaikin/daikin_base.py", line 115, in factory
await appl.update_status(appl.HTTP_RESOURCES[:1])
File "/usr/local/lib/python3.8/site-packages/pydaikin/daikin_base.py", line 209, in update_status
self.values.update(await self._get_resource(resource))
File "/usr/local/lib/python3.8/site-packages/pydaikin/daikin_base.py", line 185, in _get_resource
return await self._run_get_resource(resource)
File "/usr/local/lib/python3.8/site-packages/pydaikin/daikin_base.py", line 196, in _run_get_resource
async with self.session.get(f'http://{self._device_ip}/{resource}') as resp:
File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 1117, in __aenter__
self._resp = await self._coro
File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 520, in _request
conn = await self._connector.connect(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 535, in connect
proto = await self._create_connection(req, traces, timeout)
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 892, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 1051, in _create_direct_connection
raise last_exc
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 1020, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 975, in _wrap_create_connection
raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.0.133:80 ssl:default [Connect call failed ('192.168.0.133', 80)]

Curl Request to the Adapter:



It seems like the API is active at port 443 not 80, the port that home assistant is trying to connect to
EDIT: got it to work by changing the adapter region to US

1 Like

Hi! I have the same unit. I keep adding it over and over again and it keeps on returning as this device is already configured.

Turned on debug logs and here is what i saw.

Logger: pydaikin.daikin_base
Source: components/daikin/config_flow.py:87
First occurred: 5:09:50 PM (2 occurrences)
Last logged: 5:44:19 PM

Exception in TaskGroup: Cannot connect to host 192.168.0.4:80 ssl:default [Connect call failed (‘192.168.0.4’, 80)]
Exception in TaskGroup: Cannot connect to host 192.168.0.4:2000 ssl:default [Connect call failed (‘192.168.0.4’, 2000)]

How did you go about changing the region? Is this curl command something i can do inside home assistant?

Looks like your device is failing to connect over HTTP(80), so most likely it might be listening on HTTPS(443)

If that is the case, then you may need to establish a https connection via curl
If you have the Advanced SSH & Web Terminal addon installed in HomeAssistant, then you can access the terminal and run Curl commands such as

curl --insecure "https://192.168.0.4/common/get_regioncode"

You may run into 2 different issues.
If you get a TLS error for unsafe legacy negotiation disabled, you may need to change the openssl config to allow legacy connections

Then there may also be authorization issues, in which you need to pass the API key in the request.

echo -e "openssl_conf = openssl_init\n[openssl_init]\nssl_conf = ssl_sect\n[ssl_sect]\nsystem_default = system_default_sect\n[system_default_sect]\nOptions = UnsafeLegacyRenegotiation" | OPENSSL_CONF=/dev/stdin curl --insecure -H "X-Daikin-uuid: a46ec8425057454e8f75301976035f59" "https://192.168.0.4/common/register_terminal?key=[10/13DIGITKEY]"

Note replace the [10/13DIGITKEY] with the actual Key found on the sticker label of the controller.

The command should return something like ret=OK

Now you should be able to issue other commands such as

echo -e "openssl_conf = openssl_init\n[openssl_init]\nssl_conf = ssl_sect\n[ssl_sect]\nsystem_default = system_default_sect\n[system_default_sect]\nOptions = UnsafeLegacyRenegotiation" | OPENSSL_CONF=/dev/stdin curl --insecure -H "X-Daikin-uuid: a46ec8425057454e8f75301976035f59" "https://192.168.0.4/common/get_regioncode"

which should return a response such as ret=OK,reg=th which indicates the region is set to Thailand

echo -e "openssl_conf = openssl_init\n[openssl_init]\nssl_conf = ssl_sect\n[ssl_sect]\nsystem_default = system_default_sect\n[system_default_sect]\nOptions = UnsafeLegacyRenegotiation" | OPENSSL_CONF=/dev/stdin curl --insecure -H "X-Daikin-uuid: a46ec8425057454e8f75301976035f59" "https://192.168.0.4/common/set_regioncode?reg=us"

If set correctly it would return ret=OK,reg=us indicating region has changed.

From my own BRP072C42 unit, changing to any other region appart from Thailand would result in the endpoint updating to HTTP only, and also lead to the device failing to register in the native Daikin mobile app.

Once the device is on HTTP, it should be able to integrate into HomeAssistant without issues. The only downside I found is that it has slightly less fucntionality compared to using over HTTPS - ie Only Climate Control, Indoor/Outdoor temperature is exposed.

Other functions such as Fan Speed, preset modes, Swing modes, compressor energy consumption is all not available.

If you need to switch back to a different region, you can now just run curl such as

curl "http://192.168.0.4/common/set_regioncode?reg=th"