mac-zhou / midea-msmart

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

Discover padding error #18

Closed JKorf closed 4 years ago

JKorf commented 4 years ago

Discover fails. Device can be found, but response can't be parsed? Used the latest .19 version.

midea-discover -d
INFO:msmart.cli:Debug mode active
INFO:msmart.cli:Discovering devices with UDP Broadcast, press CTRL-C to quit...
INFO:msmart.cli:Midea Local Data 192.168.2.4 837000b8200f04025a5a0111a8007a800000000000000000000000007f1a0000001500000000000000000000000000006706f38709678c8dfd06cb24d5690557541b21fed71585eef2cfeccc730d70a7a7574a5b8f1647c7e0e090b3244dfe6e4a6afd78359f14d13eab2efd80c60ed1d76e2c3e43a6dda418000da16e50e0db682b11e235eef961e588bd6fd663cf18f31443d17c3aac03a7656614ae1dca448aeb8c241f94e80aeac46942dc1ad0e37b77e4e6472e6914b86c59cdc1b6cd1b
ERROR:msmart.security:aes_decrypt error: ValueError('Padding is incorrect.',) - data: 6706f38709678c8dfd06cb24d5690557541b21fed71585eef2cfeccc730d70a7a7574a5b8f1647c7e0e090b3244dfe6e4a6afd78359f14d13eab2efd80c60ed1
Traceback (most recent call last):
  File "/home/pi/.pyenv/versions/3.6.9/bin/midea-discover", line 11, in <module>
    sys.exit(discover())
  File "/home/pi/.pyenv/versions/3.6.9/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/pi/.pyenv/versions/3.6.9/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/pi/.pyenv/versions/3.6.9/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/pi/.pyenv/versions/3.6.9/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/pi/.pyenv/versions/3.6.9/lib/python3.6/site-packages/msmart/cli.py", line 76, in discover
    m_type = m_ssid.split('_')[1]
IndexError: list index out of range
mac-zhou commented 4 years ago

new version msmart==0.1.20 fixed this bug

JKorf commented 4 years ago

Thanks for the quick response. It indeed fixed the padding issue, however it times out when trying to connect to the device. Any advice?

midea-discover -d
INFO:msmart.cli:Debug mode active
INFO:msmart.cli:msmart version: 0.1.20
INFO:msmart.cli:Discovering devices with UDP Broadcast, press CTRL-C to quit...
INFO:msmart.cli:Midea Local Data 192.168.2.4 837000b8200f04165a5a0111a8007a800000000000000000000000007f1a0000001500000000000000000000000000006706f38709678c8dfd06cb24d5690557541b21fed71585eef2cfeccc730d70a7a7574a5b8f1647c7e0e090b3244dfe6e4a6afd78359f14d13eab2efd80c60ed1d76e2c3e43a6dda418000da16e50e0db682b11e235eef961e588bd6fd663cf18f31443d17c3aac03a7656614ae1dca448aeb8c241f94e80aeac46942dc1ad0e37b77e4e6472e6914b86c59cdc1b6cd1b
DEBUG:msmart.packet_builder:Finalize request data: aa20ac00000000000003418100ff03ff00020000000000000000000000002caf91
DEBUG:msmart.lan:Sending to 192.168.2.4:6444 5a5a011168002000000000005b2c16081d0614147f1a0000001500000000000000000000000000006b000a76e27eed2c3647e57d8602df8bee41b9935c733da6239e6edf91228690b89042d6de1a2cffd167456657d3f712c8d1f020ff0c856f83c2e4c23a7ec569
INFO:msmart.lan:Couldn't connect with Device 192.168.2.4:6444
DEBUG:msmart.device:refresh - Recieved from 192.168.2.4, 7f1a00000015:
INFO:msmart.cli:*** Found a unsupported '0xac' at 192.168.2.4 - id: 23089744190079 - sn: P0000000Q1847C9BA1C9B40000 - ssid: net_ac_C9B4
mac-zhou commented 4 years ago

sorry. it means unsupported.

reneklootwijk commented 4 years ago

I have the same with 4 ac's. Do you have a clue what is the issue to support these ac's? I can control them via the midea air and nethome plus apps.

JKorf commented 4 years ago

I'm from the Netherlands as well, so we could very well have the same ac type. I'm still looking for a solution, searching around in the msmart sdk. It's obfuscated though, so pretty hard to find anything..