Nissan Leaf Component(s)/Platform

@Abertil Thanks, sorted that.

I will check the % is correct later as I’m charging the car atm, which leads me to discover that the ‘Charging Status’ isn’t changing while the car is charging.

Here’s the log.

2019-01-26 21:26:25 DEBUG (SyncWorker_11) [pycarwings2.pycarwings2] invoking carwings API: https://gdcportalgw.its-mo.com/api_v181217_NE/gdc/BatteryStatusRecordsRequest.php
2019-01-26 21:26:25 DEBUG (SyncWorker_11) [pycarwings2.pycarwings2] params: {
   "DCMID": "201399055139",
   "RegionCode": "NE",
   "TimeFrom": "2018-11-25T22:03:22Z",
   "VIN": "SJNFAAZE0U6025560",
   "custom_sessionid": "eURCHWWLn3IVQXbiX1k8FgRi+eVe40G7jbaaeiPmdG59JwwGI2gFFKO/tXh8V+XJNMkLJRmdUo5WXxoZC20ciY1HRDi+mdC2MJr15EBmLRNg==",
   "initial_app_strings": "geORNtsZe5I4lRGjG9GZiA",
   "lg": "en_GB",
   "tz": "Europe/Paris"
}
2019-01-26 21:26:28 DEBUG (SyncWorker_11) [pycarwings2.pycarwings2] Response HTTP Status Code: 200
2019-01-26 21:26:28 DEBUG (SyncWorker_11) [pycarwings2.pycarwings2] Response HTTP Response Body: b'{"status":200,"BatteryStatusRecords":{"OperationResult":"START","OperationDateAndTime":"26-Jan-2019 22:22","BatteryStatus":{"BatteryChargingStatus":"NORMAL_CHARGING","BatteryCapacity":"11","BatteryRemainingAmount":"6","BatteryRemainingAmountWH":"","BatteryRemainingAmountkWH":""},"PluginState":"CONNECTED","CruisingRangeAcOn":"66024.0","CruisingRangeAcOff":"69168.0","TimeRequiredToFull200_6kW":{"HourRequiredToFull":"3","MinutesRequiredToFull":"0"},"NotificationDateAndTime":"2019\\/01\\/26 21:22","TargetDate":"2019\\/01\\/26 21:22"}}'
2019-01-26 21:26:30 DEBUG (SyncWorker_1) [pycarwings2.pycarwings2] invoking carwings API: https://gdcportalgw.its-mo.com/api_v181217_NE/gdc/BatteryStatusCheckRequest.php
2019-01-26 21:26:30 DEBUG (SyncWorker_1) [pycarwings2.pycarwings2] params: {
   "DCMID": "201399055139",
   "RegionCode": "NE",
   "UserId": "",
   "VIN": "SJNFAAZE0U6025560",
   "custom_sessionid": "eURCHWWLn3IVQXbiX1k8FgRi+eVe40G7jbaaeiPmdG59JwwGI2gFFKO/tXh8V+XJNMkLJRmdUo5WXxoZC20ciY1HRDi+mdC2MJr15EBmLRNg==",
   "initial_app_strings": "geORNtsZe5I4lRGjG9GZiA",
   "lg": "en_GB",
   "tz": "Europe/Paris"
}
2019-01-26 21:26:32 DEBUG (SyncWorker_1) [pycarwings2.pycarwings2] Response HTTP Status Code: 200
2019-01-26 21:26:32 DEBUG (SyncWorker_1) [pycarwings2.pycarwings2] Response HTTP Response Body: b'{"status":200,"userId":"xxxxxxxxx","vin":"SJNFAAZE0U6025560","resultKey":"DfP6yAlDKjAGx0cLSWWb9MeOeMmbPcB3i0Z6aljKuK1Hk33d0z"}'
2019-01-26 21:27:02 DEBUG (SyncWorker_7) [pycarwings2.pycarwings2] invoking carwings API: https://gdcportalgw.its-mo.com/api_v181217_NE/gdc/BatteryStatusRecordsRequest.php
2019-01-26 21:27:02 DEBUG (SyncWorker_7) [pycarwings2.pycarwings2] params: {
   "DCMID": "201399055139",
   "RegionCode": "NE",
   "TimeFrom": "2018-11-25T22:03:22Z",
   "VIN": "SJNFAAZE0U6025560",
   "custom_sessionid": "eURCHWWLn3IVQXbiX1k8FgRi+eVe40G7jbaaeiPmdG59JwwGI2gFFKO/tXh8V+XJNMkLJRmdUo5WXxoZC20ciY1HRDi+mdC2MJr15EBmLRNg==",
   "initial_app_strings": "geORNtsZe5I4lRGjG9GZiA",
   "lg": "en_GB",
   "tz": "Europe/Paris"
}
2019-01-26 21:27:04 DEBUG (SyncWorker_7) [pycarwings2.pycarwings2] Response HTTP Status Code: 200
2019-01-26 21:27:05 DEBUG (SyncWorker_7) [pycarwings2.pycarwings2] Response HTTP Response Body: b'{"status":200,"BatteryStatusRecords":{"OperationResult":"START","OperationDateAndTime":"26-Jan-2019 22:22","BatteryStatus":{"BatteryChargingStatus":"NORMAL_CHARGING","BatteryCapacity":"11","BatteryRemainingAmount":"6","BatteryRemainingAmountWH":"","BatteryRemainingAmountkWH":""},"PluginState":"CONNECTED","CruisingRangeAcOn":"66024.0","CruisingRangeAcOff":"69168.0","TimeRequiredToFull200_6kW":{"HourRequiredToFull":"3","MinutesRequiredToFull":"0"},"NotificationDateAndTime":"2019\\/01\\/26 21:22","TargetDate":"2019\\/01\\/26 21:22"}}'
2019-01-26 21:27:35 DEBUG (SyncWorker_6) [pycarwings2.pycarwings2] invoking carwings API: https://gdcportalgw.its-mo.com/api_v181217_NE/gdc/BatteryStatusRecordsRequest.php
2019-01-26 21:27:35 DEBUG (SyncWorker_6) [pycarwings2.pycarwings2] params: {
   "DCMID": "201399055139",
   "RegionCode": "NE",
   "TimeFrom": "2018-11-25T22:03:22Z",
   "VIN": "SJNFAAZE0U6025560",
   "custom_sessionid": "eURCHWWLn3IVQXbiX1k8FgRi+eVe40G7jbaaeiPmdG59JwwGI2gFFKO/tXh8V+XJNMkLJRmdUo5WXxoZC20ciY1HRDi+mdC2MJr15EBmLRNg==",
   "initial_app_strings": "geORNtsZe5I4lRGjG9GZiA",
   "lg": "en_GB",
   "tz": "Europe/Paris"
}
2019-01-26 21:27:37 DEBUG (SyncWorker_6) [pycarwings2.pycarwings2] Response HTTP Status Code: 200
2019-01-26 21:27:37 DEBUG (SyncWorker_6) [pycarwings2.pycarwings2] Response HTTP Response Body: b'{"status":200,"BatteryStatusRecords":{"OperationResult":"START","OperationDateAndTime":"26-Jan-2019 22:22","BatteryStatus":{"BatteryChargingStatus":"NORMAL_CHARGING","BatteryCapacity":"11","BatteryRemainingAmount":"6","BatteryRemainingAmountWH":"","BatteryRemainingAmountkWH":""},"PluginState":"CONNECTED","CruisingRangeAcOn":"66024.0","CruisingRangeAcOff":"69168.0","TimeRequiredToFull200_6kW":{"HourRequiredToFull":"3","MinutesRequiredToFull":"0"},"NotificationDateAndTime":"2019\\/01\\/26 21:22","TargetDate":"2019\\/01\\/26 21:22"}}'

