Teslascope Binding

Hi All,

Given the state of the Tesla Fleet API and the unknown around how charging will be applied, I’ve started working on a binding for Teslascope.

I use Teslascope anyway for my cars, and it has an API, so I figured why not use it.

This binding is at VERY early stages of development - currently no commands are working - and as of today, I’m only extracting:

  • Vehicle Name
  • VIN
  • Vehicle State
  • Odometer
  • Battery Level
  • Charging State

More data is to come - Teslascope supports a lot of data - see Developer Documentation (Vehicles) - Teslascope

Vehicle command support isn’t as extensive as the current Tesla binding, see Developer Documentation (Vehicles) - Teslascope but Charge Start/Stop is supported (but not documented). The Teslascope developer also has plans to expand the API.

Teslascope does require a nominal subscription, but it’s likely/possible that use of the Tesla API will also be non-free.

I’ll post a link here once I’ve fleshed out support for more items, then will start adding support for commands. My main need is starting climate support and charging start/stop.

1 Like

FWIW - code is at GitHub - psmedley/openhab-addons at teslascope

I’ve now added pretty much all the channels from the ‘Tesla’ binding that exist in Teslascope. I’m now extracting all that information from the json returned by teslascope, I just need to add the code to update the values into the channels.

Once that is done, I’ll work on command support.

1 Like

Initial release is at https://smedley.id.au/tmp/org.openhab.binding.teslascope-4.2.0-SNAPSHOT.jar

Currently, this is read-only - no commands are supported. Over the coming days, I’ll add support for the commands that Teslascope support, ie those described at Developer Documentation (Vehicles) - Teslascope + stop/start charge.

Commands now supported… anyone else using OpenHAB and Teslascope?

1 Like

Thanks a lot, I will try it this weekend / next week.
I’m using Teslascope, so I’ll be happy to try your Integration.

1 Like

I have installed and tried the binding. However, as soon as I enable an error is shown

Cannot invoke “com.google.gson.JsonElement.getAsJsonObject()” because the return value of “com.google.gson.JsonObject.get(String)” is null

while the url that will be build in the code acctually returns a response

1 Like

Make sure your api_key is entered correctly in the config. I got bitten in testing as double clicking it to ‘copy’ missed the part after the hyphen. I’ll work on adding some code to catch the error returned by Teslascope and give something a bit more useful than a Json error.

Also if you can enable trace logging and post me the log I can see what’s happening.

Edit: I updated https://smedley.id.au/tmp/org.openhab.binding.teslascope-4.2.0-SNAPSHOT.jar

It should now catch and report the return code returned by Teslascope.

Apologies to anyone who has already installed and has this running, I renamed some channel names to bring them into line with the OpenHAB naming conventions.

The update was helpful… It makes me realis that I needed to hit save before enabling the thing after making changes in the config. I was just testing against a wrong pubic id.

The binding itself seems to work. Reading the date goes fine. Commands are failing with a 500 response from the API, although that seems a teslascope issue since in their portal it doesn’t work either. I’ll check again later.

Thanks for the good work.

1 Like

For commands, make sure you’ve setup a virtual key via Tesla scope.

I don’t wanne make you tesla scope support center… but the key is configured fine.


although even from within teslascope itself it’s resulting in an error

Interesting! Commands are definitely working for me - perhaps check the keys in your car and see if Teslascope is listed as having access.

I am very pleased to see that you are developing this binding. I too am interested mainly in Climate (and conditioning) control along with Start/Stop charging.

I have created an account on Teslascope (free initial period), created the key and checked that Teslascope has access on my Tesla Account (web). Also I tagged my vehicule as Public in Teslascope (would rather not if it is not mandatory).

The binding can read states (Temperature, vehicule name, etc.) but the one item (switch) I tried, i.e. Lock/Unlock does not seem to work. Openhab log shows the command going out and state change, but nothing happens on the car and in the Tesla App. Also changing the lock state via the Tesla App is not reflected in the binding (even after a minute or so).

Thanks for testing :slight_smile: For commands, note that currently, Teslascope only supports:
honkHorn, flashLights, enableSentryMode, disableSentryMode, startAC, stopAC, ventWindows, closeWindows, openTrunk, openFrunk, openChargeDoor, closeChargeDoor + Start/Stop Charging

Unlock status should be detected if it’s reflected in Teslascope, I’ll try investigate later.

There is no need to set the car to ‘public’ in Teslascope - both my cars are set to Private.

Tested with the open/close charge port item.
The car responds correctly to the commands from the binding, and the state is also reflected correctly in the Tesla App. However commands from the Tesla App (and corresponding action on the car) are not reflected in the item. I watched the real-time ‘Tail’ of the Openhab log and no incoming messages on those occasions.

One thing I noted in one of your previous posts is that one can check in the car under “keys” to see if Teslascope is listed: I do not see anything about Teslascope as I see only my card keys and Phone keys. As mentioned, I do see the Teslascope access confirmation in my Tesla online account.

FWI may car is a 2023 M3 (software 2024.20.7)

re: commands from the app not showing in OpenHAB… are you able to confirm if the status is correctly reflected in https://teslascope.com/ ? the OH binding can only reflect what Teslascope is reporting…

I may be wrong about the ‘key’ showing in the car, I’ll check my cars a bit later this morning.

Looks like Openhab indeed follows the states as they appear in Teslascope. But the Teslascope site seems to be constantly out of sync, even when the commands are sent from it’s interface:

 The Trunk open/close commands operate the trunk OK, but the icon "OPEN TRUNK" in the 
 interface never changes state, so it does not seem to change the item state in Openhab.

 The Charge port open/close command is hit and miss, especially the on close command.

I do not know if this is normal behavior at this point (the UI is a little baffling), but I am only interested in Climate (and preconditionning) along with start/stop and scheduled charge. If I can get those items to work, I will be happy. I will test this over the next couple of days.

I’m using autoconditioning when my wife’s car is at school at her finish time, and charge on/off to automate charging based on grid pricing - these are the two main features I needed.

Incidentally, looking at the page source at Teslascope, I see how to support some more commands :slight_smile:

It should be possible to add support for:
door locks on/off
dog mode enable/disable
windows vent/close
trigger homelink
AC start/stop
defrost enable/disable
camp mode enable/disable
steering wheel heater enable/disable
seat heaters enable/disable

Updated build at https://smedley.id.au/tmp/org.openhab.binding.teslascope-4.3.0-SNAPSHOT.jar which will be part of OH 4.3. Docs at Teslascope - Bindings | openHAB

Apologies to anyone who had started testing the previous builds, as part of the review cycle, the ‘thing’ type changed from service to vehicle.

Hi Paul,
With the lastest Tesla App version I have (v4.35.5-2775), Tesla has improved the flexibility for all-around pre-conditioning. Ex: If I want to have the car ready to go at 9:00AM and let the car do all the ‘calculations’ in terms of when to start pre-conditioning, when to start charging and when to adjust climate, I go in Schedule and set “Precondition by 09:00AM”, set ’ Stop charging at 09:00AM" (with no start time) and finally set the charge limit I want to have at 09:00AM (ex: 95%).

Now I would like to be able to do this in Openhab :slight_smile: Questions: Do you have access to all the commands in the Tesla Fleet API? Can you add the appropriate API commands to the binding so that I can set a ‘Departure time’ and send the required commands to have the car take care of it? This would be specially in winter where it is important to have the battery at an optimal temperature when beginning a drive.
Thanks,
Francois