From 4d050f7581bb0c0fd813fd6645f8e800baf2b995 Mon Sep 17 00:00:00 2001 From: finalbillybong Date: Tue, 14 Mar 2023 16:42:24 +0000 Subject: [PATCH 01/12] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 377612f..f24d975 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,12 @@

Home Assistant YAML for Solis Hybrid Inverter using MODBUS

+This forked from https://github.com/fboundy/ha_solis_modbus and includes automations to set 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 in the template sensor. + +Requires forcast.solar integration + 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/) From f8b6c767297118719feb1cda7dc3a009f41d1161 Mon Sep 17 00:00:00 2001 From: finalbillybong Date: Tue, 14 Mar 2023 16:43:10 +0000 Subject: [PATCH 02/12] Add files via upload --- README.md | 6 ---- eco7-automations.yaml | 21 +++++++++++ eco7-automations.yaml.bak | 72 +++++++++++++++++++++++++++++++++++++ inputs.yaml | 27 ++++++++++++++ inputs.yaml.bak | 74 +++++++++++++++++++++++++++++++++++++++ template.yaml | 19 ++++++++++ 6 files changed, 213 insertions(+), 6 deletions(-) create mode 100644 eco7-automations.yaml.bak create mode 100644 inputs.yaml.bak create mode 100644 template.yaml diff --git a/README.md b/README.md index f24d975..377612f 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,6 @@

Home Assistant YAML for Solis Hybrid Inverter using MODBUS

