What card are you using to show the cell voltages?
Markdown?
If so you probably need:
{{ states('sensor.cell_1',rounded=True) }}
More options (e.g. “with_unit”) here: https://www.home-assistant.io/docs/configuration/templating/#states
What card are you using to show the cell voltages?
Markdown?
If so you probably need:
{{ states('sensor.cell_1',rounded=True) }}
More options (e.g. “with_unit”) here: https://www.home-assistant.io/docs/configuration/templating/#states
standard grid card, I’ve posted the YAML a few times and put a link in one of the replies to the original Dashboard I built mine from.
I will try that and see what it does… Thanks.
IT WORKED! Thank you Tom.
YAML updated for the first 2 battery cells:
<center>01.
{% if states('sensor.yambms_shunt_basen_bms_1_cell_voltage_max_cell_number') == '1' %}
<font color="red">{{ states('sensor.yambms_shunt_basen_bms_1_cell_voltage_01',rounded=True) }} V</font>
{% elif states('sensor.yambms_shunt_basen_bms_1_cell_voltage_min_cell_number') == '1' %} <font color="#3090C7">
{{ states('sensor.yambms_shunt_basen_bms_1_cell_voltage_01',rounded=True) }} V</font>
{% else %} {{ states('sensor.yambms_shunt_basen_bms_1_cell_voltage_01',rounded=True) }} V
{% endif %}
/
{% if states('sensor.yambms_shunt_basen_bms_1_cell_balancing_bitmask')[0]=='1' %}<font color="yellow">bal. ON</font>{% else %}bal. off{% endif %} <br> 02.
{% if states('sensor.yambms_shunt_basen_bms_1_cell_voltage_max_cell_number') == '2' %} <font color="red">{{ states('sensor.yambms_shunt_basen_bms_1_cell_voltage_02',rounded=True) }} V</font>
{% elif states('sensor.yambms_shunt_basen_bms_1_cell_voltage_min_cell_number') == '2' %} <font color="#3090C7">{{ states('sensor.yambms_shunt_basen_bms_1_cell_voltage_02',rounded=True) }} V</font>
{% else %} {{ states('sensor.yambms_shunt_basen_bms_1_cell_voltage_02',rounded=True) }} V
{% endif %} /
Grid cards don’t display information, they display cards in a grid layout. What card are you using to display the information? EDIT: Using markdown.
Yes, they are using markdown.
@Doog you need to use the function Tom provided in your markdown code.
I tried to show as much of how the Dashboard was setup and specifically the section giving me display problems in my first post and in subsequent posts.
If that YAML code which discribes the display is called “markdown” then ya, the code I posted was markdown code in my dashboard YAML file.
Hopefully I can remove all the round(3) entries, added rounded=TRUE to all of my sensors in the displays and never have to change things after HA updates. And I will pass this along to the many who use HA for solar system monitoring because it’s been discussed many many times over the last year.
did you write that markdown code?
This code should do the same and it’ll be easier to manage
{%- set max_cell_number = '%02i' % states('sensor.yambms_shunt_basen_bms_1_cell_voltage_max_cell_number') | int(0) -%}
{%- set min_cell_number = '%02i' % states('sensor.yambms_shunt_basen_bms_1_cell_voltage_min_cell_number') | int(0) -%}
{%- set bb = states('sensor.yambms_shunt_basen_bms_1_cell_balancing_bitmask') %}
{%- set colors = {min_cell_number: "#3090C7", max_cell_number: "red"} -%}
<center>
{%- for i in range(8) -%}
{%- set no = '%02i' % (i + 1) -%}
{%- set value = states('sensor.yambms_shunt_basen_bms_1_cell_voltage_' ~ no, rounded=True) -%}
{%- set color = colors.get(no, None) -%}
{%- set bal = '<font color="yellow">bal. ON</font>' if bb[i] == '%i' % (i + 1) else 'bal. off' %}
{{ no }}. {% if color %}<font color="{{ color }}">{{ value }} V</font>{% else %}{{ value }}{% endif %} / {{ bal }}
{% endfor %}
LOL, yes kinda. I forget what was there but I wanted the min and max elements to show and since the max and min cell numbers are in entities I figured I had to test each entity to set the color. And at the same time there are cells which were balancing so I wanted to turn those yellow.
I’ve since turned OFF the BMS’s onboard resistive balancing and added an external balancer so now I’m really just looking for the max and min voltage cells.
I’ll try your markdown code and see if it works but I’m an old-school C/C++ programmer so all this HTML and Javascript markup doesn’t ‘read’ well but I understand it might be more efficient and easier to maintain since I spread entity reads all over the place.
OMG, I’m seeing it now and yes that is WAY more efficient code!
I’ve already updated it to handle 9-16 by changing the 0 offset adjustment(i+1) to (i+9) and then I added the “V” to all displays instead of just the colored ones. All 3 battery displays have been updated. Again, WAY better. Thank you.
Hey, I just released a new update for the BMS Battery Cells Card on GitHub. It’s a pretty comprehensive update. I have added a detailed view where you can display significantly more information, optionally with a bar chart, cell fields, or a simple list with balance-indicator at the bottom. Maybe that is helpful. ![]()
New features:
Detailed view implemented
New adjustable sensors (SOH, cycles, capacity, MOS temperature)
Integrated buttons/switches/select for charging, discharging, and balancing
Balance indicator added
New design options
EDIT: A version will be released tomorrow or the day after in which you can add a single balance sensor to each cell. Then the system will either calculate the balance or use the sensor readings as a basis.