Hi I just wanted to share my quick and dirty Tessie integration since google assistant “Talk to Tessie” support is going away in June. When I have time I might make a full fledged component but for now api commands will have to do.
In secrets.yaml add 2 secrets 1 with your vin and the other with a token generated here: Loading
tessie_token: Bearer [token from tessie]
tesla_vin: [your vin]
In your configuration.yaml either add to or create a rest_command: section
rest_command:
tessie_command:
url: "https://api.tessie.com/{{ states('input_text.tesla_vin') }}/command/{{ command }}"
headers:
authorization: !secret tessie_token
accept: application/json
also create or add to a input_text: section
input_text:
tesla_vin:
name: Tesla VIN
initial: !secret tesla_vin
You can then use the new rest_command.tessie_command
service with the data: { command: "command_from_tessie_api" }
eg. data: { command: "start_climate" }
You can use this service in automations or make a custom switch.
To make a switch first create a sensor using tessie’s state command (this creates three binary sensors for door locks, climate, and trunk) use binary_sensor for booleans and sensor for everything else:
binary_sensor:
- name: Tesla Locked
platform: rest
device_class: lock
resource_template: "https://api.tessie.com/{{ states('input_text.tesla_vin') }}/state?use_cache=true"
headers:
authorization: !secret tessie_token
accept: application/json
value_template: '{{ value_json.vehicle_state.locked == False }}'
- name: Tesla Climate
platform: rest
device_class: running
resource_template: "https://api.tessie.com/{{ states('input_text.tesla_vin') }}/state?use_cache=true"
headers:
authorization: !secret tessie_token
accept: application/json
value_template: '{{ value_json.climate_state.is_climate_on }}'
- name: Tesla Trunk
platform: rest
device_class: garage_door
resource_template: "https://api.tessie.com/{{ states('input_text.tesla_vin') }}/state?use_cache=true"
headers:
authorization: !secret tessie_token
accept: application/json
value_template: '{{ value_json.vehicle_state.rt > 0 }}'
Then create the switches:
switches:
- platform: template
switches:
tesla_doors:
friendly_name: Tesla Door Locks
value_template: "{{ is_state('binary_sensor.tesla_locked', 'on') }}"
turn_on:
service: rest_command.tessie_command
data:
command: unlock
turn_off:
service: rest_command.tessie_command
data:
command: lock
icon_template: >-
{% if is_state('binary_sensor.tesla_locked', 'on') %}
mdi:lock-open
{% else %}
mdi:lock
{% endif %}
tesla_climate:
friendly_name: Tesla Climate
value_template: "{{ is_state('binary_sensor.tesla_climate', 'on') }}"
turn_on:
service: rest_command.tessie_command
data:
command: start_climate
turn_off:
service: rest_command.tessie_command
data:
command: stop_climate
icon_template: >-
{% if is_state('binary_sensor.tesla_climate', 'on') %}
mdi:fan
{% else %}
mdi:fan-off
{% endif %}
tesla_trunk:
friendly_name: Tesla Trunk
value_template: "{{ is_state('binary_sensor.tesla_trunk', 'on') }}"
turn_on:
service: rest_command.tessie_command
data:
command: activate_rear_trunk
turn_off:
service: rest_command.tessie_command
data:
command: activate_rear_trunk
icon_template: >-
{% if is_state('binary_sensor.tesla_trunk', 'on') %}
mdi:garage-open
{% else %}
mdi:garage
{% endif %}
Now that you have switches if you have google assistant integrated with home assistant you can control your tesla via home assistant by the switch name you just made eg “ok google turn on telsa climate”.
Note: Tessie takes about 30 seconds to actually execute a command so the switch may appear to “undo” the action if you toggle it in home assistant, then after tessie finishes it will take the correct state.
Here are some sensors for battery and range:
sensors:
- name: Tesla Battery %
platform: rest
device_class: battery
resource_template: "https://api.tessie.com/{{ states('input_text.tesla_vin') }}/state?use_cache=true"
headers:
authorization: !secret tessie_token
accept: application/json
value_template: '{{ value_json.charge_state.battery_level }}'
unit_of_measurement: '%'
- name: Tesla Ideal Range
platform: rest
device_class: distance
resource_template: "https://api.tessie.com/{{ states('input_text.tesla_vin') }}/state?use_cache=true"
headers:
authorization: !secret tessie_token
accept: application/json
value_template: '{{ value_json.charge_state.battery_range }}'
unit_of_measurement: mi
- name: Tesla Real Range
platform: rest
device_class: distance
resource_template: "https://api.tessie.com/{{ states('input_text.tesla_vin') }}/state?use_cache=true"
headers:
authorization: !secret tessie_token
accept: application/json
value_template: '{{ value_json.charge_state.est_battery_range }}'
unit_of_measurement: mi
This is my glance card configuration for the dashboard:
- entities:
- entity: switch.tesla_doors
name: Doors
tap_action:
action: toggle
- entity: switch.tesla_climate
name: Climate
tap_action:
action: toggle
- entity: switch.tesla_trunk
name: Trunk
tap_action:
action: toggle
- entity: sensor.tesla_battery
name: Battery
- entity: sensor.tesla_real_range
name: Range
show_header_toggle: false
title: Tesla
type: glance
I hope this helps someone!