evcc icon indicating copy to clipboard operation
evcc copied to clipboard

Porsche: api broken

Open Mestro82 opened this issue 1 year ago • 15 comments

Describe the bug

Seit kurzem kann ich bei einem Bekannten nicht mehr die Infos aus dem Porsche Portal anzeigen. Hat es vll mit dem Screenshot zu tun?

Steps to reproduce

  1. Status Fahrzeug zeigt keine Information mehr IMG_6398 an

...

Configuration details

vehicles:
  - name: my_car
    type: template
    template: porsche
    title: # Wird in der Benutzeroberfläche angezeigt (optional)
    user: # Benutzerkonto (bspw. E-Mail Adresse, User Id, etc.)
    password: # Passwort des Benutzerkontos (bei führenden Nullen bitte in einfache Hochkommata setzen)
    vin: W... # Erforderlich, wenn mehrere Fahrzeuge des Herstellers vorhanden sind (optional)
    capacity: 50 # Akkukapazität in kWh (optional)

Log details

pi@raspi:~ $ evcc vehicle
[main  ] INFO 2024/06/14 21:58:29 evcc 0.126.4
[main  ] INFO 2024/06/14 21:58:29 using config file: /etc/evcc.yaml
[main  ] ERROR 2024/06/14 21:58:31 creating vehicle my_car failed: cannot create vehicle type 'template': cannot create vehicle type 'porsche': unexpected status: 403 (Forbidden)
.Soc:     vehicle not available: cannot create vehicle type 'template': cannot create vehicle type 'porsche': unexpected status: 403 (Forbidden)
Capacity: 93.0kWh
Features: [Offline Retryable]

What type of operating system are you running?

Linux

Version

0.126.4

Mestro82 avatar Jun 14 '24 20:06 Mestro82

Bei mir klappt es seit ein paar Tagen auch nicht mehr. Heute ein paar Mal das Captcha im Browser machen müssen bevor ich mich wieder ohne einloggen konnte. EVCC neu gestartet, aber (noch) klappt es nicht.

NoMoreInfo avatar Jun 15 '24 10:06 NoMoreInfo

Bei mir ist auch keine Verbindung mehr möglich: [main ] ERROR 2024/06/15 14:27:42 creating vehicle taycan2 failed: cannot create vehicle type 'template': cannot create vehicle type 'porsche': unexpected status: 403 (Forbidden).

Version 0.127.1

psattl avatar Jun 15 '24 12:06 psattl

Porsche gehört ja auch irgendwie zu VW - und die haben ihr System umgestellt. War beim Skoda Enyaq auch so - und hier wurde es beim Update Donnerstag/Freitag behoben. Denke, dass es bei Porsche dann auch ein solches Problem wird und mit einem der nächsten Updates behoben werden kann.

AndaleR avatar Jun 15 '24 13:06 AndaleR

Habe dasselbe Problem: https://github.com/evcc-io/evcc/discussions/14404

SwissFanboy avatar Jun 17 '24 06:06 SwissFanboy

Es scheint die API hat sich geändert... https://github.com/CJNE/ha-porscheconnect/issues/242

Der Entwickler hat angefangen den code umzuschreiben das es wieder geht:

https://github.com/CJNE/pyporscheconnectapi/commits/new_api/

Vielleicht sind da ja schon die Änderungen dabei die hier benötigt werden

normanmaurer avatar Jun 17 '24 08:06 normanmaurer

Auch bei mir klappt es plötzlich seit ein paar Tagen nicht mehr, keine Verbindung mehr möglich. EVCC Updates und Neustarts haben das Problem nicht gelöst.

Configuration details

- type: template
  template: porsche 
  title: Porsche Taycan  
  icon: car  
  user: **********  
  password: *********  
  vin: **********  
  capacity: 71  
  phases: 3  
  cache: 15m  
  mode: now  
  name: ev3

Log Details


[main  ] ERROR 2024/06/19 11:12:12 creating vehicle ev3 failed: cannot create vehicle type 'template': cannot create vehicle type 'porsche': unexpected status: 403 (Forbidden)

ev3
---
.Soc:     vehicle not available: cannot create vehicle type 'template': cannot create vehicle type 'porsche': unexpected status: 403 (Forbidden)
Capacity: 71.0kWh
Features: [Offline Retryable]

What type of operating system are you running? Linux

Version 0.127.2

