Skip to content

Commit 764bfe6

Browse files
authored
Update fast-search-card.js
1 parent c9534a4 commit 764bfe6

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

dist/fast-search-card.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12521,6 +12521,8 @@ class FastSearchCard extends HTMLElement {
1252112521
async attemptSmartResume(entityId) {
1252212522
if (!this.ttsPlayerWasPlaying || this.ttsPlayerWasPlaying !== entityId) {
1252312523
console.log('⏭️ No auto-resume needed');
12524+
await this.cleanupTTSState(); // 🆕 HINZUGEFÜGT
12525+
this.updateTTSButtonState('ready'); // 🆕 HINZUGEFÜGT
1252412526
return;
1252512527
}
1252612528

@@ -12529,34 +12531,32 @@ class FastSearchCard extends HTMLElement {
1252912531
// 🚫 Sicherheits-Checks
1253012532
if (ttsAge > 60000) { // Nicht nach 1 Minute
1253112533
console.log('⏭️ Skipping auto-resume (too old)');
12534+
await this.cleanupTTSState(); // 🆕 HINZUGEFÜGT
12535+
this.updateTTSButtonState('ready'); // 🆕 HINZUGEFÜGT
1253212536
return;
1253312537
}
1253412538

1253512539
// 🔍 Player-Status Double-Check
1253612540
const currentState = this._hass.states[entityId];
1253712541
if (currentState?.state === 'playing') {
1253812542
console.log('⏭️ Player already playing, no resume needed');
12543+
await this.cleanupTTSState(); // 🆕 HINZUGEFÜGT
12544+
this.updateTTSButtonState('ready'); // 🆕 HINZUGEFÜGT
1253912545
return;
1254012546
}
1254112547

1254212548
try {
12543-
console.log('🎵 Auto-resuming music...');
12544-
1254512549
// 🎯 Verwende smartPlayPause für Resume
12546-
try {
12547-
console.log('🎵 Auto-resuming music...');
12548-
await this.smartPlayPause({ id: entityId });
12549-
console.log(`✅ Resumed using smartPlayPause`);
12550-
} catch (error) {
12551-
console.error('❌ Auto-resume failed:', error);
12552-
}
12553-
12550+
console.log('🎵 Auto-resuming music...');
12551+
await this.smartPlayPause({ id: entityId });
12552+
console.log(`✅ Resumed using smartPlayPause`);
1255412553
} catch (error) {
1255512554
console.error('❌ Auto-resume failed:', error);
1255612555
} finally {
1255712556
await this.cleanupTTSState();
12557+
this.updateTTSButtonState('ready'); // 🆕 HINZUGEFÜGT
1255812558
}
12559-
}
12559+
}
1256012560

1256112561
// 🧹 CLEANUP STATE
1256212562
async cleanupTTSState() {

0 commit comments

Comments
 (0)