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
73.55k stars 30.72k forks source link

Integration Daikin AC- not loading properly #45324

Closed elRadix closed 3 years ago

elRadix commented 3 years ago

The problem

Adding a new Daikin AC unit supported by Daikin Online Controller The climate and temperature entities are shown with an unavailable state

Environment

System Health

version 2021.1.4
installation_type Home Assistant OS
dev false
hassio true
docker true
virtualenv false
python_version 3.8.7
os_name Linux
os_version 5.4.86
arch x86_64
timezone Europe/Brussels
Home Assistant Community Store GitHub API | ok -- | -- Github API Calls Remaining | 5000 Installed Version | 1.10.0 Stage | running Available Repositories | 786 Installed Repositories | 48
Home Assistant Cloud logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Hass.io host_os | Home Assistant OS 5.10 -- | -- update_channel | beta supervisor_version | 2021.01.5 docker_version | 19.03.13 disk_total | 19.0 GB disk_used | 13.1 GB healthy | true supported | true board | ova supervisor_api | ok version_api | ok installed_addons | Terminal & SSH (8.6.0), AppDaemon 4 (0.3.2), WireGuard (0.4.0), Mosquitto broker (5.1), Home Assistant Google Drive Backup (0.103.0), SSH & Web Terminal (7.8.0), Visual Studio Code (2.9.1), API Consumer (0.101), Check Home Assistant configuration (3.6.0), TasmoBackup (1.04.02), chrony (1.1.3), JupyterLab Lite (0.3.1), ESPHome (1.15.3), InfluxDB (3.7.9), Grafana (5.3.6), Telegraf (0.5.6)
Lovelace dashboards | 5 -- | -- mode | storage views | 18 resources | 27
MercedesME 2020 websocket_connection_state | connected -- | -- api_endpoint_reachable | ok

Add device through Daikin AC integration, no config needed

Traceback/Error logs

Logger: homeassistant.components.climate
Source: components/daikin/climate.py:194
Integration: Climate (documentation, issues)
First occurred: 10:48:15 AM (2 occurrences)
Last logged: 10:48:15 AM

Error adding entities for domain climate with platform daikin
Error while setting up daikin platform for climate
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'

Additional information

Daikin BRP069C4x

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

daikin documentation daikin source (message by IssueLinks)

fredrike commented 3 years ago

It looks like you are not entering the API-key/password correctly (or giving the wrong IP).

@mlemainque we probably need to build some error checking in the factory.py to see that the device really can be set up..

mlemainque commented 3 years ago

It looks like you are not entering the API-key/password correctly (or giving the wrong IP).

@mlemainque we probably need to build some error checking in the factory.py to see that the device really can be set up..

The current factory should already fail if the IP of an AirBase / BRP069 is wrong as we are doing an appl.update_status and an appl.init. I expect the HA integration setup to fail too then... I've tested in my current HA (ver 2021.1.5) and the integration setup fails if the IP is wrong: "unexpected error". Note that we could provide some details in this error. Anyway I don't see how this could be the cause of the current issue...

I am not sure about what would happen if the KEY or PASSWORD provided for a BRP072C / SkyFi are wrong. We are only doing a appl.init in this case which should fail if the AC returns a 403 response. But it will succeed if it is anything else: 200 but also 401, 500, etc. Are we sure 403 is the right "error" status code? Should not we handle other status codes as well?

@elRadix Have you setup your BRP069 with an API key or a Password?

Source: https://bitbucket.org/mustang51/pydaikin/src/f5b7051d0bcfd679658dc348ced802c1167877a1/pydaikin/daikin_base.py#lines-55

elRadix commented 3 years ago

I have only used the correct IP of Daikin AC, maybe this new AC I have is not compatible?

Screenshot_20210217-001754_Daikin

SmartSelect_20210217-001159_Chrome

fredrike commented 3 years ago

The current factory should already fail if the IP of an AirBase / BRP069 is wrong as we are doing an appl.update_status and an appl.init. I expect the HA integration setup to fail too then... I've tested in my current HA (ver 2021.1.5) and the integration setup fails if the IP is wrong: "unexpected error". Note that we could provide some details in this error. Anyway I don't see how this could be the cause of the current issue...

We only check if we have a webserver connection on the other side, we never verify that it actually is a (supported) Daikin.

@mlemainque we should fix this for the upcoming pydaikin 3.0 release..

I have only used the correct IP of Daikin AC, maybe this new AC I have is not compatible?

@elRadix, your model is not supported and seems to be the same as we are trying to de-cipher here: https://community.home-assistant.io/t/daikin-ac-integration-error-loading-entities/270936/7 (oh, perhaps that is you..)

@elRadix, I think it would be good if you could add your model to the doc saying that it is not supported: https://github.com/home-assistant/home-assistant.io/blob/current/source/_integrations/daikin.markdown

puttemanp commented 3 years ago

All new Daiking AC units are now being delivered with the new BRP069C4x wifi module which is cloud based. There is a project called Daikin-controller-cloud here: https://github.com/Apollon77/daikin-controller-cloud

Perhaps someone could have a look at it and see if it's possible to integrate it in HA?

fredrike commented 3 years ago

@elRadix, your unit is not supported, I think you should rename this issue and close it (or change it to feature request).

@puttemanp, I don't have time to try to implement support for BRP069C4x, the job of porting the JavaScript code to Python seems to be quite big. There is also the issue of authentication, it seems that some magic is needed..