Closed xibriz closed 6 years ago
Nice! Does this only work with 2016+ 30kWh LEAFS?
Thanks!
As expected it dosn't work with my 24kWh leaf. Nice work adding this...now another reason why I should upgrade :-p
Trying to run it on my 24kwh I get:
./get-leaf-location.py
Prepare Session
Login...
request_location
Traceback (most recent call last):
File "./get-leaf-location.py", line 32, in <module>
result_key = l.request_location()
AttributeError: Leaf instance has no attribute 'request_location'
@glynhudson That error means that the function "request_location" does not exist in the Leaf class. Are you shure you have the latest code?
I have only tested this on my 2017 30kWh Leaf (EU), but I have read that even the oldest Leaf's have position information.
I have a 2014 24 kw, and I have username, not e-mail address as userID
# ./get-leaf-location.py
Prepare Session
Login...
request_location
ERROR:pycarwings2.pycarwings2:carwings error -5256: [MyCarFinder] API call error
Traceback (most recent call last):
File "./get-leaf-location.py", line 32, in <module>
result_key = l.request_location()
File "/home/pi/.local/lib/python2.7/site-packages/pycarwings2/pycarwings2.py", line 415, in request_location
"UserId": self.session.gdc_user_id, # this userid is the 'gdc' userid
File "/home/pi/.local/lib/python2.7/site-packages/pycarwings2/pycarwings2.py", line 101, in _request_with_retry
ret = self._request(endpoint, params)
File "/home/pi/.local/lib/python2.7/site-packages/pycarwings2/pycarwings2.py", line 141, in _request
raise CarwingsError
pycarwings2.pycarwings2.CarwingsError
Get-leaf-info works:
$ ./get-leaf-info.py
Prepare Session
Login...
get_latest_battery_status
date 01-Dec-2017 10:59
date 2017/12/01 09:59
battery_capacity2 12
battery_capacity 12
charging_status NORMAL_CHARGING
battery_capacity 12
battery_remaining_amount 12
charging_status NORMAL_CHARGING
is_charging True
is_quick_charging False
plugin_state CONNECTED
is_connected True
is_connected_to_quick_charger False
time_to_full_trickle None
time_to_full_l2 None
time_to_full_l2_6kw 0:40:00
leaf_info.battery_percent 100.0
leaf_info.state_of_charge None
start sleep 10
end sleep 10
not update
{u'batteryCapacity': u'12',
u'batteryDegradation': u'12',
u'chargeMode': u'NOT_CHARGING',
u'chargeStatus': u'CT',
u'charging': u'NO',
u'cruisingRangeAcOff': u'140800.0',
u'cruisingRangeAcOn': u'125400.0',
u'currentChargeLevel': u'0',
u'operationResult': u'START',
u'pluginState': u'NOT_CONNECTED',
u'responseFlag': u'1',
u'status': 200,
u'timeRequiredToFull': {u'hours': u'', u'minutes': u''},
u'timeRequiredToFull200': {u'hours': u'', u'minutes': u''},
u'timeRequiredToFull200_6kW': {u'hours': u'', u'minutes': u''},
u'timeStamp': u'2017-12-01 10:09:02'} ```
I get the same error as above on my late 2015, 24kwh Leaf. Could it be that it doesn't like the UserId
parameter? None of the other requests use it.
Yeah, location info was added with the new head unit software (Connect rather than CarWings) so any 24kwh before 2016 won’t support it.
Hi. I have added functionality to get the GPS-position of the Leaf.