Nissan Leaf Component(s)/Platform

You can install a custom component by:

  • Create a custom_components folder in your configuration directory
  • Download the GitHub repo as a zip file
  • Extract the kamereon folder (not the kamereon-python-master one - but the child folder underneath) to inside the custom_components folder
  • add configuration parameters to your configuration.yaml in home-assistant and restart

The configuration parameters I used are:

kamereon:
  username: {nissan username}
  password: {nissan password}
  manufacturer: "nissan"
  region: "EU"
1 Like

Thanks, I was missing what config item to use.

Having this “working”, there aren’t many sensors that gives data. Battery level is probably the one I’m missing most, but also a switch for remote start to climate would be great.

But this is a great start, I wish I had some better coding skills myself so that I could continue the development since the original developer seems to have stopped working on this.

Same here - I spent lastnight looking through other components to see how they have implemented OAuth so I could reuse anything they have done but it’s likely my lack of understanding that’s failing me more.

Sensors should not be too hard to add, but really the token refresh needs to be fixed first before it can develop further. I have been looking to see if there is somewhere I can ask for help…

Thank you very much for this reply.
Will give it a try as soon as possible.

Hi guys,

I’m having few issues.

  1. Can’t make a charge button working. Here is the code:
    type: button
    tap_action:
    action: call-service
    service: nissan_leaf.start_charge
    data:
    vin: SJNFAAZE0*********
    hold_action:
    action: none
    show_state: true
    name: START_CHARGE
    show_icon: true

It is returning “Failed to call service nissan_leaf/start_charge. required key not provided @ data[‘vin’]” on trigger.

Another thing - can’t get this part of configuration to work:
update_interval:
hours: 1
update_interval_charging:
minutes: 15
update_interval_climate:
minutes: 5
force_miles: true

System not parsing it:
Error loading /config/configuration.yaml: while parsing a block mapping
in “/config/configuration.yaml”, line 3, column 1
expected , but found ‘’
in “/config/configuration.yaml”, line 18, column 3

Without this part everything seems to work just fine. What am I missing here?

Firstly, is your leaf pre 2018?

I’m not sure about the first part, but here is mine, it triggers at 7am so I know it’s ok for going to work. Try putting the vin in single quotes.

- action:
  - service: nissan_leaf.update
    data:
      vin: 'XXXXXXXXXXXXXX'             # replace
  alias: Update Leaf
  id: '1545654345487'
  trigger:
  - at: '7:00:00'
    platform: time

As for the second part, it looks fine but try changing the hours: 1 to minutes: 60 see if that makes a difference.

Thanks, will try it out, yes Leaf is 2014.
I have another issue status is no longer updating at all, the only way to get it updated is to restart HA. I think this component is no longer functional.

Sometimes getting this:
return CarwingsLatestBatteryStatusResponse(response)
File “/usr/local/lib/python3.8/site-packages/pycarwings2/responses.py”, line 627, in init
bs = recs[“BatteryStatus”]
TypeError: list indices must be integers or slices, not str

But most of the time it is just not updating.

And now it stopped working completely:
2020-09-25 11:31:58 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.

Take a look at this post, it seems that HA doesn’t get the info every time, first time. The post describes how to add a second ‘poll’ for data, I’ve been using it for about a year and I have NO issues.

Linky Dink

Thank you very much!
I’m new to HA (currently migrating from Domoticz), so just starting to understanding how things working.

I’m strugling with this part:

  • platform: template
    sensors:
    leaf_updating:
    friendly_name: ‘Leaf Update Status’
    value_template: “{{ state_attr(‘sensor.CHANGEME_charge’, ‘update_in_progress’) }}”

Where exactly do I put it? And sensor.CHANGEME_charge should be changed to, I’m a bit confused.

It should be in the sensor.yaml file I think, and the CHANGEME should be whatever your vehicle sensor is called.

Hope that helps.

Also if you are posting code, please use the 3 backticks method. Section 11

And now it stopped working completely:
2020-09-25 11:31:58 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.

This is a standard response, it actually means it’s working.

Looks like HA update broke something:


Not working any more at all, not sure what’s the issue, looks like I have to re-install home assistant again from scratch…

Having failed with any of the above, I’ve now got a very basic setup working for my 2020 UK LEAF:

This is done with a script using Tobias Kjeldsen’s dartnissanconnect Dart library (the basis for the MyLeaf phone app) sending info over MQTT from a Docker container, then mqtt sensors in HA to pick up the data. Works for me, not yet suitable for sharing but I’ll put an update up when I have something a bit less clunky and heavyweight — this is my first time using both Dart and Docker!

Ideal future state is to hack my Pod Point with an ESP device to be able to start and stop charge, and then do things like control charge to a set percentage (80/90/100% as needed) aligned to the cheapest times on my Octopus Agile tariff without having to set the car charge timers.

