Nissan Leaf Component(s)/Platform

Thanks one of the most usefull components in HA!
It was working great for some time with a older version of nissan_leaf module on HASSIO in docker. But with the new integrated module it crashed, and I was unable to get nissan_leaf working. I therefore made a new setup with pure HASSIO on a RPI. Then the new module was working, but after some reboots it is failing like this:

2019-03-24 17:43:21 DEBUG (SyncWorker_8) [homeassistant.components.nissan_leaf] Logging into You+Nissan...
2019-03-24 17:43:21 DEBUG (SyncWorker_8) [pycarwings2.pycarwings2] invoking carwings API: https://gdcportalgw.its-mo.com/api_v181217_NE/gdc/InitialApp.php
2019-03-24 17:43:21 DEBUG (SyncWorker_8) [pycarwings2.pycarwings2] params: {
   "RegionCode": "NE",
   "custom_sessionid": "",
   "initial_app_strings": "geORNtsZe5I4lRGjG9GZiA",
   "lg": "en-US"
}
2019-03-24 17:43:22 DEBUG (SyncWorker_8) [pycarwings2.pycarwings2] Response HTTP Status Code: 200
2019-03-24 17:43:22 DEBUG (SyncWorker_8) [pycarwings2.pycarwings2] Response HTTP Response Body: b'{"status":200,"message":"success","baseprm":"uyI5Dj9g8VCOFDnBRUbr3g"}'
2019-03-24 17:43:22 DEBUG (SyncWorker_8) [pycarwings2.pycarwings2] invoking carwings API: https://gdcportalgw.its-mo.com/api_v181217_NE/gdc/UserLoginRequest.php
2019-03-24 17:43:22 DEBUG (SyncWorker_8) [pycarwings2.pycarwings2] params: {
   "Password": "vVajL1BW+oJG0VYLUFKPbg==",
   "RegionCode": "NE",
   "UserId": "myuserID",
   "custom_sessionid": "",
   "initial_app_strings": "geORNtsZe5I4lRGjG9GZiA"
}
2019-03-24 17:44:06 DEBUG (SyncWorker_8) [pycarwings2.pycarwings2] Response HTTP Status Code: 200
2019-03-24 17:44:06 DEBUG (SyncWorker_8) [pycarwings2.pycarwings2] Response HTTP Response Body: b'{"status":"-2001","message":"INVALID PARAMS"}'
2019-03-24 17:44:06 ERROR (SyncWorker_8) [pycarwings2.pycarwings2] carwings error INVALID PARAMS: -2001
2019-03-24 17:44:06 ERROR (SyncWorker_8) [homeassistant.components.nissan_leaf] An unknown error occurred while connecting to Nissan: <class 'pycarwings2.pycarwings2.CarwingsError'>

Is this because of unstable server at Nissan’s side? Anything I can do?

@BenWoodford With just one Leaf defined, I get one set of states. With the second car added I get another duplicate of the first car (same name,but _2) and i also get the unique name of the second car, also with a _2 dupe.

Car #2 still hasn’t received any charge / range / etc. telemetry, but I’m confident is working to some degree as I can see the VIN reported in some of the sensor responses.

Any help would be greatly appreciated.

When the build in nissan_leaf component fails at a new boot (which i does a lot since Nissan servers are very unstable), will it retry later or is it dead until next boot? Would hope it is retrying… :slight_smile:

No, if it fails on first boot it won’t retry. That’s how a lot of the other components in home assistant work, and normally it’s a good idea because it indicates that something is wrong with the user/password configuration on the HA end… however when the Nissan servers are quite so “not stable” it makes it problematic. I’ll have a look when I have some time about seeing if we can adjust the leaf integration with HA to retry periodically.

Thanks! Would be great with that feature :slight_smile:

filcole , thanks again for great work :slight_smile: Any idea why the “Charging Satus” is not updating even if the car is charing and the other parameters are updated?

I am using latest hassio with build in support for nissan_leaf. The log looks like this:

