alias: auto charging regulation dynamic load
description: Tests changes in charging current based on simple logic.
trigger:
- platform: state
entity_id:- sensor.ss_inverter_power
- sensor.ss_grid_power
condition:
action:
- variables:
inverter_power: “{{ states(‘sensor.ss_inverter_power’) | int }}”
grid_power: “{{ states(‘sensor.ss_grid_power’) | int }}”
total_consumption: “{{ inverter_power + grid_power }}”
max_inverter_power: 11300
charge_current: >-
{{
states(‘number.wallbox_pulsarplus_sn_651522_maximum_charging_current’) |
int }}
charger_consumption: “{{ charge_current * 230 * 3 }}”
actual_free_power: “{{ max_inverter_power - (total_consumption - charger_consumption) }}” - service: logbook.log
data:
name: EV Script Test
message: >-
Total house consumption: {{ total_consumption }} W, Available power: {{
actual_free_power }} W - service: number.set_value
target:
entity_id: number.wallbox_pulsarplus_sn_651522_maximum_charging_current
data:
value: |-
{% if actual_free_power >= 9800 %}
13
{% elif actual_free_power >= 8500 %}
12
{% elif actual_free_power >= 8200 %}
11
{% elif actual_free_power >= 7200 %}
10
{% elif actual_free_power >= 6500 %}
9
{% elif actual_free_power >= 5700 %}
8
{% elif actual_free_power >= 4940 %}
7
{% elif actual_free_power >= 4140 %}
6
{% else %}
0
{% endif %} - service: logbook.log
data:
name: EV Script Test
message: >-
Set charging current: {{
states(‘number.wallbox_pulsarplus_sn_651522_maximum_charging_current’)
}}A
mode: single
i have used this script and it manages charging current based on house consumption . I have entered inverter power in script 11300w becuase sometimes it goes to 12000w so like this i am protecting inverter which supports output 13000w . Script works fine for me you can check out my video on youtube after i installed charger i have recorded how it works you need to replace ss inverter power with your sensor that measures whole house consumption or load and sensor ss grid power with sensor that measures power pulled from the grid . here is link to video https://www.youtube.com/watch?v=y9PxtfvAyVc