Skip to content

Commit 7a656eb

Browse files
authored
Update fast-search-card.js
1 parent 92593cb commit 7a656eb

File tree

1 file changed

+50
-80
lines changed

1 file changed

+50
-80
lines changed

dist/fast-search-card.js

Lines changed: 50 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -7025,47 +7025,39 @@ class FastSearchCard extends HTMLElement {
70257025
70267026
<!-- Zeitplan Controls -->
70277027
<div class="schedule-control-design" id="schedule-control-${item.id}">
7028-
<!-- Zeitplan Action Presets -->
70297028
<div class="timer-control-presets schedule-action-presets visible" data-is-open="true">
7029+
<!-- Zeitplan Action Presets -->
7030+
70307031
<div class="timer-control-presets-grid">
7031-
<button class="timer-control-preset" data-action="schedule_daily" title="Täglich">
7032+
<button class="timer-control-preset" data-action="turn_off" title="Ausschalten">
70327033
<svg width="24px" height="24px" stroke-width="1" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" color="currentColor">
7033-
<path d="M8 2V5" stroke="currentColor" stroke-linecap="round"/>
7034-
<path d="M16 2V5" stroke="currentColor" stroke-linecap="round"/>
7035-
<path d="M3 8H21" stroke="currentColor" stroke-linecap="round"/>
7036-
<path d="M3 7C3 5.89543 3.89543 5 5 5H19C20.1046 5 21 5.89543 21 7V19C21 20.1046 20.1046 21 19 21H5C3.89543 21 3 20.1046 3 19V7Z" stroke="currentColor"/>
7034+
<path d="M7 13C7.55228 13 8 12.5523 8 12C8 11.4477 7.55228 11 7 11C6.44772 11 6 11.4477 6 12C6 12.5523 6.44772 13 7 13Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
7035+
<path d="M17 13C17.5523 13 18 12.5523 18 12C18 11.4477 17.5523 11 17 11C16.4477 11 16 11.4477 16 12C16 12.5523 16.4477 13 17 13Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
7036+
<path d="M12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3Z" stroke="currentColor"/>
70377037
</svg>
7038-
<span class="timer-preset-label">Täglich</span>
7038+
<span class="timer-preset-label">Aus</span>
70397039
</button>
7040-
<button class="timer-control-preset" data-action="schedule_weekly" title="Wöchentlich">
7040+
<button class="timer-control-preset" data-action="turn_on" title="Einschalten">
70417041
<svg width="24px" height="24px" stroke-width="1" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" color="currentColor">
7042-
<path d="M8 2V5" stroke="currentColor" stroke-linecap="round"/>
7043-
<path d="M16 2V5" stroke="currentColor" stroke-linecap="round"/>
7044-
<path d="M3 8H21" stroke="currentColor" stroke-linecap="round"/>
7045-
<path d="M3 7C3 5.89543 3.89543 5 5 5H19C20.1046 5 21 5.89543 21 7V19C21 20.1046 20.1046 21 19 21H5C3.89543 21 3 20.1046 3 19V7Z" stroke="currentColor"/>
7046-
<path d="M7 12H17" stroke="currentColor" stroke-linecap="round"/>
7042+
<path d="M21 2L9 14L4 9" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
7043+
<circle cx="12" cy="12" r="9" stroke="currentColor"/>
70477044
</svg>
7048-
<span class="timer-preset-label">Wöchentlich</span>
7045+
<span class="timer-preset-label">Ein</span>
70497046
</button>
7050-
<button class="timer-control-preset" data-action="schedule_weekdays" title="Werktags">
7047+
<button class="timer-control-preset" data-action="dim_30" title="Dimmen 30%">
70517048
<svg width="24px" height="24px" stroke-width="1" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" color="currentColor">
7052-
<path d="M8 2V5" stroke="currentColor" stroke-linecap="round"/>
7053-
<path d="M16 2V5" stroke="currentColor" stroke-linecap="round"/>
7054-
<path d="M3 8H21" stroke="currentColor" stroke-linecap="round"/>
7055-
<path d="M3 7C3 5.89543 3.89543 5 5 5H19C20.1046 5 21 5.89543 21 7V19C21 20.1046 20.1046 21 19 21H5C3.89543 21 3 20.1046 3 19V7Z" stroke="currentColor"/>
7056-
<path d="M9 15H15" stroke="currentColor" stroke-linecap="round"/>
7049+
<path d="M12 18C15.3137 18 18 15.3137 18 12C18 8.68629 15.3137 6 12 6C8.68629 6 6 8.68629 6 12C6 15.3137 8.68629 18 12 18Z" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"/>
70577050
</svg>
7058-
<span class="timer-preset-label">Werktags</span>
7051+
<span class="timer-preset-label">30%</span>
70597052
</button>
7060-
<button class="timer-control-preset" data-action="schedule_custom" title="Benutzerdefiniert">
7053+
<button class="timer-control-preset" data-action="dim_50" title="Dimmen 50%">
70617054
<svg width="24px" height="24px" stroke-width="1" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" color="currentColor">
7062-
<path d="M12 6L12 12L18 12" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
7063-
<path d="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z" stroke="currentColor"/>
7055+
<path d="M12 18C15.3137 18 18 15.3137 18 12C18 8.68629 15.3137 6 12 6C8.68629 6 6 8.68629 6 12C6 15.3137 8.68629 18 12 18Z" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"/>
70647056
</svg>
7065-
<span class="timer-preset-label">Custom</span>
7057+
<span class="timer-preset-label">50%</span>
70667058
</button>
70677059
</div>
7068-
</div>
7060+
</div>
70697061
</div>
70707062
</div>
70717063
</div>
@@ -10750,85 +10742,63 @@ class FastSearchCard extends HTMLElement {
1075010742
container.innerHTML = '<div class="loading-schedules">Lade Zeitpläne...</div>';
1075110743

1075210744
try {
10753-
// Alle Scheduler-Entitäten laden
10745+
// DEBUG: Alle Schedule-Entitäten anzeigen
1075410746
const allEntities = this._hass.states;
10755-
const scheduleEntities = Object.keys(allEntities)
10747+
const allSchedules = Object.keys(allEntities)
1075610748
.filter(key => key.startsWith('switch.schedule_'))
10757-
.map(key => allEntities[key])
10758-
.filter(entity => {
10759-
// Filter nach unserem Entity
10760-
const actions = entity.attributes.actions || [];
10761-
return actions.some(action => action.entity_id === entityId);
10762-
});
10763-
10764-
console.log(`📋 Gefundene Zeitpläne für ${entityId}:`, scheduleEntities.length);
10749+
.map(key => allEntities[key]);
1076510750

10766-
if (scheduleEntities.length === 0) {
10767-
container.innerHTML = '<div class="no-schedules">Keine aktiven Zeitpläne</div>';
10751+
console.log('🔍 DEBUG: Alle Schedule-Entitäten:', allSchedules);
10752+
console.log('🔍 DEBUG: Suche nach entityId:', entityId);
10753+
10754+
// DEBUG: Erste Schedule-Entität genauer anschauen
10755+
if (allSchedules.length > 0) {
10756+
console.log('🔍 DEBUG: Erste Schedule Attributes:', allSchedules[0].attributes);
10757+
console.log('🔍 DEBUG: Erste Schedule Timeslots:', allSchedules[0].attributes.timeslots);
10758+
console.log('🔍 DEBUG: Erste Schedule Actions in Timeslot:',
10759+
allSchedules[0].attributes.timeslots?.[0]?.actions);
10760+
}
10761+
10762+
// DEBUG: Einfache Anzeige ALLER Schedules (erstmal ohne Filter)
10763+
if (allSchedules.length === 0) {
10764+
container.innerHTML = '<div class="no-schedules">❌ Keine Zeitpläne im System gefunden</div>';
1076810765
return;
1076910766
}
1077010767

10771-
// Zeitpläne in UI rendern
10772-
const schedulesHTML = scheduleEntities.map(schedule => {
10773-
const isEnabled = schedule.state === 'on';
10774-
const nextTrigger = schedule.attributes.next_trigger;
10775-
const weekdays = schedule.attributes.weekdays || [];
10768+
// DEBUG: Zeige alle Schedules mit Details
10769+
const debugHTML = allSchedules.map((schedule, index) => {
1077610770
const timeslots = schedule.attributes.timeslots || [];
10777-
const scheduleName = schedule.attributes.friendly_name || schedule.entity_id;
10778-
10779-
// Erste Timeslot für Anzeige verwenden
1078010771
const firstTimeslot = timeslots[0];
10781-
const timeString = firstTimeslot ? firstTimeslot.start : 'Unbekannt';
10772+
const actions = firstTimeslot?.actions || [];
1078210773

1078310774
return `
10784-
<div class="schedule-item ${isEnabled ? 'enabled' : 'disabled'}" data-entity-id="${schedule.entity_id}">
10775+
<div class="schedule-item" style="border: 2px solid #007AFF; margin: 10px 0; padding: 10px;">
1078510776
<div class="schedule-info">
10786-
<div class="schedule-main">
10787-
<span class="schedule-name">${scheduleName}</span>
10788-
<span class="schedule-time">${timeString}</span>
10789-
</div>
10790-
<div class="schedule-details">
10791-
<span class="schedule-days">${this.formatWeekdays(weekdays)}</span>
10792-
${nextTrigger ? `<span class="schedule-next">Nächste: ${this.formatNextTrigger(nextTrigger)}</span>` : ''}
10793-
</div>
10794-
</div>
10795-
<div class="schedule-controls">
10796-
<button class="schedule-toggle-btn" data-action="toggle" title="${isEnabled ? 'Deaktivieren' : 'Aktivieren'}">
10797-
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
10798-
${isEnabled ?
10799-
'<path d="M6 18L18 6M6 6l12 12"/>' :
10800-
'<polyline points="20,6 9,17 4,12"/>'
10801-
}
10802-
</svg>
10803-
</button>
10804-
<button class="schedule-delete-btn" data-action="delete" title="Löschen">
10805-
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
10806-
<polyline points="3,6 5,6 21,6"/>
10807-
<path d="m19,6v14a2,2 0 0,1-2,2H7a2,2 0 0,1-2-2V6m3,0V4a2,2 0 0,1,2-2h4a2,2 0 0,1,2,2v2"/>
10808-
<line x1="10" y1="11" x2="10" y2="17"/>
10809-
<line x1="14" y1="11" x2="14" y2="17"/>
10810-
</svg>
10811-
</button>
10777+
<div><strong>Schedule ${index + 1}:</strong> ${schedule.attributes.friendly_name || schedule.entity_id}</div>
10778+
<div><strong>State:</strong> ${schedule.state}</div>
10779+
<div><strong>Weekdays:</strong> ${JSON.stringify(schedule.attributes.weekdays)}</div>
10780+
<div><strong>Time:</strong> ${firstTimeslot?.start || 'Unbekannt'}</div>
10781+
<div><strong>Actions:</strong> ${JSON.stringify(actions)}</div>
10782+
<div><strong>Target Entity:</strong> ${actions.map(a => a.entity_id).join(', ')}</div>
10783+
<div><strong>Matches ${entityId}?</strong> ${actions.some(a => a.entity_id === entityId) ? '✅ JA' : '❌ NEIN'}</div>
1081210784
</div>
1081310785
</div>
1081410786
`;
1081510787
}).join('');
1081610788

1081710789
container.innerHTML = `
1081810790
<div class="schedules-header">
10819-
<h4>Aktive Zeitpläne (${scheduleEntities.length})</h4>
10791+
<h4>🔍 DEBUG: Alle Zeitpläne (${allSchedules.length})</h4>
10792+
<p style="font-size: 12px; color: #666;">Suche nach: ${entityId}</p>
1082010793
</div>
1082110794
<div class="schedules-list">
10822-
${schedulesHTML}
10795+
${debugHTML}
1082310796
</div>
1082410797
`;
1082510798

10826-
// Event Listeners für Schedule Controls
10827-
this.setupScheduleControlEvents(container, entityId);
10828-
1082910799
} catch (error) {
1083010800
console.error('❌ Fehler beim Laden der Zeitpläne:', error);
10831-
container.innerHTML = '<div class="schedules-error">Fehler beim Laden der Zeitpläne</div>';
10801+
container.innerHTML = `<div class="schedules-error">Fehler: ${error.message}</div>`;
1083210802
}
1083310803
}
1083410804

0 commit comments

Comments
 (0)