Welcome to Tesla Motors Club
Discuss Tesla's Model S, Model 3, Model X, Model Y, Cybertruck, Roadster and More.
Register

TeslaMS tools for telemetry data visualization

This site may earn commission on affiliate links.
We should be precise in our language regarding the underlined: "... that we know of."

There may be an "update_pending_state" or "initiate_update" command that we just haven't discovered yet.

Yes, I will make sure to add "...that we know of, as of today" next time. Particularly since forums posts last a long time and I would expect that we will discover new commands or have them revealed in future mobile apps or official SDKs.
 
We should be precise in our language regarding the underlined: "... that we know of."

There may be an "update_pending_state" or "initiate_update" command that we just haven't discovered yet.
Yes, it's good to be precise with wording, but let's face it, do you think the REST api has a command to initiate an update? That seems rather far fetched.

Either way, this thread is about the visualization, right? I have a ton of code in flight that I hope to push in a day or two.
Sadly my data gathering process died yesterday morning, 10 miles into a 340 mile trip with two SC visits and a low of 8 miles of rated range. So I didn't get to collect any of those data which has me totally bummed.
I really need some help from someone more experienced in JavaScript programming to make sure that the streaming.js becomes more resilient and doesn't crash... regardless what happens. I really want to see it recover gracefully...
 
Yes, it's good to be precise with wording, but let's face it, do you think the REST api has a command to initiate an update? That seems rather far fetched.

Either way, this thread is about the visualization, right? I have a ton of code in flight that I hope to push in a day or two.
Sadly my data gathering process died yesterday morning, 10 miles into a 340 mile trip with two SC visits and a low of 8 miles of rated range. So I didn't get to collect any of those data which has me totally bummed.
I really need some help from someone more experienced in JavaScript programming to make sure that the streaming.js becomes more resilient and doesn't crash... regardless what happens. I really want to see it recover gracefully...

I run streaming.js on Windows and I setup a service that will automatically restart it if it fails for any reason. If that's a target platform of interest I can post a description of the tools I used to setup Node.js apps as service.
 
@dirkhh Have you tested to see if the charts generated by visualize.js display properly on the console browser in the car? I know it sounds silly but I can see having a bookmark to check that everything is working. I found that some of the other javascript charting tools I use didn't work in the Tesla console (even though they work on every browser, phone, and tablet that I tried).
 
I run streaming.js on Windows and I setup a service that will automatically restart it if it fails for any reason. If that's a target platform of interest I can post a description of the tools I used to setup Node.js apps as service.

Yes, I'm a Windows guy, and I just got it up and running, both the streaming (using db), and the visualize.js. Had some debugging to do, did not quite understand the --db argument, but got it sorted out now. My question is, when I hammer the service (streaming), the REST API won't give me any new token anymore all of a sudden. Also, can I do 'streaming' and use the Phone App to remote control at the same time, or will that overwhelm the requests / min and cause a shutdown?

I have some changes to streaming.js, since the nFields is computed wrong (since it is the string length instead of the number of fields), and some debugging changes to visualize.js.

Thanks so much for this great framework!
 
@dirkhh Have you tested to see if the charts generated by visualize.js display properly on the console browser in the car? I know it sounds silly but I can see having a bookmark to check that everything is working. I found that some of the other javascript charting tools I use didn't work in the Tesla console (even though they work on every browser, phone, and tablet that I tried).

No I have not. But since I'm finally near my car again (charging at 1.3kW right below me in the garage of the rented vacation house) that's easy to do later today.

Right now all my rewrites have created a bit of a mess - I need to clean things up today and push a stable state to you before going any further...
 
