flobz / psa_car_controller

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

control dashboard shows empty, car.status is empty from MQTT message #333

Closed nosuchuser closed 2 years ago

nosuchuser commented 2 years ago

Describe the bug Visible behavior: "Control" dashboard does not show. Under the hood, log shows the car.status object is not what's expected and charging state is not determined.

To Reproduce Steps to reproduce the behavior:

  1. what command did you use: python server.py (any combination of parameters)
  2. when the bug append ? Most of the times
  3. Does it persist after restarting the program? Yes
  4. Does it persist after recreate config by going to http://server_address:port/config? Yes

Config file Give the anonymize content of the config file

Environment (please complete the following information):

Additional context I'm a newbie. Watch out. I installed and ran it for the first time, left the car charging on the basement and started fiddling with the code. Managed to get through the authentication phase and having the server listening after a while. Thought it was strange that the "Control" dashboard looked funny and had no data from the car then decided to have a look at the logs.

pi@pi3:~/PSA_car_controller/psa_car_controller-master $ python server.py -l 192.168.1.211
2022-03-07 23:47:22,224 :: INFO :: ["{'vin': 'VR7BCZKXxxxxxxxxx', 'vehicle_id': '1566c4933516b4dddd74d54457a4e44516a497a63344d444d774e6a6b334d6d49345a474a6a59324a6c4d54497a4f574e6c4d544979596a4a685a57513459544931595459335a5445354d47593559324a6b596a4d315932526d4d7a566d4e57553459324a6b4f44513d', 'label': 'E-C4', 'brand': 'Citroën', 'abrp_name': 'citroen:ec4:21:50', 'battery_power': 46, 'fuel_capacity': 0, 'max_elec_consumption': 70, 'max_fuel_consumption': 0}"]
2022-03-07 23:47:23,220 :: INFO :: save config change
2022-03-07 23:47:23,470 :: INFO :: ask wakeup to VR7BCZKXxxxxxxxxx
2022-03-07 23:47:23,472 :: INFO :: topic: psa/RemoteServices/from/cid/AC-ACNT200004406926/VehCharge/state: {'action': 'state'}
2022-03-07 23:47:23,627 :: INFO :: Connected with result code {'session present': 0}
2022-03-07 23:47:23,637 :: INFO :: subscribe to psa/RemoteServices/to/cid/AC-ACNT200004406926/#
2022-03-07 23:47:23,644 :: INFO :: subscribe to psa/RemoteServices/events/MPHRTServices/VR7BCZKXxxxxxxxxx
2022-03-07 23:47:23,911 :: INFO :: mqtt msg received: psa/RemoteServices/to/cid/AC-ACNT200004406926/VehCharge/state/ProcessManagement b'{"process_date":"2022-03-07T23:47:23Z","vin":"VR7BCZKXxxxxxxxxx","correlation_id":"a6e4db71f89640499d59b84a3d9923ce20220307234723473","process_code":"900","process_message":"[process.900.request.accepted.key]"}'
2022-03-07 23:47:24,109 :: INFO :: mqtt msg received: psa/RemoteServices/to/cid/AC-ACNT200004406926/VehCharge/state/ProcessManagement b'{"process_date":"2022-03-07T23:47:24Z","vin":"VR7BCZKXxxxxxxxxx","correlation_id":"a6e4db71f89640499d59b84a3d9923ce20220307234723473","process_code":"901","process_message":"[process.901.vehicle.asleep.key]"}'
2022-03-07 23:47:26,744 :: INFO :: update_data
 * Running on http://192.168.1.211:5000/ (Press CTRL+C to quit)
2022-03-07 23:47:43,904 :: INFO :: mqtt msg received: psa/RemoteServices/events/MPHRTServices/VR7BCZKXxxxxxxxxx b'{"date":"2022-03-07T23:47:31Z","etat_res_elec":1,"precond_state":{"available":1,"programs":{"program1":{"hour":34,"minute":7,"on":0,"day":[0,0,0,0,0,0,0]},"program2":{"hour":34,"minute":7,"on":0,"day":[0,0,0,0,0,0,0]},"program3":{"hour":34,"minute":7,"on":0,"day":[0,0,0,0,0,0,0]},"program4":{"hour":34,"minute":7,"on":0,"day":[0,0,0,0,0,0,0]}},"asap":0,"status":0},"charging_state":{"program":{"hour":22,"minute":25},"available":1,"remaining_time":630,"rate":6,"cable_detected":0,"soc_batt":56,"autonomy_zev":214,"type":0,"hmi_state":1,"mode":0},"stolen_state":0,"vin":"VR7BCZKXxxxxxxxxx","reason":0,"signal_quality":1,"sev_stop_date":"2022-03-07T19:41:59Z","fds":["NDR01","NBM01","NCG01","NAO01","NAS01"],"sev_state":0,"obj_counter":1,"privacy_customer":0,"privacy_applicable":0,"privacy_applicable_max":2,"superlock_state":0}'
2022-03-07 23:47:43,906 :: ERROR :: on_mqtt_message:
Traceback (most recent call last):
  File "/home/pi/PSA_car_controller/psa_car_controller-master/libs/psa/RemoteClient.py", line 86, in __on_mqtt_message
    if car and car.status.get_energy('Electric').charging.status != INPROGRESS:
