Home Assistant Blueprint to charge Tesla car using surplus solar electricity and weather forecast.
###############################################################################
#
# ###############################################################################
/config/configuration.yaml
template:
# For Enphase, grid_power_net is an integer in watts. Positive value means importing power from grid. Negative value means exporting power to grid.
- sensor:
name: Grid Power Net
state_class: measurement
icon: mdi:transmission-tower
unit_of_measurement: W
device_class: power
state: >
{{ states('sensor.envoy_[YourEnvoyId]_current_power_consumption')|int - states('sensor.envoy_[YourEnvoyId]_current_power_production')|int }}
Copy the Blueprint file to, \HOMEASSISTANT\config\blueprints\automation\flashg\Tesla_solar_charger_automation.yaml
Restart HA.
Create 2 helper booleans, eg. Settings > Devices & Services > Helpers > Create Helper > Toggle
Config the Blueprint automation specifying charger voltage, maximum current and helper booleans created above, ie. Settings > Automations & Scenes > Blueprints > Tesla solar charger automation
2 options on how to charge the car:
To charge from excess solar, just plug in the charger. The initial charge current is 6A. After about 1 minute it will adjust the current according to amount of excess power exported to grid.
To charge from grid, set your desired charging current and turn on "Telsa Model3 charge from grid".
The Tesla triggers and conditions are slow to update unless car is polled often. Polling too often can drain the car battery. So might have to wait a minute or two for the conditions to refresh and the triggers to work. Please see below for possible work-arounds.
Work-arounds:
https://github.com/reptilex/tesla-style-solar-power-card
type: custom:tesla-style-solar-power-card
name: Power Usage
show_w_not_kw: 1
# 3 flows between bubbles
grid_to_house_entity: sensor.grid_power_import
generation_to_grid_entity: sensor.grid_power_export
generation_to_house_entity: sensor.solar_power_consumption
# optional appliances with consumption and extra values
appliance1_consumption_entity: sensor.charger_power
appliance1_extra_entity: sensor.battery
# optional 3 main bubble icons for clickable entities
grid_entity: sensor.grid_power_net
house_entity: sensor.envoy_[YourEnvoyId]_current_power_consumption
generation_entity: sensor.solar_power_production
type: entities
entities:
- entity: automation.[YourTeslaName]_solar_charger_automation
- type: attribute
entity: automation.[YourTeslaName]_solar_charger_automation
attribute: current
name: Running instance count
- type: attribute
entity: automation.[YourTeslaName]_solar_charger_automation
attribute: last_triggered
name: Last triggered
- entity: input_boolean.[YourTeslaName]_charge_from_grid
- entity: input_boolean.[YourTeslaName]_stop_charging
- entity: button.wake_up
- entity: button.force_data_update
- entity: device_tracker.location_tracker
- entity: binary_sensor.charger
- entity: binary_sensor.charging
- entity: number.charging_amps
- entity: sensor.range
- entity: sensor.battery
- entity: number.charge_limit
- entity: sensor.time_charge_complete
- entity: lock.charge_port_latch