2 Likes

I take it this is down again, if so at least I’ll know its not me :neutral_face:? I tried setting this up tonight but keep getting the following error:

2020-11-11 20:55:44 DEBUG (SyncWorker_10) [homeassistant.components.nissan_leaf] Logging into You+Nissan…

2020-11-11 20:55:48 ERROR (SyncWorker_10) [homeassistant.components.nissan_leaf] An unknown error occurred while connecting to Nissan: <class ‘pycarwings2.pycarwings2.CarwingsError’>

My config is like this which I think is correct?

nissan_leaf:
  username: !secret nissan_leaf_username
  password: !secret nissan_leaf_password
  region: "NE"
  update_interval:
    minutes: 30
  update_interval_charging:
    minutes: 15
  update_interval_climate:
    minutes: 5
  force_miles: false

It looks right to me, matches mine anyway. Does your usual app connect OK? and what leaf do you have?

Hey thanks
It’s a 2020 one. My app connects but only shows milage? Is it a case of waiting for the app to update. Only signed up a few hours ago?

Looks like something change in the 2019 leaf, here take a look at this and the following few messages.

BTW, I have a 2015 leaf which uses a different app.

Sorry I saw that but just assumed it had been merged or something with the integration. I’ll take a look at that now! Thanks for that :grinning:

Today not works. With “Nissan EV” app I can connect and update data of the car, but the integration not works. I touch nothing on configuration:

nissan_leaf:
  username: "XXXXXXXXXXXX"
  password: "XXXXXXXXXXXX"
  region: "NE"
  update_interval:
    hours: 1
  update_interval_charging:
    minutes: 5
  update_interval_climate:
    minutes: 5

This is error log:

2020-11-12 15:20:59 DEBUG (SyncWorker_2) [homeassistant.components.nissan_leaf] Logging into You+Nissan...

2020-11-12 15:21:01 ERROR (SyncWorker_2) [homeassistant.components.nissan_leaf] An unknown error occurred while connecting to Nissan: <class 'pycarwings2.pycarwings2.CarwingsError'>

I’ve a 2016 Leaf, the component works perfectly until yesterday.

By(t)e

1 Like

I added:

    pycarwings2: debug

to logs configuration and this is the log:

2020-11-13 16:57:47 DEBUG (SyncWorker_5) [homeassistant.components.nissan_leaf] Logging into You+Nissan...

2020-11-13 16:57:47 DEBUG (SyncWorker_5) [pycarwings2.pycarwings2] invoking carwings API: https://gdcportalgw.its-mo.com/api_v190426_NE/gdc/InitialApp_v2.php

2020-11-13 16:57:47 DEBUG (SyncWorker_5) [pycarwings2.pycarwings2] params: {

"RegionCode": "NE",

"custom_sessionid": "",

"initial_app_str": "9s5rfKVuMrT03RtzajWNcA",

"lg": "en-US"

}

2020-11-13 16:57:48 DEBUG (SyncWorker_5) [pycarwings2.pycarwings2] Response HTTP Status Code: 200

2020-11-13 16:57:48 DEBUG (SyncWorker_5) [pycarwings2.pycarwings2] Response HTTP Response Body: b'{"status":200,"message":"success","baseprm":"88dSp7wWnV3bvv9Z88zEwg"}'

2020-11-13 16:57:48 DEBUG (SyncWorker_5) [pycarwings2.pycarwings2] invoking carwings API: https://gdcportalgw.its-mo.com/api_v190426_NE/gdc/UserLoginRequest.php

2020-11-13 16:57:48 DEBUG (SyncWorker_5) [pycarwings2.pycarwings2] params: {

"Password": "XXXXXXXXXXXXXXXXXXXXXXX",

"RegionCode": "NE",

"UserId": "XXXXXXXXXX",

"custom_sessionid": "",

"initial_app_str": "9s5rfKVuMrT03RtzajWNcA"

}

2020-11-13 16:57:49 DEBUG (SyncWorker_5) [pycarwings2.pycarwings2] Response HTTP Status Code: 200

2020-11-13 16:57:49 DEBUG (SyncWorker_5) [pycarwings2.pycarwings2] Response HTTP Response Body: b'{"status":404,"message":"INVALID PARAMS"}'

2020-11-13 16:57:49 ERROR (SyncWorker_5) [pycarwings2.pycarwings2] carwings error INVALID PARAMS: 404

2020-11-13 16:57:49 ERROR (SyncWorker_5) [homeassistant.components.nissan_leaf] An unknown error occurred while connecting to Nissan: <class 'pycarwings2.pycarwings2.CarwingsError'>

Can anyone help me?

By(t)e

1 Like

Sorry for flooding. I downgrade to 0.117.5 and works perfectly, so the bug are in 0.117.6

By(t)e