[APP][Pro] Tesla Smart Charger

Preheat the car in the morning if it is cold outside, or switch on Sentry mode when leaving the car in the parking lot at work. Or create a notification if you forgot to connect the car to the charger if the battery level is low.

With ‘Automatic’ mode you can charge with the lowest utility prices in the selected charge period.

Go to app store to install the Tesla Smart Charger app.

To be able to use the app, a refresh token must be created. Download the “Auth app for Tesla” for iOS, or the “Tesla Tokens” app for Android. After you have authenticated in the mobile app, copy the “Refresh Token” and use that when adding the Tesla to Homey.

Install:

To install:

  • Add the Tesla device.
  • Add a flow to adjust the ‘Charge start’, ‘Charge end’ and ‘Max. charge hours in period’, or update directly in ‘Advanced settings’.
  • Go to ‘Advanced settings’ and set the ‘Utility price settings’: ‘Price area’, and ‘Currency’.

Device: Tesla

Triggers

  • Charging started (token: battery (%))
  • Charging stopped (tokens: battery (%), meter_power (kWh), complete (boolean))
  • The vehicle state changed (token: vehicle_state)
  • Charge plan created (token: charge_plan)
  • Homelink nearby (tokens: latitude, longitude)
  • Shift state changed (token: shift_state)
  • Vehicle left home (token: distance_from_home)
  • Vehicle came home (token: distance_from_home)
  • Vehicle left location (tokens: name, latitude, longitude)
  • Vehicle entered location (tokens: name, latitude, longitude)
  • Vehicle started moving (tokens: latitude, longitude)
  • Vehicle stopped moving (tokens: latitude, longitude)
  • Software update is available (token: version)

Conditions

  • Is plugged in
  • Is charge port open
  • Is charging
  • Is Homelink nearby
  • Is locked
  • Is Sentry Mode on
  • Is aircondition on
  • Is home
  • Is moving
  • Is shift state (P, D, R, N)
  • Is at location (Location)
  • Is software update available
  • Is user present

Actions

  • Set charge mode (Off, Automatic, Manual, Charge now)
  • Set period for charging (Start charging, Stop charging, Max. charge hours in period)
  • Set ‘Data fetch interval’ (Data fetch interval)
  • Set ‘Data fetch enabled’ (Data fetch enabled)
  • Charge port door (Close, Open)
  • Charging (Off, On)
  • Set charge limit mode (Standard, Max range)
  • Set charge limit % (limit)
  • Set charging current
  • Aircondition (Off, On)
  • Aircondition temperature (temperature)
  • Seat heating
  • Steering wheel heating
  • Lock / unlock doors (Lock, Unlock)
  • Actuate trunk (Front, Rear)
  • Set Sentry Mode (Off, On)
  • Reset power meter
  • Add current location to geofence (Name)
  • Add location to geofence (Name, Longitude, Latitude)
  • Delete location from geofence (Location)
  • Navigate to (Address, Google Maps url)
  • Activate Homelink device
  • Activate speed limit
  • Deactivate speed limit
  • Clear speed limit pin
  • Schedule software update
  • Cancel software update
  • Honk horn
  • Flash light

Capabilities

  • Charge mode (off, automatic, manual_std, charge_now)
  • Charging state (Disconnected, Stopped, Charging, Complete)
  • Charging rate (km/h)
  • Battery range (km)
  • Measure battery (%)
  • Battery ideal range (km)
  • Planned charge (km)
  • Time to full charge (h)
  • Charge limit (%)
  • Measure power (W)
  • Meter power (kWh)
  • Measure temperature (inside C)
  • Measure temperature (outside C)
  • Speed (km/h)
  • Shift state (P, D, R, N)
  • Odometer (km)
  • Locked (true/false)
  • Vehicle state (online, asleep)
  • Location (address)
  • Distance from home (m)
  • Longitude (lon)
  • Latitude (lat)
  • Software version

Modes

Mode: Off

Will not handle any charging, but charging can be controlled by flows.

Mode: Charge now

Will start charging instantly. After the charging is complete, or the charger is unplugged, the mode will switch automatically to ‘Off’.

Mode: Manual

Will handle charging in the ‘charge period’, but does not require utility prices.

Mode: Automatic

Will handle charging in the ‘charge period’, and will charge when utility prices are low. To charge when the prices are low, just a few of all the hours in the period must be used for charging. So to get the lowest prices, it is better to charge the car every night.

Details about triggers (when):

Charging started / stopped

Will trigger when the app sees that charging has started or stopped, and not just charging started or stopped by this app.

The vehicle state changed

Trigged when the app sees that the vehicle state (Online, Offline, Asleep) has changed.

Charge plan created (automatic mode)

