Skip to content

Commit 90fc086

Browse files
authored
Update fast-search-card.js
1 parent ab66180 commit 90fc086

File tree

1 file changed

+29
-20
lines changed

1 file changed

+29
-20
lines changed

dist/fast-search-card.js

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12449,43 +12449,52 @@ class FastSearchCard extends HTMLElement {
1244912449
}
1245012450
}
1245112451

12452-
// 🎤 SMART TTS EXECUTION (Erweiterte Service-Liste)
12452+
// in der FastSearchCard-Klasse
12453+
1245312454
async executeSmartTTS(text, entityId) {
12454-
// 🎯 Priorisierte TTS-Services (beste Qualität zuerst)
12455+
// 🎯 Music Assistant als primären Service für MA-Player verwenden
12456+
if (entityId.includes('music_assistant') || entityId.includes('ma_')) {
12457+
try {
12458+
console.log('🎤 Attempting TTS via Music Assistant...');
12459+
await this._hass.callService('music_assistant', 'say', {
12460+
entity_id: entityId,
12461+
message: text,
12462+
// Optional: Die Lautstärke während der Ansage anpassen
12463+
// volume_level: 0.8
12464+
});
12465+
console.log('✅ TTS successful with: music_assistant.say');
12466+
return 'music_assistant.say'; // Erfolgreich, Funktion beenden
12467+
} catch (error) {
12468+
console.warn(`❌ Music Assistant TTS failed, trying standard TTS...`, error);
12469+
// Wenn MA fehlschlägt, fahren wir mit den Standard-Diensten fort
12470+
}
12471+
}
12472+
12473+
// Fallback: Die bestehende Logik für alle anderen Player
1245512474
const ttsServices = [
12456-
'amazon_polly_say', // Primär: Beste Qualität
12457-
'music_assistant_say', // Music Assistant Integration
12458-
'cloud_say', // Nabu Casa
12459-
'google_translate_say', // Google Translate
12460-
'edge_tts_say', // Microsoft Edge
12461-
'piper_say', // Piper Local
12462-
'google_say', // Google Cloud (falls verfügbar)
12463-
'festival_say' // Festival (Fallback)
12475+
'amazon_polly_say',
12476+
'cloud_say',
12477+
'google_translate_say',
12478+
'edge_tts_say',
12479+
'piper_say',
1246412480
];
1246512481

1246612482
for (const [index, service] of ttsServices.entries()) {
12467-
// 🚫 Abbruch-Check
1246812483
if (this.ttsAbortController?.signal.aborted) {
1246912484
throw new Error('TTS aborted');
1247012485
}
12471-
1247212486
try {
1247312487
console.log(`🎤 Attempting TTS ${index + 1}/${ttsServices.length}: ${service}...`);
12474-
1247512488
await this._hass.callService('tts', service, {
1247612489
entity_id: entityId,
1247712490
message: text
1247812491
});
12479-
12480-
console.log(`✅ TTS successful with: ${service}`);
12481-
return service; // Return successful service
12482-
12492+
console.log(`✅ TTS successful with: ${service}`);
12493+
return service;
1248312494
} catch (error) {
1248412495
console.warn(`❌ TTS ${service} failed:`, error);
12485-
12486-
// Bei letztem Service: Error werfen
1248712496
if (index === ttsServices.length - 1) {
12488-
throw new Error('All TTS services failed');
12497+
throw new Error('All standard TTS services failed');
1248912498
}
1249012499
}
1249112500
}

0 commit comments

Comments
 (0)