Sense app controlling Tesla charging with excess solar

Recently the Tesla API (as seen in the Tesla App) became able to change the car’s charge rate remotely. This means that the Sense App now knows how much excess solar production there is AND it could send signals to our Teslas to absorb that excess instead of letting it got back to the grid where we lose it’s value.

My Sense is NEVER going to be able to detect my Tesla as I don’t charge full speed all the way to full (which you shouldn’t do), so I have put a TP-Link on it and turn it on during the day. But if Sense really wanted to help those of us with Teslas they should add this charging integration to maximize our Tesla/Solar/Sense investment.


It sounds like you are using a TP-Link to turn on/off your tesla charger. You should be able to setup a IFTTT applet to turn the TP-Link/KASA plug on when solar > usage and off when <.

I agree, “You SHOULD be able to setup an IFTTT applet” too bad the only things IFTTT can do in relation to Sense is to react to devices turning off and on, kinda useless for discovering my surplus solar.

I did end up taking someone’s code from here and making an app that will turn off and on the Tesla charging by talking directly to the car and sending requests based on any surplus. It’s ~working~ but needs to experience many more corner cases. I got it to the point where it will react correctly to the charging being turned on some other way than thru the Python script, and correctly reading the charging amps from the car.

I am currently adding the ability to up the charge rate using the new ability to set the charge current remotely. Just waiting for the sun to come out to see if I got the code right, stupid fog.

You’ll have to share the code with everyone once you have it all worked out. I’m sure a lot of users would like the TOU rates figured into this. I assume if the NEM 3.0 passes in CA, we will be seeing a lot of off grid systems running in conjunction with the grid systems. All of those will be needing a device to communicate / control devices between the grid system and off grid systems to maximize their usage.

In the past, we’ve refrained from developing anything dependent on unofficial/unsupported API’s due to the implications if something changes in terms of access for 3rd parties. I have to check-in on this, but that’s been one significant roadblock for us in the past when a Tesla integration has been suggested.

Unofficial/unsupported API’s like the one for Sense?

That’s correct. It might seem counter-intuitive, but we obviously have more control/understanding over changes that could impact usability of some of the user-created tools leveraging our unofficial API.

1 Like

OK, it’s very preliminary, but it runs for 24 hours and I THINK I got all the bugs out today, but then the sun went down, so I’ll test more tomorrow.

In the mean time, you can check it out and any bugs that I find I’ll update the code at my GitHub archive:

Just download the code, edit it and change the usernames and the Sense password to your own and launch it at the command line with python3, I am sure there are some packages that will need to be installed on your system and I’ll update the ReadMe as I figure it all out.

I would love any feedback or issues you have trying to get it to work.

OK, after MANY months of testing the latest version of TesSense, the app for charging your Tesla with extra solar that would go back to the grid is on GitHub and I actually have TWO users from Tesla Motors Club using it already. I am sure there are more Tesla owners on a Sense forum than there are Sense owners on a Tesla forum so I am also posting here. Since I don’t check this forum often (it’s been since February) you can also find me at:

I have added a few cool features not only calling SenseLink to update Sense with my Tesla’s charging power, but calling TPLink to get the power used by select smart plugs and controlling when they turn off and on so that big ticket items get the bulk of solar generation.

Specifically I have a Tesla controlled by the TesSense part of the app, also my wife’s Mitsubishi iMiev, my Vectrix electric motorcycle, and my wife’s office space heater are all controlled by the TPLink part that are plugged into smart plugs so when the Hot Tub, the Dishwasher, the Oven, the Iron or any other high draw device takes all the free solar they turn off, and when done, my devices, or any I put in the list, will come back on and use free solar until the sun goes down…

Any questions on how to install should be obvious by looking on the GitHub site as above, also all future updates can be found there:


@israndy, thanks again for sharing your solution for charging EVs off of available solar. I haven’t had a chance to wade into TesSense yet, but was reminded of you when I saw this this this AM - a whole thread in the Home Assistant forum on the topic.

Ha! I started reading thru. They have a LOT to learn about what they are doing, but since I don’t have Home Assistant integration going on I’ll probably not get into it. I have a working solution that runs in a Terminal on my computer and get’s more and more stable as the months progress.

But thanks for linking it. I may explore

1 Like