command carwings via sms

My Nissan Leaf Forum

Help Support My Nissan Leaf Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.
GroundLoop said:
There is one more link for Start Charging that I didn't include, and turbo is correct that there is no "stop". However, I did once send Start while the car was charging, and it stopped. Who knows if that's intentional.

The "Start Charging" could be more of a "toggle charging" if it works as you described. Have you tried sending the command again and see if it starts back up?
 
jwatte said:
If you're comfortable giving your login name/password to a third party site, then that site could log in for you by issuing the appropriate sequence of requests and getting the cookies.
Except that if the third party site is just another one of my computers (or a remote sever of mine) then I'm not really giving anyone else my credentials. It's just that the phone can't handle it, so we get something else to do it for us. Unfortunately, I ain't smart enough to do all that session cookie mumbo-jumbo, and it looks like it is being quite difficult on its own as well.
 
There was like 10 times this week I wanted to be able to precool the car so I finally got around to finishing.

Simple carwings portal/proxy for not so smart phones.

http://www.leafic.com/cwportal/" onclick="window.open(this.href);return false;

UPDATE:
I updated it so you can pass your credentials in the url and it will log in right away without having to type it in. So you can bookmark:

http://www.leafic.com/cwportal?username=" onclick="window.open(this.href);return false;[your username]&password=[your password]

Replace "[your username]" and "[your password]" with, well you know.



Disclaimer: yes, if I wanted to I could see your credentials, but I have better things to do than to start charging your car during peak hours. In any case, don't use this if you don't feel comfortable disclosing your carwings credentials to a random guy on the internet with some weird headgear.

Use at your own risk. I take no responsibility if it does not work as intended and you end up with a dead batter or a hot car. But it works fine on my car.

If I ever get around to it, I'd love to integrate this into twitter so you could direct-message the portal via SMS and send the car commands.
I could do this via email as well but that's not as convenient as sms.
 
In an effort of full disclosure, just some more info on how it works and what kind of info is/isn't recorded.

Your credentials are never saved anywhere. They are sent directly to nissan over a secure connection right after you hit login and then they disappear into the digital abyss. Note that while your credentials are sent from leafic.com to nissan securely, when you submit your credentials to leafic.com, the connection is not secure and technically could be read by anyone sniffing the network traffic. Network sniffing credentials is a possibility when you log into any non-secure site, such as this forum.

Nissan sets some cookies to maintain the session. These cookies are normally stored on your computer but because this is a proxy, the cookies are stored on the leafic.com server. These temporary files are stored in an area on the server that is not accessible to the public and is flushed often. Technically I, or someone with access to the server (which at this point is only me) could use this information to "assume" your session and interact with carwings like they had logged in with your credentials, assuming the session didn't time out already. So they would have to assume your session within a few minutes of you logging in. Once nissan expires the session, this saved information is useless and gets deleted the next time there is a flush.

The portal itself stores some cookies on your computer to maintain it's session with you.

At no time is any personally identifiable information, other than the temporary file to hold the session cookies as described above, saved to the the server in any form.

I'm guessing not many people will use this service but it's there if you need it.
 
turbo would you mind sharing what you did? tar ball or config or both? Would like to set this up on my own box.
 
Hmm...the code is a bit of a mess. I'd be embarrassed to release it that way.

If I can find some time (I know it wont be this weekend), I will clean it up and send it.
 
I don't remember seeing location anywhere, but I don't have it in front of me.. There is a bunch of "static" information...nothing too exciting.
 
turbo2ltr said:
I'm guessing not many people will use this service but it's there if you need it.

I will say that I do use it as a mobile connection can be low quality/slow where I am at work and a text only version goes much quicker to turn the A/C on remotely as I am leaving for the day.

Thanks!
 
BTW, I updated it the other day so you can pass your credentials in the url and it will log in right away without having to type it in. So you can bookmark:

http://www.leafic.com/cwportal?username=[your username]&password=[your password]

Replace "[your username]" and "[your password]" with, well you know.

That way turning on the AC is a two click process with no typing.
 
turbo2ltr said:
Hmm...the code is a bit of a mess. I'd be embarrassed to release it that way.

