Thanks for fixing this!
Hello!
I am using Hassio, and home assistant v 0.99.3 and the last couple days, after updating perfectly the following rows appearing again and again until I restart the homeassistant server:
2019-09-29 10:05:01 DEBUG (MainThread) [homeassistant.components.nissan_leaf] Refresh currently in progress for Leaf
2019-09-29 10:05:01 DEBUG (MainThread) [homeassistant.components.nissan_leaf] Next update=2019-09-29 08:35:01.039855+00:100:
My refresh period is 30 minutes. It looks like after a while it stucks in this state.
Can somebody help with this?
Having the same issue since when I started using with this component in February this year. I was hoping the move of Nissan with the updated API would fix some issues, but apparently they still don’t care, the native Nissan app also fails more than it succeeds when polling updates. Unfortunately with the Hassio component I have to reboot to get it functioning again. It seems to be stuck in an update? Can this be cancelled and restarted somehow (perhaps when an update takes longer than a predefined period)?
Same issue here. Now I barely get any updates from the car, even after restart.
Just got this after a restart:
carwings error; logging in and trying request again: {‘status’: 408}
12:18 AM /usr/local/lib/python3.7/site-packages/pycarwings2/pycarwings2.py (ERROR)
The Nissan server seems to have been down for some weeks. It’s working again, and the Home Assistant fixed itself. So apparently it does fix itself eventually.
I am looking for a configuration example for two cars (I have a eNV200 and a 2016 Leaf). Anybody?
Hey,
I added my account and it seems to be working fine (EU servers). Any way to add two accounts ? We each have a separate account, and it’d be nice to get the two cars in there.
Thanks
It seems the EU servers have been down again for a couple of days now. I honestly cannot get my head around the quality of this service. And then seeing adverts on tv bragging about their Nissan connect service…
Looks like I’m leaving home again with a complete frosted car again today.
The Hassio integration is working as it should though. Really happy with that. Just too bad we’re let down by the Nissan servers.
I am registered to an austrian account, and its working fine for me for a half a day. After that restart of the Hassio is needed to get back to the current state.
It looks like it often gets stuck, and you have to restart homeassistant itself to get it to work again.
Not sure why, maybe it needs to re-auth every so often ?
I still don’t understand why Nissan removed the location services. You see folks with Tesla’s getting new features every update, while Nissan is taking away features without further notice. Their servers are still crap and just like @WouterR mentioned - I can’t stand the commercials on TV anymore.
Luckily the Home Assistant integration makes it so much better to use their service.
Anyone that’s using this component with a newer nissan that is using the NissanConnect app? I used this component for my previous Leaf, but know I’ve got a new one and the registration is another process than earlier.
I have a leaf from last summer, never could get the nissan connect app to work. I’ve been using the unofficial “My Leaf” app instead which works great when needed, but mostly just this component.
The My Leaf app is basically useful only when this component is failing, sometimes you have to restart HA to get it to reconnect.
is the INVALID PARAM response indication of dead API?
see https://github.com/filcole/pycarwings2/issues/21
DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): gdcportalgw.its-mo.com:443
DEBUG:requests.packages.urllib3.connectionpool:https://gdcportalgw.its-mo.com:443 "POST /api_v190426_NE/gdc/InitialApp_v2.php HTTP/1.1" 200 None
DEBUG:pycarwings2.pycarwings2:Response HTTP Status Code: 200
DEBUG:pycarwings2.pycarwings2:Response HTTP Response Body: b'{"status":200,"message":"success","baseprm":"88dSp7wWnV3bvv9Z88zEwg"}'
DEBUG:pycarwings2.pycarwings2:invoking carwings API: https://gdcportalgw.its-mo.com/api_v190426_NE/gdc/UserLoginRequest.php
DEBUG:pycarwings2.pycarwings2:params: {
"Password": "(snip)",
"RegionCode": "NCI",
"UserId": "(SNIP)",
"custom_sessionid": "",
"initial_app_str": "9s5rfKVuMrT03RtzajWNcA"
}
DEBUG:pycarwings2.pycarwings2:Response HTTP Response Body: b'{"status":"-2010","message":"INVALID PARAMS","resultKey":""}'
Hey @filcole, I’m having issues updating, most of the time the battery status doesn’t update unless I run script again a second time. The charging status etc. works fine and the AC will turn on.
Here is the relevant section of my log, would you be so kind as to take a look please …
Thanks.
2020-02-26 20:36:20 DEBUG (MainThread) [homeassistant.components.nissan_leaf] Requesting battery update, SJNFAAZE0U6025560
2020-02-26 20:36:21 ERROR (SyncWorker_1) [pycarwings2.pycarwings2] carwings error; logging in and trying request again: {'status': 408}
2020-02-26 20:36:33 DEBUG (MainThread) [homeassistant.components.nissan_leaf] Waiting 30 seconds for battery update (SJNFAAZE0U6025560) (0)
2020-02-26 20:37:06 DEBUG (MainThread) [homeassistant.components.nissan_leaf] Server Response: {'answer': {'status': 200, 'BatteryStatusRecords': {'OperationResult': 'START', 'OperationDateAndTime': '26-Feb-2020 18:34', 'BatteryStatus': {'BatteryChargingStatus': 'NOT_CHARGING', 'BatteryCapacity': '11', 'BatteryRemainingAmount': '11', 'BatteryRemainingAmountWH': '', 'BatteryRemainingAmountkWH': ''}, 'PluginState': 'NOT_CONNECTED', 'CruisingRangeAcOn': '88264.0', 'CruisingRangeAcOff': '97240.0', 'TimeRequiredToFull': {'HourRequiredToFull': '5', 'MinutesRequiredToFull': '0'}, 'TimeRequiredToFull200': {'HourRequiredToFull': '3', 'MinutesRequiredToFull': '0'}, 'TimeRequiredToFull200_6kW': {'HourRequiredToFull': '2', 'MinutesRequiredToFull': '0'}, 'NotificationDateAndTime': '2020/02/26 17:34', 'TargetDate': '2020/02/26 17:34'}}, 'battery_capacity': '11', 'battery_remaining_amount': '11', 'charging_status': 'NOT_CHARGING', 'is_charging': False, 'is_quick_charging': False, 'plugin_state': 'NOT_CONNECTED', 'is_connected': False, 'is_connected_to_quick_charger': False, 'cruising_range_ac_off_km': 97.24, 'cruising_range_ac_on_km': 88.264, 'time_to_full_trickle': datetime.timedelta(seconds=18000), 'time_to_full_l2': datetime.timedelta(seconds=10800), 'time_to_full_l2_6kw': datetime.timedelta(seconds=7200), 'battery_percent': 91.66666666666667, 'state_of_charge': None}
2020-02-26 20:37:09 DEBUG (MainThread) [homeassistant.components.nissan_leaf] Got climate data for Leaf: {'cruising_range_ac_off_km': 96.768, 'cruising_range_ac_on_km': 87.552, 'is_hvac_running': False}
2020-02-26 20:37:09 DEBUG (MainThread) [homeassistant.components.nissan_leaf] Next update=2020-02-26 21:37:09.098750+00:00
2020-02-26 20:38:32 DEBUG (MainThread) [homeassistant.components.nissan_leaf] Updating Nissan Leaf Data
2020-02-26 20:38:32 DEBUG (MainThread) [homeassistant.components.nissan_leaf] Requesting battery update, SJNFAAZE0U6025560
2020-02-26 20:38:34 DEBUG (MainThread) [homeassistant.components.nissan_leaf] Waiting 30 seconds for battery update (SJNFAAZE0U6025560) (0)
2020-02-26 20:39:08 DEBUG (MainThread) [homeassistant.components.nissan_leaf] Server Response: {'answer': {'status': 200, 'BatteryStatusRecords': {'OperationResult': 'START', 'OperationDateAndTime': '26-Feb-2020 21:38', 'BatteryStatus': {'BatteryChargingStatus': 'NOT_CHARGING', 'BatteryCapacity': '11', 'BatteryRemainingAmount': '10', 'BatteryRemainingAmountWH': '', 'BatteryRemainingAmountkWH': ''}, 'PluginState': 'NOT_CONNECTED', 'CruisingRangeAcOn': '84488.0', 'CruisingRangeAcOff': '91648.0', 'TimeRequiredToFull': {'HourRequiredToFull': '5', 'MinutesRequiredToFull': '30'}, 'TimeRequiredToFull200': {'HourRequiredToFull': '4', 'MinutesRequiredToFull': '0'}, 'TimeRequiredToFull200_6kW': {'HourRequiredToFull': '2', 'MinutesRequiredToFull': '0'}, 'NotificationDateAndTime': '2020/02/26 20:38', 'TargetDate': '2020/02/26 20:38'}}, 'battery_capacity': '11', 'battery_remaining_amount': '10', 'charging_status': 'NOT_CHARGING', 'is_charging': False, 'is_quick_charging': False, 'plugin_state': 'NOT_CONNECTED', 'is_connected': False, 'is_connected_to_quick_charger': False, 'cruising_range_ac_off_km': 91.648, 'cruising_range_ac_on_km': 84.488, 'time_to_full_trickle': datetime.timedelta(seconds=19800), 'time_to_full_l2': datetime.timedelta(seconds=14400), 'time_to_full_l2_6kw': datetime.timedelta(seconds=7200), 'battery_percent': 83.33333333333333, 'state_of_charge': None}
2020-02-26 20:39:10 DEBUG (MainThread) [homeassistant.components.nissan_leaf] Got climate data for Leaf: {'cruising_range_ac_off_km': 96.768, 'cruising_range_ac_on_km': 87.552, 'is_hvac_running': False}
2020-02-26 20:39:10 DEBUG (MainThread) [homeassistant.components.nissan_leaf] Next update=2020-02-26 21:39:10.774909+00:00```
I’ve just tried and failed getting my leaf info into homeassistant. But I’ve been at least able to identify one problem.
I seems the pycarwings2 library expected some fields in the json it was getting from nissan. I’ve put a pull request into a pycarwings2 library here: https://github.com/filcole/pycarwings2/pull/22
Is that the right pycarwings2 library? There were several of them, but that was the first I found that was written for python3. I’m not sure which is the basis for homeassistant…
Hi Folks, would you like a pretty Nissan Leaf Element Card (like) thing.
Here is the ‘card’, just pop it into one of your lovelace pages …
- type: picture-elements
image: /local/pics/leaf.png
elements:
# Title and Program
- type: state-label
entity: sensor.leaf_state
style:
left: 0
bottom: 0
pointer-events: none
font-size: 16px
line-height: 32px
color: white
background-color: rgba(0, 0, 0, 0.3)
width: 100%
transform: initial
padding: 0 8px
# A/C Control
- type: state-icon
entity: switch.MYNISSANLEAF_climate_control
tap_action:
action: toggle
confirmation: true
style:
bottom: 0
right: 0
transform: initial
color: white
line-height: 32px
padding: 8px
margin: 0 0px 0 0
# Change color of state-icon off
--paper-item-icon-color: rgb(25,25,25)
# Range
- type: state-label
entity: sensor.leaf_range_ac
style:
top: 0
right: 0
pointer-events: none
transform: initial
font-size: 12px
color: rgba(25,25,25,1)
text-shadow: rgba(0, 0, 0, 0.2) 0px 0px 2px
line-height: 32px
margin: 1px 35px
- type: icon
icon: mdi:speedometer
style:
top: 0
right: 0
pointer-events: none
transform: scale(0.8)
color: rgba(25,25,25,1)
line-height: 32px
margin: 3px 13px 0 0
- type: state-label
entity: sensor.leaf_range
style:
top: 0
right: 0
pointer-events: none
transform: initial
font-size: 12px
color: rgba(25,25,25,1)
text-shadow: rgba(0, 0, 0, 0.2) 0px 0px 2px
line-height: 32px
margin: 30px 35px
- type: icon
icon: mdi:speedometer
style:
top: 0
right: 0
pointer-events: none
transform: scale(0.8)
color: rgba(25,25,25,1)
line-height: 32px
margin: 36px 13px
- type: state-label
entity: sensor.MYNISSANLEAF_charge
style:
top: 0
right: 0
pointer-events: none
transform: initial
font-size: 12px
color: rgba(25,25,25,1)
text-shadow: rgba(0, 0, 0, 0.2) 0px 0px 2px
line-height: 32px
margin: 59px 35px
- type: icon
icon: mdi:battery-unknown
style:
top: 0
right: 0
pointer-events: none
transform: scale(0.8)
color: rgba(25,25,25,1)
line-height: 32px
margin: 65px 13px
… and here are some sensors …
- platform: template
sensors:
leaf_state:
value_template: "Charging: {{ states('binary_sensor.MYNISSANLEAF_charging_status') }}"
leaf_range_ac:
value_template: "A/C Milage: {{ states('sensor.MYNISSANLEAF_range_ac') }}"
leaf_range:
value_template: "Milage: {{ states('sensor.MYNISSANLEAF_range') }}"
Don’t forget to change the ‘MYNISSANLEAF’ to your sensor info.
Credit MUST go to u/naofireblade and this thread of his https://www.reddit.com/r/homeassistant/comments/9op70r/neato_picture_elements_card/
The way I’ve done this is to replace the first ‘-’ in the lovelace yaml with a space, save it as it’s own leafcard.yaml and use the !include command.
- !include /config/lovelace/cards/leafcard.yaml
Also, the earlier problem about not recieving the battery status, I’ve created an automation that will poll the car a second time 30 seconds after the first time and this seems to have fixed it.
RK.
Here is the png, put it in www/pics/leaf.png (or edit the card)
Great stuff!
I succeeded in getting this working for my 2018 tekna, but I’m missing a few things.
I use these script for starting the charge and to update the status:
script:
leaf_charge:
alias: Laden starten
sequence:
- service: nissan_leaf.start_charge
data:
vin: !secret nissan_leaf_vin
leaf_update:
alias: Update status
sequence:
- service: nissan_leaf.update
data:
vin: !secret nissan_leaf_vin
-
I would love to have a button on the left hand bottom like the airco button (right bottom) that will start my charge and change color when charging.
-
I would like to have the sensor [binary_sensor.MYLEAF_plug_status] (is the charging plug plugged in?) added, maybe to the left top corner?
-
It should be possible to change the battery icon according to the charge status.
a little something like:
icon_template: "{%- if states.binary_sensor.hal_motion_sensor.state >= '95' %}mdi:battery{%- elif states.binary_sensor.hal_motion_sensor.state == '100' %}mdi:battery{%- elif states.binary_sensor.hal_motion_sensor.state <= '15' %}mdi:battery-outline{% else %}mdi:battery-{{(states.binary_sensor.hal_motion_sensor.state|float / 10)|round*10}}{%- endif %}"
Not sure how to do this, but I will give it a try.
Got this done now:
Only things missing are:
- The “start charging” script combined with the charging status as an button-icon in the left bottom corner. (mdi:ev-station?)
- The “update status” script as an button-icon in the bottom middle (mdi:update?)
I dunno how to do these…
Once fixed I’ll share my changes.
Nice work.
I have tried but I can’t even get the battery icon to change I’m not much of a programmer, I get confused easily, making this took me most of a days work.
Please post your updated when happy with the results.