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

Cant find Midea applience via cloud. Error code: 3004 message: value is illegal #25

Closed Enton-72 closed 10 months ago

Enton-72 commented 1 year ago

Version of the library

Library version=0.9.5

Environment

LXD Host: Debian 11 (6.0.0-0.deb11.6-amd64) LXC Container: Debian 12 (6.0.0-0.deb11.6-amd64) Network: Full access Python: 3.11.2

Model of appliance where problem occurs

Model: MSMBBU-12HRFN1-QRD0G

Describe the bug

The bug has occurred when I was trying to obtain TOKEN/KEY for our AC appliances via username/password. Command:

midea-beautiful-air-cli --log DEBUG --verbose discover --app "MSmartHome" --account 'mail@example.com' --password 'password' --credentials

Local discover is working (without "--account" and "--password" arguments).

I have tried to do discovery using msmart lib (https://github.com/mac-zhou/midea-msmart) and got the same error but with more info: ValueError: (1006, 'mobile=main@example.com value is illegal.')

Tried with china server/proxied and phone number/email.

Logs

Log:
2023-08-02 08:35:37 mideacontrol midea_beautiful[6923] DEBUG Library version=0.9.15
2023-08-02 08:35:37 mideacontrol midea_beautiful.cloud[6923] DEBUG HTTP request /v1/multicloud/platform/user/route: {'x-recipe-app': '1010', 'Authorization': 'Basic ********************************************************', 'sign': 'f2c73eee6c6d166bbff82a417f47acc4e1cc285c3c62e8a130762cb7817fda74', 'secretVersion': '1', 'random': '1690965337', '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': '20230802083537', 'userName': 'mail@example.com', 'appVNum': '2.22.0', 'appVersion': '2.22.0', 'clientVersion': '2.22.0', 'platformId': '1', 'reqId': 'e0e0e38a70ea17bdbe9a755e4047b72c', 'retryCount': '3', 'uid': '', 'userType': '0'}
2023-08-02 08:35:37 mideacontrol urllib3.connectionpool[6923] DEBUG Starting new HTTPS connection (1): mp-prod.appsmb.com:443
2023-08-02 08:35:38 mideacontrol urllib3.connectionpool[6923] DEBUG https://mp-prod.appsmb.com:443 "POST /mas/v5/app/proxy?alias=/v1/multicloud/platform/user/route HTTP/1.1" 200 168
2023-08-02 08:35:38 mideacontrol midea_beautiful.cloud[6923] DEBUG 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"}}
2023-08-02 08:35:38 mideacontrol midea_beautiful.cloud[6923] DEBUG 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'}}
2023-08-02 08:35:38 mideacontrol midea_beautiful.cloud[6923] DEBUG using key='data', result={'masUrl': 'https://mp-prod.appsmb.com/mas/v5/app/proxy?alias=', 'sseUrl': 'https://sse.msmartlife.net', 'idAdapt': '131329', 'countryCode': 'HK'}
2023-08-02 08:35:38 mideacontrol midea_beautiful.cloud[6923] DEBUG HTTP request /v1/user/login/id/get: {'x-recipe-app': '1010', 'Authorization': 'Basic ********************************************************', 'sign': '63a766c37601fd23ed6125cc26d7fbfb142dbd575ca61bfc15fc51717d4c7bdc', 'secretVersion': '1', 'random': '1690965338', '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': '20230802083538', 'loginAccount': 'mail@example.com', 'appVNum': '2.22.0', 'appVersion': '2.22.0', 'clientVersion': '2.22.0', 'platformId': '1', 'reqId': 'e603d06e5917e4c5e0e7ff27a4103a54', 'retryCount': '3', 'uid': '', 'userType': '0'}
2023-08-02 08:35:38 mideacontrol urllib3.connectionpool[6923] DEBUG Starting new HTTPS connection (1): mp-prod.appsmb.com:443
2023-08-02 08:35:38 mideacontrol urllib3.connectionpool[6923] DEBUG https://mp-prod.appsmb.com:443 "POST /mas/v5/app/proxy?alias=/v1/user/login/id/get HTTP/1.1" 200 41
2023-08-02 08:35:38 mideacontrol midea_beautiful.cloud[6923] DEBUG HTTP response text: {"code":"3004","msg":"value is illegal."}
2023-08-02 08:35:38 mideacontrol midea_beautiful.cloud[6923] DEBUG HTTP response: {'code': '3004', 'msg': 'value is illegal.'}
2023-08-02 08:35:38 mideacontrol midea_beautiful.cloud[6923] DEBUG Restarting session: '3004' - 'value is illegal.'

If you need any additional info I will try my best to provide it.

Thank you.

dkerr64 commented 1 year ago

Camping on that I just bought a Midea dehumidifier and have run into exactly this problem. I know the device is registered to the network properly as I can discover it using IP address...

root@homebridge:~# midea-beautiful-air-cli discover --address 192.168.29.131
id 000000P0000000Q1B88C291B363A0000/150633093209019
  id      = 150633093209019
  addr    = 192.168.29.131
  s/n     = 000000P0000000Q1B88C291B363A0000
  model   = Dehumidifier
  ssid    = net_a1_363A
  online  = True
  name    = 150633093209019
  running = False
  humid%  = 45
  target% = 50
  temp    = 0
  fan     = 40
  tank    = False
  mode    = 0
  ion     = False
  filter  = False
  pump    = False
  defrost = False
  sleep   = False
  error   = 0
  supports= {}
  version = 3
root@homebridge:~#

But as soon as I try and retrieve credentials using my account/password then I get the 3004 value is illegal error.

root@homebridge:~# midea-beautiful-air-cli --verbose --log DEBUG --no-redact discover --address 192.168.29.131 --account David@<redacted> --password <redacted> --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 <redacted>=', 'sign': '<redacted>', 'secretVersion': '1', 'random': '1691159233', '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': '20230804102713', 'userName': 'david@<redacted>', 'appVNum': '2.22.0', 'appVersion': '2.22.0', 'clientVersion': '2.22.0', 'platformId': '1', 'reqId': '5a87a707a7dd0efeb733536e624116ed', '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:midea_beautiful.cloud:HTTP request /v1/user/login/id/get: {'x-recipe-app': '1010', 'Authorization': 'Basic <redacted>=', 'sign': '<redacted>', 'secretVersion': '1', 'random': '1691159234', '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': '20230804102714', 'loginAccount': 'david@<redacted>', 'appVNum': '2.22.0', 'appVersion': '2.22.0', 'clientVersion': '2.22.0', 'platformId': '1', 'reqId': 'acc4fd5448c0a9bf8c4be0f5cfcd8b94', '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/user/login/id/get HTTP/1.1" 200 41
DEBUG:midea_beautiful.cloud:HTTP response text: {"code":"3004","msg":"value is illegal."}
DEBUG:midea_beautiful.cloud:HTTP response: {'code': '3004', 'msg': 'value is illegal.'}
DEBUG:midea_beautiful.cloud:Restarting session: '3004' - 'value is illegal.'

Like @Enton-72 I am also willing to help debug.

dkerr64 commented 1 year ago

An update that I was successful using the NetHome Plus app. First I downloaded and installed that app on my iPhone, then registered for a new account with it (I used the same email address that I used with the mSmartHome app) and then connected the dehumidifier to it. Now I was able to retrieve the credentials...

root@homebridge:~# midea-beautiful-air-cli discover --address 192.168.29.131 --account David@<redacted> --password <redacted> --credentials
id 000000P0000000Q1B88C291B363A0000/150633093209019
  id      = 150633093209019
  addr    = 192.168.29.131
  s/n     = 000000P0000000Q1B88C291B363A0000
  model   = Dehumidifier
  ssid    = net_a1_363A
  online  = True
  name    = Dehumidifier_363A
  running = True
  humid%  = 50
  target% = 40
  temp    = 23.0
  fan     = 80
  tank    = False
  mode    = 1
  ion     = False
  filter  = False
  pump    = False
  defrost = False
  sleep   = False
  error   = 0
  supports= {'fan_speed': 3, 'filter': 2, 'dry_clothes': 1, 'water_level': 4}
  version = 3
  token   = 9B1403CC...<redacted>...2311C5743
  key     = 30dc62ba...<redacted>...97dcc9

and....

root@homebridge:~# midea-beautiful-air-cli status --ip 192.168.29.131 --token 9B1403CC...<redacted>...2311C5743 --key 30dc62ba...<redacted>...97dcc9
id 000000P0000000Q1B88C291B363A0000/150633093209019
  id      = 150633093209019
  addr    = 192.168.29.131
  s/n     = 000000P0000000Q1B88C291B363A0000
  model   = Dehumidifier
  ssid    = net_a1_363A
  online  = True
  name    = 150633093209019
  running = True
  humid%  = 51
  target% = 40
  temp    = 23.0
  fan     = 80
  tank    = False
  mode    = 1
  ion     = False
  filter  = False
  pump    = False
  defrost = False
  sleep   = False
  error   = 0
  supports= {'fan_speed': 3, 'filter': 2, 'dry_clothes': 1, 'water_level': 4}
  version = 3

On my iPhone the device is visible and can be controlled in both apps. I do not know if this will cause future problems or not.

dereitz commented 1 year ago

An update that I was successful using the NetHome Plus app. First I downloaded and installed that app on my iPhone, then registered for a new account with it (I used the same email address that I used with the mSmartHome app) and then connected the dehumidifier to it. Now I was able to retrieve the credentials...

root@homebridge:~# midea-beautiful-air-cli discover --address 192.168.29.131 --account David@<redacted> --password <redacted> --credentials
id 000000P0000000Q1B88C291B363A0000/150633093209019
  id      = 150633093209019
  addr    = 192.168.29.131
  s/n     = 000000P0000000Q1B88C291B363A0000
  model   = Dehumidifier
  ssid    = net_a1_363A
  online  = True
  name    = Dehumidifier_363A
  running = True
  humid%  = 50
  target% = 40
  temp    = 23.0
  fan     = 80
  tank    = False
  mode    = 1
  ion     = False
  filter  = False
  pump    = False
  defrost = False
  sleep   = False
  error   = 0
  supports= {'fan_speed': 3, 'filter': 2, 'dry_clothes': 1, 'water_level': 4}
  version = 3
  token   = 9B1403CC...<redacted>...2311C5743
  key     = 30dc62ba...<redacted>...97dcc9

and....

root@homebridge:~# midea-beautiful-air-cli status --ip 192.168.29.131 --token 9B1403CC...<redacted>...2311C5743 --key 30dc62ba...<redacted>...97dcc9
id 000000P0000000Q1B88C291B363A0000/150633093209019
  id      = 150633093209019
  addr    = 192.168.29.131
  s/n     = 000000P0000000Q1B88C291B363A0000
  model   = Dehumidifier
  ssid    = net_a1_363A
  online  = True
  name    = 150633093209019
  running = True
  humid%  = 51
  target% = 40
  temp    = 23.0
  fan     = 80
  tank    = False
  mode    = 1
  ion     = False
  filter  = False
  pump    = False
  defrost = False
  sleep   = False
  error   = 0
  supports= {'fan_speed': 3, 'filter': 2, 'dry_clothes': 1, 'water_level': 4}
  version = 3

On my iPhone the device is visible and can be controlled in both apps. I do not know if this will cause future problems or not.

Thank you for the tip! This worked for me!

cdickmann commented 1 year ago

I have the same original issue, haven't tried the NetHome app yet.

github-actions[bot] commented 10 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

nbogojevic commented 10 months ago

Should be fixed in version 0.10.0