Taycan Client Software Development

cjne

Active Member
First Name
Johan
Joined
Sep 22, 2020
Messages
36
Reaction score
46
Location
Sweden
Vehicles
Taycan Turbo S 2021, Tesla Model S P100D 2019
Country flag
https://www.teslaapi.io/authentication/oauth

The Tesla API Auth looks much more straightforward - why isn't that surprising ? :)
Yes the Porsche stuff is a lot more complex unfortunately. It's not even one single API, it's split up on multiple endpoints with their own auth tokens.
I guess multiple teams has been involved, each responsible for their separate part...

The actual auth backend seems to be an off the shelf solution called "Ping Federate" configured for Oauth2 authentication.





Advertisement

 

cjne

Active Member
First Name
Johan
Joined
Sep 22, 2020
Messages
36
Reaction score
46
Location
Sweden
Vehicles
Taycan Turbo S 2021, Tesla Model S P100D 2019
Country flag
A little update, i have added a simple CLI in the Python library that lets you get data for one or all cars connected to your Porsche ID. It just outputs as JSON for now.
Code:
usage: cli.py [-h] -e EMAIL -p PASSWORD [-s SESSION_FILE] [-v VIN] [-a]
              [-c COUNTRY] [-l LANGUAGE]
              {list,overview,maintenance,summary,capabilities}

Porsche Connct CLI.

positional arguments:
  {list,overview,maintenance,summary,capabilities}

optional arguments:
  -h, --help            show this help message and exit
  -e EMAIL, --email EMAIL
  -p PASSWORD, --password PASSWORD
  -s SESSION_FILE, --sessionfile SESSION_FILE
  -v VIN, --vin VIN
  -a, --all
  -c COUNTRY, --country COUNTRY
  -l LANGUAGE, --language LANGUAGE
