Skip to content

Instantly share code, notes, and snippets.

@viezel
Created March 6, 2023 08:22
Show Gist options
  • Save viezel/2939ade33abfc45b8a7605f9f33e9098 to your computer and use it in GitHub Desktop.
Save viezel/2939ade33abfc45b8a7605f9f33e9098 to your computer and use it in GitHub Desktop.
Tesla charging automation in Home Assistant
alias: "EV Charging OFF"
description: ""
trigger:
- platform: numeric_state
entity_id: sensor.solar_realtime_power
for:
hours: 0
minutes: 1
seconds: 0
below: 1
condition:
- condition: state
entity_id: binary_sensor.tesla_wall_connector_contactor_closed
state: "on"
action:
- service: switch.turn_off
data: {}
target:
entity_id: switch.tesla_charger
mode: single
alias: "EV Charging ON"
description: Automatically set charging amp and start EV charging
trigger:
- platform: numeric_state
entity_id: sensor.solar_realtime_power
for:
hours: 0
minutes: 0
seconds: 10
above: 1
- platform: state
entity_id:
- binary_sensor.tesla_wall_connector_vehicle_connected
from: "off"
to: "on"
condition:
- condition: and
conditions:
- condition: state
entity_id: binary_sensor.tesla_wall_connector_vehicle_connected
state: "on"
- condition: state
entity_id: switch.tesla_charger
state: "off"
- condition: numeric_state
entity_id: sensor.solar_realtime_power
above: 1
action:
- service: switch.turn_on
data: {}
target:
entity_id: switch.tesla_charger
mode: single

Tesla Charging automation in Home Assistant

I needed a super simple Tesla charging automation for Home Assistant to use energy from the Solar panels when producing.

What it does

When Solar power is above 1 kW for more than 10 seconds, and the charger is plugged in, then start charging If Solar power drops below 1 kW, stop charging

Its that simple.

Requirements

  • Home Assistant
  • Tesla
  • Tesla Wall Connector

How to

  • Discover and install Tesla Wall Connector
  • Install Tesla Custom integration
  • Go to Settings -> Automations & Scenes -> Create Automation
  • Add the below scripts & adjust to your tesla and solar sensors for Home Assistant.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment