I'm trying to trigger on SoC level, help needed
Posted: Mon Jun 17, 2024 7:14 pm
I'm hoping someone can help, I thought this would work after testing in the templates page but hasn't triggered.
Background for goal:
I've had automations setting the work mode based on the tariffs, so at the start of the peak rate I switch to Feed-In Priority, at the end of peak I switch back to Self use. Now with the ability to Force Discharge I edited this to get even more at the peak export rate starting at 4pm. I only wanted to discharge to a set SoC though, so I set the number.min_soc and number.min_soc_on_grid to something that would see us to the next day.
Of course you reach the Min SoC, you are in Force Discharge mode, the system starts consuming from the grid (at the peak rate).
So I thought of this, if the SoC gets to that level in Force Discharge mode, I trigger this changing the mode to something else (Self Use or Feed In) and set the Min SoC to a lower level to use battery and prevent any grid consumption.
didn't trigger though, Any ideas?
here's the full automation
thanks!
Background for goal:
I've had automations setting the work mode based on the tariffs, so at the start of the peak rate I switch to Feed-In Priority, at the end of peak I switch back to Self use. Now with the ability to Force Discharge I edited this to get even more at the peak export rate starting at 4pm. I only wanted to discharge to a set SoC though, so I set the number.min_soc and number.min_soc_on_grid to something that would see us to the next day.
Of course you reach the Min SoC, you are in Force Discharge mode, the system starts consuming from the grid (at the peak rate).
So I thought of this, if the SoC gets to that level in Force Discharge mode, I trigger this changing the mode to something else (Self Use or Feed In) and set the Min SoC to a lower level to use battery and prevent any grid consumption.
didn't trigger though, Any ideas?
Code: Select all
trigger:
- platform: template
value_template: >-
"{{ states('sensor.battery_soc') | int(0) <=
states('input_number.min_soc_peak') | int(0) }}"
Code: Select all
alias: "Energy: Battery target Force Discharge SoC level achieved "
description: >-
Sets the Min SoC to lower 'day time' level and work mode back to Feed-In
Priority
trigger:
- platform: template
value_template: >-
"{{ states('sensor.workshop_battery_soc') | int(0) <=
states('input_number.min_soc_peak') | int(0) }}"
variables:
minSoC: "{{ float(states('input_number.min_soc_day')) }}"
workmode: Feed-In Priority
condition:
- condition: template
value_template: "{{ states('select.workshop_work_mode') == 'Force Discharge' }}"
action:
- service: number.set_value
target:
entity_id: number.workshop_min_soc
data:
value: "{{ minSoC }}"
- service: number.set_value
target:
entity_id: number.workshop_min_soc_on_grid
data:
value: "{{ minSoC }}"
- service: select.select_option
target:
entity_id: select.workshop_work_mode
data:
option: "{{ workmode }}"
mode: single