flobz / psa_car_controller

Control psa car with connected_car v4 API.
GNU General Public License v3.0
403 stars 210 forks source link

psacc-ha broken after auto-updated to 3.0.5 #424

Closed PatrikNorrgard closed 1 year ago

PatrikNorrgard commented 1 year ago

Describe the bug After auto-updating in Home-Assistant, sensors are not able to pull data from, not does the Web UI work, it gets a 502: Bad Gateway.

To Reproduce Steps to reproduce the behavior:

  1. what command did you use Open Web UI or use Rest api from home assistant.
  2. when the bug append ? Bug appeared after addon was auto-updated, today.
  3. Does it persist after restarting the program? Yes
  4. Does it persist after recreate config by going to http://server_address:port/config? Not able to test, refuses to allow connections.

Config file Give the anonymize content of the config file Unable to access stuff, except what is in Home Assistant: image

Environment (please complete the following information):

Containerised psa_car_controller loading... 2022-11-07 13:36:47,972 :: INFO :: ["{'vin': 'REDACTED_FOR_SECURITY', 'vehicle_id': '1567a4257576a51315230493354564d794d7a59334f54456a497a686c5a6a466d593245794d5751344e475a6a4e4751784e6d46684d575a6d4d57566c4d57466b596a526c596a42684d474a6a4f4463345a6a55354e6a466b4f4759794f474531597a5a6d4d4464684e6d566b596a593d', 'label': 'Grandland X Hybrid 4x4', 'brand': 'C', 'abrp_name': None, 'battery_power': 13.2, 'fuel_capacity': 43, 'max_elec_consumption': 70, 'max_fuel_consumption': 30}"] 2022-11-07 13:36:48,765 :: INFO :: save config change 2022-11-07 13:36:48,982 :: INFO :: ask wakeup to REDACTED_FOR_SECURITY 2022-11-07 13:36:48,982 :: INFO :: topic: psa/RemoteServices/from/cid/OV-ACNT200001014762/VehCharge/state: {'action': 'state'} 2022-11-07 13:36:49,144 :: INFO :: Connected with result code {'session present': 0} 2022-11-07 13:36:49,145 :: INFO :: subscribe to psa/RemoteServices/to/cid/OV-ACNT200001014762/# 2022-11-07 13:36:49,145 :: INFO :: subscribe to psa/RemoteServices/events/MPHRTServices/REDACTED_FOR_SECURITY 2022-11-07 13:36:49,539 :: WARNING :: Can't get language 2022-11-07 13:36:49,588 :: INFO :: mqtt msg received: psa/RemoteServices/to/cid/OV-ACNT200001014762/VehCharge/state/ProcessManagement b'{"process_date":"2022-11-07T11:36:49Z","vin":"REDACTED_FOR_SECURITY","correlation_id":"e56d8134bee24510b491b159b002c87020221107113648982","process_code":"900","process_message":"[process.900.request.accepted.key]"}' 2022-11-07 13:36:49,930 :: INFO :: mqtt msg received: psa/RemoteServices/to/cid/OV-ACNT200001014762/VehCharge/state/ProcessManagement b'{"process_date":"2022-11-07T11:36:49Z","vin":"REDACTED_FOR_SECURITY","correlation_id":"e56d8134bee24510b491b159b002c87020221107113648982","process_code":"901","process_message":"[process.901.vehicle.asleep.key]"}' Exception in thread Thread-8: Traceback (most recent call last): File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner self.run() File "/usr/lib/python3.9/threading.py", line 892, in run self._target(*self._args, *self._kwargs) File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/web/app.py", line 47, in start_app run(config_flask(args, *kwargs)) File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/web/app.py", line 81, in config_flask importlib.import_module(view) File "/usr/lib/python3.9/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 680, in _load_unlocked File "", line 790, in exec_module File "", line 228, in _call_with_frames_removed File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/web/view/views.py", line 399, in Charging.set_default_price(APP.myp.vehicles_list) File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psacc/application/charging.py", line 45, in set_default_price Charging.set_charge_price(charge, conn, cars.get_car_by_vin(charge.vin)) File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psacc/application/charging.py", line 36, in set_charge_price battery_curves = Charging.get_battery_curve(conn, charge, car) File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psacc/application/charging.py", line 31, in get_battery_curve battery_curves = BatteryChargeCurve.dto_to_battery_curve(car, charge, battery_curves_dto) File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psacc/application/battery_charge_curve.py", line 26, in dto_to_battery_curve km_by_kw = 0.8 battery_curves_dto[-1].autonomy / battery_capacity ZeroDivisionError: float division by zero WARNING: dev bundles requested with serve_locally=False. This is not supported, switching to serve_locally=True 2022-11-07 13:37:08,576 :: INFO :: mqtt msg received: psa/RemoteServices/events/MPHRTServices/REDACTED_FOR_SECURITY b'{"date":"2022-11-07T11:36:51Z","etat_res_elec":1,"precond_state":{"available":1,"programs":{"program1":{"hour":18,"minute":5,"on":1,"day":[0,0,0,0,0,1,0]},"program2":{"hour":7,"minute":15,"on":1,"day":[0,0,0,0,0,1,0]},"program3":{"hour":7,"minute":0,"on":1,"day":[1,1,1,1,1,0,0]},"program4":{"hour":34,"minute":7,"on":0,"day":[0,0,0,0,0,0,0]}},"asap":0,"status":0,"aff":1},"charging_state":{"program":{"hour":1,"minute":0},"available":1,"remaining_time":635,"rate":0,"cable_detected":1,"soc_batt":80,"autonomy_zev":28,"type":0,"aff":1,"hmi_state":0,"mode":0},"stolen_state":0,"vin":"REDACTED_FOR_SECURITY","reason":0,"signal_quality":4,"sev_stop_date":"2022-11-07T05:36:54Z","fds":["NBM01","NCG01","NAO02","NAS01"],"sev_state":0,"obj_counter":1,"privacy_customer":0,"privacy_applicable":0,"privacy_applicable_max":2,"superlock_state":0}' 2022-11-07 13:37:08,577 :: WARNING :: charge begin but API isn't updated 2022-11-07 13:38:08,637 :: INFO :: ask wakeup to REDACTED_FOR_SECURITY 2022-11-07 13:38:08,637 :: INFO :: topic: psa/RemoteServices/from/cid/OV-ACNT200001014762/VehCharge/state: {'action': 'state'} 2022-11-07 13:38:08,638 :: INFO :: mqtt msg received: psa/RemoteServices/events/MPHRTServices/REDACTED_FOR_SECURITY b'{"date":"2022-11-07T11:36:54Z","etat_res_elec":1,"precond_state":{"available":1,"programs":{"program1":{"hour":18,"minute":5,"on":1,"day":[0,0,0,0,0,1,0]},"program2":{"hour":7,"minute":15,"on":1,"day":[0,0,0,0,0,1,0]},"program3":{"hour":7,"minute":0,"on":1,"day":[1,1,1,1,1,0,0]},"program4":{"hour":34,"minute":7,"on":0,"day":[0,0,0,0,0,0,0]}},"asap":0,"status":0,"aff":1},"charging_state":{"program":{"hour":1,"minute":0},"available":1,"remaining_time":635,"rate":0,"cable_detected":1,"soc_batt":80,"autonomy_zev":26,"type":0,"aff":1,"hmi_state":0,"mode":0},"stolen_state":0,"vin":"REDACTED_FOR_SECURITY","reason":4,"signal_quality":4,"sev_stop_date":"2022-11-07T05:36:54Z","fds":["NBM01","NCG01","NAO02","NAS01"],"sev_state":0,"obj_counter":3,"privacy_customer":0,"privacy_applicable":0,"privacy_applicable_max":2,"superlock_state":0}' 2022-11-07 13:38:08,638 :: WARNING :: charge begin but API isn't updated 2022-11-07 13:39:08,698 :: INFO :: ask wakeup to REDACTED_FOR_SECURITY 2022-11-07 13:39:08,698 :: INFO :: topic: psa/RemoteServices/from/cid/OV-ACNT200001014762/VehCharge/state: {'action': 'state'} 2022-11-07 13:39:08,699 :: WARNING :: Disconnected with result code 1 2022-11-07 13:39:09,528 :: INFO :: save config change 2022-11-07 13:39:11,506 :: INFO :: Connected with result code {'session present': 0} 2022-11-07 13:39:11,506 :: INFO :: subscribe to psa/RemoteServices/to/cid/OV-ACNT200001014762/# 2022-11-07 13:39:11,507 :: INFO :: subscribe to psa/RemoteServices/events/MPHRTServices/REDACTED_FOR_SECURITY

Additional context Add any other context about the problem here.

Was working fine, before auto-updating.

PatrikNorrgard commented 1 year ago

I could add that I have tried the following:

TheRealSlimSchaali commented 1 year ago

Same for me. The web UI button just opens a white screen saying "Loading...".

Flodu31 commented 1 year ago

Same for me here

show2go commented 1 year ago

same here

meichhorn commented 1 year ago

Exactly the same for me. The web UI button just opens a white screen saying "Loading...".

flobz commented 1 year ago

Duplicate with #363

italoc commented 1 year ago

Same problem for me, and if I came back to 2.6.0 authentication don’t work.

italoc commented 1 year ago

If I try to open with a direct url not inside home assistant I obtain this error during authentication process

Exception: Traceback (most recent call last): File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/setup/app_decoder.py", line 48, in firstLaunchConfig token = res.json()["accessToken"] KeyError: 'accessToken' HOST_BRANDID : https://id-dcr.citroen.com/mobile-services sitecode: AC_IT_ESP{"returnCode":"NEED_CREATION"}

gerar19 commented 1 year ago

Same here, Loading allways.

kurim commented 1 year ago

@gerar19 Loading always is ingress issue, please see: https://github.com/flobz/psa_car_controller/issues/363#issuecomment-1306770498

@italoc 2.6.0 will not work anymore due it is not updated with new APK code, you need to use 3.0.5, and may be better do a clean installation and enable ext. port 5000 and open it through: homeassistant:5000

