frontend/js/common/entity/can_toggle_domain.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

12 lines
309 B
JavaScript

export default function canToggleDomain(hass, domain) {
const services = hass.config.services[domain];
if (!services) { return false; }
if (domain === 'lock') {
return 'lock' in services;
} else if (domain === 'cover') {
return 'open_cover' in services;
}
return 'turn_on' in services;
}