-This forked from https://github.com/fboundy/ha_solis_modbus and includes automations to set 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 in the template sensor. - -Requires forcast.solar integration - 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/eco7-automations.yaml.bak b/eco7-automations.yaml.bak new file mode 100644 index 0000000..a389f68 --- /dev/null +++ b/eco7-automations.yaml.bak @@ -0,0 +1,72 @@ +automations: + - id: "1669414355762" + alias: Sync Solis Mode to Eco7 Mode + description: If the Eco7 toggle changes, the inverter 'Grid Charging' and 'Timed Charging' toggles are set to match it. + trigger: + - platform: state + entity_id: + - input_boolean.solis_eco7_charging + condition: [] + action: + - service: input_boolean.turn_{{ trigger.to_state.state }} + entity_id: input_boolean.solis_storage_mode_grid_charge + - delay: + hours: 0 + minutes: 0 + seconds: 5 + milliseconds: 0 + - service: input_boolean.turn_{{ trigger.to_state.state }} + entity_id: input_boolean.solis_storage_mode_timed + mode: single + # + # + - id: "1669139628337" + alias: Set Eco7 Charge Current + description: Sets the Eco7 Charge Current at the start of the Eco7 period every 30 minutes during the Eco7 Period provided the Eco7 input_boolean is on + trigger: + - platform: time_pattern + minutes: "0" + - platform: time_pattern + minutes: "30" + - platform: time + at: input_datetime.economy_7_start + condition: + - condition: and + conditions: + - condition: state + entity_id: input_boolean.solis_eco7_charging + state: "on" + - condition: time + before: input_datetime.economy_7_end + after: input_datetime.economy_7_start + enabled: false + - condition: template + value_template: + "{{(now() >= today_at(states('input_datetime.economy_7_start'))) + + and (now() < today_at(states('input_datetime.economy_7_end'))) + + and states('input_boolean.solis_eco7_charging') == 'on'}}" + action: + - service: script.solis_set_charge_current + data: + charge_current: "{{states('sensor.solis_eco7_charge_current') | float}}" + mode: single + + - id: "1669145089862" + alias: Solis Set Eco7 Charge Times + description: "Changes the Fixed Charging times on the inverter whenever the Economy 7 input_datetime entities change" + trigger: + - platform: state + entity_id: + - input_datetime.economy_7_start + - input_datetime.economy_7_end + condition: + - condition: template + value_template: + "{{strptime(states('input_datetime.economy_7_end'),'%H:%M:%S').time() + >strptime(states('input_datetime.economy_7_start'),'%H:%M:%S').time()}}" + action: + - service: script.solis_set_eco7_times + data: {} + mode: single diff --git a/inputs.yaml b/inputs.yaml index 48a9147..89e5c3f 100644 --- a/inputs.yaml +++ b/inputs.yaml @@ -72,3 +72,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/inputs.yaml.bak b/inputs.yaml.bak new file mode 100644 index 0000000..48a9147 --- /dev/null +++ b/inputs.yaml.bak @@ -0,0 +1,74 @@ +input_boolean: + trigger_first_morning: + name: Waiting for first morning motion + icon: mdi:kettle + + solis_eco7_charging: + name: Solis Eco7 Charging + icon: mdi:flash + + saver_session: + name: Saver Session + icon: mdi:transmission-tower + + solis_storage_mode_grid_charge: + name: Solis Storage Mode - Grid Charge + + solis_storage_mode_backup: + name: Solis Storage Mode - Backup + + solis_storage_mode_wake_up: + name: Solis Storage Mode - Wake-Up + + solis_storage_mode_timed: + name: Solis Storage Mode - Timed + + solis_storage_mode_off_grid: + name: Solis Storage Mode - Off-Grid + + solis_storage_mode_spontaneous: + name: Solis Storage Mode - Spontaneous + +input_datetime: + economy_7_start: + name: Economy 7 Start + has_date: false + has_time: true + icon: mdi:clock-digital + + economy_7_end: + name: Economy 7 End + has_date: false + has_time: true + icon: mdi:clock-digital + +input_number: + eco7_target_soc: + name: Economy 7 Target SOC + initial: 100 + mode: box + unit_of_measurement: "%" + min: 0 + max: 100 + step: 1 + icon: mdi:battery + + solis_battery_capacity: + name: Solis Battery Capacity + initial: 5 + mode: box + unit_of_measurement: "kWh" + min: 1 + max: 50 + step: 1 + icon: mdi:battery + + backup_mode_soc: + name: Backup Mode SOC + initial: 80 + mode: box + unit_of_measurement: "%" + min: 0 + max: 100 + step: 1 + icon: mdi:battery diff --git a/template.yaml b/template.yaml new file mode 100644 index 0000000..75cb86a --- /dev/null +++ b/template.yaml @@ -0,0 +1,19 @@ + - sensor: + 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 %} \ No newline at end of file From b6b39022754d2ff6306054cbca515b73c5c7bc17 Mon Sep 17 00:00:00 2001 From: finalbillybong Date: Tue, 14 Mar 2023 16:44:32 +0000 Subject: [PATCH 03/12] Delete inputs.yaml.bak --- inputs.yaml.bak | 74 ------------------------------------------------- 1 file changed, 74 deletions(-) delete mode 100644 inputs.yaml.bak diff --git a/inputs.yaml.bak b/inputs.yaml.bak deleted file mode 100644 index 48a9147..0000000 --- a/inputs.yaml.bak +++ /dev/null @@ -1,74 +0,0 @@ -input_boolean: - trigger_first_morning: - name: Waiting for first morning motion - icon: mdi:kettle - - solis_eco7_charging: - name: Solis Eco7 Charging - icon: mdi:flash - - saver_session: - name: Saver Session - icon: mdi:transmission-tower - - solis_storage_mode_grid_charge: - name: Solis Storage Mode - Grid Charge - - solis_storage_mode_backup: - name: Solis Storage Mode - Backup - - solis_storage_mode_wake_up: - name: Solis Storage Mode - Wake-Up - - solis_storage_mode_timed: - name: Solis Storage Mode - Timed - - solis_storage_mode_off_grid: - name: Solis Storage Mode - Off-Grid - - solis_storage_mode_spontaneous: - name: Solis Storage Mode - Spontaneous - -input_datetime: - economy_7_start: - name: Economy 7 Start - has_date: false - has_time: true - icon: mdi:clock-digital - - economy_7_end: - name: Economy 7 End - has_date: false - has_time: true - icon: mdi:clock-digital - -input_number: - eco7_target_soc: - name: Economy 7 Target SOC - initial: 100 - mode: box - unit_of_measurement: "%" - min: 0 - max: 100 - step: 1 - icon: mdi:battery - - solis_battery_capacity: - name: Solis Battery Capacity - initial: 5 - mode: box - unit_of_measurement: "kWh" - min: 1 - max: 50 - step: 1 - icon: mdi:battery - - backup_mode_soc: - name: Backup Mode SOC - initial: 80 - mode: box - unit_of_measurement: "%" - min: 0 - max: 100 - step: 1 - icon: mdi:battery From ac1f8df318249e4403fe10498e0590def18d92af Mon Sep 17 00:00:00 2001 From: finalbillybong Date: Tue, 14 Mar 2023 16:48:16 +0000 Subject: [PATCH 04/12] Delete template.yaml --- template.yaml | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 template.yaml diff --git a/template.yaml b/template.yaml deleted file mode 100644 index 75cb86a..0000000 --- a/template.yaml +++ /dev/null @@ -1,19 +0,0 @@ - - sensor: - 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 %} \ No newline at end of file From 781e6a1cc9bb74e4ad4c2ed40d0df1d59d17846e Mon Sep 17 00:00:00 2001 From: finalbillybong Date: Tue, 14 Mar 2023 16:48:52 +0000 Subject: [PATCH 05/12] Update solis-template.yaml --- solis-template.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/solis-template.yaml b/solis-template.yaml index 863d143..1230fb1 100644 --- a/solis-template.yaml +++ b/solis-template.yaml @@ -100,3 +100,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 %} From 73e88cd27cf33bfb15d4e6d7891da840e9b0b290 Mon Sep 17 00:00:00 2001 From: finalbillybong Date: Tue, 14 Mar 2023 16:52:35 +0000 Subject: [PATCH 06/12] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 377612f..0892675 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,11 @@ # ha_solis_modbus

Home Assistant YAML for Solis Hybrid Inverter using MODBUS

