Nissan Leaf Component(s)/Platform

editing the pycarwings2 file hadn’t fixed it for me. all very strange.

Thats what i mean, that doesn’t work for me anymore either.

i know it seems stupid, but did you try logging into the nissan website?

Good point, that stopped working as well. I get username/password invalid in the app, which is probably no indication of the actual issue, as those my usernames and password have not been changed and worked before.
So this might just be the NissanConnect EV service itself that is broken.

I had to login to NissanConnect EV website, (re)select the free EV service subscription, confirm the ‘legal stuff’ and after that it works again in HA.

1 Like

i didn’t have to do any of that - it just started working itself after I logged into the website

Latest HA patch meant having to modify the pycarwings user agent again… integration is back working again now though

Hi Mitsunami,

Is this still working for you? I’m trying to set it up at the moment on the latest version of HA and not having much luck. I won’t post logs as if this is broken for you I guess it’s broken for everyone.

Hi ronan!

I stopped using the kamereon custom_component because it did not handle OAuth ticket refreshes and would require regular restarts of home-assistant to reconnect. The developer has unfortunately stopped maintaining the project, so have moved onto using leaf2mqtt

1 Like

This is great stuff, thank you.

I’m probably missing something, but I can’t get the climate control to work.
The documentation uses a sensor for target temperature taken from leaf/XXXXXSOMEXVINXXXXX/command/climateTargetTempC, but I never receive that topic. It isn’t listed as a status in the readme either.
The value is available in the official app and My Leaf.
Any ideas?

The fix for the user agent issue was just merged into pycarwings2

Hey - Good catch!

As far as I can tell, the target temperature for the Leaf is a local variable - and not stored on Nissan servers. So I created a MQTT based sensor to store the value - but you found my typo where I did not have a consistent topic across the sensor / MQTT climate component!

Just updated the documentation, but it should per this now: Leaf2MQTT Climate Integration
Hope that works / stores better for you.

It’s not perfect unfortunately. Ideally it should enter an update loop to check the climate has started and publish the running status. For now I have a button in Home-Assistant to publish the update command to ensure it’s running via a script. like this:

leaf_update_climate:
  alias: Leaf Update Climate
  sequence: 
    - service: mqtt.publish
      data:
        topic: leaf/XXXXXSOMEXVINXXXXX/command/climate
        payload: "update"

I’ll add to issues when I get a chance to look at it!

1 Like

Thank you, will test it later tonight.
@mitsumaui update: the climate control is workings great now! :+1:

Wouldn’t it also be possible, as a workaround, to make an simple automation that triggers on the MQTT-command for climate start, delays for a minute or so, and issue an update? Possibly with a small loop (5 times or so) that terminates when expected condition is reached.

For users of CarWings, you’ll be pleased to hear that @filcole has updated pycarwings2 to V.2.11 which I should appear in Core Update 21.8.7. That should fix the problem we’ve been having and the reason we’ve had to edit our configs.

YAY!

4 Likes

This might be an issue on my end, but with Leaf2MQTT, I am not seeing any climate topic. I think I am seeing all the other topics and can start and stop the climate ( publishing to leaf/VIN/command/climate) but even publishing an update I don’t ever see the climate topic.

Thanks for all your work on this.

Thanks for the heads up.
I must admit I forgot I even asked this question so apologies in getting back to you, your answer is appreciated!

is this not working again? I have no entity anymore since the last update.

I usually fix by editing the pycarwings2.py as mentioned here before but the file seems to be empty now

docker container exec -it homeassistant bash

vi /usr/local/lib/python3.8/site-packages/pycarwings2/pycarwings2.py

go at line 125, press i

then

then replace:at line 125:headers={“User-Agent”: “pycarwings2/2.10”}with this:headers={“User-Agent”: “”}

update: just realised that its changed to python3.9…

Should be working fine with no alterations or editing.

Just done a restart on my HA (coincidentally) and it’s fine.

Nissan changed their API endpoint a couple of days ago, so the Leaf integration has stopped working.
I have created a PR for pycarwings2, but until it is merged this can be fixed manually by editing /usr/local/lib/python3.9/site-packages/pycarwings2/pycarwings2.py and changing the URL on line 75 to https://gdcportalgw.its-mo.com/api_v210707_NE/gdc/.

5 Likes

Cheers @Skeletorjus Works great for me.

Paging @filcole … Would you be a dear and do the necessary please?