mac-zhou / midea-msmart

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

Timeout by getting response #4

Closed slydlake closed 4 years ago

slydlake commented 4 years ago

Hi @mac-zhou,

I am very glad that you try to connect locally! I try to connect with a normal python script with my comfee ac (Midea build)

When I try to connect I get always in lan.py line 40 response = sock.recv(512) I get always an timeout.

2020-05-19 00:07:36,137 Finalize request data: aa20ac00000000000003410000ff03ff00020000000000000000000000000004e9
2020-05-19 00:08:02,701 Connect the Device 192.168.178.116:6444 TimeOut.

I checked my ac. IP and Port is open.

my script looks like this:

#!/usr/bin/env python3
from msmart.device import device as midea_device    

device_ip = "192.168.178.116"
device_id = "19791209312906"

client = midea_device(device_ip, int(device_id))
device = client.setup()
device.refresh()

Can you help me investigating?

mac-zhou commented 4 years ago

this looks like your device does not support. your ac does not accept and not send respone, so timeout. do you add your ac device to midea cloud?

slydlake commented 4 years ago

Hi, ah ok. Yes the device is added in my account. It is strange that some devices are not supporting this.

mac-zhou commented 4 years ago

please update and show me the full log.

mac-zhou commented 4 years ago

update msmart to 0.1.15 and try it

slydlake commented 4 years ago

Hi. Thanks! I will try it after my holiday 😊

itProfi commented 4 years ago

!/usr/bin/env python3

from msmart.device import device as midea_device

device_ip = "192.168.178.116" device_id = "19791209312906"

client = midea_device(device_ip, int(device_id)) device = client.setup() device.refresh()

Where you can get this info? Where i get information about device (port, device_id)?

aa755 commented 4 years ago

device.refresh() always times out for me. But device.apply() works:

doing client setup
doing device refresh
DEBUG:msmart.packet_builder:Finalize request data: aa20ac00000000000003410000ff03ff00020000000000000000000000000004e9
DEBUG:msmart.lan:Sending to 192.168.1.186:6444 5a5a01116800200000000000000000000000000063f50000000e0000000000000000000000000000c7ec8e4276f8accc266a4648044169534ef900b4addf8808145b702d1c28520aec9d938eeaae3d871b99ce4b7e20a37b61b56a801f9b5692bab9a43ce8b51302.
INFO:msmart.lan:Connect the Device 192.168.1.186:6444 TimeOut for 10s. don't care about a small amount of this. if many maybe not support.
DEBUG:msmart.device:refresh - Recieved from 192.168.1.186, 63f50000000e: 
{'id': '63f50000000e', 'power_state': False, 'target_temperature': 17, 'operational_mode': <operational_mode_enum.auto: 1>, 'fan_speed': <fan_speed_enum.Auto: 102>, 'swing_mode': <swing_mode_enum.Off: 0>, 'eco_mode': False, 'turbo_mode': False}
starting apply
0x09 byte was 2
DEBUG:msmart.packet_builder:Finalize request data: aa23ac0000000000000240014e6603ff000000000000000000000000000000000000ee4a
DEBUG:msmart.lan:Sending to 192.168.1.186:6444 5a5a01116800200000000000000000000000000063f50000000e0000000000000000000000000000250f89dd022fc29133505735f7fc51204bdfb3e16e33d88768cc4c3d0658937d4325a4241fa335585c581b4ef5e5d803e275cd61403198ad871c4c4bedbdca4b.
DEBUG:msmart.lan:Received from 192.168.1.186:6444 5a5a01116800200000000000000000000000000063f50000000e0000000000000000000000000000250f89dd022fc29133505735f7fc51204bdfb3e16e33d88768cc4c3d0658937d4325a4241fa335585c581b4ef5e5d803e275cd61403198ad871c4c4bedbdca4b.
DEBUG:msmart.device:apply - Recieved from 192.168.1.186, 63f50000000e: 
itProfi commented 4 years ago

!/usr/bin/env python3

from msmart.device import device as midea_device device_ip = "192.168.178.116" device_id = "19791209312906" client = midea_device(device_ip, int(device_id)) device = client.setup() device.refresh()

