From 240374370125622614d9c06d52e4319f60ff4f84 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 26 Aug 2020 17:34:00 +0200 Subject: [PATCH] Fix more info media player dropdowns (#6712) --- .../more-info/controls/more-info-media_player.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/dialogs/more-info/controls/more-info-media_player.ts b/src/dialogs/more-info/controls/more-info-media_player.ts index 0bdcc97fd8..0e7a445c0b 100644 --- a/src/dialogs/more-info/controls/more-info-media_player.ts +++ b/src/dialogs/more-info/controls/more-info-media_player.ts @@ -174,7 +174,7 @@ class MoreInfoMediaPlayer extends LitElement { > ${stateObj.attributes.sound_mode_list.map( (mode) => html` - ${mode} + ${mode} ` )} @@ -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, }); }