From 371f59dd5f217906b74f05184e9f43c416f4b186 Mon Sep 17 00:00:00 2001 From: finalbillybong Date: Sat, 2 Dec 2023 11:18:58 +0000 Subject: [PATCH 01/10] Update eco7-automations.yaml --- eco7-automations.yaml | 52 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/eco7-automations.yaml b/eco7-automations.yaml index 6d93dac..7fc5a21 100644 --- a/eco7-automations.yaml +++ b/eco7-automations.yaml @@ -90,4 +90,54 @@ automations: 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 + mode: single + + - id: '1678731184171' + alias: Set Flux Discharge Current + description: >- + Sets the Flix Discharge Current at the start of the Flux period every 30 + minutes during the Flux Period provided the Flux input_boolean is on + trigger: + - platform: time_pattern + minutes: "0" + - platform: time_pattern + minutes: /5 + - platform: time + at: input_datetime.flux_discharge_start + condition: + - condition: template + value_template: >- + {{(now() >= today_at(states('input_datetime.flux_discharge_start'))) and + (now() < today_at(states('input_datetime.flux_discharge_end'))) and + states('input_boolean.solis_flux_discharging') == 'on'}} + action: + - service: script.solis_set_discharge_current + data: + discharge_current: "{{states('sensor.solis_flux_discharge_current_template') | float}}" + mode: restart + + - id: '1678731184172' + alias: " Solis Set Flux Discharge Times " + description: >- + Changes the Fixed Charging times on the inverter whenever the Flux + input_datetime entities change + trigger: + - platform: time_pattern + minutes: /5 + - platform: state + entity_id: + - input_boolean.solis_flux_discharging + condition: + - condition: template + value_template: >- + {{strptime(states('input_datetime.flux_discharge_end'),'%H:%M:%S').time() + >strptime(states('input_datetime.flux_discharge_start'),'%H:%M:%S').time()}} + action: + - delay: + hours: 0 + minutes: 0 + seconds: 10 + milliseconds: 0 + - service: script.solis_set_flux_times + data: {} + mode: single From 1b7d69df06a1f713454e2070b147a82c1d298204 Mon Sep 17 00:00:00 2001 From: finalbillybong Date: Sat, 2 Dec 2023 11:25:17 +0000 Subject: [PATCH 02/10] Update inputs.yaml --- inputs.yaml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/inputs.yaml b/inputs.yaml index 11e6845..763a3a7 100644 --- a/inputs.yaml +++ b/inputs.yaml @@ -56,6 +56,16 @@ input_number: step: 1 icon: mdi:battery + flux_target_soc: + name: Flux Discharge Target SOC + initial: 60 + mode: box + unit_of_measurement: "%" + min: 0 + max: 100 + step: 1 + icon: mdi:battery + solis_battery_capacity: name: Solis Battery Capacity initial: 5 @@ -101,4 +111,4 @@ input_number: min: 0 max: 13 step: 0.5 - icon: mdi:home-battery \ No newline at end of file + icon: mdi:home-battery From 59fea3e3c8bd7ce424bbbf91192dca9b208986ee Mon Sep 17 00:00:00 2001 From: finalbillybong Date: Sat, 2 Dec 2023 11:26:45 +0000 Subject: [PATCH 03/10] Update inputs.yaml --- inputs.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/inputs.yaml b/inputs.yaml index 763a3a7..0aa704d 100644 --- a/inputs.yaml +++ b/inputs.yaml @@ -45,6 +45,18 @@ input_datetime: has_time: true icon: mdi:clock-digital + flux_discharge_start: + name: Discharge Start + has_date: false + has_time: true + icon: mdi:clock-digital + + flux_discharge_end: + name: Discharge End + has_date: false + has_time: true + icon: mdi:clock-digital + input_number: eco7_target_soc: name: Economy 7 Target SOC From 29190ab3ea550db724b3f36f7b3a8cf02b90c9e6 Mon Sep 17 00:00:00 2001 From: finalbillybong Date: Sat, 2 Dec 2023 11:27:56 +0000 Subject: [PATCH 04/10] Update inputs.yaml --- inputs.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/inputs.yaml b/inputs.yaml index 0aa704d..024e915 100644 --- a/inputs.yaml +++ b/inputs.yaml @@ -7,6 +7,10 @@ input_boolean: name: Solis Eco7 Charging icon: mdi:flash + solis_flux_discharging: + name: Octopus Flux Discharging + icon: mdi:battery-charging-high + saver_session: name: Saver Session icon: mdi:transmission-tower From 450cfc561fb4c33b359f4134b4098230212d9a5d Mon Sep 17 00:00:00 2001 From: finalbillybong Date: Sat, 2 Dec 2023 11:29:26 +0000 Subject: [PATCH 05/10] Update eco7-automations.yaml --- eco7-automations.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eco7-automations.yaml b/eco7-automations.yaml index 7fc5a21..91c6c59 100644 --- a/eco7-automations.yaml +++ b/eco7-automations.yaml @@ -95,7 +95,7 @@ automations: - id: '1678731184171' alias: Set Flux Discharge Current description: >- - Sets the Flix Discharge Current at the start of the Flux period every 30 + Sets the Flux Discharge Current at the start of the Flux period every 30 minutes during the Flux Period provided the Flux input_boolean is on trigger: - platform: time_pattern From 07e78d5294141459c9832fdd835a4e6bdaf74c9a Mon Sep 17 00:00:00 2001 From: finalbillybong Date: Sat, 2 Dec 2023 11:30:07 +0000 Subject: [PATCH 06/10] Update eco7-automations.yaml --- eco7-automations.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eco7-automations.yaml b/eco7-automations.yaml index 91c6c59..393878d 100644 --- a/eco7-automations.yaml +++ b/eco7-automations.yaml @@ -95,7 +95,7 @@ automations: - id: '1678731184171' alias: Set Flux Discharge Current description: >- - Sets the Flux Discharge Current at the start of the Flux period every 30 + Sets the Flux Discharge Current at the start of the Flux period every 5 minutes during the Flux Period provided the Flux input_boolean is on trigger: - platform: time_pattern @@ -119,7 +119,7 @@ automations: - id: '1678731184172' alias: " Solis Set Flux Discharge Times " description: >- - Changes the Fixed Charging times on the inverter whenever the Flux + Changes the Fixed Discharging times on the inverter whenever the Flux input_datetime entities change trigger: - platform: time_pattern From bb7c385f553636b2e3cd71ad58fae65a07071e94 Mon Sep 17 00:00:00 2001 From: finalbillybong Date: Sat, 2 Dec 2023 11:32:33 +0000 Subject: [PATCH 07/10] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index faa3d4c..c547a43 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ 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. Everything is written for this and being tested now. I should be able to upload in the next week or so. +Added support for Discharging - can be used for Flux to discharge at peak times, for Octopus saving sessions. I also use this to bump excess enegry into my EV overnight. ------------------------------------------------------------------------------------------------------------------------------------------------------------- From b8b99767d42f60c7c3cf54664d0b1de3772c1c95 Mon Sep 17 00:00:00 2001 From: finalbillybong Date: Sat, 2 Dec 2023 11:43:51 +0000 Subject: [PATCH 08/10] Update solis-template.yaml --- solis-template.yaml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/solis-template.yaml b/solis-template.yaml index 44e200a..a5f81b0 100644 --- a/solis-template.yaml +++ b/solis-template.yaml @@ -101,6 +101,18 @@ sensor: {{max((((today_at(states('input_datetime.economy_7_end')) - max(now(), today_at(states('input_datetime.economy_7_start')))).total_seconds() / 36) | int) / 100,0)}} {%- endif %} + + - name: "Solis Flux Discharge Hours Remaining" + unique_id: "Solis Flux Discharge Time Remaining" + state_class: measurement + state: >- + {% if today_at(states('input_datetime.flux_discharge_end')) < now() -%} + {{(((today_at(states('input_datetime.flux_discharge_end')) - + today_at(states('input_datetime.flux_discharge_start')))).total_seconds() / 36) | int / 100}} + {%- else -%} + {{max((((today_at(states('input_datetime.flux_discharge_end')) - + max(now(), today_at(states('input_datetime.flux_discharge_start')))).total_seconds() / 36) | int) / 100,0)}} + {%- endif %} - name: "Solis Eco7 Charge Current" unique_id: "Solis Eco7 Charge Current" @@ -118,6 +130,23 @@ sensor: / (states('sensor.solis_battery_voltage_bms') | float) ) | int / 10 }} + + - name: "Solis Flux Discharge Current" + unique_id: "Solis Flux Discharge Current" + device_class: current + state_class: measurement + unit_of_measurement: A + state: >- + {% set value = ( + ((states('input_number.solis_battery_capacity') | int * 1000) * + ((states('sensor.solis_battery_soc') | int) - (states('input_number.flux_target_soc') | int)) + ) + / 10 + / + (states('sensor.solis_flux_discharge_hours_remaining') | float) + / (states('sensor.solis_battery_voltage_bms') | float) ) | int / 10 %} + {{ value if value >= 0 else 0 }} + - name: "Solis Battery Charge Power" unique_id: "Solis Battery Charge Power" device_class: power From 37e7e739ec3214c55cfe8b9a36afbbab7f28474e Mon Sep 17 00:00:00 2001 From: finalbillybong Date: Sat, 2 Dec 2023 11:54:40 +0000 Subject: [PATCH 09/10] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c547a43..a92152e 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ 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/ -Added support for Discharging - can be used for Flux to discharge at peak times, for Octopus saving sessions. I also use this to bump excess enegry into my EV overnight. +I have also added support for Discharging - can be used for Flux to discharge at peak times, for Octopus saving sessions. I also use this to dump excess enegry into my EV overnight. It works exactly as the charging. Fill in the inputs for start and stop times and target SOC, the automations do the rest! ------------------------------------------------------------------------------------------------------------------------------------------------------------- From 71076164f44cb096d4a4be4796ebc278cf2063b6 Mon Sep 17 00:00:00 2001 From: finalbillybong Date: Sat, 2 Dec 2023 11:58:29 +0000 Subject: [PATCH 10/10] Update scripts.yaml --- scripts.yaml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/scripts.yaml b/scripts.yaml index fc79f57..f3418f9 100644 --- a/scripts.yaml +++ b/scripts.yaml @@ -210,3 +210,36 @@ solis_set_eco7_times: mode: single icon: mdi:battery-clock-outline +alias: "Solis Set Discharge Current " +sequence: + - service: script.solis_write_holding_register + data: + register_addr: 43142 + register_value: "{{ discharge_current * 10 }}" +fields: + solis_set_charge_current: + description: Fixed time charge current (A) + example: 50 +mode: single + +alias: Solis Set Discharge Times +sequence: + - service: script.solis_write_holding_register + data: + register_addr: 43147 + register_value: "{{(states('input_datetime.flux_discharge_start')).split(':')[0] | int}}" + - service: script.solis_write_holding_register + data: + register_addr: 43148 + register_value: "{{(states('input_datetime.flux_discharge_start')).split(':')[1] | int}}" + - service: script.solis_write_holding_register + data: + register_addr: 43149 + register_value: "{{(states('input_datetime.flux_discharge_end')).split(':')[0] | int}}" + - service: script.solis_write_holding_register + data: + register_addr: 43150 + register_value: "{{(states('input_datetime.flux_discharge_end')).split(':')[1] | int}}" +mode: single +icon: mdi:battery-clock-outline +