@@ -7549,16 +7549,22 @@ class FastSearchCard extends HTMLElement {
75497549
75507550 this . setupTimeSelectionEvents ( item , action , timeSelectionContainer , container ) ;
75517551 }
7552-
7553- getActionLabel ( action ) {
7554- const labels = {
7552+
7553+ getActionLabel ( actionString ) {
7554+ const actionLabels = {
75557555 'turn_off' : '🔴 Ausschalten' ,
75567556 'turn_on' : '💡 Einschalten' ,
75577557 'dim_30' : '🌙 Dimmen 30%' ,
7558- 'dim_50' : '🌗 Dimmen 50%'
7558+ 'dim_50' : '🌗 Dimmen 50%' ,
7559+ 'toggle' : '🔄 Umschalten' ,
7560+ 'light.turn_on' : '💡 Einschalten' ,
7561+ 'light.turn_off' : '💡 Ausschalten' ,
7562+ 'switch.turn_on' : '🔌 Einschalten' ,
7563+ 'switch.turn_off' : '🔌 Ausschalten'
75597564 } ;
7560- return labels [ action ] || action ;
7561- }
7565+
7566+ return actionLabels [ actionString ] || actionString || 'Aktion' ;
7567+ }
75627568
75637569 expandTimeSelection ( timeContainer , parentContainer ) {
75647570 console . log ( '🎬 Expanding Time Selection - NEW VERSION' ) ;
@@ -10897,9 +10903,25 @@ class FastSearchCard extends HTMLElement {
1089710903 timeString = timeMatch ? timeMatch [ 1 ] : firstTimeslot ;
1089810904 }
1089910905
10900- // Action für diese Entity finden
10906+ // Action für diese Entity finden - KORRIGIERT
1090110907 const entityIndex = entities . indexOf ( entityId ) ;
10902- const actionForEntity = entityIndex >= 0 ? actions [ entityIndex ] : 'Unbekannt' ;
10908+ let actionForEntity = 'Unbekannt' ;
10909+ if ( entityIndex >= 0 && actions [ entityIndex ] ) {
10910+ const action = actions [ entityIndex ] ;
10911+ console . log ( '🔍 DEBUG Action Object:' , action ) ; // Debug-Zeile
10912+
10913+ if ( typeof action === 'string' ) {
10914+ actionForEntity = this . getActionLabel ( action ) ; // Verwende deine Funktion
10915+ } else if ( action . service ) {
10916+ // Service aus Object extrahieren (z.B. "light.turn_on" -> "turn_on")
10917+ const serviceAction = action . service . split ( '.' ) . pop ( ) ;
10918+ actionForEntity = this . getActionLabel ( serviceAction ) ;
10919+ } else if ( action . action ) {
10920+ actionForEntity = this . getActionLabel ( action . action ) ;
10921+ } else {
10922+ actionForEntity = 'Aktion' ;
10923+ }
10924+ }
1090310925
1090410926 return `
1090510927 <div class="schedule-item ${ isEnabled ? 'enabled' : 'disabled' } " data-entity-id="${ schedule . entity_id } ">
0 commit comments