Newbie question - how do I install a community add-on, Nissan Leaf

Hello,

I have same problem. no entity existing.

No logs, no yaml = no issue. Please people read the posting guidelines.

Hi
here is the yaml:

nissan_leaf:

username: XXX

password: XXXX

region: NE

update_interval:

minutes: 10

update_interval_charging:

minutes: 15

update_interval_climate:

minutes: 5

force_miles: true

sensor:

  • platform: template

    sensors:

    leaf_charge_state:

    value_template: "Charging: {{ states('binary_sensor.LEAF_charging_status') }}"
    

    leaf_charge_message:

    value_template: "{{ states('sensor.LEAF_charge') }}% - {{ states('sensor.LEAF_range') }} miles ({{ states('sensor.LEAF_range_ac') }} with AC)"
    
    icon_template: "{%- if states.sensor.LEAF_charge.state >= '95' %}mdi:battery{%- elif states.sensor.LEAF_charge.state == '100' %}mdi:battery{%- elif states.sensor.LEAF_charge.state <= '15' %}mdi:battery-outline{% else %}mdi:battery-{{(states.sensor.LEAF_charge.state|float / 10)|round*10}}{%- endif %}"
    

    leaf_range_ac:

    value_template: "{{ states('sensor.LEAF_range_ac') }} miles with AC"
    

    leaf_range:

    value_template: "{{ states('sensor.LEAF_range') }} miles"
    

    leaf_battery:

    unit_of_measurement: '%'
    
    value_template: "{{ states('sensor.LEAF_charge') }}"
    
    icon_template: "{%- if states.sensor.LEAF_charge.state >= '95' %}mdi:battery{%- elif states.sensor.LEAF_charge.state == '100' %}mdi:battery{%- elif states.sensor.LEAF_charge.state <= '15' %}mdi:battery-outline{% else %}mdi:battery-{{(states.sensor.LEAF_charge.state|float / 10)|round*10}}{%- endif %}"
    

the card:

  • theme: Backend-selected
    title: leaf
    path: leaf
    icon: mdi:car
    badges: []
    cards:
    • type: vertical-stack
      cards:
      • type: grid
        columns: 4
        cards:
        • type: gauge
          min: 0
          max: 100
          name: cAR bATT
          entity: sensor.LEAF_charge
        • type: gauge
          entity: sensor.grid_fossil_fuel_percentage
          unit: ‘%’
          max: 100
          min: 0
          name: Fos. Fuel
          severity:
          green: 0
          yellow: 10
          red: 50
        • type: custom:gap-card
        • type: custom:gap-card
        • type: button
          entity: button.start_LEAF_charging
          name: Charge now
          icon: mdi:power
          hold_action:
          action: none
          tap_action:
          action: call-service
          service: nissan_leaf.start_charge
          service_data:
          vin: SJNFAAZE0U6023145
          target: {}
        • type: button
          show_icon: true
          entity: switch.LEAF_climate_control
          icon: mdi:fan
          name: Preheat car
          hold_action:
          action: none
        • type: custom:gap-card
        • type: markdown
          content: >-
          Leaf updating:
          {{states.sensor.LEAF_range.attributes.update_in_progress}}
          square: true
      • type: grid
        columns: 2
        cards:
        • type: glance
          entities:
          • entity: binary_sensor.LEAF_plug_status
          • entity: binary_sensor.LEAF_charging_status
            show_name: false
            show_state: true
        • type: entities
          entities:
          • type: attribute
            entity: sensor.LEAF_charge
            name: Last
            icon: mdi:car
            attribute: updated_on
            format: relative
          • type: attribute
            entity: sensor.LEAF_charge
            name: Next
            icon: mdi:car
            attribute: next_update
            format: relative
            square: false
    • type: entities
      entities:
      • sensor.leaf_battery

log:
Logger: homeassistant.helpers.template_entity
Source: helpers/template_entity.py:312
First occurred: 5:28:13 PM (2 occurrences)
Last logged: 5:28:13 PM

  • Template loop detected while processing event: <Event state_changed[L]: entity_id=sensor.leaf_range_ac, old_state=<state sensor.leaf_range_ac=unknown miles with AC; friendly_name=leaf_range_ac @ 2022-07-12T17:28:12.303621+02:00>, new_state=<state sensor.leaf_range_ac=unknown miles with AC miles with AC; friendly_name=leaf_range_ac @ 2022-07-12T17:28:13.704359+02:00>>, skipping template render for Template[{{ states(‘sensor.LEAF_range_ac’) }} miles with AC]
  • Template loop detected while processing event: <Event state_changed[L]: entity_id=sensor.leaf_range, old_state=<state sensor.leaf_range=unknown miles; friendly_name=leaf_range @ 2022-07-12T17:28:12.308333+02:00>, new_state=<state sensor.leaf_range=unknown miles miles; friendly_name=leaf_range @ 2022-07-12T17:28:13.709817+02:00>>, skipping template render for Template[{{ states(‘sensor.LEAF_range’) }} miles]

