@@ -7867,15 +7867,11 @@ class FastSearchCard extends HTMLElement {
78677867 const isOn = !['off', 'unavailable'].includes(state.state);
78687868 this.callClimateService(isOn ? 'turn_off' : 'turn_on', item.id);
78697869 }
7870- break;
7871-
7870+ break;
7871+
78727872 case 'media_player':
78737873 if (action === 'play-pause') {
7874- const state = this.hass.states[item.id];
7875- const isPlaying = state?.state === 'playing';
7876- const service = isPlaying ? 'media_pause' : 'media_play';
7877- console.log(`🎵 Calling: ${service} for ${item.id}, current state: ${state?.state}`);
7878- this.hass.callService('media_player', service, { entity_id: item.id });
7874+ this.callMusicAssistantService('media_play_pause', item.id);
78797875 }
78807876 break;
78817877
@@ -7907,20 +7903,18 @@ class FastSearchCard extends HTMLElement {
79077903 case 'climate':
79087904 button.title = isActive ? 'Ausschalten' : 'Einschalten';
79097905 break;
7910-
7906+
79117907 case 'media_player':
79127908 const isPlaying = state.state === 'playing';
7913- const isUnavailable = ['unavailable', 'unknown', 'off'].includes(state.state);
7914-
79157909 button.classList.toggle('active', isPlaying);
7916- button.disabled = isUnavailable;
7917- button.title = isUnavailable ? 'Nicht verfügbar' : (isPlaying ? 'Pause' : 'Play');
7910+ button.title = isPlaying ? 'Pause' : 'Play';
79187911
7912+ // Update icon
79197913 const playIcon = `<svg width="24" height="24" stroke-width="1.5" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M6.90588 4.53682C6.50592 4.2998 6 4.58808 6 5.05299V18.947C6 19.4119 6.50592 19.7002 6.90588 19.4632L18.629 12.5162C19.0211 12.2838 19.0211 11.7162 18.629 11.4838L6.90588 4.53682Z" stroke="currentColor"></path></svg>`;
79207914 const pauseIcon = `<svg width="24" height="24" stroke-width="1.5" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M6 18.4V5.6C6 5.26863 6.26863 5 6.6 5H9.4C9.73137 5 10 5.26863 10 5.6V18.4C10 18.7314 9.73137 19 9.4 19H6.6C6.26863 19 6 18.7314 6 18.4Z" stroke="currentColor"></path><path d="M14 18.4V5.6C14 5.26863 14.2686 5 14.6 5H17.4C17.7314 5 18 5.26863 18 5.6V18.4C18 18.7314 17.7314 19 17.4 19H14.6C14.2686 19 14 18.7314 14 18.4Z" stroke="currentColor"></path></svg>`;
79217915
79227916 button.innerHTML = isPlaying ? pauseIcon : playIcon;
7923- break;
7917+ break;
79247918
79257919 case 'cover':
79267920 const position = state.attributes.current_position ?? 0;
@@ -11889,19 +11883,14 @@ class FastSearchCard extends HTMLElement {
1188911883 // Update play/pause button
1189011884 const playPauseBtn = mediaContainer.querySelector('[data-action="play-pause"]');
1189111885 if (playPauseBtn) {
11892- playPauseBtn.classList.toggle('active', isPlaying);
11893- playPauseBtn.disabled = ['unavailable', 'unknown', 'off'].includes(state.state);
11886+ playPauseBtn.classList.remove('active');
1189411887 playPauseBtn.title = isPlaying ? 'Pause' : 'Play';
1189511888
11889+ // Update icon
1189611890 const iconHTML = isPlaying ? `
11897- <svg width="48px" height="48px" stroke-width="1" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" color="currentColor">
11898- <path d="M6 18.4V5.6C6 5.26863 6.26863 5 6.6 5H9.4C9.73137 5 10 5.26863 10 5.6V18.4C10 18.7314 9.73137 19 9.4 19H6.6C6.26863 19 6 18.7314 6 18.4Z" stroke="currentColor" stroke-width="1"></path>
11899- <path d="M14 18.4V5.6C14 5.26863 14.2686 5 14.6 5H17.4C17.7314 5 18 5.26863 18 5.6V18.4C18 18.7314 17.7314 19 17.4 19H14.6C14.2686 19 14 18.7314 14 18.4Z" stroke="currentColor" stroke-width="1"></path>
11900- </svg>
11891+ <svg width="48px" height="48px" stroke-width="1" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" color="currentColor"><path d="M6 18.4V5.6C6 5.26863 6.26863 5 6.6 5H9.4C9.73137 5 10 5.26863 10 5.6V18.4C10 18.7314 9.73137 19 9.4 19H6.6C6.26863 19 6 18.7314 6 18.4Z" stroke="currentColor" stroke-width="1"></path><path d="M14 18.4V5.6C14 5.26863 14.2686 5 14.6 5H17.4C17.7314 5 18 5.26863 18 5.6V18.4C18 18.7314 17.7314 19 17.4 19H14.6C14.2686 19 14 18.7314 14 18.4Z" stroke="currentColor" stroke-width="1"></path></svg>
1190111892 ` : `
11902- <svg width="48px" height="48px" stroke-width="1" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" color="currentColor">
11903- <path d="M6.90588 4.53682C6.50592 4.2998 6 4.58808 6 5.05299V18.947C6 19.4119 6.50592 19.7002 6.90588 19.4632L18.629 12.5162C19.0211 12.2838 19.0211 11.7162 18.629 11.4838L6.90588 4.53682Z" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"></path>
11904- </svg>
11893+ <svg width="48px" height="48px" stroke-width="1" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" color="currentColor"><path d="M6.90588 4.53682C6.50592 4.2998 6 4.58808 6 5.05299V18.947C6 19.4119 6.50592 19.7002 6.90588 19.4632L18.629 12.5162C19.0211 12.2838 19.0211 11.7162 18.629 11.4838L6.90588 4.53682Z" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"></path></svg>
1190511894 `;
1190611895 playPauseBtn.innerHTML = iconHTML;
1190711896 }
@@ -12104,16 +12093,7 @@ class FastSearchCard extends HTMLElement {
1210412093 console.log('TTS Button:', ttsBtn);
1210512094
1210612095 if (prevBtn) prevBtn.addEventListener('click', () => this.callMusicAssistantService('media_previous_track', item.id));
12107-
12108- if (playPauseBtn) {
12109- playPauseBtn.setAttribute('data-action', 'play-pause'); // ✅ Das fehlt noch!
12110- playPauseBtn.addEventListener('click', (e) => {
12111- e.preventDefault();
12112- e.stopPropagation();
12113- this.handleQuickAction(item, playPauseBtn); // ✅ Richtige Reihenfolge!
12114- });
12115- }
12116-
12096+ if (playPauseBtn) playPauseBtn.addEventListener('click', () => this.callMusicAssistantService('media_play_pause', item.id));
1211712097 if (nextBtn) nextBtn.addEventListener('click', () => this.callMusicAssistantService('media_next_track', item.id));
1211812098
1211912099 // Music Assistant Toggle
0 commit comments