Skip to main content

ConnectedCar SDK

Project description

ConnectedCar Python SDK Logo

The ConnectedCar Python SDK is an open-source, python package that provides the ability to send commands to your Ford Sync Connect connected vehicle.

Installation PyPI version

python3 -m pip install connectedcar

Requirements

  • To make requests to a vehicle, the end user must have signed up for an account using Ford Pass. These credentials will be used to authenticate your requests.

Getting Started

Import the ConnectedCar SDK

import connectedcar

Create a new connectedcar client

  • Note the default ConnectedCar client_id is 9fb503e0-715b-47e8-adfd-ad4b7770f73b
client = connectedcar.AuthClient('9fb503e0-715b-47e8-adfd-ad4b7770f73b', None, None, None, 'US') # Region argument is only required if you live outside the United States.
  • Note: If your region is outside of the US you can pass different region parameters. Regions: (US, CA, EU, AU)

Use client.get_user_access_token() to exchange your user credentials for an access object. To make any vehicle data request to the Ford Sync Connect API, you'll need to give the SDK a valid access token.

access = client.get_user_access_token('<username>', '<password>')

This access object will look like this:

{
  "access_token": "...",
  "token_type": "Bearer",
  "expiration": "2021-03-01T18:04:25+00:00",
  "refresh_token": "...",
  "refresh_expiration": "2021-03-02T18:03:25+00:00",
  "expires_in": "..."
}

Access tokens will expire every 2 hours, so you'll need to constantly refresh them by calling client.exchange_refresh_token()

refreshToken = client.exchange_refresh_token(access['refresh_token'])

With your access token in hand, use connectedcar.User() to get a User object representing the user.

user = connectedcar.User(access['access_token'], "US") # Region argument is only required if you live outside the United States.

Use user.vehicles() to return an array of all the vehicles associated with a users account. The response will include the vehicle vin.

vehicles = user.vehicles()

vehicleList = [] # Array of vehicles

for userVehicle in vehicles: # For each user vehicle
    vehicleList.append(userVehicle['VIN'])

Now with a vehicle vin in hand, use connectedcar.Vehicle() to get a Vehicle object representing the user's vehicle.

currentVehicle = connectedcar.Vehicle(vehicleList[0], access['access_token'], "US") # Region argument is only required if you live outside the United States.

Now you can ask the car to do things, or ask it for some data! For example:

currentVehicle.start()

Examples & Documentation

For more examples on what you can do with Sync Connected car, see the examples folder or take a peek at the documentation.

Funding & Support

If you are interested in supporting the development of my projects check out my patreon or buy me a coffee.

Disclaimer

THIS CODEBASE IS NOT ENDORSED, AFFILIATED, OR ASSOCIATED WITH FORD, FOMOCO OR THE FORD MOTOR COMPANY.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

connectedcar-1.3.10.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

connectedcar-1.3.10-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file connectedcar-1.3.10.tar.gz.

File metadata

  • Download URL: connectedcar-1.3.10.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.0

File hashes

Hashes for connectedcar-1.3.10.tar.gz
Algorithm Hash digest
SHA256 e4c62a0263ca9293c9719998a689c05da9e21b9e55548dceefa2178a665f0486
MD5 d86ee2cc59a86ddb2d86fece05853e5a
BLAKE2b-256 e62407c2d6986f80442cf5f83df275e5e4556ccf77e0f7da63849c86837e9031

See more details on using hashes here.

File details

Details for the file connectedcar-1.3.10-py3-none-any.whl.

File metadata

File hashes

Hashes for connectedcar-1.3.10-py3-none-any.whl
Algorithm Hash digest
SHA256 fda4cab61f3483221e057cf65fb6bc31597a92bb7584d8d96bbfeebf616032c1
MD5 0a88c99a80e2577fff232367c6f9f52d
BLAKE2b-256 821a00d64173bd76a38b235e088d4c31cc418b70656b003785feef9573419674

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page