{"id":25506662,"url":"https://github.com/flashg1/teslasolarcharger","last_synced_at":"2026-03-07T03:31:03.778Z","repository":{"id":177469348,"uuid":"660449445","full_name":"flashg1/TeslaSolarCharger","owner":"flashg1","description":"Home Assistant Blueprint to charge Tesla car using surplus solar electricity and weather forecast.","archived":false,"fork":false,"pushed_at":"2025-02-15T02:17:37.000Z","size":99,"stargazers_count":19,"open_issues_count":3,"forks_count":7,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-24T10:45:41.457Z","etag":null,"topics":["blueprint","electric-vehicles","energy-management","enphase","home-assistant","home-automation","solar-energy","tesla"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flashg1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-30T03:21:45.000Z","updated_at":"2025-02-15T02:13:23.000Z","dependencies_parsed_at":"2023-09-24T10:05:14.897Z","dependency_job_id":"a1d96da2-b11a-4385-908a-16f11c4a5338","html_url":"https://github.com/flashg1/TeslaSolarCharger","commit_stats":{"total_commits":40,"total_committers":2,"mean_commits":20.0,"dds":0.5,"last_synced_commit":"29a33976d3b3d08b06f5bacd978d660afe062405"},"previous_names":["flashg1/teslasolarcharger"],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flashg1%2FTeslaSolarCharger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flashg1%2FTeslaSolarCharger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flashg1%2FTeslaSolarCharger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flashg1%2FTeslaSolarCharger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flashg1","download_url":"https://codeload.github.com/flashg1/TeslaSolarCharger/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248215192,"owners_count":21066622,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blueprint","electric-vehicles","energy-management","enphase","home-assistant","home-automation","solar-energy","tesla"],"created_at":"2025-02-19T06:59:08.756Z","updated_at":"2026-03-07T03:31:03.746Z","avatar_url":"https://github.com/flashg1.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Support for TeslaSolarCharger is ending ...\nPlease use [evSolarCharger](https://github.com/flashg1/evSolarCharger) instead.  Please read [this](https://github.com/flashg1/evSolarCharger/wiki/Installation#how-to-migrate-from-teslasolarcharger-to-evsolarcharger) if you need to migrate from TeslaSolarCharger.\n\n\n# Tesla Solar Charger\nHome Assistant Blueprint to charge Tesla car using surplus solar electricity and weather forecast.\n\n###############################################################################\n# Disclaimer:\n#\n# 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.\n#\n###############################################################################\n\n![Screenshot_20230702-094232_Home Assistant](https://github.com/flashg1/TeslaSolarCharger/assets/122323972/58d1df89-905b-422c-8542-0081b9fa342f)\n\n![Screenshot_20230630-135925_Home Assistant](https://github.com/flashg1/TeslaSolarCharger/assets/122323972/2f04b1e2-b56d-493c-977f-82d5dd04cbe5)\n\n\nFeatures\n========\n\n-   Charge from excess solar adjusting Tesla car charging current according to feedback loop value \"Grid Power Net\".  The \"Grid Power Net\" sensor expresses negative power in Watts when exporting to grid, and positive power when consuming from grid.\n-   Support multi-day solar charging using sun elevation triggers to start and stop. (Sun elevation triggers should be more favourable for countries in the northern hemisphere.)\n-   Compatible with off-peak night time charging.\n-   Configurable daily car charge limit for 7 days.  Default is to use the Tesla app charge limit.\n-   Automatically adjust to the highest charge limit set within a rainy forecast period.  The highest charge limit is selected from the 7 days charge limit settings that are within the forecast period taking into account the charge limit on bad weather setting.  The objective is to charge more before a rainy period.  Default disabled.\n-   Might be possible to prolong car battery life by setting daily charge limit to 70%, and only charge more before a rainy period by enabling option to adjust daily car charge limit based on weather.\n-   Allow top up from grid if there is not enough solar electricity.  Need to toggle on charge from grid and set power offset to draw power from grid.\n-   Support charging multiple Tesla cars at the same time based on power allocation weighting for each car.\n\n\nMy setup\n========\n\n-\tHome Assistant, https://www.home-assistant.io/\n-\tEnphase Envoy Integration configured for 30 seconds update interval, https://www.home-assistant.io/integrations/enphase_envoy\n-\tTesla Custom Integration v3.20.4, https://github.com/alandtse/tesla\n-\tTesla UMC charger, 230V, max 15A.\n-\tTesla Model 3.\n\n\nInstallation\n============\n\n-\tSet up \"Grid Power Net\" sensor in Home Assistant (HA) config, eg.\n\n/config/configuration.yaml\n```\ntemplate:\n\n    # For Enphase, grid_power_net is an integer in watts. Positive value means importing power from grid. Negative value means exporting power to grid.\n    # For other inverter brands, adjust the formula to conform with above requirement according to your setup.\n    - sensor:\n        name: Grid Power Net\n        state_class: measurement\n        icon: mdi:transmission-tower\n        unit_of_measurement: W\n        device_class: power\n        state: \u003e\n            {{ states('sensor.envoy_[YourEnvoyId]_current_power_consumption')|int - states('sensor.envoy_[YourEnvoyId]_current_power_production')|int }}\n```\n\n[![Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.](https://my.home-assistant.io/badges/blueprint_import.svg)](https://my.home-assistant.io/redirect/blueprint_import/?blueprint_url=https%3A%2F%2Fgithub.com%2Fflashg1%2FTeslaSolarCharger%2Fblob%2Fmain%2FTesla_solar_charger_automation.yaml)\n\n-\tImport the Blueprint automatically by clicking above, or manually copy the Blueprint file to following location and reload HA config,\n\\\\HOMEASSISTANT\\config\\blueprints\\automation\\flashg1\\Tesla_solar_charger_automation.yaml\n\n-\tCreate 3 helper booleans, eg.\nSettings \u003e Devices \u0026 Services \u003e Helpers \u003e Create Helper \u003e Toggle\n1.\tTesla Model3 set daily car charge limit\n2.\tTelsa Model3 charge from grid\n3.\tTesla Model3 stop charging\n\n-\tCreate 1 helper number or template sensor for power offset (required when charging from grid), eg.\nSettings \u003e Devices \u0026 Services \u003e Helpers \u003e Create Helper \u003e Number or Template a sensor\n1.\tTesla Model3 power offset\n\n-\tConfig the Blueprint automation specifying charger voltage, maximum current and helper entities created above, ie.\nSettings \u003e Automations \u0026 Scenes \u003e Blueprints \u003e Tesla solar charger automation\n\n\nHow to use\n==========\n\n-\tSet your charging limit in app or car.\n-\tConnect charger to car.  Normal charging at constant current should begin immediately if schedule charging is disabled.  After a little while, the script will take over and manage the charging current during daylight hours.  Please see work-arounds below if automation cannot be triggered.\n-\tThere are 2 options on how to charge the car (see below).\n-\tThe script will stop if charger is turned off manually or automatically by car when reaching charge limit.\n-\tTo abort charging, turn on \"Tesla Model3 stop charging\".  The script will take about a minute to terminate if using default values.\n\n2 options on how to charge the car:\n\nOption 1\n--------\nTo charge from excess solar, just plug in the charger.  The initial charge current is 5A.  After about 1 minute it will adjust the current according to amount of excess power exported to grid.\n\nOption 2\n--------\nTo charge from grid and solar, toggle on charge from grid and set power offset to draw power from grid.\n\n\nNotes\n=====\n\nPlease also check out the [wiki](https://github.com/flashg1/TeslaSolarCharger/wiki) pages.\n\nAutomation cannot be triggered\n------------------------------\nThe 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.\n\nWork-arounds:\n1. Run the automation manually by selecting the automation and then select \"Run Actions\".\n2. Turn polling off, then on.\n3. Press the \"Force data update\" button before and after plugging in the charger.\n\nDaily car charge limit settings\n-------------------------------\n- If set daily car charge limit is toggled off, charge limit will be set according to the Tesla app.\n- If set daily car charge limit is toggled on and charge car based on weather is disabled, charge limit will be set according to the limit configured for the day.\n- If set daily car charge limit is toggled on and charge car based on weather is enabled, charge limit will be adjusted to the highest limit set within the rainy forecast period taking into account the car charge limit on bad weather setting.\n- If charge car based on weather is enabled, daily car charge limit and weather provider settings must be configured.\n\nSpecial note for 3-phase chargers\n---------------------------------\nPlease see [discussion](https://github.com/flashg1/TeslaSolarCharger/issues/18) on voltage to set for charger with 3-phase power.\n\nCharge mutiple Tesla cars at the same time based on power allocation weighting for each car\n-------------------------------------------------------------------------------------------\nNote: This is theoretical only since I don't have 2 Tesla cars to test this, but happy for any feedback.  To ensure power is allocated according to weighting, the \"Grid power net\" update cycle should be the same as the script looping cycle, ie. 1 minute.\n\n- Create power allocation weighting for each car.  For example, to create for car1,\n```\nSettings \u003e Devices \u0026 services \u003e Helpers \u003e Create helper \u003e Number \u003e\nName: Car1 power allocation weight\nMinimum value: 1\nMaximum value: 10\n```\n- Create power allocation sensor for each car.  For example, to create power allocation sensor for car1 assuming we have car1 and car2,\n```\nSettings \u003e Devices \u0026 services \u003e Helpers \u003e Create helper \u003e Template \u003e Template a sensor \u003e\nName: Car1 power allocation\nState template: {{ states('sensor.grid_power_net')|int * states('input_number.car1_power_allocation_weight')|int / (state_attr('automation.car1_solar_charger_automation', 'current') * states('input_number.car1_power_allocation_weight')|int + state_attr('automation.car2_solar_charger_automation', 'current') * states('input_number.car2_power_allocation_weight')|int) }}\nUnit of measurement: W\nDevice class: Power\nState class: Measurement\n```\n- Use the power allocation sensors defined above as input to \"Grid power net\" in each car's Blueprint.\n\n\nGUI display examples\n====================\n\nDashboard Tesla power card\n--------------------------\nhttps://github.com/reptilex/tesla-style-solar-power-card\n\n```\ntype: custom:tesla-style-solar-power-card\nname: Power Usage\nshow_w_not_kw: 1\n\n# 3 flows between bubbles\ngrid_to_house_entity: sensor.grid_power_import\ngeneration_to_grid_entity: sensor.grid_power_export\ngeneration_to_house_entity: sensor.solar_power_consumption\n\n# optional appliances with consumption and extra values\nappliance1_consumption_entity: sensor.charger_power\nappliance1_extra_entity: sensor.battery\n\n# optional 3 main bubble icons for clickable entities\ngrid_entity: sensor.grid_power_net\nhouse_entity: sensor.envoy_[YourEnvoyId]_current_power_consumption\n# Watch this for car charge limit change\nhouse_extra_entity: number.charge_limit\ngeneration_entity: sensor.solar_power_production\n\n```\n\nDashboard Tesla solar charger control\n-------------------------------------\n```\ntype: entities\nentities:\n  - entity: automation.[YourTeslaName]_solar_charger_automation\n  - type: attribute\n    entity: automation.[YourTeslaName]_solar_charger_automation\n    attribute: current\n    name: Running instance count\n  - type: attribute\n    entity: automation.[YourTeslaName]_solar_charger_automation\n    attribute: last_triggered\n    name: Last triggered\n  - entity: input_boolean.[YourTeslaName]_set_daily_car_charge_limit\n  - entity: input_boolean.[YourTeslaName]_charge_from_grid\n  - entity: input_boolean.[YourTeslaName]_stop_charging\n  - entity: button.wake_up\n  - entity: button.force_data_update\n  - entity: device_tracker.location_tracker\n  - entity: binary_sensor.charger\n  - entity: binary_sensor.charging\n  - entity: number.charging_amps\n  - entity: sensor.range\n  - entity: sensor.battery\n  - entity: number.charge_limit\n  - entity: sensor.time_charge_complete\n  - entity: lock.charge_port_latch\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflashg1%2Fteslasolarcharger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflashg1%2Fteslasolarcharger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflashg1%2Fteslasolarcharger/lists"}