question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Color based on attribute

See original GitHub issue

Covered my whole lovelace UI in buttons to control the house - LOVE IT! Thanks

Would it be possible to have a color_trigger based on attribute? I’m thinking of primarily a fan (so if the speed = ‘low’) then the color of the button would change then? If you had 3 buttons (low, medium, high) you could set instead of off or on (as the fan doesnt have off or on) color_trigger based on the attribute of the fan speed.

- type: "custom:button-card"
                entity: switch.bedroom_fan
                size: 48px
                icon: mdi:fan
                name: Low
                action: service
                service:
                  domain: fan
                  action: set_speed
                  data:
                    entity_id: fan.bedroom_fan
                    speed: low
                color_type: card
                color_off: rgb(68, 70, 73)
                color: rgb(1, 121, 116)
                **color_trigger: 
                  value_template:  "{{ is_state('fan.attributes.speed', 'low')}}"**

I am being a little lazy here as could make switches for each speed, but i’m thinking of also those folks that use it for tv remotes (ie light up the xbox logo when that attribute is set)?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
kuujicommented, Oct 16, 2018

Released!

1reaction
kuujicommented, Oct 16, 2018

@jaburges

              - type: "custom:button-card"
                entity: input_select.cube_mode
                icon: mdi:cube
                action: service
                show_state: true
                state:
                  - value: 'sleeping'
                    color: var(--disabled-text-color)
                  - value: 'media'
                    color: rgb(5, 147, 255)
                  - value: 'light'
                    color: rgb(189, 255, 5)

That’s a button for a select input. It calls a service to select the next option when you click on it. That was already possible before, now the new thing is the state parameter. Here I defined 3 states with 3 values and 3 different colors.

What do you think?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vary symbology by color—ArcGIS Pro | Documentation
Unclassed colors shows variation in a feature attribute by distributing a color scheme evenly across features. Or, you can refine one of the...
Read more >
How to Color Your Map Using an Attribute - Esri
Let's click that thing. A little popup asks us what attribute we want to use for color. There is a droplist of the...
Read more >
How to color code DOORS objects based on the attribute value
Answer. The default text color in a DOORS column is black. You can change the color of text information in a column based...
Read more >
How to I colour based on Attribute Table Field Value? : r/QGIS
Click Symbology. At the top, click the dropdown that prob'ly says Single Symbol and choose Categorized. Set the Value to the field Name....
Read more >
ArcMap Symbology: Assign colors based on a column value in ...
Then, use the field calculator geoprocessing tool or right click on that new field in the attribute table and bring up the field...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found