Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

documention: thresholds #894

Closed
nschloe opened this issue Dec 22, 2022 · 7 comments
Closed

documention: thresholds #894

nschloe opened this issue Dec 22, 2022 · 7 comments
Labels
docs Documentation enhancement Something that can be improved

Comments

@nschloe
Copy link
Contributor

nschloe commented Dec 22, 2022

The main documentation gives

color_thresholds:
  - value: 0
    color: "#ff0000"
  - value: 1.333333
    color: "#ffff00"
  - value: 2.666667
    color: "#00ff00"
  - value: 4
    color: "#0000ff"

as an example for color thresholding. What exactly does this mean?

  • Between 0 and 1.3333 we have #ff0000?
  • What happens below 0?
  • What happens above 4?
@jlsjonas jlsjonas added enhancement Something that can be improved docs Documentation labels Dec 24, 2022
@jlsjonas
Copy link
Collaborator

Hi, this should indeed be cleared up a little!

Essentially, the color_treshold value works like a minimum: if the graph value is higher than a threshold, its color will apply (highest gets precedence and the first color is used as the lowest color, regardless of its value)

Between 0 and 1.3333 we have #ff0000?

Correct!

What happens below 0?

Currently, the first threshold color is used; although we might want to expose the default color if no threshold was reached in the future (to improve multi-graph & allow for "red alert only" thresholds)

What happens above 4?

#0000ff is applied.

i.e.:

color_thresholds:
  - value: 0 # currently ignored
    color: "#ff0000"
  - value: 1.333333 # anything above 1.33333 
    color: "#ffff00"
  - value: 2.666667
    color: "#00ff00"
  - value: 4
    color: "#0000ff"

@nschloe
Copy link
Contributor Author

nschloe commented Dec 24, 2022

If the the first "threshold" is ignored, then perhaps it shouldn't be there at all. That'd make it clearer that the thresholds are thresholds from below.

@Lemonadel
Copy link

Lemonadel commented Sep 30, 2023

/Hi, it looks like it’s broken or something for past few months? Or user is broken? :D

Env:
HA on HAOS on RPi4
IMG_2172

Watched on iOS HA app iOS 16-17

My config (skipping value 0 does nothing)

Code:

- type: custom:mini-graph-card
   name: VOC last hour
   entities:
    - entity: sensor.airquality_drukarka_voc_index
      color_thresholds:
      - value: 0
        color: blue
      - value: 100
        color: blue #'#44739e'
      - value: 200
        color: orange
      - value: 300
        color: red
   hours_to_show: 1
   hour24: True
   points_per_hour: 60
   show:
      legend: True
      icon: False

Results:

IMG_2171

IMG_2173

@ildar170975
Copy link
Collaborator

color_thresholds

This is a global property, not per entity.
image

type: vertical-stack
cards:
  - type: entities
    entities:
      - input_number.number
  - type: custom:mini-graph-card
    entities:
      - entity: input_number.number
    color_thresholds_transition: hard
    color_thresholds:
      - value: 0
        color: blue
      - value: 30
        color: green
      - value: 50
        color: magenta
      - value: 80
        color: red
    hours_to_show: 0.08333
    points_per_hour: 600
    height: 200
    lower_bound: ~0
    show:
      points: false
      labels: true

@Lemonadel
Copy link

I don't know how I managed to write it per entity not global as you said and not found it for several months :D

Thank you so much, naturally works like a charm!

Repository owner deleted a comment from Lemonadel Sep 30, 2023
@ildar170975
Copy link
Collaborator

Explanations were provided.
Docs need to be updated: some clarifications to be added.
PR: #1058

@ildar170975
Copy link
Collaborator

v.0.12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation enhancement Something that can be improved
Projects
None yet
Development

No branches or pull requests

4 participants