@@ -9531,22 +9531,17 @@ class FastSearchCard extends HTMLElement {
95319531 }
95329532
95339533 getLightActionData(action) {
9534- // Debug: Was kommt rein?
9535- console.log('🔧 getLightActionData - Action:', action);
9536-
9537- if (action === 'turn_on' || action.includes('Einschalten')) {
9538- return { service: 'light.turn_on', serviceData: {} };
9539- } else if (action === 'turn_off' || action.includes('Ausschalten')) {
9540- return { service: 'light.turn_off', serviceData: {} };
9541- } else if (action === 'dim_30' || action.includes('🌙') || action.includes('Dimmen 30%')) {
9542- console.log('🔧 30% Helligkeit erkannt!');
9543- return { service: 'light.turn_on', serviceData: { brightness_pct: 30 } };
9544- } else if (action === 'dim_50' || action.includes('🌗') || action.includes('Dimmen 50%')) {
9545- console.log('🔧 50% Helligkeit erkannt!');
9546- return { service: 'light.turn_on', serviceData: { brightness_pct: 50 } };
9547- } else {
9548- console.log('🔧 Fallback: turn_off');
9549- return { service: 'light.turn_off', serviceData: {} };
9534+ switch (action) {
9535+ case 'turn_on':
9536+ return { service: 'light.turn_on', serviceData: {} };
9537+ case 'turn_off':
9538+ return { service: 'light.turn_off', serviceData: {} };
9539+ case 'dim_30':
9540+ return { service: 'light.turn_on', serviceData: { brightness_pct: 30 } };
9541+ case 'dim_50':
9542+ return { service: 'light.turn_on', serviceData: { brightness_pct: 50 } };
9543+ default:
9544+ return { service: 'light.turn_off', serviceData: {} };
95509545 }
95519546 }
95529547
@@ -10108,10 +10103,12 @@ class FastSearchCard extends HTMLElement {
1010810103 getPresetIconForAction(action) {
1010910104 console.log('🔍 DEBUG - Action eingegangen:', action);
1011010105
10106+ // Bestimme welche Preset-Funktion und welche Action
1011110107 let presetHTML = '';
1011210108
1011310109 if (action.includes('Einschalten') || action.includes('Ein')) {
10114- presetHTML = this.getLightTimerPresets();
10110+ presetHTML = this.getLightTimerPresets(); // Hole komplettes HTML
10111+ // Extrahiere SVG aus turn_on Button
1011510112 const match = presetHTML.match(/data-action="turn_on"[^>]*>(.*?)<span class="timer-preset-label">/s);
1011610113 if (match) {
1011710114 const svgMatch = match[1].match(/<svg[^>]*>.*?<\/svg>/s);
@@ -10124,23 +10121,37 @@ class FastSearchCard extends HTMLElement {
1012410121 const svgMatch = match[1].match(/<svg[^>]*>.*?<\/svg>/s);
1012510122 return svgMatch ? svgMatch[0].replace('width="24"', 'width="16"').replace('height="24"', 'height="16"') : '';
1012610123 }
10127- } else if (action.includes('🌙') || action.includes('Dimmen 30%')) { // ← GEÄNDERT!
10124+ } else if (action.includes('30%')) {
1012810125 console.log('🔍 30% gefunden!');
1012910126 presetHTML = this.getLightTimerPresets();
10127+ console.log('🔍 PresetHTML Länge:', presetHTML.length);
10128+ console.log('🔍 PresetHTML enthält dim_30:', presetHTML.includes('data-action="dim_30"'));
10129+
1013010130 const match = presetHTML.match(/data-action="dim_30"[^>]*>\s*(.*?)\s*<span class="timer-preset-label">/s);
10131+ console.log('🔍 Match gefunden:', !!match);
1013110132 if (match) {
10133+ console.log('🔍 Match[1]:', match[1]);
1013210134 const svgMatch = match[1].match(/<svg[^>]*>.*?<\/svg>/s);
10135+ console.log('🔍 SVG Match:', !!svgMatch);
1013310136 if (svgMatch) {
10137+ console.log('🔍 SVG:', svgMatch[0]);
1013410138 return svgMatch[0].replace('width="24"', 'width="16"').replace('height="24"', 'height="16"');
1013510139 }
1013610140 }
10137- } else if (action.includes('🌗') || action.includes('Dimmen 50%')) { // ← GEÄNDERT!
10141+ } else if (action.includes('50%')) {
1013810142 console.log('🔍 50% gefunden!');
1013910143 presetHTML = this.getLightTimerPresets();
10144+ console.log('🔍 PresetHTML Länge:', presetHTML.length);
10145+ console.log('🔍 PresetHTML enthält dim_50:', presetHTML.includes('data-action="dim_50"'));
10146+
1014010147 const match = presetHTML.match(/data-action="dim_50"[^>]*>\s*(.*?)\s*<span class="timer-preset-label">/s);
10148+ console.log('🔍 Match gefunden:', !!match);
1014110149 if (match) {
10150+ console.log('🔍 Match[1]:', match[1]);
1014210151 const svgMatch = match[1].match(/<svg[^>]*>.*?<\/svg>/s);
10152+ console.log('🔍 SVG Match:', !!svgMatch);
1014310153 if (svgMatch) {
10154+ console.log('🔍 SVG:', svgMatch[0]);
1014410155 return svgMatch[0].replace('width="24"', 'width="16"').replace('height="24"', 'height="16"');
1014510156 }
1014610157 }
0 commit comments