Configuration - flashg1/SolarCharger GitHub Wiki

Different inverter brands and charger API working with SolarCharger

To help the community, please let people know your inverter brand and charger API you got working with SolarCharger.

How to set up home location in HA?

Home location must be defined in HA in order for HA to detect Tesla is at home. Settings > System > General > Edit location

Create charger effective voltage sensor for 3-phase system

Assuming your system has following entities, eg.

  • sensor.line_voltage
  • sensor.number_of_active_lines
Settings > Devices & services > Helpers > Create helper > Template > Template a sensor >
Name: Charger effective voltage
State template: {{ states('sensor.line_voltage') | float * states('sensor.number_of_active_lines') | int }}
Unit of measurement: V
Device class: Voltage
State class: Measurement

Once created, override the "Charger effective voltage" entity in your charger, ie.

Settings > Devices & services > SolarCharger > Settings (cog wheel) > Select your charger > Override "Charger effective voltage" with template sensor > Submit

See note from @andrut1291 for 3-phase detection using Tesla Fleet API hidden entity "binary_sensor.charger_has_multiple_phases". And also this discussion.

To charge at maximum current between specific times

To charge at maximum current between specific times, template a time-based minimum current sensor and use it to override the "Charger min current" entity in your charger, ie.

Settings > Devices & services > SolarCharger > Settings (cog wheel) > Select your charger > Override "Charger min current" with template sensor > Submit

For example, if using alandtse's integration to charge at maximum current between 23:00 and 01:00, template the sensor with those times.

Settings > Devices & services > Helpers > Create helper > Template > Template a sensor >
Name: Tesla23m3 time-based min current
State template:

{% set t = now().strftime('%H:%M') %}
{% if '23:00' <= t < '24:00' %}
  {{ states('number.sc_tesla_custom_tesla23m3_charger_max_current') }}
{% elif '00:00' <= t < '01:00' %}
  {{ states('number.sc_tesla_custom_tesla23m3_charger_max_current') }}
{% else %}
  {{ states('number.sc_tesla_custom_tesla23m3_charger_min_current') }}
{% endif %}

Unit of measurement: A
Device class: Current
State class: Measurement

Another example: Charge to 40% between mid-night and 6am if forecast today is sunny, otherwise 50%. If bad weather, then 60%.

{% set t = now().strftime('%H:%M') %}
{% set soc = states('sensor.battery') | int %}
{% set forecast = state_attr('sensor.sc_global_defaults_weather_forecast', 'daily_forecast') %}
{% if forecast and forecast | length > 0 %}
  {% set forecast_today = forecast[0]['condition'] %}
{% else %}
  {% set forecast_today = 'No forecast data' %}
{% endif %}
{% set bad_weather = forecast_today in ['rainy', 'pouring', 'lightning', 'lightning-rainy', 'hail', 'snowy', 'snowy-rainy'] %}
{% set min_soc = 40 %}
{% if forecast_today != 'sunny' %}
  {% set min_soc = min_soc + 10 %}
{% endif %}
{% if bad_weather %}
  {% set min_soc = min_soc + 10 %}
{% endif %}
{% if '00:00' <= t < '06:00' and soc < min_soc %}
  {{ states('number.sc_tesla_custom_tesla23m3_charger_max_current') }}
{% else %}
  {{ states('number.sc_tesla_custom_tesla23m3_charger_min_current') }}
{% endif %}

The user is responsible for turning on SolarCharger (SC) if the required trigger is turned off. If all triggers are turned off (ie. Plugin trigger, Sun trigger, Schedule charge), user can now program their own automation to start and stop charge without interference from SolarCharger trying to start or stop the charging process.

If you don't want to write your own automation to start and stop charge, you can turn off just the sun trigger and keep SC charger in constant pause state at night by setting a high charge limit, eg. 80%. SC will then charge during the day when there is solar, or at any time when min current = max current using above template.

Starting 1/July/2026 for households with smart meters in NSW and South East Queensland, the proposed free period is from 11am to 2pm. See Reference.

How to configure a water heater?

The following config is used to control a water heater via Shelly relay and contactor. The heater is only turned on during the day when surplus solar is 3600W or more, or top up from grid for rainy days when there is not enough solar. Here are the steps to create the SolarCharger device.

  1. Add custom device

Settings > Devices & services > SolarCharger > Add custom device > Name your device, eg. "Hot water" > Submit

  1. Define charge control entities

Settings > Devices & services > SolarCharger > Settings (cog wheel) > Select your custom device > Select your charge control entities (see below example) > Submit

  1. Configure the device

See below example.

Charge control entities
-----------------------
Charger effective voltage:	sensor.shellyproem50_[ID]_em1_voltage
Charger on/off switch:		switch.shellyproem50_[ID]_switch_0
Charger get charge current:	sensor.shellyproem50_[ID]_em1_current

Device configuration
--------------------
Priority		7
Exit condition trigger	ON
Exit condition sensor	binary_sensor.hot_water_exit_condition
max current		15
min current		0
min workable current	4
pause threshold %	-10
resume threshold %	-5
Power factor		1
Start state		Pause
Sun trigger		On

How to change charger priority on reaching energy limit or SOC?

To change charger priority after reaching a certain consumed energy limit or SOC, template a energy-based or SOC-based priority sensor and use it to override the "Charger priority" entity in your charger, ie.

Settings > Devices & services > SolarCharger > Settings (cog wheel) > Select your charger > Override "Charger priority" with template sensor > Submit

For example, if you want a lower hot water priority than the EV priority when hot water uses up 9kWh of energy or turned off by thermostat,

Settings > Devices & services > Helpers > Create helper > Template > Template a sensor >
Name: Hot water energy-based priority
State template:

{% set self_depower = states('sensor.sc_custom_hot_water_self_depower_today') | int %}
{% set consumed_energy = states('sensor.sc_custom_hot_water_consumed_energy_today') | float %}
{% set energy_limit = 9 %}
{% if self_depower >= 1 or consumed_energy >= energy_limit %}
  {{ states('number.sc_tesla_custom_tesla23m3_charger_priority') | int + 1 }}
{% else %}
  {{ states('number.sc_custom_hot_water_charger_priority') }}
{% endif %}

What to do if there is not enough solar to heat water?

To ensure hot water is heated everyday even on low surplus, reduce "Min workable current" so as to top up from grid starting around mid-day. The steps are,

  • Change "Min workable current" to the minimum solar surplus current that can activate the hot water heater, eg. 4 A. The remaining current will be drawn from the grid.
  • Template a time-based min workable current sensor and use it to override the "Min workable current" entity in your charger, ie.

Settings > Devices & services > SolarCharger > Settings (cog wheel) > Select your charger > Override "Min workable current" with template sensor > Submit

Settings > Devices & services > Helpers > Create helper > Template > Template a sensor >
Name: Hot water time-based min workable current
State template:

{% set t = now().strftime('%H:%M') %}
{% set self_depower = states('sensor.sc_custom_hot_water_self_depower_today') | int %}
{% set consumed_energy = states('sensor.sc_custom_hot_water_consumed_energy_today') | float %}
{% set energy_limit = 5 %}
{% if '11:00' <= t < '14:00' and self_depower < 1 and consumed_energy < energy_limit %}
  {{ states('number.sc_custom_hot_water_charger_min_workable_current') }}
{% elif '14:00' <= t < '16:00' and self_depower < 1 and consumed_energy < energy_limit %}
  {{ states('number.sc_custom_hot_water_charger_min_workable_current') | float / 2 | round }}
{% else %}
  {{ states('number.sc_custom_hot_water_charger_max_current') }}
{% endif %}

How to end charge session using exit-condition-trigger switch?

The exit-condition-trigger switch can be used to end a charging session when the exit condition sensor evaluates to true. The steps are,

  1. Template a binary sensor and assign it to "Exit condition sensor", eg.
Settings > Devices & services > Helpers > Create helper > Template > Template a binary sensor >
Name: Hot water exit condition
State template:

{% set self_depower = states('sensor.sc_custom_hot_water_self_depower_today') | int %}
{% if self_depower >= 1 %}
  {{ true }}
{% else %}
  {{ false }}
{% endif %}
  1. Turn on "Exit condition trigger" switch.

Hot water heater SOC

If you would like to control the hot water heater using state-of-charge (SOC) entity, here is a way to do it provided you have the hot water temperature entity.

The hot water temperature is usually reported by a temperature sensor. Create a sensor helper and use the following formula to normalise the temperature so that it can be represented by percentage SOC. Once created, assign the sensor helper to "Device state-of-charge sensor" in the SolarCharger device settings.

Percentage SOC = (Current temperature / Max temperature) * 100

where,

  • Current temperature = Current water temperature inside boiler
  • Max temperature = Maximum temperature of water that can be reached inside boiler

Example config for a heater

The following config is used to control a Vulcan 1500W heater plugged into a Matter-supported Tapo smart plug. The heater is only turned on during the day when surplus solar is 1500W or more. Here are the steps to create the SolarCharger device.

  1. Add custom device

Settings > Devices & services > SolarCharger > Add custom device > Name your device > Submit

  1. Define charge control entities

Settings > Devices & services > SolarCharger > Settings (cog wheel) > Select your custom device > Select your charge control entities (see below example) > Submit

  1. Configure the device

See below example.

Vulcan 1500W heater
-------------------
0.01A when self-depowered.

Charge control entities
-----------------------
Charger effective voltage:	sensor.vulcan_1500w_heater_plug_effective_voltage
Charger on/off switch:		switch.vulcan_1500w_heater_plug
Charger get charge current:	sensor.vulcan_1500w_heater_plug_effective_current

Device configuration
--------------------
Priority		10
Exit condition trigger	Off
Exit condition sensor	
max current		6.22
min current		0
min workable current	6.22
pause threshold %	-10
resume threshold %	-5
Power factor		1
Start state		Pause
Sun trigger		On

