Closed sebj54 closed 1 year ago
This is what I have now in that file. (VIN VF3....is not real.)
root@b9f12d83-psacc:/data# cat charge_config.json
{
"VF3M45GBUKS512345": {
"percentage_threshold": 100,
"stop_hour": null
}
}
Thank you for the file content, I have been able to set the percentage after that.
But it also reported some warnings:
psa_car_controller-psacc-1 | 2023-04-17 07:55:59,003 :: INFO :: Connected with result code {'session present': 0}
psa_car_controller-psacc-1 | 2023-04-17 07:55:59,005 :: INFO :: subscribe to psa/RemoteServices/to/cid/AP-ACNT200008134063/#
psa_car_controller-psacc-1 | 2023-04-17 07:55:59,006 :: INFO :: subscribe to psa/RemoteServices/events/MPHRTServices/VR3UHZKXZPT537168
psa_car_controller-psacc-1 | 2023-04-17 07:55:59,008 :: WARNING :: Disconnected with result code 5
psa_car_controller-psacc-1 | 2023-04-17 07:55:59,008 :: WARNING :: The connection was refused.
I tried to redo User and OTP configs but it threw an error:
psa_car_controller-psacc-1 | 2023-04-17 07:56:19,979 :: INFO :: save config change
psa_car_controller-psacc-1 | 2023-04-17 07:56:20,530 :: ERROR :: 'vin'
psa_car_controller-psacc-1 | Traceback (most recent call last):
psa_car_controller-psacc-1 | File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/web/view/config_views.py", line 133, in connectPSA
psa_car_controller-psacc-1 | res = firstLaunchConfig(app_name, email, password, countrycode)
psa_car_controller-psacc-1 | File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/setup/app_decoder.py", line 100, in firstLaunchConfig
psa_car_controller-psacc-1 | car = psacc.vehicles_list.get_car_by_vin(vehicle["vin"])
psa_car_controller-psacc-1 | KeyError: 'vin'
Could this "Your psa account is locked because you makes 20 sms activation" be your issue? Do you have error: "NOK:FORBIDDEN" in the log?
Looka at: https://github.com/flobz/psa_car_controller/blob/master/FAQ.md
Do you have correct VIN in charge_config.json?
Yes I replaced yours by mine. I used the same VIN I used with the /charge_control?vin=MY_VIN&percentage=80
. I also restarted Docker container after creating the charge_config.json
file.
Could this "Your psa account is locked because you makes 20 sms activation" be your issue? Do you have error: "NOK:FORBIDDEN" in the log?
Sorry, I didn't see your first message. Yes I have this error now:
psa_car_controller-psacc-1 | 2023-04-17 08:32:17,258 :: ERROR :: remote_refresh_token isn't defined
psa_car_controller-psacc-1 | 2023-04-17 08:32:17,664 :: ERROR :: Error during activation: {'err': 'NOK:FORBIDDEN'}
psa_car_controller-psacc-1 | 2023-04-17 08:32:17,666 :: ERROR :: get_otp_code:
psa_car_controller-psacc-1 | Traceback (most recent call last):
psa_car_controller-psacc-1 | File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/RemoteClient.py", line 193, in get_otp_code
psa_car_controller-psacc-1 | otp_code = self.otp.get_otp_code()
psa_car_controller-psacc-1 | File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/otp/otp.py", line 276, in get_otp_code
psa_car_controller-psacc-1 | raise ConfigException("Can't get otp code")
psa_car_controller-psacc-1 | psa_car_controller.psa.otp.otp.ConfigException: Can't get otp code
psa_car_controller-psacc-1 | 2023-04-17 08:32:17,669 :: ERROR :: Please redo otp config
psa_car_controller-psacc-1 | 2023-04-17 08:32:18,034 :: ERROR :: Error during activation: {'err': 'NOK:FORBIDDEN'}
psa_car_controller-psacc-1 | 2023-04-17 08:32:18,035 :: ERROR :: start_remote_control failed redo otp config
I uninstalled and reinstalled the app. I can't get my car status anymore (from the app), so I'll try later today to get it working (I think I have to link the app with my car again). I'll let you know. Thanks for your help anyway :)
I had the same issue "NOK:FORBIDDEN". After uninstall / reinstall / reset the app, I only had to do OTP config in HA and PSACC started to work OK.
Thanks again, now it works completely! I had to link the app with my car after uninstall and then do the OTP config again.
I would like to close the issue but I'll let @flobz decide because I think it's weird that I did not have any charge_config.json
file in the first place.
Unfortunately, it didn't last :( I still have the charge_config.json file but now I have a access token-related error:
psa_car_controller-psacc-1 | Exception on /get_vehicleinfo/MY_VIN [GET]
psa_car_controller-psacc-1 | Traceback (most recent call last):
psa_car_controller-psacc-1 | File "/usr/lib/python3/dist-packages/flask/app.py", line 2447, in wsgi_app
psa_car_controller-psacc-1 | response = self.full_dispatch_request()
psa_car_controller-psacc-1 | File "/usr/lib/python3/dist-packages/flask/app.py", line 1952, in full_dispatch_request
psa_car_controller-psacc-1 | rv = self.handle_user_exception(e)
psa_car_controller-psacc-1 | File "/usr/lib/python3/dist-packages/flask/app.py", line 1821, in handle_user_exception
psa_car_controller-psacc-1 | reraise(exc_type, exc_value, tb)
psa_car_controller-psacc-1 | File "/usr/lib/python3/dist-packages/flask/_compat.py", line 39, in reraise
psa_car_controller-psacc-1 | raise value
psa_car_controller-psacc-1 | File "/usr/lib/python3/dist-packages/flask/app.py", line 1950, in full_dispatch_request
psa_car_controller-psacc-1 | rv = self.dispatch_request()
psa_car_controller-psacc-1 | File "/usr/lib/python3/dist-packages/flask/app.py", line 1936, in dispatch_request
psa_car_controller-psacc-1 | return self.view_functions[rule.endpoint](**req.view_args)
psa_car_controller-psacc-1 | File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/web/view/views.py", line 146, in get_vehicle_info
psa_car_controller-psacc-1 | response=json.dumps(APP.myp.get_vehicle_info(vin, from_cache).to_dict(), default=str),
psa_car_controller-psacc-1 | File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psacc/application/psa_client.py", line 104, in get_vehicle_info
psa_car_controller-psacc-1 | res = self.api().get_vehicle_status(car.vehicle_id, extension=["odometer"])
psa_car_controller-psacc-1 | File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/connected_car_api/api/vehicles_api.py", line 1229, in get_vehicle_status
psa_car_controller-psacc-1 | (data) = self.get_vehicle_status_with_http_info(id, **kwargs) # noqa: E501
psa_car_controller-psacc-1 | File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/connected_car_api/api/vehicles_api.py", line 1293, in get_vehicle_status_with_http_info
psa_car_controller-psacc-1 | return self.api_client.call_api(
psa_car_controller-psacc-1 | File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/oauth.py", line 78, in call_api
psa_car_controller-psacc-1 | return self._ApiClient__call_api(resource_path, method,
psa_car_controller-psacc-1 | File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 147, in __call_api
psa_car_controller-psacc-1 | self.update_params_for_auth(header_params, query_params, auth_settings)
psa_car_controller-psacc-1 | File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 504, in update_params_for_auth
psa_car_controller-psacc-1 | auth_setting = self.configuration.auth_settings().get(auth)
psa_car_controller-psacc-1 | File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/connected_car_api/configuration.py", line 241, in auth_settings
psa_car_controller-psacc-1 | 'value': 'Bearer ' + self.access_token
psa_car_controller-psacc-1 | TypeError: can only concatenate str (not "NoneType") to str
It seems that the access token is now null. I tried to redo User Config but I'm stll having the "VIN" error. Also tried OTP Config but it throws an error: 401 - no_token : no token provided
.
What am I doing wrong? Is it because the process is not supposed to be turned off or restarted? I am actually testing with Docker if this repo fits my need (I want to stop charging at 80%) before installing it on a server.
I got same errors about 3 h ago, but after about 20 mins everything started to work again. Also the app was unable to connect to the server. Maybe the the PSA server for my area was down?
Yes, now found the log lines: 2023-04-18 17:18:20,314 :: ERROR :: Exception on /get_vehicleinfo/VF3M45GBUKxxxxxx [GET] Traceback (most recent call last): File "/usr/lib/python3/dist-packages/flask/app.py", line 2447, in wsgi_app response = self.full_dispatch_request()
You're right, OTP config is working again this morning 🤷♂️
Describe the bug
I don't have any
charge_config.json
in myconfig
folder. I have done User and OTP config several times (successfully). I can get my car info using the/get_vehicleinfo/MY_VIN
route.Then, when I try to use the
/charge_control?vin=MY_VIN&percentage=80
route to set a 80% limit, I have theFileNotFoundError
.If I manually create the missing file, I have other errors like
AttributeError: 'PSACarController' object has no attribute 'chc'
or JSON parsing related errors.To Reproduce Steps to reproduce the behavior:
what command did you use I used Docker
when the bug append ?
/charge_control?vin=MY_VIN&percentage=80
Does it persist after restarting the program? Yes
Does it persist after recreate config by going to http://server_address:port/config? Yes
Config file
NO
charge_config.json
fileEnvironment (please complete the following information):
What is supposed to be in the missing file?
Thanks in advance for your help on this! 🙏