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

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

Code để card

type: grid
cards:
  - type: heading
    heading: Pack 130Ah
    heading_style: title
  - 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: vertical-stack
    cards:
      - 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=#bda442 size=6>{{
                  states('sensor.jk_130_total_voltage') }} V</font></b><br>
                  C.Suất:&nbsp;&nbsp;<font color=#bda442>{{
                  states('sensor.jk_130_power') }} W</font><br>
                  D.Lượng:&nbsp;&nbsp;<font color=#bda442>{{
                  states('sensor.jk_130_total_battery_capacity_setting') }}
                  Ah</font><br> Xả:&nbsp;&nbsp;<font color=#bda442>{{
                  states('sensor.jk_130_total_charging_cycle_capacity') }}
                  Ah</font><br> Áp TB.:&nbsp;&nbsp;<font color=#bda442>{{
                  states('sensor.jk_130_average_cell_voltage') }} V</font><br>
                  Cân bằng:&nbsp;&nbsp;<font color=#bda442>{{
                  states('sensor.jk_130_balancing_current') }} A</font><br> 
              - type: markdown
                content: >-
                  <center><b><font color=#bda442 size=6>{{
                  states('sensor.jk_130_current') }} A</font></b><br>
                  SOC:&nbsp;&nbsp;<font color=#bda442>{{
                  states('sensor.jk_130_state_of_charge') }} %</font><br> 
                  Còn:&nbsp;&nbsp;<font color=#bda442>{{
                  states('sensor.jk_130_capacity_remaining') }} Ah</font><br>
                  Chu kỳ:&nbsp;&nbsp;<font color=#bda442>{{
                  states('sensor.jk_130_charging_cycles') }}</font><br> Lệch
                  Cell.:&nbsp;&nbsp;<font color=#bda442>{{
                  states('sensor.jk_130_delta_cell_voltage') }} V</font><br>
                  Nhiệt MOS.:&nbsp;&nbsp;<font color=#bda442>{{
                  states('sensor.jk_130_power_tube_temperature') }}
                  °C</font><br> Nhiệt T1:&nbsp;&nbsp;<font color=#bda442>{{
                  states('sensor.jk_130_temperature_sensor_1') }} °C</font><br>
                  Nhiệt T2:&nbsp;&nbsp;<font color=#bda442>{{
                  states('sensor.jk_130_temperature_sensor_2') }} °C</font><br>
        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(189, 164, 66)
                from: 3.1
                to: 3.4
              - color: darkred
                from: 2.5
                to: 3.1
            positions:
              icon: "off"
              indicator: inside
              name: inside
            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: 15px;
                  font-size: 10px;
                  font-weight: normal;
                }
                bar-card-name {
                  margin-right: auto;
                  margin-left: auto;
                  margin-bottom: 0px;
                  font-size: 7px;
                  font-weight: normal;
                }
      - 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>01.&nbsp;&nbsp;&nbsp; {% if
                  states('sensor.jk_130_max_voltage_cell') == '1' %}  <font
                  color="#3090C7">{{ states('sensor.jk_130_cell_voltage_1') }}
                  V</font> {% elif states('sensor.jk_130_min_voltage_cell') ==
                  '1' %}  <font color="red">{{
                  states('sensor.jk_130_cell_voltage_1') }} V</font> {% else %}
                  {{ states('sensor.jk_130_cell_voltage_1') }} V {% endif %}
                  &nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp; {{
                  states('sensor.jk_130_cell_resistance_1') }} Ω <br>
                  02.&nbsp;&nbsp;&nbsp; {% if
                  states('sensor.jk_130_max_voltage_cell') == '2' %}  <font
                  color="#3090C7">{{ states('sensor.jk_130_cell_voltage_2') }}
                  V</font> {% elif states('sensor.jk_130_min_voltage_cell') ==
                  '2' %} <font color="red">{{
                  states('sensor.jk_130_cell_voltage_2') }} V</font> {% else %}
                  {{ states('sensor.jk_130_cell_voltage_2') }} V {% endif %}
                  &nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp; {{
                  states('sensor.jk_130_cell_resistance_2') }} Ω <br>
                  03.&nbsp;&nbsp;&nbsp; {% if
                  states('sensor.jk_130_max_voltage_cell') == '3' %}  <font
                  color="#3090C7">{{ states('sensor.jk_130_cell_voltage_3') }}
                  V</font> {% elif states('sensor.jk_130_min_voltage_cell') ==
                  '3' %} <font color="red">{{
                  states('sensor.jk_130_cell_voltage_3') }} V</font> {% else %}
                  {{ states('sensor.jk_130_cell_voltage_3') }} V {% endif %}
                  &nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp; {{
                  states('sensor.jk_130_cell_resistance_3') }} Ω <br>
                  04.&nbsp;&nbsp;&nbsp; {% if
                  states('sensor.jk_130_max_voltage_cell') == '4' %}  <font
                  color="#3090C7">{{ states('sensor.jk_130_cell_voltage_4') }}
                  V</font> {% elif states('sensor.jk_130_min_voltage_cell') ==
                  '4' %} <font color="red">{{
                  states('sensor.jk_130_cell_voltage_4') }} V</font> {% else %}
                  {{ states('sensor.jk_130_cell_voltage_4') }} V {% endif %}
                  &nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp; {{
                  states('sensor.jk_130_cell_resistance_4') }} Ω <br>
                  05.&nbsp;&nbsp;&nbsp; {% if
                  states('sensor.jk_130_max_voltage_cell') == '5' %}  <font
                  color="#3090C7">{{ states('sensor.jk_130_cell_voltage_5') }}
                  V</font> {% elif states('sensor.jk_130_min_voltage_cell') ==
                  '5' %} <font color="red">{{
                  states('sensor.jk_130_cell_voltage_5') }} V</font> {% else %}
                  {{ states('sensor.jk_130_cell_voltage_5') }} V {% endif %}
                  &nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp; {{
                  states('sensor.jk_130_cell_resistance_5') }} Ω <br>
                  06.&nbsp;&nbsp;&nbsp; {% if
                  states('sensor.jk_130_max_voltage_cell') == '6' %}  <font
                  color="#3090C7">{{ states('sensor.jk_130_cell_voltage_6') }}
                  V</font> {% elif states('sensor.jk_130_min_voltage_cell') ==
                  '6' %} <font color="red">{{
                  states('sensor.jk_130_cell_voltage_6') }} V</font> {% else %}
                  {{ states('sensor.jk_130_cell_voltage_6') }} V {% endif %}
                  &nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp; {{
                  states('sensor.jk_130_cell_resistance_6') }} Ω <br>
                  07.&nbsp;&nbsp;&nbsp; {% if
                  states('sensor.jk_130_max_voltage_cell') == '7' %}  <font
                  color="#3090C7">{{ states('sensor.jk_130_cell_voltage_7') }}
                  V</font> {% elif states('sensor.jk_130_min_voltage_cell') ==
                  '7' %} <font color="red">{{
                  states('sensor.jk_130_cell_voltage_7') }} V</font> {% else %}
                  {{ states('sensor.jk_130_cell_voltage_7') }} V {% endif %}
                  &nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp; {{
                  states('sensor.jk_130_cell_resistance_7') }} Ω <br>
                  08.&nbsp;&nbsp;&nbsp; {% if
                  states('sensor.jk_130_max_voltage_cell') == '8' %}  <font
                  color="#3090C7">{{ states('sensor.jk_130_cell_voltage_8') }}
                  V</font> {% elif states('sensor.jk_130_min_voltage_cell') ==
                  '8' %} <font color="red">{{
                  states('sensor.jk_130_cell_voltage_8') }} V</font> {% else %}
                  {{ states('sensor.jk_130_cell_voltage_8') }} V {% endif %}
                  &nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp; {{
                  states('sensor.jk_130_cell_resistance_8') }} Ω <br></center>
              - type: markdown
                content: >-
                  <center>09.&nbsp;&nbsp;&nbsp; {% if
                  states('sensor.jk_130_max_voltage_cell') == '9' %}  <font
                  color="#3090C7">{{ states('sensor.jk_130_cell_voltage_9') }}
                  V</font> {% elif states('sensor.jk_130_min_voltage_cell') ==
                  '9' %}  <font color="red">{{
                  states('sensor.jk_130_cell_voltage_9') }} V</font> {% else %}
                  {{ states('sensor.jk_130_cell_voltage_9') }} V {% endif %}
                  &nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp; {{
                  states('sensor.jk_130_cell_resistance_9') }} Ω <br>
                  10.&nbsp;&nbsp;&nbsp; {% if
                  states('sensor.jk_130_max_voltage_cell') == '10' %}  <font
                  color="#3090C7">{{ states('sensor.jk_130_cell_voltage_10') }}
                  V</font> {% elif states('sensor.jk_130_min_voltage_cell') ==
                  '10' %} <font color="red">{{
                  states('sensor.jk_130_cell_voltage_10') }} V</font> {% else %}
                  {{ states('sensor.jk_130_cell_voltage_10') }} V {% endif %}
                  &nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp; {{
                  states('sensor.jk_130_cell_resistance_10') }} Ω <br>
                  11.&nbsp;&nbsp;&nbsp; {% if
                  states('sensor.jk_130_max_voltage_cell') == '11' %}  <font
                  color="#3090C7">{{ states('sensor.jk_130_cell_voltage_11') }}
                  V</font> {% elif states('sensor.jk_130_min_voltage_cell') ==
                  '11' %} <font color="red">{{
                  states('sensor.jk_130_cell_voltage_11') }} V</font> {% else %}
                  {{ states('sensor.jk_130_cell_voltage_11') }} V {% endif %}
                  &nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp; {{
                  states('sensor.jk_130_cell_resistance_11') }} Ω <br>
                  12.&nbsp;&nbsp;&nbsp; {% if
                  states('sensor.jk_130_max_voltage_cell') == '12' %}  <font
                  color="#3090C7">{{ states('sensor.jk_130_cell_voltage_12') }}
                  V</font> {% elif states('sensor.jk_130_min_voltage_cell') ==
                  '12' %} <font color="red">{{
                  states('sensor.jk_130_cell_voltage_12') }} V</font> {% else %}
                  {{ states('sensor.jk_130_cell_voltage_12') }} V {% endif %}
                  &nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp; {{
                  states('sensor.jk_130_cell_resistance_12') }} Ω <br>
                  13.&nbsp;&nbsp;&nbsp; {% if
                  states('sensor.jk_130_max_voltage_cell') == '13' %}  <font
                  color="#3090C7">{{ states('sensor.jk_130_cell_voltage_13') }}
                  V</font> {% elif states('sensor.jk_130_min_voltage_cell') ==
                  '13' %} <font color="red">{{
                  states('sensor.jk_130_cell_voltage_13') }} V</font> {% else %}
                  {{ states('sensor.jk_130_cell_voltage_13') }} V {% endif %}
                  &nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp; {{
                  states('sensor.jk_130_cell_resistance_13') }} Ω <br>
                  14.&nbsp;&nbsp;&nbsp; {% if
                  states('sensor.jk_130_max_voltage_cell') == '14' %}  <font
                  color="#3090C7">{{ states('sensor.jk_130_cell_voltage_14') }}
                  V</font> {% elif states('sensor.jk_130_min_voltage_cell') ==
                  '14' %} <font color="red">{{
                  states('sensor.jk_130_cell_voltage_14') }} V</font> {% else %}
                  {{ states('sensor.jk_130_cell_voltage_14') }} V {% endif %}
                  &nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp; {{
                  states('sensor.jk_130_cell_resistance_14') }} Ω <br>
                  15.&nbsp;&nbsp;&nbsp; {% if
                  states('sensor.jk_130_max_voltage_cell') == '15' %}  <font
                  color="#3090C7">{{ states('sensor.jk_130_cell_voltage_15') }}
                  V</font> {% elif states('sensor.jk_130_min_voltage_cell') ==
                  '15' %} <font color="red">{{
                  states('sensor.jk_130_cell_voltage_15') }} V</font> {% else %}
                  {{ states('sensor.jk_130_cell_voltage_15') }} V {% endif %}
                  &nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp; {{
                  states('sensor.jk_130_cell_resistance_15') }} Ω <br>
                  16.&nbsp;&nbsp;&nbsp; {% if
                  states('sensor.jk_130_max_voltage_cell') == '16' %}  <font
                  color="#3090C7">{{ states('sensor.jk_130_cell_voltage_16') }}
                  V</font> {% elif states('sensor.jk_130_min_voltage_cell') ==
                  '16' %} <font color="red">{{
                  states('sensor.jk_130_cell_voltage_16') }} V</font> {% else %}
                  {{ states('sensor.jk_130_cell_voltage_16') }} V {% endif %}
                  &nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp; {{
                  states('sensor.jk_130_cell_resistance_16') }} Ω <br></center>

Để lại một bình luận

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *