Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update documentation #71

Merged
merged 4 commits into from
Dec 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,21 @@ How to request a feature
Request features on the `Issue Tracker`_.


Providing samples
-----------------

Providing samples for more vehicles helps us improve the library. If you have a vehicle for which we
do not have the specifications yet, or if you have found a new feature for an existing vehicle, then
please send us the samples.

- Generate a trace.
- Add the json file to the correct `test/fixtures/kamereon` subfolder.
- Ensure that `vin` starts with `VF1AAAA` _(we do not want the real VIN)_
- Ensure that `vehicleDetails.vin` also starts with `VF1AAAA` _(we do not want the real VIN)_
- Ensure that `vehicleDetails.registrationNumber` starts with `REG-` _(we do not want the real registration number)_
- Ensure that the json file passes pre-commit (can be parsed online via https://codebeautify.org/jsonviewer)
- Create a pull request

How to set up your development environment
------------------------------------------

Expand All @@ -49,7 +64,7 @@ You need Python 3.7+ and the following tools:
- Nox_
- nox-poetry_

**WARNING**: due to an open issue with Poetry, we recommand to use the 1.0.10 version. You can install it
**WARNING**: due to an open issue with Poetry, we recommand that you use the 1.0.10 version. You can install it
with the commmand:

.. code:: console
Expand Down
66 changes: 60 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,34 +36,79 @@ Renault API
Features
--------

* TODO
This Python package manages the communication with the private Renault API used by the official MyRenault application.

The client is able to read various vehicle attributes, such as:
* mileage
* GPS location
* fuel autonomy (for fuel vehicles)
* battery autonomy (for electric vehicles)

Requirements
------------
For some vehicles, it is also possible to manage:
* hvac/pre-conditionning of the vehicle
* charge schedule

* TODO
This package has been developed to be used with Home-Assistant, but it can be used in other contexts


Installation
Requirements
------------

* Python (>= 3.7.1)

API Usage
---------

You can install *Renault API* via pip_ from PyPI_:

.. code:: console

$ pip install renault-api

.. code:: python

import aiohttp
import asyncio

from renault_api.renault_client import RenaultClient

async def main():
async with aiohttp.ClientSession() as websession:
client = RenaultClient(websession=websession, locale="fr_FR")
await client.session.login('email', 'password')
print(f"Accounts: {await client.get_person()}") # List available accounts, make a note of kamereon account id

account_id = "Your Kamereon account id"
account = await client.get_api_account(account_id)
print(f"Vehicles: {await account.get_vehicles()}") # List available vehicles, make a note of vehicle VIN

vin = "Your vehicle VIN"
vehicle = await account.get_api_vehicle(vin)
print(f"Cockpit information: {await vehicle.get_cockpit()}")
print(f"Battery status information: {await vehicle.battery_status()}")

loop = asyncio.get_event_loop()
loop.run_until_complete(main())

CLI Usage
---------

Quickstart, prompts for credentials, settings and generates traces:
The renault-api is also available through a CLI, which requires additional dependencies.
For the added dependencies, you can install *Renault API* via pip_ from PyPI_:

.. code:: console

$ pip install renault-api[cli]

Once installed, the following command prompts for credentials and settings, displays basic vehicle status information, and generates traces:

.. code:: console

$ renault-api --log status

* Credentials will automatically be stored in the user home directory (~/.credentials/renault-api.json)
* Logs will automatically be generated in `logs` subfolder

Please see the `Command-line Reference <Usage_>`_ for full details.


Expand All @@ -81,6 +126,12 @@ Distributed under the terms of the MIT_ license,
*Renault API* is free and open source software.


Disclaimer
----------

This project is not affiliated with, endorsed by, or connected to Renault. I accept no responsibility for any consequences, intended or accidental, as a as a result of interacting with Renault's API using this project.


Issues
------

Expand All @@ -92,10 +143,13 @@ Credits
-------

This project was generated from `@cjolowicz`_'s `Hypermodern Python Cookiecutter`_ template.
This project was heavily based on `@jamesremuscat`_'s `PyZE`_ python client for the Renault ZE API.


.. _@cjolowicz: https://github.com/cjolowicz
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _@jamesremuscat: https://github.com/jamesremuscat
.. _PyZE: https://github.com/jamesremuscat/pyze
.. _MIT: http://opensource.org/licenses/MIT
.. _PyPI: https://pypi.org/
.. _Hypermodern Python Cookiecutter: https://github.com/cjolowicz/cookiecutter-hypermodern-python
Expand Down
12 changes: 0 additions & 12 deletions tests/fixtures/kamereon/Contributions.rst
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
Contributing
============
- grab a trace.
- add the json file to the correct `test/fixtures/kamereon` subfolder.
- ensure that `vin` starts with `VF1AAAA-`
- ensure that `vehicleDetails.vin` also starts with `VF1AAAA-`
- ensure that `vehicleDetails.registrationNumber` starts with `REG-`
- ensure that the json file passes pre-commit (can be parsed online via https://codebeautify.org/jsonviewer)
- update this file to indicate what is interesting about the sample provided
- create a pull request


Sample vehicles
===============

Expand Down