Gandalf-1 avatar Jun 19 '24 09:06 Gandalf-1

Hatte es auch schon hier gemeldet:

https://github.com/evcc-io/evcc/discussions/12445

heinrichhermann avatar Jun 21 '24 06:06 heinrichhermann

Depends on https://github.com/CJNE/ha-porscheconnect/issues/242

andig avatar Jun 22 '24 09:06 andig

Is there a solution yet?

Jimnaldo avatar Jun 27 '24 18:06 Jimnaldo

FYI with the changes that were done in https://github.com/CJNE/pyporscheconnectapi/tree/new_api it's at least possible to "read" states again. So maybe this is a good starting point at least and will allow evcc to do everything needed except changing charging levels etc

normanmaurer avatar Jul 02 '24 09:07 normanmaurer

This is with the code installed and used in homeassistant:

Screenshot 2024-07-02 at 11 00 33 AM

normanmaurer avatar Jul 02 '24 09:07 normanmaurer

Looks like a full rewrite. We'll need a MITM trace of the vehicle communication or someone must re-engineer what the HA plugin does.

andig avatar Jul 02 '24 09:07 andig

@andig if you can give me some details how I could produce so a trace I would be happy to help

normanmaurer avatar Jul 02 '24 13:07 normanmaurer

Sorry, not using HA…

andig avatar Jul 02 '24 14:07 andig

Maybe @fredriklj can share such a trace as I suspect he had to obtain one as well for his work... OSS for the win :)

normanmaurer avatar Jul 04 '24 06:07 normanmaurer

Any news ok that topic?

Mestro82 avatar Jul 19 '24 08:07 Mestro82

Closed in https://github.com/evcc-io/evcc/commit/cd27ee2ce1a37fa86c6603f5ff59c2820a0a7a84. Nobody has found a way to update- hence we're deprecating the Porsche API. May come back at a later time.

andig avatar Jul 19 '24 13:07 andig

Sounds like it is solved for OpenWB!? https://forum.openwb.de/viewtopic.php?t=1943&start=30

NoMoreInfo avatar Jul 19 '24 13:07 NoMoreInfo

Hier bekommt ihr ggf. Zugriff auf die API's

Am Telefon hatte man sich mir gegenüber sehr offen bezgl. EVCC gezeigt. Vielleicht geben Sie euch einen Zugriff. Viel Erfolg.

https://developer.porsche.com/request-access

snapscanii avatar Jul 28 '24 06:07 snapscanii

@snapscanii they will not give you login access to this page. I think most of us already tried this.

devdems avatar Jul 28 '24 09:07 devdems

Hi, myPorsche funktioniert über IoBroker. Kann jemand sagen, ob dann ein porsche template erzeugt werden kann oder wie ich mit dem generische Vehicle und der Iobroker Verbindung die Daten rüberziehen kann?

Wichtig ist, dass das Fahrzeug nur während des Ladevorgangs gepollt wird, ansonsten geht es nicht in den Tiefschlaf und die 12V Batterie und dann die HV Batter entleert sich (das hatte ich leider schon einmal).

Grüße und danke für die HIlfe

diehappy69 avatar Oct 13 '24 16:10 diehappy69

Wir sind mit Porsche im Kontakt. Schauen wir mal, ob da was bei raus kommt...

andig avatar Oct 13 '24 16:10 andig

Wir sind mit Porsche im Kontakt. Schauen wir mal, ob da was bei raus kommt...

Kam da etwas zufriedenstellendes heraus in der Kommunikation?

heinrichhermann avatar Oct 23 '24 11:10 heinrichhermann

@andig: Looks like pyporscheconnectapi has a working implementation (beware the rate limit): https://github.com/CJNE/pyporscheconnectapi/issues/46

MarkusGH avatar Nov 03 '24 11:11 MarkusGH

I am currently using a combination of https://github.com/CJNE/pyporscheconnectapi/issues/46, shell scripting and mqtt to integrate my taycan. Works "well enough" until we have a native support again.

normanmaurer avatar Nov 06 '24 13:11 normanmaurer

I am currently using a combination of CJNE/pyporscheconnectapi#46, shell scripting and mqtt to integrate my taycan. Works "well enough" until we have a native support again.

@normanmaurer: Could you share that?

MarkusGH avatar Nov 26 '24 15:11 MarkusGH

Hi @MarkusGH

