Welcome to Tesla Motors Club
Discuss Tesla's Model S, Model 3, Model X, Model Y, Cybertruck, Roadster and More.
Register
  • We just completed a significant update, but we still have some fixes and adjustments to make, so please bear with us for the time being. Cheers!

TeslaMS tools for telemetry data visualization

green1

Active Member
Mar 25, 2014
4,548
1,121
Calgary, Alberta, Canada
- streaming.js now supports publishing data to mqtt message broker
That explains my issue, updating now...

grabbed 1.1.2 from npm and now I get this from streaming:

Code:
/usr/local/lib/node_modules/teslams/examples/streaming.js:466
            if (argv.db && data.charge_limit_soc !=== undefined) {
                                                    ^
SyntaxError: Unexpected token =
    at Module._compile (module.js:439:25)
    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)
    at startup (node.js:119:16)
    at node.js:902:3
 

hans

P631
Sep 27, 2012
1,132
13
Menlo Park
lol
That works better :)

- - - Updated - - -

So I've now added the -z option to visualize. Is there a way to tell if the car actually sleeps or not?

Visualize shouldn't actually call the car's API directly since it gets all its data from the mongodb database. Not sure that a -z option would turn on/off in visualize.
 

green1

Active Member
Mar 25, 2014
4,548
1,121
Calgary, Alberta, Canada
sorry, I meant to type streaming. I added the -z option to streaming, so the car should now be allowed to sleep, I just want to know if there's a way to check to see if it actually does.
 

ohmman

Plaid-ish Moderator
Feb 13, 2014
9,895
17,891
North Bay, CA
sorry, I meant to type streaming. I added the -z option to streaming, so the car should now be allowed to sleep, I just want to know if there's a way to check to see if it actually does.

You can check the file or db to see if it's updating. Mine definitely sleeps with -z. I'm planning to create two different launchers for streaming, one with sleep and one without. I'll use my home automation software to launch one or the other depending on certain variables (time of day, geolocation, vacation/trip mode, etc).
 

hans

P631
Sep 27, 2012
1,132
13
Menlo Park
sorry, I meant to type streaming. I added the -z option to streaming, so the car should now be allowed to sleep, I just want to know if there's a way to check to see if it actually does.

It's very hard to monitor the car without actually waking it up. You can see if the car is awake or offline with the "teslacmd -i" vehicle info command. Look for "state" to have a value of "online" or "offline" or "waking". A value of "offline" most often means the car is sleeping but it can also mean the car has driven out of cell phone coverage. Unfortunately, all other commands will cause the car to wake up.
 

green1

Active Member
Mar 25, 2014
4,548
1,121
Calgary, Alberta, Canada
It's very hard to monitor the car without actually waking it up. You can see if the car is awake or offline with the "teslacmd -i" vehicle info command. Look for "state" to have a value of "online" or "offline" or "waking". A value of "offline" most often means the car is sleeping but it can also mean the car has driven out of cell phone coverage. Unfortunately, all other commands will cause the car to wake up.
ok, maybe this is a silly question then, "always connected" would seem to imply always "online" then? but "power saving enabled" should allow sleep, so can it be "online" and asleep at the same time? or is power saving not sleep?
 

hans

P631
Sep 27, 2012
1,132
13
Menlo Park
ok, maybe this is a silly question then, "always connected" would seem to imply always "online" then? but "power saving enabled" should allow sleep, so can it be "online" and asleep at the same time? or is power saving not sleep?

I don't think "always connected" is the same and "online". I have put my car as "always connected" but it still does go to sleep at night. Perhaps not as deep a sleep as if I had "aways connected" off, but its saving electricity and reducing vampire drain somewhere other than the small amount that the mobile link is using.

- - - Updated - - -

I have my Amazon Echo accepting commands like "Alexa, turn my Tesla charger {on|off}", and "Alex, turn {on|off} my Tesla climate". I put a very early version of the code into github in the examples directly called "tesla_wemo.js". It emulates a WeMo switch in order to integrate to the Amazon echo without requiring any calls outside the home network.

I still want to add more complete phrases like "Alexa, set my Tesla charge limit to 90 percent" or "Alexa, what is the state of charge on my Tesla". However these need more than the basic WeMo on/off controls and will require more development and code running at Amazon. Stay tuned.
 

green1

