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

非常抱歉。之前一个issues没能跟进。因为一直在管主hass论坛的内容了。美的的华菱空调适配问题。 #15

Closed boyyao closed 3 years ago

boyyao commented 4 years ago

我现在将msmart升级到最新版本。并且运行midea-discover -d如下: 空调有三台。重复运行midea-discover -d会随机显示其中一台。。

bash-5.0# pip show msmart Name: msmart Version: 0.1.19 Summary: A library to control Midea appliances via the Local area network Home-page: https://github.com/mac-zhou/midea-msmart Author: mac_zhou Author-email: mac.zfl@gmail.com License: UNKNOWN Location: /usr/local/lib/python3.7/site-packages Requires: pycryptodome Required-by: bash-5.0# 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.3.29 837000b8200f04055a5a0111a8007a80000000000000000000000000c204020000850000000000000000000000000000195610e33f8ad661d6bcf360d699751ce43a10d55b2c14f8dd337a30238b38c61d0fa9bf7435ce8fdc29858455ac912f32fc917cb459c4a3135aac7ca28ce027a74a0a46d69f23e8ae365d721dfba3998a0fa254619b8d2f622538cb2ff085ec06c416020931f48926620dfe95e231116d3c5561ee26ead19c5988051404fdb68f2c51de7e8ba309244b935150e8845d ERROR:msmart.security:aes_decrypt error: ValueError('Padding is incorrect.') - data: 195610e33f8ad661d6bcf360d699751ce43a10d55b2c14f8dd337a30238b38c61d0fa9bf7435ce8fdc29858455ac912f32fc917cb459c4a3135aac7ca28ce027 Traceback (most recent call last): File "/usr/local/bin/midea-discover", line 8, in sys.exit(discover()) File "/usr/local/lib/python3.7/site-packages/click/core.py", line 829, in call return self.main(args, kwargs) File "/usr/local/lib/python3.7/site-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/local/lib/python3.7/site-packages/click/core.py", line 610, in invoke return callback(args, **kwargs) File "/usr/local/lib/python3.7/site-packages/msmart/cli.py", line 76, in discover m_type = mssid.split('')[1] IndexError: list index out of range

mac-zhou commented 4 years ago

这个错误我会在下个版本里修正,取值范围不对 从这台空调返回的数据来看是新协议,数据是以8370开头的,暂时没找到办法解密 等下一个修正的版本,看看其他2台是否可以支持

mac_zhou

在 2020年6月25日,02:05,boyyao notifications@github.com 写道:



我现在将msmart升级到最新版本。并且运行midea-discover -d如下: 空调有三台。重复运行midea-discover -d会随机显示其中一台。。

bash-5.0# pip show msmart Name: msmart Version: 0.1.19 Summary: A library to control Midea appliances via the Local area network Home-page: https://github.com/mac-zhou/midea-msmart Author: mac_zhou Author-email: mac.zfl@gmail.commailto:mac.zfl@gmail.com License: UNKNOWN Location: /usr/local/lib/python3.7/site-packages Requires: pycryptodome Required-by: bash-5.0# 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.3.29 837000b8200f04055a5a0111a8007a80000000000000000000000000c204020000850000000000000000000000000000195610e33f8ad661d6bcf360d699751ce43a10d55b2c14f8dd337a30238b38c61d0fa9bf7435ce8fdc29858455ac912f32fc917cb459c4a3135aac7ca28ce027a74a0a46d69f23e8ae365d721dfba3998a0fa254619b8d2f622538cb2ff085ec06c416020931f48926620dfe95e231116d3c5561ee26ead19c5988051404fdb68f2c51de7e8ba309244b935150e8845d ERROR:msmart.security:aes_decrypt error: ValueError('Padding is incorrect.') - data: 195610e33f8ad661d6bcf360d699751ce43a10d55b2c14f8dd337a30238b38c61d0fa9bf7435ce8fdc29858455ac912f32fc917cb459c4a3135aac7ca28ce027 Traceback (most recent call last): File "/usr/local/bin/midea-discover", line 8, in sys.exit(discover()) File "/usr/local/lib/python3.7/site-packages/click/core.py", line 829, in call return self.main(args, kwargs) File "/usr/local/lib/python3.7/site-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/local/lib/python3.7/site-packages/click/core.py", line 610, in invoke return callback(args, **kwargs) File "/usr/local/lib/python3.7/site-packages/msmart/cli.py", line 76, in discover m_type = mssid.split('')[1] IndexError: list index out of range

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/mac-zhou/midea-msmart/issues/15, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA4KC73O4NP567BBZEVAO6DRYI553ANCNFSM4OHAMXCQ.

boyyao commented 4 years ago

感谢回复。。三台空调同一个型号。应该是暂时无法被支持了。。期待能在以后加入支持~~如果有需要我可以提供测试环境。。比如开个内网的映射。美的账号,抓包等等。

这个错误我会在下个版本里修正,取值范围不对 从这台空调返回的数据来看是新协议,数据是以8370开头的,暂时没找到办法解密 等下一个修正的版本,看看其他2台是否可以支持 mac_zhou 在 2020年6月25日,02:05,boyyao notifications@github.com 写道:  我现在将msmart升级到最新版本。并且运行midea-discover -d如下: 空调有三台。重复运行midea-discover -d会随机显示其中一台。。 bash-5.0# pip show msmart Name: msmart Version: 0.1.19 Summary: A library to control Midea appliances via the Local area network Home-page: https://github.com/mac-zhou/midea-msmart Author: mac_zhou Author-email: mac.zfl@gmail.commailto:mac.zfl@gmail.com License: UNKNOWN Location: /usr/local/lib/python3.7/site-packages Requires: pycryptodome Required-by: bash-5.0# 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.3.29 837000b8200f04055a5a0111a8007a80000000000000000000000000c204020000850000000000000000000000000000195610e33f8ad661d6bcf360d699751ce43a10d55b2c14f8dd337a30238b38c61d0fa9bf7435ce8fdc29858455ac912f32fc917cb459c4a3135aac7ca28ce027a74a0a46d69f23e8ae365d721dfba3998a0fa254619b8d2f622538cb2ff085ec06c416020931f48926620dfe95e231116d3c5561ee26ead19c5988051404fdb68f2c51de7e8ba309244b935150e8845d ERROR:msmart.security:aes_decrypt error: ValueError('Padding is incorrect.') - data: 195610e33f8ad661d6bcf360d699751ce43a10d55b2c14f8dd337a30238b38c61d0fa9bf7435ce8fdc29858455ac912f32fc917cb459c4a3135aac7ca28ce027 Traceback (most recent call last): File "/usr/local/bin/midea-discover", line 8, in sys.exit(discover()) File "/usr/local/lib/python3.7/site-packages/click/core.py", line 829, in call return self.main(args, kwargs) File "/usr/local/lib/python3.7/site-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/local/lib/python3.7/site-packages/click/core.py", line 610, in invoke return callback(args, **kwargs) File "/usr/local/lib/python3.7/site-packages/msmart/cli.py", line 76, in discover m_type = mssid.split('')[1] IndexError: list index out of range — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub<#15>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA4KC73O4NP567BBZEVAO6DRYI553ANCNFSM4OHAMXCQ.

mac-zhou commented 4 years ago

暂不支持 若有后续重开此issue

mac-zhou commented 4 years ago

@boyyao 有一些进展 请跟我联系一下

cuikangyi commented 3 years ago

@boyyao 有一些进展 请跟我联系一下

8370可以解密了吗,我有一个电油汀和微波炉都是8370开头的,这个电油汀的逻辑应该和空调很像

mac-zhou commented 3 years ago

8370无法在本地进行解密 需要跟美的云进行交换密钥。 你可以看一下国外1个开发者有关8379描述 不太完美,所以我就不做此开发了。 https://github.com/WMP/midea-ac-py/wiki/AC-module-compatibility

cuikangyi commented 3 years ago

8370无法在本地进行解密 需要跟美的云进行交换密钥。 你可以看一下国外1个开发者有关8379描述 不太完美,所以我就不做此开发了。 https://github.com/WMP/midea-ac-py/wiki/AC-module-compatibility

