frontend/js/common/entity/cover_icon.js
Paulus Schoutsen 912969111f
Move all of hassUtil to JS (#1153)
* Move all of hassUtil to JS

* Fix tests
2018-05-09 21:33:31 -04:00

13 lines
373 B
JavaScript

/** Return an icon representing a cover state. */
import domainIcon from './domain_icon.js';
export default function coverIcon(state) {
var open = state.state && state.state !== 'closed';
switch (state.attributes.device_class) {
case 'garage':
return open ? 'mdi:garage-open' : 'mdi:garage';
default:
return domainIcon('cover', state.state);
}
}