Nissan Leaf Component(s)/Platform

They did put it back in the new cars, so my new Leaf do have the location service again. But there is no support in the HA component for the new API yet.

I think that its due to that the trafic goes via Sms and it was a expensive solution, especially when we all requested the location every 15 min or so.

Wait wut, traffic goes via SMS from the car to the Nissan servers? Any source?

Well, how else would it get there? :wink:

It’s either that or 2G.

I don’t have any official sources on this.
But a swedish guy did som tests and the only way to get the Nissan Leaf to report Charging state in somewhat reasonble time line, was to ask every 5 minutes. Then it didn’t go down in sleep.

I have an automation that will poll 30 seconds after polling, using an additional input_boolean. Been running for weeks now without issue.

- action:
  - entity_id: input_boolean.leaf_repeat
    service: input_boolean.turn_on
  - delay: 00:00:30
  - service: nissan_leaf.update
    data:
      vin: 'XXXXXXX123456789'             # replace
  - delay: 00:10:00
  - entity_id: input_boolean.leaf_repeat
    service: input_boolean.turn_off
  alias: Leaf Double Take
  condition:
    - condition: state
      entity_id: input_boolean.leaf_repeat
      state: 'off'
  id: '4896215945484'
  trigger:
  - entity_id: sensor.leaf_updating
    platform: state
    to: 'False'

and the input_boolean

input_boolean:
  leaf_repeat:
    name: Leaf Repeat
    initial: off
    icon: mdi:leaf

EDIT: Here is the sensor missed from the original post.

  - platform: template
    sensors:
      leaf_updating:
        friendly_name: 'Leaf Update Status'
        value_template: "{{ state_attr('sensor.CHANGEME_charge', 'update_in_progress') }}"

I would love to try this, but I am too new to understand this 100%.

How does “sensor.leaf_updating” figure into this? Is that based on a sensor-template, or is that what you set when you manually or by automation check for update?

Thanks in advance!

You’re right, I missed that, it is indeed another sensor, here it is, just change the necessary parts.

  - platform: template
    sensors:
      leaf_updating:
        friendly_name: 'Leaf Update Status'
        value_template: "{{ state_attr('sensor.CHANGEME_charge', 'update_in_progress') }}"
  

Hello all.
I’m owing a 2019 Nissan Leaf and as a noob, I tried to follow all thoses config files but without succes. Are those files ok for my 2019 car ?
I allready put the files in “custom-components/nissan-leaf”, copy the script, include the sensor and nissan_leaf in config yaml but… no success.
Someone could write a step by step how to in order to point my mistake ?

No one to help me ? Really ?

Just doesnt work for any newer than may -19.

Someone has started developing a >May-19 Leaf component, but the development unfortunately stalled.

https://github.com/mitchellrj/kamereon-python

I do have this running as a custom component which ‘works’ however it has an OAUTH timeout issue which I cannot quite figure out as not able to tell if it’s using the built-in HASS OAUTH schema and how to have it automatically renew. My Python skills are far too basic to adapt this, but all the hard work of the extracting data from the API to HASS is done.

2 Likes

This is great, I’ve missed this component since I changed to a newer Leaf, let’s encourage the developer to continue!

@mitsumaui

How did you actually set this up in HA? The installation of the custom component I’m onboard with, but what config are you using to provide user-name and password?

i have exactly the same issue. i hope somebody hass the solution

update

sorry made an typo i now have it in hass on tuesday i get my leaf so i can try if i then have the new sensors

Great !
Can you write a “how to” as you say that you have install this as a custom component ?
(noob here…)
Thanks

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.