@@ -3875,6 +3875,78 @@ class FastSearchCard extends HTMLElement {
38753875 background: #1d4ed8;
38763876 }
38773877
3878+ .tts-content {
3879+ padding: 16px !important;
3880+ }
3881+
3882+ .tts-input-section {
3883+ display: flex;
3884+ flex-direction: column;
3885+ gap: 12px;
3886+ }
3887+
3888+ .tts-header {
3889+ display: flex;
3890+ justify-content: space-between;
3891+ align-items: center;
3892+ }
3893+
3894+ .tts-title {
3895+ font-size: 14px;
3896+ font-weight: 600;
3897+ color: var(--text-primary);
3898+ }
3899+
3900+ .tts-counter {
3901+ font-size: 12px;
3902+ color: var(--text-secondary);
3903+ }
3904+
3905+ .tts-counter.warning {
3906+ color: #FF9800;
3907+ }
3908+
3909+ .tts-textarea {
3910+ background: rgba(255,255,255,0.08);
3911+ border: 1px solid rgba(255,255,255,0.15);
3912+ border-radius: 12px;
3913+ padding: 12px;
3914+ color: var(--text-primary);
3915+ font-size: 14px;
3916+ resize: vertical;
3917+ min-height: 80px;
3918+ }
3919+
3920+ .tts-textarea:focus {
3921+ outline: none;
3922+ border-color: var(--accent);
3923+ }
3924+
3925+ .tts-speak-btn {
3926+ display: flex;
3927+ align-items: center;
3928+ justify-content: center;
3929+ gap: 8px;
3930+ padding: 12px 24px;
3931+ background: var(--accent);
3932+ border: none;
3933+ border-radius: 12px;
3934+ color: white;
3935+ font-weight: 600;
3936+ cursor: pointer;
3937+ transition: all 0.2s ease;
3938+ }
3939+
3940+ .tts-speak-btn:disabled {
3941+ background: rgba(255,255,255,0.1);
3942+ color: var(--text-secondary);
3943+ cursor: not-allowed;
3944+ }
3945+
3946+ .tts-speak-btn:not(:disabled):hover {
3947+ transform: translateY(-1px);
3948+ box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
3949+ }
38783950
38793951 </style>
38803952
@@ -10679,6 +10751,15 @@ class FastSearchCard extends HTMLElement {
1067910751 mediaContainer,
1068010752 '.device-control-presets.tts-presets'
1068110753 );
10754+
10755+ // ✅ NEU: Setup TTS Event Listeners nach dem Öffnen
10756+ setTimeout(() => {
10757+ const ttsContainer = mediaContainer.querySelector('.device-control-presets.tts-presets');
10758+ if (ttsContainer && ttsContainer.classList.contains('visible')) {
10759+ this.setupTTSEventListeners(item, ttsContainer);
10760+ }
10761+ }, 100);
10762+
1068210763 }, 400); // Warte auf Schließ-Animation
1068310764 } else {
1068410765 // Öffne TTS direkt (kein Music Assistant offen)
@@ -10687,6 +10768,14 @@ class FastSearchCard extends HTMLElement {
1068710768 mediaContainer,
1068810769 '.device-control-presets.tts-presets'
1068910770 );
10771+
10772+ // ✅ NEU: Setup TTS Event Listeners nach dem Öffnen
10773+ setTimeout(() => {
10774+ const ttsContainer = mediaContainer.querySelector('.device-control-presets.tts-presets');
10775+ if (ttsContainer && ttsContainer.classList.contains('visible')) {
10776+ this.setupTTSEventListeners(item, ttsContainer);
10777+ }
10778+ }, 100);
1069010779 }
1069110780 });
1069210781 }
@@ -10727,6 +10816,29 @@ class FastSearchCard extends HTMLElement {
1072710816 break;
1072810817 }
1072910818 }
10819+
10820+ // ✅ NEU: TTS Service Call Function
10821+ speakTTS(text, entityId) {
10822+ console.log(`🗣️ Speaking via Amazon Polly: "${text}" on ${entityId}`);
10823+
10824+ try {
10825+ this._hass.callService('tts', 'amazon_polly_say', {
10826+ entity_id: entityId,
10827+ message: text,
10828+ options: {
10829+ voice: 'Marlene',
10830+ language: 'de-DE'
10831+ }
10832+ });
10833+
10834+ // Button Status Update
10835+ this.updateTTSButtonState('speaking');
10836+
10837+ } catch (error) {
10838+ console.error('❌ TTS Amazon Polly failed:', error);
10839+ this.updateTTSButtonState('error');
10840+ }
10841+ }
1073010842
1073110843 getMediaPlayerControlsHTML(item) {
1073210844 const state = this._hass.states[item.id];
@@ -12974,8 +13086,41 @@ class FastSearchCard extends HTMLElement {
1297413086 console.error("Fehler beim Abspielen via Music Assistant:", e);
1297513087 }
1297613088 }
13089+
13090+
13091+ getTTSHTML() {
13092+ return `
13093+ <div class="preset-content tts-content">
13094+ <div class="tts-input-section">
13095+ <div class="tts-header">
13096+ <span class="tts-title">🗣️ Text-to-Speech</span>
13097+ <span class="tts-counter">0/300</span>
13098+ </div>
13099+ <textarea
13100+ class="tts-textarea"
13101+ placeholder="Text eingeben... (max. 300 Zeichen)"
13102+ maxlength="300"
13103+ rows="4"></textarea>
13104+ <button class="tts-speak-btn" disabled>
13105+ <span class="tts-btn-icon">▶️</span>
13106+ <span class="tts-btn-text">Sprechen</span>
13107+ </button>
13108+ </div>
13109+ </div>
13110+ `;
13111+ }
13112+
13113+
13114+
13115+
13116+
13117+
13118+
1297713119}
1297813120
13121+
13122+
13123+
1297913124customElements.define('fast-search-card', FastSearchCard);
1298013125window.customCards = window.customCards || [];
1298113126window.customCards.push({
0 commit comments