Last edited:
Yes, I'm a Windows guy, and I just got it up and running, both the streaming (using db), and the visualize.js. Had some debugging to do, did not quite understand the --db argument, but got it sorted out now. My question is, when I hammer the service (streaming), the REST API won't give me any new token anymore all of a sudden. Also, can I do 'streaming' and use the Phone App to remote control at the same time, or will that overwhelm the requests / min and cause a shutdown?
the streaming API doesn't cause huge load for them. You can connect to it from multiple machines and things are fine.
What can get you in trouble is too many REST api calls. And that includes too many attempts to get a token. So those calls always need a timeout.
I have some changes to streaming.js, since the nFields is computed wrong (since it is the string length instead of the number of fields), and some debugging changes to visualize.js.
That's my code and I'm not surprised at all. I am completely new to JavaScript and hate the way its variables change type on me.

Can you send me a patch? Or a pull request on github to @hans?

I really would love to have someone more experienced with JavaScript to help here...
 
Current visualization options

Here's an example of what one can do with the code I pushed to Hans early this morning.

First the Energy Chart: the top one shows speed, power, regen while driving, in the middle current/voltage when charging (plus kW and miles/hr if you hover over the graph), on the bottom the SOC (with charges above 90% and below 10% shown red).

I just notice that I should remove the non-driving energy added (the green bars) in the top graph as they are much better illustrated in the charging graph. Or maybe it's interesting to see how small they are compared to the power spent / regen while driving :)

The second view is the daily summary chart - energy used while driving (so the combination of energy used to accelerate and recovered by regen), miles driven (and Wh/mile for that day) and kW charged.

I'd love to hear some feedback. What would people like to be able to do? What other graphs would be useful?

Anything that we can do from the data in the database is on the table :)

EnergyChrat.png


SummaryChart.png
 
Here's an example of what one can do with the code I pushed to Hans early this morning.

I'd love to hear some feedback. What would people like to be able to do? What other graphs would be useful?

Very nice work dirkhh. You are like the energizer bunny going nonstop creating all these cool visualizations. I just wanted to publicly say thank you for your excellent contributions.
 
Very nice work dirkhh. You are like the energizer bunny going nonstop creating all these cool visualizations. I just wanted to publicly say thank you for your excellent contributions.
Oh you are so welcome. I'm having FUN. I just hope this is useful for others, too. As I said, looking for feedback.

BTW, there was a question a couple of days ago that I wanted to answer with a picture. Yes, this does work nicely on the in car browser :)

InTesla.jpg
 
Having problems. Going to dig some more, but can't get visualize to work. It runs, but when I connect, I get no data received and visualize crashes. This is v0.6.5, pulled via npm. Storing in / retrieving from a MongoDB called "tesla". FreeBSD, ports install of npm, node, and mongodb, default configuration (no authentication). Mongo version is 2.4.4; NPM is 1.2.28; node is 0.10.15; v8 is 3.18.5.

This particular line in mongo_client is in _finishConnecting, after the authentication section. The streaming module works fine and there's plenty of data in the DB.

Caution: I'm not an expert at Mongo. I know enough to be very dangerous. mongodump dumps a good amount of data.

Thoughts?

onyx:140:~>visualize -v -d tesla -r 20
Server running
====>request is: / { 'user-agent': 'Wget/1.14 (freebsd8.3)',
accept: '*/*',
host: 'localhost:8766',
connection: 'Keep-Alive' } GET
request for /
done sending the initial page
connected to db

/usr/local/lib/node_modules/teslams/node_modules/mongodb/lib/mongodb/mongo_client.js:411
throw err
^
ReferenceError: from is not defined
at /usr/local/lib/node_modules/teslams/examples/visualize.js:92:21
at /usr/local/lib/node_modules/teslams/node_modules/mongodb/lib/mongodb/mongo_client.js:408:11
at process._tickCallback (node.js:415:13)
 
Having problems. Going to dig some more, but can't get visualize to work. It runs, but when I connect, I get no data received and visualize crashes. This is v0.6.5, pulled via npm. Storing in / retrieving from a MongoDB called "tesla". FreeBSD, ports install of npm, node, and mongodb, default configuration (no authentication). Mongo version is 2.4.4; NPM is 1.2.28; node is 0.10.15; v8 is 3.18.5.