AttributeError: 'NoneType' object has no attribute 'get_energy'
2022-03-07 23:47:43,945 :: INFO :: mqtt msg received: psa/RemoteServices/events/MPHRTServices/VR7BCZKXxxxxxxxxx b'{"date":"2022-03-07T23:47:34Z","etat_res_elec":1,"precond_state":{"available":1,"programs":{"program1":{"hour":34,"minute":7,"on":0,"day":[0,0,0,0,0,0,0]},"program2":{"hour":34,"minute":7,"on":0,"day":[0,0,0,0,0,0,0]},"program3":{"hour":34,"minute":7,"on":0,"day":[0,0,0,0,0,0,0]},"program4":{"hour":34,"minute":7,"on":0,"day":[0,0,0,0,0,0,0]}},"asap":0,"status":0},"charging_state":{"program":{"hour":22,"minute":25},"available":1,"remaining_time":630,"rate":6,"cable_detected":0,"soc_batt":56,"autonomy_zev":214,"type":0,"hmi_state":1,"mode":0},"stolen_state":0,"vin":"VR7BCZKXxxxxxxxxx","reason":4,"signal_quality":1,"sev_stop_date":"2022-03-07T19:41:59Z","fds":["NDR01","NBM01","NCG01","NAO01","NAS01"],"sev_state":0,"obj_counter":2,"privacy_customer":0,"privacy_applicable":0,"privacy_applicable_max":2,"superlock_state":0}'
2022-03-07 23:47:43,948 :: ERROR :: on_mqtt_message:
Traceback (most recent call last):
  File "/home/pi/PSA_car_controller/psa_car_controller-master/libs/psa/RemoteClient.py", line 86, in __on_mqtt_message
    if car and car.status.get_energy('Electric').charging.status != INPROGRESS:
AttributeError: 'NoneType' object has no attribute 'get_energy'
2022-03-07 23:47:44,005 :: INFO :: mqtt msg received: psa/RemoteServices/events/MPHRTServices/VR7BCZKXxxxxxxxxx b'{"date":"2022-03-07T23:47:35Z","etat_res_elec":1,"precond_state":{"available":1,"programs":{"program1":{"hour":34,"minute":7,"on":0,"day":[0,0,0,0,0,0,0]},"program2":{"hour":34,"minute":7,"on":0,"day":[0,0,0,0,0,0,0]},"program3":{"hour":34,"minute":7,"on":0,"day":[0,0,0,0,0,0,0]},"program4":{"hour":34,"minute":7,"on":0,"day":[0,0,0,0,0,0,0]}},"asap":0,"status":0},"charging_state":{"program":{"hour":22,"minute":25},"available":1,"remaining_time":630,"rate":6,"cable_detected":0,"soc_batt":56,"autonomy_zev":214,"type":0,"hmi_state":1,"mode":0},"stolen_state":0,"vin":"VR7BCZKXxxxxxxxxx","reason":3,"signal_quality":1,"sev_stop_date":"2022-03-07T19:41:59Z","fds":["NDR01","NBM01","NCG01","NAO01","NAS01"],"sev_state":0,"obj_counter":3,"privacy_customer":0,"privacy_applicable":0,"privacy_applicable_max":2,"superlock_state":0}'
2022-03-07 23:47:44,006 :: ERROR :: on_mqtt_message:
Traceback (most recent call last):
  File "/home/pi/PSA_car_controller/psa_car_controller-master/libs/psa/RemoteClient.py", line 86, in __on_mqtt_message
    if car and car.status.get_energy('Electric').charging.status != INPROGRESS:
AttributeError: 'NoneType' object has no attribute 'get_energy'
2022-03-07 23:47:44,023 :: INFO :: mqtt msg received: psa/RemoteServices/to/cid/AC-ACNT200004406926/VehCharge/state/ProcessManagement b'{"process_date":"2022-03-07T23:47:43Z","vin":"VR7BCZKXxxxxxxxxx","correlation_id":"a6e4db71f89640499d59b84a3d9923ce20220307234723473","process_code":"903","process_message":"[process.903.request.forwarded.to.vehicle.key]"}'
2022-03-07 23:47:44,387 :: INFO :: mqtt msg received: psa/RemoteServices/to/cid/AC-ACNT200004406926/VehCharge/state b'{"resp_date":"2022-03-07T23:47:44Z","vin":"VR7BCZKXxxxxxxxxx","correlation_id":"a6e4db71f89640499d59b84a3d9923ce20220307234723473","return_code":"0"}'
2022-03-07 23:47:46,658 :: INFO :: mqtt msg received: psa/RemoteServices/events/MPHRTServices/VR7BCZKXxxxxxxxxx b'{"date":"2022-03-07T23:47:40Z","etat_res_elec":0,"precond_state":{"available":1,"programs":{"program1":{"hour":34,"minute":7,"on":0,"day":[0,0,0,0,0,0,0]},"program2":{"hour":34,"minute":7,"on":0,"day":[0,0,0,0,0,0,0]},"program3":{"hour":34,"minute":7,"on":0,"day":[0,0,0,0,0,0,0]},"program4":{"hour":34,"minute":7,"on":0,"day":[0,0,0,0,0,0,0]}},"asap":0,"status":0},"charging_state":{"program":{"hour":22,"minute":25},"available":1,"remaining_time":630,"rate":6,"cable_detected":0,"soc_batt":56,"autonomy_zev":220,"type":0,"hmi_state":1,"mode":0},"stolen_state":0,"vin":"VR7BCZKXxxxxxxxxx","reason":6,"signal_quality":1,"sev_stop_date":"2022-03-07T19:41:59Z","fds":["NDR01","NBM01","NCG01","NAO01","NAS01"],"sev_state":0,"obj_counter":4,"privacy_customer":0,"privacy_applicable":0,"privacy_applicable_max":2,"superlock_state":0}'
2022-03-07 23:47:46,660 :: ERROR :: on_mqtt_message:
Traceback (most recent call last):
  File "/home/pi/PSA_car_controller/psa_car_controller-master/libs/psa/RemoteClient.py", line 86, in __on_mqtt_message
    if car and car.status.get_energy('Electric').charging.status != INPROGRESS:
