Closed atze09 closed 3 years ago
Hello, Can you test to start charging from the API ? MyOpel doesn't work on your smartphone ?
Can you test to start charging from the API ?
What do you mean with start from API?
Yes the android app did not work in the morning but now it works again. but the above mentioned failure does still exist.
Call this url : http://localhost:5000/charge_now/YOURVIN/1
This is the response:
192.168.17.155 - - [15/Mar/2021 11:32:40] "GET /charge_now/VIN/1 HTTP/1.1" 200 - 2021-03-15 11:32:40,823 :: WARNING :: Disconnected with result code 1 2021-03-15 11:32:41,084 :: INFO :: save config change 192.168.17.155 - - [15/Mar/2021 11:32:41] "GET /favicon.ico HTTP/1.1" 200 - 192.168.17.7 - - [15/Mar/2021 11:32:42] "GET /get_vehicleinfo/VIN HTTP/1.1" 200 -
Also an error.
remove otp.bin and retry please.
2021-03-15 14:42:53,665 :: INFO :: {"access_token": "Token", "customer_id": "ID", "correlation_id": "ID", "req_date": "2021-03-15T13:42:53Z", "vin": "VIN", "req_parameters": {"asap": "activate", "programs": {"program1": {"day": [0, 0, 0, 0, 0, 0, 0], "hour": 34, "minute": 7, "on": 0}, "program2": {"day": [0, 0, 0, 0, 0, 0, 0], "hour": 34, "minute": 7, "on": 0}, "program3": {"day": [0, 0, 0, 0, 0, 0, 0], "hour": 34, "minute": 7, "on": 0}, "program4": {"day": [0, 0, 0, 0, 0, 0, 0], "hour": 34, "minute": 7, "on": 0}}}} 192.168.17.7 - - [15/Mar/2021 14:42:53] "GET /preconditioning/VIN/1 HTTP/1.1" 200 - 2021-03-15 14:42:53,709 :: WARNING :: Disconnected with result code 1 2021-03-15 14:42:56,363 :: INFO :: Connected with result code {'session present': 0}
Still the same failure after delete of the file otp.bin
Can you give me the log from the start of rhe app?
Thank you for helping florian!
`pi@raspberrypi:~/psa_car_controller $ python3 server.py -f test.json -c charge_config1.json 2021-03-17 07:32:38,193 :: INFO :: server start 2021-03-17 07:32:40,434 :: INFO :: {'VIN': {'id': 'ID'}} 2021-03-17 07:32:41,301 :: ERROR :: can't refresh_remote_token: {'error': 'invalid_grant', 'error_description': 'grant is invalid'} Create a new one 2021-03-17 07:32:43,695 :: INFO :: ask state to VIN 2021-03-17 07:32:43,924 :: INFO :: Connected with result code {'session present': 0} 2021-03-17 07:32:43,927 :: INFO :: subscribe to psa/RemoteServices/to/cid/OP-ACNT20000xxxxxxx/# 2021-03-17 07:32:43,929 :: INFO :: subscribe to psa/RemoteServices/events/MPHRTServices/VIN 2021-03-17 07:32:44,252 :: INFO :: {"access_token": "access_token", "customer_id": "customer_id", "correlation_id": "correlation_id", "req_date": "2021-03-17T06:32:44Z", "vin": "VIN", "req_parameters": {"action": "state"}} 2021-03-17 07:32:44,287 :: WARNING :: Disconnected with result code 1 2021-03-17 07:32:44,911 :: INFO :: charging status of VINis Disconnected, battery level: 69.0 2021-03-17 07:32:44,919 :: INFO :: save config change 2021-03-17 07:32:46,800 :: INFO :: Connected with result code {'session present': 0} 2021-03-17 07:32:46,803 :: INFO :: subscribe to psa/RemoteServices/to/cid/OP-ACNT20000xxxxxxx/# 2021-03-17 07:32:46,806 :: INFO :: subscribe to psa/RemoteServices/events/MPHRTServices/VIN 2021-03-17 07:32:50,073 :: INFO :: update_data
Please when you ask for help try to give all relevant information, You issue will be resolved quicker and people who help will loose less time.
2021-03-17 07:32:41,301 :: ERROR :: can't refresh_remote_token: {'error': 'invalid_grant', 'error_description': 'grant is invalid'}
Create a new one
2021-03-17 07:32:44,287 :: WARNING :: Disconnected with result code 1
As you can see there is errors at the start of the program. Can you connect a new smartphone to myopel ? If you don't have one, can you delete the data of the app ? Then you should be asked to give your SMS code etc... Then try a remote request like preconditioning. You may have a warning window that appear during these steps.
After that remove otp.bin and restart the server.
Sorry for binding your capacities.
I did it your way with removing the data of the app. but it did not solve the issue.
I also did a completely new setup, with a new git clone, but with same result. What i do not understand is why the other topics are working, i get all the data battery soc and so on, but i cannot do the preconditioning, hm..
I'm having the same issue, using the myOpel app and also for a Corsa-E. Entered the SMS code and entered the app pin code.
Connection seems to be made OK if i look at the log:
2021-03-19 16:46:11,542 :: INFO :: server start
2021-03-19 16:46:13,302 :: INFO :: {'VIN': {'id': 'VINID'}}
2021-03-19 16:46:13,950 :: INFO :: ask state to VIN
2021-03-19 16:46:14,242 :: INFO :: {"access_token": "ACCESSTOKEN", "customer_id": "CUSTOMERID", "correlation_id": "CORRELATIONID", "req_date": "2021-03-19T15:46:14Z", "vin": "VIN", "req_parameters": {"action": "state"}}
2021-03-19 16:46:14,357 :: INFO :: Connected with result code {'session present': 0}
2021-03-19 16:46:14,358 :: INFO :: subscribe to psa/RemoteServices/to/cid/ID/#
2021-03-19 16:46:14,359 :: INFO :: subscribe to psa/RemoteServices/events/MPHRTServices/VIN
2021-03-19 16:46:14,360 :: WARNING :: Disconnected with result code 1
2021-03-19 16:46:14,632 :: INFO :: new position recorded for VIN
2021-03-19 16:46:14,651 :: INFO :: charging status of VIN is Disconnected, battery level: 81.0
2021-03-19 16:46:14,653 :: INFO :: save config change
2021-03-19 16:46:15,436 :: INFO :: update_data
* Running on http://IP:5000/ (Press CTRL+C to quit)
2021-03-19 16:46:16,267 :: INFO :: Connected with result code {'session present': 0}
2021-03-19 16:46:16,268 :: INFO :: subscribe to psa/RemoteServices/to/cid/ID/#
2021-03-19 16:46:16,269 :: INFO :: subscribe to psa/RemoteServices/events/MPHRTServices/VIN
2021-03-19 16:46:57,435 :: INFO :: update_data
2021-03-19 16:46:57,446 :: INFO :: new position recorded for VIN
192.168.188.160 - - [19/Mar/2021 16:46:57] "GET /get_vehicleinfo/VIN HTTP/1.1" 200 -
When triggering this URL: http://IP:5000/preconditioning/VIN/1
I get this in the logging:
2021-03-19 16:53:03,299 :: INFO :: {"access_token": "ACCESSTOKEN", "customer_id": "CUSTOMERID", "correlation_id": "CORRELATIONID", "req_date": "2021-03-19T15:53:03Z", "vin": "VIN", "req_parameters": {"asap": "activate", "programs": {"program1": {"day": [0, 0, 0, 0, 0, 0, 0], "hour": 34, "minute": 7, "on": 0}, "program2": {"day": [0, 0, 0, 0, 0, 0, 0], "hour": 34, "minute": 7, "on": 0}, "program3": {"day": [0, 0, 0, 0, 0, 0, 0], "hour": 34, "minute": 7, "on": 0}, "program4": {"day": [0, 0, 0, 0, 0, 0, 0], "hour": 34, "minute": 7, "on": 0}}}}
192.168.188.143 - - [19/Mar/2021 16:53:03] "GET /preconditioning/VIN/1 HTTP/1.1" 200 -
2021-03-19 16:53:03,320 :: WARNING :: Disconnected with result code 1
192.168.188.143 - - [19/Mar/2021 16:53:04] "GET /favicon.ico HTTP/1.1" 200 -
2021-03-19 16:53:05,188 :: INFO :: Connected with result code {'session present': 0}
2021-03-19 16:53:05,189 :: INFO :: subscribe to psa/RemoteServices/to/cid/ID/#
2021-03-19 16:53:05,189 :: INFO :: subscribe to psa/RemoteServices/events/MPHRTServices/VIN
2021-03-19 16:53:14,666 :: INFO :: save config change
Seems to be related to Opel, @langepil do you have the same problem ?
@iamrellah connection isn't ok :
2021-03-19 16:46:14,360 :: WARNING :: Disconnected with result code 1
@flobz thanks for the quick reply, first of all thank you for all the work put into this. Really awesome. I'm using this to add the information into my Home-assistant.
Is it expected that the other commands work when the warning is given? I do get correct results when accessing this URL: http://IP:5000/get_vehicleinfo/VIN
// 20210319184544
// http://IP:5000/get_vehicleinfo/VIN
{
"embedded": null,
"links": {
"_self": {
"deprecation": null,
"href": "xxxx",
"hreflang": null,
"name": null,
"profile": null,
"templated": null,
"title": null,
"type": null
},
"vehicle": null
},
"battery": {
"current": 0.0,
"voltage": 91.0
},
"doors_state": null,
"energy": [
{
"updated_at": "2021-03-19 17:32:13+00:00",
"autonomy": 186.0,
"battery": null,
"charging": {
"charging_mode": "No",
"charging_rate": 0,
"next_delayed_time": "PT0S",
"plugged": false,
"remaining_time": "PT0S",
"status": "Disconnected"
},
"consumption": null,
"level": 74.0,
"residual": null,
"type": "Electric"
}
],
"environment": null,
"ignition": null,
"kinetic": {
"acceleration": null,
"moving": false,
"pace": null,
"speed": null
},
"last_position": {
"type": "Feature",
"geometry": {
"coordinates": [ LONG,LANG
],
"type": "Point"
},
"properties": {
"heading": null,
"signal_quality": null,
"type": "Aquire",
"updated_at": "2021-03-19 17:32:18+00:00"
}
},
"preconditionning": {
"air_conditioning": {
"failure_cause": null,
"programs": null,
"status": "Disabled",
"updated_at": "2021-03-19 17:32:13+00:00"
}
},
"privacy": {
"state": "None"
},
"safety": null,
"service": {
"type": "Electric",
"updated_at": "2021-03-14 20:20:26+00:00"
},
"timed_odometer": {
"updated_at": null,
"mileage": 5186.5
}
}
@flobz thanks for the quick reply, first of all thank you for all the work put into this. Really awesome. I'm using this to add the information into my Home-assistant.
Is it expected that the other commands work when the warning is given? I do get correct results when accessing this URL: http://IP:5000/get_vehicleinfo/VIN
This is exact the problem I am facing. I also use this to get the information into home assistant.
If one of you can't describe the procedure with some pictures to connect Home Assistant to my tools, it would help a lot of people.
Yes the android app did not work in the morning but now it works again. but the above mentioned failure does still exist.
Maybe something change on the opel server. Do you know if myopel app was updated on your smartphone ? That would explain why it wasn't working in the morning but work after...
If one of you can't describe the procedure with some pictures to connect Home Assistant to my tools, it would help a lot of people.
Home-assistant just uses a HTTP request to the server URL,for example: http://ip:5000/preconditioning/VIN/1 Requesting the URL in a browser results in the same error in the logs. I assume it might then be related to the opel servers as you mentioned above. I’ll try to do some trial and error on my side as well.
Yes I know it's not complicate, but for some people it is. So a little doc to explain with pictures how to add a button, and add the url to be called could be helpful for them.
Do you receive any MQTT messages? For example start the server and charge the vehicle. You should see it in the log.
I currently have it set up like this in my configuration.yaml. This loads in the REST api which Home-assistant uses.
rest:
resource: http://IP:5000/get_vehicleinfo/VIN
scan_interval: 180
sensor:
- name: car_corsa_energy
json_attributes_path: "$.energy[0]"
json_attributes:
- level
- autonomy
- updated_at
value_template: '{{ value_json.energy[0].level }}'
- name: car_corsa_battery
json_attributes_path: "$.battery"
json_attributes:
- current
- voltage
value_template: '{{ value_json.battery.current }}'
- name: car_corsa_charging
json_attributes_path: "$.energy[0].charging"
json_attributes:
- charging_rate
- charging_mode
- plugged
- status
value_template: '{{ value_json.energy[0].charging.status }}'
- name: car_corsa_mapdata
json_attributes_path: "$.last_position.geometry"
json_attributes:
- coordinates
value_template: '{{ value_json.last_position.geometry.coordinates[2] }}'
I've also added this in the configuration.yaml to get the sensors based on that REST output
sensor:
- platform: template
sensors:
energy_level:
friendly_name: 'Battery Level'
value_template: "{{ state_attr('sensor.car_corsa_energy', 'level') }}"
unit_of_measurement: '%'
energy_autonomy:
friendly_name: 'Range'
value_template: "{{ state_attr('sensor.car_corsa_energy', 'autonomy') }}"
unit_of_measurement: 'km'
battery_current:
friendly_name: 'Battery Current'
value_template: "{{ state_attr('sensor.car_corsa_battery', 'current') }}"
battery_voltage:
friendly_name: 'Battery Voltage'
value_template: "{{ state_attr('sensor.car_corsa_battery', 'voltage') }}"
unit_of_measurement: '%'
charging_charging_rate:
friendly_name: 'Charge Rate'
value_template: "{{ state_attr('sensor.car_corsa_charging', 'charging_rate') }}"
charging_charging_rate_kw:
friendly_name: 'Charge Rate kW'
value_template: "{{ state_attr('sensor.car_corsa_charging', 'charging_rate') * 0.29 }}"
unit_of_measurement: 'kW'
charging_charging_mode:
friendly_name: 'Charging Mode'
value_template: "{{ state_attr('sensor.car_corsa_charging', 'charging_mode') }}"
charging_plugged:
friendly_name: 'Charger Plugged In'
value_template: "{{ state_attr('sensor.car_corsa_charging', 'plugged') }}"
charging_status:
friendly_name: 'Charge Status'
value_template: "{{ state_attr('sensor.car_corsa_charging', 'status') }}"
Which is then shown as this on my Dashboard.
Eventually i would want to use these REST commands to trigger the preconditioning to turn on or off. This should also make it possible to trigger these from the Google Assistant or Alexa for example. Eventually i would want to fine tune this to also show the status of the preconditioning in Home-assistant but haven't gotten to that just yet. This is also added to the configuration.yaml.
rest_command:
start_preconditioning:
url: "http://IP:5000/preconditioning/VIN/1"
stop_preconditioning:
url: "http://IP:5000/preconditioning/VIN/0"
I've also checked my logs and i do see MQTT messages being send:
2021-03-19 16:37:04,337 :: INFO :: mqtt msg psa/RemoteServices/events/MPHRTServices/VIN b'{"date":"2021-03-19T15:36:55Z","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":1,"status":1,"aff":1},"charging_state":{"program":{"hour":0,"minute":0},"available":1,"remaining_time":0,"rate":0,"cable_detected":1,"soc_batt":88,"autonomy_zev":214,"type":0,"aff":1,"hmi_state":0,"mode":2},"stolen_state":0,"vin":"VIN","reason":3,"signal_quality":2,"sev_stop_date":"2021-03-19T11:12:37Z","location":{"dop":{"h":99.989998,"p":99.989998,"v":99.989998,"valid_h":false,"valid_p":false,"valid_v":false},"dr":{"heading":xxx,"latitude":xxxx,"longitude":xxx,"speed":0,"valid_hdg":true,"valid_lat":true,"valid_lng":true,"valid_spd":true},"gnss":{"altitude":0,"error_altitude":-1,"error_h_position":0,"error_v_speed":-1,"fix_status":0,"heading":0,"latitude":0,"longitude":0,"speed":0,"timestamp":"2016-01-01T00:00:00Z","valid_alt":false,"valid_err_alt":false,"valid_err_hps":false,"valid_err_spd":false,"valid_hdg":false,"valid_lat":false,"valid_lng":false,"valid_spd":false},"satellites":{"tracked":8,"used":0,"valid_trk":false,"valid_usd":false,"valid_vis":false,"visible":27}},"fds":["NDR01","NBM01","NCG01","NAO01","NAS01"],"sev_state":0,"timestamp_gnss":1616152364,"obj_counter":4,"privacy_customer":0,"privacy_applicable":0,"privacy_applicable_max":2,"superlock_state":0}'
Thanks for your home assistant config.
Concerning mqtt problem, I can't help you because it seems to be related to opel car....
Same issue here. Not using home assistant though.
SMS code was entered correctly and i tried removed otp.bin and reenter another code in case of. Doesn't help.
here are the logs :
(.venv) psa_remote@packer-debian-10-amd64:~/server$ python server.py -f ~/config.json -c ~/charge_config.json -r -l 0.0.0.0
2021-05-02 18:00:59,633 :: INFO :: server start
2021-05-02 18:01:00,431 :: INFO :: save config change
2021-05-02 18:01:01,353 :: INFO :: ["{'vin': 'VXKUHZKXZMxxxxxxxx', 'vehicle_id': 'zzzzzzzzzzzzzzz', 'label': 'corsa-e', 'brand':
'C', 'abrp_name': 'opel:corsae:20:50', 'battery_power': 46, 'fuel_capacity': 0, 'max_elec_consumption': 70, 'max_fuel_consumption': 0}"]
2021-05-02 18:01:01,962 :: INFO :: save config change
2021-05-02 18:01:02,780 :: INFO :: ask state to VXKUHZKXZMxxxxxxxx
2021-05-02 18:01:03,011 :: INFO :: Connected with result code {'session present': 0}
2021-05-02 18:01:03,013 :: INFO :: subscribe to psa/RemoteServices/to/cid/OP-ACNT20000779999999/#
2021-05-02 18:01:03,014 :: INFO :: subscribe to psa/RemoteServices/events/MPHRTServices/VXKUHZKXZMxxxxxxxx
2021-05-02 18:01:03,501 :: INFO :: save config change
2021-05-02 18:01:03,502 :: INFO :: {"access_token": "6366437c-43c1-46bb-8452-e1dee580db2c", "customer_id": "OP-ACNT2000079999999", "correlation_id": "adef279f12864b6c8b8f
782fe4252ea920990502180103502", "req_date": "2021-05-02T18:01:03Z", "vin": "VXKUHZKXZMxxxxxxxx", "req_parameters": {"action": "state"}}
** 2021-05-02 18:01:03,559 :: WARNING :: Disconnected with result code 1 **
2021-05-02 18:01:03,879 :: INFO :: update_data
**2021-05-02 18:01:03,882 :: WARNING :: Failed to generate figure, there is probably not enough data yet**
* Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
2021-05-02 18:01:04,114 :: INFO :: save config change
2021-05-02 18:01:06,262 :: INFO :: Connected with result code {'session present': 0}
2021-05-02 18:01:06,264 :: INFO :: subscribe to psa/RemoteServices/to/cid/OP-ACNT9999999950/# 2021-05-02 18:01:06,265 :: INFO :: subscribe to psa/RemoteServices/events/MPHRTServices/VXKUHZKXZMxxxxxxxx
Tell me if you need anything more to trace it
Interested in knowing if this is related to the Corsa or all Opel cars. Anyone reading this has another car then the Corsa?
I've tried a new OTP file and fresh install but the issue remains the same. Seems that the initial "handshake" after the connection/subscribe is made the warning message is shown "disconnected with result code 1"
~/psa_car_controller$ python3 server.py -f test.json -c charge_config1.json -l IP
2021-05-03 19:09:20,264 :: INFO :: server start
2021-05-03 19:09:20,565 :: INFO :: save config change
2021-05-03 19:09:21,166 :: INFO :: ["{'vin': 'VIN', 'vehicle_id': 'ID', 'label': 'corsa-e', 'brand': 'C', 'abrp_name': 'opel:corsae:20:50', 'battery_power': 46, 'fuel_capacity': 0, 'max_elec_consumption': 70, 'max_fuel_consumption': 0}"]
What is the code you just received by SMS ?
What is your app pin code ?
2021-05-03 19:09:46,995 :: INFO :: save config change
2021-05-03 19:09:47,354 :: INFO :: ask state to VIN
2021-05-03 19:09:47,552 :: INFO :: Connected with result code {'session present': 0}
2021-05-03 19:09:47,553 :: INFO :: subscribe to psa/RemoteServices/to/cid/ID/#
2021-05-03 19:09:47,554 :: INFO :: subscribe to psa/RemoteServices/events/MPHRTServices/VIN
2021-05-03 19:09:47,611 :: INFO :: save config change
2021-05-03 19:09:47,612 :: INFO :: {"access_token": "ID", "customer_id": "ID", "correlation_id": "ID", "req_date": "2021-05-03T17:09:47Z", "vin": "VIN", "req_parameters": {"action": "state"}}
2021-05-03 19:09:47,636 :: WARNING :: Disconnected with result code 1
2021-05-03 19:09:47,889 :: INFO :: save config change
2021-05-03 19:09:48,502 :: INFO :: update_data
2021-05-03 19:09:48,506 :: WARNING :: Failed to generate figure, there is probably not enough data yet
* Running on http://IP:5000/ (Press CTRL+C to quit)
2021-05-03 19:09:49,467 :: INFO :: Connected with result code {'session present': 0}
2021-05-03 19:09:49,468 :: INFO :: subscribe to psa/RemoteServices/to/cid/ID/#
2021-05-03 19:09:49,469 :: INFO :: subscribe to psa/RemoteServices/events/MPHRTServices/VIN
192.168.188.37 - - [03/May/2021 19:10:09] "GET /get_vehicleinfo/VIN HTTP/1.1" 200 -
192.168.188.37 - - [03/May/2021 19:10:10] "GET /favicon.ico HTTP/1.1" 200 -
2021-05-03 19:11:48,094 :: INFO :: charging status of VIN is Disconnected, battery level: 97
2021-05-03 19:13:48,502 :: INFO :: charging status of VIN is Disconnected, battery level: 97
I do have the same issue on my DS.
` 2021-05-05 08:55:44,027 :: INFO :: ask state to VIN 2021-05-05 08:55:44,151 :: INFO :: Connected with result code {'session present': 0} 2021-05-05 08:55:44,152 :: INFO :: subscribe to psa/RemoteServices/to/cid/DS-ACNTXXXX/# 2021-05-05 08:55:44,153 :: INFO :: subscribe to psa/RemoteServices/events/MPHRTServices/VIN 2021-05-05 08:55:44,401 :: INFO :: save config change 2021-05-05 08:55:44,402 :: INFO :: {"access_token": "TOKEN", "customer_id": "DS-ACNTXXXX", "correlation_id": "ID", "req_date": "2021-05-05T06:55:44Z", "vin": "VIN", "req_parameters": {"action": "state"}} 2021-05-05 08:55:44,451 :: WARNING :: Disconnected with result code 1 2021-05-05 08:55:45,367 :: INFO :: update_data 2021-05-05 08:55:45,372 :: WARNING :: Failed to generate figure, there is probably not enough data yet
Some new ideas to find a solution : You can try an other mqtt version by changing it in my_psacc.py. Also Wireshark might help.
I have added the possibility to enable mqtt client debug with a0fcba1. To use it you need to set an environment variable:
export MQTT_LOG="1"
Then start server.py with debug enabled (-d options)? It hope it will help to find the problem.
@flobz thank you for your support in this. I've pulled your new code and added the variable. Here is my output:
Starting the server:
user@linuxpuck:~/psa_car_controller$ python3 server.py -f test.json -c charge_config1.json -l IP -d
2021-05-10 17:55:20,297 :: INFO :: server start
2021-05-10 17:55:20,587 :: INFO :: save config change
2021-05-10 17:55:21,270 :: INFO :: ["{'vin': 'VIN', 'vehicle_id': 'ID', 'label': 'corsa-e', 'brand': 'C', 'abrp_name': 'opel:corsae:20:50', 'battery_power': 46, 'fuel_capacity': 0, 'max_elec_consumption': 70, 'max_fuel_consumption': 0}"]
2021-05-10 17:55:21,537 :: INFO :: save config change
2021-05-10 17:55:21,802 :: DEBUG :: refresh_remote_token: {'scope': 'psaCustomerId psaMqttService', 'expires_in': 899, 'token_type': 'Bearer', 'access_token': 'TOKEN', 'refresh_token': 'TOKEN'}
2021-05-10 17:55:21,872 :: DEBUG :: Sending CONNECT (u1, p1, wr0, wq0, wf0, c1, k60) client_id=b''
2021-05-10 17:55:21,873 :: INFO :: ask state to VIN
2021-05-10 17:55:22,058 :: DEBUG :: Received CONNACK (0, 0)
2021-05-10 17:55:22,058 :: INFO :: Connected with result code {'session present': 0}
2021-05-10 17:55:22,059 :: DEBUG :: Sending SUBSCRIBE (d0, m1) [(b'psa/RemoteServices/to/cid/ID/#', 0)]
2021-05-10 17:55:22,059 :: INFO :: subscribe to psa/RemoteServices/to/cid/ID/#
2021-05-10 17:55:22,060 :: DEBUG :: Sending SUBSCRIBE (d0, m2) [(b'psa/RemoteServices/events/MPHRTServices/VIN', 0)]
2021-05-10 17:55:22,060 :: INFO :: subscribe to psa/RemoteServices/events/MPHRTServices/VIN
2021-05-10 17:55:22,081 :: DEBUG :: Received SUBACK
2021-05-10 17:55:22,100 :: DEBUG :: Received SUBACK
2021-05-10 17:55:22,128 :: INFO :: save config change
2021-05-10 17:55:22,128 :: INFO :: {"access_token": "TOKEN", "customer_id": "ID", "correlation_id": "ID2", "req_date": "2021-05-10T15:55:22Z", "vin": "VIN", "req_parameters": {"action": "state"}}
2021-05-10 17:55:22,129 :: DEBUG :: Sending PUBLISH (d0, q0, r0, m3), 'b'psa/RemoteServices/from/cid/ID/VehicleState'', ... (268 bytes)
**2021-05-10 17:55:22,155 :: WARNING :: Disconnected with result code 1**
2021-05-10 17:55:22,401 :: INFO :: save config change
2021-05-10 17:55:23,037 :: INFO :: update_data
2021-05-10 17:55:23,040 :: DEBUG :: No trips yet
2021-05-10 17:55:23,040 :: DEBUG :: No chargings yet
2021-05-10 17:55:23,042 :: DEBUG :: Create new layout
2021-05-10 17:55:23,042 :: WARNING :: Failed to generate figure, there is probably not enough data yet
Traceback (most recent call last):
File "/home/user/psa_car_controller/web/views.py", line 331, in serve_layout
figures.get_figures(trips, chargings)
NameError: name 'trips' is not defined
* Running on http://IP:PORT/ (Press CTRL+C to quit)
2021-05-10 17:55:23,693 :: DEBUG :: refresh_remote_token: {'scope': 'psaCustomerId psaMqttService', 'expires_in': 899, 'token_type': 'Bearer', 'access_token': 'TOKEN', 'refresh_token': 'TOKEN2'}
2021-05-10 17:55:24,765 :: DEBUG :: Sending CONNECT (u1, p1, wr0, wq0, wf0, c1, k60) client_id=b''
2021-05-10 17:55:24,941 :: DEBUG :: Received CONNACK (0, 0)
2021-05-10 17:55:24,941 :: INFO :: Connected with result code {'session present': 0}
2021-05-10 17:55:24,942 :: DEBUG :: Sending SUBSCRIBE (d0, m4) [(b'psa/RemoteServices/to/cid/ID/#', 0)]
2021-05-10 17:55:24,942 :: INFO :: subscribe to psa/RemoteServices/to/cid/ID/#
2021-05-10 17:55:24,942 :: DEBUG :: Sending SUBSCRIBE (d0, m5) [(b'psa/RemoteServices/events/MPHRTServices/VIN', 0)]
2021-05-10 17:55:24,943 :: INFO :: subscribe to psa/RemoteServices/events/MPHRTServices/VIN
2021-05-10 17:55:24,968 :: DEBUG :: Received SUBACK
2021-05-10 17:55:24,984 :: DEBUG :: Received SUBACK
Accessing: http://IP:5000/preconditioning/VIN/1:
2021-05-10 18:18:41,693 :: INFO :: ask state to VIN
2021-05-10 18:18:41,951 :: INFO :: save config change
2021-05-10 18:18:41,951 :: INFO :: {"access_token": "TOKEN", "customer_id": "ID", "correlation_id": "ID", "req_date": "2021-05-10T16:18:41Z", "vin": "VIN", "req_parameters": {"action": "state"}}
2021-05-10 18:18:41,952 :: DEBUG :: Sending PUBLISH (d0, q0, r0, m18), 'b'psa/RemoteServices/from/cid/ID/VehicleState'', ... (268 bytes)
2021-05-10 18:18:41,973 :: WARNING :: Disconnected with result code 1
2021-05-10 18:18:42,237 :: INFO :: save config change
2021-05-10 18:18:42,521 :: DEBUG :: refresh_remote_token: {'scope': 'psaCustomerId psaMqttService', 'expires_in': 899, 'token_type': 'Bearer', 'access_token': 'TOKEN', 'refresh_token': 'TOKEN'}
2021-05-10 18:18:43,594 :: DEBUG :: Sending CONNECT (u1, p1, wr0, wq0, wf0, c1, k60) client_id=b''
2021-05-10 18:18:43,748 :: DEBUG :: Received CONNACK (0, 0)
2021-05-10 18:18:43,749 :: INFO :: Connected with result code {'session present': 0}
2021-05-10 18:18:43,749 :: DEBUG :: Sending SUBSCRIBE (d0, m19) [(b'psa/RemoteServices/to/cid/ID/#', 0)]
2021-05-10 18:18:43,750 :: INFO :: subscribe to psa/RemoteServices/to/cid/ID/#
2021-05-10 18:18:43,750 :: DEBUG :: Sending SUBSCRIBE (d0, m20) [(b'psa/RemoteServices/events/MPHRTServices/VIN', 0)]
2021-05-10 18:18:43,751 :: INFO :: subscribe to psa/RemoteServices/events/MPHRTServices/VIN
2021-05-10 18:18:43,772 :: DEBUG :: Received SUBACK
2021-05-10 18:18:43,792 :: DEBUG :: Received SUBACK
2021-05-10 18:18:44,239 :: INFO :: save config change
2021-05-10 18:18:44,240 :: INFO :: {"access_token": "TOKEN", "customer_id": "ID", "correlation_id": "ID", "req_date": "2021-05-10T16:18:44Z", "vin": "VIN", "req_parameters": {"asap": "activate", "programs": {"program1": {"day": [0, 0, 0, 0, 0, 0, 0], "hour": 34, "minute": 7, "on": 0}, "program2": {"day": [0, 0, 0, 0, 0, 0, 0], "hour": 34, "minute": 7, "on": 0}, "program3": {"day": [0, 0, 0, 0, 0, 0, 0], "hour": 34, "minute": 7, "on": 0}, "program4": {"day": [0, 0, 0, 0, 0, 0, 0], "hour": 34, "minute": 7, "on": 0}}}}
2021-05-10 18:18:44,240 :: DEBUG :: Sending PUBLISH (d0, q0, r0, m21), 'b'psa/RemoteServices/from/cid/ID/ThermalPrecond'', ... (595 bytes)
192.168.188.37 - - [10/May/2021 18:18:44] "GET /preconditioning/VIN/1 HTTP/1.1" 200 -
2021-05-10 18:18:44,263 :: WARNING :: Disconnected with result code 1
2021-05-10 18:18:44,516 :: INFO :: save config change
2021-05-10 18:18:44,803 :: DEBUG :: refresh_remote_token: {'scope': 'psaCustomerId psaMqttService', 'expires_in': 899, 'token_type': 'Bearer', 'access_token': 'ID', 'refresh_token': 'TOKEN'}
2021-05-10 18:18:45,876 :: DEBUG :: Sending CONNECT (u1, p1, wr0, wq0, wf0, c1, k60) client_id=b''
192.168.188.37 - - [10/May/2021 18:18:45] "GET /favicon.ico HTTP/1.1" 200 -
2021-05-10 18:18:46,058 :: DEBUG :: Received CONNACK (0, 0)
2021-05-10 18:18:46,059 :: INFO :: Connected with result code {'session present': 0}
2021-05-10 18:18:46,059 :: DEBUG :: Sending SUBSCRIBE (d0, m22) [(b'psa/RemoteServices/to/cid/ID/#', 0)]
2021-05-10 18:18:46,060 :: INFO :: subscribe to psa/RemoteServices/to/cid/ID/#
2021-05-10 18:18:46,060 :: DEBUG :: Sending SUBSCRIBE (d0, m23) [(b'psa/RemoteServices/events/MPHRTServices/VIN', 0)]
2021-05-10 18:18:46,060 :: INFO :: subscribe to psa/RemoteServices/events/MPHRTServices/VIN
2021-05-10 18:18:46,082 :: DEBUG :: Received SUBACK
2021-05-10 18:18:46,105 :: DEBUG :: Received SUBACK
Sending PUBLISH (d0, q0, r0, m18), 'b'psa/RemoteServices/from/cid/ID/VehicleState'', ... (268 bytes) 2021-05-10 18:18:41,973 :: WARNING :: Disconnected with result code 1
it doesn't help much.
I have the same issue on my Corsa-e.
As suggested before, I tried to change the MQTT version in my_psacc.py from 3.1.1 to 3.1. This made it even worse, was not able to connect anymore (error code 5).
I have checked it with Wireshark: As soon as the publish is sent to the server, the connection is closed by the server without answering anything before. Any hint how to intercept the MQTT/TLS connection from the MyOpel App on my smartphone to check what is different there?
Any hint how to intercept the MQTT/TLS connection from the MyOpel App on my smartphone to check what is different there?
What I did was :
Thanks, to use a rooted phone so I can import it in the system CA store was the key!
I belief I have found the cause: The customer id has to start with OV and not OP. Changing it in the json config file seems to do the trick!
I had a look at the app_decoder.py and tried changing the brand_code from OP to OV, but that isn't right. Looks like the customer_id is the only thing where it must be OV instead of OP...
@hurzhurz, did this solve this issue?
WARNING :: Disconnected with result code 1
@hurzhurz good job! I remember that if find OV in myopel source code. But it doesn't work to use this code in app_decoder.py So to sum up :
Do I understand correctly?
@fn87 Yep, it does... at least for me. Though I don't know how your customer_id has to start with for DS...
@flobz Yes, as far as I understood it myself, that's correct.
If I remember well it's OV also. I will check and fix this problem. Thanks for the help
OV didn't fix my DS unfortunately. I'll see if I can check my MQTT messages.
@fn87 Can you try "AC"?
I have looked in the MyOpel App source and found this:
public enum SABrand {
PEUGEOT("AP"),
CITROEN("AC"),
DS("AC"),
OPEL("OV"),
VAUXHALL("OV");
BINGO! Works!
Hello at all,
Wanted to test it once again with my Opel corsa-e with the updated Version ob flobz server, but got this issue: `pi@raspberrypi:~/psa_car_controller $ python3 app_decoder.py myOpel-1.27.1.apk APK loading... Requested API level 29 is larger than maximum we have, returning API level 28 instead. APK loaded ! MyOpel email: myemail MyOpel password: What is your country code ? (ex: FR, GB, DE, ES...) DE
Your vehicles: ["{'vin': 'VIN', 'vehicle_id': '1ID', 'label': 'corsa-e', 'brand': 'C', 'abrp_name': 'opel:corsae:20:50', 'battery_power': 46, 'fuel_capacity': 0, 'max_elec_consumption': 70, 'max_fuel_consumption': 0}"]
Warning: Can't get car model please check cars.json
Traceback (most recent call last):
File "app_decoder.py", line 135, in
Did anyone face the same issue
I can also confirm that changing the customer id to start with OV instead of OP for the Opel Corsa-E resolved the issue. Thanks all, will continue testing 😃
Hello at all,
Wanted to test it once again with my Opel corsa-e with the updated Version ob flobz server, but got this issue: `pi@raspberrypi:~/psa_car_controller $ python3 app_decoder.py myOpel-1.27.1.apk APK loading... Requested API level 29 is larger than maximum we have, returning API level 28 instead. APK loaded ! MyOpel email: myemail MyOpel password: What is your country code ? (ex: FR, GB, DE, ES...) DE
Your vehicles: ["{'vin': 'VIN', 'vehicle_id': '1ID', 'label': 'corsa-e', 'brand': 'C', 'abrp_name': 'opel:corsae:20:50', 'battery_power': 46, 'fuel_capacity': 0, 'max_elec_consumption': 70, 'max_fuel_consumption': 0}"] Warning: Can't get car model please check cars.json Traceback (most recent call last): File "app_decoder.py", line 135, in if "short_label" in vehicle and car.label == "unknown": AttributeError: 'NoneType' object has no attribute 'label' `
Did anyone face the same issue
https://github.com/flobz/psa_car_controller/issues/125
Please keep on topic or create a new ticket.
Ok I fixed the code : fd320a64a6db683f2019dfd7ad9287c619bb36d1
Can someone confirm that it works ? For one people at least it still doesn't work #136.
@flobz i'm the one that also reported #136. I had this (#48) working but after needing to restart my pc I ran into the reported issue in #136.
Describe the bug Preconditioning not working
To Reproduce Steps to reproduce the behavior:
Config file
{ "client_id": "ID", "client_secret": "secret", "customer_id": "ID", "proxies": { "http": "", "https": "" }, "realm": "clientsB2COpel", "refresh_token": "token", "remote_refresh_token": "token", "weather_api": null }
Environment (please complete the following information):
Additional context Failure code:
2021-03-15 07:07:25,983 :: INFO :: {"access_token": "TOKEN", "customer_id": "ID", "correlation_id": "ID", "req_date": "2021-03-15T06:07:25Z", "vin": "FIN", "req_parameters": {"asap": "activate", "programs": {"program1": {"day": [0, 0, 0, 0, 0, 0, 0], "hour": 34, "minute": 7, "on": 0}, "program2": {"day": [0, 0, 0, 0, 0, 0, 0], "hour": 34, "minute": 7, "on": 0}, "program3": {"day": [0, 0, 0, 0, 0, 0, 0], "hour": 34, "minute": 7, "on": 0}, "program4": {"day": [0, 0, 0, 0, 0, 0, 0], "hour": 34, "minute": 7, "on": 0}}}} 192.168.17.102 - - [15/Mar/2021 07:07:25] "GET /preconditioning/FIN/1 HTTP/1.1" 200 - 2021-03-15 07:07:26,037 :: WARNING :: Disconnected with result code 1 192.168.17.102 - - [15/Mar/2021 07:07:26] "GET /favicon.ico HTTP/1.1" 200 -