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.
I think I see the problem. I merged in some changes and the BASE URL now has an extra '/' at the end. I bet it will work if you leave out the leaving '/' but I can fix it. This is only a problem with database names with a leading '/' character but it should be handled better.
 
I think I see the problem. I merged in some changes and the BASE URL now has an extra '/' at the end. I bet it will work if you leave out the leaving '/' but I can fix it. This is only a problem with database names with a leading '/' character but it should be handled better.
You should probably fix that, but that doesn't seem to be it.

I tried removing the / and I still get the same error.
 
You should probably fix that, but that doesn't seem to be it.

I tried removing the / and I still get the same error.
Then maybe the BASE URL in your config.json?

It's working for me even with the leading '/' in the database name and using the same database name as you have.

[visualize] $ node ./visualize.js --db /home/tesla/tesla
didn't find 'visualize' property in config file, web authentication turned off
Using listen port (8766) set by $PORT environment variable
js-bson: Failed to load c++ bson extension, using pure JS version
Using MongoDB URI: mongodb://127.0.0.1:27017//home/tesla/tesla
Server running on port 8766
2016-01-24T18:52:59.314-0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:54096 #403 (6 connections now open)
2016-01-24T18:52:59.326-0800 I NETWORK [conn403] end connection 127.0.0.1:54096 (5 connections now open)

From the error you posted I see it's line 177 of visualize.js were the error is thrown and that is the line that is trying to read the base URL from the config.json.

This is my config.json and its working fine for me. Works both with a baseUrl set, or set to a null string, or missing altogether .
Setting baseUrl to "/" seems to mess up the UI but I still don't get the error you see.

Code:
{
    "username": "[email protected]",
    "password": "SuPERS3cr3t",
    "visualize": {
        "baseUrl" : "",
        "webusers": [
            { "id": 1, "username": "hans", "password": "hans" },
            { "id": 2, "username": "bob", "password": "bob" }
        ]
    },
    "awsiot" : { 
        "keyPath" : "/Users/hans/.teslams/somePrivateKey.pem",    
         "certPath" : "/Users/hans/.teslams/someCert.pem",            
        "caPath" : "/Users/hans/.teslams/someRootCA.pem",    
         "clientId" : "MYAWSCLIENTID",                                
        "region" : "us-east-1"                                        
    }
}
 
Last edited:
Quick question, I noticed that npm installs 1.0.8 of teslams, but github is showing 1.1.0, what's the planned timeline for getting the npm version updated?

There were enough changes in the 1.1.0 version that I wanted to test it all out before publishing to npm. It's been running fine for me for 2 days without nap mode on but I still wanted to test it with with nap mode.
 
How does one enable nap mode?

-z, --zzz option on streaming.js

It will pause data collection when the car is parked and not charging in order to let the vehicle fall asleep and save power.
It then monitors the car and doesn't try and collect new data until the car wakes again on it's own.
Unfortunately if you park the car, trigger nap mode, and then get back into the car and start driving, you can lose up to 30 minutes of telemetry.

I want to enhance this nap mode feature to allow for time of day exceptions (i.e. try nap mode only at night) or geospatial exceptions (enable nap mode at home, but not when i park the car at the Starbucks).
 
I had another post here about the format change - I thought the API had changed... it just appears the storage of the data in the DB has changed...

Was this document structure intended? The array of numerical digits looks a bit wonky.

Code:
{
        "_id" : ObjectId("568b23f6c147a4e4683cd01d"),
        "ts" : 1451959286915,
        "vehicles" : {
                "color" : null,
                "display_name" : "Tessie",
                "id" : {
                        "s" : 1,
                        "e" : 16,
                        "c" : [
                                2,
                                0,
                                3,
                                6,
                                8,
                                9,
                                1,
                                8,
                                2,
                                x,
                                x,
                                x,
                                x,
                                x,
                                x,
                                x
                        ]
                },
                "option_codes" : "MS01,RENA,TM02,DRLH,PF01,BT85,PPSR,RFPO,WT21,IDCF,IZMB,TR01,SU01,SC01,TP01,AU01,CH01,HP01,PA00,PS01,AD02,X001,X003,X007,X011,X013,X024,X019,COUS",
                "vehicle_id" : 296xxxxxx,
                "vin" : "5YJxxxxxxxxxxxxxx",
                "tokens" : [
                        "ca9aba1fffxxxxxx",
                        "be738567a1xxxxxx"
                ],
                "state" : "online",
                "id_s" : "20368918261xxxxxx",
                "remote_start_enabled" : true,
                "calendar_enabled" : true,
                "notifications_enabled" : true,
                "backseat_token" : null,
                "backseat_token_updated_at" : null
        }
}

There's a problem with the visualization display of the car:

North American Signature
signature red
panorama roof
silver 21" wheels
carbon fiber decor
third row seats
air suspension
super charger enabled
tech package
audio upgrade
dual charger
carbon fibre spoiler

Firmware Version: unknown

Display Settings: metric

It's not too big of a deal... but just letting you know it doesn't seem to work. Latest GIT pull from this morning.
 
Last edited:
I had another post here about the format change - I thought the API had changed... it just appears the storage of the data in the DB has changed...

Was this document structure intended? The array of numerical digits looks a bit wonky.

