Thanks Muzzman1 !
I know it suck, any website could be exposed to be hacked. I've tried to use some good practice for user authentication, and most of the site is actually plain html files.
The frontend is 100% html only, so the actual page you request have no dynamic content into it, all query is done via API calls. For me, this was the best way to keep the backend code as simple and clean as possible. Also, you can actually see everything I've done, except the data gathering and database query for frontend API.
The actual backend API code have just little over 1000 line of code that generate dynamic contents which can easily be audited. That part is most clean section of the site
The frontend html and JS is a BIG MESS to anyone looking at it I guess... I've done web site back in 1998 and my html technique haven't updated much since then (I'm a table kind of guy
. So lot of thing have been experimentation which I'm surprised it worked so well across multiple browser and devices. And since it just frontend, it doesn't bother me much in term of security. (Though, there is a few things that I'll have to address before I give people ability to share their informations to others).
What worried me the most of is people with bad intent just to disturb the service. I don't control Tesla servers and there is some limitation in the action I can do to protect it without making it annoying for the rest of us. I know lot of way to actually do it. Tesla could decide to stop this service all together.
My actual biggest concern for the future is how do I scale the service as it seem new user registration are coming in steadily now. How will Tesla react if there is too much user using it (I've began contacting them). How costly will it be to host it, and at some point, it might be more than just a fun project and require much more time to handle the traffic...
I would love to keep this free, but I'm realizing now that it is not possible.
Since I store your data, I don't think you guys want that I let just anyone have access to the backend to help me out. So if I gather help, that mean I'll have to create a corporation, draft legal document and hire people.
I might own a Tesla (Well, the bank own most of it still), but the I need to be careful with my budget to shoes the car... So my funds are very limited !
So I got no idea where I should bring this next... As I write this post, 6 other people registred on the site. I want to share this tool to everyone who might find it useful. How would you guys react if I charge for it ? How much is ok ? And if I charge, how many user will want to keep using the service. How will Tesla react if I charge for something that connect to their API... Will they charge me an commercial API access fee...
I've been talking to one of the site user and first tester about integrating OBD data as well, which would give us more information about the car than the API provide, and as well allow to have more than just tesla being tracked.
Just sharing with you guys my current reflection on this whole thing...
It all fun and game until someone have to pay
- - - Updated - - -
Registered... Love it so far.
Feature requests etc...
* will this pick up my X when it joins my stable in a few days?
* Of course being me I want more stats... Run a regression through all of the factors effecting efficiency (elevation, wind, temperature, speed, HVAC, etc) to figure out what each costs and add them in so I can see what is causing what in each trip... The left over would be driving style and road conditions.
* more average and totals like average efficiency and total distance per calendar month (currently I track this manually)
* careful not to get Tesla complaining about using too much mobile bandwidth and hence money
* ways to reduce energy use when not plugged in. For me going to 15 minute intervals batten midnight and 6 when not plugged in wouldn't cause issues but I don't know how much battery it saves... Basically with this using 2kwh/day that is about the equivalent of one third of my house's entire base electricity load.
* fix typo in warnings... Your -> you're in one spot.
For your Model X (CONGRATS by the way ! ), the car will display probably a white model S on the site (Also, some of the new car color is not supported... I lost my documentation on how to extract the Image archive from the Tesla Mobile APP APK). But it should start logging correctly unless tesla revamped the whole API which I doubt. If not, contact me ASAP and I'll make sure it work of course, the earlier you get data recorded on your car, the most interested it is in the long term ! (Sadly, I don't have the first ~10 000km off mine
More stats are in the pipe line !!!
Reports of your average Wh/km(or miles) per month, week, and even depending of different temperature bracket is in the work. I also want to detect when the car is stopped at street light and look at the kW used by the car to estimate how much is used for heating and extrapolate info from it...
It is my goal also to create some competition for efficiency between us
So have a leader board on different statistics.
Already trying to contact someone at Tesla HQ regarding the API and see how/if we can coexist happily !
I wish the car didn't use as much energy for it internal computer. Also, I wish I could get notify when the car start up... I got some idea I can experiment with, but that going to require lot of changed in the backend engine that capture the data, and it been very stable so I don't like to play much with that part of the code... But I'll get to it at some point.
There going to be lot of Typo to take care off... English not my native language, and I'm probably even worst in my native language (french).