AttributeError: 'NoneType' object has no attribute 'get_energy'
2022-03-07 23:47:47,449 :: INFO :: mqtt msg received: psa/RemoteServices/events/MPHRTServices/VR7BCZKXxxxxxxxxx b'{"date":"2022-03-07T23:47:42Z","etat_res_elec":0,"precond_state":{"available":1,"programs":{"program1":{"hour":34,"minute":7,"on":0,"day":[0,0,0,0,0,0,0]},"program2":{"hour":34,"minute":7,"on":0,"day":[0,0,0,0,0,0,0]},"program3":{"hour":34,"minute":7,"on":0,"day":[0,0,0,0,0,0,0]},"program4":{"hour":34,"minute":7,"on":0,"day":[0,0,0,0,0,0,0]}},"asap":0,"status":0},"charging_state":{"program":{"hour":22,"minute":25},"available":1,"remaining_time":630,"rate":6,"cable_detected":0,"soc_batt":56,"autonomy_zev":220,"type":0,"hmi_state":1,"mode":0},"stolen_state":0,"vin":"VR7BCZKXxxxxxxxxx","reason":4,"signal_quality":1,"sev_stop_date":"2022-03-07T19:41:59Z","fds":["NDR01","NBM01","NCG01","NAO01","NAS01"],"sev_state":0,"obj_counter":5,"privacy_customer":0,"privacy_applicable":0,"privacy_applicable_max":2,"superlock_state":0}'
2022-03-07 23:47:47,450 :: ERROR :: on_mqtt_message:
Traceback (most recent call last):
  File "/home/pi/PSA_car_controller/psa_car_controller-master/libs/psa/RemoteClient.py", line 86, in __on_mqtt_message
    if car and car.status.get_energy('Electric').charging.status != INPROGRESS:
AttributeError: 'NoneType' object has no attribute 'get_energy'

Added a few breakpoints here and there trying to figure out what was happening. Dumping the "car" object after the call getting a structure like this, the error ocurrs after this message is sent. Is it by any way corrupted?


[('__class__', <class 'libs.car.Car'>),
 ('__delattr__', <method-wrapper '__delattr__' of Car object at 0x7f7ecf63a0>),
 ('__dict__',
  {'_status': None,
   'abrp_name': 'citroen:ec4:21:50',
   'battery_power': 46,
   'brand': 'Citroën',
   'fuel_capacity': 0,
   'label': 'E-C4',
   'max_elec_consumption': 70,
   'max_fuel_consumption': 0,
   'vehicle_id': '1566c4933516b4e6153316844546b55774d54457a4e44516a497a63344d444d774e6a6b334d6d49345a474a6a59324a6c4d54497a4f574e6c4d544979596a4a685a57513459544931595459335a5445354d47593559324a6b596a4d315932526d4d7a566d4e57553459324a6b4f44513d',
   'vin': 'VR7BCZKXCNE011344'}),
 ('__dir__', <built-in method __dir__ of Car object at 0x7f7ecf63a0>),
 ('__doc__', None),
 ('__eq__', <method-wrapper '__eq__' of Car object at 0x7f7ecf63a0>),
 ('__format__', <built-in method __format__ of Car object at 0x7f7ecf63a0>),
 ('__ge__', <method-wrapper '__ge__' of Car object at 0x7f7ecf63a0>),
 ('__getattribute__',
  <method-wrapper '__getattribute__' of Car object at 0x7f7ecf63a0>),
 ('__gt__', <method-wrapper '__gt__' of Car object at 0x7f7ecf63a0>),
 ('__hash__', <method-wrapper '__hash__' of Car object at 0x7f7ecf63a0>),
 ('__init__',
  <bound method Car.__init__ of <libs.car.Car object at 0x7f7ecf63a0>>),
 ('__init_subclass__',
  <built-in method __init_subclass__ of type object at 0x1ac8b380>),
 ('__le__', <method-wrapper '__le__' of Car object at 0x7f7ecf63a0>),
 ('__lt__', <method-wrapper '__lt__' of Car object at 0x7f7ecf63a0>),
 ('__module__', 'libs.car'),
 ('__ne__', <method-wrapper '__ne__' of Car object at 0x7f7ecf63a0>),
 ('__new__', <built-in method __new__ of type object at 0x8e7778>),
 ('__reduce__', <built-in method __reduce__ of Car object at 0x7f7ecf63a0>),
 ('__reduce_ex__',
  <built-in method __reduce_ex__ of Car object at 0x7f7ecf63a0>),
 ('__repr__', <method-wrapper '__repr__' of Car object at 0x7f7ecf63a0>),
 ('__setattr__', <method-wrapper '__setattr__' of Car object at 0x7f7ecf63a0>),
 ('__sizeof__', <built-in method __sizeof__ of Car object at 0x7f7ecf63a0>),
 ('__str__',
  <bound method Car.__str__ of <libs.car.Car object at 0x7f7ecf63a0>>),
 ('__subclasshook__',
  <built-in method __subclasshook__ of type object at 0x1ac8b380>),
 ('__weakref__', None),
 ('_status', None),
 ('abrp_name', 'citroen:ec4:21:50'),
 ('battery_power', 46),
 ('brand', 'Citroën'),
 ('from_json', <bound method Car.from_json of <class 'libs.car.Car'>>),
 ('fuel_capacity', 0),
 ('get_abrp_name',
  <bound method Car.get_abrp_name of <libs.car.Car object at 0x7f7ecf63a0>>),
 ('get_charge_speed',
  <bound method Car.get_charge_speed of <libs.car.Car object at 0x7f7ecf63a0>>),
 ('get_status',
  <bound method Car.get_status of <libs.car.Car object at 0x7f7ecf63a0>>),
 ('has_battery',
  <bound method Car.has_battery of <libs.car.Car object at 0x7f7ecf63a0>>),
 ('has_fuel',
  <bound method Car.has_fuel of <libs.car.Car object at 0x7f7ecf63a0>>),
 ('is_electric',
  <bound method Car.is_electric of <libs.car.Car object at 0x7f7ecf63a0>>),
 ('is_hybrid',
  <bound method Car.is_hybrid of <libs.car.Car object at 0x7f7ecf63a0>>),
 ('is_thermal',
  <bound method Car.is_thermal of <libs.car.Car object at 0x7f7ecf63a0>>),
 ('label', 'E-C4'),
 ('max_elec_consumption', 70),
 ('max_fuel_consumption', 0),
 ('set_model_name',
  <bound method Car.set_model_name of <libs.car.Car object at 0x7f7ecf63a0>>),
 ('status', None),
 ('to_dict',
  <bound method Car.to_dict of <libs.car.Car object at 0x7f7ecf63a0>>),
 ('vehicle_id',
  '1566c4933516b4e6153316844546b55774d54457a4e44516a497a63344d444d774e6a6b334d6d49345a474a6a59324a6c4d54497a4f574e6c4d544979596a4a685a57513459544931595459335a5445354d47593559324a6b596a4d315932526d4d7a566d4e57553459324a6b4f44513d'),
 ('vin', 'VR7BCZKXCNE011344')]

At some point and for a brief while I stopped seeing this error appearing, had a look at the web dashboard and was finally able to see the controls and the charge state displayed. After another restart, it stopped working again.

I have no MQTT messages to use as reference to see if the one I'm getting has a different format.

I'm still able to send wakeup calls and get vehicle info returns truthful data:

pi@pi3:~ $ 
pi@pi3:~ $ curl http://192.168.1.211:5000/get_vehicleinfo/VR7BCZKXxxxxxxxxx
{"embedded": null, "links": {"_self": {"deprecation": null, "href": "https://api.groupe-psa.com/connectedcar/v4/user/vehicles/1566c4933516b4e6153316844546b55774d54457a4e44516a497a63344d444d774e6a6b334d6d49345a474a6a59324a6c4d54497a4f574e6c4d544979596a4a685a57513ddd95459335a5445354d47593559324a6b596a4d315932526d4d7a566d4e57553459324a6b4f44513d/status", "hreflang": null, "name": null, "profile": null, "templated": null, "title": null, "type": null}, "vehicle": null}, "battery": {"current": 0.0, "voltage": 98.0}, "doors_state": null, "energy": [{"updated_at": "2022-03-07 23:49:34+00:00", "autonomy": 220.0, "battery": null, "charging": {"charging_mode": "Slow", "charging_rate": 6, "next_delayed_time": "PT22H25M", "plugged": true, "remaining_time": "PT10H30M", "status": "InProgress"}, "consumption": null, "level": 64.0, "residual": null, "type": "Electric"}, {"updated_at": "2022-02-23 09:53:44+00:00", "autonomy": null, "battery": null, "charging": null, "consumption": null, "level": 0.0, "residual": null, "type": "Fuel"}], "environment": null, "ignition": null, "kinetic": {"acceleration": null, "moving": null, "pace": null, "speed": null}, "last_position": {"type": "Feature", "geometry": {"coordinates": [null, null, null], "type": "Point"}, "properties": {"heading": null, "signal_quality": null, "type": null, "updated_at": null}}, "preconditionning": {"air_conditioning": {"failure_cause": null, "programs": null, "status": "Disabled", "updated_at": "2022-03-07 23:49:33+00:00"}}, "privacy": {"state": "None"}, "safety": null, "service": {"type": "Electric", "updated_at": "2022-03-07 23:49:34+00:00"}, "timed_odometer": {"updated_at": null, "mileage": 1241.7}}pi@pi3:~ $ 
nosuchuser commented 2 years ago

This may also be causing another error message related to preconditioning:


192.168.1.85 - - [08/Mar/2022 00:27:24] "GET /assets/clientside.js?m=1638702954.0 HTTP/1.1" 304 -
192.168.1.85 - - [08/Mar/2022 00:27:24] "GET /_dash-layout HTTP/1.1" 200 -
192.168.1.85 - - [08/Mar/2022 00:27:24] "GET /_dash-dependencies HTTP/1.1" 200 -
2022-03-08 00:27:24,467 :: ERROR :: get_control_tabs:
Traceback (most recent call last):
  File "/home/pi/PSA_car_controller/psa_car_controller-master/web/view/control.py", line 35, in get_control_tabs
    preconditionning_state = car.status.preconditionning.air_conditioning.status != "Disabled"
AttributeError: 'NoneType' object has no attribute 'preconditionning'
192.168.1.85 - - [08/Mar/2022 00:27:24] "POST /_dash-update-component HTTP/1.1" 200 -
nosuchuser commented 2 years ago

and then out of nowhere the inbound message starts to show some more relevant data and the dashboard starts showing correctly:

[('__class__', <class 'libs.car.Car'>),
 ('__delattr__', <method-wrapper '__delattr__' of Car object at 0x7f7ecf63a0>),
 ('__dict__',
  {'_status': {'battery': {'current': 0.0, 'voltage': 98.0},
 'doors_state': None,
 'embedded': None,
 'energy': [{'autonomy': 226.0,
             'battery': None,
             'charging': {'charging_mode': 'Slow',
                          'charging_rate': 6,
                          'next_delayed_time': 'PT22H25M',
                          'plugged': True,
                          'remaining_time': 'PT10H10M',
                          'status': 'InProgress'},
             'consumption': None,
             'level': 65.0,
             'residual': None,
             'type': 'Electric',
             'updated_at': datetime.datetime(2022, 3, 8, 0, 23, 5, tzinfo=tzutc())},
            {'autonomy': None,
             'battery': None,
             'charging': None,
             'consumption': None,
             'level': 0.0,
             'residual': None,
             'type': 'Fuel',
             'updated_at': datetime.datetime(2022, 2, 23, 9, 53, 44, tzinfo=tzutc())}],
 'environment': None,
 'ignition': None,
 'kinetic': {'acceleration': None, 'moving': None, 'pace': None, 'speed': None},
 'last_position': {'geometry': {'coordinates': [None, None, None],
                                'type': 'Point'},
                   'properties': {'heading': None,
                                  'signal_quality': None,
                                  'type': None,
                                  'updated_at': None},
                   'type': 'Feature'},
 'links': {'_self': {'deprecation': None,
                     'href': 'https://api.groupe-psa.com/connectedcar/v4/user/vehicles/1566c4933516b4e6153e44516a497a63344d444d774e6a6b334d6d49345a474a6a59324a6c4d54497a4f574e6c4d544979596a4a685a57513459544931595459335a5445354d47593559324a6b596a4d315932526d4d7a566d4e57553459324a6b4f44513d/status',
                     'hreflang': None,
                     'name': None,
                     'profile': None,
                     'templated': None,
                     'title': None,
                     'type': None},
           'vehicle': None},
 'preconditionning': {'air_conditioning': {'failure_cause': None,
                                           'programs': None,
                                           'status': 'Disabled',
                                           'updated_at': datetime.datetime(2022, 3, 8, 0, 23, 6, tzinfo=tzutc())}},
 'privacy': {'state': 'None'},
 'safety': None,
 'service': {'type': 'Electric',
             'updated_at': datetime.datetime(2022, 3, 8, 0, 23, 6, tzinfo=tzutc())},
 'timed_odometer': {'mileage': 1241.7, 'updated_at': None}},
   'abrp_name': 'citroen:ec4:21:50',
   'battery_power': 46,
   'brand': 'Citroën',
   'fuel_capacity': 0,
   'label': 'E-C4',
   'max_elec_consumption': 70,
   'max_fuel_consumption': 0,
   'vehicle_id': '1566c4933516b4e6153316844546b55774d54457a4e44516a497a63344d444d774e6a6b334d6d49345a474a6544979596a4a685a57513459544931595459335a5445354d47593559324a6b596a4d315932526d4d7a566d4e57553459324a6b4f44513d',
   'vin': 'VR7BCZKXxxxxxxxxx'}),
 ('__dir__', <built-in method __dir__ of Car object at 0x7f7ecf63a0>),
 ('__doc__', None),
 ('__eq__', <method-wrapper '__eq__' of Car object at 0x7f7ecf63a0>),
 ('__format__', <built-in method __format__ of Car object at 0x7f7ecf63a0>),
 ('__ge__', <method-wrapper '__ge__' of Car object at 0x7f7ecf63a0>),
 ('__getattribute__',
  <method-wrapper '__getattribute__' of Car object at 0x7f7ecf63a0>),
 ('__gt__', <method-wrapper '__gt__' of Car object at 0x7f7ecf63a0>),
 ('__hash__', <method-wrapper '__hash__' of Car object at 0x7f7ecf63a0>),
 ('__init__',
  <bound method Car.__init__ of <libs.car.Car object at 0x7f7ecf63a0>>),
 ('__init_subclass__',
  <built-in method __init_subclass__ of type object at 0x1ac8b380>),
 ('__le__', <method-wrapper '__le__' of Car object at 0x7f7ecf63a0>),
 ('__lt__', <method-wrapper '__lt__' of Car object at 0x7f7ecf63a0>),
 ('__module__', 'libs.car'),
 ('__ne__', <method-wrapper '__ne__' of Car object at 0x7f7ecf63a0>),
 ('__new__', <built-in method __new__ of type object at 0x8e7778>),
 ('__reduce__', <built-in method __reduce__ of Car object at 0x7f7ecf63a0>),
 ('__reduce_ex__',
  <built-in method __reduce_ex__ of Car object at 0x7f7ecf63a0>),
 ('__repr__', <method-wrapper '__repr__' of Car object at 0x7f7ecf63a0>),
 ('__setattr__', <method-wrapper '__setattr__' of Car object at 0x7f7ecf63a0>),
 ('__sizeof__', <built-in method __sizeof__ of Car object at 0x7f7ecf63a0>),
 ('__str__',
  <bound method Car.__str__ of <libs.car.Car object at 0x7f7ecf63a0>>),
 ('__subclasshook__',
  <built-in method __subclasshook__ of type object at 0x1ac8b380>),
 ('__weakref__', None),
 ('_status',
  {'battery': {'current': 0.0, 'voltage': 98.0},
 'doors_state': None,
 'embedded': None,
 'energy': [{'autonomy': 226.0,
             'battery': None,
             'charging': {'charging_mode': 'Slow',
                          'charging_rate': 6,
                          'next_delayed_time': 'PT22H25M',
                          'plugged': True,
                          'remaining_time': 'PT10H10M',
                          'status': 'InProgress'},
             'consumption': None,
             'level': 65.0,
             'residual': None,
             'type': 'Electric',
             'updated_at': datetime.datetime(2022, 3, 8, 0, 23, 5, tzinfo=tzutc())},
            {'autonomy': None,
             'battery': None,
             'charging': None,
             'consumption': None,
             'level': 0.0,
             'residual': None,
             'type': 'Fuel',
             'updated_at': datetime.datetime(2022, 2, 23, 9, 53, 44, tzinfo=tzutc())}],
 'environment': None,
 'ignition': None,
 'kinetic': {'acceleration': None, 'moving': None, 'pace': None, 'speed': None},
 'last_position': {'geometry': {'coordinates': [None, None, None],
                                'type': 'Point'},
                   'properties': {'heading': None,
                                  'signal_quality': None,
                                  'type': None,
                                  'updated_at': None},
                   'type': 'Feature'},
 'links': {'_self': {'deprecation': None,
                     'href': 'https://api.groupe-psa.com/connectedcar/v4/user/vehicles/1566c4933516b4e61534d54457a4e44516a497a63344d444d774e6a6b334d6d49345a474a6a59324a6c4d54497a4f574e6c4d544979596a4a685a57513459544931595459335a5445354d47593559324a6b596a4d315932526d4d7a566d4e57553459324a6b4f44513d/status',
                     'hreflang': None,
                     'name': None,
                     'profile': None,
                     'templated': None,
                     'title': None,
                     'type': None},
           'vehicle': None},
 'preconditionning': {'air_conditioning': {'failure_cause': None,
                                           'programs': None,
                                           'status': 'Disabled',
                                           'updated_at': datetime.datetime(2022, 3, 8, 0, 23, 6, tzinfo=tzutc())}},
 'privacy': {'state': 'None'},
 'safety': None,
 'service': {'type': 'Electric',
             'updated_at': datetime.datetime(2022, 3, 8, 0, 23, 6, tzinfo=tzutc())},
 'timed_odometer': {'mileage': 1241.7, 'updated_at': None}}),
 ('abrp_name', 'citroen:ec4:21:50'),
 ('battery_power', 46),
 ('brand', 'Citroën'),
 ('from_json', <bound method Car.from_json of <class 'libs.car.Car'>>),
 ('fuel_capacity', 0),
 ('get_abrp_name',
  <bound method Car.get_abrp_name of <libs.car.Car object at 0x7f7ecf63a0>>),
 ('get_charge_speed',
  <bound method Car.get_charge_speed of <libs.car.Car object at 0x7f7ecf63a0>>),
 ('get_status',
  <bound method Car.get_status of <libs.car.Car object at 0x7f7ecf63a0>>),
 ('has_battery',
  <bound method Car.has_battery of <libs.car.Car object at 0x7f7ecf63a0>>),
 ('has_fuel',
  <bound method Car.has_fuel of <libs.car.Car object at 0x7f7ecf63a0>>),
 ('is_electric',
  <bound method Car.is_electric of <libs.car.Car object at 0x7f7ecf63a0>>),
 ('is_hybrid',
  <bound method Car.is_hybrid of <libs.car.Car object at 0x7f7ecf63a0>>),
 ('is_thermal',
  <bound method Car.is_thermal of <libs.car.Car object at 0x7f7ecf63a0>>),
 ('label', 'E-C4'),
 ('max_elec_consumption', 70),
 ('max_fuel_consumption', 0),
 ('set_model_name',
  <bound method Car.set_model_name of <libs.car.Car object at 0x7f7ecf63a0>>),
 ('status',
  {'battery': {'current': 0.0, 'voltage': 98.0},
 'doors_state': None,
 'embedded': None,
 'energy': [{'autonomy': 226.0,
             'battery': None,
             'charging': {'charging_mode': 'Slow',
                          'charging_rate': 6,
                          'next_delayed_time': 'PT22H25M',
                          'plugged': True,
                          'remaining_time': 'PT10H10M',
                          'status': 'InProgress'},
             'consumption': None,
             'level': 65.0,
             'residual': None,
             'type': 'Electric',
             'updated_at': datetime.datetime(2022, 3, 8, 0, 23, 5, tzinfo=tzutc())},
            {'autonomy': None,
             'battery': None,
             'charging': None,
             'consumption': None,
             'level': 0.0,
             'residual': None,
             'type': 'Fuel',
             'updated_at': datetime.datetime(2022, 2, 23, 9, 53, 44, tzinfo=tzutc())}],
 'environment': None,
 'ignition': None,
 'kinetic': {'acceleration': None, 'moving': None, 'pace': None, 'speed': None},
 'last_position': {'geometry': {'coordinates': [None, None, None],
                                'type': 'Point'},
                   'properties': {'heading': None,
                                  'signal_quality': None,
                                  'type': None,
                                  'updated_at': None},
                   'type': 'Feature'},
 'links': {'_self': {'deprecation': None,
                     'href': 'https://api.groupe-psa.com/connectedcar/v4/user/vehicles/1566c4933516b4e61516a497a63344d444d774e6a6b334d6d49345a474a6a59324a6c4d54497a4f574e6c4d544979596a4a685a57513459544931595459335a5445354d47593559324a6b596a4d315932526d4d7a566d4e57553459324a6b4f44513d/status',
                     'hreflang': None,
                     'name': None,
                     'profile': None,
                     'templated': None,
                     'title': None,
                     'type': None},
           'vehicle': None},
 'preconditionning': {'air_conditioning': {'failure_cause': None,
                                           'programs': None,
                                           'status': 'Disabled',
                                           'updated_at': datetime.datetime(2022, 3, 8, 0, 23, 6, tzinfo=tzutc())}},
 'privacy': {'state': 'None'},
 'safety': None,
 'service': {'type': 'Electric',
             'updated_at': datetime.datetime(2022, 3, 8, 0, 23, 6, tzinfo=tzutc())},
 'timed_odometer': {'mileage': 1241.7, 'updated_at': None}}),
 ('to_dict',
  <bound method Car.to_dict of <libs.car.Car object at 0x7f7ecf63a0>>),
 ('vehicle_id',
  '1566c4933516b4e6774d54457a4e44516a497a63344d444d774e6a6b334d6d49345a474a6a59324a6c4d54497a4f574e6c4d544979596a4a685a57513459544931595459335a5445354d47593559324a6b596a4d315932526d4d7a566d4e57553459324a6b4f44513d'),
 ('vin', 'VR7BCZKXxxxxxxxxx')]

