Fade icon to grey for all entities it unavailable

This commit is contained in:
William Scanlon 2016-03-04 13:48:38 -05:00
parent 6dd7d9d158
commit c95e7dae4a
3 changed files with 10 additions and 3 deletions

View File

@ -59,7 +59,8 @@ export default new Polymer({
computeIsOn(stateObj) {
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

View File

@ -27,6 +27,14 @@
ha-state-icon[data-domain=sun][data-state=above_horizon] {
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>
<template>

View File

@ -33,8 +33,6 @@ function binarySensorIcon(state) {
export default function stateIcon(state) {
if (!state) {
return defaultIcon;
} else if (state.state && state.state === 'unavailable') {
return 'mdi:alert-circle-outline';
} else if (state.attributes.icon) {
return state.attributes.icon;
}