Actually, I notice that the Plug Status is ‘true’, so forget that :slight_smile:

However, the car is showing 109% charge :frowning:

1 Like

Hi, 0.86.2 is hell for me with the new naming rules… But I tested it to see if Leaf would work… unfortunately it dont :frowning:
This is the main error, but seems I have other issues as well (more to do with 0.86?)
I am downgrading to 0.84 now.

Error loading custom_components.binary_sensor.nissan_leaf. Make sure all dependencies are installed 
Traceback (most recent call last):
 File "/usr/local/lib/python3.6/site-packages/homeassistant/loader.py", line 117, in _load_file
 module = importlib.import_module(path)
File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/config/custom_components/binary_sensor/nissan_leaf.py", line 9, in <module>
from homeassistant.components.nissan_leaf import (
ModuleNotFoundError: No module named 'homeassistant.components.nissan_leaf'

I’m not the expert here, but the looking at your log it looks like you somehow is missing the main nissan_leaf.py.

Are you running Hass.io or Home Assistant installed some other way? Have you checked that your downloaded files are correct and correctly placed in the folder structure?

Seems that the Nissan server have actually been up for several days without going down now! :grinning:

From what I can see, everything except the Charging switch/sensor is working flawless. But maybe this is due to how I’m using my car, I always have it charge full directly at connecting the cable. Maybe it’s so that I need to have delayed charge setup in the car and trigger the charge manually for it to work?

Quick question, if I toggle the Climitate Control switch, what will be the temperature? I don’t see anywhere to specify that.

Thanks!

You set that using Carwings (unless you have a newer car, in which case you’ll use whatever that is)

5

It seems we don’t have this settings in the 2018, the temperature is set either in the timer programs or we can specify it in the phone app when doing it manually.

Hi all,
I’m running 0.84.6. Anyone got this working with 0.84.6??
I have had a working system connected to nissan for months before the recent troubles.
All I have done is to go here: https://github.com/filcole/home-assistant/tree/nissanleaf, and download the 4 files to HASSIO\config\custom_components. That approach worked last time. But I hope its a quick fix i.e. I did something wrong :slight_smile:

I still see the following error:

Unable to install package pycarwings2==2.7: Failed building wheel for pycryptodome
 python-jose-cryptodome 1.3.2 has requirement pycryptodome<3.4.0,>=3.3.1, but you'll have pycryptodome 
3.7.3 which is incompatible.
pyrebase4 4.2.0 has requirement oauth2client==4.1.2, but you'll have oauth2client 4.0.0 which is 
incompatible.
broadlink 0.9 has requirement pycryptodome==3.4.11, but you'll have pycryptodome 3.7.3 which is 
incompatible.
Command "/usr/local/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-            
sgiruo0a/pycryptodome/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', 
'\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-oh1uhbid/install-record.txt     
--single-version-externally-managed --prefix  --compile --user --prefix=" failed with error code 1 in /tmp/pip- 
install-sgiruo0a/pycryptodome/
You are using pip version 18.0, however version 19.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

US app? This component uses the old API which is global, as only the US (and probably Japan) has the upgraded stuff with the Alexa app, 2018 security features, etc. None of us plebs get that.

A separate component would be needed for the newer API, as that’s out of the scope of this one and would be a total rewrite (and of course, US only)

Hmm, I don’t exactly know what you mean. I am in Canada and I use Nissan Connect EV on my phone for the app. It does not seems to have Alexa integration as far as I can see.

I have alexa integrated with home assistant. Worked perfectly to start climate for my Leaf via routines. “Alexa start car”. That was when the nissan component worked for me in Hass, though :frowning: .

Yeah I think Canada has it too. Other regions don’t have the same app and have a totally different API with a lot less features. We don’t have any way to set the temperature remotely.

Weird, from what I know, Carwings has shut down and was replaced by Nissan Connect for everyone : http://www.mynissanleaf.com/viewtopic.php?t=20576

I never used Carwings on my 2018 and this component works fine anyway. I just need to figure which temperature will be set when I trigger the climate control.

Here’s a timeline to make things a bit clearer:

Leaf released: CarWings released with it

30kwh Leaf released: CarWings “replaced” with NissanConnect for EVs. Car software on older cars stayed the same, same API behind the scenes though IIRC. NissanConnect was basically just a rebrand as it used the same API behind the scenes and had all the same features, even working with the older cars. They may have updated the API slightly but it’s not a rewrite of it.

2018 Leaf released: Newer “2018” API that was pretty much a rewrite with security features, Alexa, apparently setting the temperature remotely, etc introduced in select regions. The older CarWings/NC API still works in all regions but Nissan replaced their app in the regions with the 2018 API compatible app.

We don’t have the same app over in the UK that you have, and don’t have the option even on 2018s to set the temperature remotely. As @RoadkillUK showed we set ours via the screen.

Thanks @BenWoodford for the recap! I was not aware of these subtle change between the API, just between the switch from CarWings to Nissan Connect.

Yeah, the charging sensor isn’t working perfectly. Something to look into. Some more comments by reviewer(s) on the pull request require to integration to be restructured so some way before this is integrated to home assistant proper.

Hi again.

just updated to 86.4 and now I have less errors, but errors non the less:
1.
carwings error INVALID PARAMS: -2010
2.
An unknown error occurred while connecting to Nissan: <class ‘pycarwings2.pycarwings2.CarwingsError’>

Anyone that knows what I can do?

This… omg, so much work just because I did not read this properly…
I got it working now :smiley:

@LudoErgoSum What did you change to get it working?