Always show the brightness slider in more-info (#168)

* Always show the brightness slider in more-info

Always show the brightness slider in more-info if it is supported.
Even when the light is currently off.

* Lint fix

* Set brightness to 0 when light is off
This commit is contained in:
andrey-git 2017-01-05 23:26:39 +02:00 committed by Paulus Schoutsen
parent 57071f7250
commit 029ed86395

View File

@ -132,6 +132,8 @@ Polymer({
} else {
this.effectIndex = -1;
}
} else {
this.brightnessSliderValue = 0;
}
this.async(function () {
@ -140,9 +142,16 @@ Polymer({
},
computeClassNames: function (stateObj) {
return window.hassUtil.attributeClassNames(
stateObj, ['brightness', 'rgb_color', 'color_temp', 'white_value',
var classes = window.hassUtil.attributeClassNames(
stateObj, ['rgb_color', 'color_temp', 'white_value',
'effect_list']);
var BRIGHTNESS_SUPPORTED = 1;
// If brightness is supported - show the slider even if the attribute is
// missing (because the light is off).
if (stateObj && (stateObj.attributes.supported_features & BRIGHTNESS_SUPPORTED)) {
classes += ' has-brightness';
}
return classes;
},
effectChanged: function (effectIndex) {