Skip to content

[Bug] Template Mode in Bar Module not updating values #52

@sammort

Description

@sammort

Love this card, a fantastic evolution of the Ultra Vehicle Card, thanks for your incredible work.

An issue I've found is that, when using Template Mode for a value in the Bar module, the value doesn't update unless the browser window is refreshed.

As an example, in this card you can see that the "Left Side" is using a template value to return a rounded number for range. The car is currently charging, so that range value is increasing, but that value doesn't reflect in the card. When I open the entity by clicking it, you can see the real value doesn't match the value on the card

Image
type: custom:ultra-card
card_background: var(--card-background-color, var(--ha-card-background, white))
card_border_radius: 12
card_border_color: var(--divider-color)
card_border_width: 1
card_padding: 16
layout:
  rows:
    - id: row1
      columns:
        - id: col1
          modules:
            - id: text-1769812237326-uwdxw4i63
              type: text
              text: Bluey
              link: ""
              hide_if_no_link: false
              tap_action:
                action: nothing
              hold_action:
                action: nothing
              double_tap_action:
                action: nothing
              icon: phu:renault
              icon_color: "#CCCCCC"
              icon_position: before
              template_mode: false
              template: ""
              unified_template_mode: false
              unified_template: ""
              enable_hover_effect: true
              hover_background_color: var(--divider-color)
              font_weight: "700"
              text_transform: none
              design: {}
              display_mode: always
              display_conditions: []
              alignment: center
              color: "#CCCCCC"
              module_name: Title
              margin_bottom: 0px
              margin:
                bottom: 0px
              padding_bottom: 0px
              padding:
                bottom: 0px
            - id: horizontal-1769813772298-0b3zoidam
              type: horizontal
              alignment: center
              gap: 0.7
              wrap: false
              modules:
                - id: info-1769813788479-5k2sud8i7
                  type: info
                  info_entities:
                    - name: Bluey Battery
                      icon: mdi:battery-charging
                      id: info-entity-1769813788479-tvujg9n2q
                      icon_color: var(--primary-text-color)
                      show_name: false
                      show_units: true
                      show_state: true
                      unified_template_mode: false
                      unified_template: ""
                      entity: sensor.bluey_battery
                  module_name: SoC
                  tap_action:
                    action: default
                    entity: sensor.bluey_battery
                - id: info-1769813785612-u89hxvvr5
                  type: info
                  info_entities:
                    - entity: binary_sensor.bluey_plugged_in_at_home
                      name: Bluey Plugged In at Home
                      icon: mdi:ev-plug-type2
                      id: info-entity-1769813785612-foidiqulu
                      show_name: false
                      unified_template_mode: true
                      unified_template: |-
                        {
                          "state_text": "{% if state == 'on' %}Plugged In{% else %}Unplugged{% endif %}",
                          "icon_color": "{% if state == 'on' %}var(--primary-color){% else %}var(--primary-text-color){% endif %}",
                        }
                      show_icon: true
                      template_mode: false
                      name_value_layout: vertical
                      name_value_gap: 2
                      template: ""
                      dynamic_icon_template_mode: false
                      show_units: false
                      show_state: true
                      icon_color: var(--primary-color)
                      state_color: var(--primary-text-color)
                  module_name: Connector
                  tap_action:
                    action: default
                    entity: binary_sensor.bluey_plugged_in_at_home
                  display_mode: every
                  display_conditions:
                    - id: cond_1769815673945_y4zgd
                      type: entity_state
                      ui_expanded: true
                      entity: binary_sensor.bluey_charging_at_home
                      operator: "="
                      custom_name: Not Charging
                      value: "off"
                  allow_wrap: true
                - id: info-1769815845436-4m99sneu8
                  type: info
                  info_entities:
                    - entity: binary_sensor.bluey_charging_at_home
                      name: Bluey Charging at Home
                      icon: mdi:ev-plug-type2
                      id: info-entity-1769815845436-u9ci1l16l
                      show_name: false
                      unified_template_mode: false
                      unified_template: ""
                      show_icon: true
                      template_mode: false
                      name_value_layout: vertical
                      name_value_gap: 2
                      template: ""
                      dynamic_icon_template_mode: false
                      show_units: false
                      show_state: true
                      icon_color: var(--primary-color)
                      state_color: var(--primary-text-color)
                      dynamic_color_template_mode: false
                  module_name: Charging
                  tap_action:
                    action: default
                    entity: binary_sensor.bluey_charging_at_home
                  display_mode: every
                  display_conditions:
                    - id: cond_1769815673945_y4zgd
                      type: entity_state
                      ui_expanded: true
                      entity: binary_sensor.bluey_charging_at_home
                      operator: "="
                      custom_name: Charging
                      value: "on"
                - id: info-1769813784518-f9xkgegxa
                  type: info
                  info_entities:
                    - entity: sensor.bluey_mileage
                      name: Bluey Mileage
                      icon: mdi:counter
                      id: info-entity-1769813784518-wxq8m15cw
                      show_name: false
                      icon_color: var(--primary-text-color)
                      unified_template_mode: true
                      unified_template: |-
                        {
                          "state_text": "{{ '{0:,.0f}'.format(states('sensor.bluey_mileage') | round(0)) }} mi"
                        }
                  module_name: Odometer
                  tap_action:
                    action: default
                    entity: sensor.bluey_mileage
              tap_action:
                action: nothing
              hold_action:
                action: nothing
              double_tap_action:
                action: nothing
              display_mode: always
              display_conditions: []
            - id: image-1769812237326-r4y0snz40
              type: image
              image_type: upload
              image_url: /api/image/serve/8f2b5674525b2a1eb74430b9f36f6f81
              entity: ""
              image_entity: ""
              image_attribute: ""
              width: 100
              height: 200
              aspect_ratio: auto
              object_fit: contain
              hold_action:
                action: nothing
              double_tap_action:
                action: nothing
              filter_blur: 0
              filter_brightness: 100
              filter_contrast: 100
              filter_saturate: 100
              filter_hue_rotate: 0
              filter_opacity: 100
              rotation: 0
              border_radius: 8
              box_shadow: none
              hover_enabled: false
              hover_effect: scale
              hover_scale: 105
              hover_rotate: 5
              hover_opacity: 90
              hover_blur: 0
              hover_brightness: 110
              hover_shadow: none
              hover_translate_x: 0
              hover_translate_y: 0
              hover_transition: 300
              display_mode: every
              display_conditions:
                - id: cond_1769820336559_qlgr0
                  type: entity_state
                  ui_expanded: true
                  entity: device_tracker.bluey_location
                  operator: "="
                  custom_name: At Home
                  value: home
              alignment: center
              module_name: Image
            - id: map-1769820372987-ligpr9oes
              type: map
              map_provider: google
              map_type: roadmap
              zoom: 13
              show_map_controls: true
              disable_zoom_scroll: false
              disable_touch_drag: false
              auto_zoom_entities: false
              markers:
                - id: marker-1769820372987-vm1e51r9u
                  name: Car location
                  type: entity
                  latitude: xxxxx
                  longitude: xxxxx
                  icon: mdi:pin-outline
                  icon_color: var(--primary-color)
                  icon_size: 20
                  marker_image_type: icon
                  entity: device_tracker.bluey_location
              map_height: 400
              aspect_ratio: "16:9"
              tap_action:
                action: nothing
              hold_action:
                action: nothing
              double_tap_action:
                action: nothing
              display_mode: every
              display_conditions:
                - id: cond_1769820598307_egqar
                  type: entity_state
                  ui_expanded: true
                  entity: device_tracker.bluey_location
                  operator: "!="
                  custom_name: Away From home
                  value: home
              module_name: Location
            - id: bar-1769812523780-3dokblt3f
              type: bar
              entity: sensor.bluey_battery
              percentage_type: entity
              percentage_entity: ""
              percentage_attribute_entity: ""
              percentage_attribute_name: ""
              percentage_current_entity: ""
              percentage_total_entity: ""
              percentage_template: ""
              percentage_min_template_mode: false
              percentage_min_template: ""
              percentage_max_template_mode: false
              percentage_max_template: ""
              height: 16
              bar_direction: left-to-right
              bar_size: medium
              bar_radius: round
              bar_style: outline
              bar_width: 80
              bar_alignment: center
              border_radius: 0
              glass_blur_amount: 8
              label_alignment: space-between
              show_percentage: false
              show_value: true
              percentage_text_size: 14
              percentage_text_alignment: center
              percentage_text_bold: false
              percentage_text_italic: false
              percentage_text_strikethrough: false
              value_position: inside
              left_title: Range
              left_entity: sensor.bluey_battery_autonomy
              left_condition_type: none
              left_condition_entity: ""
              left_condition_state: ""
              left_template_mode: true
              left_title_size: 14
              left_value_size: 14
              left_title_color: var(--secondary-text-color)
              left_value_color: var(--primary-text-color)
              left_enabled: true
              left_tap_action:
                action: default
              left_hold_action:
                action: nothing
              left_double_tap_action:
                action: nothing
              right_title: Total
              right_entity: sensor.bluey_battery_autonomy
              right_enabled: true
              right_condition_type: none
              right_condition_entity: ""
              right_condition_state: ""
              right_template_mode: true
              right_template: >-
                {{ (((states('sensor.bluey_battery_autonomy') | round()) /
                states('sensor.bluey_battery') | int ()) * 100) | round () }} mi
              right_title_size: 14
              right_value_size: 14
              right_title_color: var(--secondary-text-color)
              right_value_color: var(--primary-text-color)
              right_tap_action:
                action: default
              right_hold_action:
                action: nothing
              right_double_tap_action:
                action: nothing
              bar_color: var(--primary-color)
              bar_background_color: ""
              bar_border_color: var(--divider-color)
              percentage_text_color: ""
              dot_color: ""
              minimal_icon_enabled: false
              minimal_icon: ""
              minimal_icon_mode: icon-in-dot
              minimal_icon_size: 24
              minimal_icon_size_auto: true
              minimal_icon_color: ""
              minimal_icon_use_dot_color: true
              use_gradient: false
              gradient_display_mode: full
              gradient_stops:
                - id: "1"
                  position: 0
                  color: "#ff0000"
                - id: "2"
                  position: 50
                  color: "#ffff00"
                - id: "3"
                  position: 100
                  color: "#00ff00"
              limit_entity: ""
              limit_color: ""
              animation: true
              template_mode: false
              template: ""
              unified_template_mode: false
              unified_template: ""
              bar_animation_enabled: true
              bar_animation_entity: binary_sensor.bluey_charging_at_home
              bar_animation_trigger_type: state
              bar_animation_attribute: ""
              bar_animation_value: "on"
              bar_animation_type: pulse
              bar_animation_override_entity: ""
              bar_animation_override_trigger_type: state
              bar_animation_override_attribute: ""
              bar_animation_override_value: ""
              bar_animation_override_type: none
              tap_action:
                action: nothing
              hold_action:
                action: nothing
              double_tap_action:
                action: nothing
              display_mode: always
              display_conditions: []
              module_name: Battery Gauge
              design: {}
              left_template: "{{ (states('sensor.bluey_battery_autonomy') | round()) }} mi"
      column_layout: 1-col
      gap: 15
card_shadow_enabled: false
card_margin: 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions