Complex automation PV string

I am currently downgrading my Electricity Contract (from 3x50amp to 3x35amp). I once upgraded to add additional solar panels and a inverter. But the difference in price between 3 x 35Aand 3x 50A is around 900 euro yearly and with current prices for delivering back it is no longer interesting. But I don’t want to disable the inverter, it is still valuable on days and times with less sun. As long as none of my phases go over 35A it is ok that the inverter is on.
So I added relays between all my PV strings (6) that I can switch on/off using HA. So the idea is that when I reach on one of the phases 34kWh, I switch off a string (or 2 or 3) and switch them on (one by one) when I get below 31 kWh. But automating this turns out to be a challenge. So I have this:


My biggest concern is that I don’t know (yet) how fast the Current will go down and if it is possible that for example automation 1 (1 string Off) triggers and a few seconds later automation 2, that switches off the second string. I think I really would like to see some condition that one of my automation cannot be triggered if one of the other automations were triggered in the last minute. Any ideas? Is this possible with a template sensor that can be switched ‘on’, and that has an automation that switches it off. So I can add the off of this sensor as a condition?

To create the automation for managing PV strings and avoiding the 35A limit, you can use the following approach in Home Assistant:

  1. Template Sensor: Monitor the current amperage on each phase.
  2. Automation Trigger: Use a numeric state trigger to detect when any phase exceeds 35A.
  3. Cooldown Mechanism: Implement an input_boolean as a cooldown to prevent multiple triggers in quick succession.
  4. Action: Switch off the appropriate PV string based on the current state.

Here’s an example of how this could be structured:

Template Sensor

yaml

template:
  - sensor:
      - name: "Phase A Amperage"
        state: "{{ states('sensor.phase_a_amperage') }}"
      - name: "Phase B Amperage"
        state: "{{ states('sensor.phase_b_amperage') }}"
      - name: "Phase C Amperage"
        state: "{{ states('sensor.phase_c_amperage') }}"

Automation Trigger with Cooldown

yaml

input_boolean:
  cooldown_active:
    name: Cooldown Active

automation:
  - alias: "PV String Management"
    trigger:
      - platform: numeric_state
        entity_id: 
          - sensor.phase_a_amperage
          - sensor.phase_b_amperage
          - sensor.phase_c_amperage
        above: 35
    condition:
      - condition: state
        entity_id: input_boolean.cooldown_active
        state: "off"
    action:
      - service: switch.turn_off
        target:
          entity_id: switch.pv_string
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.cooldown_active
      - delay: "00:05:00" # Cooldown period of 5 minutes
      - service: input_boolean.turn_off
        target:
          entity_id: input_boolean.cooldown_active

Explanation:

  • Template Sensor: Monitors the amperage on each phase.
  • Automation: Triggers when any phase exceeds 35A and the cooldown isn’t active.
  • Cooldown Mechanism: Prevents the automation from triggering again for 5 minutes.

Thanks, I implemented what you suggested. Unfortunately it does not work yet.
It looks like the triggers dont work:


If I test all conditions, they all pass.

So somehow the triggers dont work.

image



But I have no idea why not, - 35.502 is below -34.5 as far as I know.