Nissan Leaf Component(s)/Platform

Had to go back to scripts. The service call would not accept the vin.

Some more color fixes:

Right hand botom icon shows Climate control status and starts the climate control ‘on click’
Botom middle icon requests new data from the car.
Left hand botom icon shows charging status and will start charging ‘on click’

Configuration:

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

sensor: 
  - platform: template
    sensors:
      leaf_state:
        value_template: "Laden: {{ states('binary_sensor.leaf1mich_charging_status') }}"
      leaf_range_ac: 
        value_template: "A/C actieradius: {{ states('sensor.leaf1mich_range_ac') }}"
      leaf_range: 
        value_template: "Actieradius: {{ states('sensor.leaf1mich_range') }}"
      leaf_battery:
        friendly_name: "Accu"
        unit_of_measurement: '%'
        value_template: "{{ states('sensor.leaf1mich_charge') }}"
        icon_template: "{%- if states.sensor.leaf1mich_charge.state >= '95' %}mdi:battery{%- elif states.sensor.leaf1mich_charge.state == '100' %}mdi:battery{%- elif states.sensor.leaf1mich_charge.state <= '15' %}mdi:battery-outline{% else %}mdi:battery-{{(states.sensor.leaf1mich_charge.state|float / 10)|round*10}}{%- endif %}"

script:
  leaf_charge:
    alias: Laden starten
    sequence:
      - service: nissan_leaf.start_charge
        data:
          vin: !secret nissan_leaf_vin
  leaf_update:
    alias: Update status
    sequence:          
      - service: nissan_leaf.update
        data:
          vin: !secret nissan_leaf_vin

Lovelace:

elements:
  - entity: binary_sensor.leaf1mich_charging_status
    icon: 'mdi:ev-station'
    style:
      background-color: 'rgba(0, 0, 0, 0.3)'
      bottom: 0
      font-size: 16px
      left: 0
      line-height: 50px
      padding: 0 8px
      transform: initial
      width: 100%
    tap_action:
      action: call-service
      confirmation: false
      service: script.leaf_charge
    type: state-icon
  - entity: sensor.leaf1mich_charge
    icon: 'mdi:reload'
    style:
      bottom: 0
      color: white
      left: 45%
      line-height: 32px
      margin: 0px 0px -3px 0px
      padding: 8px
      transform: initial
    tap_action:
      action: call-service
      confirmation: false
      service: script.leaf_update
    type: state-icon
  - entity: switch.leaf1mich_climate_control
    icon: 'mdi:fan'
    style:
      bottom: 0
      color: white
      line-height: 32px
      margin: 5px 0px -3px 0px
      padding: 8px
      right: 0
      transform: initial
    tap_action:
      action: toggle
      confirmation: false
    type: state-icon
  - entity: binary_sensor.leaf1mich_plug_status
    style:
      '--paper-item-icon-color': 'rgb(25,25,25,1)'
      left: 0
      margin: 25px 25px
      top: 0
    type: state-icon
  - entity: sensor.leaf_range_ac
    style:
      font-size: 12px
      color: 'rgb(25,25,25,1)'
      line-height: 32px
      margin: 1px 35px
      pointer-events: none
      right: 0
      text-shadow: 'rgb(0, 0, 0, 0.2) 0px 0px 2px'
      top: 0
      transform: initial
    type: state-label
  - entity: sensor.leaf_range
    icon: 'mdi:speedometer'
    style:
      '--paper-item-icon-color': 'rgb(25,25,25,1)'
      line-height: 32px
      margin: 5px 5px
      right: 0
      top: 0
      transform: initial
    type: state-icon
  - entity: sensor.leaf_range
    style:
      font-size: 12px
      color: 'rgba(25,25,25,1)'
      line-height: 32px
      margin: 30px 35px
      pointer-events: none
      right: 0
      text-shadow: 'rgb(0, 0, 0, 0.2) 0px 0px 2px'
      top: 0
      transform: initial
    type: state-label
  - entity: sensor.leaf_range
    icon: 'mdi:speedometer'
    style:
      '--paper-item-icon-color': 'rgb(25,25,25)'
      line-height: 32px
      margin: 33px 5px
      right: 0
      top: 0
      transform: initial
    type: state-icon
  - entity: sensor.leaf1mich_charge
    style:
      color: 'rgba(25,25,25,1)'
      font-size: 12px
      line-height: 32px
      margin: 58px 34px
      pointer-events: none
      right: 0
      text-shadow: 'rgb(0, 0, 0, 0.2) 0px 0px 2px'
      top: 0
      transform: initial
    type: state-label
  - entity: sensor.leaf_battery
    style:
      '--paper-item-icon-color': 'rgb(25,25,25,1)'
      margin: 60px 5px
      right: 0
      top: 0
      transform: initial
    type: state-icon
image: /local/images/car/leaf.jpg
type: picture-elements

The image:

3 Likes