-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathsimon42-dashboard-strategy-core.bf96b4b7.js
More file actions
149 lines (149 loc) · 62.2 KB
/
Copy pathsimon42-dashboard-strategy-core.bf96b4b7.js
File metadata and controls
149 lines (149 loc) · 62.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
"use strict";(self.webpackChunksimon42_dashboard_strategy=self.webpackChunksimon42_dashboard_strategy||[]).push([[114],{241(e,t,s){s.d(t,{Registry:()=>o});var i=s(609),n=s(475);class o{constructor(){}static initialize(e,t){o._initialized||((0,i.sX)("registry-init"),o._hass=e,o._config=t,(0,n.F)(e),o._fetchedEntities=Object.values(e.entities),o._fetchedDevices=Object.values(e.devices),o._fetchedAreas=Object.values(e.areas),(0,i.sX)("registry-buildExclusionSets"),o._buildExclusionSets(),(0,i.PZ)("registry-buildExclusionSets"),(0,i.sX)("registry-buildDeviceMaps"),o._buildDeviceMaps(),(0,i.PZ)("registry-buildDeviceMaps"),(0,i.sX)("registry-buildEntityMaps"),o._buildEntityMaps(),(0,i.PZ)("registry-buildEntityMaps"),o._initialized=!0,(0,i.cY)(`Registry initialized: ${o._fetchedEntities.length} entities, ${o._fetchedDevices.length} devices, ${o._fetchedAreas.length} areas`),(0,i.PZ)("registry-init"))}static _isEntityVisible(e){return!o._excludeSet.has(e.entity_id)&&!o._hiddenFromConfig.has(e.entity_id)&&!e.hidden&&"config"!==e.entity_category&&"diagnostic"!==e.entity_category}static _isConfigOrDiagnostic(e){return"config"===e.entity_category||"diagnostic"===e.entity_category}static _buildEntityMaps(){const e=o._fetchedEntities;o._entityById=new Map;for(const t of e)o._entityById.set(t.entity_id,t);o._entitiesByDomain=new Map,o._visibleEntitiesByDomain=new Map;for(const t of e){if(!(t.entity_id in o._hass.states))continue;const e=t.entity_id.indexOf("."),s=t.entity_id.substring(0,e);o._entitiesByDomain.has(s)||o._entitiesByDomain.set(s,[]),o._entitiesByDomain.get(s)?.push(t.entity_id),o._isEntityVisible(t)&&(o._visibleEntitiesByDomain.has(s)||o._visibleEntitiesByDomain.set(s,[]),o._visibleEntitiesByDomain.get(s)?.push(t.entity_id))}o._entitiesByDevice=new Map;for(const t of e)t.device_id&&(o._entitiesByDevice.has(t.device_id)||o._entitiesByDevice.set(t.device_id,[]),o._entitiesByDevice.get(t.device_id)?.push(t.entity_id));o._entitiesByArea=new Map,o._visibleEntitiesByArea=new Map,o._configDiagEntitiesByArea=new Map;for(const t of e){const e=t.area_id||(t.device_id?o._deviceById.get(t.device_id)?.area_id:void 0);e&&(o._entitiesByArea.has(e)||o._entitiesByArea.set(e,[]),o._entitiesByArea.get(e)?.push(t),o._isConfigOrDiagnostic(t)&&(o._configDiagEntitiesByArea.has(e)||o._configDiagEntitiesByArea.set(e,[]),o._configDiagEntitiesByArea.get(e)?.push(t)),o._isEntityVisible(t)&&(o._visibleEntitiesByArea.has(e)||o._visibleEntitiesByArea.set(e,[]),o._visibleEntitiesByArea.get(e)?.push(t)))}}static _buildDeviceMaps(){o._deviceById=new Map;for(const e of o._fetchedDevices)o._deviceById.set(e.id,e)}static _buildExclusionSets(){o._excludeSet=new Set;for(const e of o._fetchedEntities)e.labels.includes("no_dboard")&&o._excludeSet.add(e.entity_id);o._hiddenFromConfig=new Set;const e=o._config.areas_options;if(e)for(const t of Object.values(e))if(t.groups_options)for(const e of Object.values(t.groups_options))if(e.hidden&&Array.isArray(e.hidden))for(const t of e.hidden)o._hiddenFromConfig.add(t)}static get hass(){return o._hass}static get config(){return o._config}static get initialized(){return o._initialized}static getEntity(e){return o._entityById.get(e)}static getEntityIdsForDomain(e){return o._entitiesByDomain.get(e)||[]}static getEntitiesForArea(e){return o._entitiesByArea.get(e)||[]}static getEntityIdsForDevice(e){return o._entitiesByDevice.get(e)||[]}static getVisibleEntityIdsForDomain(e){return o._visibleEntitiesByDomain.get(e)||[]}static getVisibleEntitiesForArea(e){return o._visibleEntitiesByArea.get(e)||[]}static getConfigDiagEntitiesForArea(e){return o._configDiagEntitiesByArea.get(e)||[]}static getDevice(e){return o._deviceById.get(e)}static get areas(){return o._fetchedAreas}static get floors(){return Object.values(o._hass.floors)}static isExcludedByLabel(e){return o._excludeSet.has(e)}static isHiddenByConfig(e){return o._hiddenFromConfig.has(e)}static isEntityExcluded(e){if(o._excludeSet.has(e))return!0;if(o._hiddenFromConfig.has(e))return!0;const t=o._entityById.get(e);return!(!t||!t.hidden&&"config"!==t.entity_category&&"diagnostic"!==t.entity_category)}static isEntityExcludedWithStateCategory(e){if(o.isEntityExcluded(e))return!0;const t=o._hass.states[e];return"config"===t?.attributes?.entity_category||"diagnostic"===t?.attributes?.entity_category}static getHiddenForGroup(e){const t=new Set,s=o._config.areas_options;if(!s)return t;for(const i of Object.values(s)){const s=i.groups_options?.[e];if(s?.hidden&&Array.isArray(s.hidden))for(const e of s.hidden)t.add(e)}return t}static getHiddenForAreaGroup(e,t){const s=new Set,i=o._config.areas_options?.[e]?.groups_options?.[t];if(i?.hidden&&Array.isArray(i.hidden))for(const e of i.hidden)s.add(e);return s}}o._entitiesByDomain=new Map,o._visibleEntitiesByDomain=new Map,o._initialized=!1},177(e,t,s){s.r(t);var i=s(684),n=s(241),o=s(609),a=s(475);const r=["Rollo","Rollladen","Jalousie","Vorhang","Gardine","Rolladen","Beschattung","Raffstore","Fenster","Cover","Blind","Curtain","Shade","Shutter","Window","Markise","Awning"].map(e=>new RegExp(`^${e}\\s+|\\s+${e}$`,"gi")),c=["awning","blind","curtain","shade","shutter","window"];class d extends i.WF{constructor(){super(...arguments),this._cachedFilteredIds=null,this._lastCoversList="",this._tileCards=new Map,this._headingCard=null}setConfig(e){this._config=e,this._deviceClasses=e.device_classes||c}willUpdate(e){if(!e.has("hass")||!this.hass)return;(0,o.Er)("covers-group");const t=e.get("hass");if(t&&t.entities===this.hass.entities||(this._cachedFilteredIds=null),!this._cachedFilteredIds){if(!n.Registry.initialized)return;this._cachedFilteredIds=new Set(this._getFilteredCoverEntities(this.hass))}this._propagateHass(this.hass)}_propagateHass(e){this._headingCard&&(this._headingCard.hass=e);for(const t of this._tileCards.values())t.hass=e}_getFilteredCoverEntities(e){return n.Registry.getVisibleEntityIdsForDomain("cover").filter(t=>{const s=e.states[t];if(!s)return!1;const i=s.attributes?.device_class;return i?this._deviceClasses.includes(i):this._deviceClasses.length>1})}_getRelevantCovers(){if(!this.hass||!this._cachedFilteredIds)return[];const e=this._config.group_type,t=!0===this._config.show_partially_open,s=[];for(const i of this._cachedFilteredIds){const n=this.hass.states[i];if(!n)continue;const o=n.attributes?.current_position,a="number"==typeof o,r="opening"===n.state||"closing"===n.state;if("partially_open"===e)("open"===n.state||r)&&a&&o>0&&o<100&&s.push(i);else if("open"===e)"open"!==n.state&&"opening"!==n.state||(t?(!a||o>=100)&&s.push(i):s.push(i));else if("closed"===n.state)s.push(i);else if("closing"===n.state){if(t&&a&&o>0)continue;s.push(i)}}return s.sort((e,t)=>{const s=this.hass?.states[e],i=this.hass?.states[t];return s&&i?new Date(i.last_changed).getTime()-new Date(s.last_changed).getTime():0}),s}_stripCoverType(e){const t=this.hass?.states[e];if(!t)return e;let s=t.attributes.friendly_name||e;for(const e of r)e.lastIndex=0,s=s.replace(e,"");return s.trim()||t.attributes.friendly_name||e}_buildHeadingConfig(e){const t=this._config.group_type,s=this._config.batch_open_text||(0,a.localize)("covers.open_all"),i=this._config.batch_close_text||(0,a.localize)("covers.close_all");if("partially_open"===t)return{type:"heading",heading:`${this._config.heading_partial||(0,a.localize)("covers.partially_open")} (${e.length})`,icon:"mdi:blinds-horizontal",badges:[{type:"button",icon:"mdi:arrow-up",text:s,tap_action:{action:"perform-action",perform_action:"cover.open_cover",target:{entity_id:e}}},{type:"button",icon:"mdi:arrow-down",text:i,tap_action:{action:"perform-action",perform_action:"cover.close_cover",target:{entity_id:e}}}]};const n="open"===t;return{type:"heading",heading:`${n?this._config.heading_open||(0,a.localize)("covers.open"):this._config.heading_closed||(0,a.localize)("covers.closed")} (${e.length})`,icon:n?"mdi:blinds-horizontal":"mdi:blinds",badges:[{type:"button",icon:n?"mdi:arrow-down":"mdi:arrow-up",text:n?i:s,tap_action:{action:"perform-action",perform_action:n?"cover.close_cover":"cover.open_cover",target:{entity_id:e}}}]}}_getOrCreateTileCard(e){let t=this._tileCards.get(e);return t||(t=document.createElement("hui-tile-card"),t.hass=this.hass,t.setConfig({type:"tile",entity:e,name:this._stripCoverType(e),features:[{type:"cover-open-close"}],vertical:!1,features_position:"inline",state_content:["current_position","last_changed"]}),this._tileCards.set(e,t),t)}_calculateRenderKey(e){return e.map(e=>{const t=this.hass?.states[e];if(!t)return e;const s=t.attributes?.current_position;return"number"==typeof s?`${e}:${t.state}:${s}`:`${e}:${t.state}`}).join(",")}render(){if(!this.hass||!this._cachedFilteredIds)return i.s6;const e=this._getRelevantCovers();return this.hidden=0===e.length,i.qy`
<div class="covers-section">
<div id="heading"></div>
<div class="cover-grid" id="grid"></div>
</div>
`}updated(e){if(super.updated(e),!this.hass||!this._cachedFilteredIds)return;const t=this._getRelevantCovers(),s=this._calculateRenderKey(t);if(this._lastCoversList===s)return;if(this._lastCoversList=s,0===t.length){const e=this.shadowRoot?.getElementById("heading");e&&(e.innerHTML="");const t=this.shadowRoot?.getElementById("grid");return t&&(t.innerHTML=""),this._headingCard=null,this._tileCards.clear(),void(this._lastCoversList="")}const i=this.shadowRoot?.getElementById("heading");i&&(this._headingCard||(this._headingCard=document.createElement("hui-heading-card"),i.appendChild(this._headingCard)),this._headingCard.hass=this.hass,this._headingCard.setConfig(this._buildHeadingConfig(t)));const n=this.shadowRoot?.getElementById("grid");if(!n)return;const o=new Set(t);for(const[e,t]of this._tileCards)o.has(e)||(t.parentNode===n&&n.removeChild(t),this._tileCards.delete(e));let a=null;for(const e of t){const t=this._getOrCreateTileCard(e),s=a?a.nextSibling:n.firstChild;t!==s&&n.insertBefore(t,s),a=t}for(;a&&a.nextSibling;)n.removeChild(a.nextSibling)}getCardSize(){const e=this._getRelevantCovers();return Math.ceil(e.length/3)+1}}d.properties={hass:{attribute:!1}},d.styles=i.AH`
:host {
display: block;
}
:host([hidden]) {
display: none;
}
.covers-section {
display: flex;
flex-direction: column;
gap: 8px;
width: 100%;
}
.cover-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 8px;
}
`,customElements.define("simon42-covers-group-card",d)},470(e,t,s){s.r(t);var i=s(684),n=s(241),o=s(609),a=s(475),r=s(563);const c=["brightness","color_temp","hs","xy","rgb","rgbw","rgbww","white"];class d extends i.WF{constructor(){super(...arguments),this._cachedSourceIds=null,this._cachedAreaForEntity=null,this._lastLightsList="",this._tileCards=new Map,this._headingCard=null,this._floorHeadingCards=new Map,this._groupContainers=new Map,this._groupExpansion=new Map}setConfig(e){if(!["on","off","all"].includes(e.group_type))throw new Error("You need to define group_type (on/off/all)");this._config=e}willUpdate(e){if(!e.has("hass")||!this.hass)return;(0,o.Er)("lights-group");const t=e.get("hass");if(t&&t.entities===this.hass.entities||(this._cachedSourceIds=null,this._cachedAreaForEntity=null),!this._cachedSourceIds){if(!n.Registry.initialized)return;this._cachedSourceIds=new Set(this._getSourceLightEntities())}this._propagateHass(this.hass)}_propagateHass(e){this._headingCard&&(this._headingCard.hass=e);for(const t of this._tileCards.values())t.hass=e}_getState(e){if(this.hass)return Reflect.get(this.hass.states,e)}_getSourceLightEntities(){return Array.isArray(this._config.entities)&&this._config.entities.length>0?this._config.entities.filter(e=>e.startsWith("light.")&&void 0!==this._getState(e)):n.Registry.getVisibleEntityIdsForDomain("light").filter(e=>void 0!==this._getState(e))}_getRelevantLights(e){if(!this.hass)return[];const t=e?Array.from(e):Array.from(this._cachedSourceIds||[]);if(0===t.length)return[];if("all"===this._config.group_type)return[...t].sort((e,t)=>this._sortByLastChanged(e,t));const s="on"===this._config.group_type?"on":"off",i=[];for(const e of t){const t=this._getState(e);t&&t.state===s&&i.push(e)}return i.sort((e,t)=>this._sortByLastChanged(e,t))}_sortByLastChanged(e,t){const s=this._getState(e),i=this._getState(t);return s&&i?new Date(i.last_changed).getTime()-new Date(s.last_changed).getTime():0}_getAreaForEntity(e){if(this._cachedAreaForEntity||(this._cachedAreaForEntity=new Map),this._cachedAreaForEntity.has(e))return this._cachedAreaForEntity.get(e)??null;const t=n.Registry.getEntity(e);let s=t?.area_id??null;if(!s&&t?.device_id){const e=n.Registry.getDevice(t.device_id);s=e?.area_id??null}return this._cachedAreaForEntity.set(e,s),s}_getDisplayName(e){if(this.hass)return this._config.area?(0,r.To)(e,this._config.area,this.hass):void 0}_getGroupChildIds(e,t){const s=this._getState(e),i=s?.attributes?.entity_id;if(!Array.isArray(i))return[];const n=i.filter(s=>"string"==typeof s&&s.startsWith("light.")&&s!==e&&t.has(s));return[...new Set(n)].sort((e,t)=>this._sortByLastChanged(e,t))}_collectDescendants(e,t,s,i){const n=s.get(e);if(n)return n;if(i.has(e))return new Set;i.add(e);const o=new Set;for(const n of t.get(e)||[]){o.add(n);for(const e of this._collectDescendants(n,t,s,i))o.add(e)}return i.delete(e),s.set(e,o),o}_buildHierarchy(e){if(!0!==this._config.nested_groups){const t=new Map;for(const s of e)t.set(s,{entityId:s,childIds:[]});return{topLevelIds:[...e],nodes:t}}const t=new Set(e),s=new Map;for(const i of e)s.set(i,this._getGroupChildIds(i,t));const i=new Map,n=new Map,o=new Set;for(const t of e){const e=s.get(t)||[],a=e.filter(t=>!e.some(e=>e!==t&&this._collectDescendants(e,s,i,new Set).has(t)));n.set(t,{entityId:t,childIds:a});for(const e of a)o.add(e)}return{topLevelIds:e.filter(e=>!o.has(e)).sort((e,t)=>this._sortByLastChanged(e,t)),nodes:n}}_groupByFloors(e){if(!this.hass)return[];const t=Object.values(this.hass.areas),s=new Map;for(const e of t)s.set(e.area_id,e.floor_id??null);const i=new Map;for(const t of e){const e=this._getAreaForEntity(t),n=e?s.get(e)??null:null;i.has(n)||i.set(n,[]),i.get(n)?.push(t)}const n=this.hass.floors;return[...Object.keys(n).filter(e=>i.has(e)),...i.has(null)?[null]:[]].map(e=>{const t=e?n[e]:null;return{floorId:e,floorName:t?.name||(0,a.localize)("lights.floor_other"),floorIcon:t?.icon||"mdi:home-outline",lights:i.get(e)??[]}})}_getFloorDomKey(e){return e??"_none"}_buildHeadingConfig(e,t,s){const i="on"===this._config.group_type,n="all"===this._config.group_type,o=t?`${t} (${e.length})`:`${n?this._config.heading_label||(0,a.localize)("room.lighting"):i?(0,a.localize)("lights.on"):(0,a.localize)("lights.off")} (${e.length})`,r=0===e.length?[]:[{type:"button",icon:"mdi:lightbulb-on",text:(0,a.localize)("lights.all_on"),tap_action:{action:"perform-action",perform_action:"light.turn_on",target:{entity_id:e}},visibility:[{condition:"or",conditions:e.map(e=>({condition:"state",entity:e,state:"off"}))}]},{type:"button",icon:"mdi:lightbulb-off",text:(0,a.localize)("lights.all_off"),tap_action:{action:"perform-action",perform_action:"light.turn_off",target:{entity_id:e}},visibility:[{condition:"or",conditions:e.map(e=>({condition:"state",entity:e,state:"on"}))}]}];return{type:"heading",heading:o,icon:s||this._config.heading_icon||(n||i?"mdi:lightbulb-group":"mdi:lightbulb-group-off"),badges:r}}_getOrCreateTileCard(e){const t=this._tileCards.get(e);if(t)return t;const s=document.createElement("hui-tile-card");s.hass=this.hass;const i={type:"tile",entity:e,vertical:!1,state_content:"last_changed"},n=this._getDisplayName(e);n&&(i.name=n);const o=this._getState(e),a=o?.attributes?.supported_color_modes,r=a?.some(e=>c.includes(e))||!1;return"off"!==this._config.group_type&&r&&(i.features=[{type:"light-brightness"}],i.features_position="inline"),s.setConfig(i),s.dataset.entityId=e,this._tileCards.set(e,s),s}_isExpanded(e){return this._groupExpansion.get(e)??!0===this._config.default_expanded}_getOrCreateGroupContainer(e){let t=this._groupContainers.get(e);if(t)return t;t=document.createElement("div"),t.className="group-block",t.dataset.entityId=e;const s=document.createElement("div");s.className="group-header";const i=document.createElement("button");i.className="group-toggle",i.type="button",i.setAttribute("aria-expanded","false");const n=document.createElement("ha-icon");n.setAttribute("icon","mdi:chevron-right"),i.appendChild(n);const o=document.createElement("div");o.className="group-card-slot",s.append(i,o);const a=document.createElement("div");return a.className="group-children",a.hidden=!0,t.append(s,a),i.addEventListener("click",()=>{const t=!this._isExpanded(e);this._groupExpansion.set(e,t),i.setAttribute("aria-expanded",String(t)),a.hidden=!t}),this._groupContainers.set(e,t),t}_resolveHierarchyContainer(e,t){return t?this._getOrCreateGroupContainer(e):this._getOrCreateTileCard(e)}_placeHierarchyNode(e,t,s){t!==s&&e.insertBefore(t,s)}_syncGroupContainer(e,t,s,i){const n=e.querySelector(".group-card-slot"),o=this._getOrCreateTileCard(t);o.parentNode!==n&&n.replaceChildren(o);const a=e.querySelector(".group-children"),r=this._isExpanded(t);e.querySelector(".group-toggle").setAttribute("aria-expanded",String(r)),a.hidden=!r,this._reconcileHierarchy(a,s,i)}_reconcileHierarchy(e,t,s){let i=null;for(const n of t){const t=s.get(n),o=t?.childIds||[],a=this._resolveHierarchyContainer(n,o.length>0),r=i?i.nextSibling:e.firstChild;this._placeHierarchyNode(e,a,r),i=a,o.length>0&&this._syncGroupContainer(a,n,o,s)}for(;i&&i.nextSibling;)e.removeChild(i.nextSibling)}render(){if(!this.hass||!this._cachedSourceIds)return i.s6;const e=this._getRelevantLights();if(0===e.length)return this.hidden=!0,i.s6;if(this.hidden=!1,this._config.group_by_floors){const t=this._groupByFloors(e);return i.qy`
<div class="lights-section">
<div id="heading"></div>
${t.map(e=>{const t=this._getFloorDomKey(e.floorId);return i.qy`
<div class="floor-section">
<div id=${`floor-heading-${t}`}></div>
<div class="light-grid" id=${`floor-grid-${t}`}></div>
</div>
`})}
</div>
`}return i.qy`
<div class="lights-section">
<div id="heading"></div>
<div class="light-grid" id="grid"></div>
</div>
`}_getOrCreateFloorHeadingCard(e){let t=this._floorHeadingCards.get(e);return t||(t=document.createElement("hui-heading-card"),this._floorHeadingCards.set(e,t),t)}updated(e){if(super.updated(e),!this.hass||!this._cachedSourceIds)return;const t=this._getRelevantLights(),s=t.join(",");if(this._lastLightsList===s)return;if(this._lastLightsList=s,0===t.length)return;if(this._config.group_by_floors){const e=this._groupByFloors(t),s=this.shadowRoot?.getElementById("heading");if(s){this._headingCard||(this._headingCard=document.createElement("hui-heading-card"));const e=this._headingCard;s.appendChild(e),e.hass=this.hass,e.setConfig(this._buildHeadingConfig(t))}const i=new Set(t);for(const t of e){const e=t.floorId||"_none",s=this.shadowRoot?.getElementById(`floor-heading-${e}`);if(s){const i=this._getOrCreateFloorHeadingCard(e);i.parentNode||s.appendChild(i),i.hass=this.hass,i.setConfig(this._buildHeadingConfig(t.lights,t.floorName,t.floorIcon))}const i=this.shadowRoot?.getElementById(`floor-grid-${e}`);if(i){const e=this._buildHierarchy(t.lights);this._reconcileHierarchy(i,e.topLevelIds,e.nodes)}}for(const[e,t]of this._tileCards)i.has(e)||(t.parentNode&&t.parentNode.removeChild(t),this._tileCards.delete(e));for(const[e,t]of this._groupContainers)i.has(e)||(t.parentNode&&t.parentNode.removeChild(t),this._groupContainers.delete(e));return}const i=this.shadowRoot?.getElementById("heading");if(i){this._headingCard||(this._headingCard=document.createElement("hui-heading-card"));const e=this._headingCard;i.appendChild(e),e.hass=this.hass,e.setConfig(this._buildHeadingConfig(t))}const n=this.shadowRoot?.getElementById("grid");if(!n)return;const o=this._buildHierarchy(t),a=new Set(t);for(const[e,t]of this._tileCards)a.has(e)||(t.parentNode&&t.parentNode.removeChild(t),this._tileCards.delete(e));for(const[e,t]of this._groupContainers)a.has(e)||(t.parentNode&&t.parentNode.removeChild(t),this._groupContainers.delete(e));this._reconcileHierarchy(n,o.topLevelIds,o.nodes)}getCardSize(){const e=this._getRelevantLights();return Math.ceil(e.length/3)+1}}d.properties={hass:{attribute:!1}},d.styles=i.AH`
:host {
display: block;
}
:host([hidden]) {
display: none;
}
.lights-section {
display: flex;
flex-direction: column;
gap: 8px;
width: 100%;
}
.light-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 8px;
}
.floor-section {
display: flex;
flex-direction: column;
gap: 8px;
}
.group-block {
grid-column: 1 / -1;
display: flex;
flex-direction: column;
gap: 8px;
padding: 12px;
border: 1px solid var(--divider-color);
border-radius: 16px;
background: color-mix(in srgb, var(--card-background-color) 92%, var(--primary-color) 8%);
}
.group-header {
display: grid;
grid-template-columns: auto 1fr;
gap: 8px;
align-items: start;
}
.group-toggle {
display: inline-flex;
align-items: center;
justify-content: center;
width: 36px;
height: 36px;
margin-top: 6px;
border: none;
border-radius: 999px;
background: var(--secondary-background-color);
color: var(--primary-text-color);
cursor: pointer;
transition: transform 0.2s ease;
}
.group-toggle:hover {
background: color-mix(in srgb, var(--secondary-background-color) 75%, var(--primary-color) 25%);
}
.group-toggle ha-icon {
--mdc-icon-size: 18px;
transition: transform 0.2s ease;
}
.group-toggle[aria-expanded='true'] ha-icon {
transform: rotate(90deg);
}
.group-children {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
gap: 8px;
padding-left: 44px;
}
.group-children[hidden] {
display: none;
}
`,customElements.define("simon42-lights-group-card",d)},254(e,t,s){s.r(t);var i=s(684),n=s(241),o=s(609),a=s(475),r=s(598);const c=new Set(["awning","blind","curtain","shade","shutter","window"]),d=new Set(["door","garage","gate","window"]),l=new Set(["door","window","garage_door","opening","smoke","gas"]),h={orange:"var(--orange-color, #ff9800)",purple:"var(--purple-color, #9c27b0)",yellow:"var(--yellow-color, #ffc107)",red:"var(--red-color, #f44336)",grey:"var(--disabled-color, #bdbdbd)"};class _ extends i.WF{constructor(){super(...arguments),this._count=0,this._relevantEntityIds=null}setConfig(e){this._config=e,this._relevantEntityIds=null}willUpdate(e){if(!e.has("hass")||!this.hass)return;(0,o.Er)(`summary-${this._config.summary_type}`);const t=e.get("hass");t&&t.entities===this.hass.entities||(this._relevantEntityIds=null,(0,o.cY)(`summary-${this._config.summary_type}: cache invalidated (registry changed)`));const s=this._calculateCount();this._count!==s&&(this._count=s)}_isEntityRelevant(e,t){return!n.Registry.isEntityExcludedWithStateCategory(e)}_getRelevantEntities(){if(!this.hass||this._relevantEntityIds)return;if(!n.Registry.initialized)return;const e=this._config.summary_type;(0,o.sX)(`summary-getRelevant-${e}`);const t=this.hass;let s;switch(this._config.summary_type){case"lights":s=n.Registry.getVisibleEntityIdsForDomain("light").filter(e=>t.states[e]&&this._isEntityRelevant(e,t.states[e]));break;case"covers":s=n.Registry.getVisibleEntityIdsForDomain("cover").filter(e=>{const s=t.states[e];if(!s)return!1;if(!this._isEntityRelevant(e,s))return!1;const i=s.attributes?.device_class;return!(i&&!c.has(i))});break;case"security":{const e=n.Registry.getVisibleEntityIdsForDomain("lock"),i=n.Registry.getVisibleEntityIdsForDomain("cover"),o=n.Registry.getVisibleEntityIdsForDomain("binary_sensor");s=[];for(const i of e)t.states[i]&&this._isEntityRelevant(i,t.states[i])&&s.push(i);for(const e of i){const i=t.states[e];if(!i||!this._isEntityRelevant(e,i))continue;const n=i.attributes?.device_class;void 0!==n&&d.has(n)&&s.push(e)}for(const e of o){const i=t.states[e];if(!i||!this._isEntityRelevant(e,i))continue;const o=n.Registry.getEntity(e);if(o?.platform&&r.ZI.has(o.platform))continue;const a=i.attributes?.device_class;void 0!==a&&l.has(a)&&s.push(e)}break}case"batteries":s=(0,r.fS)(t,this._config);break;case"climate":s=n.Registry.getVisibleEntityIdsForDomain("climate").filter(e=>t.states[e]&&this._isEntityRelevant(e,t.states[e]));break;default:s=[]}this._relevantEntityIds=new Set(s),(0,o.cY)(`summary-${e}: ${s.length} relevant entities`),(0,o.PZ)(`summary-getRelevant-${e}`)}_calculateCount(){if(!this.hass)return 0;if(this._getRelevantEntities(),!this._relevantEntityIds||0===this._relevantEntityIds.size)return 0;const e=this.hass;let t=0;switch(this._config.summary_type){case"lights":for(const s of this._relevantEntityIds)"on"===e.states[s]?.state&&t++;return t;case"covers":for(const s of this._relevantEntityIds){const i=e.states[s]?.state;"open"!==i&&"opening"!==i||t++}return t;case"security":for(const s of this._relevantEntityIds){const i=e.states[s];i&&(s.startsWith("lock.")&&"unlocked"===i.state||s.startsWith("cover.")&&"open"===i.state||s.startsWith("binary_sensor.")&&"on"===i.state)&&t++}return t;case"batteries":{const s=this._config.battery_critical_threshold??20;for(const i of this._relevantEntityIds){const n=e.states[i];if(n)if(i.startsWith("binary_sensor."))"on"===n.state&&t++;else{const e=n.attributes?.unit_of_measurement;if(e&&"%"!==e)continue;const i=parseFloat(n.state);("unavailable"===n.state||"unknown"===n.state||!isNaN(i)&&i<s)&&t++}}return t}case"climate":for(const s of this._relevantEntityIds){const i=e.states[s]?.state;i&&"off"!==i&&"unavailable"!==i&&"unknown"!==i&&t++}return t;default:return 0}}_getDisplayConfig(){const e=this._count,t=e>0;return{lights:{icon:"mdi:lamps",name:t?`${e} ${1===e?(0,a.localize)("summary.lights_on_one"):(0,a.localize)("summary.lights_on_many")}`:(0,a.localize)("summary.lights_off"),color:t?"orange":"grey",path:"lights"},covers:{icon:"mdi:blinds-horizontal",name:t?`${e} ${1===e?(0,a.localize)("summary.covers_open_one"):(0,a.localize)("summary.covers_open_many")}`:(0,a.localize)("summary.covers_closed"),color:t?"purple":"grey",path:"covers"},security:{icon:"mdi:security",name:t?`${e} ${(0,a.localize)("summary.security_unsafe")}`:(0,a.localize)("summary.security_safe"),color:t?"yellow":"grey",path:"security"},batteries:{icon:t?"mdi:battery-alert":"mdi:battery-charging",name:t?`${e} ${1===e?(0,a.localize)("summary.batteries_critical_one"):(0,a.localize)("summary.batteries_critical_many")}`:(0,a.localize)("summary.batteries_ok"),color:t?"red":"grey",path:"batteries"},climate:{icon:"mdi:thermostat",name:t?`${e} ${1===e?(0,a.localize)("summary.climate_active_one"):(0,a.localize)("summary.climate_active_many")}`:(0,a.localize)("summary.climate_off"),color:t?"orange":"grey",path:"climate"}}[this._config.summary_type]}_handleClick(){if(!this.hass)return;const e=this._getDisplayConfig();this.dispatchEvent(new CustomEvent("hass-action",{bubbles:!0,composed:!0,detail:{config:{tap_action:{action:"navigate",navigation_path:e.path}},action:"tap"}}))}render(){const e=this._getDisplayConfig(),t=h[e.color]||h.grey;return i.qy`
<ha-card @click=${()=>this._handleClick()}>
<ha-icon class="icon" .icon=${e.icon} style="color: ${t}"></ha-icon>
<div class="name">${e.name}</div>
</ha-card>
`}getCardSize(){return 1}}_.properties={hass:{attribute:!1},_count:{state:!0}},_.styles=i.AH`
:host {
display: block;
cursor: pointer;
}
ha-card {
padding: 12px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
gap: 8px;
height: 100%;
box-sizing: border-box;
--ha-card-border-width: 0;
background: var(--ha-card-background, var(--card-background-color, #fff));
border-radius: var(--ha-card-border-radius, 12px);
}
ha-card:active {
transform: scale(0.97);
transition: transform 0.1s;
}
.icon {
--mdc-icon-size: 28px;
transition: color 0.3s;
}
.name {
font-size: 13px;
font-weight: 500;
line-height: 1.2;
color: var(--primary-text-color);
}
`,customElements.define("simon42-summary-card",_),window.customCards=window.customCards||[],window.customCards.push({type:"simon42-summary-card",name:"Simon42 Summary Card",description:"Reactive summary card that counts entities dynamically"})},113(e,t,s){s.d(t,{Db:()=>i,GX:()=>n,LN:()=>r,fF:()=>o,g7:()=>a});const i={temperature:"red",humidity:"indigo",pm25:"orange",pm10:"orange",carbon_dioxide:"green",volatile_organic_compounds:"purple",illuminance:"amber",battery:"red",motion:"yellow",occupancy:"cyan",presence:"cyan",moisture:"blue",window:"teal",door:"teal",smoke:"red",gas:"red",wind_speed:"blue",pressure:"deep-purple",power:"orange",energy:"orange"};function n(e,t){const s=t.states[e];if(!s)return"grey";const n=s.attributes?.device_class;if(n&&i[n])return i[n];const o=s.attributes?.unit_of_measurement;return"lx"===o?"amber":"g/m³"===o?"blue":"grey"}function o(e,t,s,i){return"sensor"===e?!!("battery"===t||i.includes("battery")||"temperature"!==t&&"°C"!==s&&"°F"!==s&&"humidity"!==t&&"%"!==s&&("pm25"===t||i.includes("pm_2_5")||i.includes("pm25")||"pm10"===t||i.includes("pm_10")||i.includes("pm10")||"carbon_dioxide"===t||i.includes("co2")||"volatile_organic_compounds"===t||i.includes("voc")||"illuminance"===t||"lx"===s||"g/m³"===s)):"binary_sensor"===e&&("motion"===t||"occupancy"===t||"presence"===t||"window"===t||"door"===t||"smoke"===t||"gas"===t)}function a(e){return"window"===e||"door"===e}function r(e,t,s,i){return!i?.has(e)&&(!!s?.has(e)||t)}},609(e,t,s){s.d(t,{Er:()=>l,PZ:()=>a,cY:()=>r,sX:()=>o});let i=null;function n(){if(null!==i)return i;try{i=new URLSearchParams(window.location.search).has("s42_debug")}catch{i=!1}return i}function o(e){n()&&performance.mark(`s42-start-${e}`)}function a(e){if(!n())return;const t=`s42-start-${e}`,s=`s42-end-${e}`;performance.mark(s);try{const i=performance.measure(`s42-${e}`,t,s);console.log(`[s42-perf] ${e}: ${i.duration.toFixed(2)}ms`)}catch{}}function r(e,...t){n()&&console.log(`[s42-debug] ${e}`,...t)}const c=new Map;let d=null;function l(e){n()&&(c.set(e,(c.get(e)||0)+1),d||(d=setInterval(()=>{if(0===c.size)return;const e=Array.from(c.entries()).map(([e,t])=>`${e}=${t}`).join(", ");console.log(`[s42-perf] hass-updates/5s: ${e}`),c.clear()},5e3)))}"undefined"!=typeof window&&(window.__s42_dump=function(){const e=performance.getEntriesByType("measure").filter(e=>e.name.startsWith("s42-")).sort((e,t)=>e.startTime-t.startTime);if(0===e.length)return void console.log("[s42-perf] No measures recorded. Load page with ?s42_debug=true");console.table(e.map(e=>({name:e.name.replace("s42-",""),start:`${e.startTime.toFixed(1)}ms`,duration:`${e.duration.toFixed(2)}ms`})));const t=e.reduce((e,t)=>e+t.duration,0);console.log(`[s42-perf] Total measured: ${t.toFixed(2)}ms across ${e.length} measures`)})},598(e,t,s){s.d(t,{Ok:()=>a,ZI:()=>r,fS:()=>c,nR:()=>n,tC:()=>o});var i=s(241);function n(e,t){return i.Registry.getVisibleEntityIdsForDomain("person").filter(t=>!!e.states[t]).map(t=>{const s=e.states[t];return{entity_id:t,name:s.attributes?.friendly_name||t.split(".")[1],state:s.state,isHome:"home"===s.state}})}function o(e){return i.Registry.getVisibleEntityIdsForDomain("weather").find(t=>!!e.states[t])}function a(e){const t=i.Registry.getVisibleEntityIdsForDomain("sensor");for(const s of t){const t=e.states[s];if(t&&"unavailable"!==t.state&&"unknown"!==t.state)return s}const s=i.Registry.getVisibleEntityIdsForDomain("light");for(const t of s)if(e.states[t])return t;return"sun.sun"}const r=new Set(["tankerkoenig"]);function c(e,t){const s=[...i.Registry.getEntityIdsForDomain("sensor"),...i.Registry.getEntityIdsForDomain("binary_sensor")].filter(s=>{const n=e.states[s];if(!n)return!1;if(i.Registry.isExcludedByLabel(s))return!1;if(i.Registry.isHiddenByConfig(s))return!1;const o=i.Registry.getEntity(s);return!(o?.hidden||t.hide_mobile_app_batteries&&"mobile_app"===o?.platform||(!s.startsWith("binary_sensor.")||!s.includes("battery"))&&("battery"!==n.attributes?.device_class||"%"!==n.attributes?.unit_of_measurement))}),n=new Set;for(const t of s)if(t.startsWith("sensor.")){const s=e.entities[t]?.device_id;s&&n.add(s)}return s.filter(t=>{if(!t.startsWith("binary_sensor."))return!0;const s=e.entities[t]?.device_id;return!s||!n.has(s)})}},475(e,t,s){s.d(t,{localize:()=>l,F:()=>d});const i=JSON.parse('{"dashboard":{"title":"Dynamisches Dashboard"},"views":{"overview":"Übersicht","lights":"Lichter","covers":"Rollos & Abdeckungen","security":"Sicherheit","batteries":"Batterien","climate":"Klima"},"sections":{"overview":"Übersicht","summaries":"Zusammenfassungen","favorites":"Favoriten","custom_cards":"Eigene Karten","areas":"Bereiche","areas_other":"Weitere Bereiche","weather":"Wetter","energy":"Energie"},"summary":{"lights_on_one":"Licht an","lights_on_many":"Lichter an","lights_off":"Alle Lichter aus","covers_open_one":"Rollo offen","covers_open_many":"Rollos offen","covers_closed":"Alle Rollos geschlossen","security_unsafe":"unsicher","security_safe":"Alles gesichert","batteries_critical_one":"Batterie kritisch","batteries_critical_many":"Batterien kritisch","batteries_ok":"Alle Batterien OK","climate_active_one":"Thermostat aktiv","climate_active_many":"Thermostate aktiv","climate_off":"Alle Thermostate aus"},"lights":{"on":"Eingeschaltete Lichter","off":"Ausgeschaltete Lichter","all_off":"Alle aus","all_on":"Alle ein","floor_other":"Weitere"},"covers":{"open":"Offene Rollos & Abdeckungen","closed":"Geschlossene Rollos & Abdeckungen","partially_open":"Teiloffene Rollos & Abdeckungen","open_all":"Alle öffnen","close_all":"Alle schließen","awnings_open":"Ausgefahrene Markisen","awnings_closed":"Eingefahrene Markisen","awnings_partial":"Teilweise ausgefahrene Markisen","awnings_open_all":"Alle ausfahren","awnings_close_all":"Alle einfahren","windows_open":"Offene Fenster","windows_closed":"Geschlossene Fenster","windows_partial":"Teiloffene Fenster","windows_open_all":"Alle öffnen","windows_close_all":"Alle schließen"},"security":{"locks_unlocked":"Schlösser - Entriegelt","locks_locked":"Schlösser - Verriegelt","doors_open":"Türen, Tore & Fenster - Offen","doors_closed":"Türen, Tore & Fenster - Geschlossen","garages_open":"Garagen - Offen","garages_closed":"Garagen - Geschlossen","windows_open":"Tür- & Fenstersensoren - Offen","windows_closed":"Tür- & Fenstersensoren - Geschlossen","smoke_gas_active":"Rauch- & Gasmelder - Alarm","smoke_gas_inactive":"Rauch- & Gasmelder - Kein Alarm"},"batteries":{"critical":"Kritisch","low":"Niedrig","good":"Gut","battery_one":"Batterie","battery_many":"Batterien"},"climate":{"heating":"Heizen","cooling":"Kühlen","idle":"Bereitschaft","off":"Aus"},"room":{"cameras":"Kameras","lighting":"Beleuchtung","all_on":"Alle ein","all_off":"Alle aus","locks":"Schlösser","climate":"Klima","covers":"Rollos & Abdeckungen","curtains":"Vorhänge","windows":"Fenster, Türen & Tore","media":"Medien","scenes":"Szenen","misc":"Sonstiges","automations":"Automationen","scripts":"Skripte","room_pins":"Raum-Pins"},"editor":{"section_order":"Abschnitts-Reihenfolge","section_order_desc":"Ziehe die Abschnitte per Drag & Drop in die gewünschte Reihenfolge. Leere Abschnitte werden automatisch ausgeblendet.","section_hidden":"ausgeblendet","energy_link_dashboard":"Energie-Dashboard verlinken","target_section":"Zeige in","section_overview":"Übersicht","show_clock_card":"Uhrzeit-Karte anzeigen","show_clock_card_desc":"Zeigt die Uhrzeit-Karte in der Übersicht an.","alarm_entity":"Alarm-Entität:","alarm_none":"Keine (Uhr in voller Breite)","alarm_desc":"Wähle eine Alarm-Control-Panel-Entität aus. Wenn die Uhrzeit-Karte aktiv ist, wird das Alarm-Panel daneben angezeigt. Ohne Uhrzeit-Karte erscheint das Alarm-Panel in voller Breite.","show_search_card":"Such-Karte anzeigen","show_search_card_desc":"Zeigt die custom:search-card direkt unter der Uhr in der Übersicht an.","show_search_card_missing":"Benötigt <strong>custom:search-card</strong> und <strong>card-tools</strong>. Bitte installieren Sie beide Komponenten, um diese Funktion zu nutzen.","section_summaries":"Zusammenfassungen","columns_2":"2 Spalten (2x2 Grid)","columns_4":"4 Spalten (1x4 Reihe)","columns_desc":"Wähle aus, wie die Zusammenfassungskarten angezeigt werden sollen. Das Layout passt sich automatisch an, wenn Karten ausgeblendet werden.","show_light_summary":"Licht-Zusammenfassung anzeigen","group_lights_by_floors":"Lichter nach Etagen gruppieren","group_lights_by_floors_desc":"Gruppiert die Lichter in der Lichter-Ansicht nach Etagen. Jede Etage erhält einen eigenen Bereich mit Ein-/Ausschalt-Button.","nested_light_groups":"Verschachtelte Lichtgruppen anzeigen","nested_light_groups_desc":"Zeigt Lichtgruppen als aufklappbare Container mit den enthaltenen Lampen darunter an. Standardmäßig deaktiviert, damit das bisherige flache Verhalten unverändert bleibt.","show_covers_summary":"Rollo-Zusammenfassung anzeigen","show_partially_open_covers":"Teiloffene Rollos separat anzeigen","show_partially_open_covers_desc":"Zeigt teiloffene Rollos (weder ganz offen noch geschlossen) in einer eigenen Gruppe an.","show_security_summary":"Sicherheits-Zusammenfassung anzeigen","show_climate_summary":"Klima-Zusammenfassung anzeigen","show_climate_summary_desc":"Zeigt die Klima-Zusammenfassungskarte in der Übersicht an. Zählt aktive Thermostate und Klimageräte.","show_battery_summary":"Batterie-Zusammenfassung anzeigen","hide_mobile_app_batteries":"Mobile-App-Batterien ausblenden","hide_mobile_app_batteries_desc":"Blendet Batterien von Smartphones, Tablets und Watches (Mobile App) in der Batterie-Übersicht und -Zusammenfassung aus.","battery_thresholds":"Batterie-Schwellwerte","battery_critical_below":"Kritisch unter","battery_low_below":"Niedrig unter","battery_thresholds_desc":"Schwellwerte für die Batterie-Statusgruppen (Kritisch / Niedrig / Gut).","section_info_cards":"Info-Karten","show_weather":"Wetter-Karte anzeigen","show_weather_desc":"Zeigt die Wettervorhersage-Karte in der Übersicht an, wenn eine Wetter-Entität verfügbar ist.","show_energy":"Energie-Dashboard anzeigen","show_energy_desc":"Zeigt die Energie-Verteilungskarte in der Übersicht an, wenn Energiedaten verfügbar sind.","section_favorites":"Favoriten","select_entity":"Entität auswählen...","add":"+ Hinzufügen","favorites_desc":"Wähle Entitäten aus, die als Favoriten unter den Zusammenfassungen angezeigt werden sollen. Die Entitäten werden als Kacheln angezeigt.","show_state":"Status anzeigen","hide_last_changed":"Zuletzt aktualisiert ausblenden","section_areas_rooms":"Bereiche & Räume","section_areas":"Bereiche","group_by_floors":"Bereiche in Etagen gliedern","group_by_floors_desc":"Gruppiert die Bereiche in der Übersicht nach Etagen. Wenn aktiviert, wird für jede Etage eine separate Section erstellt.","show_switches_on_areas":"Schalter auf Bereichskarten anzeigen","show_switches_on_areas_desc":"Zeigt Schalter (Switches) als Controls auf den Bereichskarten in der Übersicht an. ⚠️ Stelle sicher, dass alle Schalter, die nicht geschaltet werden können oder sollen, über die Entitäts-Einstellungen auf \'Nicht sichtbar\' gestellt sind!","show_alerts_on_areas":"Alert-Icons auf Bereichskarten anzeigen","show_alerts_on_areas_desc":"Zeigt Alert-Icons (z.B. Bewegung, Feuchtigkeit, Wärme) auf den Bereichskarten an, wenn ein Binärsensor im Bereich aktiv ist.","show_locks_in_rooms":"Schlösser in Raum-Ansichten anzeigen","show_locks_in_rooms_desc":"Zeigt Schlösser (z.B. Nuki) in den jeweiligen Raum-Ansichten an. Schlösser erscheinen unabhängig davon immer in der Sicherheits-Übersicht.","show_automations_in_rooms":"Automationen in Raum-Ansichten anzeigen","show_automations_in_rooms_desc":"Zeigt dem Bereich zugeordnete Automationen in den jeweiligen Raum-Ansichten an.","show_scripts_in_rooms":"Skripte in Raum-Ansichten anzeigen","show_scripts_in_rooms_desc":"Zeigt dem Bereich zugeordnete Skripte in den jeweiligen Raum-Ansichten an.","show_window_contacts_in_rooms":"Fensterkontakte in Raum-Ansichten anzeigen","show_window_contacts_in_rooms_desc":"Zeigt Fensterkontakte als Badges in den jeweiligen Raum-Ansichten an.","show_door_contacts_in_rooms":"Türkontakte in Raum-Ansichten anzeigen","show_door_contacts_in_rooms_desc":"Zeigt Türkontakte als Badges in den jeweiligen Raum-Ansichten an.","use_default_area_sort":"Home Assistant Sortierung verwenden","use_default_area_sort_desc":"Verwendet die Sortierung der Bereiche aus Home Assistant anstelle der hier konfigurierten Reihenfolge.","areas_manage_desc":"Wähle aus, welche Bereiche im Dashboard angezeigt werden sollen und in welcher Reihenfolge. Klappe Bereiche auf, um einzelne Entitäten zu verwalten.","section_room_pins":"Raum-Pins","room_pins_desc":"Wähle Entitäten aus, die in ihren zugeordneten Räumen als erstes angezeigt werden sollen. Ideal für Entitäten die normalerweise nicht automatisch erfasst werden (z.B. Wetterstationen, spezielle Sensoren). <strong>Nur Entitäten mit Raum-Zuordnung können ausgewählt werden.</strong> Diese Pins erscheinen nur im jeweiligen Raum, nicht in der Übersicht.","section_views":"Ansichten","show_summary_views":"Zusammenfassungs-Views anzeigen","show_summary_views_desc":"Zeigt die Zusammenfassungs-Views (Lichter, Rollos, Sicherheit, Batterien) in der oberen Navigation an.","show_room_views":"Raum-Views anzeigen","show_room_views_desc":"Zeigt die einzelnen Raum-Views in der oberen Navigation an.","section_advanced":"Erweiterte Funktionen","section_custom_cards":"Eigene Karten","custom_cards_heading_placeholder":"Eigene Karten","custom_cards_desc":"Überschrift und Icon der Section für die eigenen Karten auf dem Dashboard. Leer lassen für Standardwerte.","add_custom_card":"+ Neue Karte hinzufügen","video_tutorial":"Video-Anleitung ansehen","custom_cards_help":"Füge eigene Karten zur Übersicht hinzu. Die Karten erscheinen in einer eigenen Section zwischen Zusammenfassung und Bereichen. Tipp: Erstelle die Karte zuerst in einem normalen Dashboard, kopiere den YAML-Code und füge ihn hier ein.","section_custom_badges":"Eigene Badges","add_custom_badge":"+ Neues Badge hinzufügen","custom_badges_help":"Füge eigene Badges zum Header der Übersicht hinzu (neben den Personen-Chips).","section_custom_views":"Custom Views","add_custom_view":"+ Neue View hinzufügen","custom_views_help":"Erstelle eigene Views mit beliebigen Cards. Tipp: Erstelle die View zuerst in einem normalen Dashboard, kopiere den YAML-Code und füge ihn hier ein.","no_favorites":"Keine Favoriten hinzugefügt","no_room_pins":"Keine Raum-Pins hinzugefügt","no_results":"Keine Ergebnisse gefunden","no_room":"Kein Raum","no_custom_views":"Keine Custom Views erstellt","no_custom_cards":"Keine eigenen Karten erstellt","no_custom_badges":"Keine eigenen Badges erstellt","no_areas":"Keine Bereiche verfügbar","no_entities_in_area":"Keine Entitäten in diesem Bereich gefunden","loading_entities":"Lade Entitäten...","new_view":"Neue View","new_card":"Neue Karte","title_placeholder":"Titel","path_placeholder":"Pfad (z.B. mein-view)","yaml_placeholder":"YAML-Code hier einfügen...","card_title_placeholder":"Titel (optional, wird als Heading angezeigt)","yaml_valid":"YAML gültig","domain_lights":"Beleuchtung","domain_climate":"Klima","domain_covers":"Rollos & Abdeckungen","domain_covers_curtain":"Vorhänge","domain_covers_window":"Fenster, Türen & Tore","domain_media_player":"Medien","domain_scenes":"Szenen","domain_vacuum":"Staubsauger","domain_fan":"Ventilatoren","domain_switches":"Schalter","domain_locks":"Schlösser","domain_badges":"Raum-Badges","badges_additional":"Zusätzliche Badges","badges_add":"Hinzufügen","badges_select_entity":"Entity auswählen...","badges_remove":"Entfernen","badges_show_name":"Entity-Name auf Badge anzeigen","badges_name_short":"Name"}}');var n=s.t(i,2);const o=JSON.parse('{"dashboard":{"title":"Dynamic Dashboard"},"views":{"overview":"Overview","lights":"Lights","covers":"Blinds & Covers","security":"Security","batteries":"Batteries","climate":"Climate"},"sections":{"overview":"Overview","summaries":"Summaries","favorites":"Favorites","custom_cards":"Custom Cards","areas":"Areas","areas_other":"Other Areas","weather":"Weather","energy":"Energy"},"summary":{"lights_on_one":"light on","lights_on_many":"lights on","lights_off":"All lights off","covers_open_one":"cover open","covers_open_many":"covers open","covers_closed":"All covers closed","security_unsafe":"unsafe","security_safe":"All secure","batteries_critical_one":"battery critical","batteries_critical_many":"batteries critical","batteries_ok":"All batteries OK","climate_active_one":"thermostat active","climate_active_many":"thermostats active","climate_off":"All thermostats off"},"lights":{"on":"Lights On","off":"Lights Off","all_off":"All off","all_on":"All on","floor_other":"Other"},"covers":{"open":"Open Blinds & Covers","closed":"Closed Blinds & Covers","partially_open":"Partially Open Blinds & Covers","open_all":"Open all","close_all":"Close all","awnings_open":"Extended Awnings","awnings_closed":"Retracted Awnings","awnings_partial":"Partially Extended Awnings","awnings_open_all":"Extend all","awnings_close_all":"Retract all","windows_open":"Open Windows","windows_closed":"Closed Windows","windows_partial":"Partially Open Windows","windows_open_all":"Open all","windows_close_all":"Close all"},"security":{"locks_unlocked":"Locks - Unlocked","locks_locked":"Locks - Locked","doors_open":"Doors, Gates & Windows - Open","doors_closed":"Doors, Gates & Windows - Closed","garages_open":"Garages - Open","garages_closed":"Garages - Closed","windows_open":"Door & Window Sensors - Open","windows_closed":"Door & Window Sensors - Closed","smoke_gas_active":"Smoke & Gas Detectors - Alarm","smoke_gas_inactive":"Smoke & Gas Detectors - No Alarm"},"batteries":{"critical":"Critical","low":"Low","good":"Good","battery_one":"battery","battery_many":"batteries"},"climate":{"heating":"Heating","cooling":"Cooling","idle":"Idle","off":"Off"},"room":{"cameras":"Cameras","lighting":"Lighting","all_on":"All on","all_off":"All off","locks":"Locks","climate":"Climate","covers":"Blinds & Covers","curtains":"Curtains","windows":"Windows, Doors & Gates","media":"Media","scenes":"Scenes","misc":"Miscellaneous","automations":"Automations","scripts":"Scripts","room_pins":"Room Pins"},"editor":{"section_order":"Section Order","section_order_desc":"Drag sections to reorder them on the overview page. Empty sections are hidden automatically.","section_hidden":"hidden","energy_link_dashboard":"Link to energy dashboard","target_section":"Show in","section_overview":"Overview","show_clock_card":"Show clock card","show_clock_card_desc":"Shows the clock card on the overview.","alarm_entity":"Alarm entity:","alarm_none":"None (clock full width)","alarm_desc":"Select an alarm control panel entity. When the clock card is active, the alarm panel is shown next to it. Without the clock card, the alarm panel takes the full width.","show_search_card":"Show search card","show_search_card_desc":"Shows the custom:search-card directly below the clock on the overview.","show_search_card_missing":"Requires <strong>custom:search-card</strong> and <strong>card-tools</strong>. Please install both components to use this feature.","section_summaries":"Summaries","columns_2":"2 columns (2x2 grid)","columns_4":"4 columns (1x4 row)","columns_desc":"Choose how summary cards should be displayed. The layout adjusts automatically when cards are hidden.","show_light_summary":"Show light summary","group_lights_by_floors":"Group lights by floors","group_lights_by_floors_desc":"Groups lights in the lights view by floors. Each floor gets its own section with on/off buttons.","nested_light_groups":"Show nested light groups","nested_light_groups_desc":"Shows light groups as expandable containers with their member lights underneath. Disabled by default to preserve the existing flat list behavior.","show_covers_summary":"Show cover summary","show_partially_open_covers":"Show partially open covers separately","show_partially_open_covers_desc":"Shows partially open covers (neither fully open nor closed) in a separate group.","show_security_summary":"Show security summary","show_climate_summary":"Show climate summary","show_climate_summary_desc":"Shows the climate summary card on the overview. Counts active thermostats and climate devices.","show_battery_summary":"Show battery summary","hide_mobile_app_batteries":"Hide mobile app batteries","hide_mobile_app_batteries_desc":"Hides batteries from smartphones, tablets, and watches (Mobile App) from the battery overview and summary.","battery_thresholds":"Battery thresholds","battery_critical_below":"Critical below","battery_low_below":"Low below","battery_thresholds_desc":"Thresholds for battery status groups (Critical / Low / Good).","section_info_cards":"Info Cards","show_weather":"Show weather card","show_weather_desc":"Shows the weather forecast card on the overview when a weather entity is available.","show_energy":"Show energy dashboard","show_energy_desc":"Shows the energy distribution card on the overview when energy data is available.","section_favorites":"Favorites","select_entity":"Select entity...","add":"+ Add","favorites_desc":"Select entities to be shown as favorites below the summaries. Entities are displayed as tiles.","show_state":"Show state","hide_last_changed":"Hide last changed","section_areas_rooms":"Areas & Rooms","section_areas":"Areas","group_by_floors":"Group areas by floors","group_by_floors_desc":"Groups areas on the overview by floors. When enabled, a separate section is created for each floor.","show_switches_on_areas":"Show switches on area cards","show_switches_on_areas_desc":"Shows switches as controls on the area cards in the overview. Home Assistant hides these by default.","show_alerts_on_areas":"Show alert icons on area cards","show_alerts_on_areas_desc":"Shows alert icons (e.g. motion, moisture, heat) on area cards when a binary sensor in the area is active.","show_locks_in_rooms":"Show locks in room views","show_locks_in_rooms_desc":"Shows locks (e.g. Nuki) in the respective room views. Locks always appear in the security overview regardless.","show_automations_in_rooms":"Show automations in room views","show_automations_in_rooms_desc":"Shows automations assigned to the area in the respective room views.","show_scripts_in_rooms":"Show scripts in room views","show_scripts_in_rooms_desc":"Shows scripts assigned to the area in the respective room views.","show_window_contacts_in_rooms":"Show window contacts in room views","show_window_contacts_in_rooms_desc":"Shows window contacts as badges in the respective room views.","show_door_contacts_in_rooms":"Show door contacts in room views","show_door_contacts_in_rooms_desc":"Shows door contacts as badges in the respective room views.","use_default_area_sort":"Use Home Assistant sorting","use_default_area_sort_desc":"Uses the area sorting from Home Assistant instead of the order configured here.","areas_manage_desc":"Choose which areas should be shown on the dashboard and in what order. Expand areas to manage individual entities.","section_room_pins":"Room Pins","room_pins_desc":"Select entities to be shown first in their assigned rooms. Ideal for entities that are not automatically detected (e.g. weather stations, special sensors). <strong>Only entities with room assignment can be selected.</strong> These pins only appear in their respective room, not on the overview.","section_views":"Views","show_summary_views":"Show summary views","show_summary_views_desc":"Shows the summary views (Lights, Covers, Security, Batteries) in the top navigation.","show_room_views":"Show room views","show_room_views_desc":"Shows individual room views in the top navigation.","section_advanced":"Advanced Features","section_custom_cards":"Custom Cards","custom_cards_heading_placeholder":"Custom Cards","custom_cards_desc":"Heading and icon for the custom cards section on the dashboard. Leave empty for defaults.","add_custom_card":"+ Add new card","video_tutorial":"Watch video tutorial","custom_cards_help":"Add custom cards to the overview. Cards appear in a separate section between summaries and areas. Tip: Create the card in a regular dashboard first, copy the YAML code, and paste it here.","section_custom_badges":"Custom Badges","add_custom_badge":"+ Add new badge","custom_badges_help":"Add custom badges to the overview header (next to person chips).","section_custom_views":"Custom Views","add_custom_view":"+ Add new view","custom_views_help":"Create custom views with any cards. Tip: Create the view in a regular dashboard first, copy the YAML code, and paste it here.","no_favorites":"No favorites added","no_room_pins":"No room pins added","no_results":"No results found","no_room":"No room","no_custom_views":"No custom views created","no_custom_cards":"No custom cards created","no_custom_badges":"No custom badges created","no_areas":"No areas available","no_entities_in_area":"No entities found in this area","loading_entities":"Loading entities...","new_view":"New View","new_card":"New Card","title_placeholder":"Title","path_placeholder":"Path (e.g. my-view)","yaml_placeholder":"Paste YAML code here...","card_title_placeholder":"Title (optional, shown as heading)","yaml_valid":"YAML valid","domain_lights":"Lighting","domain_climate":"Climate","domain_covers":"Blinds & Covers","domain_covers_curtain":"Curtains","domain_covers_window":"Windows, Doors & Gates","domain_media_player":"Media","domain_scenes":"Scenes","domain_vacuum":"Vacuums","domain_fan":"Fans","domain_switches":"Switches","domain_locks":"Locks","domain_badges":"Room Badges","badges_additional":"Additional Badges","badges_add":"Add","badges_select_entity":"Select entity...","badges_remove":"Remove","badges_show_name":"Show entity name on badge","badges_name_short":"Name"}}'),a={de:n,en:s.t(o,2)};function r(e,t){try{return e.split(".").reduce((e,t)=>e[t],a[t])}catch{return}}let c;function d(e){const t=e?.locale.language??e?.language??"en";c=e=>r(e,t)??r(e,"en")??e}function l(e){return c?c(e):e}},563(e,t,s){s.d(t,{To:()=>n,YN:()=>r,getVisibleAreasFromHass:()=>a,nG:()=>o}),s(241);const i=new Map;function n(e,t,s){if(!s.states[e])return e;const n=function(e,t){const s=t.states[e];return s?s.attributes?.friendly_name??e.split(".")[1].replace(/_/g," "):null}(e,s);if(!n)return e;const o=t.name;if(!o)return n;if(!i.has(o)){const e=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");i.set(o,{start:new RegExp(`^${e}\\s+`,"i"),end:new RegExp(`\\s+${e}$`,"i"),middle:new RegExp(`\\s+${e}\\s+`,"i")})}const a=i.get(o);if(!a)return n;const r=n.replace(a.start,"").replace(a.end,"").replace(a.middle," ").trim();return r.length>0&&r.toLowerCase()!==o.toLowerCase()?r:n}function o(e,t,s){const i=t?.hidden??[],n=e.filter(e=>!i.includes(e.area_id));if(s)return n;const o=t?.order??[];return o.length>0?n.sort((e,t)=>{const s=o.indexOf(e.area_id),i=o.indexOf(t.area_id);return-1!==s&&-1!==i?s-i:-1!==s?-1:-1!==i?1:e.name.localeCompare(t.name)}):n.sort((e,t)=>e.name.localeCompare(t.name)),n}function a(e,t,s){return o(Object.values(e.areas),t,s)}function r(e,t,s){const i=s.states[e],n=s.states[t];if(!i||!n)return 0;const o=new Date(i.last_changed).getTime();return new Date(n.last_changed).getTime()-o}["Rollo","Rollos","Rolladen","Rolläden","Vorhang","Vorhänge","Jalousie","Jalousien","Shutter","Shutters","Blind","Blinds"].map(e=>new RegExp(`\\b${e}\\b`,"gi"))},418(e,t,s){var i=s(217),n=s(241),o=s(598),a=s(563),r=s(475);const c=["light","fan","switch","cover-shutter","cover-blind","cover-curtain","cover-shade","cover-awning","cover-garage","cover-gate","cover-door","cover-window","cover-damper"],d=new Set(["motion","occupancy","sound","moisture","smoke","gas","heat","cold","safety","tamper","vibration"]);function l(e,t){const s=function(e,t){const s=n.Registry.getVisibleEntitiesForArea(e);if(0===s.length)return[];const i=new Set;for(const e of s){const s=t.states[e.entity_id];if(!s)continue;const o=e.entity_id.split(".")[0],a=s.attributes?.device_class;if("light"===o)i.add("light");else if("fan"===o)i.add("fan");else if("switch"===o&&n.Registry.config.show_switches_on_areas)i.add("switch");else if("cover"===o&&a){const e=`cover-${a}`;c.includes(e)&&i.add(e)}}return[...i]}(e.area_id,t),i=[];e.temperature_entity_id&&t.states[e.temperature_entity_id]&&i.push("temperature"),e.humidity_entity_id&&t.states[e.humidity_entity_id]&&i.push("humidity");const o=n.Registry.config.show_alerts_on_areas?function(e,t){const s=n.Registry.getVisibleEntitiesForArea(e);if(0===s.length)return[];const i=new Set;for(const e of s){if("binary_sensor"!==e.entity_id.split(".")[0])continue;const s=t.states[e.entity_id],n=s?.attributes?.device_class;n&&d.has(n)&&i.add(n)}return[...i]}(e.area_id,t):void 0;return{type:"area",area:e.area_id,display_type:"compact",sensor_classes:i.length>0?i:void 0,alert_classes:o&&o.length>0?o:void 0,features:s.length>0?[{type:"area-controls",controls:s}]:[],features_position:"inline",navigation_path:e.area_id,vertical:!1,grid_options:{columns:"full"}}}function h(e){return null==e?"mdi:floor-plan":-1===e?"mdi:home-floor-negative-1":e>=0&&e<=3?`mdi:home-floor-${e}`:"mdi:floor-plan"}function _(e,t){return e&&t?{type:"grid",cards:[{type:"heading",heading:(0,r.localize)("sections.weather"),heading_style:"title",icon:"mdi:weather-partly-cloudy"},{type:"weather-forecast",entity:e,forecast_type:"daily"}]}:null}function g(e,t=!0){return e?{type:"grid",cards:[{type:"heading",heading:(0,r.localize)("sections.energy"),heading_style:"title",icon:"mdi:lightning-bolt"},{type:"energy-distribution",link_dashboard:t}]}:null}var u=s(609);function m(e){const t=[];for(const s of e)s.parsed_config&&(Array.isArray(s.parsed_config)?t.push(...s.parsed_config):(s.title&&t.push({type:"heading",heading:s.title,heading_style:"subtitle"}),t.push(s.parsed_config)));return t}class p extends HTMLElement{static async generate(e,t){(0,u.sX)("overview-generate");const s=e.dashboardConfig||{};n.Registry.initialize(t,s);const c=(0,a.nG)(n.Registry.areas,s.areas_display,s.use_default_area_sort),d=(0,o.nR)(t,s),p=(0,o.tC)(t),f=(0,o.Ok)(t),y=function(e,t){const s=[];for(const i of e){if(!t.states[i.entity_id])continue;const e=t.entities[i.entity_id];if(!0===e?.hidden)continue;const n=i.name.split(" ")[0];s.push({type:"entity",entity:i.entity_id,name:n,show_entity_picture:!0,show_state:!0,state_content:"state",show_name:!0,show_icon:!0,tap_action:{action:"more-info"}})}return s}(d,t),w=!1!==s.show_weather,v=!1!==s.show_energy,b=!0===s.show_search_card,C=!0===s.group_by_floors,E=s.custom_cards||[],S=new Map;for(const e of E){const t=e.target_section||"custom_cards",s=S.get(t)||[];s.push(e),S.set(t,s)}const A=function(e){const{showSearchCard:t,config:s,hass:i}=e,n=!1!==s.show_clock_card,o=s.alarm_entity,a=[];(n||o)&&a.push({type:"heading",heading:(0,r.localize)("sections.overview"),heading_style:"title",icon:"mdi:overscan"}),n?o?(a.push({type:"clock",clock_size:"small",show_seconds:!1}),a.push({type:"tile",entity:o,vertical:!1})):a.push({type:"clock",clock_size:"small",show_seconds:!1,grid_options:{columns:"full"}}):o&&a.push({type:"tile",entity:o,vertical:!1,grid_options:{columns:"full"}}),t&&a.push({type:"custom:search-card",grid_options:{columns:"full"}});const c=s.summaries_columns||2,d=!1!==s.show_covers_summary,l=!1!==s.show_light_summary,h=!1!==s.show_security_summary,_=!1!==s.show_battery_summary,g=!0===s.show_climate_summary,u=[];if(l&&u.push({type:"custom:simon42-summary-card",summary_type:"lights",areas_options:s.areas_options||{}}),d&&u.push({type:"custom:simon42-summary-card",summary_type:"covers",areas_options:s.areas_options||{}}),h&&u.push({type:"custom:simon42-summary-card",summary_type:"security",areas_options:s.areas_options||{}}),_&&u.push({type:"custom:simon42-summary-card",summary_type:"batteries",areas_options:s.areas_options||{},hide_mobile_app_batteries:s.hide_mobile_app_batteries,battery_critical_threshold:s.battery_critical_threshold}),g&&u.push({type:"custom:simon42-summary-card",summary_type:"climate",areas_options:s.areas_options||{}}),u.length>0)if(a.push({type:"heading",heading:(0,r.localize)("sections.summaries")}),4===c)a.push({type:"horizontal-stack",cards:u});else for(let e=0;e<u.length;e+=2){const t=u.slice(e,e+2);a.push({type:"horizontal-stack",cards:t})}const m=(s.favorite_entities||[]).filter(e=>void 0!==i.states[e]);if(m.length>0){a.push({type:"heading",heading:(0,r.localize)("sections.favorites")});const e=!0===s.favorites_show_state,t=!0===s.favorites_hide_last_changed,i=[];e&&i.push("state"),t||i.push("last_changed");for(const e of m)a.push({type:"tile",entity:e,show_entity_picture:!0,vertical:!1,...i.length>0?{state_content:i}:{}})}return 0===a.length?null:{type:"grid",cards:a}}({someSensorId:f,showSearchCard:b,config:s,hass:t}),k=function(e,t,s){const i=e.filter(e=>e.parsed_config);if(0===i.length)return null;const n=[{type:"heading",heading:t||(0,r.localize)("sections.custom_cards"),icon:s||"mdi:cards"}];for(const e of i)Array.isArray(e.parsed_config)?n.push(...e.parsed_config):(e.title&&n.push({type:"heading",heading:e.title}),n.push(e.parsed_config));return{type:"grid",cards:n}}(S.get("custom_cards")||[],s.custom_cards_heading,s.custom_cards_icon),B=function(e,t=!1,s=null){if(!t||!s)return{type:"grid",cards:[{type:"heading",heading_style:"title",heading:(0,r.localize)("sections.areas")},...e.map(e=>l(e,s))]};const i=new Map,n=[];for(const t of e)t.floor_id?(i.has(t.floor_id)||i.set(t.floor_id,[]),i.get(t.floor_id)?.push(t)):n.push(t);const o=[],a=Object.keys(s.floors).filter(e=>i.has(e));for(const e of a){const t=i.get(e)??[],n=s.floors[e],a=n?.name||e,r=n?.icon||h(n?.level);o.push({type:"grid",cards:[{type:"heading",heading_style:"title",heading:a,icon:r},...t.map(e=>l(e,s))]})}return n.length>0&&o.push({type:"grid",cards:[{type:"heading",heading_style:"title",heading:(0,r.localize)("sections.areas_other"),icon:"mdi:home-outline"},...n.map(e=>l(e,s))]}),o}(c,C,t),R=new Map([["overview",A],["custom_cards",k],["areas",B],["weather",_(p??null,w)],["energy",g(v,!1!==s.energy_link_dashboard)]]),z=function(e){const t=new Set(["overview","custom_cards","areas","weather","energy"]),s=new Set,n=[];for(const i of e)t.has(i)&&!s.has(i)&&(n.push(i),s.add(i));for(const e of i.G)s.has(e)||n.push(e);return n}(s.sections_order??i.G),x=[];for(const e of z){const t=R.get(e);if(t&&(Array.isArray(t)?x.push(...t):x.push(t),"custom_cards"!==e)){const t=S.get(e);if(t&&t.length>0){const e=m(t);if(e.length>0){const t=x[x.length-1];t.cards&&t.cards.push(...e)}}}}const D=x.reduce((e,t)=>e+(t.cards?.length||0),0);(0,u.PZ)("overview-generate"),(0,u.cY)(`Overview: ${x.length} sections, ${D} cards, ${y.length} badges`);const F=(s.custom_badges||[]).filter(e=>e.parsed_config).map(e=>e.parsed_config);return function(e,t){return{title:(0,r.localize)("views.overview"),path:"home",icon:"mdi:home",type:"sections",max_columns:3,badges:t.length>0?t:void 0,header:t.length>0?{layout:"center",badges_position:"bottom",badges_wrap:"wrap"}:void 0,sections:e}}(x,[...y,...F])}}customElements.define("ll-strategy-simon42-view-overview",p)}}]);