Example output for "overview"
Code:
{
  "vin": ".....",
  "oilLevel": null,
  "fuelLevel": null,
  "batteryLevel": {
    "value": 43,
    "unit": "PERCENT",
    "unitTranslationKey": "GRAY_SLICE_UNIT_PERCENT"
  },
  "remainingRanges": {
    "conventionalRange": {
      "distance": null,
      "engineType": "UNSUPPORTED",
      "isPrimary": false
    },
    "electricalRange": {
      "distance": {
        "value": 137,
        "unit": "KILOMETER",
        "originalValue": 137,
        "originalUnit": "KILOMETER",
        "valueInKilometers": 137,
        "unitTranslationKey": "GRAY_SLICE_UNIT_KILOMETER"
      },
      "engineType": "ELECTRIC",
      "isPrimary": true
    }
  },
  "mileage": {
    "value": 1093,
    "unit": "KILOMETER",
    "originalValue": 1093,
    "originalUnit": "KILOMETER",
    "valueInKilometers": 1093,
    "unitTranslationKey": "GRAY_SLICE_UNIT_KILOMETER"
  },
  "parkingLight": "OFF",
  "parkingLightStatus": null,
  "parkingBreak": "ACTIVE",
  "parkingBreakStatus": null,
  "doors": {
    "frontLeft": "CLOSED_UNLOCKED",
    "frontRight": "CLOSED_UNLOCKED",
    "backLeft": "CLOSED_UNLOCKED",
    "backRight": "CLOSED_UNLOCKED",
    "frontTrunk": "CLOSED_UNLOCKED",
    "backTrunk": "CLOSED_UNLOCKED",
    "overallLockStatus": "CLOSED_UNLOCKED"
  },
  "serviceIntervals": {
    "oilService": {
      "distance": null,
      "time": null
    },
    "inspection": {
      "distance": {
        "value": -29000,
        "unit": "KILOMETER",
        "originalValue": -29000,
        "originalUnit": "KILOMETER",
        "valueInKilometers": -29000,
        "unitTranslationKey": "GRAY_SLICE_UNIT_KILOMETER"
      },
      "time": {
        "value": -703,
        "unit": "DAYS",
        "unitTranslationKey": "GRAY_SLICE_UNIT_DAY"
      }
    }
  },
  "tires": {
    "frontLeft": {
      "currentPressure": {
        "value": 2.8,
        "unit": "BAR",
        "valueInBar": 2.8,
        "unitTranslationKey": "GRAY_SLICE_UNIT_BAR"
      },
      "optimalPressure": {
        "value": 3,
        "unit": "BAR",
        "valueInBar": 3,
        "unitTranslationKey": "GRAY_SLICE_UNIT_BAR"
      },
      "differencePressure": {
        "value": 0.2,
        "unit": "BAR",
        "valueInBar": 0.2,
        "unitTranslationKey": "GRAY_SLICE_UNIT_BAR"
      },
      "tirePressureDifferenceStatus": "DIVERGENT"
    },
    "frontRight": {
      "currentPressure": {
        "value": 2.8,
        "unit": "BAR",
        "valueInBar": 2.8,
        "unitTranslationKey": "GRAY_SLICE_UNIT_BAR"
      },
      "optimalPressure": {
        "value": 3,
        "unit": "BAR",
        "valueInBar": 3,
        "unitTranslationKey": "GRAY_SLICE_UNIT_BAR"
      },
      "differencePressure": {
        "value": 0.2,
        "unit": "BAR",
        "valueInBar": 0.2,
        "unitTranslationKey": "GRAY_SLICE_UNIT_BAR"
      },
      "tirePressureDifferenceStatus": "DIVERGENT"
    },
    "backLeft": {
      "currentPressure": {
        "value": 2.9,
        "unit": "BAR",
        "valueInBar": 2.9,
        "unitTranslationKey": "GRAY_SLICE_UNIT_BAR"
      },
      "optimalPressure": {
        "value": 3.2,
        "unit": "BAR",
        "valueInBar": 3.2,
        "unitTranslationKey": "GRAY_SLICE_UNIT_BAR"
      },
      "differencePressure": {
        "value": 0.3,
        "unit": "BAR",
        "valueInBar": 0.3,
        "unitTranslationKey": "GRAY_SLICE_UNIT_BAR"
      },
      "tirePressureDifferenceStatus": "DIVERGENT"
    },
    "backRight": {
      "currentPressure": {
        "value": 2.9,
        "unit": "BAR",
        "valueInBar": 2.9,
        "unitTranslationKey": "GRAY_SLICE_UNIT_BAR"
      },
      "optimalPressure": {
        "value": 3.3,
        "unit": "BAR",
        "valueInBar": 3.3,
        "unitTranslationKey": "GRAY_SLICE_UNIT_BAR"
      },
      "differencePressure": {
        "value": 0.4,
        "unit": "BAR",
        "valueInBar": 0.4,
        "unitTranslationKey": "GRAY_SLICE_UNIT_BAR"
      },
      "tirePressureDifferenceStatus": "DIVERGENT"
    }
  },
  "windows": {
    "frontLeft": "CLOSED",
    "frontRight": "CLOSED",
    "backLeft": "CLOSED",
    "backRight": "CLOSED",
    "roof": "UNSUPPORTED",
    "maintenanceHatch": "UNSUPPORTED",
    "sunroof": {
      "status": "UNSUPPORTED",
      "positionInPercent": null
    }
  },
  "parkingTime": null,
  "overallOpenStatus": "CLOSED"
}
Up next is probably to try doing stuff, like lock and unlock...
 

cjne

Active Member
First Name
Johan
Joined
Sep 22, 2020
Messages
36
Reaction score
46
Location
Sweden
Vehicles
Taycan Turbo S 2021, Tesla Model S P100D 2019
Country flag
https://www.teslaapi.io/authentication/oauth

