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.
Ferroamp and Easee
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/a2eac19e8ed97447c3742f12814d1c3b/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
@danielolsson100
Copy link
Author

This requires HomeAssistant custom integrations for Ferroamp / Easee to load balance the max available current to the Easee charger every 30s without the use if Tibber pulse / Equlizer / Watty etc for a more optimized charging experience for your home.

Add these 2 automations above as separate automations
I use the entity "input_number.battery_sts_code" and set it to 1 when I charge the Ferroamp battery as a status flag.
I limit the max current to 45A (16A*3 as my normal max) If the Ferroamp battery is charging with 2000W to allow the house battery to change at the same time during charging of my Eletric car.
And when the Ferroamp battery charging is finished then I release all available current to the Easee charger.
You can find your "device_id" value by accessing http://homeassistant.local:8123/developer-tools/service
Type in the Service "Easee EV Charger: Set charging cost"
and add your charger using the GUI and then look into the created yaml code to see your device_id for your Easee charger.

The second automations set the Easee charger to a charge level that is safe, in my case 10A as a precaution if the HA isn't online the next time the charger starts to minimize the risk of a burned burn fuse.

My Ferroamp system has ACE set to 15A to balance the phases the last current even to the phases because my Kia EV6 don't seems to like different currents on the phases when charging.

As always. Use this code at your own risk and don't blame me if things go bad :)

@Fladric
Copy link

Fladric commented Apr 5, 2023

Thanks alot, using it with Ferroamp and Easee. I used the power for one of my ESO:s to control if the battery is charging, set it to be above 200 W of charging before lowering the charge amp to the Easee box.
Works good so far!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment