@@ -12297,21 +12297,56 @@ class FastSearchCard extends HTMLElement {
1229712297 }
1229812298
1229912299 speakTTS(text, entityId) {
12300- console.log(`🗣️ Speaking via Amazon Polly : "${text}" on ${entityId}`);
12300+ console.log(`🗣️ Speaking: "${text}" on ${entityId}`);
1230112301
1230212302 try {
12303+ // Versuche zuerst Amazon Polly
1230312304 this._hass.callService('tts', 'amazon_polly_say', {
1230412305 entity_id: entityId,
1230512306 message: text
1230612307 });
1230712308
1230812309 this.updateTTSButtonState('speaking');
12310+ console.log('✅ Amazon Polly TTS called');
1230912311
1231012312 } catch (error) {
12311- console.error('❌ TTS Amazon Polly failed:', error);
12312- this.updateTTSButtonState('error');
12313+ console.warn('⚠️ Amazon Polly failed, trying fallback TTS:', error);
12314+
12315+ // Fallback zu Standard TTS Services
12316+ this.tryFallbackTTS(text, entityId);
1231312317 }
1231412318 }
12319+
12320+ // Fallback TTS Services
12321+ async tryFallbackTTS(text, entityId) {
12322+ const fallbackServices = [
12323+ 'tts.cloud_say', // Nabu Casa
12324+ 'tts.google_translate_say', // Google Translate
12325+ 'tts.piper_say', // Piper
12326+ 'tts.edge_tts_say' // Microsoft Edge
12327+ ];
12328+
12329+ for (const service of fallbackServices) {
12330+ try {
12331+ await this._hass.callService('tts', service.split('.')[1], {
12332+ entity_id: entityId,
12333+ message: text
12334+ });
12335+
12336+ this.updateTTSButtonState('speaking');
12337+ console.log(`✅ Fallback TTS successful: ${service}`);
12338+ return;
12339+
12340+ } catch (error) {
12341+ console.warn(`❌ ${service} failed:`, error);
12342+ continue;
12343+ }
12344+ }
12345+
12346+ // Alle Services fehlgeschlagen
12347+ console.error('❌ All TTS services failed');
12348+ this.updateTTSButtonState('error');
12349+ }
1231512350
1231612351 updateTTSButtonState(state) {
1231712352 // Finde den aktuell aktiven TTS Button
0 commit comments