Active Member
Mar 25, 2014
4,548
1,121
Calgary, Alberta, Canada
I don't think "always connected" is the same and "online". I have put my car as "always connected" but it still does go to sleep at night. Perhaps not as deep a sleep as if I had "aways connected" off, but its saving electricity and reducing vampire drain somewhere other than the small amount that the mobile link is using.
Hrmmm... well first thing this morning I did teslacmd -i and it said the car was online, nothing should have disturbed it over night as I have streaming set to -z, and nothing else should have been querying it. I'm starting to think my car never sleeps, I've never seen a time it didn't show "online" (power saving on, always connected on)

- - - Updated - - -

I have my Amazon Echo accepting commands like "Alexa, turn my Tesla charger {on|off}", and "Alex, turn {on|off} my Tesla climate". I put a very early version of the code into github in the examples directly called "tesla_wemo.js". It emulates a WeMo switch in order to integrate to the Amazon echo without requiring any calls outside the home network.

I still want to add more complete phrases like "Alexa, set my Tesla charge limit to 90 percent" or "Alexa, what is the state of charge on my Tesla". However these need more than the basic WeMo on/off controls and will require more development and code running at Amazon. Stay tuned.
I'm considering some stuff with teslacmd and my server, but right now what I really want is to get the control functions integrated in to a nice web page serving from my server, either on my own apache2 server, or integrated in to the visualize one.
Unfortunately I'm a little weak in this department, so although I can mangle existing code, I really don't know how to even start to create a web page to do this. If the control stuff existed in a tab in visualize I could certainly pretty it up, or even add new features, but I'm lost at how to add it in the first place.
 

hans

P631
Sep 27, 2012
1,132
13
Menlo Park
I have some basic integration with IFTTT working. If anyone has some use cases and more experience with IFTTT I am happy to see if I can implement it. Just send me a PM.
 

jayman

Member
Aug 31, 2013
329
118
Illinois
Is this anything to be concerned about?

8439721d99446806a76329ec452fee52.jpg
 

hans

P631
Sep 27, 2012
1,132
13
Menlo Park
Is this anything to be concerned about?

8439721d99446806a76329ec452fee52.jpg


No. HTTP 504 error code means that their public proxy (probably NGINX) timed out waiting for another internal system. I consistently see a small percent of all API calls to Tesla that time out and have to be retried.
 

FlasherZ

Sig Model S + Sig Model X + Model 3 Resv
Jun 21, 2012
7,024
1,013
One thing to watch out for when receiving your second car... it may take over your first car's slot.

We took delivery of Model X yesterday (Friday). The moment it was turned on for us after we accepted delivery, TeslaMS detected it as the "-O 0" car, and the original Model S as the "-O 1" car. So I had to switch everything around (and clean up some data). Good news is that it's easier to find when you can do a search for any records with odometer < 100. :)
 

hans

P631
Sep 27, 2012
1,132
13
Menlo Park
One thing to watch out for when receiving your second car... it may take over your first car's slot.

We took delivery of Model X yesterday (Friday). The moment it was turned on for us after we accepted delivery, TeslaMS detected it as the "-O 0" car, and the original Model S as the "-O 1" car. So I had to switch everything around (and clean up some data). Good news is that it's easier to find when you can do a search for any records with odometer < 100. :)

Well that's a pain. I suppose the code could check if the VIN matches from the prior data but that switchover could happen at any moment, not just at start time. Thank you for pointing this out so other lucky multi-car owners can watch out for this.
 

hans

P631
Sep 27, 2012
1,132
13
Menlo Park
I have had some success using a local copy of freeboard to make a customizable dashboard that can visualize the data coming from streaming.js via the new MQTT output.
Its been a struggle to get freeboard to publish and subscribe at the same time. I have each working in isolation but they collide when I try and do both. Freeboard seems very nice at visualizing but it's been enough of a struggle to create control buttons that I am open to trying another IoT visualization/dashboard tool if anyone knows one. I already have Node-red working in the background for the logic but the UI is not pretty for an end user. I am started down a path of just writing a web UI myself. It's an excuse to learn more about touch interfaces in javascript.

Screen Shot 2016-02-08 at 9.32.46 AM.png
 

green1

Active Member
Mar 25, 2014
4,548
1,121
Calgary, Alberta, Canada
Seem to have had a bit of an issue this evening, I just went for a half hour drive, spend an hour and a half at a location, and drove another half hour home. I have no data at all from the trip from visualize near as I can tell, it stops getting any data at 16:02 and doesn't get any more until 18:56, I left home at about 16:32 and returned at about 18:56