How to control battery discharge rate?

To control battery output power between specific times, template a time-based power limit sensor and use it to override the "Supply power limit" entity in your device, eg.

Settings > Devices & services > SolarCharger > Settings (cog wheel) > Select your custom device > Override "Supply power limit" with template sensor > Submit

For example, to minimise battery discharge between 10am and 4pm, template the sensor with those times.

Settings > Devices & services > Helpers > Create helper > Template > Template a sensor >
Name: Battery1 time-based power limit
State template:

{% set t = now().strftime('%H:%M') %}
{% if '10:00' <= t < '16:00' %}
  {{ 0 }}
{% elif '16:00' <= t < '24:00' %}
  {{ states('number.sc_custom_battery1_supply_power_limit') }}
{% elif '00:00' <= t < '06:00' %}
  {{ states('number.sc_custom_battery1_supply_power_limit') }}
{% elif '06:00' <= t < '09:00' %}
  {{ -1 }}
{% else %}
  {{ 1000 }}
{% endif %}

Unit of measurement: W
Device class: Power
State class: Measurement

How to control vehicle charge current?

If it is not possible to adjust the charge current from the vehicle side, the only remaining option is to adjust the charge current from the charger side. Check your charger to see if it is supported by Home Assistant with the following control entities,

  • Charger on/off switch
  • Charger get charge current
  • Charger set charge current

The charger on/off switch is required as a minimum, otherwise SolarCharger (SC) will not be able to manage charging. After creating the SC device in step 1, follow step 2 to add these control entities if it is supported by your charger.

  1. Add SC charger device

Settings > Devices & services > SolarCharger > Add charger device > Select your device > Submit

Once created the SC device, follow instruction here to configure the device.

  1. Define charge control entities

To add the control entities to the SC device,

Settings > Devices & services > SolarCharger > Settings (cog wheel) > Select your device > Set your charge control entities (see below) > Submit

Charge control entities
-----------------------
Charger on/off switch:		Your charger on/off switch entity
Charger get charge current:	Your charger get charge current entity
Charger set charge current:	Your charger set charge current entity

How to change daily charge limit defaults?

Please see here.

Daily car charge limit settings

  • If "Schedule charge" is toggled off, charge limit will be set according to the Tesla app.
  • If "Schedule charge" is toggled on and charge car based on weather is disabled, charge limit will be set according to the limit configured for the day.
  • If "Schedule charge" 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.
  • Automatically adjust to a higher charge limit today if today has no charge completion time and next 3 days have higher charge limit. The day before the highest charge limit day will be set to 5% below the highest charge limit, otherwise it will be set to (N*10)% below the highest charge limit where N is the number of days before the highest charge limit day. The objective is to reduce charge limit difference between days to make it easier to achieve charge limit goals.
  • If charge car based on weather is enabled, daily car charge limit and weather provider settings must be configured.

How to determine battery maximum charge speed?

To determine battery maximum charge speed in charge level percentage rise per hour, see Calibrate max charge speed

Tesla Fleet API charging status not up-to-date

Please try turning on the "Poll charger update" switch and test again to see if it makes a difference.

The following is most likely not required. See discussion.

I am not using Tesla Fleet API, so I am not sure what configuration is required for Tesla Fleet API to work with SolarCharger. I suspect charging status might not be up-to-date during the charging process. See vehicle sleep for polling and cost. Happy for any user feedback for improvement.

Create the button, eg.

  - entity: input_button.[YourEvName]_tesla_fleet_api_update_ha

Create automation for the button, eg.

alias: [YourEvName] Tesla Fleet API update HA
description: Tesla Fleet API update HA on button press.
triggers:
  - trigger: state
    entity_id:
      - input_button.[YourEvName]_tesla_fleet_api_update_ha
conditions: []
actions:
  - action: homeassistant.update_entity
    data:
      entity_id:
        - sensor.[YourEvName]_charging
mode: single

Charge multiple devices at the same time based on priority and weight for each device

Set the priority and power allocation weight for each device. Power is allocated according to the priority and weight.

What if I changed my default charger name?

A corresponding change is required in SolarCharger, eg. if the MQTT switch entity is,

  • switch.tesla_ble_[vin]_charger

There is an option to change the "tesla_ble_[vin]" part, and replace with the new name.

Settings > Devices & services > SolarCharger > Settings (cog wheel) > Select your device >

  • Scroll down to near bottom and you should see red boxes indicating problem with invalid entities.
  • Scroll to and set "Charger name" > Submit

Once submitted, check again to make sure there are no red boxes.

How to check if I am using the correct charger entities?

Settings > Devices & services > SolarCharger > Settings (cog wheel) > Select your device >

  • Scroll down to near bottom to see if there are red boxes indicating problem with invalid entities.
  • If there are red boxes, see this if you have renamed your charger.
  • If there are no red boxes but boxes showing entities from incorrect integration, see this.

Default waiting times after specific action