maybe I can help out describing my solution divided in the following three steps

  1. Install the files from the repository https://github.com/CJNE/ha-porscheconnect according to the instructions "manual installation". Important: use the branch "new_api" since the changes are not currently not committed to the "main" branch. Please check if information of you car appear in Home Assistant
  2. Push the information of your car from Home Assistant via MQTT (e.g. via Statestream (https://www.home-assistant.io/integrations/mqtt_statestream)
  3. Adapt the vehicle configuration in evcc.yaml as follows
vehicles:
- name: PAG
  type: custom
  title: Cayenne
  capacity: 21.8
  soc:
    source: mqtt
    topic: homeassistant/sensor/state_of_charge/state
  range:
    source: mqtt
    topic: homeassistant/sensor/remaining_range_electric/state

The Home Assistant plugin updates the information approximately every 30 minutes so target SOC charging is "challenging". But hey - much better than before ... :-)

Fingers crossed! :-)

WolfImBusch avatar Nov 26 '24 20:11 WolfImBusch

@MarkusGH I basically do the same as @WolfImBusch with the difference that I use a shell script for 2.

#!/usr/bin/bash

DIR="${BASH_SOURCE%/*}"
if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi
. "$DIR/config.sh"

CAPABILITIES=`/home/norman/pyporsche/bin/porschecli capabilities -a`

for VIN in ${VINS[@]}; do
    MEASUREMENTS=`echo $CAPABILITIES | jq ". | select(.vin==\"$VIN\")" | jq '.measurements'`
    CURRENT_CHARGE=`echo $MEASUREMENTS | jq '.[] | select(.key=="BATTERY_LEVEL")' | jq ."value.percent"`
    CURRENT_RANGE=`echo $MEASUREMENTS | jq '.[] | select(.key=="E_RANGE")' | jq ."value.kilometers"`
    CURRENT_MILEAGE=`echo $MEASUREMENTS | jq '.[] | select(.key=="MILEAGE")' | jq ."value.kilometers"`
    CURRENT_MIN_SOC=`echo $MEASUREMENTS | jq '.[] | select(.key=="CHARGING_PROFILES")' | jq ".value.list[] | select(.name==\"Home\")" | jq '.minSoc'`
    CURRENT_CHARGING_STATE=`echo $MEASUREMENTS | jq '.[] | select(.key=="BATTERY_CHARGING_STATE")' | jq ."value.status"`

    /usr/bin/mosquitto_pub -r -h $MQTT_HOST -u $MQTT_USER -P $MQTT_PASSWORD -t $MQTT_TOPIC/$VIN/battery_level -m $CURRENT_CHARGE
    /usr/bin/mosquitto_pub -r -h $MQTT_HOST -u $MQTT_USER -P $MQTT_PASSWORD -t $MQTT_TOPIC/$VIN/range -m $CURRENT_RANGE
    /usr/bin/mosquitto_pub -r -h $MQTT_HOST -u $MQTT_USER -P $MQTT_PASSWORD -t $MQTT_TOPIC/$VIN/mileage -m $CURRENT_MILEAGE
    /usr/bin/mosquitto_pub -r -h $MQTT_HOST -u $MQTT_USER -P $MQTT_PASSWORD -t $MQTT_TOPIC/$VIN/min_soc -m $CURRENT_MIN_SOC
    /usr/bin/mosquitto_pub -r -h $MQTT_HOST -u $MQTT_USER -P $MQTT_PASSWORD -t $MQTT_TOPIC/$VIN/charging_state -m $CURRENT_CHARGING_STATE
done

normanmaurer avatar Nov 27 '24 08:11 normanmaurer

@normanmaurer: Amazing! That saves so much time. Can you please post your vehicle configuration in evcc.yaml also ?

MarkusGH avatar Nov 27 '24 09:11 MarkusGH

vehicles:
- type: custom
  title: Taycan
  icon: car
  capacity: 93
  name: taycan
  soc:
    source: mqtt
    topic: porsche/$VIN/battery_level
    timeout: 60m
  range:
    source: mqtt
    topic: porsche/$VIN/range
    timeout: 60m
  odometer:
    source: mqtt
    topic: porsche/$VIN/mileage
    timeout: 60m
  limitsoc:
    source: mqtt
    topic: porsche/$VIN/min_soc
    timeout: 60m

@MarkusGH replace $VIN with your VIN.

normanmaurer avatar Nov 27 '24 10:11 normanmaurer