this.hass.states[r]?.attributes.symcon_path||this.hass.states[r]?.attributes.friendly_name||r).join(`
@@ -1907,24 +1910,24 @@ ${n.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.reading span { color:var(--nf-muted,#aaa); }
b { white-space:nowrap; font-variant-numeric:tabular-nums; }
small { font-size:.85em; }
- `};customElements.get("nf-utility-report")||customElements.define("nf-utility-report",pc);var tx=/garage|carport|keller|cellar|basement|technik|heizung|heizraum|boiler|utility|werkstatt|schuppen|shed|dachboden|attic/i,Ti=t=>t.living??!tx.test(t.name),nx=.1,f_=t=>({x0:Math.min(...t.map(e=>e[0])),x1:Math.max(...t.map(e=>e[0])),z0:Math.min(...t.map(e=>e[1])),z1:Math.max(...t.map(e=>e[1]))});function fc(t,e,n,r,i=nx){if(n.points.length<3)return{roomId:n.id,floor:0,living:0,low:0};let o=f_(n.points),s=r.filter(f=>{let g=f_(f.footprint);return g.x1>=o.x0&&g.x0<=o.x1&&g.z1>=o.z0&&g.z0<=o.z1}),a=e.elevation+(n.ceiling!=null&&n.ceiling>0?n.ceiling:e.height),l=(t.settings.roof?.sections??[]).some(f=>!f.open),c=Ks(n),u=0,d=0,p=0;for(let f=o.x0+i/2;f
C([f,g],v.footprint)))continue;let b=l?jr(t,f,g):null,y=Math.min(a,b??1/0)-e.elevation-c;y>=2?u++:y>=1?d++:p++}let h=i*i;return{roomId:n.id,floor:(u+d+p)*h,living:Ti(n)?(u+d/2)*h:0,low:(d+p)*h}}var m_=new WeakMap;function zi(t,e){if(e.layer)return[];let n=m_.get(e);if(n&&n.roof===t.settings.roof)return n.areas;let r=rx(t,e);return m_.set(e,{roof:t.settings.roof,areas:r}),r}function rx(t,e){let n=fe(e.rooms,{exterior:t.settings.wall_exterior,interior:t.settings.wall_interior},e.walls??[]).walls;return e.rooms.map(r=>fc(t,e,r,n))}var mr=t=>t.reduce((e,n)=>({floor:e.floor+n.floor,living:e.living+n.living,low:e.low+n.low}),{floor:0,living:0,low:0});function g_(t,e,n){let r=t.floors.length,i=e?.name??(r===0?n.first:n.next(r));return{...We(I("floor"),i,Eu(t.floors,e?.level)),ha_floor:e?.floor_id??null}}function mc(t,e){let n=t.findIndex(i=>i.elevation>e.elevation),r=n<0?t.length:n;return[...t.slice(0,r),e,...t.slice(r)]}function __(t,e,n){let r=t.findIndex(s=>s.id===e),i=r+n;if(r<0||i<0||i>=t.length)return[...t];let o=[...t];return[o[r],o[i]]=[o[i],o[r]],o}function b_(t,e){let n=new Set(t.floors.map(r=>r.ha_floor));return Object.values(e??{}).filter(r=>!n.has(r.floor_id)).sort((r,i)=>(r.level??99)-(i.level??99)||r.name.localeCompare(i.name))}function gr(t,e,n){if(!e.ha_floor)return[];let r=new Set(t.floors.flatMap(i=>i.rooms.map(o=>o.area_id)));return Object.values(n??{}).filter(i=>i.floor_id===e.ha_floor&&!r.has(i.area_id)).sort((i,o)=>i.name.localeCompare(o.name))}function y_(t,e,n){return Object.values(n??{}).filter(r=>r.floor_id===e.ha_floor||!t.floors.some(i=>i.ha_floor===r.floor_id))}function v_(t,e,n,r,i=I){let o=structuredClone(e),s=t.floors.reduce((u,d)=>Math.max(u,d.elevation+d.height),e.elevation+e.height),a=new Map,l=new Map;o.id=i("floor"),o.name=n,o.elevation=Math.round(s*1e3)/1e3,o.ha_floor=null,o.start_view=null,o.rooms=o.rooms.map(u=>{let d=i("room");return a.set(u.id,d),{...u,id:d,area_id:null}}),o.walls=(o.walls??[]).map(u=>{let d=i("wall");return l.set(u.id,d),{...u,id:d}}),o.openings=o.openings.filter(u=>a.has(u.room_id)).map(u=>({...u,id:i("opening"),room_id:a.get(u.room_id),wall:u.wall?l.get(u.wall)??null:u.wall}));let c=new Set(["meter","inverter","home_battery","wallbox","grid_point"]);return o.furniture=r.furniture?o.furniture.filter(u=>!c.has(u.type)).map(u=>ax({...u,id:i("furniture")})):[],o.placements=r.devices?o.placements:[],o.outdoor=r.outdoor?o.outdoor.map(u=>({...u,id:i("outdoor")})):[],o}var ix=["entity","power","fan_entity","room_sensor"],ox=["door_left","door_right","soc","charge","export","status","temp_entity","temp_entity2","state_entity","state_entity2","color_entity","care_entity","cover_entity","type_entity","parent_meter","car","tap"],sx=["gang_entities","pictures","types","meter_floors","show_when","extra_lights"];function ax(t){let e={...t};for(let n of ix)(n==="entity"||n==="power"||e[n]!=null)&&(e[n]="none");for(let n of ox)e[n]!=null&&(e[n]=null);for(let n of sx)delete e[n];return e}function w_(t,e,n,r){let i=t.floors.find(l=>l.id===e),o=t.floors.find(l=>l.id===r);if(!i||!o||i===o)return!1;let s=i.furniture.findIndex(l=>l.id===n);if(s<0)return!1;let[a]=i.furniture.splice(s,1);return o.furniture.push(a),!0}function lx(t,e,n){if(e.layer||!e.rooms.length)return _;let r=t.t,i=mr(zi(t.doc,e)).living,o=mr(t.doc.floors.flatMap(s=>zi(t.doc,s))).living;return m`
+ `};customElements.get("nf-utility-report")||customElements.define("nf-utility-report",pc);var tx=/garage|carport|keller|cellar|basement|technik|heizung|heizraum|boiler|utility|werkstatt|schuppen|shed|dachboden|attic/i,Ti=t=>t.living??!tx.test(t.name),nx=.1,f_=t=>({x0:Math.min(...t.map(e=>e[0])),x1:Math.max(...t.map(e=>e[0])),z0:Math.min(...t.map(e=>e[1])),z1:Math.max(...t.map(e=>e[1]))});function fc(t,e,n,r,i=nx){if(n.points.length<3)return{roomId:n.id,floor:0,living:0,low:0};let o=f_(n.points),s=r.filter(f=>{let g=f_(f.footprint);return g.x1>=o.x0&&g.x0<=o.x1&&g.z1>=o.z0&&g.z0<=o.z1}),a=e.elevation+(n.ceiling!=null&&n.ceiling>0?n.ceiling:e.height),l=(t.settings.roof?.sections??[]).some(f=>!f.open),c=Ks(n),u=0,d=0,p=0;for(let f=o.x0+i/2;fC([f,g],v.footprint)))continue;let _=l?jr(t,f,g):null,y=Math.min(a,_??1/0)-e.elevation-c;y>=2?u++:y>=1?d++:p++}let h=i*i;return{roomId:n.id,floor:(u+d+p)*h,living:Ti(n)?(u+d/2)*h:0,low:(d+p)*h}}var m_=new WeakMap;function zi(t,e){if(e.layer)return[];let n=m_.get(e);if(n&&n.roof===t.settings.roof)return n.areas;let r=rx(t,e);return m_.set(e,{roof:t.settings.roof,areas:r}),r}function rx(t,e){let n=fe(e.rooms,{exterior:t.settings.wall_exterior,interior:t.settings.wall_interior},e.walls??[]).walls;return e.rooms.map(r=>fc(t,e,r,n))}var mr=t=>t.reduce((e,n)=>({floor:e.floor+n.floor,living:e.living+n.living,low:e.low+n.low}),{floor:0,living:0,low:0});function g_(t,e,n){let r=t.floors.length,i=e?.name??(r===0?n.first:n.next(r));return{...We(I("floor"),i,Eu(t.floors,e?.level)),ha_floor:e?.floor_id??null}}function mc(t,e){let n=t.findIndex(i=>i.elevation>e.elevation),r=n<0?t.length:n;return[...t.slice(0,r),e,...t.slice(r)]}function __(t,e,n){let r=t.findIndex(s=>s.id===e),i=r+n;if(r<0||i<0||i>=t.length)return[...t];let o=[...t];return[o[r],o[i]]=[o[i],o[r]],o}function b_(t,e){let n=new Set(t.floors.map(r=>r.ha_floor));return Object.values(e??{}).filter(r=>!n.has(r.floor_id)).sort((r,i)=>(r.level??99)-(i.level??99)||r.name.localeCompare(i.name))}function gr(t,e,n){if(!e.ha_floor)return[];let r=new Set(t.floors.flatMap(i=>i.rooms.map(o=>o.area_id)));return Object.values(n??{}).filter(i=>i.floor_id===e.ha_floor&&!r.has(i.area_id)).sort((i,o)=>i.name.localeCompare(o.name))}function y_(t,e,n){return Object.values(n??{}).filter(r=>r.floor_id===e.ha_floor||!t.floors.some(i=>i.ha_floor===r.floor_id))}function v_(t,e,n,r,i=I){let o=structuredClone(e),s=t.floors.reduce((u,d)=>Math.max(u,d.elevation+d.height),e.elevation+e.height),a=new Map,l=new Map;o.id=i("floor"),o.name=n,o.elevation=Math.round(s*1e3)/1e3,o.ha_floor=null,o.start_view=null,o.rooms=o.rooms.map(u=>{let d=i("room");return a.set(u.id,d),{...u,id:d,area_id:null}}),o.walls=(o.walls??[]).map(u=>{let d=i("wall");return l.set(u.id,d),{...u,id:d}}),o.openings=o.openings.filter(u=>a.has(u.room_id)).map(u=>({...u,id:i("opening"),room_id:a.get(u.room_id),wall:u.wall?l.get(u.wall)??null:u.wall}));let c=new Set(["meter","inverter","home_battery","wallbox","grid_point"]);return o.furniture=r.furniture?o.furniture.filter(u=>!c.has(u.type)).map(u=>ax({...u,id:i("furniture")})):[],o.placements=r.devices?o.placements:[],o.outdoor=r.outdoor?o.outdoor.map(u=>({...u,id:i("outdoor")})):[],o}var ix=["entity","power","fan_entity","room_sensor"],ox=["door_left","door_right","soc","charge","export","status","temp_entity","temp_entity2","state_entity","state_entity2","color_entity","care_entity","cover_entity","type_entity","parent_meter","car","tap"],sx=["gang_entities","pictures","types","meter_floors","show_when","extra_lights"];function ax(t){let e={...t};for(let n of ix)(n==="entity"||n==="power"||e[n]!=null)&&(e[n]="none");for(let n of ox)e[n]!=null&&(e[n]=null);for(let n of sx)delete e[n];return e}function w_(t,e,n,r){let i=t.floors.find(l=>l.id===e),o=t.floors.find(l=>l.id===r);if(!i||!o||i===o)return!1;let s=i.furniture.findIndex(l=>l.id===n);if(s<0)return!1;let[a]=i.furniture.splice(s,1);return o.furniture.push(a),!0}function lx(t,e,n){if(e.layer||!e.rooms.length)return b;let r=t.t,i=mr(zi(t.doc,e)).living,o=mr(t.doc.floors.flatMap(s=>zi(t.doc,s))).living;return m`
${r(t.doc.floors.length>1?"living_area_floor_house":"living_area_floor",{floor:ze(t.hass,i),house:ze(t.hass,o)})}
`}function cx(t,e,n,r){let i=b_(t.doc,t.hass?.floors),o=()=>i.length>0?e.floorMenu=!e.floorMenu:n.addFloor(null);return m`
${[...t.doc.floors].reverse().map(s=>m``)}
- ${t.admin?m``:_}
+ ${t.admin?m``:b}
${t.admin&&e.floorMenu?m``:_}`}function ux(t,e,n,r){let i=(o,s,a)=>m`a(Number(l.target.value)||0)} />`;return m`
+
`:b}`}function ux(t,e,n,r){let i=(o,s,a)=>m`a(Number(l.target.value)||0)} />`;return m`
${t.t("floor_shift")}
${i("X",e.shiftX,o=>e.shiftX=o)} ${i("Z",e.shiftZ,o=>e.shiftZ=o)}
- ${r.start_view?m``:_}
+ ${r.start_view?m``:b}
this.hass.states[r]?.attributes.symcon_path||this.hass.states
`}function px(t,e,n,r){let i=t.t,o=c=>t.change((u,d)=>Object.assign(d,c)),s=y_(t.doc,r,t.hass?.floors),a=gr(t.doc,r,t.hass?.areas),l=[["",i("no_ha_floor")],...s.map(c=>[c.floor_id,c.name])];return m`
${W(t,i("floor_name"),r.name,c=>o({name:c}),{wide:!0})}
${E(t,i("elevation"),r.elevation,c=>o({elevation:c}))}
- ${t.admin?ux(t,e,n,r):_}
+ ${t.admin?ux(t,e,n,r):b}
${E(t,i("height"),r.height,c=>o({height:Math.max(1,c)}),.05,1)}
- ${Object.keys(t.hass?.floors??{}).length>0?H(t,i("ha_floor"),r.ha_floor??"",l,c=>o({ha_floor:c||null}),{wide:!0}):_}
+ ${Object.keys(t.hass?.floors??{}).length>0?H(t,i("ha_floor"),r.ha_floor??"",l,c=>o({ha_floor:c||null}),{wide:!0}):b}
${D(t,i("floor_layer"),!!r.layer,c=>o({layer:c||void 0}),{title:i("floor_layer_hint")})}
- ${X(t.hass)?hx(t,r):m`${z(t,i("floor_power"),r.power_entity??null,void 0,O(t.hass,c=>c.startsWith("sensor.")&&t.hass?.states[c]?.attributes.device_class==="power"),c=>o({power_entity:c&&c!=="none"?c:null}))}${r.power_entity?S(i("floor_power_hint"),"nf-wide"):_}`}
- ${r.layer?_:Ue(t,i("wall_paint_floor"),r.wall_paint_outside,t.doc.settings.wall_paint_outside??Qi,c=>o({wall_paint_outside:c}))}
+ ${X(t.hass)?hx(t,r):m`${z(t,i("floor_power"),r.power_entity??null,void 0,O(t.hass,c=>c.startsWith("sensor.")&&t.hass?.states[c]?.attributes.device_class==="power"),c=>o({power_entity:c&&c!=="none"?c:null}))}${r.power_entity?S(i("floor_power_hint"),"nf-wide"):b}`}
+ ${r.layer?b:Ue(t,i("wall_paint_floor"),r.wall_paint_outside,t.doc.settings.wall_paint_outside??Qi,c=>o({wall_paint_outside:c}))}
${lx(t,r,n)}
- ${t.admin&&a.length>0?m`
`:_}
+ ${t.admin&&a.length>0?m`
`:b}
${t.admin?m`
- ${e.floorCopy?dx(t,e,n,e.floorCopy):_}
+ ${e.floorCopy?dx(t,e,n,e.floorCopy):b}
- ${e.notice?m`
${e.notice}
`:_}`:_}
+ ${e.notice?m`
${e.notice}
`:b}`:b}
`}function k_(t,e,n,r,i){return m`
${t.t("floors")}
- ${cx(t,e,n,i)} ${r?px(t,e,n,r):_}
- `}var x_=["lamp_downlight","lamp_spot","lamp_panel","lamp_ceiling"];function $_(t,e){let n=de(t.points);return{type:"lamp_downlight",rows:Math.max(1,Math.round((n.z1-n.z0)/1.2)),cols:Math.max(1,Math.round((n.x1-n.x0)/1.2)),entity:e[0]??null}}function ws(t,e){let[n,r,i]=nt[e.type];return Pu(t,e.rows,e.cols).map(([o,s])=>({id:I("furniture"),type:e.type,x:o,z:s,rotation:0,w:n,d:r,h:i,variant:null,entity:e.entity??"none",power:null}))}var gc=t=>Math.max(1,Math.min(12,Math.round(t)));var fx=globalThis.__nfAnnounced??new Set;globalThis.__nfAnnounced=fx;var S_=/^(media_player|assist_satellite)\./;function mx(t,e){return e?Object.values(t.entities??{}).filter(n=>!n.hidden&&(n.area_id??(n.device_id?t.devices?.[n.device_id]?.area_id:null))===e).map(n=>n.entity_id):[]}function M_(t,e){let n=t.states[e];return!n||n.state==="unavailable"?!1:e.startsWith("notify.")?t.entities?.[e]?.platform==="alexa_devices"&&e.endsWith("_announce"):n.state==="off"||n.state==="unknown"?!1:n.attributes.device_class!=="tv"}function R_(t,e,n){if(n.announce_speaker==="none")return null;if(n.announce_speaker)return n.announce_speaker;if(e&&n.points.length>=3){let o=[...e.placements.filter(s=>S_.test(s.entity_id)).map(s=>({id:s.entity_id,x:s.x,z:s.z})),...e.furniture.filter(s=>s.entity&&S_.test(s.entity)).map(s=>({id:s.entity,x:s.x,z:s.z}))].find(s=>C([s.x,s.z],n.points)&&M_(t,s.id));if(o)return o.id}let r=mx(t,n.area_id);for(let i of["assist_satellite.","notify.","media_player."]){let o=r.filter(s=>s.startsWith(i)&&M_(t,s)).sort()[0];if(o)return o}return null}function E_(t,e,n){return e.rooms.length===0?_:m`
+ ${cx(t,e,n,i)} ${r?px(t,e,n,r):b}
+ `}var x_=["lamp_downlight","lamp_spot","lamp_panel","lamp_ceiling"];function $_(t,e){let n=de(t.points);return{type:"lamp_downlight",rows:Math.max(1,Math.round((n.z1-n.z0)/1.2)),cols:Math.max(1,Math.round((n.x1-n.x0)/1.2)),entity:e[0]??null}}function ws(t,e){let[n,r,i]=nt[e.type];return Pu(t,e.rows,e.cols).map(([o,s])=>({id:I("furniture"),type:e.type,x:o,z:s,rotation:0,w:n,d:r,h:i,variant:null,entity:e.entity??"none",power:null}))}var gc=t=>Math.max(1,Math.min(12,Math.round(t)));var fx=globalThis.__nfAnnounced??new Set;globalThis.__nfAnnounced=fx;var S_=/^(media_player|assist_satellite)\./;function mx(t,e){return e?Object.values(t.entities??{}).filter(n=>!n.hidden&&(n.area_id??(n.device_id?t.devices?.[n.device_id]?.area_id:null))===e).map(n=>n.entity_id):[]}function M_(t,e){let n=t.states[e];return!n||n.state==="unavailable"?!1:e.startsWith("notify.")?t.entities?.[e]?.platform==="alexa_devices"&&e.endsWith("_announce"):n.state==="off"||n.state==="unknown"?!1:n.attributes.device_class!=="tv"}function R_(t,e,n){if(n.announce_speaker==="none")return null;if(n.announce_speaker)return n.announce_speaker;if(e&&n.points.length>=3){let o=[...e.placements.filter(s=>S_.test(s.entity_id)).map(s=>({id:s.entity_id,x:s.x,z:s.z})),...e.furniture.filter(s=>s.entity&&S_.test(s.entity)).map(s=>({id:s.entity,x:s.x,z:s.z}))].find(s=>C([s.x,s.z],n.points)&&M_(t,s.id));if(o)return o.id}let r=mx(t,n.area_id);for(let i of["assist_satellite.","notify.","media_player."]){let o=r.filter(s=>s.startsWith(i)&&M_(t,s)).sort()[0];if(o)return o}return null}function E_(t,e,n){return e.rooms.length===0?b:m`
${t.t("rooms")}
${e.rooms.map(r=>m`
`:b}
+ ${e.spots?gx(t,e,n,r):b}
+ ${e.packages?m`${dh.map(p)}${S(i("pkg_hint"))}
`:b}
`}var A_=ee`
.nf-value-links h4 { margin: 12px 0; }
.nf-value-add { min-width: 30px; font-size: 18px; padding: 3px 8px; }
@@ -4073,15 +4076,15 @@ ${n.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
.nf-hydronic-form summary { cursor:pointer; font-weight:500; }
.nf-hydronic-form details[open]>.nf-form { margin-top:9px; }
.nf-hydronic-control { border-top:1px solid var(--nf-line); padding-top:7px; }
-`;var F_=["cabinet","shelf","lamp","device"],Rn="own_studio";var wx={cabinet:{w:120,d:45,h:80,doors:2,drawers:1,shelves:2,base:"plinth",handle:"bar",back:!0,lamp:"floor",display:!1,mount:"floor",body:"white",front:"wood"},shelf:{w:80,d:35,h:180,doors:0,drawers:0,shelves:4,base:"none",handle:"none",back:!0,lamp:"floor",display:!1,mount:"floor",body:"wood",front:"wood"},lamp:{w:40,d:40,h:160,doors:0,drawers:0,shelves:0,base:"none",handle:"none",back:!1,lamp:"floor",display:!1,mount:"floor",body:"metal",front:"white"},device:{w:60,d:60,h:85,doors:0,drawers:0,shelves:0,base:"none",handle:"none",back:!1,lamp:"floor",display:!0,mount:"floor",body:"white",front:"dark"}},bc=(t,e)=>({kind:t,name:e,...wx[t]}),T_=(t,e)=>({...bc(e,t.name),body:t.body,front:t.front}),_r=(t,e,n)=>Math.min(n,Math.max(e,Number.isFinite(t)?t:e)),br=t=>Math.round(t*1e4)/1e4;function yc(t){return{...t,name:t.name.trim().slice(0,60),w:_r(Math.round(t.w),5,400),d:_r(Math.round(t.d),2,200),h:_r(Math.round(t.h),2,300),doors:_r(Math.round(t.doors),0,6),drawers:_r(Math.round(t.drawers),0,6),shelves:_r(Math.round(t.shelves),0,12)}}function ce(t,e,n,r,i,o,s,a,l={}){let[c,u,d]=t,p=(x,k,M)=>{let A=Math.max(-M,x-k/2),T=Math.min(M,x+k/2);return T-A<1e-4?[Math.max(-M,Math.min(M,x)),.001*M*2]:[(A+T)/2,T-A]},[h,f]=p(e,r,c/2),[g,b]=p(n,i,u/2),y=Math.max(0,Math.min(d*.999,o)),v=Math.max(d*.001,Math.min(d-y,s)),w=x=>br(Math.max(.001,Math.min(1,x)));return{shape:"box",x:br(h/c),z:br(g/u),w:w(f/c),d:w(b/u),y:br(y/d),h:w(v/d),color:a,...l}}function z_(t,e,n){let[r,i,o]=t;if(e==="legs"){let s=Math.min(.1,o*.25),a=Math.min(.04,r/6,i/6);for(let[l,c]of[[-1,-1],[1,-1],[-1,1],[1,1]])n.push(ce(t,l*(r/2-a),c*(i/2-a),a,a,0,s,"metal"));return s}if(e==="plinth"){let s=Math.min(.08,o*.2);return n.push(ce(t,0,-.02,r-.02,i-.04,0,s,"dark")),s}return 0}function kx(t,e){let[n,r,i]=e,o=[],s=z_(e,t.base,o),a=t.doors+t.drawers>0,l=t.handle==="none"||!a?0:Math.min(.025,r*.08),c=a?Math.min(.02,r*.1):0,u=r-c-l,d=-r/2+u/2,p=i-s;if(!a){let v=Math.min(.018,n/10,p/10);o.push(ce(e,-n/2+v/2,0,v,r,s,p,t.body,{edges:!0})),o.push(ce(e,n/2-v/2,0,v,r,s,p,t.body,{edges:!0})),o.push(ce(e,0,-r/2+.005,n-2*v,.01,s,p,t.body));for(let w=0;w<=t.shelves+1;w++)o.push(ce(e,0,.005,n-2*v,r-.01,s+(p-v)*w/(t.shelves+1),v,t.front,{edges:"faint"}));return o}o.push(ce(e,0,d,n,u,s,p,t.body,{edges:!0}));let h=.004,f=-r/2+u+c/2,g=t.doors>0?Math.min(.18,Math.max(.08,(p-.3)/Math.max(1,t.drawers))):p/t.drawers,b=s+(t.drawers>0?g*t.drawers:0),y=(v,w,x)=>{if(t.handle==="none")return;let k=r/2-l/2;t.handle==="knob"?o.push(ce(e,v,k,.025,l,w-.0125,.025,"metal")):x?o.push(ce(e,v,k,.015,l,w-.08,.16,"metal")):o.push(ce(e,v,k,Math.min(.16,n*.4),l,w-.0075,.015,"metal"))};for(let v=0;v0){let v=n/t.doors,w=i-b;for(let x=0;x1.2?.45:.8);y(k+M*(v/2-.04),Math.min(A,i-.1),!0)}}return o}function xx(t,e){let[n,r,i]=e,o=Math.min(.02,n/10,i/10),s=[ce(e,-n/2+o/2,0,o,r,0,i,t.body,{edges:!0}),ce(e,n/2-o/2,0,o,r,0,i,t.body,{edges:!0})];t.back&&s.push(ce(e,0,-r/2+.005,n-2*o,.01,0,i,t.body));let a=t.shelves+2;for(let l=0;l({...ce(e,l,c,u,u,d,p,h,f),shape:"cyl"}),a=(l,c,u)=>({...ce(e,0,0,o,o,l,c,t.front,{glow:!0,edges:"faint"}),shape:"loft",tw:br(Math.min(1,o*u/n)),td:br(Math.min(1,o*u/r))});switch(t.lamp){case"pendant":{let l=Math.min(.3,i*.4);return[s(0,0,Math.min(.12,o),i-.03,.03,t.body),s(0,0,Math.min(.01,o/4),l,i-l-.03,"dark"),a(0,l,.35)]}case"wall":{let l=Math.min(.02,r*.2);return[ce(e,0,-r/2+l/2,Math.min(.1,n),l,i*.3,i*.4,t.body),ce(e,0,0,Math.min(.02,n),r-l,i*.45,Math.min(.02,i*.1),t.body),a(i*.15,i*.7,.7)]}default:{let l=Math.min(t.lamp==="table"?.25:.35,i*.4);return[s(0,0,o*.6,0,Math.min(.03,i*.05),t.body,{edges:!0}),s(0,0,Math.min(.03,o/6),.02,i-l-.02,t.body),a(i-l,l,.7)]}}}function Sx(t,e){let[n,r,i]=e,o=[],s=t.mount==="floor"?z_(e,t.base,o):0,a=t.display?Math.min(.01,r*.1):0;if(o.push(ce(e,0,-a/2,n,r-a,s,i-s,t.body,{edges:!0})),t.display){let l=Math.min(.02,n*.08,(i-s)*.08);o.push(ce(e,0,r/2-a/2,n-2*l,a,s+l,i-s-2*l,t.front,{screen:!0}))}return o}function ks(t,e,n){let r=yc(t),i=[r.w/100,r.d/100,r.h/100],o=r.name||e,s=n==="en"?{en:o}:{[n.slice(0,5)]:o,en:o},a={id:e,name:s,size:i,parts:[],recipe:r};switch(r.kind){case"cabinet":a.parts=kx(r,i),a.surface=!0;break;case"shelf":a.parts=xx(r,i);break;case"lamp":a.parts=$x(r,i),a.light=r.lamp,a.mount=r.lamp==="pendant"?"ceiling":r.lamp==="wall"?"wall":r.lamp==="table"?"surface":"floor",r.lamp==="wall"&&(a.wall_y=1.6);break;case"device":a.parts=Sx(r,i),a.electric=!0,a.mount=r.mount,r.mount==="wall"&&(a.wall_y=1.2);break}return a}function P_(t,e){let n=t.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").replace(/ß/g,"ss").replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"").slice(0,32)||"piece",r=/^[a-z0-9]/.test(n)?n:`p${n}`;if(!e.includes(r))return r;for(let i=2;;i++)if(!e.includes(`${r}_${i}`))return`${r}_${i}`}var D_=["white","wood","body","metal","dark","glass","accent"],Mx={white:"#dfe6f2",wood:"#8a6a4a",body:"#3a4a6a",metal:"#9aa7bf",dark:"#1e2638",glass:"#7fd0e8",accent:"#37e0ff",fabric:"#4b5d8c",cushion:"#6a7fb3"},O_=t=>Mx[t]??t;function Rx(t){let e=ks(t,"preview","en"),[n,,r]=e.size,i=180/Math.max(n,r),[o,s]=[n*i,r*i],a=[...e.parts].sort((l,c)=>l.z+l.d/2-(c.z+c.d/2));return m`
@@ -4104,10 +4107,10 @@ ${n.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
${e.filter(s=>s.floorId===o.id).map(s=>m`
${Ex[s.kind]}${Ax(t,s)}
n.fix(s)}>${Fx(t,s)}
- ${s.entityIds?Tx(t,s.entityIds,n):_}
+ ${s.entityIds?Tx(t,s.entityIds,n):b}
`)}
`)}`}
- ${(t.doc.settings.check_ignore??[]).length>0?m`n.resetIgnored()}>${r("check_reset_ignored",{n:t.doc.settings.check_ignore.length})}
`:_}
+ ${(t.doc.settings.check_ignore??[]).length>0?m`n.resetIgnored()}>${r("check_reset_ignored",{n:t.doc.settings.check_ignore.length})}
`:b}
`}function Tx(t,e,n){let r=t.t;return m`
${r("check_show_devices",{n:e.length})}
@@ -4115,7 +4118,7 @@ ${n.sources.map(r=>this.hass.states[r]?.attributes.symcon_path||this.hass.states
n.ignore([i])}>${r("check_fix_ignore")}`)}
n.ignore(e)}>${r("check_ignore_all",{n:e.length})}
- `}var C_=(t,e)=>m`✓ ${t.t("check_open")}`;function N_(t,e){if(!e||!Number.isFinite(e.value))return null;let n=/^\s*([^/\s]+)\s*\/\s*kWh\s*$/i.exec(e.unit);if(!n)return null;let r=/^(ct|cent|cents|c)$/i.test(n[1]),i=r||/^eur$/i.test(n[1])?"\u20AC":n[1];return{value:Math.round(t*e.value*(r?1:100))/100,currency:i}}var V_=20,B_=new WeakMap;function zx(t){let e=t.entities??{},n=B_.get(e);if(!n){n=new Map;for(let[r,i]of Object.entries(e))i.device_id&&r.startsWith("sensor.")&&t.states[r]?.attributes.device_class==="battery"&&!n.has(i.device_id)&&n.set(i.device_id,r);B_.set(e,n)}return n}function Px(t,e){let n=t.entities?.[e]?.device_id,r=n?zx(t).get(n):void 0;if(r){let s=Number(t.states[r]?.state);if(Number.isFinite(s))return s}let i=t.states[e]?.attributes;if(!i||i.battery_level===void 0&&i.battery===void 0)return null;let o=Number(i.battery_level??i.battery);return Number.isFinite(o)?o:null}function Dx(t){let e=[],n=r=>typeof r=="string"&&/^[a-z_]+\.[a-z0-9_]+$/.test(r);for(let r of t.placements)e.push({entity:r.entity_id,x:r.x,z:r.z,room:null});for(let r of t.furniture)for(let i of[r.entity,r.power])n(i)&&e.push({entity:i,x:r.x,z:r.z,room:null});for(let r of t.openings)for(let i of[r.contact,r.contact2,r.tilt,r.tilt2,r.cover,r.cover2,r.lock])n(i)&&e.push({entity:i,x:NaN,z:NaN,room:r.room_id});return e}var Ix=(t,e,n)=>t.rooms.find(r=>r.points.length>=3&&C([e,n],r.points));function W_(t,e){let n=new Set,r=[];for(let i of e.floors)for(let o of Dx(i)){let s=t.entities?.[o.entity]?.device_id??o.entity;if(n.has(s))continue;let a=Px(t,o.entity);a!==null&&(n.add(s),r.push({entity:o.entity,level:a,floorId:i.id,roomId:o.room??Ix(i,o.x,o.z)?.id??null}))}return r.sort((i,o)=>i.level-o.level)}var yr=.08;function K_(t,e){let n=1/0;for(let r=0;r0?Math.max(0,Math.min(1,((t[0]-i[0])*s+(t[1]-i[1])*a)/l)):0;n=Math.min(n,Math.hypot(t[0]-(i[0]+s*c),t[1]-(i[1]+a*c)))}return n}var j_=t=>({x0:Math.min(...t.map(e=>e[0])),x1:Math.max(...t.map(e=>e[0])),z0:Math.min(...t.map(e=>e[1])),z1:Math.max(...t.map(e=>e[1]))});function Ox(t,e,n=.2){if(t.points.length<3||e.points.length<3)return!1;let[r,i]=[j_(t.points),j_(e.points)],o=Math.max(r.x0,i.x0)+yr,s=Math.min(r.x1,i.x1)-yr,a=Math.max(r.z0,i.z0)+yr,l=Math.min(r.z1,i.z1)-yr;if(s<=o||l<=a)return!1;for(let c=o;c<=s+1e-9;c+=Math.min(n,s-o||n))for(let u=a;u<=l+1e-9;u+=Math.min(n,l-a||n)){let d=[c,u];if(C(d,t.points)&&C(d,e.points)&&K_(d,t.points)>yr&&K_(d,e.points)>yr)return!0}return!1}function G_(t){let e=new Set(["id","type","variant","name","icon","picture","vehicle","room_id","wall"]),n=r=>typeof r=="string"&&/^[a-z_]+\.[a-z0-9_]+$/.test(r);return Object.entries(t).flatMap(([r,i])=>e.has(r)?[]:Array.isArray(i)?i.filter(n):n(i)?[i]:[])}var U_=t=>G_(t),Hx=3,Lx=new Set(["off","standby","idle"]);function Cx(t,e,n,r){let i=e.energy.tariff,o=i?t.states[i]:void 0,s=o?{value:Number(o.state),unit:String(o.attributes.unit_of_measurement??"")}:null,a=new Set,l=(c,u)=>{if(!c||c==="none"||a.has(c))return;a.add(c);let d=t.states[c]?.state;if(!d||!Lx.has(d)||c.startsWith("light."))return;let p=ui(t,c),h=p?Fe(t.states[p]):null;if(h===null||h<=Hx)return;let f=N_(h*24*365/1e3,s);r.push({kind:"standby",floorId:n.id,vars:{name:B(t,c),w:Math.round(h),cost:f?`${f.value.toFixed(0)} ${f.currency}`:`${Math.round(h*24*365/1e3)} kWh`},fix:u,changes:!1})};for(let c of n.furniture)l(c.entity,{do:"show_furniture",furnitureId:c.id});for(let c of n.placements){let u=n.rooms.find(d=>d.points.length>=3&&C([c.x,c.z],d.points));u&&l(c.entity_id,{do:"show_room",roomId:u.id})}}function Z_(t,e){let n=[],r=e?.areas,i=new Set(t.settings.check_ignore??[]),o=new Set(t.floors.flatMap(s=>s.rooms.map(a=>a.area_id)).filter(s=>!!s));for(let s of t.floors){if(s.layer)continue;for(let l of s.rooms){if(l.area_id)continue;let c=Object.values(r??{}).find(u=>u.name.trim().toLowerCase()===l.name.trim().toLowerCase()&&!o.has(u.area_id));n.push(c?{kind:"room_no_area",floorId:s.id,vars:{room:l.name,area:c.name},fix:{do:"set_area",roomId:l.id,areaId:c.area_id},changes:!0}:{kind:"room_no_area",floorId:s.id,vars:{room:l.name,area:""},fix:{do:"show_room",roomId:l.id},changes:!1})}let a=gr(t,s,r);if(a.length&&n.push({kind:"areas_unplaced",floorId:s.id,vars:{n:a.length,names:a.map(l=>l.name).join(", ")},fix:{do:"add_area_rooms"},changes:!0}),e){let l=Me(e,[s]),c=Ht(e,[s]);for(let u of s.rooms){if(!u.area_id)continue;let d=ns(s,u);for(let f of s.furniture)if(C([f.x,f.z],u.points))for(let g of U_(f))d.add(g);for(let f of s.openings)if(f.room_id===u.id){for(let g of G_(f))d.add(g);for(let g of Object.values(c.get(f.id)??{}))typeof g=="string"&&d.add(g)}for(let f of s.furniture){let g=l.get(f.id);if(g&&C([f.x,f.z],u.points))for(let b of[g.entity,g.power])typeof b=="string"&&d.add(b)}let p=ye(e,u).filter(f=>Tt(je(e,f))),h=On(e,p).map(f=>f.primary).filter(f=>!d.has(f)&&!i.has(f));h.length&&n.push({kind:"devices_unplaced",floorId:s.id,vars:{room:u.name,n:h.length},fix:{do:"place_devices",roomId:u.id,entityIds:h},entityIds:h,changes:!0})}}for(let l=0;ld.id===c.room_id)?.name??""},fix:{do:"show_opening",openingId:c.id},changes:!1})}}if(e&&Cx(e,t,s,n),e&&Object.keys(e.states).length){let l=s.placements.map(c=>c.entity_id).filter(c=>!e.states[c]);l.length&&n.push({kind:"entity_missing",floorId:s.id,vars:{n:l.length,ids:l.slice(0,3).join(", ")},fix:{do:"remove_placements",entityIds:l},changes:!0});for(let c of s.furniture){let u=U_(c).filter(d=>d!=="none"&&!e.states[d]);u.length&&!(ue(c.type)&&!c.entity)&&n.push({kind:"furniture_entity_missing",floorId:s.id,vars:{id:u[0]},fix:{do:"show_furniture",furnitureId:c.id},changes:!1})}}}if(e)for(let s of W_(e,t)){if(s.level>=V_)break;n.push({kind:"battery_low",floorId:s.floorId,vars:{name:B(e,s.entity),level:Math.round(s.level)},fix:s.roomId?{do:"show_room",roomId:s.roomId}:{do:"show_floor"},changes:!1})}return n}var re=t=>t.replace(/[&<>"]/g,e=>({"&":"&","<":"<",">":">",'"':"""})[e]),En=t=>t.map(([e,n])=>`${e.toFixed(3)},${n.toFixed(3)}`).join(" ");function Nx(t,e,n,r){let i=fe(e.rooms,{exterior:t.settings.wall_exterior,interior:t.settings.wall_interior},e.walls??[]).walls,o=[...e.rooms.flatMap(y=>y.points),...i.flatMap(y=>y.footprint)];if(!o.length)return"";let[s,a]=[Math.min(...o.map(y=>y[0])),Math.max(...o.map(y=>y[0]))],[l,c]=[Math.min(...o.map(y=>y[1])),Math.max(...o.map(y=>y[1]))],u=1.2,d=[];for(let y of e.rooms)d.push(``);for(let y of i)d.push(``);for(let y of e.openings){let v=Ce(y,e.rooms,e.walls??[]),w=v?Kt(i,y,v):null;if(!w)continue;let{wall:x,s:k}=w,M=Math.hypot(x.b[0]-x.a[0],x.b[1]-x.a[1]);if(M<1e-6)continue;let A=[(x.b[0]-x.a[0])/M,(x.b[1]-x.a[1])/M],T=[-A[1],A[0]],F=(q,ke)=>[x.a[0]+A[0]*q+T[0]*ke,x.a[1]+A[1]*q+T[1]*ke],[L,P]=[k-y.width/2,k+y.width/2],[N,V]=[x.left+.01,-(x.right+.01)];if(d.push(``),y.type==="garage"){let q=(x.left-x.right)/2;d.push(``)}else if(y.type==="window"){let q=(x.left-x.right)/2;d.push(``),d.push(``)}else{let q=y.room_id===x.roomRight?-1:1,ke=F(L,q*(q>0?x.left:x.right)),Ft=F(L,q*((q>0?x.left:x.right)+y.width)),j=F(P,q*(q>0?x.left:x.right));d.push(``)}}let p=new Map(n.map(y=>[y.roomId,y]));for(let y of e.rooms){if(y.points.length<3)continue;let[v,w]=be(y.points),x=p.get(y.id);d.push(`${re(y.name)}`),x&&d.push(`${re(r.area(x.living>0?x.living:x.floor))}`)}let h=(y,v,w,x,k,M)=>{let T=(y+w)/2,F=(v+x)/2,L=M?`M ${y-.15} ${v} L ${y+.15} ${v} M ${w-.15} ${x} L ${w+.15} ${x}`:`M ${y} ${v-.15} L ${y} ${v+.15} M ${w} ${x-.15} L ${w} ${x+.15}`,P=M?`${re(k)}`:`${re(k)}`;return`${P}`};d.push(h(s,c+.5,a,c+.5,r.length(a-s),!1)),d.push(h(s-.5,l,s-.5,c,r.length(c-l),!0)),d.push(`${re(r.length(1))}`);let[f,g]=[a-s+2*u,c-l+2*u];return`${d.join("")}`}function q_(t,e){let n=t.floors.filter(l=>!l.layer&&l.rooms.length),r=[],i=[],o=[];for(let l of[...n].sort((c,u)=>c.elevation-u.elevation)){let c=zi(t,l);o.push(...c);let u=mr(c);r.push(`${re(l.name)}
${re(e.living)}: ${re(e.area(u.living))}
${Nx(t,l,c,e)}`),i.push(`| ${re(l.name)} |
`);for(let d of c){let p=l.rooms.find(h=>h.id===d.roomId);i.push(`| ${re(p.name)} | ${re(e.area(d.floor))} | ${d.low>.05?re(e.area(d.low)):""} | ${re(e.area(d.living))} |
`)}i.push(`| ${re(e.total)} | ${re(e.area(u.floor))} | ${u.low>.05?re(e.area(u.low)):""} | ${re(e.area(u.living))} |
`)}let s=mr(o),a=`${re(e.living)}
| ${re(e.room)} | ${re(e.floorArea)} | ${re(e.low)} | ${re(e.living)} |
${i.join("")}| ${re(e.total)} | ${re(e.area(s.floor))} | ${s.low>.05?re(e.area(s.low)):""} | ${re(e.area(s.living))} |
${re(e.note)}
`;return`${re(e.title)}