Hi all,
I may sound silly, but I wanted to share template sensors I created for my Pylontech battery bank consisting out of 4 x US3000B batteries.
Currently, there is no time remaining or time till full calculations coming from Batteries (BMS) or Venus and since I don’t have BMV. Because of that I created template sensors for HA.
Please comment, rip it apart, give suggestions, laugh at me, share if you have anything that is better, etc
- Battery - Current Remaining Capacity (Ah)
- platform: template
sensors:
battery_remaining_capacity:
friendly_name: "Battery Remaining Capacity"
unit_of_measurement: "Ah"
value_template: >-
{% set t = states('sensor.battery_soc_victron') | float %}
{% set u = states('sensor.battery_current') | float %}
{{(296*(t/100)) | round(0, default=0 )}}
- Battery time remaining under current load
- platform: template
sensors:
battery_time_remaining:
friendly_name: "Battery Time Remaining"
unit_of_measurement: "Hr"
value_template: >-
{% set c = states('sensor.home_ac_consumption') | float %}
{{(236*48/c) | round(0, default=0 )}}
I have taken 20% of the total capacity, as I have the 3000B version…the figure for 4 x US3000C would be 280 (capacity - 5%)
- Battery Recharge Time
- platform: template
sensors:
battery_recharge_time:
friendly_name: "Battery Recharge Time"
unit_of_measurement: "Hr"
value_template: >-
{% set x = states('sensor.battery_remaining_capacity') | float %}
{% set y = states('sensor.battery_current') | float %}
{{(2*(x/y)) | round(0, default=0 )}}
The above assumes that you have following Victron modbus sensors created:
- sensor.battery_soc_victron
- name: "Battery SOC Victron"
data_type: uint16
unit_of_measurement: "%"
slave: 225
address: 266
scale: 0.1
- sensor.battery_current
- name: "Battery Current"
data_type: int16
unit_of_measurement: "A"
slave: 100
address: 841
scale: 0.1
- sensor.home_ac_consumption
- name: "Home AC Consumption"
data_type: uint16
unit_of_measurement: "W"
scan_interval: 5
slave: 100
address: 817
scale: 1
This is the results:
Current “problem” is the update interval. Modbus sensors update every 30 or so seconds and make the template sensors to update as well which can seem erratic at times.
Possible solutions is to create sensors specifically for the calculation and make them update every 15min or 30min…
Maybe creating moving average sensor from the results? Opened to suggestions and new ideas