TMC is an independent, primarily volunteer organization that relies on ad revenue to cover its operating costs. Please consider whitelisting TMC on your ad blocker or making a Paypal contribution here: paypal.me/SupportTMC

ChargeGuy: new Android app with notifications and charge alarms.

Discussion in 'Model S: User Interface' started by Mercury, Mar 13, 2015.

  1. Mercury

    Mercury Member

    Joined:
    Dec 28, 2014
    Messages:
    27
    Location:
    Scottsdale, AZ
    Longtime lurker here. I got my P85D on 12/31 along with everyone else, been loving it so far. The Android app, though, is a little on the crusty side, as everyone here has noted repeatedly.


    I rolled my own helper app awhile ago and I'm putting it into Google Play today after sprucing it up a bit. ChargeGuy is available now and is 100% free: no IAP, ads, or crapware. The Google Play link is: https://play.google.com/store/apps/details?id=com.ncs.chargeguy


    It has two main features to help out with managing charging.


    1) Configurable alarms. ChargeGuy will check your car daily for connection status and minimum range as configured, raising notifications on your phone if things don't go to plan. You can specify a connection warning and a range alarm separately. You can also set the range alarm to bypass system volume and play an extra noisy sound clip, which will wake up most normal humans. If you're like me and you tend to plug in only when you notice the range is semi-low, this is a godsend.


    2) Real-time monitoring on demand for supercharging. ChargeGuy lurks in the background and monitors your car's charging status, raising notifications when it changes. It also keeps an ongoing notification visible with stats and time left, so you don't have to do battle with the stock app that requires being restarted all the goddamn time.


    The monitoring has to be set off manually, since it works by polling the car a few times per minute. To avoid hammering Tesla's servers (and your phone's battery), it automatically stops after charge is complete or a few hours elapse.


    ---


    Thanks to timdorr and others for documenting the REST API - it saved me a lot of reversing time. This app uses the new oauth method of authenticating, so I'm pretty sure it'll work for everyone. Enjoy!
     
  2. irishstoutaz

    irishstoutaz Member

    Joined:
    Apr 7, 2013
    Messages:
    302
    Location:
    Cave Creek, AZ
    #2 irishstoutaz, Mar 13, 2015
    Last edited: Mar 13, 2015
    Just downloaded and going to give it a try... Thanks for creating this! :biggrin:

    *Note: There is a default UserID & PW that is present when you first attempt to login.

    Update: My table had a prepopulated UserID and PW phone did not have it prepopulated
     
  3. wk057

    wk057 Senior Tinkerer

    Joined:
    Feb 23, 2014
    Messages:
    4,722
    Location:
    Hickory, NC, USA
    Sounds like a good plan, however I think Tesla recently modified authentiation and the community-documented API doesn't quite work like it should anymore. Probably check out the VisibleTesla thread and source for details on that. If you're able to get a nice working app I'd be willing to donate/buy/whatever. Bonus points if you make it OSS ;)

    For me, I get this with your app:

    2015-03-13 20.04.03.png
     
  4. Mercury

    Mercury Member

    Joined:
    Dec 28, 2014
    Messages:
    27
    Location:
    Scottsdale, AZ
    Uh-oh. I hope there's not some dangly test code. Thanks for the heads-up, I'll give it a wipe and make sure.

    - - - Updated - - -

    Yeah, I've been following that big thread for awhile. I went with the new oauth-style, since the old user_session[email/pw] stuff appears to be going away. Although it's a little annoying that I'm already running into a bump. Naturally, it doesn't occur with my login. :mad:

    I'll see how many people are affected, maybe have it fall back to the old authentication if necessary.
     
  5. laalan

    laalan Member

    Joined:
    Sep 16, 2012
    Messages:
    145
    Location:
    Orange, CA
    Got server request error also, bit it is Fri the 13th
     
  6. scottm

    scottm Active Member

    Joined:
    Jun 13, 2014
    Messages:
    1,282
    Location:
    Canada
    Let me get this right, your app is going to prompt me for myTesla crendentials?


    Ummm no thanks. That's like handing you a key to my car.
     
  7. eco5280

    eco5280 Member

    Joined:
    Mar 27, 2014
    Messages:
    620
    Location:
    Country
    +1. Actually +$90,000. I'll pass.
     
  8. wk057

    wk057 Senior Tinkerer

    Joined:
    Feb 23, 2014
    Messages:
    4,722
    Location:
    Hickory, NC, USA
    I agree this is a terribly bad practice, but since Tesla has no public API it's impossible to make an app that does anything otherwise. This is why I'd like any apps that need this data to be open source, personally.

    In this case I changed the password, tried the app, changed it again. I'm sure there will be social engineering attacks along these lines eventually, since the login and password can be used to locate, remotely start, AND drive off with the car all without the key. Then a bunch of Model S thefts will happen. Tesla really needs to beef up security on the keyless driving feature. It should, at the very least, require an additional password or PIN or even an SMS verification or something.
     
  9. Mercury

    Mercury Member

    Joined:
    Dec 28, 2014
    Messages:
    27
    Location:
    Scottsdale, AZ
    Until Tesla provides a better way, then this is it. I definitely understand your concern, but there's not much to do to avoid it, other than build it from source. I don't want to get in the business of processing a bunch of random pull requests, so I'm not putting it on github yet.

    However, I'd be more than happy to email anyone the source who wants to help tinker, just drop me a PM.
     
  10. wk057

    wk057 Senior Tinkerer

    Joined:
    Feb 23, 2014
    Messages:
    4,722
    Location:
    Hickory, NC, USA
    I wouldn't mind giving it a little bit of tinkering to see if I can figure out why it isn't working for me.

    On a side note, did you design it with multiple vehicles per account in mind? When I added my fiance's Model S to the account this broke almost every 3rd party app/interface previously.
     
  11. Mercury

    Mercury Member

    Joined:
    Dec 28, 2014
    Messages:
    27
    Location:
    Scottsdale, AZ
    If they ever do want to embrace any kind of community development, they're going to eventually have to do some kind of tiered access control, or maybe granting access through the stock app.

    Unfortunately, I can't think of a way to truly mitigate it without trust. OAuth itself won't solve the problem at all - even if you magically import an access token into an app, then the app could still simply pass the token upstream for the bad guy to take the car. Having some kind of "read-only" tier would be an excellent quick solution for Tesla, especially if they can come up with a way to manage credentials and pass the access token back (like Facebook does on Android/iOS).

    Until then, we're stuck with no apps - or trust, which is definitely hard to come by with a car this valuable.
     
  12. wk057

    wk057 Senior Tinkerer

    Joined:
    Feb 23, 2014
    Messages:
    4,722
    Location:
    Hickory, NC, USA
    Right. Definitely need Tesla's support to make a secure solution.

    In the mean time, the next best thing is open source.
     
  13. Mercury

    Mercury Member

    Joined:
    Dec 28, 2014
    Messages:
    27
    Location:
    Scottsdale, AZ
    Yep. Although opening the source doesn't resolve the trust issue very well, unless people are actually building the APK from source and installing it. But, hey, that's better than nothing. Speaking of which, I PM'd you a link to it, if you want to build it and give it a spin to see what Tesla is coming back with at auth time.
     
  14. wk057

    wk057 Senior Tinkerer

    Joined:
    Feb 23, 2014
    Messages:
    4,722
    Location:
    Hickory, NC, USA
    True.

    I'm going to tinker with it tonight most likely and I'll let you know. Thanks. :)
     
  15. wk057

    wk057 Senior Tinkerer

    Joined:
    Feb 23, 2014
    Messages:
    4,722
    Location:
    Hickory, NC, USA
    So, I put the source into Android Studio, compiled, and ran in debug mode....... and it works fine.

    2015-03-15 03.03.18.png

    Installed the APK from the store, ran, fails as posted earlier.

    :confused:
     
  16. Mercury

    Mercury Member

    Joined:
    Dec 28, 2014
    Messages:
    27
    Location:
    Scottsdale, AZ
    All right, glad to see multiple cars working! Likely culprit is Proguard or something in the release settings - good data to have. Once I get some coffee in me, should be easy pickings to kill.
     
  17. Mercury

    Mercury Member

    Joined:
    Dec 28, 2014
    Messages:
    27
    Location:
    Scottsdale, AZ
    Quick thread necro: I set up a repo for this little app and updated the version in Google Play to strip out the Proguard stuff that was causing trouble. I also fixed an annoying bug that would sometimes stop the real-time monitoring of the car during a charge. The repo is here: https://github.com/ninthmike/chargeguy

    Note that the source being available doesn't magically make the app safe in Google Play, as there's no proof that the source in the repo was used to build the one in Play. So if you want to use this, you have two options:

    1) Trust me and install the app from Play. Google could easily find malicious code in the APK if someone reported a car stolen and I have made no attempt to conceal my identity or personal data. And my P85D gets very jealous, so stealing someone's car would probably lead to a major relationship issue.

    2) Totally understandable not to trust me. In that case, install Android Studio and pull from the repo to build it yourself. It's actually not that hard to do and I'm sure Google will turn up some guides for doing just that with a little research. Or if you know an Android dev you trust, I'm sure it'd be duck soup for them to handle it. Or if you want to meet up at Tavern Americana for a pint and some Tesla talk (Scottsdale, AZ), then I'll do it. :wink:
     
  18. jpcarreiro

    jpcarreiro Member

    Joined:
    Dec 1, 2014
    Messages:
    20
    Location:
    London, UK
    Thanks for the code Mercury.
     

Share This Page