Code:
{
        "_id" : ObjectId("568b23f6c147a4e4683cd01d"),
        "ts" : 1451959286915,
        "vehicles" : {
                "color" : null,
                "display_name" : "Tessie",
                "id" : {
                        "s" : 1,
                        "e" : 16,
                        "c" : [
                                2,
                                0,
                                3,
                                6,
                                8,
                                9,
                                1,
                                8,
                                2,
                                x,
                                x,
                                x,
                                x,
                                x,
                                x,
                                x
                        ]
                },
                "option_codes" : "MS01,RENA,TM02,DRLH,PF01,BT85,PPSR,RFPO,WT21,IDCF,IZMB,TR01,SU01,SC01,TP01,AU01,CH01,HP01,PA00,PS01,AD02,X001,X003,X007,X011,X013,X024,X019,COUS",
                "vehicle_id" : 296xxxxxx,
                "vin" : "5YJxxxxxxxxxxxxxx",
                "tokens" : [
                        "ca9aba1fffxxxxxx",
                        "be738567a1xxxxxx"
                ],
                "state" : "online",
                "id_s" : "20368918261xxxxxx",
                "remote_start_enabled" : true,
                "calendar_enabled" : true,
                "notifications_enabled" : true,
                "backseat_token" : null,
                "backseat_token_updated_at" : null
        }
}

There's a problem with the visualization display of the car:



It's not too big of a deal... but just letting you know it doesn't seem to work. Latest GIT pull from this morning.
The strange data in the 'id' field is just a workaround for the fact that Tesla made the new IDs larger than JavaScript can parse natively as JSON so I had to use a special encoding called bigInt. It's still valid javascript, just not as human readable. If you want the easy to read version see the id_s field which is the same number as a string.

PM me your option codes and I can debug the lack of display of your car in visualize.
 
Option codes are in the data above.

I think it's less about the options (they seem to be right, along with the car graphics). But firmware version and GUI display settings are wrong (it says 'unknown' and 'metric'... I use imperial).

- - - Updated - - -

I could probably delete all the guiSettings documents and let it refresh since they don't really change... Do you need them over time if I've never changed?
 
Option codes are in the data above.

I think it's less about the options (they seem to be right, along with the car graphics). But firmware version and GUI display settings are wrong (it says 'unknown' and 'metric'... I use imperial).

- - - Updated - - -

I could probably delete all the guiSettings documents and let it refresh since they don't really change... Do you need them over time if I've never changed?
I messed with the firmware stuff to make it display more versions correctly, maybe I messed something up on the unknown ones? (should still give the build number even if it doesn't know v7.0 or v7.1) (what build do you have?)
As for metric vs imperial... I don't think anything I touched should have affected that part....

hans: let me know what you find, especially if it's in the part I modified, I'm curious if I broke something... (and sorry if I did!)

FlasherZ: can you confirm what your car is, it's a sig, is it an 85? or a P85? I'm trying to fix the model number decoding.
 
Last edited:
I messed with the firmware stuff to make it display more versions correctly, maybe I messed something up on the unknown ones? (should still give the build number even if it doesn't know v7.0 or v7.1) (what build do you have?)
As for metric vs imperial... I don't think anything I touched should have affected that part....

hans: let me know what you find, especially if it's in the part I modified, I'm curious if I broke something... (and sorry if I did!)
It displays this way if the REST request for the data fail at startup. Usually if you quit and try again it works. I can have the code check for failed requests and try again. Really wish Tesla's APIs were more reliable.
 
I messed with the firmware stuff to make it display more versions correctly, maybe I messed something up on the unknown ones? (should still give the build number even if it doesn't know v7.0 or v7.1) (what build do you have?)
As for metric vs imperial... I don't think anything I touched should have affected that part....

hans: let me know what you find, especially if it's in the part I modified, I'm curious if I broke something... (and sorry if I did!)

FlasherZ: can you confirm what your car is, it's a sig, is it an 85? or a P85? I'm trying to fix the model number decoding.

It's a P85.
 
It's a P85.
That's unfortunate... it confirms that Tesla has an incredibly annoyingly convoluted way of presenting such things in the options stream, and that there is quite a lot of variety in how they chose to label it.

It also means that we're going to have to completely re-work that section if we want it to be accurate. My suggestion is that we're going to have to stop looking for individual option codes to try to identify parts of the badge, and start looking at groups of option codes to find it.
 
And I broke it again... :(

streaming is giving me this on the git pull from 2 days ago...
Code:
module.js:340
    throw err;
          ^
Error: Cannot find module 'mqtt'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/teslams/examples/streaming.js:12:12)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
ideas?
 
Version 1.1.3 published to npm.

Fixes
- streaming.js no longer writes "null" data to mongodb when requests for auxiliary REST data from Tesla fail or timeout
- visualize.js displays version number of Teslams
- visualize.js displays most current Display Setting and Firmware Version if available in mongodb
- visualize properly displays metallic blue and titanium car color

New features
- streaming.js now supports simultaneous output to both files and mongodb
- streaming.js now support nap mode on all output (previously it just did mongodb)
- streaming.js now supports publishing data to mqtt message broker
- streaming.js now supports publishing data to Amazon AWS IOT (useful for storing in Amazon DynamoDB and running Amazon Lambda rules on data)
- a new browser based realtime charting example app is included (uses mqtt output)
 
Last edited: