I have had some time to test, I pulled the copy from the core dev branch (d8222a8eb601ff55f0481e84a3706d798a0f8546) and used the interactions to add all of my devices and it works. There are some things that might need to be tweaked to make it easier for users:
name and mac are not being set
Looking at the calls being made I don’t see anything going to the basic_info call anymore which maybe why this is happening. This then results in all the units being added as climate.daikin_ac rather than by the name they have been configured with. The mac is also set to the IP address rather than the mac value from basic_info
Invalid key still adds the device
I was initially scratching my head as to why the code was returning errors about python keys not being found. It looks like there is no error handling for the 403 error returned by the commands (could possibly bail if the register_terminal fails) so Home Assistant is adding the device and is then confused later on as to why its not working.
The key is only needed for the register_terminal
I don’t think we need to store the key in the configs, this is only needed to register the UUID (like an oauth token) so if we have a previously registered UUID we dont need to send the key again. This may make the process a little faster and follows with what the app does
The best option for the above two might be to only register the key (in pydaikin) when a key is given (with our without a UUID). If only a UUID is given then it assumes it has been registered and skips that initial step.
During Home Assistant’s config flow the current process of asking for the key is done, at that point pydaikin is called with both a generated UUID and the key, pydaikin registers the terminal and/or returns a failure. All that is then stored in the config is the UUID that was generated.
Net discovery is giving an error
I think my code was doing this for an unregistered device, but because the units respond to the UDP request discovery is being confused. I am not sure how this could be fixed but its worth noting as they may show up in Home Assistant but be unusable.
File "/usr/src/homeassistant/homeassistant/components/discovery/__init__.py", line 199, in scan_devices
results = await hass.async_add_job(_discover, netdisco)
File "/usr/local/lib/python3.7/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 224, in _discover
netdisco.scan()
File "/usr/local/lib/python3.7/site-packages/netdisco/discovery.py", line 72, in scan
self.daikin.scan()
File "/usr/local/lib/python3.7/site-packages/netdisco/daikin.py", line 26, in scan
self.update()
File "/usr/local/lib/python3.7/site-packages/netdisco/daikin.py", line 77, in update
'id': entry['id'],
KeyError: 'id'
If anyone wants me to update my githuib copy with a version that works in 0.109.4 let me know (The dev copy needs a couple of small changes and you would need to readd the devices), although I dont think its too far away from being releasable.