Skip to main content

CarConnectivity plugin providing a REST API

Project description

CarConnectivity Plugin for a REST API

GitHub sourcecode GitHub GitHub issues

CarConnectivity will become the successor of WeConnect-python in 2025 with similar functionality but support for other brands beyond Volkswagen!

CarConnectivity is a python API to connect to various car services. This plugin provides a REST API that allows other clients to interact with CarConnectivity's object tree.

Supported operations

  • GET data from CarConnectivity's object tree
  • PUT writable attributes (change values)
  • POST commands with their arguments

Installation

pip install carconnectivity-plugin-restapi

Configuration

Add the plugin to your carconnectivity.json configuration file:

{
    "carConnectivity": {
        "connectors": [...],
        "plugins": [
            {
                "type": "restapi",
                "config": {
                    "host": "0.0.0.0",
                    "port": 40000,
                    "username": "admin",
                    "password": "secretpassword"
                }
            }
        ]
    }
}

Multiple users

{
    "carConnectivity": {
        "plugins": [
            {
                "type": "restapi",
                "config": {
                    "port": 40000,
                    "users": [
                        {"username": "user1", "password": "pass1"},
                        {"username": "user2", "password": "pass2"}
                    ]
                }
            }
        ]
    }
}

HTTPS

{
    "carConnectivity": {
        "plugins": [
            {
                "type": "restapi",
                "config": {
                    "port": 40000,
                    "https": true,
                    "ssl_certificate_file": "/path/to/cert.pem",
                    "ssl_certificate_key_file": "/path/to/key.pem",
                    "username": "admin",
                    "password": "secret"
                }
            }
        ]
    }
}

API Usage

All endpoints require HTTP Basic Authentication.

GET — retrieve data

GET http://localhost:40000/<path>

Returns the object or attribute at <path> in the CarConnectivity object tree as JSON. An empty path (/) returns the entire tree.

Example:

curl -u admin:secret http://localhost:40000/garage/WVWZZZAUZLW123456/charging/connector/connection_state

PUT — set a writable attribute

PUT http://localhost:40000/<path>
Content-Type: application/json

{"value": <new_value>}

Example:

curl -u admin:secret -X PUT -H "Content-Type: application/json" \
     -d '{"value": 80}' \
     http://localhost:40000/garage/WVWZZZAUZLW123456/charging/settings/target_level

POST — execute a command

POST http://localhost:40000/<path>
Content-Type: application/json

{"value": <command_arguments>}

Example:

curl -u admin:secret -X POST -H "Content-Type: application/json" \
     -d '{"value": "start"}' \
     http://localhost:40000/garage/WVWZZZAUZLW123456/climatization/commands/start-stop

Configuration parameters

Parameter Description Default
host Host/IP to listen on 0.0.0.0
port Port to listen on 40000
username Single user username
password Single user password
users List of {username, password} objects
https Enable HTTPS false
ssl_certificate_file Path to SSL certificate file
ssl_certificate_key_file Path to SSL private key file
log_level Log level (DEBUG, INFO, WARNING, ERROR) ERROR

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

carconnectivity_plugin_restapi-0.1a1.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file carconnectivity_plugin_restapi-0.1a1.tar.gz.

File metadata

File hashes

Hashes for carconnectivity_plugin_restapi-0.1a1.tar.gz
Algorithm Hash digest
SHA256 9be445f5d6774ba15a92539f5c6f46a50bc4e9c0c63264381d639bf67575d5b6
MD5 c2ba2398171b0539eb73b399f1187f68
BLAKE2b-256 59085686a6a5d3365aa6f73426c6b9dc1a2b58f95845409b68efa08acae1c1d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for carconnectivity_plugin_restapi-0.1a1.tar.gz:

Publisher: build_and_publish.yml on tillsteinbach/CarConnectivity-plugin-restapi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file carconnectivity_plugin_restapi-0.1a1-py3-none-any.whl.

File metadata

File hashes

Hashes for carconnectivity_plugin_restapi-0.1a1-py3-none-any.whl
Algorithm Hash digest
SHA256 8552cc3e279c76d1bb3b4244962e5c12f86da2d89255ba7b50f91528de3d41a8
MD5 ea3fa7693e55764ee0d4e55d10ba184b
BLAKE2b-256 1eb2ba77fcad71a9d7482e077dbdad883a2730fac86e28fcad7420a2a2d1134b

See more details on using hashes here.

Provenance

The following attestation bundles were made for carconnectivity_plugin_restapi-0.1a1-py3-none-any.whl:

Publisher: build_and_publish.yml on tillsteinbach/CarConnectivity-plugin-restapi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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