Tạo giao diện giám sát Pin trên Home Assistant

UPDATE – đã fix lỗi hiển thị số thập phân trên HA mới

Các addon cài trong hass yêu cầu cần có
* Bubble Card
* Bar card

Phiên bản cũ

Code mới

type: vertical-stack
cards:
  - type: custom:bubble-card
    card_type: button
    sub_button:
      - entity: switch.jk_130_charging
        name: Sạc
        show_name: false
        show_background: true
        show_state: true
        show_last_changed: false
        show_attribute: false
        icon: mdi:battery-charging-high
        tap_action:
          action: toggle
        double_tap_action:
          action: toggle
        hold_action:
          action: toggle
      - entity: switch.jk_130_discharging
        name: Xả
        show_state: true
        show_name: false
        show_last_changed: false
        icon: mdi:battery-minus-outline
        tap_action:
          action: toggle
      - entity: switch.jk_130_balancer
        show_name: true
        name: Cân Bằng
        tap_action:
          action: toggle
    entity: switch.jk_130_enable_bluetooth_connection
    show_name: false
    show_last_changed: false
    show_attribute: false
    show_state: true
    card_layout: large
    styles: ""
    tap_action:
      action: none
  - type: custom:stack-in-card
    keep:
      margin: false
      box_shadow: false
      background: false
    cards:
      - type: grid
        square: false
        columns: 2
        cards:
          - type: markdown
            content: >-
              <center><b><font color=#097ad6 size=6>{{
              states('sensor.jk_130_total_voltage') | round(3) }}
              V</font></b><br> C.Suất:  <font color=#097ad6>{{
              states('sensor.jk_130_power') | round(3) }} W</font><br>
              D.Lượng:  <font color=#097ad6>{{
              states('sensor.jk_130_total_battery_capacity_setting') | round(3)
              }} Ah</font><br> Tổng Xả:  <font color=#097ad6>{{
              states('sensor.jk_130_total_charging_cycle_capacity') | round(3)
              }} Ah</font><br> Áp TB.:  <font color=#097ad6>{{
              states('sensor.jk_130_average_cell_voltage') | round(3) }}
              V</font><br> Cân bằng:  <font color=#097ad6>{{
              states('sensor.jk_130_balancing_current') | round(3) }}
              A</font><br> Nhiệt T1:  <font color=#097ad6>{{
              states('sensor.jk_130_temperature_sensor_1') | round(3) }}
              °C</font><br> Nhiệt T2:  <font color=#097ad6>{{
              states('sensor.jk_130_temperature_sensor_2') | round(3) }}
              °C</font>
          - type: markdown
            content: >-
              <center><b><font color=#097ad6 size=6>{{
              states('sensor.jk_130_current') | round(3) }} A</font></b><br>
              SOC:  <font color=#097ad6>{{
              states('sensor.jk_130_state_of_charge') | round(3) }}
              %</font><br>  Còn:  <font color=#097ad6>{{
              states('sensor.jk_130_capacity_remaining') | round(3) }}
              Ah</font><br> Chu kỳ:  <font color=#097ad6>{{
              states('sensor.jk_130_charging_cycles') }}</font><br> Lệch
              Cell.:  <font color=#097ad6>{{
              states('sensor.jk_130_delta_cell_voltage') | round(3) }}
              V</font><br> Nhiệt MOS.:  <font color=#097ad6>{{
              states('sensor.jk_130_power_tube_temperature') | round(3) }}
              °C</font><br> Nhiệt T3:  <font color=#097ad6>{{
              states('sensor.jk_130_temperature_sensor_3') | round(3) }}
              °C</font><br> Nhiệt T4:  <font color=#097ad6>{{
              states('sensor.jk_130_temperature_sensor_4') | round(3) }}
              °C</font>
    card_mod:
      style: |
        ha-card {
          backdrop-filter: blur(10px);
          box-shadow: none;
          border: none
        }
  - type: horizontal-stack
    cards:
      - type: custom:bar-card
        direction: up
        columns: 8
        decimal: 3
        max: 3.45
        min: 3
        height: 80px
        severity:
          - color: darkred
            from: 3.45
            to: 4
          - color: darkorange
            from: 3.4
            to: 3.45
          - color: rgb(9, 122, 214)
            from: 3.1
            to: 3.4
          - color: darkred
            from: 2.5
            to: 3.1
        positions:
          icon: "off"
          indicator: inside
          name: outside
        entities:
          - entity: sensor.jk_130_cell_voltage_1
            name: Cell 01
          - entity: sensor.jk_130_cell_voltage_2
            name: Cell 02
          - entity: sensor.jk_130_cell_voltage_3
            name: Cell 03
          - entity: sensor.jk_130_cell_voltage_4
            name: Cell 04
          - entity: sensor.jk_130_cell_voltage_5
            name: Cell 05
          - entity: sensor.jk_130_cell_voltage_6
            name: Cell 06
          - entity: sensor.jk_130_cell_voltage_7
            name: Cell 07
          - entity: sensor.jk_130_cell_voltage_8
            name: Cell 08
          - entity: sensor.jk_130_cell_voltage_9
            name: Cell 09
          - entity: sensor.jk_130_cell_voltage_10
            name: Cell 10
          - entity: sensor.jk_130_cell_voltage_11
            name: Cell 11
          - entity: sensor.jk_130_cell_voltage_12
            name: Cell 12
          - entity: sensor.jk_130_cell_voltage_13
            name: Cell 13
          - entity: sensor.jk_130_cell_voltage_14
            name: Cell 14
          - entity: sensor.jk_130_cell_voltage_15
            name: Cell 15
        card_mod:
          style: |-
            bar-card-value {
              margin-right: auto;
              margin-left: auto;
              margin-bottom: 35px;
              font-size: 10px;
              font-weight: normal;
            }
            bar-card-name {
              margin-right: auto;
              margin-left: auto;
              margin-bottom: 0px;
              font-size: 10px;
              font-weight: normal;
            }
  - 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>Cells
      - type: grid
        square: false
        columns: 2
        cards:
          - type: markdown
            content: >-
              <center> {%- for i in range(1, 9) %} {{- '%02d' % i
              }}.    {%- set voltage_entity =
              'sensor.jk_130_cell_voltage_' ~ i %} {%- set resistance_entity =
              'sensor.jk_130_cell_resistance_' ~ i %} {%- set voltage =
              states(voltage_entity) | float | round(3) %} {%- set resistance =
              states(resistance_entity) | float | round(4) %} {%- if
              states('sensor.jk_130_max_voltage_cell') | int == i %}
                <font color="#3090C7">{{ voltage }} V</font>
              {%- elif states('sensor.jk_130_min_voltage_cell') | int == i %}
                <font color="red">{{ voltage }} V</font>
              {%- else %}
                {{ voltage }} V
              {%- endif %}    /    {{ resistance
              }} Ω <br> {%- endfor %} </center>
          - type: markdown
            content: >-
              <center> {%- for i in range(9, 17) %} {{- '%02d' % i
              }}.    {%- set voltage_entity =
              'sensor.jk_130_cell_voltage_' ~ i %} {%- set resistance_entity =
              'sensor.jk_130_cell_resistance_' ~ i %} {%- set voltage =
              states(voltage_entity) | float | round(3) %} {%- set resistance =
              states(resistance_entity) | float | round(4) %} {%- if
              states('sensor.jk_130_max_voltage_cell') | int == i %}
                <font color="#3090C7">{{ voltage }} V</font>
              {%- elif states('sensor.jk_130_min_voltage_cell') | int == i %}
                <font color="red">{{ voltage }} V</font>
              {%- else %}
                {{ voltage }} V
              {%- endif %}    /    {{ resistance
              }} Ω <br> {%- endfor %} </center>

sau khi đã khắc phục

5 1 đánh giá
Đánh giá bài viết
Theo dõi
Thông báo của
0 Góp ý
Được bỏ phiếu nhiều nhất
Mới nhất Cũ nhất
Phản hồi nội tuyến
Xem tất cả bình luận
0
Rất thích suy nghĩ của bạn, hãy bình luận.x