fixed select input (#51)
the event was fired too often, so the source was always reset https://github.com/home-assistant/home-assistant/issues/1874
This commit is contained in:
parent
25a7759be0
commit
6a8e6a5a08
|
@ -73,7 +73,7 @@
|
|||
on-change='volumeSliderChanged' class='flex'>
|
||||
</paper-slider>
|
||||
</div>
|
||||
<div class='controls layout horizontal justified' hidden$='[[!supportsSelectSource]]'>
|
||||
<div class='controls layout horizontal justified' hidden$='[[!computeHideSelectSource(isOff, supportsSelectSource)]]'>
|
||||
<iron-icon class="source-input" icon="mdi:login-variant"></iron-icon>
|
||||
<paper-dropdown-menu class="source-input" label-float label='Source'>
|
||||
<paper-menu class="dropdown-content" selected="{{sourceIndex}}">
|
||||
|
|
|
@ -108,7 +108,6 @@ export default new Polymer({
|
|||
this.volumeSliderValue = newVal.attributes.volume_level * 100;
|
||||
this.isMuted = newVal.attributes.is_volume_muted;
|
||||
this.source = newVal.attributes.source;
|
||||
this.sourceIndex = 0;
|
||||
this.supportsPause = (newVal.attributes.supported_media_commands & 1) !== 0;
|
||||
this.supportsVolumeSet = (newVal.attributes.supported_media_commands & 4) !== 0;
|
||||
this.supportsVolumeMute = (newVal.attributes.supported_media_commands & 8) !== 0;
|
||||
|
@ -158,6 +157,10 @@ export default new Polymer({
|
|||
return isOff ? !supportsTurnOn : !supportsTurnOff;
|
||||
},
|
||||
|
||||
computeHideSelectSource(isOff, supportsSelectSource) {
|
||||
return !isOff && supportsSelectSource;
|
||||
},
|
||||
|
||||
computeSelectedSource(stateObj) {
|
||||
return stateObj.attributes.source_list.indexOf(stateObj.attributes.source);
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue