Page 1 of 2
[609] Nissan Leaf
Posted: Wednesday 16 September 2015 10:54
by BluesBro
Hi!
I own a Nissan Leaf and there seems to be a workaround to implement the Carwings telemetrics into Domoticz.
https://github.com/haykinson/pycarwings
http://www.electricvehiclewiki.com/Carwings_protocol
Only need tho change the servers for the appropriate region.
Example of result from the python Script:
logged in, vin: ***censored***, nickname: ***Censored***
requesting status...
sleeping for 20 seconds...
getting latest...
done!
!!python/object:response.LatestBatteryStatus
latest_battery_status: !!python/object:response.SmartphoneLatestBatteryStatusResponse
battery_capacity: !!python/unicode '12'
battery_charging_status: !!python/unicode 'NOT_CHARGING'
battery_remaining_amount: !!python/unicode '10'
cruising_range_ac_off: !!python/unicode '127296'
cruising_range_ac_on: !!python/unicode '125664'
last_battery_status_check_execution_time: 2015-09-16 08:13:11+00:00
notification_date_and_time: 2015-09-16 08:13:11+00:00
operation_date_and_time: 2015-09-16 08:12:55+00:00
operation_result: !!python/unicode 'START'
plugin_state: !!python/unicode 'NOT_CONNECTED'
time_required_to_full: !!python/object/apply:datetime.timedelta [0, 19800, 0]
time_required_to_full_L2: !!python/object/apply:datetime.timedelta [0, 12600, 0]
I also lack the ability to turn AC On/Off, but it seems to be a command hidden within the carwings protocol link.
Anybody wanna give it a go?
Re: Nissan Leaf
Posted: Thursday 17 September 2015 22:34
by hansrune
Absolutely.... Over the weekend sometime
Re: [609] Nissan Leaf
Posted: Tuesday 22 September 2015 19:50
by hansrune
Can“t make it log in... The pycarwings code seems some 4 years old, and the README states:
- doesn't appear to work out of the box outside the United States
Connects to 66.77.196.207, ssl initiation OK, but not further than that . Some 20 packets exchanged
What is your location ?
Re: [609] Nissan Leaf
Posted: Tuesday 22 September 2015 20:20
by BluesBro
Different url in europe.
Switch
BASE_URL = '
https://nissan-na-smartphone-biz.viaaq. ... phoneProxy'
to
BASE_URL = '
https://nissan-eu-smartphone-biz.viaaq. ... phoneProxy'
And in userService.py
SERVICE_PATH = '/userService'
To
SERVICE_PATH = '/userService/ne'
Re: [609] Nissan Leaf
Posted: Tuesday 22 September 2015 20:45
by hansrune
Thanks, but login still does not succeed.
Re: [609] Nissan Leaf
Posted: Tuesday 22 September 2015 20:48
by BluesBro
Are you logging in with username or e-mail?
Strange... It works for me. Im from Norway.
[609] Nissan Leaf
Posted: Tuesday 22 September 2015 21:03
by hansrune
Changed to username. That got me logged in, or at least apparently further, but ended in internal server error (500).
My iOS Leaf Link also has a 'unknown communication error' message. Could be just another bad car wings day....
Norway as well ... Will dig deeper some other time
Re: [609] Nissan Leaf
Posted: Wednesday 23 September 2015 9:34
by BluesBro
Looks like the EU URL isdown. I think they have re-routed the official app through Asia-URL, but thirdparty apps are now struggling.
I will see if I can find the Asia URL
Re: [609] Nissan Leaf
Posted: Wednesday 23 September 2015 9:43
by BluesBro
Corrected BASE_URL in connection.py
Code: Select all
BASE_URL = 'https://nissan-asia-smartphone-biz.viaaq.com/aqPortal/smartphoneProxy'
Corrected SERVICE_PATH in userservice.py
Just tested it and it works for me at least.
Re: [609] Nissan Leaf
Posted: Wednesday 23 September 2015 12:58
by hansrune
For me as well. Thanks!
Re: [609] Nissan Leaf
Posted: Wednesday 30 September 2015 10:03
by BluesBro
Any luck on this..?

Re: [609] Nissan Leaf
Posted: Wednesday 30 September 2015 10:16
by hansrune
Well. It is more a question of what is useful to integrate into Domoticz. Not a lot, IMO. I already monitor kWh used for charging + charge times by other means (Owl meter) .
Things may change as they now revamp the Carwings services
Re: [609] Nissan Leaf
Posted: Wednesday 30 September 2015 11:20
by BluesBro
AC-controll is the pinnacle imo. This will be giving us the option to sett more than one timer via LUA or Blockly.
And also posting current battery level in a Dummyswitch would be useful.
Re: [609] Nissan Leaf
Posted: Saturday 03 October 2015 11:29
by vlegros
Hello
I'm having a Nissan Leaf (Europe) since 1 week and fan of Domoticz as I've setup it @home. (temperature sensors, lights, ...)
I would like to know how to interface with Carwings as it looks like it is possible ?
Thanks in advance
Vincent
Re: [609] Nissan Leaf
Posted: Tuesday 08 December 2015 2:35
by alfredo
Did any of you norwegians do anything with this?
I hacked it up and post the number to a dummy Counter-switch, but its not optimal.
Any better dummy-switches to use?
Re: [609] Nissan Leaf
Posted: Tuesday 08 December 2015 11:18
by BluesBro
I became a father in the midst of all this so all my spare time goes to lullabyes and diaperchange

Sure would appreciate if someone got it to work thou, and especially the AC-part!
Re: [609] Nissan Leaf
Posted: Tuesday 08 December 2015 11:19
by BluesBro
BTW Alfredo! Could you give me a How-To? With the complete scripts and all?
Re: [609] Nissan Leaf
Posted: Tuesday 08 December 2015 11:49
by alfredo
Congratulations!
I git cloned the pycarwings-repo, and made the adjustments needed above.
I then used the following script:
http://pastebin.com/gPnPLz8B
I used that against a dummy Counter/Counter in Domoticz. (no, I use a percentage-counter now - see edit2 below)
I copied it together during the night, so it's not really that well tested yet.
Don't want to type up more now, because this is a temporary solution.
Edit:
I already found some errors, changed the pastebin above.
Edit2:
Well, what do you know - I found a better way to do this I think.
Now using a percentage-counter - still need some testing though.
Re: [609] Nissan Leaf
Posted: Tuesday 08 December 2015 13:40
by BluesBro
Actually the old one worked better althou it sent the 100% value of the battery.
The new one got me this error:
LEAF.sh: line 8: unexpected EOF while looking for matching ``'
LEAF.sh: line 23: syntax error: unexpected end of file
Re: [609] Nissan Leaf
Posted: Tuesday 08 December 2015 13:47
by BluesBro
The new one with % gives me:
LEAF.sh: line 14: bc: command not found
Error: Value variable empty