diff --git a/README.md b/README.md
index acd75b6..faa3d4c 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,17 @@
Home Assistant YAML for Solis Hybrid Inverter using MODBUS
+This forked from https://github.com/fboundy/ha_solis_modbus and includes automations to estimate an overnight target SOC to ensure enough power to run your house until the sun comes out while also leaving maximum space in your battery for energy capture.
+
+Fill in the three input numbers for charge, and set your usable battery capacity and solar prediction entity_id in the template sensor.
+
+Requires forcast.solar integration: https://www.home-assistant.io/integrations/forecast_solar/
+
+I plan to add support for setting battery discharge times and current to accomodate people who are on the new Octopus Flux tariff. Everything is written for this and being tested now. I should be able to upload in the next week or so.
+
+
+-------------------------------------------------------------------------------------------------------------------------------------------------------------
+
This is a Home Assistant YAML file for communicating with a Solis Hybrid inverter using a Data Logging Stick which uses pure Modbus over TCP. It has been tested using a Solis 5-eh1p(3-6)k inverter and:
- DLS-LAN stick: Serial number 1920xxxxxx [as shown here](https://tenergise.co.uk/product/solis-data-logging-stick/)
diff --git a/eco7-automations.yaml b/eco7-automations.yaml
index a389f68..6d93dac 100644
--- a/eco7-automations.yaml
+++ b/eco7-automations.yaml
@@ -70,3 +70,24 @@ automations:
- service: script.solis_set_eco7_times
data: {}
mode: single
+
+ - id: '1678731184170'
+ alias: Set Target SOC for Overnight Charging
+ description: ''
+ trigger:
+ - platform: time
+ at: 00:28:00
+ condition:
+ - condition: time
+ weekday:
+ - mon
+ - tue
+ - wed
+ - thu
+ - fri
+ action:
+ - service: input_number.set_value
+ entity_id: input_number.eco7_target_soc
+ data:
+ value: '{{ states(''sensor.target_battery_charge_weekday'') | int(0) }}'
+ mode: single
\ No newline at end of file
diff --git a/inputs.yaml b/inputs.yaml
index 9c228c9..11e6845 100644
--- a/inputs.yaml
+++ b/inputs.yaml
@@ -75,3 +75,30 @@ input_number:
max: 100
step: 1
icon: mdi:battery
+
+ end_of_day_charge_required:
+ name: End of Day Charge Required
+ mode: box
+ unit_of_measurement: "kWh"
+ min: 0
+ max: 13
+ step: 0.5
+ icon: mdi:home-battery
+
+ start_of_day_charge_required:
+ name: Start of Day Charge Required
+ mode: box
+ unit_of_measurement: "kWh"
+ min: 0
+ max: 13
+ step: 0.5
+ icon: mdi:home-battery
+
+ daytime_charge_required:
+ name: Day Time Charge Required
+ mode: box
+ unit_of_measurement: "kWh"
+ min: 0
+ max: 13
+ step: 0.5
+ icon: mdi:home-battery
\ No newline at end of file
diff --git a/solis-template.yaml b/solis-template.yaml
index d7f4a98..bf1e60f 100644
--- a/solis-template.yaml
+++ b/solis-template.yaml
@@ -130,3 +130,22 @@ template:
state: >-
{% set state = states.sensor.solis_battery_current_direction.state | int %}
{{ states('sensor.solis_battery_power') | float(2) if state > 0 else 0 }}
+
+ name: 'Target Battery Charge Weekday'
+ unique_id: 'sensor.target_battery_charge_weekday'
+ unit_of_measurement: '%'
+ icon: mdi:battery-90
+ state: >
+ {% set charge_end = states('input_number.end_of_day_charge_required') | float %}
+ {% set charge_now = states('input_number.start_of_day_charge_required') | float %}
+ {% set home_consumption = states('input_number.daytime_charge_required') | float %}
+ {% set forecast = states('sensor.energy_production_today') | float %}
+ {% set capacity = 13 %}
+ {% set target_charge = ((charge_end + charge_now + home_consumption - forecast) / capacity) * 100 %}
+ {% if target_charge < 32 %}
+ {{ 32 }}
+ {% elif target_charge > 100 %}
+ {{ 100 }}
+ {% else %}
+ {{ target_charge | round(0, default=0) }}
+ {% endif %}