custom-cards / bar-card

Customizable Animated Bar card for Home Assistant Lovelace
MIT License
378 stars 54 forks source link

Severity level for non-numeric values & Display text for values #130

Open Tom-ahawk opened 3 years ago

Tom-ahawk commented 3 years ago

For my example I have a sensor with air quality values (attributes), one of the attributes is the sum index for all measured values in string (low, medium, high, severe) and another sensor with with states like: low/medium/hight/severer.

  1. Enhance existing severity option code to change displayed value to displayed text, this way an explanatory text can be displayed instead of value:
entity: sensor.example
title: Severity
type: 'custom:bar-card'
severity:
  - color: Green
    display: "Low"
    from: 0
    to: 25
  - color: Orange
    display: "High"
    from: 26
    to: 50
  - color: Red
    display: "Severe"
    from: 51
    to: 100
  1. Please consider making the severity option for non-numeric values (and the %-range they apply up to, on the bar) like:

     severity:
       - color: green
         display: "low" #if display is not used then use the sensors state/attribute text
         from%: 0
       - color: orange
         display: "medium"
         from%: 40
       - color: red
         display: "hight"
         from%: 80
       - color: purple 
         display: "severe"
         from%: 90

image

Today (6/7) the standard Gauge Card got "label string" (optional), - Label of the segment. This will be shown instead of the value. Hope the bar-card gets it to.