Could someone please verify this script is correctly syntaxed/written.
It almost works perfectly.
Not sure if this part is correct as the value isn’t reducing when required:
For those interested it is an algorhythm to charge my house battery off my EV V2L during extended poor weather.
- service: number.set_value
data:
value: >-
{{ states('number.ss_grid_charge_battery_current') | int - 5
}}
alias: V2l Charging algorhythm
sequence:
- repeat:
sequence:
- if:
- condition: numeric_state
entity_id: sensor.shackinverter_aux_power
above: 2000
below: 2200
then:
- repeat:
sequence:
- delay:
hours: 0
minutes: 0
seconds: 10
milliseconds: 0
until:
- condition: numeric_state
entity_id: sensor.shackinverter_aux_power
above: 2010
below: 2200
- if:
- condition: numeric_state
entity_id: sensor.shackinverter_aux_power
above: 2210
then:
- service: number.set_value
data:
value: >-
{{ states('number.ss_grid_charge_battery_current') | int -
5 }}
target:
entity_id: number.ss_grid_charge_battery_current
- delay:
hours: 0
minutes: 0
seconds: 10
milliseconds: 0
- if:
- condition: numeric_state
entity_id: sensor.shackinverter_aux_power
below: 1900
then:
- service: number.set_value
data:
value: >-
{{ states('number.ss_grid_charge_battery_current') | int +
1 }}
target:
entity_id: number.ss_grid_charge_battery_current
- delay:
hours: 0
minutes: 0
seconds: 10
milliseconds: 0
- if:
- condition: numeric_state
entity_id: sensor.shackinverter_aux_power
above: 2210
then:
- service: number.set_value
data:
value: >-
{{ states('number.ss_grid_charge_battery_current') | int - 5
}}
target:
entity_id: number.ss_grid_charge_battery_current
- delay:
hours: 0
minutes: 0
seconds: 10
milliseconds: 0
- if:
- condition: numeric_state
entity_id: sensor.shackinverter_aux_power
below: 1900
then:
- service: number.set_value
data:
value: >-
{{ states('number.ss_grid_charge_battery_current') | int + 1
}}
target:
entity_id: number.ss_grid_charge_battery_current
- delay:
hours: 0
minutes: 0
seconds: 10
milliseconds: 0
- if:
- condition: numeric_state
entity_id: sensor.shackinverter_aux_power
above: 1900
below: 2210
then:
- delay:
hours: 0
minutes: 0
seconds: 10
milliseconds: 0
- delay:
hours: 0
minutes: 0
seconds: 10
milliseconds: 0
until:
- condition: or
conditions:
- condition: numeric_state
entity_id: sensor.shackinverter_aux_power
below: 1900
- condition: or
conditions:
- condition: numeric_state
entity_id: sensor.shackinverter_aux_power
above: 2210
- service: script.v2l_charging_algorhythm
metadata: {}
data: {}