Where you can get this info? Where i get information about device (port, device_id)?

Friends?

slydlake commented 4 years ago

!/usr/bin/env python3

from msmart.device import device as midea_device device_ip = "192.168.178.116" device_id = "19791209312906" client = midea_device(device_ip, int(device_id)) device = client.setup() device.refresh()

Where you can get this info? Where i get information about device (port, device_id)?

Friends?

Take a look here: https://github.com/mac-zhou/midea-ac-py

slydlake commented 4 years ago

@mac-zhou I get now this reply:

2020-06-01 12:38:58,537 Finalize request data: aa20ac00000000000003410000ff03ff00020000000000000000000000000004e9
2020-06-01 12:38:58,668 Sending to 192.168.178.116:6444 5a5a0111680020000000000000000000000000008a32000000120000000000000000000000000000c7ec8e4276f8accc266a4648044169534ef900b4addf8808145b702d1c28520aec9d938eeaae3d871b99ce4b7e20a37b8adf0877d99082a8ef1520af41ac7520.
2020-06-01 12:39:08,671 Connect the Device 192.168.178.116:6444 TimeOut for 10s. don't care about a small amount of this. if many maybe not support.
2020-06-01 12:39:08,672 refresh - Recieved from 192.168.178.116, 8a3200000012: 
slydlake commented 4 years ago

sending does also not work:

2020-06-01 12:49:47,773 Finalize request data: aa23ac000000000000024001376603ff000000000000000000000000000000000000e966
2020-06-01 12:49:48,053 Sending to 192.168.178.116:6444 5a5a0111680020000000000000000000000000008a320000001200000000000000000000000000007e30d0ebfbcbc57767ed00bf427a59904bdfb3e16e33d88768cc4c3d0658937d2b505d2d83d43b50be0fc550af0e618611660af83cd55c3e82ffd30f59eb0374.
2020-06-01 12:49:58,058 Connect the Device 192.168.178.116:6444 TimeOut for 10s. don't care about a small amount of this. if many maybe not support.
2020-06-01 12:49:58,058 apply - Recieved from 192.168.178.116, 8a3200000012: 
aa755 commented 4 years ago

it seems timeouts happen when the request sent is malformed. When I tried flipping some bits to implement #8 , I was getting timeouts on device::apply and the AC had no response. When I removed my changes, device::apply changes the AC state correctly and receives a response. Also, even when a response was received from the device, the unpadding code was truncating all of it. I also had to comment out the unpadding to get a response that the device class could parse correctly.

slydlake commented 4 years ago

@aa755 The question is: what are the bits, that are malformed the request... How can I get the info what are the correct bits?

aa755 commented 4 years ago

Logging communication with the cloud version may be a way because the cloud version works flawlessly (for me) at least in the Celsius mode. It would be great if @mac-zhou provides some insights between the relation between the cloud data format and the LAN data format. It seems the formats are very similar.

mac-zhou commented 4 years ago

@aa755 The question is: what are the bits, that are malformed the request... How can I get the info what are the correct bits?

when you control the device with app, you need to capture traffic the device. save the capture file and show me

mac-zhou commented 4 years ago

Logging communication with the cloud version may be a way because the cloud version works flawlessly (for me) at least in the Celsius mode. It would be great if @mac-zhou provides some insights between the relation between the cloud data format and the LAN data format. It seems the formats are very similar.

i am in china, cloud version is not work for me. you need to capture traffic the device.

slydlake commented 4 years ago

@aa755 The question is: what are the bits, that are malformed the request...

How can I get the info what are the correct bits?

when you control the device with app, you need to capture traffic the device.

save the capture file and show me

Do you need the wlan traffic or the Internet traffic? Thank you 😊

mac-zhou commented 4 years ago

@aa755 The question is: what are the bits, that are malformed the request...

How can I get the info what are the correct bits?

when you control the device with app, you need to capture traffic the device. save the capture file and show me

Do you need the wlan traffic or the Internet traffic? Thank you 😊

wlan traffic is the best

slydlake commented 4 years ago

