kalkih / mini-graph-card

Minimalistic graph card for Home Assistant Lovelace UI
MIT License
2.96k stars 232 forks source link

lower_bound not working without upper_bound #928

Closed gigatexel closed 1 year ago

gigatexel commented 1 year ago

Expected behaviour: when a lower_bound is specified, the graph uses this as a "hard" bound

In reality, this only works when an upper_bound is also specified.

image image

ildar170975 commented 1 year ago

Do not confirm here:

image

type: vertical-stack
cards:
  - type: custom:mini-graph-card
    entities:
      - entity: sensor.xiaomi_cg_1_co2
    hours_to_show: 4
    points_per_hour: 120
    line_width: 1
    smoothing: false
    aggregate_func: last
    show:
      labels: true
  - type: custom:mini-graph-card
    entities:
      - entity: sensor.xiaomi_cg_1_co2
    hours_to_show: 4
    points_per_hour: 120
    line_width: 1
    smoothing: false
    aggregate_func: last
    lower_bound: ~400
    show:
      labels: true
  - type: custom:mini-graph-card
    entities:
      - entity: sensor.xiaomi_cg_1_co2
    hours_to_show: 4
    points_per_hour: 120
    line_width: 1
    smoothing: false
    aggregate_func: last
    lower_bound: 0
    show:
      labels: true

Works fine w/o upper_bound.

ildar170975 commented 1 year ago

What is a strange value "-11" on your 1st picture ? Post a code for your card.

gigatexel commented 1 year ago

It is generated by the card.

ildar170975 commented 1 year ago

Since no code is posted, nothing to investigate.

gigatexel commented 1 year ago

Code:

cards:
  - type: custom:mushroom-template-card
    card_mod:
      style: |
        ha-card {
          border-width: 0px;
        }
    primary: Regenwater
    icon: mdi:thermometer
    icon_color: |-
      {% if is_state(entity, 'unknown') %}

      {% elif states(entity) | float >= 75 %}
        green
      {% elif states(entity) | float >= 50 %}
        yellow
      {% elif states(entity) | float >= 25 %}
         amber
      {% elif states(entity) | float >= 15 %}
        orange
      {% else %}
         red
      {% endif %}
    entity: sensor.regenwater_percentage_filter
  - type: custom:mini-graph-card
    card_mod:
      style: |
        ha-card {
          border-width: 0px;
        }
    lower_bound: 0
    upper_bound: 100
    entities:
      - sensor.regenwater_percentage_filter
    show:
      icon: false
      name: false
      state: true
      labels: true
    hours_to_show: 48
    points_per_hour: 1
    color_thresholds:
      - value: 0
        color: '#FF0000'
      - value: 15
        color: '#FFA500'
      - value: 25
        color: '#FFBF00'
      - value: 50
        color: '#FFFF00'
      - value: 75
        color: '#00FF00'
    animate: true
    line_width: 1
    min_bound_range: 25
ildar170975 commented 1 year ago

custom:mushroom-template-card

Not related to the issue. May be removed from the posted code.

ildar170975 commented 1 year ago

Remove this & recheck: upper_bound: 100 color_thresholds: min_bound_range: 25

gigatexel commented 1 year ago

Fixed. min_bound_range seems to overwrite

thx!