Posted

in

, , , ,

by


Home Assistant gauge card – manually defined colours

Home Assistant gauge card – manually defined colours

This post fits to (Today I learned) category.

The ‘normal’ way to define colours in a ‘gauge’ card is by defining severity from UI gauge settings. There are only 4 colours available in a sequence: blue, green, yellow, red:

gauge chart in home assistant

Standard colours are defined using UI by turning on ‘define severity‘ and then entering thresholds for green, yellow, red:

setiings for gauge chart in home assistant

But what if I want to define my own colours (e. g. green-yellow-orange-red)? Sometimes these colours doesn’t visually well represent the sensor value.

Firstly I wanted to define themes but because it didn’t work in a first try, I gave up.

gauge chart showing manually defined segment colours in home assistant

Then I found out that Home Assistant gauge card help offers definining manual ‘segments’ for gauge card. So I switched to manual editing of a gauge and defined segments:

cards:
  - type: gauge
    entity: sensor.ikea_vindstyrka_airquality_01_voc_index
    needle: true
    max: 500
    name: VOC index - organske spojine
    segments:
      - from: 0
        color: green
      - from: 150
        color: yellow
      - from: 250
        color: orange
      - from: 400
        color: red

For me it was easier than defining and editing ‘themes.yaml’. Maybe I’ll use frontend themes next time.

Tags:

If you’re reading this on fediverse and the layout (embedded pics) is off, here’s the link to the original blog post.



Comments

3 responses to “Home Assistant gauge card – manually defined colours”

  1. kaybeeque Avatar

    @tomi nice! Thanks for this.

    Blog now added to my RSS feed as well. 👍

    1. Tomi the Slav and 1024 others Avatar

      @kaybee335 @tomi Thank you! You're probably the first person ever who added my blog to rss reader 🙂
      RSS is great, I almost completely switched my consumption of news to rss (Feeder and Thunderbird).
      Which reader are you using?

      1. kaybeeque Avatar

        @po3mah @tomi I've been using Feedly since Google Reader got unceremoniously executed. 😂

        I haven't tried anything else, there's been no reason to.

Leave a Reply

Your email address will not be published. Required fields are marked *