Giter Club home page Giter Club logo

kamereon-python's Introduction

kamereon-python

Kamereon is platform used for connected cars from the Renault-Nissan-Mitsubishi Alliance from 2019 onwards.

Compatible models

Theoretically...

  • Nissan Navara (from July 2019)
  • Nissan Leaf (from May 2019)
  • Nissan Juke (from November 2019)
  • Renault Zoe?

Example usage

pip install -r requirements.txt
python kamereon/__init__.py EU [email protected] my-password

This project

Is a proof-of-concept, and my goal is to build this into a general library for this platform, and use that to build a Home Assistant component.

License

Apache 2

References

This wouldn't have been half as easy to put together if it wasn't for the work by Tobias Westergaard Kjeldsen on reverse engineering Nissan Connect Services apps for his dartnissanconnect library and My Leaf app

Acronyms and initialisms

  • SVT: Stolen Vehicle Tracking
  • SRP: ?? PIN (PIN used for remote control actions)
  • FOTA: ???
  • EPS: ???
  • RGDC: ???
  • NCI: Nissan Connect ???
  • NCB: Nissan Connect ???
  • ACMS: ??? the server-side platform used to handle requests
  • ICE: Internal Combustion Engine
  • RHL: Remote Horn / Lights
  • RC: Remove Charge
  • RLU: Remote Lock / Unlock
  • BCI: ?
  • RES: Remote Electric Start / Stop?
  • CCS: Climate Control System
  • RPC/RPU: ?
  • SVTB: Stolen Vehicle Tracking Block / Unblock

kamereon-python's People

Contributors

mitchellrj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

kamereon-python's Issues

Howto fetch refresh status

Does anyone know how the status of a refresh command can be retrieved as executed in

def refresh_battery_status(self):

The command returns a refresh id:

{"data":{"type":"RefreshBatteryStatus","id":"10105284-e42b-4376-819e-fe50cf52c9df","attributes":{}}}

that should be queryable?

Missing voluptous package

After running pip3 install -r requirements.txt:

Installing collected packages: oauthlib, requests_oauthlib
  DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
  DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
Successfully installed oauthlib-3.2.0 requests_oauthlib-1.3.1
Traceback (most recent call last):
  File "/Users/andig/htdocs/kamereon-python/kamereon/__init__.py", line 6, in <module>
    import voluptuous as vol
ModuleNotFoundError: No module named 'voluptuous'

and

Traceback (most recent call last):
  File "/Users/andig/htdocs/kamereon-python/kamereon/__init__.py", line 8, in <module>
    from homeassistant.const import (
ModuleNotFoundError: No module named 'homeassistant'

example without home-assistant

Hi,

thanks for this code. Do you think it would be possible to have a little python3 example that shows the usage without home-assistant?

Thanks,
Johannes

cannot import name 'TIME_MINUTES' from 'homeassistant.const'

Thanks for putting this together! I wish I had more knowledge around Python to help contribute, but I'll keep trying to figure out the code.

This is the full error message:
ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform kamereon.sensor: Platform not found (cannot import name 'TIME_MINUTES' from 'homeassistant.const' (/usr/src/homeassistant/homeassistant/const.py)).

Does not work with current Nissanconnect EU

To start with many thanks for this Python implementation. However, for me it didn't work with the current version of Nissanconnect for EU.The response from the server seems to have changed. And I ran into some issues that seem to be related to Python3.

However, I got the bits and pieces that I need running. If someone is interested, I could share them.

Happy hacking and testing!

I am glad to announce my "test page" for developers and hackers which want to explore their cars capabilities:

http://jumpjack.altervista.org/myrenault/

Have fun and share your results! ;-)

Note: you don't need to put your credentials in the online version, the page works fine also if you save it locally.

Example of GET or POST fucntion to the car

Good afternoon @mitchellrj

I don't have the level of programming to understand the code, I want to connect with the car (which I could do since the prompt returned me the vin of the vehicle) in order to get data from it and set orders such start or stop charging. But is being complicated for me.
Could you please show me an example to for example turn on the HVAC or read the actual state of charge of the battery?
Maybe with it I will be able to realise how to do other types of requests.
Thanks!

what Im trying to do is to control the car with a raspberry after omptimizing the use of energy.

oauthlib.oauth2.rfc6749.errors.TokenExpiredError: (token_expired)

Seems to be a problem with token expiration after about an hour: TokenExpiredError

Log:
2020-04-08 23:32:47 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for kamereon which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2020-04-08 23:32:47 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2020-04-08 23:32:52 INFO (MainThread) [custom_components.kamereon] Logging in to service
2020-04-08 23:38:00 INFO (MainThread) [custom_components.kamereon] Logging in to service
2020-04-08 23:38:01 INFO (MainThread) [custom_components.kamereon] Doing a vehicle.refresh()...
2020-04-08 23:38:04 INFO (MainThread) [custom_components.kamereon] refresh done.
2020-04-08 23:38:04 INFO (MainThread) [custom_components.kamereon.sensor] BatteryLevelSensor.state...
...
...
...
2020-04-09 00:28:55 INFO (MainThread) [custom_components.kamereon] Logging in to service
2020-04-09 00:28:57 INFO (MainThread) [custom_components.kamereon] Doing a vehicle.refresh()...
2020-04-09 00:29:00 INFO (MainThread) [custom_components.kamereon] refresh done.
2020-04-09 00:29:00 INFO (MainThread) [custom_components.kamereon.sensor] BatteryLevelSensor.state...
2020-04-09 00:34:01 INFO (MainThread) [custom_components.kamereon] Logging in to service
2020-04-09 00:34:01 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
**File "/config/custom_components/kamereon/init.py", line 105, in update
for vehicle in kamereon_session.fetch_vehicles():
File "/config/custom_components/kamereon/kamereon.py", line 704, in fetch_vehicles
'{}v2/users/{}/cars'.format(self.settings['user_base_url'], self.user_id)
File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 543, in get
return self.request('GET', url, kwargs)
File "/usr/local/lib/python3.7/site-packages/requests_oauthlib/oauth2_session.py", line 478, in request
url, http_method=method, body=data, headers=headers
File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 198, in add_token
raise TokenExpiredError()
oauthlib.oauth2.rfc6749.errors.TokenExpiredError: (token_expired)

2020-04-09 00:39:02 INFO (MainThread) [custom_components.kamereon] Logging in to service
2020-04-09 00:39:02 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/config/custom_components/kamereon/init.py", line 105, in update
for vehicle in kamereon_session.fetch_vehicles():
File "/config/custom_components/kamereon/kamereon.py", line 704, in fetch_vehicles
'{}v2/users/{}/cars'.format(self.settings['user_base_url'], self.user_id)
File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 543, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests_oauthlib/oauth2_session.py", line 478, in request
url, http_method=method, body=data, headers=headers
File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 198, in add_token
raise TokenExpiredError()
oauthlib.oauth2.rfc6749.errors.TokenExpiredError: (token_expired)
...
...

Maybee a login every time or some kind of token refresh every 30 minutes?

Not really issue, but encouragement

It's great to see this development, it's a shame it did stop.

Is it so that you only are taking a break, or have you decided to not develop this anymore?

When I changed to a newer Leaf I was really missing the HA integration and now it seem to be so close!!

How to add to Homeassistant for testing

Hi,

I want to add it to HA also to see if I can help in getting it to work.
How exactly can I add this to Home Assistant.

I recently have a Nissan ariya and I want it in HA .

my coding skills mostly c# and .net so will see where i end up
brg
K.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.