From 5973dd41715f7aca1bd03cdc0aa6625afb34c94a Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Mon, 12 Oct 2015 23:38:29 -0700 Subject: [PATCH] Scenes can can no longer be toggled --- src/cards/ha-domain-card.js | 3 ++- .../entity/ha-state-label-badge.html | 6 ++++- src/components/entity/ha-state-label-badge.js | 8 +++---- src/components/ha-label-badge.html | 1 + src/dialogs/more-info-dialog.js | 2 +- src/state-summary/state-card-scene.html | 23 ++++++++++++------- src/state-summary/state-card-scene.js | 16 +++++-------- src/state-summary/state-card.js | 2 +- 8 files changed, 34 insertions(+), 27 deletions(-) diff --git a/src/cards/ha-domain-card.js b/src/cards/ha-domain-card.js index 6ab1449480..40226da0f1 100644 --- a/src/cards/ha-domain-card.js +++ b/src/cards/ha-domain-card.js @@ -26,7 +26,8 @@ export default new Polymer({ }, entityTapped(ev) { - if (ev.target.classList.contains('paper-toggle-button')) { + if (ev.target.classList.contains('paper-toggle-button') || + ev.target.classList.contains('paper-icon-button')) { return; } ev.stopPropagation(); diff --git a/src/components/entity/ha-state-label-badge.html b/src/components/entity/ha-state-label-badge.html index 1b5567200c..1fd0465382 100644 --- a/src/components/entity/ha-state-label-badge.html +++ b/src/components/entity/ha-state-label-badge.html @@ -13,7 +13,11 @@ } .blue { - --ha-label-badge-color: #039be5; + --ha-label-badge-color: #039be5; + } + + .green { + --ha-label-badge-color: #0DA035; } .grey { diff --git a/src/components/entity/ha-state-label-badge.js b/src/components/entity/ha-state-label-badge.js index bbfe6ce535..989abc44a0 100644 --- a/src/components/entity/ha-state-label-badge.js +++ b/src/components/entity/ha-state-label-badge.js @@ -28,11 +28,8 @@ export default new Polymer({ this.async(() => moreInfoActions.selectEntity(this.state.entityId), 1); return; } - if (this.state.domain === 'scene' && this.state.state === 'on' && - !this.state.attributes.active_requested) { - // Scenes that are on but by virtue of other events then itself - // being turned on cannot be turned off. - return; + if (this.state.domain === 'scene') { + serviceActions.callTurnOn(this.state.entityId); } else if (this.state.state === 'off') { serviceActions.callTurnOn(this.state.entityId); } else { @@ -43,6 +40,7 @@ export default new Polymer({ computeClasses(state) { switch (state.domain) { case 'scene': + return 'green'; case 'script': return state.state === 'on' ? 'blue' : 'grey'; default: diff --git a/src/components/ha-label-badge.html b/src/components/ha-label-badge.html index 835cfd0a88..2b87b7d04a 100644 --- a/src/components/ha-label-badge.html +++ b/src/components/ha-label-badge.html @@ -29,6 +29,7 @@ transition: border .3s ease-in-out; } .label-badge .value { + font-size: 90%; overflow: hidden; text-overflow: ellipsis; } diff --git a/src/dialogs/more-info-dialog.js b/src/dialogs/more-info-dialog.js index 12fde660bf..e7db62ee1c 100644 --- a/src/dialogs/more-info-dialog.js +++ b/src/dialogs/more-info-dialog.js @@ -14,7 +14,7 @@ require('../components/state-history-charts'); require('../more-infos/more-info-content'); // if you don't want the history component to show add the domain to this array -const DOMAINS_WITH_NO_HISTORY = ['camera', 'configurator']; +const DOMAINS_WITH_NO_HISTORY = ['camera', 'configurator', 'scene']; export default new Polymer({ is: 'more-info-dialog', diff --git a/src/state-summary/state-card-scene.html b/src/state-summary/state-card-scene.html index 593e05032f..bb2b443d66 100644 --- a/src/state-summary/state-card-scene.html +++ b/src/state-summary/state-card-scene.html @@ -1,15 +1,22 @@ + - - + + + diff --git a/src/state-summary/state-card-scene.js b/src/state-summary/state-card-scene.js index abb43f8209..8daea5f475 100644 --- a/src/state-summary/state-card-scene.js +++ b/src/state-summary/state-card-scene.js @@ -1,7 +1,7 @@ import Polymer from '../polymer'; +import { serviceActions } from '../util/home-assistant-js-instance'; -require('./state-card-display'); -require('./state-card-toggle'); +require('../components/state-info.js'); export default new Polymer({ is: 'state-card-scene', @@ -10,15 +10,11 @@ export default new Polymer({ stateObj: { type: Object, }, - - allowToggle: { - type: Boolean, - value: false, - computed: 'computeAllowToggle(stateObj)', - }, }, - computeAllowToggle(stateObj) { - return stateObj.state === 'off' || stateObj.attributes.active_requested; + activateScene(ev) { + // ev.preventDefault(); + // ev.stopPropagation(); + serviceActions.callTurnOn(this.stateObj.entityId); }, }); diff --git a/src/state-summary/state-card.js b/src/state-summary/state-card.js index 94180e32c1..e1f82d33e1 100644 --- a/src/state-summary/state-card.js +++ b/src/state-summary/state-card.js @@ -19,6 +19,6 @@ export default new Polymer({ cardTapped(ev) { ev.stopPropagation(); - this.async(() => moreInfoActions.selectEntity(this.stateObj.entityId), 100); + this.async(() => moreInfoActions.selectEntity(this.stateObj.entityId), 1); }, });