adds template sources
This commit is contained in:
7
helpers/sensor.estimated_charge_percent_today.jinja
Normal file
7
helpers/sensor.estimated_charge_percent_today.jinja
Normal file
@@ -0,0 +1,7 @@
|
||||
{% set totalWh = 3200 %}
|
||||
{% set currentChargePercent = states('sensor.system_flos_bkw_sb_state_of_charge') | float(0) %}
|
||||
|
||||
{% set todayProductionWh = (states('sensor.balkon_solcast_pv_forecast_balkonsolar_forecast_remaining_today') | float(0)) * 1000 %}
|
||||
{% set estimatedProductionPercent = 100 * (todayProductionWh / totalWh) %}
|
||||
|
||||
{{ (currentChargePercent + estimatedProductionPercent) | round(2) }}
|
||||
11
helpers/sensor.estimated_charge_percent_tomorrow.jinja
Normal file
11
helpers/sensor.estimated_charge_percent_tomorrow.jinja
Normal file
@@ -0,0 +1,11 @@
|
||||
{% set totalWh = 3200 %}
|
||||
|
||||
{% set estimatedChargePercentToday = states("sensor.estimated_charge_percent_today") | float(0) %}
|
||||
|
||||
{% set avgConsumptionWh = states("sensor.energy_from_battery_7_days_average") | float(0) %}
|
||||
{% set avgConsumptionPercent = 100 * (avgConsumptionWh / totalWh) %}
|
||||
|
||||
{% set tomorrowProductionWh = (states('sensor.balkon_solcast_pv_forecast_balkonsolar_forecast_tomorrow') | float(0)) * 1000 %}
|
||||
{% set estimatedProductionPercentTomorrow = 100 * (tomorrowProductionWh / totalWh) %}
|
||||
|
||||
{{ (estimatedChargePercentToday - avgConsumptionPercent + estimatedProductionPercentTomorrow) | round(2) }}
|
||||
29
helpers/sensor.estimated_optimal_output_limit.jinja
Normal file
29
helpers/sensor.estimated_optimal_output_limit.jinja
Normal file
@@ -0,0 +1,29 @@
|
||||
{# Configuration #}
|
||||
{% set totalWh = 3200 %}
|
||||
{% set maxPower = 600 %}
|
||||
{% set targetChargePercent = 100 %}
|
||||
{% set sunsetOffset = -3 %}
|
||||
|
||||
{% set currentChargePercent = states('sensor.system_flos_bkw_sb_state_of_charge') | float(0) %}
|
||||
{% set solarAvailable = states('binary_sensor.solar_power_available') | bool(false) %}
|
||||
|
||||
{% if solarAvailable and currentChargePercent < 100 %}
|
||||
{# Current state infos #}
|
||||
{% set timeToSunsetHours = ((as_timestamp(state_attr('sun.sun', 'next_setting')) - as_timestamp(now()))) / 3600 + sunsetOffset %}
|
||||
|
||||
{# Average battery power for the day to reach targetChargePercent #}
|
||||
{% set remainingChargePercent = [ 0, targetChargePercent - currentChargePercent ] | max %}
|
||||
{% set remainingChargeWh = (remainingChargePercent / 100) * totalWh %}
|
||||
{% set remainingAvgPower = (remainingChargeWh / timeToSunsetHours) %}
|
||||
|
||||
{# Today average production power #}
|
||||
{% set todayProductionWh = (states('sensor.balkon_solcast_pv_forecast_balkonsolar_forecast_remaining_today') | float(0)) * 1000 %}
|
||||
{% set todayOffsetWh = todayProductionWh - remainingChargeWh %}
|
||||
{% set todayOffsetPower = todayOffsetWh / timeToSunsetHours %}
|
||||
{% set positiveOffsetPower = [ 0, todayOffsetPower ] | max %}
|
||||
{% set limitedOffsetPower = [ maxPower, positiveOffsetPower ] | min %}
|
||||
|
||||
{{ limitedOffsetPower | round(0) }}
|
||||
{% else %}
|
||||
{{ 0 }}
|
||||
{% endif %}
|
||||
25
helpers/sensor.power_output_dynamic.jinja
Normal file
25
helpers/sensor.power_output_dynamic.jinja
Normal file
@@ -0,0 +1,25 @@
|
||||
{% set batFullToday = states("sensor.estimated_charge_percent_today") | float(0) >= 100 %}
|
||||
{% set batFullTomorrow = states("sensor.estimated_charge_percent_today") | float(0) >= 100 %}
|
||||
|
||||
{% set techTemp = states("sensor.klima_balkonsolar_temperature") | float(0) %}
|
||||
{% set techTempThr = 35 %}
|
||||
{% set safePowerLimit = 401 %}
|
||||
|
||||
{% set powerUsageMin = states("sensor.power_usage_min_fault_tolerant") | float(0) %}
|
||||
{% set powerUsageMax = states("sensor.power_usage_max_fault_tolerant") | float(0) %}
|
||||
|
||||
|
||||
|
||||
{% if states("sensor.estimated_charge_percent_today") | float(0) >= 100 %}
|
||||
{% set output = states("sensor.power_usage_max_fault_tolerant") | float(0) %}
|
||||
{% endif %}
|
||||
|
||||
{% set output = [ output, states("sensor.estimated_optimal_output_limit") | float(0) ] | max %}
|
||||
|
||||
{% if states("sensor.klima_balkonsolar_temperature") | float(0) > 35 %}
|
||||
{% set output = [ output, 401 ] | min %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
||||
{{ output }}
|
||||
Reference in New Issue
Block a user