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

saic_ismart_client tells me "incorrect password" #15

Open
elmer0815 opened this issue Nov 26, 2023 · 7 comments
Open

saic_ismart_client tells me "incorrect password" #15

elmer0815 opened this issue Nov 26, 2023 · 7 comments

Comments

@elmer0815
Copy link

I have a problem with the saic_ismart_client telling me I used a wrong pasword.
But I'm sure I use the correct one...

I'm able to login to the ismart app with the same PW and userid I tried to use for the saic-python-mqtt-gateway.
The app login works fine - after I reconnect in the app saic resets my failed logons to 5 attempts.

When I try to login through the gateway it doesn't work.
Is there a restriction in the pw length?
I looked at your code and think that there should be no problem with my pw.
The password has 20 characters, upper/ lowercase and numbers - no special characters.
As I see in the code a password between 6 and 30 characters is supported...

But now I don't have any idea what could be wrong...

My environment:
Everything runs in Docker.
I use the saic-python-mqtt-gateway from docker hub.
I also have a mosquitto and evcc running in docker.
According to the logs the connections between evcc <--> mosquitto <--> saic-python-mqtt-gateway seems to work.

Just the connection saic-python-mqtt-gateway <--> saic api seems to fail :-(

Status: Downloaded newer image for saicismartapi/saic-python-mqtt-gateway:latest
2023-11-26 11:23:30,399 [  INFO  ] Connected to MQTT broker - mqtt_publisher
2023-11-26 11:23:30,402 [  INFO  ] Scheduler started - apscheduler.scheduler
2023-11-26 11:23:31,268 [ ERROR  ] MqttGateway crashed due to SaicApiException - __main__
Traceback (most recent call last):
  File "/usr/src/app/./mqtt_gateway.py", line 301, in run
    login_response_message = self.saic_api.login()
  File "/usr/local/lib/python3.10/site-packages/saic_ismart_client/saic_api.py", line 122, in login
    raise SaicApiException(login_response_message.body.error_message,
saic_ismart_client.exceptions.SaicApiException: return code: 15019, message: Incorrect password. You may have another 3 attempts of the day,please try again.
return code: 15019, message: Incorrect password. You may have another 3 attempts of the day,please try again.

regards
elmer

@tosate
Copy link
Contributor

tosate commented Nov 27, 2023

Does your password contain an ampersand?

@elmer0815
Copy link
Author

elmer0815 commented Nov 27, 2023

No - just normal characters (upper/lowercase) and numbers...
The length of the pw is 20 characters.

Update: and also no special character like äöüß

@tosate
Copy link
Contributor

tosate commented Nov 30, 2023

Is there maybe a white space behind your password in your variable definition?

@elmer0815
Copy link
Author

elmer0815 commented Nov 30, 2023

I start the gateway via docker:

sudo docker run --label=com.centurylinklabs.watchtower.enable=true --restart=no --name saic-python-mqtt-gateway -e [email protected] -e SAIC_PASSWORD=ThisIsmySecurePW123 -e MQTT_URI=tcp://172.17.0.4:1883 -e MQTT_USER=saicmg4 -e MQTT_PASSWORD=myMQttPW456 saicismartapi/saic-python-mqtt-gateway:latest

There is no whitespace after the pw...

After I started this, it ends with the error message mentioned earlier (wrong pw).
In portainer I can see the environment variables I passed to this container and the SAIC_PASSWORD is absolutely correct...
I did a copy/paste and checked with the original PW.

Update:

I thought it could be a problem with the LANG or LC_ALL variable and played with C.UTF-8, en_US.UTF-8 and de_DE.UTF-8.
But also without success... :-(

@lcanod
Copy link

lcanod commented Aug 3, 2024

Same issue here, same password error even tough I'm 100% sure it's correct. I can login in the APP, but not through the Add-on.

Tried with the Phone number as user and also with the mail. No sucess.

Password with no strange characters, only numbers and letters to simplify, but it doesn't work

Were anyone able to troubleshoot or identify the issue?

@tosate
Copy link
Contributor

tosate commented Aug 4, 2024

Hi @lcanod

if you are using the latest version of the MQTT Gateway, then the login and all the other API requests are handled by saic-python-client-ng

In this case you can find on your MQTT broker the topic saic/_internal/api/oauth/token/request that shows you the actual login request that has been sent to the SAIC API. The body starts with grant_type=password&username=<your-user>&password=<your-hashed-password>.

Not the password is sent to the SAIC API, but its SHA1 hash value.
You can validate this value in Bash:

echo -n "your-password" | sha1sum

I hope that you can debug the issue with this information.

@lcanod
Copy link

lcanod commented Aug 7, 2024

My bad, tosate. I was wrongly thinking in the SAIC_MQTT Gateway, and due to the frustration and browsing a lot to try to find out a solution, I didn't realize this is the phyton client instead. :-(

Sorry about that. I still have the login issue, but not with the saic-python-client, but with the saic-python-mqtt-gateway

Any help related to the MQTT Gateway is appreciated anyway ;-)

Sorry about that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants