Skip to content

Commit

Permalink
Added check for max charge rate.
Browse files Browse the repository at this point in the history
Update #94
  • Loading branch information
dannytsang committed Aug 22, 2023
1 parent 92ca4d2 commit e90a134
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions custom_templates/calculate_ecoflow_delta2_charge_rate.jinja
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Created by Danny Tsang <danny@tsang.uk>
{% macro calculate_ecoflow_delta2_charge_rate(excess_amount, increment_amount) %}
{{ ((states('sensor.ecoflow_kitchen_solar_excess')|float(0) / increment_amount)|int(0)) * increment_amount }}
{% macro calculate_ecoflow_delta2_charge_rate(excess_amount, increment_amount, max_charge_rate) %}
{% set charge_rate = ((states('sensor.ecoflow_kitchen_solar_excess')|float(0) / increment_amount)|int(0)) * increment_amount %}
{{ iif(charge_rate > max_charge_rate, max_charge_rate, charge_rate) }}
{% endmacro %}

0 comments on commit e90a134

Please sign in to comment.