Nissan Leaf Component(s)/Platform

Yeah I guess that is the problem, I get a message in the app that says the client has been blocked by nissan for all NA.

Hi, it seems that people are only integrating Nissan Leaf’s into Home Assistant?
We just got our Nissan Ariya and it use the Nissan Connect Services app that I can’t find a way to integrate into Home Assistant at this moment.
Have anyone succeeded with this?
I believe newer Nissans all use this newer service?

I’m using the new nissan leaf mqtt integration. Who’s using this one to? And how does your dashboard look like.

I checked out your Github repo and it looks like you’ve made some good progress with the Leaf Charge %, Plugged In State, Range, Charging Status, and Climate Control components. It’s great that you’ve included notes on the Region, Nissan Connect, and Interval settings, which will be helpful for anyone wanting to try out your component. I’ll be following your progress, and I’m sure other Leaf enthusiasts will be interested too. Speaking of which, if you’re into Nissans, you should take a look at this Nissan Silvia buying guide I found - it’s got some great tips and tricks for anyone looking to get one.

Hi,
I been using Leaf2MQTT for a while now and it has worked just fine.

After updating to version 45 or if it was when I updated to Home Assistant Core: 2023.3.1 I get the following error below. Any one else seen this?

[21:24:37] INFO: Setting environment variables…
Done.
[21:24:40] INFO: Starting leaf2mqtt…
WARNING: 2023-03-05 21:24:47.536059: main: Could not execute request.

Can anyone please confirm if the Nissan Leaf component works at all?

Which one?
Or what year is your car?

I’m using the old carwings component and it’s working fine.

Anyone else having issues with this integration. For a few weeks now I’ve not been getting data, occasionally it would on a restart, but not every time. Lately it’s not working at all.

The car is a 2015 and it’s been working for a few years.

I have the debug log below if anyone can help out, thanks.

2023-07-30 19:15:07.722 DEBUG (SyncWorker_7) [homeassistant.components.nissan_leaf.sensor] Adding sensors for vin=SJNFAAZE0U6025560
2023-07-30 19:15:07.873 DEBUG (SyncWorker_8) [homeassistant.components.nissan_leaf.switch] Adding switch for vin=SJNFAAZE0U6025560
2023-07-30 19:15:07.943 DEBUG (SyncWorker_5) [homeassistant.components.nissan_leaf.binary_sensor] Adding binary_sensors for vin=SJNFAAZE0U6025560
2023-07-30 19:15:07.967 DEBUG (MainThread) [homeassistant.components.nissan_leaf] Registered LeafBatterySensor integration for VIN SJNFAAZE0U6025560
2023-07-30 19:15:07.968 DEBUG (MainThread) [homeassistant.components.nissan_leaf.sensor] Registered LeafRangeSensor integration with Home Assistant for VIN SJNFAAZE0U6025560
2023-07-30 19:15:07.969 DEBUG (MainThread) [homeassistant.components.nissan_leaf.sensor] Registered LeafRangeSensor integration with Home Assistant for VIN SJNFAAZE0U6025560
2023-07-30 19:15:07.970 DEBUG (SyncWorker_6) [homeassistant.components.nissan_leaf.button] Adding button for vin=SJNFAAZE0U6025560
2023-07-30 19:15:07.997 DEBUG (MainThread) [homeassistant.components.nissan_leaf.switch] Registered LeafClimateSwitch integration with Home Assistant for VIN SJNFAAZE0U6025560
2023-07-30 19:15:08.029 DEBUG (MainThread) [homeassistant.components.nissan_leaf] Registered LeafPluggedInSensor integration for VIN SJNFAAZE0U6025560
2023-07-30 19:15:08.030 DEBUG (MainThread) [homeassistant.components.nissan_leaf] Registered LeafChargingSensor integration for VIN SJNFAAZE0U6025560
2023-07-30 19:15:08.070 DEBUG (MainThread) [homeassistant.components.nissan_leaf] Registered LeafChargingButton integration for VIN SJNFAAZE0U6025560
2023-07-30 19:15:18.720 DEBUG (MainThread) [homeassistant.components.nissan_leaf] Updating Nissan Leaf Data
2023-07-30 19:15:18.721 DEBUG (MainThread) [homeassistant.components.nissan_leaf] Requesting battery update, SJNFAAZE0U6025560
2023-07-30 19:15:20.329 DEBUG (MainThread) [homeassistant.components.nissan_leaf] Battery status check returned nothing
2023-07-30 19:15:22.604 DEBUG (MainThread) [homeassistant.components.nissan_leaf] Waiting 40 seconds for battery update (SJNFAAZE0U6025560) (0)
2023-07-30 19:16:03.858 DEBUG (MainThread) [homeassistant.components.nissan_leaf] Waiting 40 seconds for battery update (SJNFAAZE0U6025560) (1)
2023-07-30 19:16:45.159 DEBUG (MainThread) [homeassistant.components.nissan_leaf] Waiting 40 seconds for battery update (SJNFAAZE0U6025560) (2)
2023-07-30 19:17:26.395 DEBUG (MainThread) [homeassistant.components.nissan_leaf] 3 attempts exceeded return latest data from server
2023-07-30 19:17:27.879 ERROR (MainThread) [homeassistant.components.nissan_leaf] An error occurred parsing response from server
2023-07-30 19:17:27.887 DEBUG (MainThread) [homeassistant.components.nissan_leaf] Next update=2023-07-30 19:17:27.887408+00:00
2023-07-30 19:17:28.078 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 590, in state
numerical_value = int(value)
^^^^^^^^^^
ValueError: invalid literal for int() with base 10: 'unknown'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template_entity.py", line 393, in _async_template_startup
result_info.async_refresh()
File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 976, in async_refresh
self._refresh(None)
File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 1156, in _refresh
self.hass.async_run_hass_job(self._job, event, updates)
File "/usr/src/homeassistant/homeassistant/core.py", line 627, in async_run_hass_job
hassjob.target(*args)
File "/usr/src/homeassistant/homeassistant/helpers/template_entity.py", line 362, in _handle_results
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 742, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 810, in _async_write_ha_state
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 748, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 594, in state
raise ValueError(
ValueError: Sensor sensor.leaf_battery has device class 'battery', state class 'None' unit '%' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: 'unknown' (<class 'str'>)

There have been huge issues with the Nissan services over the last month or so. I couldn’t even use the Nissan app to check charge levels, start aircon, etc.

After so many frustrating emails back and forth with Nissan customer services, they finally got the tech people to reset my account as if I were a new owner and then finally it was working. That was just a few days ago and I haven’t yet tried reconfiguring the Home Assistant integration.

I suggest you try using the Nissan app and see if that’s where your problem is, too.

As of September 2023 this integration is still working for me.

I do seem to be getting less data/ status update less frequently, but it’s the same with the Nissan app, when ever I use the Nissan App appears to have stale info until I do a refresh. That said I did not pay for the subscription when the car became 3 years old. (I might this winter so I get to preheat the car)

I’m new to leaf2mqtt in HA. I get successful a lot of information about the leaf, like battery or climate info, so I think the addon works fine without any error.
But as I try to get the value of the topic “stats” like daily and monthly statistics (TravelTime etc), there are no values. I also connect to mqtt with an gerneric mqtt broker, but there are also no information about stats or trips.

mqttPNG

Is there something wrong or do I have configured something not correct?

Me too. three and a half months to delete and recreate an account. :triumph:

By(t)e

Did it help to re-create the account?

Yes. I am now fully up and running again, able to monitor charge, start the aircon, etc from Home Assistant.

It was painful dealing with Nissan though and took several attempts but once their app was working, the regular home assistant Leaf integration worked, too.

Thank you for the update. Then I will try the same. The service on our old Leaf on the european server is working now and then - mostly not :frowning:

It seems that Nissan has changed the authentication to connect to their servers, which is breaking the Home Assistant integration. Over on the HA Node Red discussion a solution has been posted, but I’m not sure how we could implement that here. Could anyone shed any light on this?

See here: API stopped working: "The requested URL /api_v210707_NE/gdc/InitialApp_v2.php was not found on this server." · Issue #46 · filcole/pycarwings2 · GitHub

  1. SSH to HAOS
  2. docker exec -it homeassistant bash
  3. sed -i ‘s/api_v210707_/api_v230317_/g’ /usr/local/lib/python3.12/site-packages/pycarwings2/pycarwings2.py
  4. I restarted HAOS (I do not know if it is mandatory)
    and it is working again.

By(t)e

2 Likes

Thanks for this. I’ve installed the Terminal add-on and successfully connected from my PC using Putty and logged in as root, with the settings for unprotected access. However, I am getting an error message:
-bash: docker: command not found

I went back to the forum that is linked to and I see that the command is intended to modify a file. However in my installation of Home Assistant the file isn’t in the directory that is referenced in the command. I’ve been exploring directories through the terminal and cannot find where the pycarwings2.py file is stored and I just cannot find a post describing the directory structure!

Any idea where I would find the pycarwings file within my Home Assistant directory structure, please!

It depends on the type of installation of your Home Assistant instance.
In my case, I installed HA via VENV, so the file to edit is in:
~/homeassistant/lib64/python3.12/site-packages/pycarwings2/pycarwings2.py

By(t)e

Nissanconnect don’t update value from 2 weeks. Isn’t a component issue, because also the app and website don’t update the SOC value.
Do you find any problem in last days?

By(t)e