The Tesla API Auth looks much more straightforward - why isn't that surprising ? :)
Tesla has now deprecated this oauth method in favor of openid, very similar to the Porsche way.
As a result the Tesla Home Assistant integration is now broken :(

Maybe if i can get the Porsche integration working before they fix it :p
 

legataycan

Active Member
Joined
Sep 29, 2020
Messages
42
Reaction score
5
Location
UK
Vehicles
Taycan 4S, 981 Boxster
Country flag
Great work everyone! I'll start poking around at this in my spare time too. Exciting!
 

rowi

New Member
First Name
Rolf
Joined
Feb 5, 2021
Messages
3
Reaction score
5
Location
Germany, Cologne area
Vehicles
Taycan 4S, MY 2021
Country flag
Oh my, what a fantastic gold mine here! I stumbled across the XHT in the source of the Porsche Connect website, found the api.porsche.com and searched the Web, but I was expecting way less information, but definitely no samples in Python, PHP and even a command line tool. Thank you all so much, this will make my upcoming weekend great!
 

tigerbalm

Well-Known Member
Joined
Oct 11, 2020
Messages
353
Reaction score
369
Location
Ireland
Vehicles
Panamera Turbo S E-hybrid, Peugeot e-208, Taycan
Country flag
The first usable version of my Porsche Connect library written in Swift focused on Apple platforms has been released.

https://github.com/driven-app/porsche-connect

This includes a command line utility (https://github.com/driven-app/porsche-connect#command-line-tool) that demonstrates using the library and will be useful in its own right.

Instructions are included for creating a universal binary for both Intel (x86_64) and Apple (M1/AXX arm64 SoC's).

This library inherits all the various advantages of Swift, such as strong typing, native binary speed and runs in a sandbox for security (it can't see the rest of your device). It has a full test suite that uses a mock server to simulate the Porsche API in both success and failure conditions.

Unfortunately, I can't make progress on more Porsche Connect API's and services until I receive my own car (its at Emden Port) and activate remote services.

My first use of this library is building an open-source macOS app that will sit on the status bar (near the mac's clock) that you'll be able to quickly see current status (state of charge, etc) of your Porsche directly from your Mac, without having to open a mobile app.

While it will be open-sourced, I will also be making available a compiled and notarized version for folks to just download and use directly.
 
Last edited:

MissionC

Well-Known Member
Joined
Feb 15, 2019
Messages
238
Reaction score
264
Location
Boston
Vehicles
Taycan 4S
Country flag
My first use of this library is building an open-source macOS app that will sit on the status bar (near the mac's clock) that you'll be able to quickly see current status (state of charge, etc) of your Porsche directly from your Mac, without having to open a mobile app.

While it will be open-sourced, I will also be making available a compiled and notarized version for folks to just download and use directly.
Excellent work! Happy to pitch in as you start the client. Are you going AppKit or SwiftUI?
 

tigerbalm

Well-Known Member
Joined
Oct 11, 2020
Messages
353
Reaction score
369
Location
Ireland
Vehicles
Panamera Turbo S E-hybrid, Peugeot e-208, Taycan
Country flag
Excellent work! Happy to pitch in as you start the client. Are you going AppKit or SwiftUI?
I thought it would be SwiftUI but as my first app is just a tiny menubar app – I'm able to get AppKit to do what I want easier. It may well be possible with SwiftUI but I couldn't get it to dance in the right direction.

Especially for this app, that uses the "Application is agent (UIElement)" option to ensure no window opens up when started and it doesn't appear on the dock – a true background menubar app.

I'm calling the app ChargeBar and only at the beginning of the UI building out at https://github.com/driven-app/charge-bar
 

Jon Steinmetz

Well-Known Member
First Name
Jon
Joined
May 17, 2020
Messages
72
Reaction score
50
Location
Grant, MN
Vehicles
2021 Porsche Taycan 4S
Country flag
Has anyone investigated communication with the PMCC directly? I have been thinking that a Home Assistant integration for local control and fetching data would be neat. An integration for the connect service would also be cool.
 

rs38

Well-Known Member
Joined
Nov 16, 2020
Messages
47
Reaction score
23
Location
Germany
Vehicles
gt2,i8,i3,
Country flag

Advertisement





 
ZYRUS


Advertisement
Top