Skip to content

Commit 2fdde8c

Browse files
authored
Update fast-search-card.js
1 parent 3bd42e7 commit 2fdde8c

File tree

1 file changed

+18
-24
lines changed

1 file changed

+18
-24
lines changed

dist/fast-search-card.js

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9575,47 +9575,41 @@ class FastSearchCard extends HTMLElement {
95759575
}
95769576

95779577

9578+
95789579
async loadActiveTimers(entityId) {
9580+
console.log('🔍 DEBUG: loadActiveTimers aufgerufen für:', entityId);
9581+
95799582
const container = this.shadowRoot.getElementById(`active-timers-${entityId}`);
95809583
if (!container) return;
95819584

95829585
container.innerHTML = '<div class="loading-timers">Lade Timer...</div>';
95839586

95849587
try {
9585-
// KORRIGIERT: Verwende die richtige API
95869588
const allSchedules = await this._hass.callWS({
9587-
type: 'scheduler' // ← Das war der Fehler!
9589+
type: 'scheduler'
95889590
});
95899591

95909592
console.log('📋 Alle Scheduler Items (korrekte API):', allSchedules);
95919593

9592-
// Filter für diese Entity UND nur echte Timer (keine Wochentage)
9593-
const entityTimers = allSchedules.filter(schedule => {
9594-
// Prüfe ob diese Entity in den timeslots/actions vorkommt
9595-
const belongsToEntity = schedule.timeslots && schedule.timeslots.some(slot =>
9596-
slot.actions && slot.actions.some(action => action.entity_id === entityId)
9597-
);
9598-
// Timer = einmalige Ausführung (erkennt man am Namen oder fehlendem repeat_type)
9599-
const isTimer = !schedule.weekdays ||
9600-
schedule.weekdays.length === 0 ||
9601-
(schedule.name && schedule.name.includes('min)')) || // Timer haben oft "(30min)" im Namen
9602-
schedule.repeat_type === 'once' ||
9603-
!schedule.repeat_type;
9604-
// DEBUG: Zeige alle relevanten Schedules
9605-
if (belongsToEntity) {
9606-
console.log(`🔍 TIMER DEBUG - Schedule: ${schedule.name}, weekdays: ${JSON.stringify(schedule.weekdays)}, isTimer: ${isTimer}`);
9607-
}
9608-
9609-
return belongsToEntity && isTimer;
9610-
});
9594+
// ... Filter-Code bleibt gleich ...
96119595

96129596
console.log(`🎯 Timer für ${entityId}:`, entityTimers);
96139597

9614-
// NEU: Timer zwischenspeichern für Edit-Fallback
96159598
this.lastLoadedTimers = entityTimers;
96169599

9617-
// KORRIGIERT: Verwende renderActiveTimers (die existierende Funktion)
9618-
this.renderActiveTimers(entityTimers, entityId);
9600+
console.log('🔍 DEBUG: Rufe renderActiveTimers auf...');
9601+
console.log('🔍 DEBUG: this.renderActiveTimers existiert?', typeof this.renderActiveTimers);
9602+
9603+
// Prüfen ob die Funktion existiert
9604+
if (typeof this.renderActiveTimers === 'function') {
9605+
this.renderActiveTimers(entityTimers, entityId);
9606+
} else {
9607+
console.error('❌ renderActiveTimers Funktion existiert nicht!');
9608+
// Fallback - direkt HTML setzen
9609+
container.innerHTML = entityTimers.length > 0
9610+
? `<div class="no-timers">${entityTimers.length} Timer gefunden</div>`
9611+
: '<div class="no-timers">Keine aktiven Timer</div>';
9612+
}
96199613

96209614
} catch (error) {
96219615
console.error('❌ Fehler beim Laden der Timer:', error);

0 commit comments

Comments
 (0)