2019-03-28 00:22:07 DEBUG (SyncWorker_5) [pycarwings2.pycarwings2] Response HTTP Status Code: 200
2019-03-28 00:22:07 DEBUG (SyncWorker_5) [pycarwings2.pycarwings2] Response HTTP Response Body: b’{“status”:200,“BatteryStatusRecords”:{“OperationResult”:“START”,“OperationDateAndTime”:“mars 28,2019 00:21”,“BatteryStatus”:{“BatteryChargingStatus”:“NORMAL_CHARGING”,“BatteryCapacity”:“12”,“BatteryRemainingAmount”:“8”,“BatteryRemainingAmountWH”:"",“BatteryRemainingAmountkWH”:""},“PluginState”:“CONNECTED”,“CruisingRangeAcOn”:“86528.0”,“CruisingRangeAcOff”:“90584.0”,“TimeRequiredToFull200”:{“HourRequiredToFull”:“5”,“MinutesRequiredToFull”:“0”},“NotificationDateAndTime”:“2019\/03\/27 23:21”,“TargetDate”:“2019\/03\/27 23:21”}}’
2019-03-28 00:22:07 DEBUG (MainThread) [homeassistant.components.nissan_leaf] Latest server date=mars 28,2019 00:21
2019-03-28 00:22:07 DEBUG (MainThread) [homeassistant.components.nissan_leaf] Server Response: {‘answer’: {‘status’: 200, ‘BatteryStatusRecords’: {‘OperationResult’: ‘START’, ‘OperationDateAndTime’: ‘mars 28,2019 00:21’, ‘BatteryStatus’: {‘BatteryChargingStatus’: ‘NORMAL_CHARGING’, ‘BatteryCapacity’: ‘12’, ‘BatteryRemainingAmount’: ‘8’, ‘BatteryRemainingAmountWH’: ‘’, ‘BatteryRemainingAmountkWH’: ‘’}, ‘PluginState’: ‘CONNECTED’, ‘CruisingRangeAcOn’: ‘86528.0’, ‘CruisingRangeAcOff’: ‘90584.0’, ‘TimeRequiredToFull200’: {‘HourRequiredToFull’: ‘5’, ‘MinutesRequiredToFull’: ‘0’}, ‘NotificationDateAndTime’: ‘2019/03/27 23:21’, ‘TargetDate’: ‘2019/03/27 23:21’}}, ‘battery_capacity’: ‘12’, ‘battery_remaining_amount’: ‘8’, ‘charging_status’: ‘NORMAL_CHARGING’, ‘is_charging’: True, ‘is_quick_charging’: False, ‘plugin_state’: ‘CONNECTED’, ‘is_connected’: True, ‘is_connected_to_quick_charger’: False, ‘cruising_range_ac_off_km’: 90.584, ‘cruising_range_ac_on_km’: 86.528, ‘time_to_full_trickle’: None, ‘time_to_full_l2’: datetime.timedelta(seconds=18000), ‘time_to_full_l2_6kw’: None, ‘battery_percent’: 66.66666666666667, ‘state_of_charge’: None}
2019-03-28 00:22:07 DEBUG (SyncWorker_15) [pycarwings2.pycarwings2] invoking carwings API: https://gdcportalgw.its-mo.com/api_v181217_NE/gdc/RemoteACRecordsRequest.php
2019-03-28 00:22:07 DEBUG (SyncWorker_15) [pycarwings2.pycarwings2] params: {
“DCMID”: “201399069401”,
“RegionCode”: “NE”,
“TimeFrom”: “2017-11-02T20:55:03Z”,
“VIN”: “my_VIN”,
“custom_sessionid”: “5FZDvg8t90KikpZoWFlhYgDDQMoP2OKu4ZhnFewzSCVLdQ+EvBxQNT5GBFqhX7YjPVlqBv5cGj9hkqE2mhRd4lVQFQXA9V5QwrfRuEgzSwqA==”,
“initial_app_strings”: “geORNtsZe5I4lRGjG9GZiA”,
“lg”: “no_NO”,
“tz”: “Europe/Paris”

Recommendation, Hide VIN from the debug! This should not be displayed in the logs!

What do you think is a reasonable pulling time? I have a 2018 nissan leaf!

Still regarding the pulling time! According to what you say (or what I understood), when plugged in, the 12V battery does not charge! But according to what you say, you put the pulling time while plugged in to more frequent! Shouldn’t it be the other way around?

Thank you

My charging status also is not updating!

Thank you

Mine neither, I think it’s a server side issue. I don’t think I’ve had an update this month, same on android apps too.

On my Nissan Android app I can see the info that it’s charging! On the “My Leaf” app also, including the rate that it’s charging at the moment!

Thank you

Mine is connecting to Nissan and refreshing, but NOT the “charing status” even if the log says: ‘BatteryChargingStatus’: ‘NORMAL_CHARGING’ . Seems like to component is not interpreting it right :frowning:

Hi all, are we all connecting OK and getting data from the Nissan server? I’m asking as I’ve not been able to get any info either with this HA addon or any of my Android apps since the end of March.

Edit: It could be my account. I’m getting data for the daily usage etc. but it’s not updating the battery at all, nor is it allowing me to preheat the car.

Yep, I’ve got last update just a few min ago. Works fine for me.

Cheers, I’ll contact Nissan.

Mine is responding regularly but also failing quire often. I am using the European server. But still the Nissan Leaf module is not interpreting the response for “charging status” correct. Would be fantastic to have the fixed :blush:

I can’t get one of my Leafs to work with Hass. Even if I remove the working one and have the non-working one configured, I get no telemetry data. The username & password are definately correct (I can connect to it fine from phone apps) and my other Leaf works fine with the same settings. I’ve made sure all connected apps are logged out so as not to interfere.

Interestingly, while there is no telemetry data there is the car’s VIN in the response.

Can anyone advise how I go about troubleshooting this? This is what my log looks like:

2019-04-08 22:51:57 WARNING (SyncWorker_6) [homeassistant.components.nissan_leaf] WARNING: This may poll your Leaf too often, and drain the 12V battery.  If you drain your cars 12V battery it WILL NOT START as the drive train battery won't connect. Don't set the intervals too low.
2019-04-08 22:52:15 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/nissan_leaf/__init__.py", line 228, in async_update_data
    await self.async_refresh_data(now)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/nissan_leaf/__init__.py", line 278, in async_refresh_data
    server_response = await self.async_get_battery()
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/nissan_leaf/__init__.py", line 354, in async_get_battery
    self.leaf.get_latest_battery_status)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/pycarwings2/pycarwings2.py", line 396, in get_latest_battery_status
    return CarwingsLatestBatteryStatusResponse(response)
  File "/usr/local/lib/python3.7/site-packages/pycarwings2/responses.py", line 596, in __init__
    bs = recs["BatteryStatus"]
TypeError: list indices must be integers or slices, not str

Hello!

Leaf components seem to be working fine on the front end, but on the back end I’m getting the following errors…

2019-04-14 12:57:17 ERROR (SyncWorker_3) [pycarwings2.pycarwings2] carwings error -5256: [MyCarFinder] API call error
2019-04-14 12:57:17 ERROR (MainThread) [homeassistant.components.nissan_leaf] Error fetching location info

HASS 90.2
Mac OSX

What Leaf do you have? Location info is only on the Gen2 Leaf.

2015

How do we exclude these items? Or do we just have to live with these errors?