@@ -8141,6 +8141,12 @@ class FastSearchCard extends HTMLElement {
81418141 <div class="quick-stats">
81428142 ${quickStats.map(stat => `<div class="stat-item">${stat}</div>`).join('')}
81438143 </div>
8144+
8145+ <!-- NEU: Label Button hinzufügen -->
8146+ <button class="label-test-button" onclick="this.addStarLabel('${item.id}')" title="Star Label hinzufügen">
8147+ ⭐
8148+ </button>
8149+
81448150 </div>
81458151 </div>
81468152 `;
@@ -11074,6 +11080,42 @@ class FastSearchCard extends HTMLElement {
1107411080
1107511081 return stats;
1107611082 }
11083+
11084+
11085+
11086+
11087+ async addStarLabel(entityId) {
11088+ console.log(`🌟 Versuche Label "star" zu ${entityId} hinzuzufügen...`);
11089+
11090+ try {
11091+ // Aktuelle Labels der Entity abrufen
11092+ const entityRegistry = this._hass.entities[entityId];
11093+ const currentLabels = entityRegistry?.labels || [];
11094+
11095+ console.log('Aktuelle Labels:', currentLabels);
11096+
11097+ // "star" Label hinzufügen (wenn nicht schon vorhanden)
11098+ const updatedLabels = [...new Set([...currentLabels, 'star'])];
11099+
11100+ console.log('Neue Labels:', updatedLabels);
11101+
11102+ // WebSocket API Call
11103+ const result = await this._hass.callWS({
11104+ type: "config/entity_registry/update",
11105+ entity_id: entityId,
11106+ labels: updatedLabels
11107+ });
11108+
11109+ console.log('✅ Label erfolgreich hinzugefügt:', result);
11110+ alert('Star Label hinzugefügt!');
11111+
11112+ } catch (error) {
11113+ console.error('❌ Fehler beim Hinzufügen des Labels:', error);
11114+ alert('Fehler: ' + error.message);
11115+ }
11116+ }
11117+
11118+
1107711119
1107811120 getCustomBackgroundImage(item) {
1107911121 const customData = item.custom_data || {};
0 commit comments