User guide - flashg1/SolarCharger GitHub Wiki
GUI display examples
Power flow card
https://github.com/flixlix/power-flow-card-plus
type: custom:power-flow-card-plus
entities:
battery:
entity: ''
display_zero: false
grid:
entity: sensor.envoy_[ID]_current_net_power_consumption
solar:
entity: sensor.envoy_[ID]_current_power_production
display_zero_state: true
individual:
- entity: sensor.sc_tesla_custom_tesla23m3_consumed_power
name: Tesla23m3
icon: mdi:car
display_zero: true
secondary_info:
entity: sensor.battery
unit_of_measurement: '%'
- entity: sensor.hot_water_power
name: Hot water
icon: mdi:water-boiler
display_zero: true
secondary_info:
entity: sensor.shellyproem50_[ID]_em0_power
display_zero: true
- entity: sensor.vulcan_1500w_heater_plug_power
name: Vulcan heater
icon: mdi:heating-coil
display_zero: false
secondary_info:
entity: sensor.sc_custom_vulcan_1500w_heater_consumed_power
display_zero: false
home:
secondary_info:
entity: number.charge_limit
unit_of_measurement: '%'
display_zero: true
clickable_entities: true
display_zero_lines: true
use_new_flow_rate_model: true
base_decimals: 0
kilo_decimals: 1
min_flow_rate: 0.75
max_flow_rate: 6
max_expected_power: 2000
min_expected_power: 0.01
kilo_threshold: 10000
mega_threshold: 1000000
transparency_zero_lines: 0
sort_individual_devices: false
SolarCharger Global defaults
Select the "SolarCharger Charger" card with width of 1 to display the "Global defaults" device. More info here on how to add the card.
Power monitor duration
Power allocations captured during the power monitor duration is used to calculate the median net allocated power value, which is used to determine whether or not to stall charging when available current is below minimum workable current, or resume charging when available current is 10% above minimum workable current. Charger is switched off when in pause state. Power source is not switched off when in discharge state. The default power monitor duration is 10 minutes. Set 0 minutes to disable this function and use realtime net allocated power instead (not recommended as it can cause rapid switching of charger on and off which is not good for the charger).
This function requires "Min workable current" to be set to a value other than zero, and a large sample size for reliable pausing/unpausing of charger or discharge/charge of power source.
Net allocated power sample size = Round (Power monitor duration / net power update period)
The device will stay in "Charge" state when any of the following conditions are true, provided that charge limit has not been reached.
- "Fast charge mode" is on.
- "Calibrate max charge speed" is on.
- "Min current" is equal to "Max current" and "Max current" is greater than zero.
- Charge schedule has charge end time set, and needs to charge at max current to achieve the required SOC at charge end time.
Note that power monitor duration is only read once at the start of a charge session. If setting value during a charge session, stop and restart charge for the new value to take effect.
SolarCharger Controls & Sensors card
Please see here on how to add the card.
Charge
Switch on to start charging, or switch off to stop charging.
Run states
Possible run states are: Start, Initialise, Charge (sub-state: Self-depower), Pause, Supply, Tidy-up, End
Start
Set up starting variables for the charger or power source.
Initialise
Wake up device to be charged.
Charge
Turn on charger or power source and start charging.
Self-depower
The "Self-depower" state is a sub-state of the "Charge" state. It is used to indicate the device reduced power consumption or turned off by itself while charging, eg. water heater turned off by a thermostat. Please see Self-depower today counter for more information.
Pause
Applicable to charger device only. Turn off charger and wait until the median net allocated power is equal to or above the minimum workable power resume threshold before resuming charge.
Supply
Applicable to power source device only. Turn off power source charging current and begin to supply power when power source is at or above charge limit, or when there is no surplus power for charging. It will wait until the median net allocated power is equal to or above the minimum workable power resume threshold before resuming charge. Requires "Supply cap" to be on. Power source can only switch between "Charge" and "Supply" states.
Tidy-up
Turn off charger or power source.
End
The end state.
Fast charge mode
Charge at max current. Default is to charge using surplus solar electricity.
Next charge time
This is used internally by SolarCharger to set the next charge session start time to achieve just-in-time SOC set by the charge limit and end time. It is used in conjunction with "Schedule charge" to schedule time for next charge session. See weekly charge schedule.
Priority
Highest charge priority = 5
Lowest charge priority = 100
Default = 8
Priorities reserved for system use = 0 to 4
Priority defines the order in which power is allocated to the devices, and can be any integer between 5 and 100. Power is allocated to devices in the order of highest priority to lowest priority. Deallocation to free up power occurs in reverse order, ie. from lowest priority to highest priority. Devices with the same priority will be allocated power according to their power allocation weight.
Power allocation weight
Used to calculate allocated power. Power allocation weight is used when there are more than one charger and need to allocate power to each charger according to the weight. Value must be 1 or greater in order for device to participate in power allocation. Set value to 0 to disable allocation for device. See delta allocated power for formula.
Delta allocated power
Portion of net power allocated to charger at moment in time.
Delta allocated power = Net power * (Allocation weight / Total weight)
Net allocated power
The charger's cumulative sum of delta allocated power.
Consumed power
Power consumed by charger.
Consumed energy today
Shows the estimated energy used to charge the device today. Value is in kWh, and is reset to zero at midnight.
SolarCharger Diagnostic card
Please see here on how to add the card.
Instance
1 = Charger is running.
0 = Charger stopped.
Share allocation
Share allocation is only relevant when instance count is 1.
1 = Charger is participating in power allocation.
0 = Charger paused and receives theoretical power allocation as if it is participating in real power allocation, when in fact its share has already been distributed among non-paused chargers. The theoretical power allocation is used by the charger to determine if there is enough power to meet minimum workable power requirement should it exit the paused state.
Self-depower today
Shows the number of times the device reduced power consumption or turned off by itself today. This is only applicable to devices that do not allow the user to set current, eg. a water heater with a thermostat. The device must provide an on/off switch entity and get charge current entity for this to work. The counter is reset to zero at midnight.
Stall charge
The total number of "Pause" or "Supply" state occurrences per charge session. The number is reset at the start of each charge session.
Stall average duration
Shows stall average duration per charge session. The number is reset at the start of each charge session.
Stall last duration
Shows running stall duration. The number is reset at the start of each charge session.
Net allocated power sample size
The number of net allocated power updates captured during the "Power monitor duration" window.
Net allocated power data set
Sensor to indicate whether data set is ready for use depending on duration of captured data. Pause and un-pause charger decisions can only be made when the data set is ready for use. Once set ready for the first time, the data set is considered to be ready if duration of captured data is above 80% of power monitor duration.
Median net allocated power
The median of net allocated power. See Power monitor duration for more information.
Median net allocated power period
The median of net allocated power update period in seconds, and should be equivalent to the net power update period.
SolarCharger Configuration card
Please see here on how to add the card.
Max current
Set the charger maximum current. The maximum current is required to determine the maximum power that can be allocated to the device during power allocation and rebalancing.
Min current
Set the charger minimum current. The charge current will not fall below this value. Entity can be overridden in Settings (cog wheel), please see example.
For chargers with large minimum workable current (eg. OCPP), there will be borderline cases when available solar is just below minimum workable current, which will cause SC to switch from 6A to 0A. You can avoid this by setting minimum current = 6A to allow it to draw from grid during those temporary moments when there is not enough solar.
The pause state will only be invoked when net allocated power is less than minimum workable power for a prolonged period of time.
Step current list
Step current list is required for chargers that do not support 1A incremental steps. Instead, the charger can only adjust current in predefined steps, eg. [0, 6, 10, 15, 30], in which case please ensure "Max current", "Min current" and "Min workable current" are valid steps in the list. Default blank list (ie. []) is used to indicate 1A incremental steps.
Min workable current
Specify charger minimum workable current in Ampere. If available current falls below the charger minimum workable current, the charge current will be set to 0A. OCPP charger may require the minimum workable current to be set to 6A.
Min workable power pause threshold
Minimum workable power is calculated from minimum workable current (ie. power = voltage * current). A configurable buffer as a percentage of minimum workable power to raise or lower the threshold for entering pause state. This prevents rapid toggling between charging and paused states in borderline scenarios. The default is 0% of minimum workable power, ie. the charger will enter pause state if available power drops below the minimum workable power. The percentage threshold can be positive or negative.
Min workable power resume threshold
Minimum workable power is calculated from minimum workable current (ie. power = voltage * current). A configurable buffer as a percentage of minimum workable power to raise or lower the threshold for exiting pause state and resume charging. This prevents rapid toggling between charging and paused states in borderline scenarios. The default is +10% of minimum workable power, ie. the available power needs to be 10% above the minimum workable power before charger can exit pause state and resume charging. The percentage threshold can be positive or negative.
Power factor
Set power factor to be used in real power calculation for reactive and non-linear loads. Default is 1 for resistive load.
Poll charger update
Enable this if third-party charger integration requires polling for updates and does not provide a polling button. Please turn this on if you are using Tesla Fleet, Tessie or Telemetry.
Start state
Select the state to use when starting session. Possible states are Auto (default), Charge and Pause.
Auto
Automatically start with "Charge" state during daylight hours or "Pause" state during night time.
Charge
Always start with "Charge" state when starting session.
Pause
Always start with "Pause" state when starting session. Enable this to start device in pause state to facilitate monitoring of available solar for resistive load that uses a lot of energy when switched on, eg. hot water. Not applicable when "Supply cap" is on.
Max charge speed
This is used to calculate the time required to charge the device for just-in-time charge scheduling.
Calibrate max charge speed
Charges at max current until there is a 4% increase in current state of charge (SOC). The collected data will be used to set the max charge speed (%/hour). Note that SOC sensor entity must be defined and its starting value must be less than 92% in order for this function to work.
Supply cap
Turn this on to limit the power source's output power by reducing power consumption for devices under management. Power source can be a battery, a 2-way charger, a wind turbine, solar panels, etc. Requires the "Supply net power sensor" to be defined. If power source cannot be charged (eg. a wind turbine) or has no entity to read input charge current, then set "Max current"=0 and "Min workable current"=1 to keep power source always in "Supply" state.
Supply net power sensor
Defines the power source net power entity ID. The entity value in Watts is negative when power source is exporting power (eg. battery discharging), and positive when power source is importing power (eg. battery charging). SolarCharger only uses the negative value from the sensor to manage export power.
Please note that the power portion from the "Supply net power sensor" must already be included in the "Net power sensor".
Supply power limit
Defines the power source output power limit in Watts, which can be any positive value. Set it to -1 to remove the output power limit. Set it to 0 to minimise power export.
This entity is overridable, which allows you to adjust the output power depending on time or other conditions. Please see here for example.
OCPP specific config
Charge profile ID (default=1)
Set the profile ID used to set the charge current. Default is 1. If the charger fails to set the charge current, you might consider using a different charge profile ID or changing the stack level. You might also consider clearing all existing charge profiles in the charger provided it is possible for you to recreate those profiles in case you need them again.
Charge profile stack level (default=0)
Set the stack level (priority) of the charge profile in case it is required to work with existing charge profiles. Set to -1 to use the maximum stack level (highest priority).
SolarCharger Schedule card
Press the "Reset charge limit and time" button to reset limits and times to default values when required.
Please see here on how to add the card.
Charge limit 7 days schedule
The charge limit and end time combination define the time the car needs to be ready with the specified SOC. To use this function, please enable "Schedule charge". Note that SOC sensor is required to estimate the charge start time if charge end time is set.
If charge end time is set to a value other than midnight, SolarCharger will try to achieve SOC set by the charge limit using surplus solar first unless there is not enough time, in which case it will charge at maximum current to reach charge limit. Max charge speed must have been calibrated in order for this to work.
Set charge end time to midnight (ie. 12:00:00 AM) to disable scheduling for the day, in which case SolarCharger will aim for the charge limit using surplus solar only and without guarantee of reaching charge limit.
Note that your HA login profile has configuration for time format, ie. either 24 or 12 hour time format.
Schedule charge
Turns the weekly charge schedule and per-day charge limits on or off. It works together with "Plug-in trigger" and "Sun trigger" to apply each day's charge limit and scheduled charge times. See weekly charge schedule.
- Enabled: The charger follows the weekly schedule and uses that day's charge limit.
- Disabled: The charger keeps the charge limit already set on the device. It charges from solar only, unless "Fast charge mode" is on.
Midnight charge limit check
If "Schedule charge" is enabled and the charger isn't running, the charger starts at midnight to check the new day's charge limit:
- SOC at or above the new limit: The charger does not start.
- SOC below the new limit: The charger starts. With "Start state" set to "Auto" and "Fast charge mode" off, it starts in the "Pause" state and waits for solar.
[!IMPORTANT] To avoid unexpected charging at midnight, set "Start state" to "Auto" and turn off "Fast charge mode". If you don't need the midnight check, turn off "Schedule charge".
Sun trigger
Enable or disable the use of sunrise start elevation to trigger start of charge session, and sunset end elevation trigger to stop the session. If disabled, SolarCharger will run irrespective of time of day once started until charge limit is reached. The start and end elevations are defined in global defaults.
Plugin trigger
Enable or disable the act of plugging in the charger to trigger start of charge session.
Device presence sensor
Select the ping ICMP entity for detecting presence of device. Please see setup instructions and this for other possible entities that can be used.
Device presence trigger
Enable or disable the use of ping ICMP entity to detect presence of device and update HA with latest data. Device presence sensor must have been defined before enabling this trigger.
Exit condition sensor
Binary sensor helper used by "Exit condition trigger" switch to end charging session if binary sensor template evaluates to true. For example, end session if "Consumed energy today" >= 9kWh, or "Self-depower today" >= 1.
Exit condition trigger
If toggled on, charging session will end if "Exit condition sensor" evaluates to true. See example.
Reduce charge limit difference
Look ahead to reduce charge limit difference between days. Automatically charge more today if next 3 days have much higher charge limit and today has no charge end time, or if today has charge end time and SOC is just 1% below the required charge limit. See Daily car charge limit settings.
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 up to 15 minutes for the conditions to refresh and the triggers to work. Please see below for a number of possible work-arounds.
Possible work-arounds:
- Plug in the charger and then press the "Wake up" button follow by the "Force data update" button.
- Install the "Ping" integration to ping car, then assign the ping entity to "Device presence sensor" and turn on "Device presence trigger" in local device config. This will wake up car and force update HA on first ping response.
Please see this for more info.
Use "Ping" to detect car and update HA to get latest status
Install the "Ping (ICMP)" integration, and then configure it to ping the static IP address of your car. Don't use the car host name since HA can take up to 10 minutes to resolve the host name. Assign the ping entity to "Device presence sensor" and turn on "Device presence trigger" in local device config. The first ping response will wake up car and force update HA on latest status. Car will respond to ping as long as car is awake. It will only retry 15 times to update HA to see if the charger is connected or switched on, sleeping 60 seconds before each retry.
The following automation is no longer required and is here for your information only. It has been replaced by the "Device presence trigger".
alias: [YourEvName] presence update
description: "Wake up car and force update HA if charger is plugged in within 15 minutes of first ping response."
triggers:
- trigger: state
entity_id:
- binary_sensor.[YourEvIpAddress]
to: "on"
conditions:
- condition: state
entity_id: binary_sensor.[YourEvChargerPluggedInSensor]
state: "off"
actions:
- action: button.press
metadata: {}
data: {}
target:
entity_id: button.wake_up
- delay:
hours: 0
minutes: 0
seconds: 40
milliseconds: 0
- repeat:
sequence:
- action: button.press
metadata: {}
data: {}
target:
entity_id: button.force_data_update
- delay:
hours: 0
minutes: 1
seconds: 0
milliseconds: 0
until:
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.[YourEvChargerPluggedInSensor]
state: "on"
- condition: template
value_template: "{{ repeat.index >= 15 }}"
mode: single
Please note that car can sometimes forget the WIFI network, in which case re-enter the WIFI password to join the network so that ping can work again.