-
Hi. I just found this addon and it looks awesome, really enjoy setting up some simpler views than before. One question I have though. I have a sensor (door/window) which I use to check a state of an item. The problem is that it shows "Closed" and dark icon, while when it's "Open" the icon lights up. My logic here is that it should be "On" when closed (or "Seated") and when the sensor is open "On", it should be dark icon and "Unoccupied" for text. Is there a simple way to invert the icon, and possibly change status text based on this above logic? I am very new to coding, so even Yaml is a tad tough from the start, but I am using examples and trying to understand. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
I made half of this work, by using this code: type: entities
entities:
- type: custom:paper-buttons-row
buttons:
- entity: switch.stol_kontor
layout: icon|state
state_icons:
"off": mdi:account
"on": mdi:chair-rolling
state_text:
"off": Seated
"on": Away
name: false Now the only issue is that the "mdi:account" icon is dark while the "mdi:chair-rolling" icon is yellow, or "active". This is what I would have liked to change around so that the first one is active (yellow) while the second is dark. Edit: The code above comes out wrong even if I use <code" formatting, but the text is correct so it should be fine. |
Beta Was this translation helpful? Give feedback.
-
You can use state_styles:
"off":
button:
color: var(--paper-item-icon-active-color)
"on":
button:
color: var(--paper-item-icon-color) lovelace-paper-buttons-row#using-style-and-state_styles On another note you can use three backticks for code formatting on Github, e.g.
|
Beta Was this translation helpful? Give feedback.
You can use
state_styles
to achive this, this will invert the active/inactive colorslovelace-paper-buttons-row#using-style-and-state_styles
On another note you can use three backticks for code formatting on Github, e.g.