That is not how to post yaml.

Where can I find the guideline ?
Can you please speak clearly , i am new here

Sorry, I thought everyone was referred to it when they joined the forum. How to help us help you - or How to ask a good question

nissan_leaf:
  username: XXX
  password: XXX
  region: NE
  update_interval:
    minutes: 10
  update_interval_charging:
    minutes: 15
  update_interval_climate:
    minutes: 5
  force_miles: true
  
sensor:
  - platform: template
    sensors:
      leaf_charge_state:
        value_template: "Charging: {{ states('binary_sensor.LEAF_charging_status') }}"
      leaf_charge_message:
        value_template: "{{ states('sensor.LEAF_charge') }}% - {{ states('sensor.LEAF_range') }} miles ({{ states('sensor.LEAF_range_ac') }} with AC)"
        icon_template: "{%- if states.sensor.LEAF_charge.state >= '95' %}mdi:battery{%- elif states.sensor.LEAF_charge.state == '100' %}mdi:battery{%- elif states.sensor.LEAF_charge.state <= '15' %}mdi:battery-outline{% else %}mdi:battery-{{(states.sensor.LEAF_charge.state|float / 10)|round*10}}{%- endif %}"
      leaf_range_ac:
        value_template: "{{ states('sensor.LEAF_range_ac') }} miles with AC"
      leaf_range: 
        value_template: "{{ states('sensor.LEAF_range') }} miles"
      leaf_battery:
        unit_of_measurement: '%'
        value_template: "{{ states('sensor.LEAF_charge') }}"
        icon_template: "{%- if states.sensor.LEAF_charge.state >= '95' %}mdi:battery{%- elif states.sensor.LEAF_charge.state == '100' %}mdi:battery{%- elif states.sensor.LEAF_charge.state <= '15' %}mdi:battery-outline{% else %}mdi:battery-{{(states.sensor.LEAF_charge.state|float / 10)|round*10}}{%- endif %}"  

is it better now ?

Hi. So firstly, apologies for forgetting that I have installed some custom cards which are in use in the dashboard. So maybe it’s best to simplify things and take it a step at a time:

  • Ignore (or delete completely) the part of the dashboard with the LEAF stuff. You can add the controls that you need later, without all the complexity.
  • See how far you can get debugging it yourself:
    • Firstly in the developer tools click on Check Configuration to see if some error has slipped into the YAML
    • If that’s all OK, then use the ‘States’ tab to see if you can find your new LEAF variables and work out if they are getting values from the Nissan servers. Tip: use the ‘Filter entities’ option to filter just entities with the right kind of names (eg. ‘Leaf’)
    • Also look at the error logs. That’s under Settings → System → Logs and then you will probably need to Load Full Logs. Beware, that last bit can take a long time. Look through the logs or apply filtering to see if you are getting an error from the Nissan servers.

It can take quite a long time for the Nissan servers to provide updates, so you have to be patient at times with this. Also, everyone says that the Nissan servers are temperamental, so sometimes it really isn’t your code that’s at fault. When I was trying to get it all working I used a third party app on my phone, QuickLeaf that I used to check whether or not the Nissan APIs were working and that I had got all my login details correct (!). If the QuickLeaf app on your phone can poll the Nissan servers for the battery status then HA should be able to; conversely, if QuickLeaf cannot get a response, then you’re better waiting until Nissan is playing nicely again!

Let me know how you get on.

A tip as well, ha entity names are always lower case, so nothing will EVER be named sensor.LEAF_charge.

I found it from the app you gave me quickLeaf I used the email to sign in on HA it should be the user name now it works fine. Many thanks

I want to have to change the unit from miles to km
is it just to change in the yaml from miles to km ?

thanks

It is change force miles to falce to get km

Thanks all

Worth a try! Let us know if it works.

everything works now

many thanks

1 Like

Hi

I’m very new to HA & I’m interested in getting this Nissan integration working.
You have posted 2 sections of yaml. The first section I think should be placed in the configuration.yaml file in the /homeassistant folder. Can you tell me where the second section of yaml should be placed please?

Thanks Keith

Thanks Nick,
I have actually already read that document and many others.
My question was really aimed at Phil and was specifically “where should the second section of yaml that Phil supplied be placed”?
I.e. what is the name of the file and what folder is it in?
For me, it gives all sorts of errors if I place it in /config/configuration.yaml.
If I’m told that’s where it should be placed, I will trouble shoot it. But there’s no point me troubleshooting if the code should be in another file.

Thanks again Keith

It is an excerpt from the frontend configuration. In a dashboard click the overflow menu and choose edit dashboard. Then click the overflow menu again choose raw configuration editor. Voila.

Hi Keith. Nick is exactly right; this is taken directly from the code editor of a dashboard. However, if you are new to Home Assistant then you might find it more useful building your dashboard up one button at a time, rather than wrestling with someone else’s code in YAML. It is getting a bit off topic, but you’re welcome to message me directly if you’d like some pointers.

Thanks Nick. That has sorted it for me.

1 Like