For ‘Automatic’ mode, the ‘Charge plan created’ will trigger when a new charge plan is created. The charge plan is created when the app sees that the vehicle is home, the charger is plugged in, and utility prices for today and tomorrow have been fetched.

The charge plan is available as a token, with information about ‘km to be charged’, ‘sum charge hours’, ‘cost reduction in percentage’ and ‘hours for charging with prices’.

The cost reduction is calculated as the difference between ‘Automatic’ and ‘Manual’ modes in percentage, i.e. how much you save by using the automatic mode compared to manual mode. NB! Fees and grid costs are not taken into consideration here. Just the utility price.

Details about actions (then):

Add current location to geofence

The current location of the Tesla will be added to a list of locations.

The ‘Vehicle entered location’ and ‘Vehicle left location’ triggers can be used to trigger when the car enters and leaves the location.

The ‘Is at location’ condition can be used to check if a specific location is close to the current location.

A maximum of 20 locations can be added.

Navigate to (Address, Google Maps url)

To start navigation, both an address and a Google Maps URL must be provided.

Example:

Address: Rigtersbleek-Zandvoort 10, 7521 BE Enschede, Nederland

Google Maps URL: Google Maps

Details about Advanced settings:

Charge start and end

The period of the day for charging.

Charge hours per period (automatic mode)

To get the lowest prices, it is better to charge often, with a low number of charge hours per day.

Example
  • Set the charge period to 22:00 in the evening, to 06:30 in the morning, for a maximum of 8.5 hours during the night.
  • Charge 5 of the 8.5 hours when the prices are lowest, so set the ‘Charge hours per period’ to 5.

Charge rate (km/h) (automatic mode)

The charge rate is used for calculating the necessary hours for charging, and is updated once each day.

Price area (automatic mode)

Price area for utility prices.

  • Austria: AT
  • Belgium: BE
  • Denmark: DK1, DK2
  • Estonia: EE
  • Finland: FI
  • France: FR
  • Germany and Luxembourg: DE-LU
  • Latvia: LV
  • Lithuania: LT
  • Netherlands: NL
  • Norway: Oslo, Kr.sand, Bergen, Molde, Tr.heim, Tromsø
  • Sweden: SE1, SE2, SE3, SE4

Currency (automatic mode)

Currency for utility prices.

Data fetch interval (minutes)

Fetching data will wake up the vehicle, and it will stay awake for 10 minutes before going to sleep again. So a low fetch interval will lead to higher battery loss, i.e. vampire drain.

The default value for the fetch interval is 60 minutes, so the vehicle will be awake 10 minutes and asleep 50 minutes every hour.

When the vehicle is charging or driving, the state of the vehicle is checked every minute.

The value of the fetch interval will affect the latency of the triggers that respond to the state of the vehicle.

Data fetch enabled

Uncheck ‘Data fetch enabled’ to disable fetching data, ref. ‘Data fetch interval’.

Location accuracy

Radius in meters for checking if home or at a location.

Minimum refresh interval when streaming

To avoid a too high load on the Homey when streaming, there is a minimum refresh interval. The default is 10 seconds.

Details about Maintenance Actions:

To repair go to device settings → Maintenance Actions, and click the Repair - button.

Disclaimer:

Use at your own risk. I accept no responsibility for any damages caused by using this app.

Release Notes:

1.5.3

  • Fix for chargeplan date/time format

1.5.2

  • Fix for fetching prices

1.5.1

  • Utility prices for more countries

1.5.0

  • Added action to set charging current
  • Upgraded to SDK3

1.4.1

  • Fix for software update trigger
  • Fix for charging stopped trigger

1.4.0

  • Switched to refresh token for authentication

1.3.3

  • Icon for Model Y

1.3.2

  • Fixed titles for flows

1.3.1

  • Fixed issue with authentication

1.3.0

  • Added support for Homelink
  • Added support for ideal battery range
4 Likes

Just want to check, so if I:

  1. Create a flow to define current location, (named Home) and charging times (00:30 to 04:30) - in UK so can’t set utility etc.
  2. I run a flow with a check that the car is plugged in, at home (above location) and then “set charge mode” to manual

This should schedule the car to start charging at 00:30 and stop at 04:30?
Max hours - if i set to 1 hour, it will only charge for 1 hour between the above times?

Hi,

Well, “Home” is when the car is near the GPS location of the Homey. The default “location accuracy” is 250 meters, but you can change that in Adv. settings.
So for charging, you don’t need to set the location.

The “add location” and “add current location” flows are for adding extra locations, that will trigger the “vehicle left location” and “vehicle entered location” triggers.

Max hours is only used in “Automatic mode”. Not needed in “Manual mode”.

So you only need to:

  • set the charging times (00:30 - 04:30).
  • set the mode to “Manual”