Hi, I filtered the IP of the ac (dest and src).

With the app, I turned the ac on, changed to temperature 20 celsius, turned ac off.

ac-only.pcap.zip

mac-zhou commented 4 years ago

Hi, I filtered the IP of the ac (dest and src).

With the app, I turned the ac on, changed to temperature 20 celsius, turned ac off.

ac-only.pcap.zip

all packets is the HTTPS data the midea protocol filter is tcp && data[:2] == 5a5a

aa755 commented 4 years ago

@slydlake perhaps you need to turn off internet/WAN in your router before capturing traffic

mac-zhou commented 4 years ago

@slydlake perhaps you need to turn off internet/WAN in your router before capturing traffic

It's not about WAN. the protocol is also run on WAN.

slydlake commented 4 years ago

Hi, I filtered the IP of the ac (dest and src). With the app, I turned the ac on, changed to temperature 20 celsius, turned ac off. ac-only.pcap.zip

all packets is the HTTPS data the midea protocol filter is tcp && data[:2] == 5a5a

with this filter I get no data With "data[:2] == 5a5a" I can only see UDP Data send from my iPhone (app) Do you need this? Or did I something wrong by catpuring??

mac-zhou commented 4 years ago
  1. check device's 6444 port is open
  2. as far as i know, the new version of ios app is not connect device via LAN. so the better is to use a Android phone
  3. you can downgrade the version of android app
  4. you can capturing traffic between phone and device.
slydlake commented 4 years ago

Port ist open Unfortunately I have only Apple Devices...

Is the current android version using LAN?

slydlake commented 4 years ago

A friend was just in my home. I tried her android phone. But it's the same result, only UDP Data with this filter...

aa755 commented 4 years ago

I think it uses cloud when internet is on and LAN otherwise. Thats why I said you should turn off internet in your router

slydlake commented 4 years ago

@aa755 Just tried without WAN. Does not work. App cannot connect. So I think that the app only works over WAN.

mac-zhou commented 4 years ago

is there some tcp packets from phone and device?

mac_zhou

在 2020年6月2日,22:50,slydlake notifications@github.com 写道:



A friend was just in my home. I tried her android phone. But it's the same result, only UDP Data with this filter...

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/mac-zhou/midea-msmart/issues/4#issuecomment-637593298, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA4KC7YKTQN6VPXEYSAVVN3RUUGULANCNFSM4NEPFPNQ.

mac-zhou commented 4 years ago

i don’t know. i china we use app name “美的美居”. what is your device’s Brand and Model? maybe you can try midea air app version v5.0.1.430 or

https://apps.apple.com/nl/app/carrier-air-conditioner/id1078542632

mac_zhou

在 2020年6月2日,22:39,slydlake notifications@github.com 写道:



Port ist open Unfortunately I have only Apple Devices...

Is the current android version using LAN?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/mac-zhou/midea-msmart/issues/4#issuecomment-637586081, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA4KC74ELB6SGFT4ZHT43FDRUUFJTANCNFSM4NEPFPNQ.

mac-zhou commented 4 years ago

Hi, I filtered the IP of the ac (dest and src).

With the app, I turned the ac on, changed to temperature 20 celsius, turned ac off.

ac-only.pcap.zip

oh,I just made a mistake. your device is running the new protocol. the packets filter is tcp.segment_data[:2] == 8370 wireshark decode as TLS I can't decrypt this version‘s packet

slydlake commented 4 years ago

Yes. TCP Packages from iPhone are here attached. Filter: (iPhoneIP.src && TCP) || (iPhoneIP.dst && TCP)

I used now the media air app. iphone with media app.pcap.zip

slydlake commented 4 years ago

My ac is Comfee MPPF1-12CRN7. It's the same like Comfee SOGNIDORO-09E

seppe912 commented 4 years ago

same issue here from a user of my loxone Plugin. See log:

