# ============================================================================== # REGULATION PI - SOLARFLOW 1 (sfp1) Intégration numérique temporelle (3s) # Si Auto, calcule l'action PI, gère le partage d'étendue (Charge/Décharge) # Fichier : /homeassistant/automations_sfp1.yaml # ELECTROPARTAGE 02-11-2026 # ============================================================================== - id: "1789647154276" alias: "SolarFlow 1 - Régulation PI Temps Réel" description: "Calcule l'action PI, gère le mode AC (Charge/Décharge) et transmet les consignes" trigger: - platform: time_pattern seconds: "/3" condition: - condition: state entity_id: input_select.sfp1_mode_regulation state: "Automatique" action: # 1. Calcul de la mémoire intégrale (I) avec conversion dt (3s / 60 = 0.05 min) - action: input_number.set_value target: entity_id: input_number.sfp1_integral_memory data: value: >- {% set current_i = states('input_number.sfp1_integral_memory') | float(0) %} {% set ecart = states('sensor.sfp1_ecart_regulation') | float(0) %} {% set deadzone = states('input_number.sfp1_deadzone') | float(15) %} {% set ki = states('input_number.sfp1_ki_rep_min') | float(0.1) %} {% set dt_sec = 3 %} {% set dt_min = dt_sec / 60.0 %} {% set max_power = states('input_number.sfp1_max_power') | float(2400) %} {% if ecart | abs <= deadzone %} {{ current_i }} {% else %} {% set new_i = current_i + (-1 * ki * ecart * dt_min) %} {{ [[new_i, -max_power] | max, max_power] | min | round(2) }} {% endif %} # 2. Pilotage partage d'étendue selon le signe de SS - choose: # CAS A : DÉCHARGE (SS > 0) - conditions: - condition: template value_template: "{{ states('sensor.sfp1_signal_sortie_ss') | float(0) > 0 }}" sequence: - if: - condition: template value_template: "{{ not is_state('select.solarflow_2400_ac_plus_p1_ac_mode', 'output') }}" then: - action: select.select_option target: entity_id: select.solarflow_2400_ac_plus_p1_ac_mode data: option: "output" - action: number.set_value target: entity_id: number.solarflow_2400_ac_plus_p1_input_limit data: value: 0 - action: number.set_value target: entity_id: number.solarflow_2400_ac_plus_p1_output_limit data: value: >- {% set ss = states('sensor.sfp1_signal_sortie_ss') | float(0) %} {% set max_power = states('input_number.sfp1_max_power') | float(2400) %} {{ [ss, max_power] | min | round(0) }} # CAS B : CHARGE (SS < 0) - conditions: - condition: template value_template: "{{ states('sensor.sfp1_signal_sortie_ss') | float(0) < 0 }}" sequence: - if: - condition: template value_template: "{{ not is_state('select.solarflow_2400_ac_plus_p1_ac_mode', 'input') }}" then: - action: select.select_option target: entity_id: select.solarflow_2400_ac_plus_p1_ac_mode data: option: "input" - action: number.set_value target: entity_id: number.solarflow_2400_ac_plus_p1_output_limit data: value: 0 - action: number.set_value target: entity_id: number.solarflow_2400_ac_plus_p1_input_limit data: value: >- {% set ss = states('sensor.sfp1_signal_sortie_ss') | float(0) %} {% set max_power = states('input_number.sfp1_max_power') | float(2400) %} {{ [(ss | abs), max_power] | min | round(0) }} # CAS C : NEUTRE / PAUSE (SS = 0) default: - action: number.set_value target: entity_id: number.solarflow_2400_ac_plus_p1_output_limit data: value: 0 - action: number.set_value target: entity_id: number.solarflow_2400_ac_plus_p1_input_limit data: value: 0 mode: single