If I can find some time (I know it wont be this weekend), I will clean it up and send it.

Rule #1 of open source: Messy code doesn't matter. Working code does!
If it's messy, and others read it, it will automatically get better.
Just dump it into a new github repository and be happy! (I love github -- so much better than sourceforge, bazaar, codeplex etc)
 
turbo2ltr said:
If I can find some time (I know it wont be this weekend), I will clean it up and send it.
I'd also be interested; I was going to write a little tool that could check and see if the car is a) below a given percentage of charge and b) not plugged in, and if both situations are true, text or e-mail the owner. (Basically, a less-sucky version of the plugin reminders that someone could set up and run on their own server.)

I started to reverse-engineer the calls in order to do this, but I'd rather not reinvent the wheel.
 
I like how useful the portal looks, but I can't login with either my Carwings or MyNissan usernames/passwords.

It looks like this when I try it:

VIN: JN1ADOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
ID: tml PUBLIC

Updated:
SOC:
Range:
L2 Charge Time:
Charge Status:
Plugged In:
HVAC:

Get Status
Update Status (Ping car)

Start Charging

Start HVAC
Stop HVAC

Logout

Sending update request, please wait... There was a problem updating
File from cookie: /tmp/NISSANbcWLsA Using /tmp/NISSANbcWLsA as cookie file statusupdate:

In order to view this page you need JavaScript and Flash Player 8+ support!

etc...

I live in Portugal, btw, if that has anything to do with the problem (maybe we use a different Nissan/Carwings website alltogether).
 
Interesting. Not sure what the problem would be and the code is rather crappy at handling errors.

When you go to the 'normal' portal, do you go here https://www.nissanusa.com/owners/login or do you go somewhere else?
 
GroundLoop said:
My "HTML page" consists of these three links:
Code:
Refresh Status:
https://www.nissanusa.com/owners/vehicles/statusRefresh?id=XXXX&rand=2.9938402264070563

Fan On:
https://www.nissanusa.com/owners/vehicles/setHvac?id=XXXX&fan=on&rand=1.2039483457659211

Fan Off:
https://www.nissanusa.com/owners/vehicles/setHvac?id=XXXX&fan=off&rand=1.3459323457659211

Could these links be stored as Bookmarks on a Blackberry browser? I mean, once you're logged into the nissanusa site, just run these Bookmarked entries. Would this work instead of having some form of a personal webserver page?
 
Theoretically yes, but it's not that simple. There is a random number at the end of the url to make sure it doesn't get cached. Without changing it every time you load that page, it may load a cached version of the page and never hit the server, therefor never actually execute the command.

The other issue is that there are actually two links for each command. One tells the server what command to send and the other tells the car to execute the command. In the end it's easier to use the site, but it is possible.
 
turbo2ltr said:
Theoretically yes, but it's not that simple. There is a random number at the end of the url to make sure it doesn't get cached. Without changing it every time you load that page, it may load a cached version of the page and never hit the server, therefor never actually execute the command.

The other issue is that there are actually two links for each command. One tells the server what command to send and the other tells the car to execute the command. In the end it's easier to use the site, but it is possible.

Thanks for the explanation turbo.
 
mxp said:
Could these links be stored as Bookmarks on a Blackberry browser? I mean, once you're logged into the nissanusa site, just run these Bookmarked entries. Would this work instead of having some form of a personal webserver page?

You certainly can Bookmark these on a Blackberry and use them. It's the only way to use the BlackBerry Tour to control the car. Indeed, that's what I do until I can get a Smartphone. <zing>

Unfortunately, it still makes you log in. AND if you enter your password too quickly, before it auto-tabs you to the password field, you have to enter it twice. But hey, it's better than nothing.
Almost.

So the effect is:
Click Bookmark. Wait two or three minutes for the backward written-in-BASIC Blackberry browser to start up and "Loading.." bs.
Then, you get bumped to Nissan's login site, with the microfiche window to enter your username and password.
After Enter, and more computational mountain-moving by the Blackberry, you are presented with a web page bearing the word:
"true"
And the deed is done.

Four more months.
 
Back
Top