Add option to hide the group card switch (#159)

* Add option to hide the group card switch

* Changed hide_switch to control

* lint

* lint again

* Pick state-card-display if control is hidden

* fix permissions
This commit is contained in:
Sebastian von Minckwitz 2016-12-06 02:47:29 +01:00 committed by Paulus Schoutsen
parent 2652823d35
commit 4697af1b0d
2 changed files with 2 additions and 3 deletions

View File

@ -110,7 +110,7 @@ Polymer({
showGroupToggle: function (groupEntity, states) {
var canToggleCount;
if (!groupEntity || !states ||
if (!groupEntity || !states || groupEntity.attributes.control === 'hidden' ||
(groupEntity.state !== 'on' && groupEntity.state !== 'off')) {
return false;
}

View File

@ -163,13 +163,12 @@ window.hassUtil.relativeTime.tests = [
7, 'day',
];
window.hassUtil.stateCardType = function (hass, state) {
if (state.state === 'unavailable') {
return 'display';
} else if (window.hassUtil.DOMAINS_WITH_CARD.indexOf(state.domain) !== -1) {
return state.domain;
} else if (window.hassUtil.canToggle(hass, state.entityId)) {
} else if (window.hassUtil.canToggle(hass, state.entityId) && state.attributes.control !== 'hidden') {
return 'toggle';
}
return 'display';