+This forked from https://github.com/fboundy/ha_solis_modbus and includes automations to set 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 in the template sensor. + +Requires forcast.solar integration 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/) From e8a9be3ae9215a5ce4828a5e70e8c1492af4986f Mon Sep 17 00:00:00 2001 From: finalbillybong Date: Tue, 14 Mar 2023 16:53:07 +0000 Subject: [PATCH 07/12] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0892675..f24d975 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,13 @@ # ha_solis_modbus

Home Assistant YAML for Solis Hybrid Inverter using MODBUS

+ This forked from https://github.com/fboundy/ha_solis_modbus and includes automations to set 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 in the template sensor. Requires forcast.solar integration + 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/) From f0aba41635f5171df1faf4db85e92999a3bad425 Mon Sep 17 00:00:00 2001 From: finalbillybong Date: Tue, 14 Mar 2023 16:53:42 +0000 Subject: [PATCH 08/12] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f24d975..dcf82be 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@

Home Assistant YAML for Solis Hybrid Inverter using MODBUS

-This forked from https://github.com/fboundy/ha_solis_modbus and includes automations to set 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. +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 in the template sensor. From 32aaff81ec47d471d0a96c7ceac1aa570bb9674d Mon Sep 17 00:00:00 2001 From: finalbillybong Date: Tue, 14 Mar 2023 18:09:21 +0000 Subject: [PATCH 09/12] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dcf82be..21c458a 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ 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 in the template sensor. +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 From c05e6f4b4d5364cba98cf1c275bad2c06651bf4b Mon Sep 17 00:00:00 2001 From: finalbillybong Date: Tue, 14 Mar 2023 18:09:58 +0000 Subject: [PATCH 10/12] Delete eco7-automations.yaml.bak --- eco7-automations.yaml.bak | 72 --------------------------------------- 1 file changed, 72 deletions(-) delete mode 100644 eco7-automations.yaml.bak diff --git a/eco7-automations.yaml.bak b/eco7-automations.yaml.bak deleted file mode 100644 index a389f68..0000000 --- a/eco7-automations.yaml.bak +++ /dev/null @@ -1,72 +0,0 @@ -automations: - - id: "1669414355762" - alias: Sync Solis Mode to Eco7 Mode - description: If the Eco7 toggle changes, the inverter 'Grid Charging' and 'Timed Charging' toggles are set to match it. - trigger: - - platform: state - entity_id: - - input_boolean.solis_eco7_charging - condition: [] - action: - - service: input_boolean.turn_{{ trigger.to_state.state }} - entity_id: input_boolean.solis_storage_mode_grid_charge - - delay: - hours: 0 - minutes: 0 - seconds: 5 - milliseconds: 0 - - service: input_boolean.turn_{{ trigger.to_state.state }} - entity_id: input_boolean.solis_storage_mode_timed - mode: single - # - # - - id: "1669139628337" - alias: Set Eco7 Charge Current - description: Sets the Eco7 Charge Current at the start of the Eco7 period every 30 minutes during the Eco7 Period provided the Eco7 input_boolean is on - trigger: - - platform: time_pattern - minutes: "0" - - platform: time_pattern - minutes: "30" - - platform: time - at: input_datetime.economy_7_start - condition: - - condition: and - conditions: - - condition: state - entity_id: input_boolean.solis_eco7_charging - state: "on" - - condition: time - before: input_datetime.economy_7_end - after: input_datetime.economy_7_start - enabled: false - - condition: template - value_template: - "{{(now() >= today_at(states('input_datetime.economy_7_start'))) - - and (now() < today_at(states('input_datetime.economy_7_end'))) - - and states('input_boolean.solis_eco7_charging') == 'on'}}" - action: - - service: script.solis_set_charge_current - data: - charge_current: "{{states('sensor.solis_eco7_charge_current') | float}}" - mode: single - - - id: "1669145089862" - alias: Solis Set Eco7 Charge Times - description: "Changes the Fixed Charging times on the inverter whenever the Economy 7 input_datetime entities change" - trigger: - - platform: state - entity_id: - - input_datetime.economy_7_start - - input_datetime.economy_7_end - condition: - - condition: template - value_template: - "{{strptime(states('input_datetime.economy_7_end'),'%H:%M:%S').time() - >strptime(states('input_datetime.economy_7_start'),'%H:%M:%S').time()}}" - action: - - service: script.solis_set_eco7_times - data: {} - mode: single From e925c30aff9a0c1e7266c4b38184fda40d85a874 Mon Sep 17 00:00:00 2001 From: finalbillybong Date: Fri, 14 Apr 2023 07:41:36 +0100 Subject: [PATCH 11/12] Update README.md --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 21c458a..9f324b3 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,11 @@ This forked from https://github.com/fboundy/ha_solis_modbus and includes automat 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 +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. + +------------------------------------------------------------------------------------------------------------------------------------------------------------- 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: From 37e876219eefb538fde573f6b4b3d649b2f0a1ba Mon Sep 17 00:00:00 2001 From: finalbillybong Date: Sun, 16 Apr 2023 20:59:38 +0100 Subject: [PATCH 12/12] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9f324b3..e1fab9a 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,8 @@ Fill in the three input numbers for charge, and set your usable battery capacity 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. +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. + -------------------------------------------------------------------------------------------------------------------------------------------------------------