This particular line in mongo_client is in _finishConnecting, after the authentication section. The streaming module works fine and there's plenty of data in the DB.

Caution: I'm not an expert at Mongo. I know enough to be very dangerous. mongodump dumps a good amount of data.

Thoughts?

Your URL is incorrect.
That's the next thing I'll work on: better handling of the URL.
You need
http://localhost:8766/energy?from=2013-8-20-0-0-0&to=2013-8-25-0-0-0
(For example... Typing on the phone. I'm driving my Tesla back home from Sunriver (180 miles in an S60...))
You need both from and to and the dates are six numbers with dashes between them... As I said, I know this needs work
 
I still get the following if I don't start visualize from the examples directory. Looks like there are a few relative path names in the code.
That's fine, we just have to document that visualize must be started from the teslams/examples directory.


[~] $ visualize -d tesla
Server running


/usr/local/lib/node_modules/teslams/examples/visualize.js:218
if (err) throw err;
^
Error: ENOENT, open './energy.html'


When I try and load the URL http://127.0.0.1:8766/energy it doesn't exit and it displays "Invalid query format" on the web page.
When I try and load the URL
http://127.0.0.1:8766/ it does exit with the same error as FlasherZ.

Perhaps a request to http://127.0.0.1:8766/ should display a page with usage information, or a form like at the top of the charts.
 
I've been playing with teslams for a few months now and just updated to v0.6.6 with npm so I can start playing with the new graphs.

I assume I need to add some additional values to my "streaming.js" command line to capture charge related data like voltage and current.

What values are you capturing and storing in MongoDB?

Thanks for the great work!
 
Your URL is incorrect.
That's the next thing I'll work on: better handling of the URL.
You need
http://localhost:8766/energy?from=2013-8-20-0-0-0&to=2013-8-25-0-0-0
(For example... Typing on the phone. I'm driving my Tesla back home from Sunriver (180 miles in an S60...))
You need both from and to and the dates are six numbers with dashes between them... As I said, I know this needs work

Ok, that worked... I was following the instructions off the github page, which says:

visualize.js - Display historical or realtime streaming data in a browser using Google Maps and provide an energy/speed graph
A sample application that uses streaming data collected in MongoDB by the streaming.js app and makes it visible in a browser.

To execute run:

For help run:

visualize --help

Point your browser to http://localhost:8766 to view the map.

Visiting http://localhost:8766/energy?from=----&to=---- displays a speed / energy graph for the given time period. For example http://localhost:8766/energy?from=2013-08-01-7-08&to=2013-08-01-7-52 for your data from 7:08 until 7:52 in the morning of August 1st.

I thought that just going to the root of the server would give me useful options / a map based on that. :)

Is there any way to generate the sample map that is showed by the instructions for the streaming API (the one with location / the path of the car)?
 
Last edited:
I still get the following if I don't start visualize from the examples directory. Looks like there are a few relative path names in the code.
That's fine, we just have to document that visualize must be started from the teslams/examples directory.


[~] $ visualize -d tesla
Server running


/usr/local/lib/node_modules/teslams/examples/visualize.js:218
if (err) throw err;
^
Error: ENOENT, open './energy.html'


When I try and load the URL http://127.0.0.1:8766/energy it doesn't exit and it displays "Invalid query format" on the web page.
When I try and load the URL
http://127.0.0.1:8766/ it does exit with the same error as FlasherZ.

Perhaps a request to http://127.0.0.1:8766/ should display a page with usage information, or a form like at the top of the charts.
Yes. Relative paths everywhere. Added to todo list :)
And as I said - need to fix the parsing of arguments (and do something useful with no query arguments, like past 12h)

- - - Updated - - -

I've been playing with teslams for a few months now and just updated to v0.6.6 with npm so I can start playing with the new graphs.

I assume I need to add some additional values to my "streaming.js" command line to capture charge related data like voltage and current.

What values are you capturing and storing in MongoDB?

Thanks for the great work!
All the streaming data plus some climate data and charging data.