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.

Question: how to set colour based on light brightness

See original GitHub issue

Hi,

I have a button that I want to be “background” colour" when off and “yellow” when at 30% (which is the tap_action of this button).

…I know this isn’t a bug, but I am not sure where I can post a question like this.

Below is the best I have got and I know it is wrong. Can anyone advise"

          - type: 'custom:button-card'
            entity: light.hallway
            color: auto-no-temperature
            color_type: card
            state:
              - value: "off"
                color: var(--paper-item-icon-color)
              - value: {{state_attr('blight.hallway','brightness_pct')}}
                operator: "="
                value: 30
                color: yellow
            styles:
              card:
                - height: 100px
            name: "Low"
            tap_action:
              action: call-service
              service: light.turn_on
              service_data:
                entity_id: light.hallway
                brightness_pct: 30

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
RomRidercommented, Dec 30, 2021

Happy that it works. I’m going to close this, then 😃

0reactions
JCHH2commented, Dec 30, 2021

agh, I posted on reddit, not here

Read more comments on GitHub >

github_iconTop Results From Across the Web

Automatic smart light brightness and color based on the sun
I use Home Assistant to set my smart light brightness and colour temperature to different values based on the time of day and...
Read more >
Adjust the brightness and color temperature on your iPhone or ...
Use the brightness control in Control Center, or open Display & Brightness in Settings.
Read more >
Change text color based on brightness of the covered ...
Ignore the first set of functions because they're wrong, but the YIQ formula will help you determine whether or not to use a...
Read more >
Will changing the color of the light source change the ...
The problem is that filament based lighting produce a continuous spectrum of wavelengths and must be filtered to produce specific colors.
Read more >
How to adjust temperature, color, and brightness on your ...
Change color, temperature, and brightness · On the Color tab, tap and drag your finger across the color spectrum until you find your...
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