Nissan CarWings Updates

I’m currently using the Nissan Leaf YAML configuration / hack to get it into my HA.

While the integration itself does work, it’s completely useless since it refuses to update on its own. Even after using the update interval settings and changing them just to see, nothing ever updates unless I reboot HA completely every time I want an update.

What am I missing?

You could try updating it via an automation, the instructions are on the page you linked.

The instructions on how to do that are pretty vague and I’ve tried pasting it in my YAML a few times and it either triggers a safe mode boot up or gets ignored completely.

Can you possibly post a dummy version the way you interpret it to see if it matches mine?

Don’t just copy/paste, try making it with the automation editor in the UI. It’s really easy.
Trigger on time pattern and insert /1in hours (or whatever interval you want).
As an action you call the service nissan_leaf.update with your VIN-number as service data.
Quick tip, you can get the VIN by template like this:
vin: '{{ states.sensor.yourcarhere_charge.attributes.vin }}'

You can also check if the service working by testing it under developer tools.

I have noticed that the service sometimes needs to run twice to get all the values from the server. I have solved this by creating a script that sends another update-command as soon as the first finishes.

Here’s the script that I use as a workaround. It utilizes a binary sensor that is true when the car is actively updating, and false when it’s not. After sending an update command it waits for the integration to say that it’s in the process of updating. After the update is done, it sends another command to update.

You can then call the script by automation.

Again I’d advice you to try to recreate the script in the editor in UI.

Binary sensor:

binary_sensor:
  - platform: template
    sensors:
      car_updating:
        friendly_name: Leaf updating
        value_template: >-
            {{ is_state_attr('binary_sensor.yourcar_charging_status', 'update_in_progress', true)
               or is_state_attr('binary_sensor.yourcar_plug_status', 'update_in_progress', true)
               or is_state_attr('sensor.yourcar_charge', 'update_in_progress', true)
               or is_state_attr('sensor.yourcar_range', 'update_in_progress', true)
               or is_state_attr('sensor.yourcar_range_ac', 'update_in_progress', true) }}
        icon_template: mdi:reload-alert

script:

update_leaf:
  alias: Update Leaf
  mode: single
  sequence:
  - service: nissan_leaf.update
    data:
      vin: '{{ states.sensor.yourcar_charge.attributes.vin }}'
  - wait_template: '{{ is_state(''binary_sensor.car_updating'', ''on'') }}'
    timeout: 00:01:00
  - wait_template: '{{ is_state(''binary_sensor.car_updating'', ''off'') }}'
    timeout: 00:06:00
  - service: nissan_leaf.update
    data:
      vin: '{{ states.sensor.yourcar_charge.attributes.vin }}'

Here’s mine, it updates as usual, then waits for 30 seconds and polls a second time.

Linky Dink

Sorry for the delay in response in me trying to take your advice. Unfortunately I have a new issue.

Due to a complete loss of my HA setup I had running on a Pi 3 and 16GB card (since this was my test boat) I had to re-setup the whole thing and now this integration doesn’t work at all. Can’t get any entities to load and no errors either.

I have everything setup and updated to current and my home back together on a new Ras Pi 4 (2GB) and a better U3 64GB SD card and it runs so much better!

Any known issues or guidance on why this doesn’t work at all anymore?

There was a change in 0.118 that broke the integration. See this issue for information.