好的,谢谢

ZaneYork commented 3 years ago

这边分享一下我这边使用8370协议fake server方案的测试结果。局域网内有四台设备,分别为华凌洗碗机、美的冰箱、华凌空调X2。无法完成空调的通讯连接,device.authenticate函数报错。

最新版 midea-discover -d 报告如下:

root@host:~/home_assistant# midea-discover -d
INFO:msmart.cli:Debug mode active
INFO:msmart.cli:msmart version: 0.1.24
INFO:msmart.cli:Sending Device Scan Broadcast...
INFO:msmart.cli:Midea Local Data 192.168.1.128 837000b8200f00005a5a0111a8007a80000000000000000000000000fd8d280000920000000000000000010000000000015c8409818109325b3d33a60679a755307ee9e0b795b0e564a4df6b25121c5fcf6a26d9fa674a83015690ba5dd70a31e34e2c8cf254687d3198a3d116659a027d1c0fc9f2c8b8e27d6de5747a569be05ca019d91538867c161bc97979eba8a906c416020931f48926620dfe95e231116f62620d21750f45433002a8a1693ea234d5353265377bbe8c56520e3dee6cc0
INFO:msmart.cli:Decrypt Reply: 192.168.1.128 e302a8c02c1900003030303045313130313030303030304c323139413331303030363537303030300d6d696465615f65315f303635370000040002000000020000000000e100030000000000502dbb2f29b20590010220440103000000000000000000000000000000000000000000
DEBUG:msmart.command:Finalize request data: aa20ac00000000000003418100ff03ff00020000000000000000000000001ff35a
INFO:msmart.lan:Couldn't connect with Device 192.168.2.227:6444
DEBUG:msmart.device:refresh - Recieved from 192.168.2.227, fd8d28000092: 
INFO:msmart.cli:*** Found a unsupported device - type: '0xe1' - version: V3 - ip: 192.168.2.227 - port: 6444 - id: 160528700313085 - sn: 0000E1101000000L219A310006570000 - ssid: midea_e1_0657
INFO:msmart.cli:Midea Local Data 192.168.1.126 837000c8200f00005a5a0111b8007a8000000000d6ca0c0e0604151423e9280000950000000000000000018000000000abd62538c6ed4f4745efeaf29498fec0a0327262fe909d776110eb89f07f26ff6b0e766a188090ffd00737318ee91d5413b28be5ed636e61382d5fe78270b2b004dc345c82150ddfc50081dbeb0d67b5dd8a83aceb23574565d7b03e1bc5c43b4bdfb3e16e33d88768cc4c3d0658937d96fbcce99f70c976413c2f05f60f82e7e4f32ab7360afc42d8263c52468578e7de0dc2a05d5caa2b6f8dc4ffee7e7b05
INFO:msmart.cli:Decrypt Reply: 192.168.1.126 7e01a8c02c19000030303030303033313232323034303033313132323530353530333430303030300d6d696465615f61635f303334300000830002000000000000000000ac00acac00000000a0681cb970f1150014032017000300000000000000000000000000000000000000000000000000000000000000000000
DEBUG:msmart.command:Finalize request data: aa20ac00000000000003418100ff03ff0002000000000000000000000000278fb6
DEBUG:msmart.lan:Sending to 192.168.1.126:6444 5a5a0111680020000000000005270b0e0604151423e92800009500000000000000000000000000006b000a76e27eed2c3647e57d8602df8ba4cb06c3487ae47c7644a8dfd9233e2bdd915ceec7bd6bb31e4330477192b2137a4eedd657ed13bdc8a35031baedac4d
INFO:msmart.lan:Couldn't connect with Device 192.168.1.126:6444
DEBUG:msmart.device:refresh - Recieved from 192.168.1.126, 23e928000095: 
INFO:msmart.cli:*** Found a unsupported device - type: '0xac' - version: V3 - ip: 192.168.1.126 - port: 6444 - id: 163827235219747 - sn: 00000031222040031122505503400000 - ssid: midea_ac_0340
INFO:msmart.cli:Midea Local Data 192.168.1.177 837000c8200f00005a5a0111b8007a800000000063db0b0e060415148a171e0000950000000000000000018000000000636213d510afed22b361dbc2ef0cd66ccc7f3021a53610553b9732bfe3c65df433a251d7f835c7a4fa27bd6804e194326c5b2eb74297f78daafa7b79d5369bd368534daec78f4e87be164c0cdbc1239183bece575b4d7729ca46d6a506bd15854bdfb3e16e33d88768cc4c3d0658937d96fbcce99f70c976413c2f05f60f82e7d6ebc881653f55a423f3ee69252b2822cff1219f5b0fb449518880093f67caaf
INFO:msmart.cli:Decrypt Reply: 192.168.1.177 b101a8c02c1900003030303043413331313331304131313033304230363131373034393055534c330d6d696465615f63615f3034393000009f0002000000100000000000ca0038000000000030b237f11ae5058701052017010300000000000000000000000000000000000000000000000000000000000000000000
DEBUG:msmart.command:Finalize request data: aa20ac00000000000003418100ff03ff00020000000000000000000000002f4df0
DEBUG:msmart.lan:Sending to 192.168.1.177:6444 5a5a01116800200000000000072f0b0e060415148a171e00009500000000000000000000000000006b000a76e27eed2c3647e57d8602df8bcef2bff4f6df0c6d5010e41fad569e541fd6a683c4596e94e3233ba3eca33e4ed3934df6949de1ef3b9de6d2e6dbfba5
INFO:msmart.lan:Couldn't connect with Device 192.168.1.177:6444
DEBUG:msmart.device:refresh - Recieved from 192.168.1.177, 8a171e000095: 
INFO:msmart.cli:*** Found a unsupported device - type: '0xca' - version: V3 - ip: 192.168.1.177 - port: 6444 - id: 163827234510730 - sn: 0000CA311310A11030B061170490USL3 - ssid: midea_ca_0490
INFO:msmart.cli:Midea Local Data 192.168.1.135 837000c8200f00005a5a0111b8007a8000000000df290c0e0604151450e92800009500000000000000000180000000004b662ba6c8472fc9b925fd8d4ab4767717cae4a2c8bc70cee50f72043b78cbfc8047754670f9fe8b16d363dcc7ae2b6cbcfb0854333d85e8c63db2a67d926633b88ae0c7ec1dda75a8570b280c952eb5765e62e1cb7e92ede8e786529ebfd5904bdfb3e16e33d88768cc4c3d0658937d96fbcce99f70c976413c2f05f60f82e735821a1f231849b52c16ada914ab7bd32bd25ebd32442da11f68dc83e05e3cc2
INFO:msmart.cli:Decrypt Reply: 192.168.1.135 8701a8c02c19000030303030303033313232323034303032333043323330353430313235303030300d6d696465615f61635f303132350000830002000000000000000000ac00acac00000000a0681cbf21bf150014032017000300000000000000000000000000000000000000000000000000000000000000000000
DEBUG:msmart.command:Finalize request data: aa20ac00000000000003418100ff03ff0002000000000000000000000000002f3d
DEBUG:msmart.lan:Sending to 192.168.1.135:6444 5a5a011168002000000000000b000c0e0604151450e92800009500000000000000000000000000006b000a76e27eed2c3647e57d8602df8b2827baca3eb58e38278e05774e31d64d83e6dea1f4afef9c8a9bc5cc586610ce144c350d0d1922ee4f2b9f077f77cff4
INFO:msmart.lan:Couldn't connect with Device 192.168.1.135:6444
DEBUG:msmart.device:refresh - Recieved from 192.168.1.135, 50e928000095: 
INFO:msmart.cli:*** Found a unsupported device - type: '0xac' - version: V3 - ip: 192.168.1.135 - port: 6444 - id: 163827235219792 - sn: 000000312220400230C2305401250000 - ssid: midea_ac_0125

kueblc/midea-msmart的8370分支报告如下:

bash-5.0# 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.1.128 5a5a0111a8007a80000000000000000000000000fd8d280000920000000000000000010000000000015c8409818109325b3d33a60679a755307ee9e0b795b0e564a4df6b25121c5fcf6a26d9fa674a83015690ba5dd70a31e34e2c8cf254687d3198a3d116659a027d1c0fc9f2c8b8e27d6de5747a569be05ca019d91538867c161bc97979eba8a906c416020931f48926620dfe95e231116f62620d21750f45433002a8a1693ea2
INFO:msmart.cli:*** Found a supported 'e1' (3) at 192.168.2.227:6444 - id: 160528700313085 - sn: 0000E1101000000L219A310006570000 - ssid: midea_e1_0657 - mac: 502dbb2f29b2 - protocol: 3
INFO:msmart.cli:Midea Local Data 192.168.1.126 5a5a0111b8007a8000000000d6ae120e0604151423e9280000950000000000000000018000000000abd62538c6ed4f4745efeaf29498fec0a0327262fe909d776110eb89f07f26ff6b0e766a188090ffd00737318ee91d5413b28be5ed636e61382d5fe78270b2b004dc345c82150ddfc50081dbeb0d67b5dd8a83aceb23574565d7b03e1bc5c43b4bdfb3e16e33d88768cc4c3d0658937d96fbcce99f70c976413c2f05f60f82e7364e115ad553312a56924a819e8e3f55
INFO:msmart.cli:*** Found a supported 'ac' (44204) at 192.168.1.126:6444 - id: 163827235219747 - sn: 00000031222040031122505503400000 - ssid: midea_ac_0340 - mac: a0681cb970f1 - protocol: 3
INFO:msmart.cli:Midea Local Data 192.168.1.177 5a5a0111b8007a80000000005d66120e060415148a171e0000950000000000000000018000000000636213d510afed22b361dbc2ef0cd66ccc7f3021a53610553b9732bfe3c65df433a251d7f835c7a4fa27bd6804e194326c5b2eb74297f78daafa7b79d5369bd368534daec78f4e87be164c0cdbc1239183bece575b4d7729ca46d6a506bd15854bdfb3e16e33d88768cc4c3d0658937d96fbcce99f70c976413c2f05f60f82e735a2a7d450e9b12eb9865c6de1727ee8
INFO:msmart.cli:*** Found a supported 'ca' (56) at 192.168.1.177:6444 - id: 163827234510730 - sn: 0000CA311310A11030B061170490USL3 - ssid: midea_ca_0490 - mac: 30b237f11ae5 - protocol: 3
INFO:msmart.cli:Midea Local Data 192.168.1.135 5a5a0111b8007a80000000005174120e0604151450e92800009500000000000000000180000000004b662ba6c8472fc9b925fd8d4ab4767717cae4a2c8bc70cee50f72043b78cbfc8047754670f9fe8b16d363dcc7ae2b6cbcfb0854333d85e8c63db2a67d926633b88ae0c7ec1dda75a8570b280c952eb5765e62e1cb7e92ede8e786529ebfd5904bdfb3e16e33d88768cc4c3d0658937d96fbcce99f70c976413c2f05f60f82e75e056e5a5cb971c9994d688ed038f31a
INFO:msmart.cli:*** Found a supported 'ac' (44204) at 192.168.1.135:6444 - id: 163827235219792 - sn: 000000312220400230C2305401250000 - ssid: midea_ac_0125 - mac: a0681cbf21bf - protocol: 3
njordan77 commented 3 years ago

I'm not sure if v3 is supported. my AC is found but seems to be not supported. Anything i can do to make it work @mac-zhou ?

Thanks a lot Norbert

INFO:msmart.lan:Couldn't connect with Device 192.168.1.70:6444
DEBUG:msmart.device:refresh - Recieved from 192.168.1.70, 6d634534501d:
INFO:msmart.cli:*** Found a unsupported device - type: '0xac' - version: V3 - ip: 192.168.1.70 - port: 6444 - id: 3188xxxxxx98285 - sn: 000000xxxxxxxxxxxxxxxxxxxxxxxxxxDB4C0000 - ssid: net_ac_ASDF
mac-zhou commented 3 years ago

新版已经支持