flashg1 / TeslaSolarCharger

Home Assistant Blueprint to charge Tesla car using surplus solar electricity and weather forecast.
MIT License
14 stars 5 forks source link
blueprint electric-vehicles energy-management enphase home-assistant home-automation solar-energy tesla

Tesla Solar Charger

Home Assistant Blueprint to charge Tesla car using surplus solar electricity and weather forecast.

###############################################################################

Disclaimer:

#

Even though this automation has been created with care, the author cannot be responsible for any damage caused by this automation. Use at your own risk.

# ###############################################################################

Screenshot_20230702-094232_Home Assistant

Screenshot_20230630-135925_Home Assistant

Installation

/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 }}

My setup

Features

How to use

2 options on how to charge the car:

Option 1

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.

Option 2

To charge from grid, set your desired charging current and turn on "Telsa Model3 charge from grid".

Notes

Automation cannot be triggered

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:

  1. Run the automation manually by selecting the automation and then select "Run Actions".
  2. Turn polling off, then on.
  3. Press the "Force data update" button before and after plugging in the charger.

Daily car charge limit settings

GUI display examples

Dashboard Tesla power card

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

Dashboard Tesla solar charger control

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