TheRealSlimSchaali commented 1 year ago

Thanks a lot that worked for me as well by calling the integration directly via ":5000" via the browser.

leebger commented 1 year ago

Same problem here. Web GUI hang at "Loading". Sensors not able to pull any data. Thx

h-tro commented 1 year ago

Same problem here. Loading allways.

DavidFFerreira commented 1 year ago

Same probleme...Log after do a OTP Config again image

DavidFFerreira commented 1 year ago

more errors image

nuznormal commented 1 year ago

same error here. updated to 3.0.5 and saw that ingress didn't work restored 2.6.0 and that didn't work either anymore. updated again to 3.0.5. the sensors update in home assistant, webpage http://ip:5000 does work but no trips logged since I first updated it to 3.0.5. sometimes i get the same error as DavidFFerreira, sometime no error (after add-on restart) also there is an error when opening the speed chart on a charge

Traceback (most recent call last): File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/web/view/views.py", line 114, in get_battery_curve return figures.get_battery_curve_fig(row, APP.myp.vehicles_list[0]), True File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/web/figures.py", line 159, in get_battery_curve_fig start_date = dash_date_to_datetime(row["start_at"]) File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/web/tools/utils.py", line 44, in dash_date_to_datetime return datetime.strptime(st, "%Y-%m-%dT%H:%M:%S.000Z").replace(tzinfo=UTC) TypeError: strptime() argument 1 must be str, not int

maybe 3.0.5 does not work with the db file on version 2.6.0 ? i really don't wanna lose all the data

madeirab commented 1 year ago

Same problem here.

flobz commented 1 year ago

duplicate with #437