Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Device became unavailable after last MSmartHome app upgrade #11

Closed
syntesys87 opened this issue Jul 1, 2023 · 20 comments · Fixed by mill1000/midea-msmart#10
Closed
Labels
bug Something isn't working

Comments

@syntesys87
Copy link

Describe the bug (描述一下问题)
It is unable to get the device available.

Screenshots / Logs / Pcap File(屏幕截图/日志/抓包文件)
This is the output from midea-discover:
ERROR:msmart.device.AC.command:Payload 'c0004a667f7f00000000006b67000000000000c0' failed CRC. Received: 0xC0, Expected: 0xCB.
ERROR:msmart.device.AC.command:Payload 'c0004a667f7f00000000006a67000000000000c1' failed CRC. Received: 0xC1, Expected: 0x88.
ERROR:msmart.device.AC.command:Payload 'c0004a667f7f00000000006967000000000000c2' failed CRC. Received: 0xC2, Expected: 0x4D.
ERROR:msmart.device.AC.command:Payload 'c0004a667f7f00000000006867000000000000c3' failed CRC. Received: 0xC3, Expected: 0xE.

Versions (版本信息)

  • Home Assistant version: 2023.6.3
  • Midea msmart version: 0.2.5 (latest installed with pip install msmart)
@syntesys87 syntesys87 added the bug Something isn't working label Jul 1, 2023
@mill1000
Copy link
Owner

mill1000 commented Jul 5, 2023

It's possible the firmware updated and the protocol has changed.

What's interesting is that final byte in each message appears to be a valid checksum

Can you enable debug messages and provide logs from that?
midea-discover -d

@mill1000
Copy link
Owner

mill1000 commented Jul 5, 2023

Other users reported similar problems. No solution yet.

This one also looks like a checksum
mac-zhou/midea-msmart/issues/103

Unsure about this one
mac-zhou/midea-msmart/issues/104

@syntesys87
Copy link
Author

It seems thah something changed on firmware, because msmart 0.2.3 worked correctly before the midea app upgrade. Now I'm using with success the package Midea AC LAN, but the next days I will try with debug property.

@mill1000
Copy link
Owner

mill1000 commented Jul 5, 2023

msmart 0.2.3 never checked the CRC or checksum on responses from the device. That was introduced in v0.2.4. It looks like midea_ac_lan also doesn't check for CRCs or checksum.

So I bet your device FW didn't update, but simply this library did and it's incompatible

@syntesys87
Copy link
Author

But now I have the same problem with msmart 0.2.3

@mill1000
Copy link
Owner

Can you confirm that msmart 0.2.3 is installed? Provide the output of midea-discover -d.

@SpasovskiFilip
Copy link

I have the same issue with msmart 0.2.5. here is the output from this command: midea-discover -a myEMAIL@gmail.com -p somePassWoRd -d

INFO:msmart.cli:Debug mode active
INFO:msmart.cli:msmart version: 0.2.5 Currently only supports ac devices, only su
pport MSmartHome and 美的美居 APP.
DEBUG:asyncio:Using selector: EpollSelector
DEBUG:msmart.scanner:Broadcast message sent: 1
DEBUG:msmart.scanner:Midea Local Data 192.168.31.27 837000c8200f00005a5a0111b8007a800000000047b403161907171475f40400001d000000000000000001800000000030340497cedf0ec77a63156f6b2f4c4a4b689493e3a38591df12910591e5a41666788b0860aa9ac205643b39b61be1752842f9da0db794a5a64222fc66b6236b84e5f242e56644bda74b5ca673645ab7d02d2c8d499d71354c08e60d8bd50b304bdfb3e16e33d88768cc4c3d0658937d0bb19369bf0317b24d3a4de9e6a13106161955abf4d2d00728a0c78bfe45a295949fcdd3d92080a8fa6679acfcb4201c
DEBUG:msmart.scanner:Decrypt Reply: 192.168.31.27 1b1fa8c02c19000030303030303050303030303030305131373038364345424530363238303030300b6e65745f61635f303632380000870002000000000000000000ac00acac000000007086cebe0628150029102237000300000000000000000000000000000000000000000000000000000000000000000000
DEBUG:msmart.scanner:Socket timeout
INFO:msmart.cloud:Using Midea cloud server: https://mp-prod.appsmb.com/mas/v5/app/proxy?alias= False
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mp-prod.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mp-prod.appsmb.com:443 "POST /mas/v5/app/proxy?alias=/v1/user/login/id/get HTTP/1.1" 200 77
DEBUG:msmart.cloud:Response: {"code":"0","msg":"ok","data":{"loginId":"215e1f5e-4881-48fe-8973-49d8758e"}}
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mp-prod.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mp-prod.appsmb.com:443 "POST /mas/v5/app/proxy?alias=/mj/user/login HTTP/1.1" 200 848
DEBUG:msmart.cloud:Response: {"code":0,"msg":"成功","data":{"randomData":"763b2d0fd6c89a66fa63b4da290e749a6d5e2c717ae1b6d4e36b54113167f37c","uid":"f3d87037af3a7889d7134c81d68741d8","accountId":"1073857101","nickname":"myNICKNAME","mdata":{"tokenPwdInfo":{"tokenPwd":"211c59764aab9fd564ed7c923bbaec93","expiredDate":1692914643712,"createDate":1690322643712},"userInfo":{"sourceId":"mj_12345","empId":"5383246339692544","address":"","gender":"0","mobile":"myEMAIL@gmail.com","userDeptInfoList":null,"extras":null,"nameEn":null,"employeeNumber":null,"headPhoto":null,"uid":"f3d87037af3a7889d7134c81d68741d8","name":"myEMAIL@gmail.com","email":null},"doDeviceBind":null,"accessToken":"T1h07ldy0pog3u9wb","signUnlockEnabled":null},"accessToken":"763694a44acde89d82c87f5c336d4e100474201e11c9332ad085510599513fa5","userId":"79645281910785","email":"myEMAIL@gmail.com"}}
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mp-prod.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mp-prod.appsmb.com:443 "POST /mas/v5/app/proxy?alias=/v1/iot/secure/getToken HTTP/1.1" 200 303
DEBUG:msmart.cloud:Response: {"code":"0","msg":"ok","data":{"tokenlist":[{"udpId":"322890c3a091665a759ca7aa382d659d","key":"e8e583b3daf2448e84989494297fd34648b5cd4690b54e3ab4c69920bb9e32e7","token":"E2A254B14FBB387153B64A40239922BAA334ED3E2ADBB540D06C014230121574AAA9DE9625390C2AFE34BCDD1138EFCC5AD496E62897CF3AE998C2CEBDDF35D3"}]}}
DEBUG:msmart.lan:Attempting new connection to 192.168.31.27:6444
DEBUG:msmart.lan:Socket 192.168.31.141:35892 -> 192.168.31.27:6444 retries: 0 time: 0.0 tcp_key: None
DEBUG:msmart.lan:Sending 192.168.31.141:35892 -> 192.168.31.27:6444 retries: 0 time: 0.0 message: 8370004020000000e2a254b14fbb387153b64a40239922baa334ed3e2adbb540d06c014230121574aaa9de9625390c2afe34bcdd1138efcc5ad496e62897cf3ae998c2cebddf35d3
DEBUG:msmart.lan:Recv 192.168.31.141:35892 -> 192.168.31.27:6444 retries: 0 time: 0.06 Response: 83700005200f00204552524f52
ERROR:msmart.security:authentication failed
ERROR:msmart.lan:Authentication failed for 192.168.31.141:35892 -> 192.168.31.27:6444 retries: 0 time: 0.06
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mp-prod.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mp-prod.appsmb.com:443 "POST /mas/v5/app/proxy?alias=/v1/iot/secure/getToken HTTP/1.1" 200 303
DEBUG:msmart.cloud:Response: {"code":"0","msg":"ok","data":{"tokenlist":[{"udpId":"949fcdd3d92080a8fa6679acfcb4201c","key":"21b600af7d2f499098235ff8a885a3005707b7c506c841a9a9bd317b6b28be3d","token":"051F1E35FF3C09677D60D1896A8B167A18CCF01488CBD7118628204EC4CECCA0E790C5A07FD6792D3A418B6A1EDC6CB570494EC7CB91BE86B0187B8D5DCA2
415"}]}}
DEBUG:msmart.lan:Socket 192.168.31.141:35892 -> 192.168.31.27:6444 retries: 0 time: 0.69 tcp_key: None
DEBUG:msmart.lan:Sending 192.168.31.141:35892 -> 192.168.31.27:6444 retries: 0 time: 0.69 message: 8370004020000001051f1e35ff3c09677d60d1896a8b167a18ccf01488cbd7118628204ec4cecca0e790c5a07fd6792d3a418b6a1edc6cb570494ec7cb91be86b0187b8d5dca2415
DEBUG:msmart.lan:Recv 192.168.31.141:35892 -> 192.168.31.27:6444 retries: 0 time: 0.7 Response: 837000402001904916db1d71ae1bcfcb1cf59493cedc11db5579a624481e0c190a2a4ba445d132d60168fba58369aa3b27e252d8113d5dee37628d14cb7ef46ac97fe7909345e810
INFO:msmart.lan:Got TCP key for 192.168.31.141:35892 -> 192.168.31.27:6444 retries: 0 time: 0.7 tcp_key: eee1c758d7af876c65911a00e79c62fdb3c7733abb5d0754c18475872f7bfbc0
DEBUG:msmart.base_command:Frame data: aa21ac8d000000000003418100ff03ff000200000000000000000000000003016971
DEBUG:msmart.device.base:pkt_builder: 192.168.31.27:6444 len: 104 data: 5a5a01116800200000000000320604001a07171475f40400001d0000000000000000000000000000b8436dd15e84d5a4fc6fbf77d2b12486e10c552981b23022cb71ea0fc54dc25ecfa0ce55888ac57fc42a7eacc32
85d37db0e1c64667ac2791a14aa34ec4e69cf
DEBUG:msmart.lan:Socket 192.168.31.141:35892 -> 192.168.31.27:6444 retries: 0 time: 1.7 tcp_key: eee1c758d7af876c65911a00e79c62fdb3c7733abb5d0754c18475872f7bfbc0
DEBUG:msmart.lan:Sending 192.168.31.141:35892 -> 192.168.31.27:6444 retries: 0 time: 1.7 message: 8370008e20660635fb7d167311648b388bea1cc785c5b0a89a7b192e41c3dd388c57662b62118287a39baf6dfe08706b738cf4e81625fc70129963f997c4f435e4a5b175108eee42f7ef5d4f18e63ac54a454dbd47da0a7aac3c4201494b38e3638c99cd79569d0d3a2517212feffd5b1c6dff7ac171f5482e9aefc3ae27ff605ce07c1a5fa8500a1237f958a299b980398fdced9e27DEBUG:msmart.lan:Recv 192.168.31.141:35892 -> 192.168.31.27:6444 retries: 0 time: 2.18 Response: 8370007e2063b4b5446a41c3c552fa78f45dd8ba3c6e5e93fd3f34ac7002f50694e22e7dfa60e5133855ca458cfd6ec1c8ee4a822d787d80ad5f0bf7909008511a4fa17e600d26e39979d221ad042af6a5d755b59430fb7064c861a59d4771390e6538ccbbb5603a82f99668bbfb915f78c380e98e203939256ec6532f3930a6f02e0643b6d7
DEBUG:msmart.lan:Got responses len: 134
DEBUG:msmart.device.base:Got responses from 192.168.31.27:6444 Version: 3 Count:1 Spend time: 0.48
DEBUG:msmart.device.base:Update from 192.168.31.27:6444 aa1eac00000000000003c0004b1e7f7f000000000069630000000000000d33
ERROR:msmart.device.AC.command:Payload 'c0004b1e7f7f000000000069630000000000000d' failed CRC. Received: 0xD, Expected: 0xAA.Traceback (most recent call last):
  File "/usr/local/bin/midea-discover", line 8, in <module>
    sys.exit(discover())
             ^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/msmart/cli.py", line 51, in discover
    found_devices = loop.run_until_complete(discovery.get_all() if ip == '' elsediscovery.get(ip))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/msmart/scanner.py", line 193, in get_all
    await self._process_tasks(tasks)
  File "/usr/local/lib/python3.11/site-packages/msmart/scanner.py", line 199, in _process_tasks
    [self.result.add(task.result()) for task in tasks]
  File "/usr/local/lib/python3.11/site-packages/msmart/scanner.py", line 199, in <listcomp>
    [self.result.add(task.result()) for task in tasks]
                     ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/msmart/scanner.py", line 55, in support_test
    await loop.run_in_executor(None, _device.refresh)
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/msmart/device/AC/appliance.py", line 109, in refresh
    self._send_cmd(cmd)
  File "/usr/local/lib/python3.11/site-packages/msmart/device/AC/appliance.py", line 114, in _send_cmd
    self._process_response(response)
  File "/usr/local/lib/python3.11/site-packages/msmart/device/AC/appliance.py", line 124, in _process_response
    if response.id == ResponseId.State:
       ^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/msmart/device/AC/command.py", line 206, in id
    return self._id
           ^^^^^^^^
AttributeError: 'state_response' object has no attribute '_id'. Did you mean: 'id'?

@mill1000
Copy link
Owner

@SpasovskiFilip

I've got a branch that tries to resolve this issue. Can you give it a shot?

Install like so

pip install git+https://github.com/mill1000/midea-msmart.git@issue/checksum_as_crc

And then post the output of midea-discover again.

@SpasovskiFilip
Copy link

Install like so

pip install git+https://github.com/mill1000/midea-msmart.git@issue/checksum_as_crc

And then post the output of midea-discover again.

@mill1000
I tried this and I got a new issue, but the good news is that CRC is not a problem anymore... I think :D
Here is the output of the latest try

INFO:msmart.cli:Debug mode active
INFO:msmart.cli:msmart version: 0.2.6.dev37+ga747a06 Currently only supports ac devices, only support MSmartHome and 美的美居 APP.
DEBUG:asyncio:Using selector: EpollSelector
DEBUG:msmart.scanner:Broadcast message sent: 1
DEBUG:msmart.scanner:Midea Local Data 192.168.31.27 837000c8200f00005a5a0111b8007a80000000007da0350c1a07171475f40400001d000000000000000001800000000030340497cedf0ec77a63156f6b2f4c4a4b689493e3a38591df12910591e5a41666788b0860aa9ac205643b39b61be1752842f9da0db794a5a64222fc66b6236b84e5f242e56644bda74b5ca673645ab7d02d2c8d499d71354c08e60d8bd50b304bdfb3e16e33d88768cc4c3d0658937d0bb19369bf0317b24d3a4de9e6a13106932d8f2dd65858930ee34eef1e82e3bc949fcdd3d92080a8fa6679acfcb4201c
DEBUG:msmart.scanner:Decrypt Reply: 192.168.31.27 1b1fa8c02c19000030303030303050303030303030305131373038364345424530363238303030300b6e65745f61635f303632380000870002000000000000000000ac00acac000000007086cebe0628150029102237000300000000000000000000000000000000000000000000000000000000000000000000
DEBUG:msmart.scanner:Socket timeout
INFO:msmart.cloud:Using Midea cloud server: https://mp-prod.appsmb.com/mas/v5/app/proxy?alias= False
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mp-prod.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mp-prod.appsmb.com:443 "POST /mas/v5/app/proxy?alias=/v1/user/login/id/get HTTP/1.1" 200 77
DEBUG:msmart.cloud:Response: {"code":"0","msg":"ok","data":{"loginId":"98a46b15-ea52-42cd-80e8-92af6163"}}
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mp-prod.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mp-prod.appsmb.com:443 "POST /mas/v5/app/proxy?alias=/mj/user/login HTTP/1.1" 200 848
DEBUG:msmart.cloud:Response: {"code":0,"msg":"成功","data":{"randomData":"d0de7cc9782e9f8bc4e130e1139ae9d25917b5c51c22c05d82146b383a4fdb91","uid":"f3d87037af3a7889d7134c81d68741d8","accountId":"1073857101","nickname":"myNickname","mdata":{"tokenPwdInfo":{"tokenPwd":"0f3f6e47875e8b95614bf1604ef883f2","expiredDate":1692968023456,"createDate":1690376023456},"userInfo":{"sourceId":"mj_12345","empId":"5383246339692544","address":"","gender":"0","mobile":"myEMAIL@gmail.com","userDeptInfoList":null,"extras":null,"nameEn":null,"employeeNumber":null,"headPhoto":null,"uid":"f3d87037af3a7889d7134c81d68741d8","name":"myEMAIL@gmail.com","email":null},"doDeviceBind":null,"accessToken":"ir5sshkT1h0w396q5","signUnlockEnabled":null},"accessToken":"a99dee9426f73d926c852941e5cbce69b1fb5cda9471a69ebd53f0b96351941d","userId":"07819152879645","email":"myEMAIL@gmail.com"}}
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mp-prod.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mp-prod.appsmb.com:443 "POST /mas/v5/app/proxy?alias=/v1/iot/secure/getToken HTTP/1.1" 200 303
DEBUG:msmart.cloud:Response: {"code":"0","msg":"ok","data":{"tokenlist":[{"udpId":"322890c3a091665a759ca7aa382d659d","key":"4dde2162ab5e473f80a68b2c24667e0bc65580977b504f1ca365822b5022a081","token":"40934840B4E1566713B4687EF08258628782F3753AEECA050A0B8AE5BC361B1DB1EBC49F2AAC05E2F98927C7899F38C54EAC828F767B890AEAF3C9698666ED27"}]}}
DEBUG:msmart.lan:Attempting new connection to 192.168.31.27:6444
DEBUG:msmart.lan:Socket 192.168.31.141:59028 -> 192.168.31.27:6444 retries: 0 time: 0.0 tcp_key: None
DEBUG:msmart.lan:Sending 192.168.31.141:59028 -> 192.168.31.27:6444 retries: 0 time: 0.0 message: 837000402000000040934840b4e1566713b4687ef08258628782f3753aeeca050a0b8ae5bc361b1db1ebc49f2aac05e2f98927c7899f38c54eac828f767b890aeaf3c9698666ed27
DEBUG:msmart.lan:Recv 192.168.31.141:59028 -> 192.168.31.27:6444 retries: 0 time: 0.05 Response: 83700005200f00204552524f52
ERROR:msmart.security:authentication failed
ERROR:msmart.lan:Authentication failed for 192.168.31.141:59028 -> 192.168.31.27:6444 retries: 0 time: 0.05
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mp-prod.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mp-prod.appsmb.com:443 "POST /mas/v5/app/proxy?alias=/v1/iot/secure/getToken HTTP/1.1" 200 303
DEBUG:msmart.cloud:Response: {"code":"0","msg":"ok","data":{"tokenlist":[{"udpId":"949fcdd3d92080a8fa6679acfcb4201c","key":"4b406ebafa88466f9db23b93f0305f0d43bee951e80541048983461a51bbfc1a","token":"4364A944F59BA07C90FE2D7310A836C9F73206C7C6E38A18D5C8D1DF8A87447C53EDCDD138774EE003DB8293C1BF468E066B37091093676EFDB780E8562BB92B"}]}}
DEBUG:msmart.lan:Socket 192.168.31.141:59028 -> 192.168.31.27:6444 retries: 0 time: 0.55 tcp_key: None
DEBUG:msmart.lan:Sending 192.168.31.141:59028 -> 192.168.31.27:6444 retries: 0 time: 0.55 message: 83700040200000014364a944f59ba07c90fe2d7310a836c9f73206c7c6e38a18d5c8d1df8a87447c53edcdd138774ee003db8293c1bf468e066b37091093676efdb780e8562bb92b
DEBUG:msmart.lan:Recv 192.168.31.141:59028 -> 192.168.31.27:6444 retries: 0 time: 0.55 Response: 8370004020016f46cb45d45114b79ffa0f865e52f2a2b44ead6f8aed654ef34481fbe917833cb92912d34c5edce8e6b18223dfd4179118ab522274b5df50611bdf20055111e7fbfa
INFO:msmart.lan:Got TCP key for 192.168.31.141:59028 -> 192.168.31.27:6444 retries: 0 time: 0.56 tcp_key: fc392825be0d0de3a54ef319b17211863c40a6d92be48d8c55bc0a93d30bb193
DEBUG:msmart.base_command:Frame data: aa21ac8d000000000003418100ff03ff000200000000000000000000000003016971
DEBUG:msmart.device.base:pkt_builder: 192.168.31.27:6444 len: 104 data: 5a5a01116800200000000000082e350e1a07171475f40400001d0000000000000000000000000000b8436dd15e84d5a4fc6fbf77d2b12486e10c552981b23022cb71ea0fc54dc25ecfa0ce55888ac57fc42a7eacc3285d37a7432dcddad5dd480b943f5494c086b8
DEBUG:msmart.lan:Socket 192.168.31.141:59028 -> 192.168.31.27:6444 retries: 0 time: 1.56 tcp_key: fc392825be0d0de3a54ef319b17211863c40a6d92be48d8c55bc0a93d30bb193
DEBUG:msmart.lan:Sending 192.168.31.141:59028 -> 192.168.31.27:6444 retries: 0 time: 1.56 message: 8370008e2066613e245f3fc889f4014d5c5af1b3ec8c6d7fb1d8017a214dca2d7ad6db1ad8c5ea7ee03228df43fc6cc393b5c2341ab7cc63ba9c01929c9b8d125af44a2ac7a5accce455c0225281014b5f763541ba9ba55a0a8d2e1435a4117c45d63e50342e48830b9db8936f7ec3ec749d27bf421dce67e8714a817f7132d6b8b14a41fca24e01a14f4bb449351fa199813d311cb2
DEBUG:msmart.lan:Recv 192.168.31.141:59028 -> 192.168.31.27:6444 retries: 0 time: 2.04 Response: 8370007e2063c3f5adb5974ae22c9fc681288d14af5175e5f8ddc06295349e8a8d5a4c5f23dd3974c128787da673b9dd5281dfa54e3fb76f85db7ae9b3fd28cacb40f854ee9a0295c49a144c2ba599b8d307e1b9c85d21c7231c408c667222777de3b33ebe0800dc749052db827a78f84ef1c6be51f439f3fdb8168d9682c570289a9df66043
DEBUG:msmart.lan:Got responses len: 134
DEBUG:msmart.device.base:Got responses from 192.168.31.27:6444 Version: 3 Count:1 Spend time: 0.48
DEBUG:msmart.device.base:Update from 192.168.31.27:6444 aa1eac00000000000003c0004b1e7f7f00000000006d71000000000000fb33
DEBUG:msmart.device.AC.command:State response payload: c0004b1e7f7f00000000006d71000000000000
DEBUG:msmart.device.AC.appliance:Unknown <enum 'fan_speed_enum'>: 30
Traceback (most recent call last):
  File "/usr/local/bin/midea-discover", line 8, in <module>
    sys.exit(discover())
             ^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/msmart/cli.py", line 48, in discover
    found_devices = loop.run_until_complete(
                    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/msmart/scanner.py", line 197, in get_all
    await self._process_tasks(tasks)
  File "/usr/local/lib/python3.11/site-packages/msmart/scanner.py", line 203, in _process_tasks
    [self.result.add(task.result()) for task in tasks]
  File "/usr/local/lib/python3.11/site-packages/msmart/scanner.py", line 203, in <listcomp>
    [self.result.add(task.result()) for task in tasks]
                     ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/msmart/scanner.py", line 55, in support_test
    await loop.run_in_executor(None, _device.refresh)
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/msmart/device/AC/appliance.py", line 126, in refresh
    self.send_cmd(cmd)
  File "/usr/local/lib/python3.11/site-packages/msmart/device/AC/appliance.py", line 137, in send_cmd
    self.process_response(response)
  File "/usr/local/lib/python3.11/site-packages/msmart/device/AC/appliance.py", line 151, in process_response
    self.update(response)
  File "/usr/local/lib/python3.11/site-packages/msmart/device/AC/appliance.py", line 213, in update
    self._freeze_protection_mode = res.freeze_protection_mode
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'state_response' object has no attribute 'freeze_protection_mode'

@mill1000
Copy link
Owner

Thanks. It's a start!

I'll make some changes to properly initialize the object and that should clear up the exception.

Can you provide the following info for me?

  • What is the make & model of your unit?
  • What was the state of the unit when you provided the info above? (I.e. operation mode, target temp, fan speed, indoor temperature)

@SpasovskiFilip
Copy link

SpasovskiFilip commented Jul 26, 2023

Thanks for the support!

The unit is the following:

  • Make: VIVAX - SPLIT TYPE AIR CONDITIONER - INDOOR UNIT
  • Model: ACP-12CH35AERI/I2
    Honestly I tried this while I'm at work, and I assume the unit was off (since my wife is fine sitting in 35°C)
    I'm using this in Home Assistant that is running on docker on my Synology NAS.
    I'll try again when I come back home and turn on the unit.

Update:
I tried it at home while the unit was On and I still got the same output.

This is the state of the unit while trying it:

  • Operation mode: Cool
  • Fan speed: Low
  • Target temp: 26°C
  • Indoor temp: 26°C
  • Outdoor temp: 32°C

@mill1000
Copy link
Owner

Just updated the branch. Try installing again and post the output of midea-discover -d

@SpasovskiFilip
Copy link

YES IT WORKS! finally got no errors and got the id! :D Now i hope it works with the Home Assistant integration :)
P.S. The unit was off again during this run.

Here is the output from the debug run

INFO:msmart.cli:Debug mode active
INFO:msmart.cli:msmart version: 0.2.6.dev38+g15a9aee Currently only supports ac devices, only support MSmartHome and 美的美居 APP.
DEBUG:asyncio:Using selector: EpollSelector
DEBUG:msmart.scanner:Broadcast message sent: 1
DEBUG:msmart.scanner:Midea Local Data 192.168.31.27 837000c8200f00005a5a0111b8007a8000000000a6923b151a07171475f40400001d000000000000000001800000000030340497cedf0ec77a63156f6b2f4c4a4b689493e3a38591df12910591e5a41666788b0860aa9ac205643b39b61be1752842f9da0db794a5a64222fc66b6236b84e5f242e56644bda74b5ca673645ab7d02d2c8d499d71354c08e60d8bd50b304bdfb3e16e33d88768cc4c3d0658937d0bb19369bf0317b24d3a4de9e6a131065e2fbaae9aa6703e905e2a16786a4c51949fcdd3d92080a8fa6679acfcb4201c
DEBUG:msmart.scanner:Decrypt Reply: 192.168.31.27 1b1fa8c02c19000030303030303050303030303030305131373038364345424530363238303030300b6e65745f61635f303632380000870002000000000000000000ac00acac000000007086cebe0628150029102237000300000000000000000000000000000000000000000000000000000000000000000000
DEBUG:msmart.scanner:Socket timeout
INFO:msmart.cloud:Using Midea cloud server: https://mp-prod.appsmb.com/mas/v5/app/proxy?alias= False
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mp-prod.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mp-prod.appsmb.com:443 "POST /mas/v5/app/proxy?alias=/v1/user/login/id/get HTTP/1.1" 200 77
DEBUG:msmart.cloud:Response: {"code":"0","msg":"ok","data":{"loginId":"a209cf12-5da1-47c8-befe-8dc0abd4"}}
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mp-prod.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mp-prod.appsmb.com:443 "POST /mas/v5/app/proxy?alias=/mj/user/login HTTP/1.1" 200 848
DEBUG:msmart.cloud:Response: {"code":0,"msg":"成功","data":{"randomData":"7e276c0584b406fbd37e00e2f3a46602ed8dd0187085923ad8feb1af8ed8722f","uid":"f3d87037af3a7889d7134c81d68741d8","accountId":"1073857101","nickname":"myNICKNAME","mdata":{"tokenPwdInfo":{"tokenPwd":"833249648dbc47cf897c4c61d5251b5c","expiredDate":1693000772099,"createDate":1690408772099},"userInfo":{"sourceId":"mj_12345","empId":"5383246339692544","address":"","gender":"0","mobile":"myEMAIL@gmail.com","userDeptInfoList":null,"extras":null,"nameEn":null,"employeeNumber":null,"headPhoto":null,"uid":"f3d87037af3a7889d7134c81d68741d8","name":"myEMAIL@gmail.com","email":null},"doDeviceBind":null,"accessToken":"T1h0plmz7mdc5npuq","signUnlockEnabled":null},"accessToken":"a138c4d2e2376b8519327cd90bc897059571e954e282faf1a8cd684606ed01a5","userId":"79645281910785","email":"myEMAIL@gmail.com"}}
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mp-prod.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mp-prod.appsmb.com:443 "POST /mas/v5/app/proxy?alias=/v1/iot/secure/getToken HTTP/1.1" 200 303
DEBUG:msmart.cloud:Response: {"code":"0","msg":"ok","data":{"tokenlist":[{"udpId":"322890c3a091665a759ca7aa382d659d","key":"bd490f9115b14a768659cc42b25096b8988aa466a3f94105be7f34e093f42936","token":"0EB960941EE30789714C677B39CB9B718E4293913C49A62A8ECABCF0C3D43204F78EA1CAE81E2F9E60E2D10406E1E4E71A94D1FE1D408EBC38798B063BD87529"}]}}
DEBUG:msmart.lan:Attempting new connection to 192.168.31.27:6444
DEBUG:msmart.lan:Socket 192.168.31.141:49488 -> 192.168.31.27:6444 retries: 0 time: 0.0 tcp_key: None
DEBUG:msmart.lan:Sending 192.168.31.141:49488 -> 192.168.31.27:6444 retries: 0 time: 0.0 message: 83700040200000000eb960941ee30789714c677b39cb9b718e4293913c49a62a8ecabcf0c3d43204f78ea1cae81e2f9e60e2d10406e1e4e71a94d1fe1d408ebc38798b063bd87529
DEBUG:msmart.lan:Recv 192.168.31.141:49488 -> 192.168.31.27:6444 retries: 0 time: 0.05 Response: 83700005200f007b4552524f52
ERROR:msmart.security:authentication failed
ERROR:msmart.lan:Authentication failed for 192.168.31.141:49488 -> 192.168.31.27:6444 retries: 0 time: 0.05
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mp-prod.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mp-prod.appsmb.com:443 "POST /mas/v5/app/proxy?alias=/v1/iot/secure/getToken HTTP/1.1" 200 303
DEBUG:msmart.cloud:Response: {"code":"0","msg":"ok","data":{"tokenlist":[{"udpId":"949fcdd3d92080a8fa6679acfcb4201c","key":"b6007d7cab9141d7ba516e8ba3623bba18358d7cf9804e4c84b2c39b884408cd","token":"14DE62A271AE00F8BB7F730B7EC2733FA6C4B8A548CA1042FE37CF0666B5B2DE6B49A7015E91C0423991180D3940BC0CCB386F12E09E3C017F55ED911F3233C5"}]}}
DEBUG:msmart.lan:Socket 192.168.31.141:49488 -> 192.168.31.27:6444 retries: 0 time: 0.53 tcp_key: None
DEBUG:msmart.lan:Sending 192.168.31.141:49488 -> 192.168.31.27:6444 retries: 0 time: 0.53 message: 837000402000000114de62a271ae00f8bb7f730b7ec2733fa6c4b8a548ca1042fe37cf0666b5b2de6b49a7015e91c0423991180d3940bc0ccb386f12e09e3c017f55ed911f3233c5
DEBUG:msmart.lan:Recv 192.168.31.141:49488 -> 192.168.31.27:6444 retries: 0 time: 0.53 Response: 837000402001d741a5c0891482c1f9afd09599db5550e1bc356016402980978e203f0929e55b58ca9a4808d4f37703514fbcf5a9014a26dde9372c8e67223ed95538a3d5ba090af9
INFO:msmart.lan:Got TCP key for 192.168.31.141:49488 -> 192.168.31.27:6444 retries: 0 time: 0.53 tcp_key: be07d4793a4d60e670414bbe255f1a8db32eae49f48d6f789fece3aec011a9f8
DEBUG:msmart.base_command:Frame data: aa21ac8d000000000003418100ff03ff000200000000000000000000000003016971
DEBUG:msmart.device.base:pkt_builder: 192.168.31.27:6444 len: 104 data: 5a5a0111680020000000000046223b171a07171475f40400001d0000000000000000000000000000b8436dd15e84d5a4fc6fbf77d2b12486e10c552981b23022cb71ea0fc54dc25ecfa0ce55888ac57fc42a7eacc3285d37a1fe59e3ad298deeba062c28b6bb4a37
DEBUG:msmart.lan:Socket 192.168.31.141:49488 -> 192.168.31.27:6444 retries: 0 time: 1.54 tcp_key: be07d4793a4d60e670414bbe255f1a8db32eae49f48d6f789fece3aec011a9f8
DEBUG:msmart.lan:Sending 192.168.31.141:49488 -> 192.168.31.27:6444 retries: 0 time: 1.54 message: 8370008e2066823b06a49010c9780fe0b08a8ce54cdd8927f1e15a8d117ea7e34cd01d1f17f7bf7509bdca49bc3671698c79e3019e461d11a8ea10ce3819a3f0d4b2df5dec284674159654046daea3c2631f2fea8fc3860725bd37db0336e7334dcd33c10d2f61f6404acaff04bb50340e696effc8e5b18c092a5123f5f80b525ed4666183ef9b42f2dbc6c5068e9834d7d8eb1ed8e3
DEBUG:msmart.lan:Recv 192.168.31.141:49488 -> 192.168.31.27:6444 retries: 0 time: 2.01 Response: 8370007e20639380943b02961434dda34fe672bc41707e3d007635e4e84326302f8e07ca8c7279d641cc9da9b966613e0f1d8cf5a000a5f12dc5d806bfcba42a3c5fdad63aed3ea4fbf241a91698ad0f0bed7104712ce297a27b0a691e9f71f1e57fa4d77aa2e539b5f700866dc1cc6fc6204ec5d9a3947b93c820cdd6f5199e1f03f80a4adb
DEBUG:msmart.lan:Got responses len: 134
DEBUG:msmart.device.base:Got responses from 192.168.31.27:6444 Version: 3 Count: 1 Spend time: 0.48
DEBUG:msmart.device.base:Update from 192.168.31.27:6444 aa1eac00000000000003c0004a1e7f7f0000000000696f0000000000000233
DEBUG:msmart.device.AC.command:State response payload: c0004a1e7f7f0000000000696f000000000000
DEBUG:msmart.device.AC.appliance:Unknown <enum 'operational_mode_enum'>: None
DEBUG:msmart.device.AC.appliance:Unknown <enum 'fan_speed_enum'>: None
DEBUG:msmart.device.AC.appliance:Unknown <enum 'swing_mode_enum'>: None
DEBUG:msmart.scanner:{'_name': None, '_lan_service': <msmart.lan.lan object at 0x7fe981490550>,'_ip': '192.168.31.27', '_id': 31885837530229, '_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': 3, '_token': bytearray(b'\x14\xdeb\xa2q\xae\x00\xf8\xbb\x7fs\x0b~\xc2s?\xa6\xc4\xb8\xa5H\xca\x10B\xfe7\xcf\x06f\xb5\xb2\xdekI\xa7\x01^\x91\xc0B9\x91\x18\r9@\xbc\x0c\xcb8o\x12\xe0\x9e<\x01\x7fU\xed\x91\x1f23\xc5'), '_key': bytearray(b'\xb6\x00}|\xab\x91A\xd7\xbaQn\x8b\xa3b;\xba\x185\x8d|\xf9\x80NL\x84\xb2\xc3\x9b\x88D\x08\xcd'), '_last_responses': [b'\xaa\x1e\xac\x00\x00\x00\x00\x00\x00\x03\xc0\x00J\x1e\x7f\x7f\x00\x00\x00\x00\x00io\x00\x00\x00\x00\x00\x00\x023'], '_prompt_tone': False, '_power_state': None, '_target_temperature': None, '_operational_mode': <operational_mode_enum.fan_only: 5>, '_fan_speed': <fan_speed_enum.Auto: 102>, '_swing_mode': <swing_mode_enum.Off: 0>, '_eco_mode': None, '_turbo_mode': None, '_freeze_protection_mode': None, '_sleep_mode': None, '_fahrenheit_unit': None, '_display_on': None, '_filter_alert': None, '_supported_op_modes': ['auto', 'cool', 'dry', 'heat', 'fan_only'], '_supported_swing_modes': ['Off', 'Vertical', 'Horizontal', 'Both'], '_supports_eco': True, '_supports_turbo': True, '_supports_freeze_protection_mode': True, '_supports_display_control': True, '_min_target_temperature': 16, '_max_target_temperature': 30, '_on_timer': None, '_off_timer': None, '_indoor_temperature': None, '_outdoor_temperature': None}
DEBUG:msmart.scanner:*** Found a device: {'name': 'net_ac_0628', 'ssid': 'net_ac_0628', 'ip': '192.168.31.27', 'port': 6444, 'id': 31885837530229, 'version': 3, 'token': '14DE62A271AE00F8BB7F730B7EC2733FA6C4B8A548CA1042FE37CF0666B5B2DE6B49A7015E91C0423991180D3940BC0CCB386F12E09E3C017F55ED911F3233C5', 'key': 'b6007d7cab9141d7ba516e8ba3623bba18358d7cf9804e4c84b2c39b884408cd', 'type': 'ac', 'sn': '000P0000000Q17086CEBE06280000', 'model': '00Q17', 'support': True, 'run_test': True}
INFO:msmart.cli:*** Found a device: {'name': 'net_ac_0628', 'ssid': 'net_ac_0628', 'ip': '192.168.31.27', 'port': 6444, 'id': 31885837530229, 'version': 3, 'token': '14DE62A271AE00F8BB7F730B7EC2733FA6C4B8A548CA1042FE37CF0666B5B2DE6B49A7015E91C0423991180D3940BC0CCB386F12E09E3C017F55ED911F3233C5', 'key': 'b6007d7cab9141d7ba516e8ba3623bba18358d7cf9804e4c84b2c39b884408cd', 'type': 'ac', 'sn': '000P0000000Q17086CEBE06280000', 'model': '00Q17', 'support': True, 'run_test': True}

Thanks again @mill1000

@mill1000
Copy link
Owner

Cool! Progress! I just noticed a bug and push another change to the branch.

Let me know how it goes with HA. Your device sends interesting messages so I'm curious how well it works

@filip-spasovski
Copy link

filip-spasovski commented Jul 27, 2023

The integration in HA seems to work ok, but when I try to use it in the dashboard, I get an error.
I turned on debug logging, and this is the output from it.

I copied this directory to the custom_components then restarted HA
https://github.com/mill1000/midea-ac-py/tree/future/custom_components/midea_ac


2023-07-27 10:58:13.227 INFO (MainThread) [custom_components.midea_ac] Starting midea-ac-py. Using msmart version 0.2.6.dev38+g15a9aee.
2023-07-27 10:58:13.285 INFO (SyncWorker_4) [msmart.lan] Got TCP key for 192.168.31.141:51036 -> 192.168.31.27:6444 retries: 0 time: 0.05 tcp_key: b4a424c367f7509d97440f088099e46c5d52ad8ebd54dfc30e9ea991b970172c
2023-07-27 10:58:14.285 INFO (MainThread) [custom_components.midea_ac] Querying device capabilities.
2023-07-27 10:58:16.288 DEBUG (SyncWorker_1) [msmart.lan] Recv 192.168.31.141:51036 -> 192.168.31.27:6444 retries: 0 time: 3.06, timed out
2023-07-27 10:58:16.288 DEBUG (SyncWorker_1) [msmart.lan] Got responses len: 0
2023-07-27 10:58:17.289 DEBUG (SyncWorker_1) [msmart.lan] Socket 192.168.31.141:51036 -> 192.168.31.27:6444 retries: 1 time: 4.06 tcp_key: b4a424c367f7509d97440f088099e46c5d52ad8ebd54dfc30e9ea991b970172c
2023-07-27 10:58:17.289 DEBUG (SyncWorker_1) [msmart.lan] Sending 192.168.31.141:51036 -> 192.168.31.27:6444 retries: 1 time: 4.06 message: 8370007e20664383ec7bf244f84bd7892deeb29f0708a96cf8abe4d6c8b7cac35ef2240b881a61beb4263817201dabdea1179482a3d59b0ccc7faa1b899c9aaf7abf280fa806c25424d8a01e21014813a27723b73b9a151bef8f6ba0a50469eb2b8f4d3096412148eed8ed0246f57339cda2dfc01a25cb62862a7255fc7ccad7352dfaae8834
2023-07-27 10:58:19.291 DEBUG (SyncWorker_1) [msmart.lan] Recv 192.168.31.141:51036 -> 192.168.31.27:6444 retries: 1 time: 6.06, timed out
2023-07-27 10:58:19.291 DEBUG (SyncWorker_1) [msmart.lan] Got responses len: 0
2023-07-27 10:58:19.292 DEBUG (SyncWorker_1) [msmart.device.base] Got responses from 192.168.31.27:6444 Version: 3 Count: 0 Spend time: 5.01
2023-07-27 10:58:19.292 WARNING (SyncWorker_1) [msmart.device.base] Got Null from 192.168.31.27:6444 Version: 3 Count: 0 Spend time: 5.01
2023-07-27 10:58:19.294 INFO (MainThread) [homeassistant.components.climate] Setting up climate.midea_ac
2023-07-27 10:58:19.294 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.midea_ac
2023-07-27 10:58:19.294 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.midea_ac
2023-07-27 10:58:19.294 INFO (MainThread) [homeassistant.components.switch] Setting up switch.midea_ac
2023-07-27 10:58:19.294 INFO (MainThread) [custom_components.midea_ac.climate] Setting up climate platform.
2023-07-27 10:58:19.295 INFO (MainThread) [custom_components.midea_ac.sensor] Setting up sensor platform.
2023-07-27 10:58:19.295 INFO (MainThread) [custom_components.midea_ac.binary_sensor] Setting up binary sensor platform.
2023-07-27 10:58:19.295 INFO (MainThread) [custom_components.midea_ac.switch] Setting up switch platform.
2023-07-27 10:58:19.323 DEBUG (SyncWorker_10) [msmart.base_command] Frame data: aa21ac8d000000000003418100ff03ff00020000000000000000000000000327971d
2023-07-27 10:58:19.323 DEBUG (SyncWorker_10) [msmart.device.base] pkt_builder: 192.168.31.27:6444 len: 104 data: 5a5a0111680020000000000020133a0a1b07171475f40400001d0000000000000000000000000000b8436dd15e84d5a4fc6fbf77d2b1248654096ad10307d0945a1ae7a478e38c42b51febccab0079180710ebd1257ce56ff48cfc3aaed7141010e60fd2b4704d76
2023-07-27 10:58:19.326 DEBUG (SyncWorker_10) [msmart.lan] Socket 192.168.31.141:51036 -> 192.168.31.27:6444 retries: 0 time: 6.1 tcp_key: b4a424c367f7509d97440f088099e46c5d52ad8ebd54dfc30e9ea991b970172c
2023-07-27 10:58:19.326 DEBUG (SyncWorker_10) [msmart.lan] Sending 192.168.31.141:51036 -> 192.168.31.27:6444 retries: 0 time: 6.1 message: 8370008e2066b1dc5354e0585e25d81425796f05f5af221d7aa537cf98d9fe6aac254dedee71007cda47d3cfe0372b3f9c035277849df851292b33280808f7bdd6f385701f130638b435c65d8e3fa0a145f89915fe13d2decd0622722592f2db75eb5c3dd3e5638a8ac7880f4ff5aa3a2c9c9345da9ef8e9f7d3e8748df16c3e536e3ec5c39281a3dd58de7c0c3f154d952817fc8264
2023-07-27 10:58:19.804 DEBUG (SyncWorker_10) [msmart.lan] Recv 192.168.31.141:51036 -> 192.168.31.27:6444 retries: 0 time: 6.57 Response: 8370007e2063fb56be41d71eb9051fc127729ad777a3bd126262ade920af14413f03ea7a3b8d7d88c7bc70fba9d8ba5903298a49e033b1d54dfba8f6780878c07aa5998e5898b1ae6b1285b05349df364cb533bc628e304e1c1d91864a1648fb50eb5af16179a6a2dfa823c68b5e73d5372a39906effe714087a86aec2e1e6e07f230c5da501
2023-07-27 10:58:19.804 DEBUG (SyncWorker_10) [msmart.lan] Got responses len: 134
2023-07-27 10:58:19.804 DEBUG (SyncWorker_10) [msmart.device.base] Got responses from 192.168.31.27:6444 Version: 3 Count: 1 Spend time: 0.48
2023-07-27 10:58:19.804 DEBUG (SyncWorker_10) [msmart.device.base] Update from 192.168.31.27:6444 aa1eac00000000000003c00062657f7f0000000000695c000000000000b633
2023-07-27 10:58:19.805 DEBUG (SyncWorker_10) [msmart.device.AC.command] State response payload: c00062657f7f0000000000695c000000000000
2023-07-27 10:58:19.805 DEBUG (SyncWorker_10) [msmart.device.AC.appliance] Unknown <enum 'operational_mode_enum'>: None
2023-07-27 10:58:19.805 DEBUG (SyncWorker_10) [msmart.device.AC.appliance] Unknown <enum 'fan_speed_enum'>: None
2023-07-27 10:58:19.805 DEBUG (SyncWorker_10) [msmart.device.AC.appliance] Unknown <enum 'swing_mode_enum'>: None
2023-07-27 10:58:23.371 WARNING (SyncWorker_11) [msmart.device.AC.appliance] Device is not capable of operational mode 5.
2023-07-27 10:58:23.372 WARNING (SyncWorker_11) [msmart.device.AC.appliance] Device is not capable of swing mode 0.
2023-07-27 10:58:23.373 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140452534693456] must be real number, not NoneType
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 205, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1965, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2005, in _execute_service
    return await cast(
           ^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service
    return await service.entity_service_call(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 848, in entity_service_call
    response_data = task.result()  # pop exception if have
                    ^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1192, in async_request_call
    return await coro
           ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 892, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/midea_ac/climate.py", line 274, in async_set_hvac_mode
    await self.apply_changes()
  File "/config/custom_components/midea_ac/climate.py", line 121, in apply_changes
    await self.hass.async_add_executor_job(self._device.apply)
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/msmart/device/AC/appliance.py", line 193, in apply
    self.send_cmd(cmd, self._defer_update)
  File "/usr/local/lib/python3.11/site-packages/msmart/device/AC/appliance.py", line 129, in send_cmd
    responses = super().send_cmd(cmd)
                ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/msmart/device/base.py", line 74, in send_cmd
    pkt_builder.set_command(cmd)
  File "/usr/local/lib/python3.11/site-packages/msmart/packet_builder.py", line 36, in set_command
    self.command = command.pack()
                   ^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/msmart/base_command.py", line 22, in pack
    payload = self.payload + bytes([self.message_id])
              ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/msmart/device/AC/command.py", line 113, in payload
    beep = 0x42 if self.beep_on else 0
                           ^^^^^^^^^^^^
TypeError: must be real number, not NoneType

@mill1000
Copy link
Owner

2023-07-27 10:58:19.805 DEBUG (SyncWorker_10) [msmart.device.AC.appliance] Unknown <enum 'operational_mode_enum'>: None
2023-07-27 10:58:19.805 DEBUG (SyncWorker_10) [msmart.device.AC.appliance] Unknown <enum 'fan_speed_enum'>: None
2023-07-27 10:58:19.805 DEBUG (SyncWorker_10) [msmart.device.AC.appliance] Unknown <enum 'swing_mode_enum'>: None

Looks like you didn't update the branch since yesterday. I noticed a bug yesterday after your initial success. Try pulling the latest.

Cool! Progress! I just noticed a bug and push another change to the branch.

@SpasovskiFilip
Copy link

Are you talking about this repo?
https://github.com/mill1000/midea-ac-py/
And if yes, which branch? Is it the default future branch or some other, because that's where I got the midea_ac folder from.

@mill1000
Copy link
Owner

No, I mean mill1000/midea-msmart. The same one we worked with earlier. So update with the same pip command from #11 (comment)

@SpasovskiFilip
Copy link

It works now! OMG, thank you!

I think the issue was I didn't restart HA after I made the pull from the latest changes :D

image

@mill1000
Copy link
Owner

Awesome! I'll get these fixes merged in so everyone else gets them too.

Feel free to create new issues for any problems you encounter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants