kalkih / mini-graph-card

Minimalistic graph card for Home Assistant Lovelace UI
MIT License
3.01k stars 234 forks source link

Problems with Graph Card #886

Closed itsmartinho closed 9 months ago

itsmartinho commented 1 year ago

Hello amazing people,

I've been progressively working on making my UI "prettier" and I've came across a issue I can't seem to fix. I used to use temporarily those cards:

type: custom:mini-graph-card
name: Temperatura
entities:
  - sensor.5c857eb0303a_temperature
show:
  labels: true
color_thresholds:
  - value: 8
    color: '#2cf4e8'
  - value: 20
    color: '#4caf50'
  - value: 32
    color: '#f4482c'

Now I've been working on this new graph-card:

type: custom:stack-in-card
cards:
  - type: grid
    square: false
    columns: 2
    cards:
      - type: custom:mushroom-entity-card
        entity: sensor.sensor_home_average_humidity
        primary_info: state
        secondary_info: name
        name: Interior
        icon_color: green
      - type: custom:mushroom-entity-card
        entity: sensor.sensor_exterior_humidity
        primary_info: state
        secondary_info: name
        name: Exterior
        icon_color: blue
  - type: custom:mini-graph-card
    entities:
      - entity: sensor.sensor_home_average_humidity
        color: '#00bb33'
      - entity: sensor.sensor_exterior_humidity
        color: '#2196f3'
        y_axis: secondary
    hours_to_show: 24
    line_width: 3
    font_size: 50
    animate: true
    show:
      name: false
      icon: false
      state: false
      legend: false
      fill: fade

The problem I am facing, is that I wish I could add those 3 variables to each of the 2 graphs present in the new card. It gives a different coloration depending on those parameters that gave it such a nice look and feeling, can someone help me transporting the color effect color_thresholds: into the new card, on both entities?

I've tried so many times but my code seems to always be crashing :(

Thanks a lot in advance

ildar170975 commented 1 year ago
  1. Why does your issue contain a code for a mushroom card? Is it related somehow? If not - please do not post a code which is not related to the described issue.

  2. This issue is neither a bug nor a feature request. It's a question. I suggest to ask questions in the HA Community thread and leave Github for bugs & FRs. There you will get answers faster and share them with other users.

  3. If you need to add the color_thresholds code to the mini-graph-card you described for humidities, then just add a code exactly as you did for a temperature:

    - type: custom:mini-graph-card
    entities:
      ...
    hours_to_show: 24
    ...
    show:
      ...
    color_thresholds:
      - value: 8
        color: '#2cf4e8'
      - value: 20
        color: '#4caf50'
      - value: 32
        color: '#f4482c'

    and these '80,20,32' values should be replaced by thresholds for humidity. Surely then BOTH graphs for a humidity will have same thresholds, you cannot specify different thresholds for different entities (a corresponding FR for individual per-entity color_thresholds was already registered on Github, you may find it and start monitoring). Also, I do not suggest to show thresholds when more then one graph is displayed since a picture becomes not clear due to many overlapping colors.

ildar170975 commented 1 year ago

Let me know if the issue is solved. If it is - then close it please.

ildar170975 commented 9 months ago

No feedback from OP. The issue will be closed soon.

itsmartinho commented 9 months ago

Yes the issue is resolved. Thank you so much!