Home Assistant Lovelace UI cards #230
Replies: 36 comments 44 replies
-
Good job! Could you try to convert your Lovelace configuration into a blueprint? |
Beta Was this translation helpful? Give feedback.
-
Your contribution is mentioned at the Goodie section now! :-) Thanks for your support! https://github.com/syssi/esphome-jk-bms/tree/add-googie-section#goodies |
Beta Was this translation helpful? Give feedback.
-
Hi! I tweaked the code so it works by default with your naming @syssi Top card
Stats card
Cells card
Control card
|
Beta Was this translation helpful? Give feedback.
-
Thanks for these contributions everyone! Here's my version with the following changes:
a bit unfortunate that home assistant uglyfies the formatting when you save the configuration, but works and looks nice: |
Beta Was this translation helpful? Give feedback.
-
Thanks for sharing! Here's the final fixed version:
|
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I can't understand how this .yaml language works |
Beta Was this translation helpful? Give feedback.
-
Thanks, |
Beta Was this translation helpful? Give feedback.
-
Seems you are running a modified version. Try the code from first post.
…On Fri, Mar 1, 2024, 06:04 Đặng Đình Ngọc ***@***.***> wrote:
Hi,
I dont know why, your scripts failed to run "{% for idx in range(1, 5" the
display only show the upper part of the lovelace (image)
The part relating to cells does not show up.
image.png (view on web)
<https://github.com/syssi/esphome-jk-bms/assets/8839597/38f888d6-87a8-412c-baef-043c90826a18>
Can you advice. I can manually list cell entities but the scripts can be
fine if it work!
Please help
Best,
—
Reply to this email directly, view it on GitHub
<#230 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABJGIGYFWKIM3VQTLBMP6V3YV7443AVCNFSM6AAAAAATRVZQA6VHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4DMMZYGEZDO>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Thanks a lot works perfectly |
Beta Was this translation helpful? Give feedback.
-
Hello guys, can someone tell me why it doesn't change the colors to minimum and maximum on my cell I don't know where I went wrong:
|
Beta Was this translation helpful? Give feedback.
-
Thank you, it works well now, I think |
Beta Was this translation helpful? Give feedback.
-
dr3amr Could you see my code? I don't know why but I always have one goal number 3 in blue and it doesn't change. Minimum in red color jumps on all targets but not blue max
|
Beta Was this translation helpful? Give feedback.
-
hello guys, I recently bought a new BMS model JK_PB2A16S20P Hardware Ver 15.XA and Software Ver. V15.10 everything works as it should |
Beta Was this translation helpful? Give feedback.
-
I've modified the codes to suit ANT-32s BMS
|
Beta Was this translation helpful? Give feedback.
-
Hi, maybe someone will like it) in the end it came together fine
|
Beta Was this translation helpful? Give feedback.
-
I made it for myself with two batteries, it turned out interesting) |
Beta Was this translation helpful? Give feedback.
-
Good evening. I want to connect two jk-bms that I have each with a tesla battery to the home assistant. I'm at the beginning and I don't really know how to start. I bought an ESP32 and I have HOA installed on a mini pc. Please help me with the steps to connect. Thank you |
Beta Was this translation helpful? Give feedback.
-
Thank you very much, can I use an esp32 board for the 2BMS or do I need 2 esp32 boards. |
Beta Was this translation helpful? Give feedback.
-
Hello everyone, I managed to connect the two jk bms to the home assistant via bluetooth, I receive the data but I cannot vertically integrate the card from the address https://github.com/syssi/esphome-jk-bms/blob/main/esp32 -ble-v14-multiple.yaml, with only one but not version 14 the simple one integrates Lovelace UI cards, stack-in-card, has anyone managed to do it for two bms? Thanks |
Beta Was this translation helpful? Give feedback.
-
Put the code for your cards
…On Mon, Jan 6, 2025 at 2:47 PM spirake ***@***.***> wrote:
jk.bms.jpg (view on web)
<https://github.com/user-attachments/assets/21420605-7934-4997-b232-23f4ad7a4424>
—
Reply to this email directly, view it on GitHub
<#230 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A6RHDDQRZT2YMO3EFIMJSS32JLMWZAVCNFSM6AAAAAATRVZQA6VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCNZVGMYTMOI>
.
You are receiving this because you commented.Message ID:
***@***.***>
--
Edward Allen
Network/System/IT Solutions Provider/Consultant
Voice: +1-647-876-4337
WhatsApp: +1-647-876-4337
https://www.linkedin.com/in/edwardajallen/
***@***.***
|
Beta Was this translation helpful? Give feedback.
-
esp32-ble-v14-multiple.yaml bms0_protocol_version: JK02_32S esphome: esp32: web_server: external_components: source: ${external_components_source} ota:
logger: api: esp32_ble_tracker: ble_client: mac_address: ${bms0_mac_address} ble_client_id: client0 platform: jk_bms_ble platform: jk_bms_ble button: platform: jk_bms_ble platform: jk_bms_ble number: platform: jk_bms_ble ... ... platform: jk_bms_ble cell_resistance_1: total_voltage: power_tube_temperature: ... cell_resistance_1: total_voltage: power_tube_temperature: ... platform: jk_bms_ble platform: gpio platform: jk_bms_ble platform: ble_client platform: ble_client text_sensor: platform: jk_bms_ble platform: jk_bms_ble |
Beta Was this translation helpful? Give feedback.
-
This is the code i want to use for 2 bms |
Beta Was this translation helpful? Give feedback.
-
I am currently using version 11 and can integrate the card vertically, for version 14 it must be changed in the code but I don't know what. Thank you |
Beta Was this translation helpful? Give feedback.
-
This is the raw code to vertical card for version 11 |
Beta Was this translation helpful? Give feedback.
-
`type: vertical-stack
|
Beta Was this translation helpful? Give feedback.
-
The code below is for 1 card.
Do a search and replace. Replace pack1 with your sensor name eg "jk_bms".
then make another copy for your second card.
type: vertical-stack
… cards:
- type: custom:stack-in-card
keep:
margin: false
box_shadow: false
cards:
- type: custom:stack-in-card
columns: 1
cards:
- type: gauge
entity: sensor.pack1_soc
needle: true
name: Charge
severity:
green: 75
yellow: 40
red: 0
- type: markdown
content: >-
<center>Charge: <b> {% if
states('switch.pack1_charge') ==
'on' %} <font color=#41CD52>{{ states('switch.pack1_charge')
|
upper }}</font> {% else %} <font color=red>{{
states('switch.pack1_charge') | upper }}</font> {% endif %}
</b>
{{' ' * 5 }}
Discharge: <b> {% if states('switch.pack1_discharge')
== 'on'
%} <font color=#41CD52>{{ states('switch.pack1_discharge') |
upper
}}</font> {% else %} <font color=red> {{
states('switch.pack1_discharge') | upper }} </font> {% endif
%}
</b>
- type: custom:stack-in-card
keep:
margin: false
box_shadow: false
background: false
cards:
- type: custom:stack-in-card
margin: false
columns: 2
mode: horizontal
cards:
- type: markdown
content: >-
<center><b><font color=#41CD52 size=6>{{
states('sensor.pack1_voltage') }} V</font></b><br> </center>
{%
macro pad_right(w, s) %} {{ s }} {% set slen = w -
(s|length) %}
{% for idx in range(slen)%} {%endfor %}
{%- endmacro %}
{% macro green(s) %} <font color=#41CD52 size=2
family=Consolas>
{{ s }} </font> {%- endmacro %}
<div> {{ pad_right(14, "Power Flow:") -}} {% set power =
states('sensor.pack1_power') | int %} {{ green('%d' % power
+ '
W') }}<br> {{ pad_right(16, "Total Capacity:") -}} {{
green(states('sensor.pack1_capacity') + " Ah") }}<br> {{
pad_right(16, 'Cycle Capacity:') }} {{
green(states('sensor.pack1_cycle_capacity') + " Ah") }}<br>
{{
pad_right(16, 'Avg Cell V:') }} {{
green(states('sensor.pack1_cell_volt_average') + ' V') }}
<br> {{
pad_right(10, 'Min Cell:') }} {{
green(states('sensor.pack1_cell_index_min') ) }} {{' '
* 5
}}{{ pad_right(9, 'Max Cell:') }} {{
green(states('sensor.pack1_cell_index_max') ) }} <br> {{
pad_right(7, 'Batt T1:') }} {{
green(states('sensor.pack1_temperatures_1') + '°C') }}
{{' '
* 3 }}{{ pad_right(6, 'Bal Cur:') }} {{
green(states('sensor.pack1_balance_current') ) }} </div>
- type: markdown
content: >-
<center><b><font color=#41CD52 size=6>{{
states('sensor.pack1_current') }} A</font></b><br> </center>
{%
macro pad_right(w, s) %} {{ s }} {% set slen = w -
(s|length) %}
{% for idx in range(slen)%} {%endfor %} {%- endmacro
%} {%
macro green(s) %} <font color=#41CD52 family=Consolas> {{ s
}}
</font> {%- endmacro %} <div> {{ pad_right(14,
"Remaining:") -}}
{{ green(states('sensor.pack1_soc') + ' %') }}<br> {{
pad_right(15, "Avail. Capacity:") -}} {{
green(states('sensor.pack1_charge') + " Ah") }}<br> {{
pad_right(15, 'Cycle Count:') }} {{
green(states('sensor.computed_cycle_ant') + " N") }}<br> {{
pad_right(16, 'Delta Cell V:') }} {{
green(states('sensor.pack1_cell_volt_delta') + ' V') }} <br>
{{
pad_right(14, 'MOS Temp.:') }} {{
green(states('sensor.pack1_mos_temperature') + ' °C') }}<br>
{{
pad_right(15, 'Battery T2:') }} {{
green(states('sensor.pack1_temperatures_2') + ' °C') }}
</div>
- type: custom:stack-in-card
keep:
margin: false
box_shadow: false
background: false
cards:
- type: grid
square: false
columns: 1
cards:
- type: markdown
content: >-
<center><b> pack1 Cells <font color="red"> {{' ' * 5 }}
{{
states('sensor.pack_1_charge_kw') + ' KW' }}</font> </b>
</center>
- type: grid
square: false
columns: 2
cards:
- type: markdown
content: >-
{% for idx in range(1, 5) -%} {%- set min_idx =
states('sensor.pack1_cell_index_min') %} {%- set max_idx =
states('sensor.pack1_cell_index_max') %} {%- set is_max =
states('sensor.pack1_cell_index_max')| int == idx %} {%- set
is_min = states('sensor.pack1_cell_index_min')| int == idx
%} {%
if idx <= 9 %} {%- set volt_sensor_id =
'sensor.pack1_cell_volt_0%d' % idx %} {%- set cell_volt =
states('sensor.pack1_cell_volt_0%d' % idx) %} {%- else %}
{%- set
volt_sensor_id = 'sensor.pack1_cell_volt_%d' % idx %} {%- set
cell_volt = states('sensor.pack1_cell_volt_%d' % idx) %} {%-
endif
%} {%- set font_start = '<font color="#3090C7">' if is_max
else
'<font color="red">' if is_min else '' %} {%- set font_end =
'</font>' if is_max or is_min else '' %} {{ "%02d" %
idx }}.
{{ font_start }} {{ cell_volt }} V {{ font_end -}} <br> {%
endfor %}
- type: markdown
content: >-
{% for idx in range(5, 8) -%} {%- set min_idx =
states('sensor.pack1_cell_index_min') %} {%- set max_idx =
states('sensor.pack1_cell_index_max') %} {%- set is_max =
states('sensor.pack1_cell_index_max')| int == idx %} {%- set
is_min = states('sensor.pack1_cell_index_min')| int == idx
%} {%
if idx <= 9 %} {%- set volt_sensor_id =
'sensor.pack1_cell_volt_0%d' % idx %} {%- set cell_volt =
states('sensor.pack1_cell_volt_0%d' % idx) %} {%- else %}
{%- set
volt_sensor_id = 'sensor.pack1_cell_volt_%d' % idx %} {%- set
cell_volt = states('sensor.pack1_cell_volt_%d' % idx) %} {%-
endif
%} {%- set font_start = '<font color="#3090C7">' if is_max
else
'<font color="red">' if is_min else '' %} {%- set font_end =
'</font>' if is_max or is_min else '' %} {{ "%02d" %
idx }}.
{{ font_start }} {{ cell_volt }} V {{ font_end -}} <br> {%
endfor %}
- type: entities
entities:
- entity: switch.pack1_charge
name: Charging
- entity: switch.pack1_discharge
name: Discharging
- entity: switch.pack1_balance
name: Balance
show_header_toggle: false
card_mod:
style: |
ha-card {
color: red;
}
On Tue, Jan 7, 2025 at 11:44 AM spirake ***@***.***> wrote:
type: vertical-stack
cards:
- type: custom:stack-in-card
keep:
margin: false
box_shadow: false
cards:
- type: custom:stack-in-card
columns: 1
cards:
-
type: markdown
content: |-
Time: *{{ states('sensor.jk_bms_total_runtime_formatted') |
upper }} *
* - type: markdown content: >- Charge: {% if
states('switch.jk_bms_charging') == 'on' %} {{
states('switch.jk_bms_charging') | upper }} {% else %} {{
states('switch.jk_bms_charging') | upper }} {% endif %} {{' ' * 5 }}
Discharge: {% if states('switch.jk_bms_discharging') == 'on' %} {{
states('switch.jk_bms_discharging') | upper }} {% else %} {{
states('switch.jk_bms_discharging') | upper }} {% endif %} {{' ' * 5 }}
Balance: {% if states('switch.jk_bms_balancer') == 'on' %} {{
states('switch.jk_bms_balancer') | upper }} {% else %} {{
states('switch.jk_bms_balancer') | upper }} {% endif %} *
* - type: custom:stack-in-card keep: margin: false box_shadow: false
background: false cards: - type: custom:stack-in-card margin: false
columns: 2 mode: horizontal cards: - type: markdown content: >- {{
states('sensor.jk_bms_total_voltage') }} V {% macro pad_right(w, s) %} {{ s
}} {% set slen = w - (s|length) %} {% for idx in range(slen)%} {%endfor
%} {%- endmacro %} {% macro green(s) %} {{ s }} {%- endmacro %} {{
pad_right(14, "Power Draw:") -}} {% set power =
states('sensor.jk_bms_power') | int %} {{ green('%d' % power + ' W') }} {{
pad_right(16, "Total Capacity:") -}} {{
green(states('sensor.jk_bms_total_battery_capacity_setting') + " Ah") }} {{
pad_right(16, 'Cycle Capacity:') }} {{
green(states('sensor.jk_bms_total_charging_cycle_capacity') + " Ah") }} {{
pad_right(16, 'Avg Cell V:') }} {{
green(states('sensor.jk_bms_average_cell_voltage') + ' V') }} {{
pad_right(16, 'Balance Curr:') }} {{
green(states('sensor.jk_bms_balancing_current') + ' A') }} {{ pad_right(16,
'Battery T1:') }} {{ green(states('sensor.jk_bms_temperature_sensor_1') + '
°C') }} - type: markdown content: >- {{ states('sensor.jk_bms_current') }}
A {% macro pad_right(w, s) %} {{ s }} {% set slen = w - (s|length) %} {%
for idx in range(slen)%} {%endfor %} {%- endmacro %} {% macro green(s) %}
{{ s }} {%- endmacro %} {{ pad_right(14, "Remaining:") -}} {{
green(states('sensor.jk_bms_capacity_remaining') + ' %') }} {{
pad_right(15, "Rem. Capacity:") -}} {{
green(states('sensor.jk_bms_capacity_remaining_derived') + " Ah") }} {{
pad_right(15, 'Cycle Count:') }} {{
green(states('sensor.jk_bms_charging_cycles') + " Ah") }} {{ pad_right(16,
'Delta Cell V:') }} {{ green(states('sensor.jk_bms_delta_cell_voltage') + '
V') }} {{ pad_right(14, 'MOS Temp.:') }} {{
green(states('sensor.jk_bms_power_tube_temperature') + ' °C') }} {{
pad_right(15, 'Battery T2:') }} {{
green(states('sensor.jk_bms_temperature_sensor_2') + ' °C') }} - type:
custom:stack-in-card keep: margin: false box_shadow: false background:
false cards: - type: grid square: false columns: 1 cards: - type: markdown
content: Cells - type: grid square: false columns: 1 cards: - type:
markdown content: >- 01. {% if states('sensor.jk_bms_max_voltage_cell')
== '1' %} {{ states('sensor.jk_bms_cell_voltage_1') }} V {% elif
states('sensor.jk_bms_min_voltage_cell') == '1' %} {{
states('sensor.jk_bms_cell_voltage_1') }} V {% else %} {{
states('sensor.jk_bms_cell_voltage_1') }} V {% endif %} / {{
states('sensor.jk_bms_cell_resistance_1') }} Ω 02. {% if
states('sensor.jk_bms_max_voltage_cell') == '2' %} {{
states('sensor.jk_bms_cell_voltage_2') }} V {% elif
states('sensor.jk_bms_min_voltage_cell') == '2' %} {{
states('sensor.jk_bms_cell_voltage_2') }} V {% else %} {{
states('sensor.jk_bms_cell_voltage_2') }} V {% endif %} / {{
states('sensor.jk_bms_cell_resistance_2') }} Ω 03. {% if
states('sensor.jk_bms_max_voltage_cell') == '3' %} {{
states('sensor.jk_bms_cell_voltage_3') }} V {% elif
states('sensor.jk_bms_min_voltage_cell') == '3' %} {{
states('sensor.jk_bms_cell_voltage_3') }} V {% else %} {{
states('sensor.jk_bms_cell_voltage_3') }} V {% endif %} / {{
states('sensor.jk_bms_cell_resistance_3') }} Ω 04. {% if
states('sensor.jk_bms_max_voltage_cell') == '4' %} {{
states('sensor.jk_bms_cell_voltage_4') }} V {% elif
states('sensor.jk_bms_min_voltage_cell') == '4' %} {{
states('sensor.jk_bms_cell_voltage_4') }} V {% else %} {{
states('sensor.jk_bms_cell_voltage_4') }} V {% endif %} / {{
states('sensor.jk_bms_cell_resistance_4') }} Ω 05. {% if
states('sensor.jk_bms_max_voltage_cell') == '5' %} {{
states('sensor.jk_bms_cell_voltage_5') }} V {% elif
states('sensor.jk_bms_min_voltage_cell') == '5' %} {{
states('sensor.jk_bms_cell_voltage_5') }} V {% else %} {{
states('sensor.jk_bms_cell_voltage_5') }} V {% endif %} / {{
states('sensor.jk_bms_cell_resistance_5') }} Ω 06. {% if
states('sensor.jk_bms_max_voltage_cell') == '6' %} {{
states('sensor.jk_bms_cell_voltage_6') }} V {% elif
states('sensor.jk_bms_min_voltage_cell') == '6' %} {{
states('sensor.jk_bms_cell_voltage_6') }} V {% else %} {{
states('sensor.jk_bms_cell_voltage_6') }} V {% endif %} / {{
states('sensor.jk_bms_cell_resistance_6') }} Ω 07. {% if
states('sensor.jk_bms_max_voltage_cell') == '7' %} {{
states('sensor.jk_bms_cell_voltage_7') }} V {% elif
states('sensor.jk_bms_min_voltage_cell') == '7' %} {{
states('sensor.jk_bms_cell_voltage_7') }} V {% else %} {{
states('sensor.jk_bms_cell_voltage_7') }} V {% endif %} / {{
states('sensor.jk_bms_cell_resistance_7') }} Ω - type: entities entities: -
entity: switch.jk_bms_charging name: Charging - entity:
switch.jk_bms_discharging name: Discharging - entity:
switch.jk_bms_balancer name: Balancing show_header_toggle: false *
—
Reply to this email directly, view it on GitHub
<#230 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A6RHDDW4PFX7T3W6LTTPMZ32JQAATAVCNFSM6AAAAAATRVZQA6VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCNZWGMZDSOA>
.
You are receiving this because you commented.Message ID:
***@***.***>
--
Edward Allen
Network/System/IT Solutions Provider/Consultant
Voice: +1-647-876-4337
WhatsApp: +1-647-876-4337
https://www.linkedin.com/in/edwardajallen/
***@***.***
|
Beta Was this translation helpful? Give feedback.
-
Note: I will be updating this post if there are modifications to the cards along the way.
Note2: @syssi's example has "substitutions: name: jk-bms" while I used "substitutions: name: bms-bt-monitor" (for sensor names), so in order to use the cards, one needs to do a replace-all from "bms-bt-monitor" to own used substitution name.
Hi all and @syssi
@syssi if you want you can embed the code to README.md
Just sharing my work on adding similar jkbms app graphics to HA:
Code bellow, requires Stack In Card by @RomRider => https://github.com/custom-cards/stack-in-card + markdown card (included with HA)
Top card:
Stats card:
Cells card:
Control card:
Beta Was this translation helpful? Give feedback.
All reactions