09.06 20:58 msmart.packet_builder DEBUG    Finalize request data: aa23ac0000000000000240422c6603ff0003000000000000000000000000000000000511
09.06 20:58 msmart.lan   DEBUG    Sending to 192.168.2.50:6444 5a5a011168002000000000000000000000000000cb42000000120000000000000000000000000000bdaf2d37af1de4c663502e68918efeda523eb5f406fc76826270d99f559bdd3917521e93fb9b3c010d79654c539f9b4ce1cb2ca4057fd0fb7a496879cfc607ad.
09.06 20:58 msmart.lan   INFO     Connect the Device 192.168.2.50:6444 TimeOut for 10s. don't care about a small amount of this. if many maybe not support.
09.06 20:58 msmart.device DEBUG    apply - Recieved from 192.168.2.50, cb4200000012: 

seems that there is no received data. Appliance Is a Midea Blanc-Series. do you have any idea whats wrong?

aa755 commented 4 years ago

@mac-zhou : here is the packet capture for communication between my phone (nethome app on android, IP 192.168.1.103) and the AC (pioneer mini split, IP 192.168.1.186) phone_ac_comm_protocol_filtered.zip. I used the filter tcp && data[:2] == 5a5a && (ip.src == 192.168.1.103 || ip.dst == 192.168.1.103) in wireshark. This looks quite different from the communication generated by your library.

aa755 commented 4 years ago

In the recording in the post just above, I did not change any AC setting in the app so all communication may just be status queries. Here is a new capture where I rapidly change the AC settings: phone_ac_comm_protocol_settings_changes.zip

The packets are larger here.

mac-zhou commented 4 years ago

In the recording in the post just above, I did not change any AC setting in the app so all communication may just be status queries. Here is a new capture where I rapidly change the AC settings: phone_ac_comm_protocol_settings_changes.zip

The packets are larger here.

update msmart to 0.1.16 and run midea-discover -d then show me the output I probably know how to solve your issues

mac-zhou commented 4 years ago

In the recording in the post just above, I did not change any AC setting in the app so all communication may just be status queries. Here is a new capture where I rapidly change the AC settings: phone_ac_comm_protocol_settings_changes.zip

The packets are larger here.

it looks like the change below?

### No.3 2020-06-10 22:10:25.631417 192.168.1.103 => 192.168.1.186
Message Type:    SET 0x23 applianceId: -hex: 63f50000000e -int: 15393162851683
Decoded Data:    {'power_state': True, 'operational_mode': 'Heat', 'target_temperature': 30, 'fan_speed': 'Auto', 'swing_mode': 0, 'eco_mode': False, 'turbo_mode': False, 'indoor_temperature': -25.0, 'outdoor_temperature': -25.0}

### No.7 2020-06-10 22:10:39.044716 192.168.1.103 => 192.168.1.186
Message Type:    SET 0x23 applianceId: -hex: 63f50000000e -int: 15393162851683
Decoded Data:    {'power_state': True, 'operational_mode': 'Cool', 'target_temperature': 30, 'fan_speed': 'Auto', 'swing_mode': 0, 'eco_mode': False, 'turbo_mode': False, 'indoor_temperature': -25.0, 'outdoor_temperature': -25.0}

### No.11 2020-06-10 22:10:42.990532 192.168.1.103 => 192.168.1.186
Message Type:    SET 0x23 applianceId: -hex: 63f50000000e -int: 15393162851683
Decoded Data:    {'power_state': True, 'operational_mode': 'Cool', 'target_temperature': 30, 'fan_speed': 'Auto', 'swing_mode': 0, 'eco_mode': False, 'turbo_mode': False, 'indoor_temperature': -25.0, 'outdoor_temperature': -25.0}

### No.13 2020-06-10 22:10:49.505120 192.168.1.103 => 192.168.1.186
Message Type:    SET 0x23 applianceId: -hex: 63f50000000e -int: 15393162851683
Decoded Data:    {'power_state': True, 'operational_mode': 'Cool', 'target_temperature': 30, 'fan_speed': 'High', 'swing_mode': 0, 'eco_mode': False, 'turbo_mode': False, 'indoor_temperature': -25.0, 'outdoor_temperature': -25.0}

