Nissan Leaf Component(s)/Platform


This does not even work with other Nissan cars. Only the Leaf.


I’m getting my 3G upgrade today on my 2015 LEAF. Will this work with the current version of Home Assistant? Thanks!


Hi All,

I’m quite a newbie on HA but usually I manage with googling and some persistence.
I am however quite stumped by what to actually do with this one.
How I now understand it I need to do two things:

  1. move 4 files to the folder “custom_component/“etc.”” from Bens git.

The issue here is that I dont understand if the folder should be placed under “config” or not. I see both
“config\custom_component” and simply “custom_component” in the discussion.

2)The second step is: "add the below to configuration.yaml.

      username: "[email protected]"
      password: "mypassword"
      nissan_connect: true
      region: 'NE'
      update_interval: 30
      update_interval_charging: 10
      update_interval_climate: 5
      force_miles: false

My issue here is that I get “Unable to find component nissan_leaf” in the log. Dont dare to try a restart when I cant validate the config file.

Any help would be much appreciated.


I’m reasonably sure that it makes a difference how many spaces there are after the ‘nissan_leaf’ should be just 2 spaces.

Like …


Thank you very much for the quick reply RoadkilUK.

I should be very well aware of the 2 spaces, but I still would have used time before I spotted it, so you saved me time and frustration :slightly_smiling_face:

Regarding the rest I hope I figures it out. I had an issue with my samba, windows 10 disables the required files if its not used in a while… so I used Configurator to add it directly in That did not seem to work. I have made samba work now, and the error is gone :smiley:. Restarting HA now. Fingers crossed!


Thanks so much for this custom component! I’ve got it installed and everything is working beautifully on my hassIO. Are there any plans on adding more additional features like lock/unlock car, lights, horns and lights? these are available in the nissan connect app and was wondering how difficult would it be to implement it in the component as well.


Nope, sorry. This component uses the worldwide API. The API that provides lock/unlock, etc is only available in certain regions (not mine) so is best done as a separate component for 2018 Leafs.


With the latest hassOS (Home Assistant 0.81.0) I get this error.

Unable to install package Failed building wheel for pycryptodome
python-jose-cryptodome 1.3.2 has requirement pycryptodome<3.4.0,>=3.3.1, but you'll have pycryptodome 3.7.0 which is incompatible.
pyrebase4 4.2.0 has requirement oauth2client==4.1.2, but you'll have oauth2client 4.0.0 which is incompatible.
broadlink 0.9 has requirement pycryptodome==3.4.11, but you'll have pycryptodome 3.7.0 which is incompatible.
Command "/usr/local/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-4zd1j_hj/pycryptodome/';f=getattr(tokenize, 'open', open)(__file__);'\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-d1nf_ciz/install-record.txt --single-version-externally-managed --prefix  --compile --user --prefix=" failed with error code 1 in /tmp/pip-install-4zd1j_hj/pycryptodome/
You are using pip version 18.0, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.


Same here.


I’m also having the same issue. This seems to be a common problem with custom components since the update to 0.81.0. I had a snapshot from before the update and restore to that, and the Nissan Leaf component is still broken.

I’ll try to downgrade everything else involved to see if that temporarily fixes it, unless the dev can provide an update :slight_smile:


Glad I’m not the only one experiencing this issue…


I think we are not to expect to much from this project anymore.

I tried this yesterday: and it looked very promising, but after a while no more data is being published to mqtt.

ATM there is not one flawlessly working solution :frowning:


Bit odd, given i don’t think there’s a version requirement for pycryptodome in the pycarwings repo (or is there…?)

People are of course welcome to contribute fixes, my time is somewhat limited right now


Seems like updating to 0.81.2 fixed the component, everything is working fine again


Yes, It’s working again with 0.81.2


Anyone have an issue with the session credentials timing out? It seems like the component only signs in inside setup(). If the HA server runs a while, those credentials expire and there’s no hook to re-auth. Or, at least, that’s my guess.


I’ve only had it happen very rarely, however I never bother using the app so maybe that’s why?


New error:

2018-11-20 13:03:07 WARNING (MainThread) [homeassistant.setup] Setup of nissan_leaf is taking over 10 seconds.
2018-11-20 13:03:56 ERROR (SyncWorker_19) [pycarwings2.pycarwings2] carwings error INVALID PARAMS: -2001
2018-11-20 13:03:56 ERROR (SyncWorker_19) [custom_components.nissan_leaf] An unknown error occurred while connecting to Nissan: <class 'pycarwings2.pycarwings2.CarwingsError'>
2018-11-20 13:03:56 INFO (SyncWorker_19) [custom_components.nissan_leaf] Successfully logged in and fetched Leaf info
2018-11-20 13:03:56 INFO (SyncWorker_19) [custom_components.nissan_leaf] WARNING: This may poll your Leaf too often, and drain the 12V. If you drain your car's 12V it won't start as the drive train battery won't connect Don't set the intervals too low.
2018-11-20 13:03:56 ERROR (MainThread) [homeassistant.setup] Error during setup of component nissan_leaf
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/", line 148, in _async_setup_component
    component.setup, hass, processed_config)  # type: ignore
  File "/usr/local/lib/python3.6/concurrent/futures/", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/", line 127, in setup
    leaf, hass, config)
UnboundLocalError: local variable 'leaf' referenced before assignment


I’ve not been able to log into the server since last Friday, apparently I’m not the only one. It’s not a problem with this add-on, it’s a server problem … again.



Heads up folks, Nissan have changed their API for some licensing reason and now updates are needed again.

Will get on this, it’s a library fix so once it’s fixed restarting HASS should update things