Looking at the logs I see:

Code:
11 Feb 16:02:28 - Info: 30 minute nap starts now
11 Feb 16:03:18 - Info: car is napping or sleeping, skipping auxiliary REST data
I thought that it only started a nap timer if I just parked? the car hasn't moved in a couple of days. even so though it wouldn't explain missing the whole trip half an hour later

Code:
11 Feb 16:31:30 - Vehicle state is: online
11 Feb 16:32:20 - Info: car is napping or sleeping, skipping auxiliary REST data sample
11 Feb 16:32:28 - 0 of 6 REST requests since 1455233540244
11 Feb 16:32:38 - Poll return HTTP OK and body is this:
11 Feb 16:32:39 - 1 of 6 Stream requests since 1455233549696


<--snip-->

11 Feb 16:35:00 - 6 of 6 Stream requests since 1455233674891
11 Feb 16:35:00 - Poll return HTTP OK and body is this:
11 Feb 16:35:01 - 7 of 6 Stream requests since 1455233674891
11 Feb 16:35:01 - Warn: throttling due to too many streaming requests per minute
too many streaming requests? why would that be happening? I don't have anything else streaming, when I look at my streaming log, the only time that appears is during this period, and in fact, it happens almost every minute from 16:35 to 16:59 (basically the whole time I was driving)

The return trip is a different issue, the log shows that the car was reporting offline the whole time I was driving:
Code:
11 Feb 18:31:53 - 0 of 6 REST requests since 1455240683878
11 Feb 18:31:54 - Info: car is in (offline) state, will check again in 1 minutes
11 Feb 18:32:23 - Info: car is napping or sleeping, skipping auxiliary REST data sample

<--snip-->

11 Feb 18:54:36 - Info: car is in (offline) state, will check again in 1 minutes
11 Feb 18:55:24 - Info: car is napping or sleeping, skipping auxiliary REST data sample
11 Feb 18:55:36 - 0 of 6 REST requests since 1455242124556


Then when I arrived home and plugged in, everything started reporting again.

Ideas? Am I doing something wrong somewhere? or is this just some freak occurrence?
 

FlasherZ

Sig Model S + Sig Model X + Model 3 Resv
Jun 21, 2012
7,024
1,013
I would guess freak occurrence. If the stream poll returned HTTP OK but a null body, and it appeared offline on the way back, it looks like the car wasn't properly connected up with Tesla. Perhaps bringing it home and plugging in caused it to switch to Wi-Fi, which caused the tunnel to renegotiate.
 

green1

Active Member
Mar 25, 2014
4,548
1,121
Calgary, Alberta, Canada
I would guess freak occurrence. If the stream poll returned HTTP OK but a null body, and it appeared offline on the way back, it looks like the car wasn't properly connected up with Tesla. Perhaps bringing it home and plugging in caused it to switch to Wi-Fi, which caused the tunnel to renegotiate.
That makes some sense for the way home, but the way there where it showed throttled seems to be something else, ideas?
 

FlasherZ

Sig Model S + Sig Model X + Model 3 Resv
Jun 21, 2012
7,024
1,013
That makes some sense for the way home, but the way there where it showed throttled seems to be something else, ideas?

Actually, that's what I was suggesting. The "too many streaming requests" means that TeslaMS made a request to Tesla's servers, and the long poll returned too quickly. When you make the request to the streaming server, it's supposed to be a long poll for ~2 minutes. When the request returns, TeslaMS starts a new one. If the streaming server returns too quickly on a repeated basis, TeslaMS stops sending requests so that it isn't pounding Tesla's servers.

It could be that the car wasn't connected to Tesla's servers and is unavailable - I've seen that happen; it could also be because of some type of outage on Tesla's servers. Either way, there wasn't a connection there.

I don't think it's anything to worry about. I have the occasional holes in my data too. :)
 

About Us

Formed in 2006, Tesla Motors Club (TMC) was the first independent online Tesla community. Today it remains the largest and most dynamic community of Tesla enthusiasts. Learn more.

Do you value your experience at TMC? Consider becoming a Supporting Member of Tesla Motors Club. As a thank you for your contribution, you'll get nearly no ads in the Community and Groups sections. Additional perks are available depending on the level of contribution. Please visit the Account Upgrades page for more details.


SUPPORT TMC
Top