Change background based on numerical entity #1217
Closed
Unanswered
azsaleem
asked this question in
Questions about config, custom styles and templates
Replies: 3 comments 4 replies
-
The condition you're using is incorrect. You should compare the state to 45 using the "greater than" operator (>), not the "strictly equal to" operator (===) combined with a string. So, use
If this solves your problem, mark this as solved and close the discussion. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thans so much for your response. I’ve copied the text as you’ve suggested but this hasn’t worked.
style: |
.bubble-button-background {
opacity: 1 !important;
background-color: ${state > 45 ? 'red' : 'yellow'} !important;
}
From: Menelao147 ***@***.***>
Sent: 09 February 2025 11:00
To: Clooos/Bubble-Card ***@***.***>
Cc: azsaleem ***@***.***>; Author ***@***.***>
Subject: Re: [Clooos/Bubble-Card] Change background based on numerical entity (Discussion #1217)
The condition you're using is incorrect. You should compare the state to 45 using the "greater than" operator (>), not the "strictly equal to" operator (===) combined with a string. So, use state > 45 instead of state === '> 45'.
.bubble-button-background {
opacity: 1 !important;
background-color: ${state > 45 ? 'red' : 'yellow'} !important;
}
_____
If this solves your problem, mark this as solved and close the discussion.
—
Reply to this email directly, view it on GitHub <#1217 (comment)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/AOWPOOO7B52BK44LWFCKZBL2O4YLHAVCNFSM6AAAAABWYAZ5LCVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTEMJQHAYDSNI> .
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
4 replies
-
Omg!! I fixed it. I had put code as "Style" rather than "Styles" Thanks for the help |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Goal
I want to change the color of the background based on temperature of the water. So when it is at temperature (ie >45 deg) it should be red, when it is 38-44, it should be yellow and below that should be blue. I'm not able to get even the first first. I've tried a few of the elements based in the docs, see below.
Source Yaml
Which step did you already try?
Problem
None of the above work, is there a way to make this happen. I can make it happen based on entities being on or off but is there a way to do it based on the numerical value of an entity?
Read the documentation
Beta Was this translation helpful? Give feedback.
All reactions