Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save danielolsson100/a2eac19e8ed97447c3742f12814d1c3b to your computer and use it in GitHub Desktop.
Save danielolsson100/a2eac19e8ed97447c3742f12814d1c3b to your computer and use it in GitHub Desktop.

Revisions

  1. danielolsson100 revised this gist Jan 2, 2023. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions ferroamp_easee_grid_equlizer - automations.yaml
    Original file line number Diff line number Diff line change
    @@ -15,6 +15,9 @@ condition:
    - condition: state
    entity_id: sensor.easee_status
    state: charging
    - condition: state
    entity_id: sensor.easee_reason_for_no_current
    state: max_dynamic_circuit_current_too_low
    action:
    - if:
    - condition: and
    @@ -55,6 +58,9 @@ condition:
    - condition: state
    entity_id: sensor.easee_status
    state: charging
    - condition: state
    entity_id: sensor.easee_reason_for_no_current
    state: max_dynamic_circuit_current_too_low
    action:
    - service: easee.set_circuit_dynamic_limit
    data:
  2. danielolsson100 revised this gist Dec 28, 2022. 2 changed files with 63 additions and 106 deletions.
    63 changes: 63 additions & 0 deletions ferroamp_easee_grid_equlizer - automations.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,63 @@
    alias: Ferroamp > HA > Easee => Grid Equlizer
    description: ""
    trigger:
    - platform: state
    entity_id:
    - sensor.ferroamp_grid_current
    condition:
    - condition: and
    conditions:
    - condition: numeric_state
    entity_id: sensor.easee_dynamic_charger_limit
    above: 0
    - condition: or
    conditions:
    - condition: state
    entity_id: sensor.easee_status
    state: charging
    action:
    - if:
    - condition: and
    conditions:
    - condition: numeric_state
    entity_id: input_number.battery_sts_code
    above: 0
    below: 2
    - condition: numeric_state
    entity_id: sensor.ferroamp_esm_19440006_state_of_charge
    below: 90
    then:
    - service: easee.set_circuit_dynamic_limit
    data:
    device_id: b40f1f45d28b0891fe8d
    currentP1: >-
    {{((45 - states('sensor.ferroamp_grid_current')|float) / 3) |
    round(0,'floor') + states('sensor.easee_circuit_current')|int}}
    else:
    - service: easee.set_circuit_dynamic_limit
    data:
    device_id: b40f1f45d28b0891fe8d
    currentP1: >-
    {{((48 - states('sensor.ferroamp_grid_current')|float) / 3) |
    round(0,'floor') + states('sensor.easee_circuit_current')|int}}
    mode: single


    alias: Easee => Default charge level
    description: ""
    trigger:
    - platform: state
    entity_id:
    - sensor.easee_status
    condition:
    - condition: not
    conditions:
    - condition: state
    entity_id: sensor.easee_status
    state: charging
    action:
    - service: easee.set_circuit_dynamic_limit
    data:
    device_id: b40f1f45d28b0891fe8d
    currentP1: 10
    mode: single
    106 changes: 0 additions & 106 deletions ferroamp_easee_grid_equlizer.yaml
    Original file line number Diff line number Diff line change
    @@ -1,106 +0,0 @@
    blueprint:
    domain: automation
    name: Ferroamp + Easee => Grid Equlizer - v1.0.1
    description: This automation connects Ferroamp and Easee for Grid phase balancing
    when the charger is active. <br>You need to have both Ferroamp and Easee integrations
    up and running before you can use this blueprint.
    source_url: https://gist.github.com/danielolsson100/a2eac19e8ed97447c3742f12814d1c3b
    input:
    igridcurrent:
    name: Ferroamp Grid Current sensor
    description: 'By default: sensor.ferroamp_grid_current'
    selector:
    entity:
    domain: sensor
    device_class: current
    multiple: false
    default: sensor.ferroamp_grid_current
    ichargercircuitcurrent:
    name: Easee Charger Circuit current
    description: 'By default: sensor.<your easee name>_circuit_current'
    selector:
    entity:
    domain: sensor
    device_class: current
    multiple: false
    default: sensor.easee_circuit_current
    ichargerdynamiccircuitlimit:
    name: Easee Dynamic Circuit limit sensor
    description: 'By default: sensor.<your easee name>_dynamic_circuit_limit'
    selector:
    entity:
    domain: sensor
    device_class: current
    multiple: false
    default: sensor.easee_dynamic_circuit_limit
    ichargerstatus:
    name: Easee Charger Status sensor
    description: 'By default: sensor.<your easee name>_status'
    selector:
    entity:
    domain: sensor
    multiple: false
    default: sensor.easee_status
    trigger:
    - platform: state
    entity_id:
    - !input igridcurrent
    condition:
    - condition: state
    entity_id: !input ichargerstatus
    state: charging
    - condition: template
    value_template: '{{ ((state_attr(entChargerCircuitCurrent, ''state_circuitTotalPhaseConductorCurrentL1''))
    | int) != valCurrentAvailableForChargingL1 or ((state_attr(entChargerCircuitCurrent, ''state_circuitTotalPhaseConductorCurrentL2''))
    | int) != valCurrentAvailableForChargingL2 or ((state_attr(entChargerCircuitCurrent, ''state_circuitTotalPhaseConductorCurrentL3''))
    | int) != valCurrentAvailableForChargingL3 }}'
    action:
    - service: easee.set_circuit_dynamic_limit
    data:
    circuit_id: '{{ state_attr(entChargerStatus,''circuit_id'') }}'
    currentP1: '{{ valCurrentAvailableForChargingL1 }}'
    currentP2: '{{ valCurrentAvailableForChargingL2 }}'
    currentP3: '{{ valCurrentAvailableForChargingL3 }}'
    variables:
    entChargerDynamicCircuitLimit: !input ichargerdynamiccircuitlimit
    entGridCurrent: !input igridcurrent
    entChargerCircuitCurrent: !input ichargercircuitcurrent
    entChargerStatus: !input ichargerstatus
    valCurrentAvailableForChargingL1: '
    {% set easRatCur = state_attr(entChargerCircuitCurrent, ''circuit_ratedCurrent'')|float %}
    {% set easCirCurL1 = state_attr(entChargerCircuitCurrent, ''state_circuitTotalPhaseConductorCurrentL1'')|float %}
    {% set easDynCirCurL1 = state_attr(entChargerDynamicCircuitLimit, ''state_dynamicCircuitCurrentP1'')|float %}
    {% set faGridCurL1 = (state_attr(entGridCurrent, ''L1'')|float) * -1 %}
    {% set calcAvailCurL1 = easRatCur - faGridCurL1 + easCirCurL1 %}
    {% if calcAvailCurL1 < 6 %}
    {% set valCurrentAvailableForChargingL1 = 6 %}
    {% elif calcAvailCurL1 > 32 %}
    {% set calcAvailCurL1 = 32 %}
    {% endif %}
    {{calcAvailCurL1|int}}'
    valCurrentAvailableForChargingL2: '
    {% set easRatCur = state_attr(entChargerCircuitCurrent, ''circuit_ratedCurrent'')|float %}
    {% set easCirCurL2 = state_attr(entChargerCircuitCurrent, ''state_circuitTotalPhaseConductorCurrentL2'')|float %}
    {% set easDynCirCurL2 = state_attr(entChargerDynamicCircuitLimit, ''state_dynamicCircuitCurrentP2'')|float %}
    {% set faGridCurL2 = (state_attr(entGridCurrent, ''L2'')|float) * -1 %}
    {% set calcAvailCurL2 = easRatCur - faGridCurL2 + easCirCurL2 %}
    {% if calcAvailCurL2 < 6 %}
    {% set valCurrentAvailableForChargingL2 = 6 %}
    {% elif calcAvailCurL2 > 32 %}
    {% set calcAvailCurL2 = 32 %}
    {% endif %}
    {{calcAvailCurL2|int}}'
    valCurrentAvailableForChargingL3: '
    {% set easRatCur = state_attr(entChargerCircuitCurrent, ''circuit_ratedCurrent'')|float %}
    {% set easCirCurL3 = state_attr(entChargerCircuitCurrent, ''state_circuitTotalPhaseConductorCurrentL3'')|float %}
    {% set easDynCirCurL3 = state_attr(entChargerDynamicCircuitLimit, ''state_dynamicCircuitCurrentP3'')|float %}
    {% set faGridCurL3 = (state_attr(entGridCurrent, ''L3'')|float) * -1 %}
    {% set calcAvailCurL3 = easRatCur - faGridCurL3 + easCirCurL3 %}
    {% if calcAvailCurL3 < 6 %}
    {% set valCurrentAvailableForChargingL3 = 6 %}
    {% elif calcAvailCurL3 > 32 %}
    {% set calcAvailCurL3 = 32 %}
    {% endif %}
    {{calcAvailCurL3|int}}'
    mode: restart
    max_exceeded: silent
  3. danielolsson100 revised this gist Jul 19, 2022. 1 changed file with 50 additions and 47 deletions.
    97 changes: 50 additions & 47 deletions ferroamp_easee_grid_equlizer.yaml
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,9 @@
    blueprint:
    domain: automation
    name: Ferroamp + Easee => Grid Equlizer
    description: This automation connects Ferroamp and Easee for Grid phase balancing when the charger is active. <br>You
    need to have both Ferroamp and Easee integrations up and running before you can use this blueprint.
    name: Ferroamp + Easee => Grid Equlizer - v1.0.1
    description: This automation connects Ferroamp and Easee for Grid phase balancing
    when the charger is active. <br>You need to have both Ferroamp and Easee integrations
    up and running before you can use this blueprint.
    source_url: https://gist.github.com/danielolsson100/a2eac19e8ed97447c3742f12814d1c3b
    input:
    igridcurrent:
    @@ -14,15 +15,15 @@ blueprint:
    device_class: current
    multiple: false
    default: sensor.ferroamp_grid_current
    ichargercurrent:
    name: Easee Charger current
    description: 'By default: sensor.<your easee name>_current'
    ichargercircuitcurrent:
    name: Easee Charger Circuit current
    description: 'By default: sensor.<your easee name>_circuit_current'
    selector:
    entity:
    domain: sensor
    device_class: current
    multiple: false
    default: sensor.easee_current
    default: sensor.easee_circuit_current
    ichargerdynamiccircuitlimit:
    name: Easee Dynamic Circuit limit sensor
    description: 'By default: sensor.<your easee name>_dynamic_circuit_limit'
    @@ -49,55 +50,57 @@ condition:
    entity_id: !input ichargerstatus
    state: charging
    - condition: template
    value_template: '{{ ((state_attr(entChargerCurrent,state_circuitTotalPhaseConductorCurrentL1)) | int) != valCurrentAvailableForChargingL1
    or ((state_attr(entChargerCurrent,state_circuitTotalPhaseConductorCurrentL2)) | int) != valCurrentAvailableForChargingL2
    or ((state_attr(entChargerCurrent,state_circuitTotalPhaseConductorCurrentL3)) | int) != valCurrentAvailableForChargingL3 }}'
    value_template: '{{ ((state_attr(entChargerCircuitCurrent, ''state_circuitTotalPhaseConductorCurrentL1''))
    | int) != valCurrentAvailableForChargingL1 or ((state_attr(entChargerCircuitCurrent, ''state_circuitTotalPhaseConductorCurrentL2''))
    | int) != valCurrentAvailableForChargingL2 or ((state_attr(entChargerCircuitCurrent, ''state_circuitTotalPhaseConductorCurrentL3''))
    | int) != valCurrentAvailableForChargingL3 }}'
    action:
    - service: easee.set_circuit_dynamic_limit
    data:
    circuit_id: '{{ state_attr(entChargerStatus,''circuit_id'') }}'
    currentP1: '{{ valCurrentAvailableForChargingL1 }}'
    currentP2: '{{ valCurrentAvailableForChargingL2 }}'
    currentP3: '{{ valCurrentAvailableForChargingL3 }}'
    currentP3: '{{ valCurrentAvailableForChargingL3 }}'
    variables:
    entChargerDynamicCircuitLimit: !input ichargerdynamiccircuitlimit
    entGridCurrent: !input igridcurrent
    entChargerCurrent: !input ichargercurrent
    entChargerCircuitCurrent: !input ichargercircuitcurrent
    entChargerStatus: !input ichargerstatus
    valCurrentAvailableForCharging: '
    {% set mainFuse = 16 %}
    {% set fuseSaftyLimit = 0 %}
    {% set easMinChargeLimit = 6 %}
    {% set easMaxChargeLimit = 32 %}
    {% set easCirCurL1 = (state_attr(entChargerCurrent,state_circuitTotalPhaseConductorCurrentL1)) | round(1) %}
    {% set easCirCurL2 = (state_attr(entChargerCurrent,state_circuitTotalPhaseConductorCurrentL2)) | round(1) %}
    {% set easCirCurL3 = (state_attr(entChargerCurrent,state_circuitTotalPhaseConductorCurrentL3)) | round(1) %}
    {% set easDynCirCurL1 = (state_attr(entChargerDynamicCircuitLimit,state_dynamicCircuitCurrentP1)) | round(1) %}
    {% set easDynCirCurL2 = (state_attr(entChargerDynamicCircuitLimit,state_dynamicCircuitCurrentP2)) | round(1) %}
    {% set easDynCirCurL3 = (state_attr(entChargerDynamicCircuitLimit,state_dynamicCircuitCurrentP3)) | round(1) %}
    {% set faGridCurL1 = (state_attr(entGridCurrent,L1) * -1 ) | round(1) %}
    {% set faGridCurL2 = (state_attr(entGridCurrent,L2) * -1 ) | round(1) %}
    {% set faGridCurL3 = (state_attr(entGridCurrent,L3) * -1 ) | round(1) %}
    {{ valCurrentAvailableForChargingL1 = (mainFuse - faGridCurP1 + easCirCurP1 - fuseSaftyLimit) | int }}
    {{ valCurrentAvailableForChargingL2 = (mainFuse - faGridCurP2 + easCirCurP2 - fuseSaftyLimit) | int }}
    {{ valCurrentAvailableForChargingL3 = (mainFuse - faGridCurP3 + easCirCurP3 - fuseSaftyLimit) | int }}
    {% if valCurrentAvailableForChargingL1 < easMinChargeLimit %}
    {% set valCurrentAvailableForChargingL1 = easMinChargeLimit %}
    {% elif valCurrentAvailableForChargingL1 > easMaxChargeLimit%}
    {% set valCurrentAvailableForChargingL1 = easMaxChargeLimit %}
    {% endif %}
    {% if valCurrentAvailableForChargingL2 < easMinChargeLimit %}
    {% set valCurrentAvailableForChargingL2 = easMinChargeLimit %}
    {% elif valCurrentAvailableForChargingL2 > easMaxChargeLimit%}
    {% set valCurrentAvailableForChargingL2 = easMaxChargeLimit %}
    {% endif %}
    {% if valCurrentAvailableForChargingL3 < easMinChargeLimit %}
    {% set valCurrentAvailableForChargingL3 = easMinChargeLimit %}
    {% elif valCurrentAvailableForChargingL3 > easMaxChargeLimit%}
    {% set valCurrentAvailableForChargingL3 = easMaxChargeLimit %}
    {% endif %}'
    valCurrentAvailableForChargingL1: '
    {% set easRatCur = state_attr(entChargerCircuitCurrent, ''circuit_ratedCurrent'')|float %}
    {% set easCirCurL1 = state_attr(entChargerCircuitCurrent, ''state_circuitTotalPhaseConductorCurrentL1'')|float %}
    {% set easDynCirCurL1 = state_attr(entChargerDynamicCircuitLimit, ''state_dynamicCircuitCurrentP1'')|float %}
    {% set faGridCurL1 = (state_attr(entGridCurrent, ''L1'')|float) * -1 %}
    {% set calcAvailCurL1 = easRatCur - faGridCurL1 + easCirCurL1 %}
    {% if calcAvailCurL1 < 6 %}
    {% set valCurrentAvailableForChargingL1 = 6 %}
    {% elif calcAvailCurL1 > 32 %}
    {% set calcAvailCurL1 = 32 %}
    {% endif %}
    {{calcAvailCurL1|int}}'
    valCurrentAvailableForChargingL2: '
    {% set easRatCur = state_attr(entChargerCircuitCurrent, ''circuit_ratedCurrent'')|float %}
    {% set easCirCurL2 = state_attr(entChargerCircuitCurrent, ''state_circuitTotalPhaseConductorCurrentL2'')|float %}
    {% set easDynCirCurL2 = state_attr(entChargerDynamicCircuitLimit, ''state_dynamicCircuitCurrentP2'')|float %}
    {% set faGridCurL2 = (state_attr(entGridCurrent, ''L2'')|float) * -1 %}
    {% set calcAvailCurL2 = easRatCur - faGridCurL2 + easCirCurL2 %}
    {% if calcAvailCurL2 < 6 %}
    {% set valCurrentAvailableForChargingL2 = 6 %}
    {% elif calcAvailCurL2 > 32 %}
    {% set calcAvailCurL2 = 32 %}
    {% endif %}
    {{calcAvailCurL2|int}}'
    valCurrentAvailableForChargingL3: '
    {% set easRatCur = state_attr(entChargerCircuitCurrent, ''circuit_ratedCurrent'')|float %}
    {% set easCirCurL3 = state_attr(entChargerCircuitCurrent, ''state_circuitTotalPhaseConductorCurrentL3'')|float %}
    {% set easDynCirCurL3 = state_attr(entChargerDynamicCircuitLimit, ''state_dynamicCircuitCurrentP3'')|float %}
    {% set faGridCurL3 = (state_attr(entGridCurrent, ''L3'')|float) * -1 %}
    {% set calcAvailCurL3 = easRatCur - faGridCurL3 + easCirCurL3 %}
    {% if calcAvailCurL3 < 6 %}
    {% set valCurrentAvailableForChargingL3 = 6 %}
    {% elif calcAvailCurL3 > 32 %}
    {% set calcAvailCurL3 = 32 %}
    {% endif %}
    {{calcAvailCurL3|int}}'
    mode: restart
    max_exceeded: silent
  4. danielolsson100 revised this gist Jul 18, 2022. No changes.
  5. danielolsson100 revised this gist Jul 18, 2022. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions ferroamp_easee_grid_equlizer.yaml
    Original file line number Diff line number Diff line change
    @@ -16,7 +16,7 @@ blueprint:
    default: sensor.ferroamp_grid_current
    ichargercurrent:
    name: Easee Charger current
    description: 'By default (A): sensor.<your easee name>_current'
    description: 'By default: sensor.<your easee name>_current'
    selector:
    entity:
    domain: sensor
    @@ -100,4 +100,4 @@ variables:
    {% set valCurrentAvailableForChargingL3 = easMaxChargeLimit %}
    {% endif %}'
    mode: restart
    max_exceeded: silent
    max_exceeded: silent
  6. danielolsson100 revised this gist Jul 18, 2022. 1 changed file with 66 additions and 111 deletions.
    177 changes: 66 additions & 111 deletions ferroamp_easee_grid_equlizer.yaml
    Original file line number Diff line number Diff line change
    @@ -1,148 +1,103 @@
    blueprint:
    domain: automation
    name: Ferroamp + Easee Grid Equlizer
    description: This automation connects Ferroamp and Easee for Grid balancing.
    <br><br>You need to have both Ferroamp and Easee integration up and running through
    HACS. See readme.
    name: Ferroamp + Easee => Grid Equlizer
    description: This automation connects Ferroamp and Easee for Grid phase balancing when the charger is active. <br>You
    need to have both Ferroamp and Easee integrations up and running before you can use this blueprint.
    source_url: https://gist.github.com/danielolsson100/a2eac19e8ed97447c3742f12814d1c3b
    input:
    isolarpower:
    name: Ferroamp Solar power sensor
    description: 'By default: sensor.ferroamp_solar_power'
    igridcurrent:
    name: Ferroamp Grid Current sensor
    description: 'By default: sensor.ferroamp_grid_current'
    selector:
    entity:
    domain: sensor
    device_class: power
    multiple: false
    default: sensor.ferroamp_solar_power
    iconsumptionpower:
    name: Ferroamp Consumption power sensor
    description: 'By default: sensor.ferroamp_consumption_power'
    selector:
    entity:
    domain: sensor
    device_class: power
    multiple: false
    default: sensor.ferroamp_consumption_power
    ibatterysoc:
    name: Ferroamp HOME battery state of charge sensor
    description: 'By default: sensor.ferroamp_system_state_of_charge'
    selector:
    entity:
    domain: sensor
    device_class: battery
    multiple: false
    default: sensor.ferroamp_system_state_of_charge
    iexternalvoltage:
    name: Ferroamp External voltage sensor
    description: 'By default: sensor.ferroamp_external_voltage'
    selector:
    entity:
    domain: sensor
    device_class: voltage
    device_class: current
    multiple: false
    default: sensor.ferroamp_external_voltage
    ichargerpower:
    name: Easee charging power sensor
    description: 'By default (kW): sensor.<your easee name>_power'
    default: sensor.ferroamp_grid_current
    ichargercurrent:
    name: Easee Charger current
    description: 'By default (A): sensor.<your easee name>_current'
    selector:
    entity:
    domain: sensor
    device_class: power
    device_class: current
    multiple: false
    ichargerdynamiclimit:
    name: Easee Charger Dynamic limit sensor
    description: 'By default: sensor.<your easee name>_dynamic_charger_limit'
    default: sensor.easee_current
    ichargerdynamiccircuitlimit:
    name: Easee Dynamic Circuit limit sensor
    description: 'By default: sensor.<your easee name>_dynamic_circuit_limit'
    selector:
    entity:
    domain: sensor
    device_class: current
    multiple: false
    default: sensor.easee_dynamic_circuit_limit
    ichargerstatus:
    name: Easee Charger Status sensor
    description: 'By default: sensor.<your easee name>_status'
    selector:
    entity:
    domain: sensor
    multiple: false
    iminbatterylevel:
    name: 'Boost charging with homebattery if SoC is above:'
    description: Boost charging with home battery power if home battery SoC is above
    this limit.
    selector:
    number:
    min: 0.0
    max: 100.0
    step: 1.0
    unit_of_measurement: '%'
    mode: slider
    default: 20
    ibatteryboostpower:
    name: Maximum homebattery discharge capacity
    description: Set your home battery maximum discharge power.
    selector:
    number:
    unit_of_measurement: W
    mode: box
    step: 1.0
    default: 5000
    itimestart:
    name: Activate time
    description: Set the time you want the load balancing to activate. This is important
    to avoid low charging currents during nighttime.
    default: 08:00:00
    selector:
    time: {}
    itimeend:
    name: Deactivate time
    description: Set the time you want the load balancing to deactivate. This is
    important to avoid low charging currents during nighttime.
    default: '22:00:00'
    selector:
    time: {}
    default: sensor.easee_status
    trigger:
    - platform: state
    entity_id:
    - !input isolarpower
    - !input igridcurrent
    condition:
    - condition: state
    entity_id: !input ichargerstatus
    state: charging
    - condition: template
    value_template: '{{ (states(entChargerDynamicLimit)|int) != valCurrentAvailableForCharging
    }}'
    - condition: time
    after: !input itimestart
    before: !input itimeend
    value_template: '{{ ((state_attr(entChargerCurrent,state_circuitTotalPhaseConductorCurrentL1)) | int) != valCurrentAvailableForChargingL1
    or ((state_attr(entChargerCurrent,state_circuitTotalPhaseConductorCurrentL2)) | int) != valCurrentAvailableForChargingL2
    or ((state_attr(entChargerCurrent,state_circuitTotalPhaseConductorCurrentL3)) | int) != valCurrentAvailableForChargingL3 }}'
    action:
    - service: easee.set_charger_dynamic_limit
    - service: easee.set_circuit_dynamic_limit
    data:
    charger_id: '{{ state_attr(entChargerStatus,''id'') }}
    '
    current: '{{ valCurrentAvailableForCharging }}
    '
    circuit_id: '{{ state_attr(entChargerStatus,''circuit_id'') }}'
    currentP1: '{{ valCurrentAvailableForChargingL1 }}'
    currentP2: '{{ valCurrentAvailableForChargingL2 }}'
    currentP3: '{{ valCurrentAvailableForChargingL3 }}'
    variables:
    entChargerDynamicLimit: !input ichargerdynamiclimit
    entSolarPower: !input isolarpower
    entConsumptionPower: !input iconsumptionpower
    entBatterySOC: !input ibatterysoc
    entBatteryMinSoC: !input iminbatterylevel
    entBatteryBoostPower: !input ibatteryboostpower
    entChargingPower: !input ichargerpower
    entExternalVoltage: !input iexternalvoltage
    entChargerDynamicCircuitLimit: !input ichargerdynamiccircuitlimit
    entGridCurrent: !input igridcurrent
    entChargerCurrent: !input ichargercurrent
    entChargerStatus: !input ichargerstatus
    valExternalVoltage: '{% if state_attr(entChargerStatus, ''config_phaseMode'') ==
    1 %} {{ states(entExternalVoltage)|float / 3 }} {% else %} {{ states(entExternalVoltage)|float
    }} {% endif %}'
    valCurrentAvailableForCharging: '{% set powerAvailable = (states(entSolarPower)|float
    - states(entConsumptionPower)|float + (states(entChargingPower)|float * 1000))|int
    %} {% if states(entBatterySOC)|float >= entBatteryMinSoC|float %} {% set powerAvailable
    = powerAvailable + entBatteryBoostPower|float %} {% endif %} {% set EaseeAvailableCurrent
    = (powerAvailable / valExternalVoltage) | float %} {% if EaseeAvailableCurrent
    < 6 %} {% set EaseeAvailableCurrent = 6 %} {% elif EaseeAvailableCurrent > 32
    %} {% set EaseeAvailableCurrent = 32 %} {% endif %} {{ EaseeAvailableCurrent|int
    }}'
    valCurrentAvailableForCharging: '
    {% set mainFuse = 16 %}
    {% set fuseSaftyLimit = 0 %}
    {% set easMinChargeLimit = 6 %}
    {% set easMaxChargeLimit = 32 %}
    {% set easCirCurL1 = (state_attr(entChargerCurrent,state_circuitTotalPhaseConductorCurrentL1)) | round(1) %}
    {% set easCirCurL2 = (state_attr(entChargerCurrent,state_circuitTotalPhaseConductorCurrentL2)) | round(1) %}
    {% set easCirCurL3 = (state_attr(entChargerCurrent,state_circuitTotalPhaseConductorCurrentL3)) | round(1) %}
    {% set easDynCirCurL1 = (state_attr(entChargerDynamicCircuitLimit,state_dynamicCircuitCurrentP1)) | round(1) %}
    {% set easDynCirCurL2 = (state_attr(entChargerDynamicCircuitLimit,state_dynamicCircuitCurrentP2)) | round(1) %}
    {% set easDynCirCurL3 = (state_attr(entChargerDynamicCircuitLimit,state_dynamicCircuitCurrentP3)) | round(1) %}
    {% set faGridCurL1 = (state_attr(entGridCurrent,L1) * -1 ) | round(1) %}
    {% set faGridCurL2 = (state_attr(entGridCurrent,L2) * -1 ) | round(1) %}
    {% set faGridCurL3 = (state_attr(entGridCurrent,L3) * -1 ) | round(1) %}
    {{ valCurrentAvailableForChargingL1 = (mainFuse - faGridCurP1 + easCirCurP1 - fuseSaftyLimit) | int }}
    {{ valCurrentAvailableForChargingL2 = (mainFuse - faGridCurP2 + easCirCurP2 - fuseSaftyLimit) | int }}
    {{ valCurrentAvailableForChargingL3 = (mainFuse - faGridCurP3 + easCirCurP3 - fuseSaftyLimit) | int }}
    {% if valCurrentAvailableForChargingL1 < easMinChargeLimit %}
    {% set valCurrentAvailableForChargingL1 = easMinChargeLimit %}
    {% elif valCurrentAvailableForChargingL1 > easMaxChargeLimit%}
    {% set valCurrentAvailableForChargingL1 = easMaxChargeLimit %}
    {% endif %}
    {% if valCurrentAvailableForChargingL2 < easMinChargeLimit %}
    {% set valCurrentAvailableForChargingL2 = easMinChargeLimit %}
    {% elif valCurrentAvailableForChargingL2 > easMaxChargeLimit%}
    {% set valCurrentAvailableForChargingL2 = easMaxChargeLimit %}
    {% endif %}
    {% if valCurrentAvailableForChargingL3 < easMinChargeLimit %}
    {% set valCurrentAvailableForChargingL3 = easMinChargeLimit %}
    {% elif valCurrentAvailableForChargingL3 > easMaxChargeLimit%}
    {% set valCurrentAvailableForChargingL3 = easMaxChargeLimit %}
    {% endif %}'
    mode: restart
    max_exceeded: silent
    max_exceeded: silent
  7. danielolsson100 revised this gist Jul 18, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ferroamp_easee_grid_equlizer.yaml
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@ blueprint:
    description: This automation connects Ferroamp and Easee for Grid balancing.
    <br><br>You need to have both Ferroamp and Easee integration up and running through
    HACS. See readme.
    source_url: https://gist.github.com/danielolsson100/a2eac19e8ed97447c3742f12814d1c3b/ferroamp_easee_grid_equlizer.yaml
    source_url: https://gist.github.com/danielolsson100/a2eac19e8ed97447c3742f12814d1c3b
    input:
    isolarpower:
    name: Ferroamp Solar power sensor
  8. danielolsson100 revised this gist Jul 18, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ferroamp_easee_grid_equlizer.yaml
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@ blueprint:
    description: This automation connects Ferroamp and Easee for Grid balancing.
    <br><br>You need to have both Ferroamp and Easee integration up and running through
    HACS. See readme.
    source_url: https://gist.github.com/danielolsson100/ferroamp_easee_grid_equlizer/ferroamp_easee_grid_equlizer.yaml
    source_url: https://gist.github.com/danielolsson100/a2eac19e8ed97447c3742f12814d1c3b/ferroamp_easee_grid_equlizer.yaml
    input:
    isolarpower:
    name: Ferroamp Solar power sensor
  9. danielolsson100 created this gist Jul 18, 2022.
    148 changes: 148 additions & 0 deletions ferroamp_easee_grid_equlizer.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,148 @@
    blueprint:
    domain: automation
    name: Ferroamp + Easee Grid Equlizer
    description: This automation connects Ferroamp and Easee for Grid balancing.
    <br><br>You need to have both Ferroamp and Easee integration up and running through
    HACS. See readme.
    source_url: https://gist.github.com/danielolsson100/ferroamp_easee_grid_equlizer/ferroamp_easee_grid_equlizer.yaml
    input:
    isolarpower:
    name: Ferroamp Solar power sensor
    description: 'By default: sensor.ferroamp_solar_power'
    selector:
    entity:
    domain: sensor
    device_class: power
    multiple: false
    default: sensor.ferroamp_solar_power
    iconsumptionpower:
    name: Ferroamp Consumption power sensor
    description: 'By default: sensor.ferroamp_consumption_power'
    selector:
    entity:
    domain: sensor
    device_class: power
    multiple: false
    default: sensor.ferroamp_consumption_power
    ibatterysoc:
    name: Ferroamp HOME battery state of charge sensor
    description: 'By default: sensor.ferroamp_system_state_of_charge'
    selector:
    entity:
    domain: sensor
    device_class: battery
    multiple: false
    default: sensor.ferroamp_system_state_of_charge
    iexternalvoltage:
    name: Ferroamp External voltage sensor
    description: 'By default: sensor.ferroamp_external_voltage'
    selector:
    entity:
    domain: sensor
    device_class: voltage
    multiple: false
    default: sensor.ferroamp_external_voltage
    ichargerpower:
    name: Easee charging power sensor
    description: 'By default (kW): sensor.<your easee name>_power'
    selector:
    entity:
    domain: sensor
    device_class: power
    multiple: false
    ichargerdynamiclimit:
    name: Easee Charger Dynamic limit sensor
    description: 'By default: sensor.<your easee name>_dynamic_charger_limit'
    selector:
    entity:
    domain: sensor
    device_class: current
    multiple: false
    ichargerstatus:
    name: Easee Charger Status sensor
    description: 'By default: sensor.<your easee name>_status'
    selector:
    entity:
    domain: sensor
    multiple: false
    iminbatterylevel:
    name: 'Boost charging with homebattery if SoC is above:'
    description: Boost charging with home battery power if home battery SoC is above
    this limit.
    selector:
    number:
    min: 0.0
    max: 100.0
    step: 1.0
    unit_of_measurement: '%'
    mode: slider
    default: 20
    ibatteryboostpower:
    name: Maximum homebattery discharge capacity
    description: Set your home battery maximum discharge power.
    selector:
    number:
    unit_of_measurement: W
    mode: box
    step: 1.0
    default: 5000
    itimestart:
    name: Activate time
    description: Set the time you want the load balancing to activate. This is important
    to avoid low charging currents during nighttime.
    default: 08:00:00
    selector:
    time: {}
    itimeend:
    name: Deactivate time
    description: Set the time you want the load balancing to deactivate. This is
    important to avoid low charging currents during nighttime.
    default: '22:00:00'
    selector:
    time: {}
    trigger:
    - platform: state
    entity_id:
    - !input isolarpower
    condition:
    - condition: state
    entity_id: !input ichargerstatus
    state: charging
    - condition: template
    value_template: '{{ (states(entChargerDynamicLimit)|int) != valCurrentAvailableForCharging
    }}'
    - condition: time
    after: !input itimestart
    before: !input itimeend
    action:
    - service: easee.set_charger_dynamic_limit
    data:
    charger_id: '{{ state_attr(entChargerStatus,''id'') }}
    '
    current: '{{ valCurrentAvailableForCharging }}
    '
    variables:
    entChargerDynamicLimit: !input ichargerdynamiclimit
    entSolarPower: !input isolarpower
    entConsumptionPower: !input iconsumptionpower
    entBatterySOC: !input ibatterysoc
    entBatteryMinSoC: !input iminbatterylevel
    entBatteryBoostPower: !input ibatteryboostpower
    entChargingPower: !input ichargerpower
    entExternalVoltage: !input iexternalvoltage
    entChargerStatus: !input ichargerstatus
    valExternalVoltage: '{% if state_attr(entChargerStatus, ''config_phaseMode'') ==
    1 %} {{ states(entExternalVoltage)|float / 3 }} {% else %} {{ states(entExternalVoltage)|float
    }} {% endif %}'
    valCurrentAvailableForCharging: '{% set powerAvailable = (states(entSolarPower)|float
    - states(entConsumptionPower)|float + (states(entChargingPower)|float * 1000))|int
    %} {% if states(entBatterySOC)|float >= entBatteryMinSoC|float %} {% set powerAvailable
    = powerAvailable + entBatteryBoostPower|float %} {% endif %} {% set EaseeAvailableCurrent
    = (powerAvailable / valExternalVoltage) | float %} {% if EaseeAvailableCurrent
    < 6 %} {% set EaseeAvailableCurrent = 6 %} {% elif EaseeAvailableCurrent > 32
    %} {% set EaseeAvailableCurrent = 32 %} {% endif %} {{ EaseeAvailableCurrent|int
    }}'
    mode: restart
    max_exceeded: silent