Thanks! Thats done it
Thanks for sharing!
Hi mate, got Foxess also, where do you define current_power and decimal_hours thanks
As Best practice. Should we be putting these custom settings in configuration.yaml or in one of the developer or system automation areas.
I too want to add many different variables, but not sure on best practice.
Has anyone achieved this using Solax Modbus integration sensors? I cant seem to figure it out…
Yup, let me find the sensor and paste it in.
Remaining time in battery (discharging) :
{% if states('sensor.solax_battery_power_charge')|int < 0 %}
{% set percent = states('sensor.solax_battery_capacity') | float(0) / 100.0 | float(0) %}
{% set number = 1 | float(0) %}
{% set energy = 6 | float(0) %}
{% set reserve = (10 | float(5)) / 100.0 %}
{% set charge = ((percent - reserve) * number * energy) | float(0) %}
{% set current_power = (states('sensor.solax_battery_power_charge') | float(0) * -1) / 1000.0 %}
{% set decimal_hours = charge / current_power %}
{% set minutes = (decimal_hours % 1 * 60) | round(0) %}
{{ '{:2}:{:02}'.format(decimal_hours | int(00), minutes | int(00)) }}
{% else %}
{% set percent = states('sensor.solax_battery_capacity') | float(0) / 100.0 | float(0) %}
{% set number = 1 | float(0) %}
{% set energy = 6 | float(0) %}
{% set reserve = (10 | float(5)) / 100.0 %}
{% set charge = ((percent - reserve) * number * energy) | float(0) %}
{% set current_power = states('sensor.shelly_ct_channel_2_power') | float(0) / 1000.0 %}
{% set decimal_hours = charge / current_power %}
{% set minutes = (decimal_hours % 1 * 60) | round(0) %}
{{ '{:2}:{:02}'.format(decimal_hours | int(00), minutes | int(00)) }}
{% endif %}
TIme to charge (charging) :
{% if states('sensor.solax_battery_power_charge')|int <= 0 %}
Discharging
{% else %}
{% set capacity = states('sensor.solax_battery_voltage_charge')| float(default=1) * 30 | float(default=1) %}
{% set soc = 100 - (states('sensor.solax_battery_capacity') | float(default=1)) | float(default=1) %}
{% set discharged = (capacity/100) * soc | float(default=1) %}
{% set energy = (discharged/100) * 99 | float(default=1) %}
{% set output = states('sensor.solax_battery_power_charge') | float(default=1) %}
{% set loss = (output/100) * 85.92 | float(default=1) %}
{% set decimal_hours = discharged / output | float(default=1) %}
{% set minutes = (decimal_hours % 1 * 60) | round(0) %}
{{ '{:2}:{:02}'.format(decimal_hours | int(00), minutes | int(00)) }}
{% endif %}