Hi and sorry for the delay, I have been quite busy this week and I was unable to find a way to improve the device discovery.
It is not acceptable if discovery is not working fine but I had an idea this morning and I would like to share with you and get your feedback (and of course your help). It’s not perfect but at least, with a little work, I think it can bypass the discovery issue.
Just a few words to explain how are working Dyson devices (Pure cool link but I think the 360 robot should work the same way) and this component:
I’m doing HTTP requests to Dyson web services (with email/password/language) in order to have information about Dyson devices. In the web services responses, I have useful information like device name, device id, encrypted device credentials (different from Dyson account credentials), …
Nevertheless, I don’t have the devices IP address (and it’s fair because it can change) so I have to do a multicast DNS (mDNS) request to discover devices on the local network. If I have answers from the mDNS request, I can then connect using MQTT protocol directly to the devices using decrypted credentials. With MQTT I’m able to get device status and send commands. Success !
The issue you have (not always but we are at least 3 to had this issue at least once so it’s not an exception) is sometimes, for an unknown reason, the Dyson devices refuse to answer to mDNS requests. I can’t explain why. Maybe I’m not sending a valid mDNS request, maybe the device is not understanding the request, maybe the device is to lazy to answer … No idea yet.
What I propose to test is to bypass the mDNS discovery step by providing the IP address directly to the component (in the configuration). It should work and it can bypass another limitation with mDNS protocol: it can only work in the same network. If your Home Assistant is not on the same network (you have a router between HA and your Dyson devices), it can not work. It must not be your case because it worked at least once.
The drawback of this solution is it is not really easy to find devices IP addresses so it should only be used if discovery is not working.
How to find devices IP Addresses
With nmap tool we can do a network scan to find computer with MQTT enable:
$ nmap -p 1883 192.168.0.0/24 --open
Starting Nmap 6.40 ( http://nmap.org ) at 2017-05-20 11:37 CEST
Nmap scan report for 192.168.0.103
Host is up (0.012s latency).
PORT STATE SERVICE
1883/tcp open unknown
Nmap scan report for 192.168.0.213
Host is up (0.051s latency).
PORT STATE SERVICE
1883/tcp open unknown
Nmap scan report for home-assistant.lan (192.168.0.233)
Host is up (0.00044s latency).
PORT STATE SERVICE
1883/tcp open unknown
Nmap done: 256 IP addresses (16 hosts up) scanned in 6.25 seconds
Installing nmap is out of scope and depends of your OS but is is something like apt-get install nmap
on Debian/Ubuntu, yum install nmap
on Red-hat/CentOS, brew install nmap
on MacOS X with Homebrew or using the Installer on Windows. It can be done from the Home Assistant computer itself or from any other computer/laptop on the same network.
In this example, I’m scanning my local network (192.168.0.0/24 but it can be something else like 192.168.1.0/24) and I have 3 results (as expected):
- The last one (192.168.0.233) is my Home Assistant installation because I have enable MQTT to implement some automation => to ignore
- The 2 others results are my Dyson devices: 192.168.0.103 and 192.168.0.213. If you have only 1 Dyson device, it will be quite easy. In my case I’ll have to test 2 possibilities.
What I would like to have in the configuration is something like that (not yet implemented, just a proposition):
dyson:
username: <email>
password: <password>
language: <language_code>
timeout: 5 # optional
retry: 1 # optional
devices: # Optional, only if discovery is not working
- device_id: <device_id_1>
device_ip_address: <device_1_ip_address>
- device_id: <device_id_2>
device_ip_address: <device_2_ip_address>
...
If devices is provided, I’ll bypass the mDNS discovery step.
As you can see, I need the devices ID too. I can be able to use the device name (Pürity and Cooley in your feedback) but I think device ID will be more reliable. The question is: How to find device_id ? In fact you already had your devices ID in the debug logs you provided (PE8-UK-HHA0158A for example) but you can also use the Dyson link mobile application to get the device ID (on the device page, click on Settings)
NN2-EU-HFA0516A in my example.
Feedback
Now, I’ll would like to have your feedback about this proposition. With information I gave, are you able to provide Devices ID and IP address ? I don’t need them, just to know if you were able to gather them.
And do you think it is acceptable to provide a component with some complex (?) manual steps to configure ? Of course, this manual step must only be used if discovery is not working.
Thanks for your help !