@@ -1145,6 +1145,23 @@ class FastSearchCard extends HTMLElement {
11451145 position: relative;
11461146 }
11471147
1148+ .icon-video {
1149+ position: absolute;
1150+ top: 0;
1151+ left: 0;
1152+ width: 100%;
1153+ height: 100%;
1154+ object-fit: cover;
1155+ border-radius: 20px;
1156+ z-index: 1;
1157+ opacity: 0;
1158+ transition: opacity 0.3s ease;
1159+ }
1160+
1161+ .icon-video[autoplay] {
1162+ opacity: 1;
1163+ }
1164+
11481165 .icon-content {
11491166 flex-grow: 1;
11501167 display: flex;
@@ -8108,6 +8125,15 @@ class FastSearchCard extends HTMLElement {
81088125 }
81098126 }
81108127 }
8128+ // Video Element Update
8129+ const videoElement = detailPanel.querySelector('.icon-video');
8130+ if (videoElement) {
8131+ const newVideoUrl = this.getVideoUrl(item);
8132+ if (newVideoUrl && videoElement.src !== newVideoUrl) {
8133+ videoElement.src = newVideoUrl;
8134+ videoElement.load();
8135+ }
8136+ }
81118137 }
81128138
81138139 // Device-spezifische Updates (bleibt gleich)
@@ -8298,6 +8324,7 @@ class FastSearchCard extends HTMLElement {
82988324 <div class="icon-content">
82998325 <div class="icon-background-wrapper">
83008326 <div class="icon-background" style="${backgroundStyle}">
8327+ ${this.hasVideoUrl(item) ? this.renderVideoElement(item) : ''}
83018328 </div>
83028329 </div>
83038330 <div class="detail-info-row" style="gap: ${isActive ? '12px' : '0px'}">
@@ -14704,6 +14731,56 @@ class FastSearchCard extends HTMLElement {
1470414731 return state.attributes.entity_picture || state.attributes.media_image_url || null;
1470514732 }
1470614733
14734+
14735+
14736+ getVideoUrl(item) {
14737+ if (!item) return null;
14738+
14739+ // Klima-Geräte: State-basierte Video-URLs (lokal gehostet)
14740+ if (item.domain === 'climate') {
14741+ const state = this._hass?.states[item.id];
14742+ const isActive = state && state.state !== 'off';
14743+
14744+ const baseUrl = '/local/fast-search-card/';
14745+ return baseUrl + (isActive ? 'climate-on.mp4' : 'climate-off.mp4');
14746+ }
14747+
14748+ // 1. Custom Data Video URL prüfen
14749+ if (item.custom_data?.video_url) {
14750+ return item.custom_data.video_url;
14751+ }
14752+
14753+ // 2. Entity Attributes prüfen (falls Home Assistant Entity)
14754+ if (this._hass && item.id) {
14755+ const state = this._hass.states[item.id];
14756+ if (state?.attributes?.video_url) {
14757+ return state.attributes.video_url;
14758+ }
14759+ }
14760+
14761+ // 3. Kein Video gefunden
14762+ return null;
14763+ }
14764+
14765+ hasVideoUrl(item) {
14766+ return this.getVideoUrl(item) !== null;
14767+ }
14768+
14769+ renderVideoElement(item) {
14770+ const videoUrl = this.getVideoUrl(item);
14771+ if (!videoUrl) return '';
14772+
14773+ return `
14774+ <video class="icon-video" autoplay muted loop playsinline>
14775+ <source src="${videoUrl}" type="video/mp4">
14776+ <source src="${videoUrl.replace('.mp4', '.webm')}" type="video/webm">
14777+ </video>
14778+ `;
14779+ }
14780+
14781+
14782+
14783+
1470714784 animateElementIn(element, keyframes, options = {}) {
1470814785 if (!element) return;
1470914786
0 commit comments