The app will then start charging when

  • the car is home, less than 250 meters from the Homey
  • the car is plugged in the charger
  • between 00:30 - 04:30
1 Like

Brilliant, thanks. Seemed to work last night, will test again tonight.

@balmli is there a way to reduce the polling when the car is plugged in? I’m charging the car (Model 3) and if I leave it plugged in it reduces by 5% in one day! This is massive…and way too much, will stop me using the app to be honest. 1 minute polling is fine when actually charging, but not if just plugged in.

I reduced the polling when not plugged in to the max (1440) as with the default polling (every hour) my Model S hardly sleeps and was loosing tons of charge.

Yes, the app polls every minute if it’s plugged in. I will fix that.

Polling every 60 minutes, the car will stay awake 10 minutes after the poll, and then sleep for 50 minutes.

2 Likes

Brilliant, thanks @balmli I have just updated from github and will feedback.

1 Like

Hi, I have a feature request.

Is it possible to get a local variable (Token:UpdateVersion) on the condition ‘Is software update available’ ?
Looks like local tokens is only possible for Triggers, but I might be wrong.

If not, is it possible to add a Global Token named ‘Software Available’ og something like that ?
This would contain the version number of the update if available or the installed version if no new version is available? Or maybe just a dash if no update available?

I Cant get the trigger ‘Software update available’ to trigger unless i open Tesla device in the app.

I have a flow that starts the software update if the time is between 02:00 and 05:00 and the car is at home. And this flow also sends a push notification to my phone telling me it has started the update.
I would like to include the version it is updating to in this message, but only the current software verion is available. (since the trigger is ‘time’ and not ‘Software update is available’.

Secondly, do you prefer feature reqests here in the forum or as issues in Github?
Hint: I have more feature requests… :wink:

Hi Torstein,

You are right! Tokens are only possible for triggers and as global tokens.

The ‘Software update available’ trigger will only trigger between each ‘poll’ to the Tesla. So if the ‘Check data interval’ is 60 minutes, it will wake up the car every 60 minutes and then check the software version. Maybe you have a very long interval during the night ?

I’ve added a new capability: ‘Software version update’ that you can use in the push notification. Look out for v. 1.0.36.

You can add feature requests here, so more people sees it.

Wow, You are really quick to respond.

Will try this with the next update. (Already installed 12.1 during the night)

Regarding the ‘Software update available’ trigger:
I have a flow with ‘Software Update Available -> push notify’ (Flow 1)
This had not triggered after more then an hour after the notification from the Tesla app that the update was ready. When i opened the Homey App and clicked your Tesla Smart Charger App, the flow triggered once.
(Not sure what I did? clicked the device icon or opened a flow or maybe I opened the App settings. But I did not manually run a flow)

And my trigger to check for updates AND update runs every hour but only continues if the time is between 02-05. (Flow 2)

So between around 23:00 to 02:00 the first flow (Flow 1) should trigger every 1 hour but never did.
(Polling is default at 60 minutes all day)

Would this flow work in a timely manner?
Or would it take 60 minutes in the longest case? The time that is set in the data fetch

When I change a setting . For example het polling time to 15 there is a type mismatch error . Nevertheless I love the app :stuck_out_tongue_winking_eye:

If the “data fetch interval” is set to 1 minute, it will take a maximum of 1 minute for the app to see the new position, and that will trigger the flow. And 60 minutes -> max 60 minutes of course.

I think it would be better to use the “name” token, and check for the name of the position. Like this:

Skjermbilde 2021-01-21 kl. 08.14.29

Hi Marco,

You only need to set the password field, if you have changed the password.

So try clearing the password field, and change another setting, and see if that works.

Mmm I did not change password , I just go to settings and change the poll time and push save . I’m not touching the new password setting.

OK, so a bug … I will have a look at it. Thanks for reporting.

Hi Bjornar,

I’m trying to make a flow with more stability to open our garagedoor when entering the premises.
Therefor created a simple test flow.

IF: tesla came home
THEN: turn on carport light

when testing, there’s no response.

So created another flow:

IF: tesla enters location
AND: location is Home
THEN: turn on carport light.

No response also.
Any mistakes on my behalves?

The app does have a “data fetch interval”. The default is 60 minutes. You can change that to the minimum, which is 1 minute.

With 1 minute, it will take a minimum of 1 minute for the app to see the new position, and that will trigger the flow.

1 Like

Thank you, I’ll come back to you.
At this moment while trying to setup again after uninstalll, app message the login credentials are not right.
Bit strange, because same credentials logging in at tesla.com is without a jiffy.

Sounds like the same issues some Home Assistant users are having:

It seems Tesla has changed something in their backend that causes third party integrations to fail authentication.

2 Likes