any idea? is this PSA's API fault?

flobz commented 2 years ago

if fixed some stuff in last version, is it still an issue ?

nosuchuser commented 2 years ago

did a fresh install on v3.0.3 and this still happens.

pi@pi3:~ $ psa-car-controller -l 192.168.1.211 --web-conf 2022-05-11 17:28:54,933 :: ERROR :: Bad config WARNING: dev bundles requested with serve_locally=False. This is not supported, switching to serve_locally=True 2022-05-11 17:28:58,588 :: INFO :: update_data 2022-05-11 17:30:57,052 :: WARNING :: Requested API level 30 is larger than maximum we have, returning API level 28 instead. 2022-05-11 17:31:42,468 :: INFO :: save config change 2022-05-11 17:31:43,858 :: INFO :: Your vehicles: ["{'vin': 'VR7BCZKXXXXXXXXXX', 'vehicle_id': '1566c4933516b4e6153316844546b55774d54457a4e44516a497a63344d444d774e6a6b334d6d49345a474a6a59324a6c4d54497a4f574e6c4d544979596a4a685a57513459544931595459335a5445354dXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'label': 'E-C4', 'brand': 'Citroën', 'abrp_name': 'citroen:ec4:21:50', 'battery_power': 46, 'fuel_capacity': 0, 'max_elec_consumption': 70, 'max_fuel_consumption': 0}"] 2022-05-11 17:31:43,863 :: INFO :: save config change 2022-05-11 17:31:45,115 :: INFO :: ["{'vin': 'VR7BCZKXXXXXXXXXX', 'vehicle_id': '1566c4933516b4e6153316844546b55774d54457a4e44516a497a63344d444d774e6a6b334d6d49345a474a6a59324a6c4d54497a4f574e6c4d544979596a4a685a57513459544931595459335a5445354dXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'label': 'E-C4', 'brand': 'Citroën', 'abrp_name': 'citroen:ec4:21:50', 'battery_power': 46, 'fuel_capacity': 0, 'max_elec_consumption': 70, 'max_fuel_consumption': 0}"] 2022-05-11 17:31:45,119 :: INFO :: save config change 2022-05-11 17:33:12,458 :: ERROR :: remote_refresh_token isn't defined 2022-05-11 17:33:13,891 :: INFO :: save config change 2022-05-11 17:33:14,124 :: INFO :: ask wakeup to VR7BCZKXXXXXXXXXX 2022-05-11 17:33:14,126 :: INFO :: topic: psa/RemoteServices/from/cid/AC-ACNT200004406926/VehCharge/state: {'action': 'state'} 2022-05-11 17:33:14,286 :: INFO :: Connected with result code {'session present': 0} 2022-05-11 17:33:14,288 :: INFO :: subscribe to psa/RemoteServices/to/cid/AC-ACNT200004406926/# 2022-05-11 17:33:14,289 :: INFO :: subscribe to psa/RemoteServices/events/MPHRTServices/VR7BCZKXXXXXXXXXX 2022-05-11 17:33:14,502 :: INFO :: mqtt msg received: psa/RemoteServices/to/cid/AC-ACNT200004406926/VehCharge/state/ProcessManagement b'{"process_date":"2022-05-11T16:33:14Z","vin":"VR7BCZKXXXXXXXXXX","correlation_id":"20ca3bb702ba4ba59d9de95542e89ec120220XXXXXXXXXXXX","process_code":"900","process_message":"[process.900.request.accepted.key]"}' 2022-05-11 17:33:14,529 :: INFO :: mqtt msg received: psa/RemoteServices/to/cid/AC-ACNT200004406926/VehCharge/state/ProcessManagement b'{"process_date":"2022-05-11T16:33:14Z","vin":"VR7BCZKXXXXXXXXXX","correlation_id":"20ca3bb702ba4ba59d9de95542e89ec120220XXXXXXXXXXXX","process_code":"903","process_message":"[process.903.request.forwarded.to.vehicle.key]"}' 2022-05-11 17:33:16,622 :: INFO :: mqtt msg received: psa/RemoteServices/to/cid/AC-ACNT200004406926/VehCharge/state b'{"resp_date":"2022-05-11T16:33:16Z","vin":"VR7BCZKXXXXXXXXXX","correlation_id":"20ca3bb702ba4ba59d9de95542e89ec120220XXXXXXXXXXXX","return_code":"0"}' 2022-05-11 17:33:16,786 :: WARNING :: Failed to generate figure, there is probably not enough data yet 2022-05-11 17:33:17,224 :: ERROR :: get_control_tabs: Traceback (most recent call last): File "/home/pi/.local/lib/python3.9/site-packages/psa_car_controller/web/view/control.py", line 38, in get_control_tabs preconditionning_state = car.status.preconditionning.air_conditioning.status != "Disabled" AttributeError: 'NoneType' object has no attribute 'preconditionning' 2022-05-11 17:33:20,640 :: INFO :: mqtt msg received: psa/RemoteServices/events/MPHRTServices/VR7BCZKXXXXXXXXXX b'{"date":"2022-05-11T16:33:05Z","etat_res_elec":0,"precond_state":{"available":1,"programs":{"program1":{"hour":34,"minute":7,"on":0,"day":[0,0,0,0,0,0,0]},"program2":{"hour":34,"minute":7,"on":0,"day":[0,0,0,0,0,0,0]},"program3":{"hour":34,"minute":7,"on":0,"day":[0,0,0,0,0,0,0]},"program4":{"hour":34,"minute":7,"on":0,"day":[0,0,0,0,0,0,0]}},"asap":0,"status":0},"charging_state":{"program":{"hour":6,"minute":0},"available":1,"remaining_time":635,"rate":0,"cable_detected":1,"soc_batt":100,"autonomy_zev":344,"type":0,"hmi_state":0,"mode":2},"stolen_state":0,"vin":"VR7BCZKXXXXXXXXXX","reason":4,"signal_quality":4,"sev_stop_date":"2022-05-11T16:11:52Z","fds":["NDR01","NBM01","NCG01","NAO01","NAS01"],"sev_state":0,"obj_counter":24,"privacy_customer":0,"privacy_applicable":0,"privacy_applicable_max":2,"superlock_state":0}' 2022-05-11 17:33:20,642 :: ERROR :: on_mqtt_message: Traceback (most recent call last): File "/home/pi/.local/lib/python3.9/site-packages/psa_car_controller/psa/RemoteClient.py", line 95, in _fix_not_updated_api if car and car.status.get_energy('Electric').charging.status != INPROGRESS: AttributeError: 'NoneType' object has no attribute 'get_energy'

nosuchuser commented 2 years ago

anyway, I changed to the HA version and this no longer is an issue.