home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
74.1k stars 31.1k forks source link

Daikin Aircondition integration broken as of 117.0 #46302

Closed shadow7412 closed 3 years ago

shadow7412 commented 3 years ago

The problem

Although it seems to work in 116.4, upgrading to 117.0 prevents me from being able to control my US7s.

The airconditioners are coming up as orphaned devices. Deleting them and trying to recreate them in the newer version doesn't work either..

I've seen a couple of possibly relevant errors come up in the logs during startup, which have been put in the logs section of this form.

This error is preventing me from upgrading to a secure release. I found the version causing it by upgrading version one by one from the one I was using until it broke - as upgrading to the latest version (2021.2.2) gave me the same issue.

What is version of Home Assistant Core has the issue?

117

What was the last working version of Home Assistant Core?

116.4

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Daikin

Link to integration documentation on our website

https://www.home-assistant.io/integrations/daikin/

Example YAML snippet

# Put your YAML below this line

Anything in the logs that might be useful for us?

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/discovery/__init__.py", line 196, in scan_devices
results = await hass.async_add_executor_job(
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/discovery/__init__.py", line 223, in _discover
netdisco.scan(zeroconf_instance=zeroconf_instance)
File "/usr/local/lib/python3.8/site-packages/netdisco/discovery.py", line 72, in scan
self.daikin.scan()
File "/usr/local/lib/python3.8/site-packages/netdisco/daikin.py", line 26, in scan
self.update()
File "/usr/local/lib/python3.8/site-packages/netdisco/daikin.py", line 77, in update
'id': entry['id'],
KeyError: 'id'

And this one:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 426, in async_trigger
await self.action_script.async_run(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1010, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 245, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 253, in _async_step
await getattr(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 472, in _async_device_step
await platform.async_call_action_from_config(
File "/usr/src/homeassistant/homeassistant/components/climate/device_action.py", line 93, in async_call_action_from_config
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1398, in async_call
raise ServiceNotFound(domain, service) from None
homeassistant.exceptions.ServiceNotFound: Unable to find service climate/set_hvac_mode
probot-home-assistant[bot] commented 3 years ago

daikin documentation daikin source (message by IssueLinks)

probot-home-assistant[bot] commented 3 years ago

Hey there @fredrike, mind taking a look at this issue as its been labeled with an integration (daikin) you are listed as a codeowner for? Thanks! (message by CodeOwnersMention)

fredrike commented 3 years ago

I'll take a look at it. It must be something that happened in that release.

Can you add your device with ip-address (bypassing the discovery part)?

shadow7412 commented 3 years ago

Sorry, but I'm a bit confused by what you mean. Is discovery still required after the devices have been set up? I'm not sure how you set one up manually...

But I found this other message in the logs when I just switched back to 2020.2.2:

Config entry '192.168.X.XX' for daikin integration not ready yet. Retrying in 80 seconds

Messages like that are repeating themselves for each of the units.

fredrike commented 3 years ago

Looking trough the changes from here: https://github.com/home-assistant/core/commits/dev/homeassistant/components/daikin

And 0.117 was released Oct 28, and 0.164.0 was released Oct 15 I don't see any obvious changes..

Also found this: https://community.home-assistant.io/t/0-117-quick-bar-compact-header-a-yaml-editor-xbox-and-template-types/239954/43?u=fredrike

fredrike commented 3 years ago

@shadow7412, your pasted logs indicates issues with the discovery module

File "/usr/local/lib/python3.8/site-packages/netdisco/discovery.py", line 72, in scan
self.daikin.scan()
File "/usr/local/lib/python3.8/site-packages/netdisco/daikin.py", line 26, in scan
self.update()
File "/usr/local/lib/python3.8/site-packages/netdisco/daikin.py", line 77, in update
'id': entry['id'],
KeyError: 'id'

That module have been deprecated for quite some time (and does not accept updates).

What I meant is to add your device via Integations..

Screenshot 2021-02-11 at 09 27 16
shadow7412 commented 3 years ago

I upgraded to latest, then deleted the integrations that exist. Then, ignorning the discovered devices, I went to add a Daikin AC integration.

If I fill out the API Key and password (with the SSID, right?) I get the following log.

2021-02-18 20:18:53 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 964, in _create_direct_connection
hosts = await asyncio.shield(self._resolve_host(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 829, in _resolve_host
addrs = await \
File "/usr/local/lib/python3.8/site-packages/aiohttp/resolver.py", line 29, in resolve
infos = await self._loop.getaddrinfo(
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 825, in getaddrinfo
return await self.run_in_executor(
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.8/socket.py", line 918, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name does not resolve

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 118, in factory
await appl.init()
File "/usr/local/lib/python3.8/site-packages/pydaikin/daikin_skyfi.py", line 66, in init
await self.update_status(self.HTTP_RESOURCES)
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_skyfi.py", line 106, in _run_get_resource
return await super()._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 1012, in __aenter__
self._resp = await self._coro
File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 480, in _request
conn = await self._connector.connect(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 523, in connect
proto = await self._create_connection(req, traces, timeout)
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 858, in _create_connection
_, proto = await self._create_direct_connection(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 971, in _create_direct_connection
raise ClientConnectorError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host den ac:2000 ssl:default [Name does not resolve]

If I leave them blank and only fill out the host (which I'm pretty sure is wrong, but I thought I'd try it) I get this one;

2021-02-18 20:21:01 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 936, 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.2.43', 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 1012, in __aenter__
self._resp = await self._coro
File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 480, in _request
conn = await self._connector.connect(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 523, in connect
proto = await self._create_connection(req, traces, timeout)
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 858, in _create_connection
_, proto = await self._create_direct_connection(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 1004, in _create_direct_connection
raise last_exc
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 980, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 943, in _wrap_create_connection
raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.2.43:80 ssl:default [Connect call failed ('192.168.2.43', 80)]

I've pinged you on discord. If you like, we can diagnose the issue there. I figure it'll be faster if you can watch what I'm doing wrong.

shadow7412 commented 3 years ago

Oh, A small note; I used the only Daikin AC integration in my list. If this one is deprecated, then what's the name of the one I should be using? Any ideas why it wouldn't come up?

fredrike commented 3 years ago

If I fill out the API Key and password (with the SSID, right?)

The API Key is only used by BRP072Cx devices.

bild

shadow7412 commented 3 years ago

Ok, I've tried that. It loads for a while (which seems promising) but then bombs out with this modal;

image

There's nothing in the logs. It's worth noting that if I attempt to connect with the wrong API key, it successfully tells me there was an authentication failure.

shadow7412 commented 3 years ago

So, I've discovered that if I do a clean install, this works as expected. However upgrading my installation from the version above breaks things. Even if I delete the integrations and attempt to readd them, things remain broken (and show symptoms as shown above).

I don't really want to, but at this stage it looks like I'm going to set everything up from scratch.

fredrike commented 3 years ago

@shadow7412, can you verify that you always have the same IP on your Daikin unit, I think it is a local network issue.

shadow7412 commented 3 years ago

I set all of the aircons to static back when I first connected them to the network. I'm going to close this issue. Although we never really found a resolution, I have since recreated my home assistant install from scratch and everything is working.

There is definitely an issue in the upgrade script that seems to brick everything. But I imagine most people aren't going to encounter it if they haven't already.