Skip to content

Code: 3004, Message: value is illegal. #193

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

Closed
sltelitsyn opened this issue Mar 3, 2025 · 11 comments · Fixed by #194
Closed

Code: 3004, Message: value is illegal. #193

sltelitsyn opened this issue Mar 3, 2025 · 11 comments · Fixed by #194
Labels
bug Something isn't working

Comments

@sltelitsyn
Copy link

sltelitsyn commented Mar 3, 2025

Hello,
Since today my AC stopped working with 3004 message: "Code: 3004, Message: value is illegal."
Problem looks similar to mac-zhou/midea-ac-py#217

DEBUG:msmart.cloud:API response: {"code":"0","msg":"ok","data":{"loginId":"%cut"}}
DEBUG:msmart.cloud:Received loginId: %cut
DEBUG:msmart.discover:Discovered 1 devices.
INFO:httpx:HTTP Request: POST https://mp-prod.appsmb.com/mas/v5/app/proxy?alias=/mj/user/login "HTTP/1.1 200 OK"
DEBUG:msmart.cloud:API response: {"code":0,"msg":"成功","data":{"randomData":"01521cb98e7e8d062bd4148b3ed3ee0632e42fb7554e756ebae229726c49d71c","uid":"%cut","accountId":"%cut","nickname":"%cut","mdata":{"tokenPwdInfo":{"tokenPwd":"%cut","expiredDate":1743589356992,"createDate":1740997356992},"userInfo":{"sourceId":"mj_12345","empId":"%cut","address":"","gender":"0","mobile":"%cut,"userDeptInfoList":null,"extras":null,"nameEn":null,"employeeNumber":null,"headPhoto":null,"uid":"%cut","name":"%cut,"email":null},"doDeviceBind":null,"accessToken":"%cut","signUnlockEnabled":null},"accessToken":"%cut","userId":"%cut","email":"%cut}}
DEBUG:msmart.cloud:Received accessToken: %cut
DEBUG:msmart.discover:Fetching token and key for udpid '%cut' (little).
INFO:httpx:HTTP Request: POST https://mp-prod.appsmb.com/mas/v5/app/proxy?alias=/v1/iot/secure/getToken "HTTP/1.1 200 OK"
DEBUG:msmart.cloud:API response: {"code":"3004","msg":"value is illegal."}
ERROR:msmart.discover:Code: 3004, Message: value is illegal.
DEBUG:msmart.discover:Fetching token and key for udpid '%cut' (big).
INFO:httpx:HTTP Request: POST https://mp-prod.appsmb.com/mas/v5/app/proxy?alias=/v1/iot/secure/getToken "HTTP/1.1 200 OK"
DEBUG:msmart.cloud:API response: {"code":"3004","msg":"value is illegal."}

Should I provide something additional to help to resolve the issue?

@mill1000
Copy link
Owner

mill1000 commented Mar 3, 2025

Can you confirm which version is installed?

Have you tried a different cloud region (via the --region argument)?

Might be that the API changed again and I'll have to do some additional RE work.

Luckily, the cloud access is only necessary for obtaining the token and key. If you already have those you can still control the device.

@dlburton87
Copy link

I'm having the same issue when trying to use discover. Version 2025.2.2

@sltelitsyn
Copy link
Author

Can you confirm which version is installed?

Have you tried a different cloud region (via the --region argument)?

Might be that the API changed again and I'll have to do some additional RE work.

Luckily, the cloud access is only necessary for obtaining the token and key. If you already have those you can still control the device.

This happens with latest HACS version of midea integration and replicates with quite old midea python service. I don't know how to check the version, but I installed it several months ago.
I suspect this is a breaking change from Midea side.

Different regions lead to the same behavior.

Unfortunately, I previously removed devices, because I had changed IPs of my ACs, so I don't have any tokens atm.

@sdebruyn
Copy link

sdebruyn commented Mar 4, 2025

Same issue here, I also have this with other integrations like this one

DEBUG:msmart.cloud:Received accessToken: xxxxxxxxh26tc1hieg
DEBUG:msmart.discover:Fetching token and key for udpid 'xxxxxxxxxxxxxxxxxxxx332bd72545' (little).
INFO:httpx:HTTP Request: POST https://mp-prod.appsmb.com/mas/v5/app/proxy?alias=/v1/iot/secure/getToken "HTTP/1.1 200 OK"
DEBUG:msmart.cloud:API response: {"code":"3004","msg":"value is illegal."}
ERROR:msmart.discover:Code: 3004, Message: value is illegal.
DEBUG:msmart.discover:Fetching token and key for udpid 'xxxxxxxxxxxxxxxxxxxxd4772' (big).
INFO:httpx:HTTP Request: POST https://mp-prod.appsmb.com/mas/v5/app/proxy?alias=/v1/iot/secure/getToken "HTTP/1.1 200 OK"
DEBUG:msmart.cloud:API response: {"code":"3004","msg":"value is illegal."}
ERROR:msmart.discover:Code: 3004, Message: value is illegal.
INFO:msmart.cli:Found 1 devices.
INFO:msmart.cli:Found device:
{'ip': '192.168.xxx.50', 'port': 6444, 'id': xxxxxxxxxx348269, 'online': False, 'supported': False, 'type': <DeviceType.AIR_CONDITIONER: 172>, 'name': 'net_ac_xxxx', 'sn': 'xxxxxxxxxxxxxxx7450000', 'key': None, 'token': None}

@mill1000 mill1000 added the bug Something isn't working label Mar 4, 2025
@ryanandres
Copy link

ryanandres commented Mar 4, 2025

I'm also seeing this issue.

I just replaced my problematic US-OSK102 with the US-SK105 (UPC 17310900003164) after @tacomaguy20 suggested in mill1000/midea-ac-py#283

My Carrier Android app is controlling the device just fine, but HA is having issues adding the device...
Image

I ran msmart-ng to get closer to the problem and here's where I'm at...

~ msmart-ng discover 192.168.3.233
INFO:msmart.cli:Discovering 192.168.3.233 on local network.
INFO:msmart.cloud:Using Midea cloud server: https://mp-prod.appsmb.com (China: False).
ERROR:msmart.discover:Code: 3004, Message: value is illegal.
ERROR:msmart.discover:Code: 3004, Message: value is illegal.
INFO:msmart.cli:Found 1 devices.
INFO:msmart.cli:Found device:
{'ip': '192.168.3.233', 'port': 6444, 'id': XXXXXX, 'online': False, 'supported': False, 'type': <DeviceType.AIR_CONDITIONER: 172>, 'name': 'net_ac_43C2', 'sn': 'XXXXXXXXX', 'key': None, 'token': None}

@tacomaguy20
Copy link

I'm also seeing this issue.

I just replaced my problematic US-OSK102 with the US-SK105 (UPC 17310900003164) after @tacomaguy20 suggested in mill1000/midea-ac-py#283

My Carrier Android app is controlling the device just fine, but HA is having issues adding the device... Image

I ran msmart-ng to get closer to the problem and here's where I'm at...

➜ ~ msmart-ng discover 192.168.3.233 INFO:msmart.cli:Discovering 192.168.3.233 on local network. INFO:msmart.cloud:Using Midea cloud server: https://mp-prod.appsmb.com (China: False). ERROR:msmart.discover:Code: 3004, Message: value is illegal. ERROR:msmart.discover:Code: 3004, Message: value is illegal. INFO:msmart.cli:Found 1 devices. INFO:msmart.cli:Found device: {'ip': '192.168.3.233', 'port': 6444, 'id': XXXXXX, 'online': False, 'supported': False, 'type': <DeviceType.AIR_CONDITIONER: 172>, 'name': 'net_ac_43C2', 'sn': 'XXXXXXXXX', 'key': None, 'token': None}

Ryan, I see you mentioned me so I figured I'd chime in. I've never been able to log into the cloud from msmart for whatever reason but HA would still see and detect my units if I had connected to Nethome plus first. I don't have a proprietary app like carrier does. However, when I tried to use msmart, I would get the value is illegal is when I tried to discover without using the --account and --password or if I mistyped either. Even getting the password correct, it never would log me in, just continued to tell me my password was wrong. Additionally, I believe I could see the token information if I used the debug option but I don't think it was necessary to add since the Midea smart AC would detect automatically as long as I used the "discover device" option. Configure manually never seemed to work for me though. I'm not sure if that helps. Maybe trying a generic app like Nethome plus would help you to connect?

@ryanandres
Copy link

Ryan, I see you mentioned me so I figured I'd chime in. I've never been able to log into the cloud from msmart for whatever reason but HA would still see and detect my units if I had connected to Nethome plus first. I don't have a proprietary app like carrier does. However, when I tried to use msmart, I would get the value is illegal is when I tried to discover without using the --account and --password or if I mistyped either. Even getting the password correct, it never would log me in, just continued to tell me my password was wrong. Additionally, I believe I could see the token information if I used the debug option but I don't think it was necessary to add since the Midea smart AC would detect automatically as long as I used the "discover device" option. Configure manually never seemed to work for me though. I'm not sure if that helps. Maybe trying a generic app like Nethome plus would help you to connect?

I just tried the nethome plus app. It said I already had an account so I tried using my Carrier credentials and it worked! Nethome plus has the exact UI as Carrier's app! So I'm guessing it's all the same backend with rebranding.

Anyway, I had all the same experiences as you with everything you mentioned. Perhaps the Code: 3004 error is a recent bug.

Thanks for your input!

@FoxxMD
Copy link

FoxxMD commented Mar 12, 2025

Also having this issue with a Midea MAW08V1QWT I just purchased. Setup from Home Assistant fails with the value is illegal message and when using msmart-ng I get the same type of error as everyone else:

[foxx@foxx-arch ~]$ msmart-ng discover --region US --account **** --password **** 192.168.0.49
INFO:msmart.cli:Discovering 192.168.0.49 on local network.
INFO:msmart.cloud:Using Midea cloud server: https://mp-prod.appsmb.com (China: False).
ERROR:msmart.discover:Code: 3004, Message: value is illegal.
ERROR:msmart.discover:Code: 3004, Message: value is illegal.
INFO:msmart.cli:Found 1 devices.
INFO:msmart.cli:Found device:
{'ip': '192.168.0.49', 'port': 6444, 'id': 151732605894676, 'online': False, 'supported': False, 'type': <DeviceType.AIR_CONDITIONER: 172>, 'name': 'net_ac_A7F2', 'sn': '000000P0000000Q1B80BDA46A7F20000', 'key': None, 'token': None}


[foxx@foxx-arch ~]$ msmart-ng query --region US --account **** --password **** --auto 192.168.0.49
INFO:msmart.cli:Discovering 192.168.0.49 on local network.
INFO:msmart.cloud:Using Midea cloud server: https://mp-prod.appsmb.com (China: False).
ERROR:msmart.discover:Code: 3004, Message: value is illegal.
ERROR:msmart.discover:Code: 3004, Message: value is illegal.
INFO:msmart.cli:Querying device state.
INFO:msmart.lan:Creating new connection to 192.168.0.49:6444.
WARNING:msmart.base_device:Network timeout 192.168.0.49:6444: No response from host.
WARNING:msmart.base_device:No response from 192.168.0.49:6444 in 6.020000 seconds.
ERROR:msmart.cli:Device is not online.

@mill1000
Copy link
Owner

Alright, I have a potential fix ready in PR #194

I'd appreciated if some additional testing could be done against real world devices.

To test, install the PR via pip

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

Then run discover with debugging and post your results. e.g. Success, tokens received and functional or failures with errors.

msmart-ng discover --debug

Thanks for your patience

@sdebruyn
Copy link

I do get tokens with this version, thank you :)

@sltelitsyn
Copy link
Author

sltelitsyn commented Mar 20, 2025

It works. I could obtain the tokens.
Thank you very much for your dedication!

wuwentao added a commit to midea-lan/midea-local that referenced this issue Mar 24, 2025
switch default cloud from Smarthome to Nethome plus.
as Midea closed the api service in Smarthome cloud.

we just receive this temp solution from msmart-ng repo, the origin link
is :
mill1000/midea-msmart#193
mill1000/midea-msmart#194

anyway, it's a backup solution, and midea also will close this service
in future, so we still need to migrate to new v2 cloud api in future.
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.

7 participants