nbogojevic / midea-beautiful-air

Python client for accessing Midea air conditioners and dehumidifiers (Midea, Comfee, Inventor EVO) via local network
MIT License
116 stars 19 forks source link

'3004' - 'value is illegal.' #26

Closed JimmyBjorklund closed 10 months ago

JimmyBjorklund commented 1 year ago

When using the library i keep getting '3004' - 'value is illegal.' a bit unclear what the issue is. Any one else have this issue?

Version of the library

version': '2.22.0', 'systemVersion': '8.1.0'

Logs

midea-beautiful-air-cli --verbose --log DEBUG discover --account xxxx@yyy.com --password xxxxx --credentials --app MSmartHome
DEBUG:midea_beautiful:Library version=0.9.15
DEBUG:midea_beautiful.cloud:HTTP request /v1/multicloud/platform/user/route: {'x-recipe-app': '1010', 'Authorization': 'Basic ********************************************************', 'sign': '5146f2233bd1654266e08e4f5a137ebb95e4af70d3f94eb7b8905ba8b7d06994', 'secretVersion': '1', 'random': '1691476063', 'version': '2.22.0', 'systemVersion': '8.1.0', 'platform': '0', 'Accept-Encoding': 'identity', 'Content-Type': 'application/json'} {'appId': 1010, 'format': 2, 'clientType': 1, 'language': 'en_US', 'src': 1010, 'stamp': '20230808082743', 'userName': 'jimmy.bjorklu*************', 'appVNum': '2.22.0', 'appVersion': '2.22.0', 'clientVersion': '2.22.0', 'platformId': '1', 'reqId': 'f41fd6b923bd4a5b9ab375e2e2913614', 'retryCount': '3', 'uid': '', 'userType': '0'}
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/multicloud/platform/user/route HTTP/1.1" 200 168
DEBUG:midea_beautiful.cloud:HTTP response text: {"msg":"ok","code":0,"data":{"masUrl":"https://mp-prod.appsmb.com/mas/v5/app/proxy?alias=","sseUrl":"https://sse.msmartlife.net","idAdapt":"131329","countryCode":"HK"}}
DEBUG:midea_beautiful.cloud:HTTP response: {'msg': 'ok', 'code': 0, 'data': {'masUrl': 'https://mp-prod.appsmb.com/mas/v5/app/proxy?alias=', 'sseUrl': 'https://sse.msmartlife.net', 'idAdapt': '131329', 'countryCode': 'HK'}}
DEBUG:midea_beautiful.cloud:using key='data', result={'masUrl': 'https://mp-prod.appsmb.com/mas/v5/app/proxy?alias=', 'sseUrl': 'https://sse.msmartlife.net', 'idAdapt': '131329', 'countryCode': 'HK'}
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 41
DEBUG:midea_beautiful.cloud:HTTP response: *** REDACTED ***
DEBUG:midea_beautiful.cloud:Restarting session: '3004' - 'value is illegal.'
cdickmann commented 1 year ago

I ran into the same just now. The app works fine.

RobbiTobbi1955 commented 1 year ago

I have the same problem. Obviously Midea changed something. The MSMartHome has been updated some few weeks ago and is now 3.0.2. It works (of course). Also my cpp implementation (yet private) of your phyton fails with connection to the cloud and error 3004. It worked fine until at least may 2023. Local discovery works.

Update: I used new token/key pair derived from midea-discover 2023.8.1 from mac-zhou, then I could request data from my currently active AC. Possibly this token/key pair has "maximum age"? Without connection to the cloud I'm lost (and will check tomorrow what mac zhou exactly did to solve this problem)

RobbiTobbi1955 commented 1 year ago

It seems that the solution for this problem is such: When POST v1/user/login/id/get (you request the LoginID) add "deviceId": "c1acad8939ac0d7d" to the payload (between "stamp" and "LoginAccount"). Add the same in the POST /mk/user/login, between "osVersion" and "deviceId". It even works with "0123456789abcdef" as a "deviceId". Thanks to mill1000 https://github.com/mac-zhou/midea-msmart/issues/109