### No.17 2020-06-10 22:10:51.255165 192.168.1.103 => 192.168.1.186
Message Type:    SET 0x23 applianceId: -hex: 63f50000000e -int: 15393162851683
Decoded Data:    {'power_state': True, 'operational_mode': 'Cool', 'target_temperature': 30, 'fan_speed': 'High', 'swing_mode': 0, 'eco_mode': False, 'turbo_mode': True, 'indoor_temperature': -25.0, 'outdoor_temperature': -25.0}

### No.19 2020-06-10 22:10:52.954043 192.168.1.103 => 192.168.1.186
Message Type:    SET 0x23 applianceId: -hex: 63f50000000e -int: 15393162851683
Decoded Data:    {'power_state': False, 'operational_mode': 'Cool', 'target_temperature': 30, 'fan_speed': 'High', 'swing_mode': 0, 'eco_mode': False, 'turbo_mode': False, 'indoor_temperature': -25.0, 'outdoor_temperature': -25.0}
aa755 commented 4 years ago
[abhishek@optiplex midea-msmart]$ midea-discover -d
INFO:msmart.cli:Debug mode active
INFO:msmart.cli:Discovering devices with UDP Broadcast, press CTRL-C to quit...
DEBUG:msmart.packet_builder:Finalize request data: aa20ac00000000000003410000ff03ff00020000000000000000000000001fd8f6
DEBUG:msmart.lan:Sending to 192.168.1.101:6444 5a5a0111680020000000000000000000000000007fed0000000e0000000000000000000000000000c7ec8e4276f8accc266a4648044169530928fada958bd49cae6294115aabef32137826d34fdb8e6c28cf085101c06d7d41d5c35f37917a5df50091c99e4d624b.
INFO:msmart.lan:Connect the Device 192.168.1.101:6444 TimeOut for 10s. don't care about a small amount of this. if many maybe not support.
DEBUG:msmart.device:refresh - Recieved from 192.168.1.101, 7fed0000000e: 
INFO:msmart.cli:Found a unsupported '0xac' at 192.168.1.101 - id: 15393162849663 - sn: P0000000Q1BC0F2BA61C110000 - ssid: net_ac_1C11
DEBUG:msmart.packet_builder:Finalize request data: aa20ac00000000000003410000ff03ff000200000000000000000000000029bb09
DEBUG:msmart.lan:Sending to 192.168.1.186:6444 5a5a01116800200000000000000000000000000063f50000000e0000000000000000000000000000c7ec8e4276f8accc266a46480441695393f5bd30e9aeb629c7a26b6159c09396fca5cf91d6d609ef6fbf6e4bfe2e9340250d930e061c567ef50967eb3f0c3efb.
INFO:msmart.lan:Connect the Device 192.168.1.186:6444 TimeOut for 10s. don't care about a small amount of this. if many maybe not support.
DEBUG:msmart.device:refresh - Recieved from 192.168.1.186, 63f50000000e: 
INFO:msmart.cli:Found a unsupported '0xac' at 192.168.1.186 - id: 15393162851683 - sn: P0000000Q1BC0F2BAA9B3B0000 - ssid: net_ac_9B3B
aa755 commented 4 years ago

it looks like the change below?

### No.3 2020-06-10 22:10:25.631417 192.168.1.103 => 192.168.1.186
Message Type:  SET 0x23 applianceId: -hex: 63f50000000e -int: 15393162851683
Decoded Data:  {'power_state': True, 'operational_mode': 'Heat', 'target_temperature': 30, 'fan_speed': 'Auto', 'swing_mode': 0, 'eco_mode': False, 'turbo_mode': False, 'indoor_temperature': -25.0, 'outdoor_temperature': -25.0}

### No.7 2020-06-10 22:10:39.044716 192.168.1.103 => 192.168.1.186
Message Type:  SET 0x23 applianceId: -hex: 63f50000000e -int: 15393162851683
Decoded Data:  {'power_state': True, 'operational_mode': 'Cool', 'target_temperature': 30, 'fan_speed': 'Auto', 'swing_mode': 0, 'eco_mode': False, 'turbo_mode': False, 'indoor_temperature': -25.0, 'outdoor_temperature': -25.0}

