mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-18 23:06:40 +00:00
Fade icon to grey for all entities it unavailable
This commit is contained in:
parent
6dd7d9d158
commit
c95e7dae4a
@ -59,7 +59,8 @@ export default new Polymer({
|
|||||||
|
|
||||||
computeIsOn(stateObj) {
|
computeIsOn(stateObj) {
|
||||||
return stateObj && stateObj.state !== 'off' &&
|
return stateObj && stateObj.state !== 'off' &&
|
||||||
stateObj.state !== 'unlocked' && stateObj.state !== 'closed';
|
stateObj.state !== 'unlocked' && stateObj.state !== 'closed' &&
|
||||||
|
stateObj.state !== 'unavailable';
|
||||||
},
|
},
|
||||||
|
|
||||||
// We call updateToggle after a successful call to re-sync the toggle
|
// We call updateToggle after a successful call to re-sync the toggle
|
||||||
|
@ -27,6 +27,14 @@
|
|||||||
ha-state-icon[data-domain=sun][data-state=above_horizon] {
|
ha-state-icon[data-domain=sun][data-state=above_horizon] {
|
||||||
color: #DCC91F;
|
color: #DCC91F;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Color the icon if unavailable */
|
||||||
|
ha-state-icon[data-domain=light][data-state=unavailable],
|
||||||
|
ha-state-icon[data-domain=switch][data-state=unavailable],
|
||||||
|
ha-state-icon[data-domain=binary_sensor][data-state=unavailable],
|
||||||
|
ha-state-icon[data-domain=sensor][data-state=unavailable] {
|
||||||
|
color: #D3D3D3;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -33,8 +33,6 @@ function binarySensorIcon(state) {
|
|||||||
export default function stateIcon(state) {
|
export default function stateIcon(state) {
|
||||||
if (!state) {
|
if (!state) {
|
||||||
return defaultIcon;
|
return defaultIcon;
|
||||||
} else if (state.state && state.state === 'unavailable') {
|
|
||||||
return 'mdi:alert-circle-outline';
|
|
||||||
} else if (state.attributes.icon) {
|
} else if (state.attributes.icon) {
|
||||||
return state.attributes.icon;
|
return state.attributes.icon;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user