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
71.57k stars 29.91k forks source link

Daikin integration duplicated #36635

Closed sagitt closed 4 years ago

sagitt commented 4 years ago

The problem

I have not daikin in yaml mode, removed it with 0.110, after 0.111 upgrade i see 2 new daikin integration discovered...... so i removed my configured daikin thinking a configuration issue, restarted, and now i see 4 daikin integration. 2 ignorable, 2 not ignorable.

for now fixed configuring 2 not ignorable and ignore other 2.

Environment

Problem-relevant configuration.yaml

Traceback/Error logs

Additional information

Schermata 2020-06-10 alle 19 33 01

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

daikin documentation daikin source (message by IssueLinks)

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

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

fredrike commented 4 years ago

@sagitt does your devices support zeroconf?

This is partly solved in #36571.

sagitt commented 4 years ago

@sagitt does your devices support zeroconf?

This is partly solved in #36571.

i have 2 daikin emura with wi-fi card

fredrike commented 4 years ago

@sagitt does your devices support zeroconf? This is partly solved in #36571.

i have 2 daikin emura with wi-fi card

Does the Emura support zeroconf?

astrandb commented 4 years ago

Same problem here with HA 111.1 I have no yaml entry. First configured Daikin integration instance works fine. (No API key and no password entered). Discovery panel reapperas immediately with no option to ignore. Have tried all reasonable combinations of deleting integration and restarting HA without any success.

fredrike commented 4 years ago

I'm terrible sorry for this issue. As my Daikin unit doesn't support Zeroconf I implemented that support in blind.

@MartinHjelmare, would it be ok to use say https://pypi.org/project/getmac/, during the zeroconf flow to resolve the hostname to a mac? The other solution would be to check if hostname is available (it might be for some units) and use that instead of mac for unique id but that would require a lot of work.

MartinHjelmare commented 4 years ago

Yes, that's ok. But be aware that getting the mac address of a host successfully depends on the network set up, and might not work in all cases.

fredrike commented 4 years ago

But be aware that getting the mac address of a host successfully depends on the network set up, and might not work in all cases.

I don't think Zeroconf works if the network isn't set up 🙈 .

fredrike commented 4 years ago

Would be great if someone with a Zeroconf device could test: https://github.com/home-assistant/core/pull/36704

astrandb commented 4 years ago

Below is a debug log from HA 111.1 without #36704 I have not touched anything, just waited a few minutes

2020-06-12 08:45:50 DEBUG (MainThread) [homeassistant.components.daikin.config_flow] Zeroconf discovery_info: {'host': '192.168.0.66', 'port│0 packages can be updated.
': 80, 'hostname': 'DaikinAP51913.local.', 'type': '_dkapi._tcp.local.', 'name': 'DkApi._dkapi._tcp.local.', 'properties': {'_raw': {'reg': │0 updates are security updates.
b'eu', 'type': b'aircon', 'ver': b'1_2_51', 'adp_kind': b'3'}, 'reg': 'eu', 'type': 'aircon', 'ver': '1_2_51', 'adp_kind': '3'}}            │
2020-06-12 08:46:27 DEBUG (MainThread) [homeassistant.components.daikin.config_flow] Discovered device: {'id': '409F38D0FF8C', 'name': 'Serv│
errum', 'ip': '192.168.0.66', 'mac': '409F38D0FF8C', 'ver': '1_2_51'}
fredrike commented 4 years ago

Below is a debug log from HA 111.1 without #36704 I have not touched anything, just waited a few minutes

2020-06-12 08:45:50 DEBUG (MainThread) [homeassistant.components.daikin.config_flow] Zeroconf discovery_info: {'host': '192.168.0.66', 'port│0 packages can be updated.
': 80, 'hostname': 'DaikinAP51913.local.', 'type': '_dkapi._tcp.local.', 'name': 'DkApi._dkapi._tcp.local.', 'properties': {'_raw': {'reg': │0 updates are security updates.
b'eu', 'type': b'aircon', 'ver': b'1_2_51', 'adp_kind': b'3'}, 'reg': 'eu', 'type': 'aircon', 'ver': '1_2_51', 'adp_kind': '3'}}            │
2020-06-12 08:46:27 DEBUG (MainThread) [homeassistant.components.daikin.config_flow] Discovered device: {'id': '409F38D0FF8C', 'name': 'Serv│
errum', 'ip': '192.168.0.66', 'mac': '409F38D0FF8C', 'ver': '1_2_51'}

Thanks! It is as I suspected, the old discovery method is interfering with the new Zeroconf discovery.

This runs the patch in a docker container: docker run --name=hadev -p 8123:8123 -it python:3.8 sh -c 'apt-get update; apt-get install -y python3-pip python3.7-dev python3.7-venv python-wheel-common autoconf libssl-dev libxml2-dev libxslt1-dev libjpeg-dev libffi-dev libudev-dev zlib1g-dev libavformat-dev libavcodec-dev libavdevice-dev libavutil-dev libswscale-dev libavresample-dev libavfilter-dev; git clone -b daikin-config_flow --single-branch https://github.com/fredrike/home-assistant.git /home-assistant; cd /home-assistant; git reset --hard; git pull; pip install sqlalchemy; script/setup; hass'