### No.11 2020-06-10 22:10:42.990532 192.168.1.103 => 192.168.1.186
Message Type:  SET 0x23 applianceId: -hex: 63f50000000e -int: 15393162851683
Decoded Data:  {'power_state': True, 'operational_mode': 'Cool', 'target_temperature': 30, 'fan_speed': 'Auto', 'swing_mode': 0, 'eco_mode': False, 'turbo_mode': False, 'indoor_temperature': -25.0, 'outdoor_temperature': -25.0}

### No.13 2020-06-10 22:10:49.505120 192.168.1.103 => 192.168.1.186
Message Type:  SET 0x23 applianceId: -hex: 63f50000000e -int: 15393162851683
Decoded Data:  {'power_state': True, 'operational_mode': 'Cool', 'target_temperature': 30, 'fan_speed': 'High', 'swing_mode': 0, 'eco_mode': False, 'turbo_mode': False, 'indoor_temperature': -25.0, 'outdoor_temperature': -25.0}

### No.17 2020-06-10 22:10:51.255165 192.168.1.103 => 192.168.1.186
Message Type:  SET 0x23 applianceId: -hex: 63f50000000e -int: 15393162851683
Decoded Data:  {'power_state': True, 'operational_mode': 'Cool', 'target_temperature': 30, 'fan_speed': 'High', 'swing_mode': 0, 'eco_mode': False, 'turbo_mode': True, 'indoor_temperature': -25.0, 'outdoor_temperature': -25.0}

### No.19 2020-06-10 22:10:52.954043 192.168.1.103 => 192.168.1.186
Message Type:  SET 0x23 applianceId: -hex: 63f50000000e -int: 15393162851683
Decoded Data:  {'power_state': False, 'operational_mode': 'Cool', 'target_temperature': 30, 'fan_speed': 'High', 'swing_mode': 0, 'eco_mode': False, 'turbo_mode': False, 'indoor_temperature': -25.0, 'outdoor_temperature': -25.0}

The changes are correct, but the indoor and outdoor temperatures are incorrect. maybe it was 25C but certainly not -25C

mac-zhou commented 4 years ago

it looks like the change below?

### No.3 2020-06-10 22:10:25.631417 192.168.1.103 => 192.168.1.186
Message Type:    SET 0x23 applianceId: -hex: 63f50000000e -int: 15393162851683
Decoded Data:    {'power_state': True, 'operational_mode': 'Heat', 'target_temperature': 30, 'fan_speed': 'Auto', 'swing_mode': 0, 'eco_mode': False, 'turbo_mode': False, 'indoor_temperature': -25.0, 'outdoor_temperature': -25.0}

### No.7 2020-06-10 22:10:39.044716 192.168.1.103 => 192.168.1.186
Message Type:    SET 0x23 applianceId: -hex: 63f50000000e -int: 15393162851683
Decoded Data:    {'power_state': True, 'operational_mode': 'Cool', 'target_temperature': 30, 'fan_speed': 'Auto', 'swing_mode': 0, 'eco_mode': False, 'turbo_mode': False, 'indoor_temperature': -25.0, 'outdoor_temperature': -25.0}

### No.11 2020-06-10 22:10:42.990532 192.168.1.103 => 192.168.1.186
Message Type:    SET 0x23 applianceId: -hex: 63f50000000e -int: 15393162851683
Decoded Data:    {'power_state': True, 'operational_mode': 'Cool', 'target_temperature': 30, 'fan_speed': 'Auto', 'swing_mode': 0, 'eco_mode': False, 'turbo_mode': False, 'indoor_temperature': -25.0, 'outdoor_temperature': -25.0}

### No.13 2020-06-10 22:10:49.505120 192.168.1.103 => 192.168.1.186
Message Type:    SET 0x23 applianceId: -hex: 63f50000000e -int: 15393162851683
Decoded Data:    {'power_state': True, 'operational_mode': 'Cool', 'target_temperature': 30, 'fan_speed': 'High', 'swing_mode': 0, 'eco_mode': False, 'turbo_mode': False, 'indoor_temperature': -25.0, 'outdoor_temperature': -25.0}

