Fix more info media player dropdowns (#6712)

This commit is contained in:
Bram Kragten 2020-08-26 17:34:00 +02:00 committed by GitHub
parent 3e6a759309
commit 2403743701
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -174,7 +174,7 @@ class MoreInfoMediaPlayer extends LitElement {
>
${stateObj.attributes.sound_mode_list.map(
(mode) => html`
<paper-item itemName=${mode}>${mode}</paper-item>
<paper-item .itemName=${mode}>${mode}</paper-item>
`
)}
</paper-listbox>
@ -352,21 +352,27 @@ class MoreInfoMediaPlayer extends LitElement {
}
private _handleSourceChanged(e: CustomEvent) {
const newVal = e.detail.value;
const newVal = e.detail.item.itemName;
if (!newVal || this.stateObj!.attributes.source === newVal) return;
if (!newVal || this.stateObj!.attributes.source === newVal) {
return;
}
this.hass.callService("media_player", "select_source", {
entity_id: this.stateObj!.entity_id,
source: newVal,
});
}
private _handleSoundModeChanged(e: CustomEvent) {
const newVal = e.detail.value;
const newVal = e.detail.item.itemName;
if (!newVal || this.stateObj?.attributes.sound_mode === newVal) return;
if (!newVal || this.stateObj?.attributes.sound_mode === newVal) {
return;
}
this.hass.callService("media_player", "select_sound_mode", {
entity_id: this.stateObj!.entity_id,
sound_mode: newVal,
});
}