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

adb抓取数据非M-Smart协议 #76

Open KongXiangning opened 2 years ago

KongXiangning commented 2 years ago

使用6.7.1.73版美居,抓包得到的数据中: 05-09 21:55:56.891 17633 17733 E track : [2022-05-09 21:55:56.890][][track][MopCountly.java][sendDataDelay()][804][com.midea.ai.appliances][com.midea.service.moa.worker]:sendDataDelay: topic = app_action, data = {"app_name":"美的美居","app_version":"6.7.1.73","action_create_time":1652104556863,"opt_system_version":"8.0.0","opt_system_type":"android","network_type":"WIFI","network_operator":"","device_resolution":"1080,1920","device_brand":"samsung","device_type":"SM-G9350","ip_address":"192.168.50.241","device_imei":"359583076312778","action_type":"device_control","button_link_name":"","extra1":"{\"queryStrings\":{\"serviceUrl\":\"/applianceOneTouch/config/list\"},\"transmitData\":{\"deviceId\":29686814015424,\"sn\":\"00000021122011715781202907220000\"}}","extra2":"","page_name":"weex_plugin_control","prev_page_name":"","sub_action":"requestDataTransmit_request","action_result":"成功","location_gps_long":"","location_gps_lat":"","uid":"2d71c2baebd80d6a7e6ac1476c951290","user_account":"11111111111","install_way":"000003","app_key":"900","iot_device_id":"29686814015424","page_id":"5257aadf-c423-4bf8-bcf2-04654598b3cc","device_session_id":null,"widget_name":"0xAC_22011715","widget_version":"20220429","error_msg":""}