### No.17 2020-06-10 22:10:51.255165 192.168.1.103 => 192.168.1.186
Message Type:    SET 0x23 applianceId: -hex: 63f50000000e -int: 15393162851683
Decoded Data:    {'power_state': True, 'operational_mode': 'Cool', 'target_temperature': 30, 'fan_speed': 'High', 'swing_mode': 0, 'eco_mode': False, 'turbo_mode': True, 'indoor_temperature': -25.0, 'outdoor_temperature': -25.0}

### No.19 2020-06-10 22:10:52.954043 192.168.1.103 => 192.168.1.186
Message Type:    SET 0x23 applianceId: -hex: 63f50000000e -int: 15393162851683
Decoded Data:    {'power_state': False, 'operational_mode': 'Cool', 'target_temperature': 30, 'fan_speed': 'High', 'swing_mode': 0, 'eco_mode': False, 'turbo_mode': False, 'indoor_temperature': -25.0, 'outdoor_temperature': -25.0}

Almost, but the indoor and outdoor temperatures are incorrect. maybe it was 25C but certainly not -25C

this's set command not response, ignore the indoor and outdoor temperatures.

aa755 commented 4 years ago

Thanks for looking into this. Here's another capture where I changed the AC settings in the beginning and left the app open for a while. The app seems to poll every 10s using 2 TCP packets, one of length 57 and another of length 104. The responses are of length 57 and 88 respectively.

mix_change_query_filtered.zip

mac-zhou commented 4 years ago

length 57 maybe is Heartbeat length 88 is the response length 104 is the command

mac-zhou commented 4 years ago

Thanks for looking into this. Here's another capture where I changed the AC settings in the beginning and left the app open for a while. The app seems to poll every 10s using 2 TCP packets, one of length 57 and another of length 104. The responses are of length 57 and 88 respectively.

mix_change_query_filtered.zip

I just updated my code you can clone this repo and install manually python3 setup.py install and the try midea-discover -d again

aa755 commented 4 years ago

Ok, that worked, thanks!

[abhishek@optiplex midea-msmart]$ midea-discover -d
INFO:msmart.cli:Debug mode active
INFO:msmart.cli:Discovering devices with UDP Broadcast, press CTRL-C to quit...
DEBUG:msmart.packet_builder:Finalize request data: aa20ac00000000000003418100ff03ff000200000000000000000000000010b2aa
DEBUG:msmart.lan:Sending to 192.168.1.186:6444 5a5a01116800200000000000000000000000000063f50000000e00000000000000000000000000006b000a76e27eed2c3647e57d8602df8b83803207ac5603efb04d91076733b9bba2ba5dd3770133d9ba3ec377e480772b1cf591303c81e4636fa8375c2c1ec375.
DEBUG:msmart.lan:Received from 192.168.1.186:6444 5a5a01116800200000000000000000000000000063f50000000e00000000000000000000000000006b000a76e27eed2c3647e57d8602df8b83803207ac5603efb04d91076733b9bba2ba5dd3770133d9ba3ec377e480772b1cf591303c81e4636fa8375c2c1ec375.
DEBUG:msmart.device:refresh - Recieved from 192.168.1.186, 63f50000000e: aa1eac00000000000003c0004b667f7f00000000046358000000000000d233
DEBUG:msmart.command:Appliance response data: c0004b667f7f00000000046358000000000000d233
DEBUG:msmart.command:indoor_temperature: 24.5 .
DEBUG:msmart.command:outdoor_temperature: 19.0 .
INFO:msmart.cli:Found a supported '0xac' at 192.168.1.186 - id: 15393162851683 - sn: P0000000Q1BC0F2BAA9B3B0000 - ssid: net_ac_9B3B
oberlon commented 4 years ago

Do I understand it the right way. Midea use two different "protocols" for local communication? midea-discover -d is not working on my host. I get ERROR:msmart.security:aes_decrypt error: ValueError('Padding is incorrect.') When I dump the traffic between my iphone and the Midea AC all data starts with 8370. I'm using latest msmart 0.1.18.

mac-zhou commented 4 years ago

i can't parser data that starts with 8370