mac-zhou / midea-msmart

This is a library to allow communicating to a Midea AC via the Local area network.
MIT License
147 stars 39 forks source link

Authentication failed when running midea-discover #69

Closed GrabkaMan closed 2 years ago

GrabkaMan commented 2 years ago

Hey,

I've been trying to add my Rotenso AC unit for few days now with different options and can't add it to HA.

The biggest issues - I think - is when trying to run midea-discover This is my response:

INFO:msmart.cli:msmart version: 0.2.2 Currently only supports ac devices.
ERROR:msmart.security:authentication failed
ERROR:msmart.lan:Authentication failed for 192.168.3.2:2583 -> 192.168.3.44:6444 retries: 0 time: 0.05
ERROR:msmart.security:authentication failed
ERROR:msmart.lan:Authentication failed for 192.168.3.2:2585 -> 192.168.3.35:6444 retries: 0 time: 0.03
INFO:msmart.lan:Got TCP key for 192.168.3.2:2583 -> 192.168.3.44:6444 retries: 0 time: 0.45 ebe0b222823a7740dd31b342b0a65390f48dcd5dc3827ab66d9b49b172258a14
INFO:msmart.lan:Got TCP key for 192.168.3.2:2585 -> 192.168.3.35:6444 retries: 0 time: 0.28 1de136ccfe1877b0b90bd43071498c8a93a86c9ca10ef22054d8c1111f825028
INFO:msmart.cli:*** Found a device: ←[94m←[1m{'type': 'ac', 'support': True, 'version': 3, 'ip': '192.168.3.35', 'id': **ID**, 'port': 6444, 'token': '**TOKEN**', 'key': '**KEY**'

+The second devices data

The thing is when I run the midea-discover the second time I get different TOKEN and KEY. The rest of the data is the same.

Any ideas why this happens?

I've also tried using my credentials, but the same error happens

mac-zhou commented 2 years ago

The token or key has time information, so each request will be different. token and key is reusable, just choose one, no need to repeat requests for.

mac-zhou commented 2 years ago

I forgot to explain the issue authentication failed😂 Midea has 2 forms of udpid, it is not confirmed which one is suitable for the device, so it will be requested 2 times and 1 of them will fail

https://github.com/mac-zhou/midea-msmart/blob/f07e760dd69aee3a3340e80eeaf3bb391dc4161d/msmart/scanner.py#L57