数据是空调的,而这台空调是可以通过example.py正常访问到信息的。空调和手机在同网段同网关。上面数据的extra1的数据是否是通过美的服务器控制发送的数据?下面是midea-discover -d的信息: INFO:msmart.cli:Debug mode active INFO:msmart.cli:msmart version: 0.2.3 Currently only supports ac devices, only support MSmartHome APP. DEBUG:asyncio:Using selector: EpollSelector DEBUG:msmart.scanner:Broadcast message sent: 1 DEBUG:msmart.scanner:Midea Local Data 192.168.50.198 5a5a011178007a80000000000000000000000000c0ff0000001b00000000000000000000000000002c24d5598b2a8372fec9d4a5bd17b70569f7dad2cec93b2ded831a60570fe89e68bfab7a16827e1c92e9a27271d86901beeabc30b7a2ebf6d532d277d684c54e42be3415997275550af7a1b19255893f DEBUG:msmart.scanner:Decrypt Reply: 192.168.50.198 c632a8c02c19000030303030303032313132323031313731353738313230323930373232303030300d6d696465615f61635f30373232 DEBUG:msmart.scanner:Midea Local Data 192.168.50.141 5a5a011178007a800000000000000000000000001d58000000340000000000000000000000000000e23580841bf770693d0dfbd925f1319067a41fe3bc064f48a10943037785028811db415827bb369109045db33c975a0239c7ea055769f688bed00cfc854d096c293c17b2b6c1a675cc8d9ca1355476ff DEBUG:msmart.scanner:Decrypt Reply: 192.168.50.141 8d32a8c02c1900003030303045323231313030303033304b353137413130323130313337303030300d6d696465615f65325f30313337 DEBUG:msmart.scanner:Socket timeout DEBUG:msmart.command:Finalize request data: aa20ac00000000000003418100ff03ff0002000000000000000000000000044e1a DEBUG:msmart.scanner:*** Found a device: {'name': 'midea_e2_0137', 'ssid': 'midea_e2_0137', 'ip': '192.168.50.141', 'port': 6444, 'id': 57174604666909, 'version': 2, 'token': None, 'key': None, 'type': 'e2', 'sn': '0E2211000030K517A102101370000', 'model': '030K5', 'support': False, 'run_test': True} DEBUG:msmart.device.AC.appliance:pkt_builder: 192.168.50.198:6444 len: 104 data: 5a5a011168002000000000002a0433090a051614c0ff0000001b00000000000000000000000000006b000a76e27eed2c3647e57d8602df8b0a8b7738ed91d6762986fab07edbd00ec26c0bfb0278a35978bc4be27a65aa39127c4154dc775290062212211d052fb3 DEBUG:msmart.lan:Attempting new connection to 192.168.50.198:6444 DEBUG:msmart.lan:Socket 192.168.50.8:44116 -> 192.168.50.198:6444 retries: 0 time: 0.0 tcp_key: None DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mp-prod.appsmb.com:443 DEBUG:msmart.lan:Sending 192.168.50.8:44116 -> 192.168.50.198:6444 retries: 0 time: 0.0 message: 5a5a011168002000000000002a0433090a051614c0ff0000001b00000000000000000000000000006b000a76e27eed2c3647e57d8602df8b0a8b7738ed91d6762986fab07edbd00ec26c0bfb0278a35978bc4be27a65aa39127c4154dc775290062212211d052fb3 DEBUG:msmart.lan:Recv 192.168.50.8:44116 -> 192.168.50.198:6444 retries: 0 time: 0.55 Response: 5a5a011168002080000000000000000000000000c0ff0000001b0000000000000000000000000000c4ad34b3792163239badf62e8c1e5517d4c996770235718a1ddfb10cc691b3179ad359e795a07b64eab486d93b92aa7aa1084cfce7b3d34a5df224546abcc5e3 DEBUG:msmart.lan:Get responses len: 104 DEBUG:msmart.device.AC.appliance:Got responses from 192.168.50.198:6444 Version: 2 Count: 1 Spend time: 0.56 DEBUG:msmart.device.AC.appliance:Update from 192.168.50.198:6444 aa23ac00000000000203c0004c667f7f00000004006aff10000200000000000000041029 DEBUG:msmart.command:Appliance response data: c0004c667f7f00000004006aff10000200000000000000041029 DEBUG:msmart.scanner:{'_name': None, '_lan_service': <msmart.lan.lan object at 0x7f669dd62a00>, '_ip': '192.168.50.198', '_id': 29686814015424, '_port': 6444, '_keep_last_known_online_state': False, '_type': 172, '_updating': False, '_defer_update': False, '_half_temp_step': False, '_support': True, '_online': True, '_active': True, '_protocol_version': 2, '_token': None, '_key': None, '_last_responses': [], '_prompt_tone': False, '_power_state': False, '_target_temperature': 28.0, '_operational_mode': <operational_mode_enum.cool: 2>, '_fan_speed': <fan_speed_enum.Auto: 102>, '_swing_mode': <swing_mode_enum.Off: 0>, '_eco_mode': False, '_turbo_mode': False, 'fahrenheit_unit': False, '_on_timer': {'status': False, 'hour': 31, 'minutes': 3}, '_off_timer': {'status': False, 'hour': 31, 'minutes': 3}, '_indoor_temperature': 28.2, '_outdoor_temperature': 102.5} DEBUG:msmart.scanner:*** Found a device: {'name': 'midea_ac_0722', 'ssid': 'midea_ac_0722', 'ip': '192.168.50.198', 'port': 6444, 'id': 29686814015424, 'version': 2, 'token': None, 'key': None, 'type': 'ac', 'sn': '00021122011715781202907220000', 'model': '11715', 'support': True, 'run_test': True} INFO:msmart.cli:*** Found a device: {'name': 'midea_ac_0722', 'ssid': 'midea_ac_0722', 'ip': '192.168.50.198', 'port': 6444, 'id': 29686814015424, 'version': 2, 'token': None, 'key': None, 'type': 'ac', 'sn': '00021122011715781202907220000', 'model': '11715', 'support': True, 'run_test': True} INFO:msmart.cli:*** Found a device: {'name': 'midea_e2_0137', 'ssid': 'midea_e2_0137', 'ip': '192.168.50.141', 'port': 6444, 'id': 57174604666909, 'version': 2, 'token': None, 'key': None, 'type': 'e2', 'sn': '0E2211000030K517A102101370000', 'model': '030K5', 'support': False, 'run_test': True}

希望能得到您的指导,谢谢

mac-zhou commented 2 years ago

你是什么需求,没看懂

KongXiangning commented 2 years ago

就是我想通过midea-msmart控制美的电热水器,用midea-discover是可以发现热水器的,就是141,e2的那个。但是我不知道怎么去获取e2(电热水器)的协议,在值得买见过一个你指导的人用了adb抓取手机端局域网控制设备的报文,但是我同样操作抓到的数据却像是和美的服务通信的报文。 所以我想了解获取协议的方法,谢谢