feat: show scoped utility overviews and compact trend controls
This commit is contained in:
1 parent
2bf5f4a60a
commit
5fd674bb00
17 files changed
+987
-456
No files matched your search
@@ -6,6 +6,8 @@ All notable changes to NextFloor, newest first. Every release lists what is **Ad
|
||||
|
||||
### Added
|
||||
|
||||
- **Native utility overview by scope:** The top bar shows building totals in all-floors view and the selected floor's totals otherwise. A quiet, foldable side card lists floors or rooms with power/flow and consumption, trend access, live updates and navigation. Building totals respect floor overrides and deduplicate shared native meters.
|
||||
|
||||
- **Native Symcon archive trends:** Logged values expose a compact trend icon in floating room cards and room/HVAC/weather/meter readouts. A lazy dialog reads original archive data with custom time/resolution and Y limits, time navigation, wheel/drag zoom, line/step/bar/table views, min/max, live refresh and CSV export. Counter aggregation uses native interval consumption; Boolean/string logs, empty/error/limited responses and different units are handled explicitly.
|
||||
|
||||
- **Native Symcon utility meters:** Discover electricity, water, gas, heating and cooling meters in a room's linked area hierarchy, including hidden categories and dummy modules. Display instantaneous power/flow and cumulative energy/consumption separately, sum compatible room readings per floor, and allow independent floor meter overrides for every medium through the object-tree picker. Preserve periods and units, deduplicate links, prefer parent totals over sub-meters, watch live updates, and expose room and floor reports.
|
||||
@@ -25,6 +27,8 @@ All notable changes to NextFloor, newest first. Every release lists what is **Ad
|
||||
|
||||
### Changed
|
||||
|
||||
- **Compact trend popup:** Move custom time/resolution, display options, Y limits and CSV behind a settings button, keep a compact quick toolbar, and give the responsive chart most of the popup height. The settings overlay preserves chart size.
|
||||
|
||||
- **Explicit Symcon area names:** Selecting a room area preserves the room name. A dedicated button adopts only the actual leaf category name.
|
||||
|
||||
- **Incomplete Symcon utility sums:** Keep the sum of available meter values and prefix it with `Err:` in room/floor reports and power labels. Show `Err: –` when every source is unavailable and remove the marker automatically after recovery.
|
||||
|
||||
@@ -1816,7 +1816,7 @@ ${i}`}else o=Rh(s)}}catch(s){let l=s.message,a={not_json:"import_error_not_json"
|
||||
<div class="nf-form">${lk(t,e)}</div>
|
||||
${M(o("solar_string_hint"))} ${M(o("solar_form_hint"))}
|
||||
${n.admin?X(m`<button class="nf-btn" ?disabled=${!l} @click=${()=>l&&i({...Vn(l,e.id),portrait:e.portrait})}>${o("solar_fit")}</button>`,m`<button class="nf-btn nf-danger" @click=${()=>r.removeField()}>${o("delete")}</button>`):_}
|
||||
</section>`}var wg=t=>Math.round(t*1e3)/1e3,qi=class{ctx;sectionSel=null;windowSel=null;chimneySel=null;fieldSel=null;pickMode=!1;constructor(e){this.ctx=e}get sectionId(){return this.sectionSel}set sectionId(e){this.sectionSel=e,this.ctx.refresh()}get windowId(){return this.windowSel}set windowId(e){this.windowSel=e,this.ctx.refresh()}get chimneyId(){return this.chimneySel}set chimneyId(e){this.chimneySel=e,e&&(this.windowSel=null),this.ctx.refresh()}get solarId(){return this.fieldSel}set solarId(e){this.fieldSel=e,this.ctx.refresh()}get picking(){return this.pickMode}set picking(e){this.pickMode=e,this.ctx.refresh()}get doc(){return this.ctx.host.doc}get settings(){return this.doc.settings.roof}get admin(){return this.ctx.host.admin}get section(){return this.sectionSel?this.settings.sections?.find(e=>e.id===this.sectionSel):void 0}get window(){return this.windowSel?this.settings.windows?.find(e=>e.id===this.windowSel):void 0}get chimney(){return this.chimneySel?this.settings.chimneys?.find(e=>e.id===this.chimneySel):void 0}get field(){return this.fieldSel?this.settings.solar?.find(e=>e.id===this.fieldSel):void 0}isFixed(e){return!!e&&(!!e.locked||!!this.doc.settings.lock_plan)}useSections(e=!1){if(!this.admin)return;let n=(this.settings.sections??[]).length>0;e&&n&&!this.ctx.confirm(this.ctx.host.t("roof_regen_confirm"))||(this.ctx.host.change(r=>{r.settings.roof.type="custom",(e||!n)&&(r.settings.roof.sections=la(r,()=>I("roof")))}),this.sectionId=null)}addSection(e,n){if(!this.admin)return;let r=of(this.doc,e,n);this.ctx.host.change(o=>{o.settings.roof.type="custom",o.settings.roof.sections=[...o.settings.roof.sections??[],r]}),this.sectionId=r.id}takeOutline(){let e=this.ctx.host.floor;if(!e||!this.sectionSel||!this.admin)return;let{wall_exterior:n,wall_interior:r}=this.doc.settings,o=ea(e.rooms,e.walls??[],n,r);if(!o)return;let i=o.map(([s,l])=>[wg(s),wg(l)]);this.patchSection({shape:"flat",points:i,...Nt(i)})}addDormer(e){let n=this.section;if(!n||!this.admin)return;let r=ta(n,e,I("roof"));this.ctx.host.change(o=>{o.settings.roof.sections=[...o.settings.roof.sections??[],r]}),this.sectionId=r.id}patchSection(e){let n=this.sectionSel;!n||!this.admin||this.ctx.host.change(r=>{let o=r.settings.roof.sections?.find(i=>i.id===n);o&&Object.assign(o,e)})}removeCorner(e){let n=this.sectionSel;!n||!this.admin||this.ctx.host.change(r=>{let o=r.settings.roof.sections?.find(i=>i.id===n);o&&cf(o,e)})}removeSection(){let e=this.sectionSel;!e||!this.admin||(this.ctx.host.change(n=>n.settings.roof.sections=(n.settings.roof.sections??[]).filter(r=>r.id!==e)),this.sectionId=null)}duplicateSection(){let e=this.section;if(!e||!this.admin)return;let n=sf(e);this.ctx.host.change(r=>r.settings.roof.sections=[...r.settings.roof.sections??[],n]),this.sectionId=n.id}addWindow(){if(!this.admin)return;let e=this.doc.settings.north??0,n=Yr(Z(this.doc).filter(o=>!o.flat),e)??Z(this.doc)[0];if(!n)return;let r=Zr(n,I("rwin"));this.ctx.host.change(o=>o.settings.roof.windows=[...o.settings.roof.windows??[],r]),this.windowSel=r.id,this.sectionId=null}patchWindow(e){let n=this.windowSel;!n||!this.admin||this.ctx.host.change(r=>{let o=r.settings.roof.windows?.find(s=>s.id===n);if(!o)return;Object.assign(o,e);let i=Z(r).find(s=>s.key===o.face);i&&Object.assign(o,ft(i,dn(o)))})}removeWindow(){let e=this.windowSel;!e||!this.admin||(this.ctx.host.change(n=>n.settings.roof.windows=(n.settings.roof.windows??[]).filter(r=>r.id!==e)),this.windowId=null)}addChimney(){if(!this.admin)return;let e=Z(this.doc),n=e.find(o=>!o.flat)??e[0];if(!n)return;let r=qr(n,I("chim"));this.ctx.host.change(o=>o.settings.roof.chimneys=[...o.settings.roof.chimneys??[],r]),this.chimneySel=r.id,this.windowSel=null,this.sectionId=null}patchChimney(e){let n=this.chimneySel;!n||!this.admin||this.ctx.host.change(r=>{let o=r.settings.roof.chimneys?.find(s=>s.id===n);if(!o)return;Object.assign(o,e);let i=Z(r).find(s=>s.key===o.face);i&&Object.assign(o,ft(i,kt(o,i)))})}removeChimney(){let e=this.chimneySel;!e||!this.admin||(this.ctx.host.change(n=>n.settings.roof.chimneys=(n.settings.roof.chimneys??[]).filter(r=>r.id!==e)),this.chimneyId=null)}addField(){if(!this.admin)return;let e=Z(this.doc),n=new Set((this.settings.solar??[]).map(i=>i.face)),r=this.doc.settings.north??0,o=Yr(e.filter(i=>!n.has(i.key)),r)??Yr(e,r);o&&(this.appendField(Vn(o,I("pv"))),this.sectionSel=null)}addWallField(){let e=this.ctx.floorId()??this.doc.floors[0]?.id,n=this.admin&&e?fa(this.doc,I("pv"),e):null;n&&this.appendField(n)}addGroundField(){this.admin&&this.appendField(Gr(this.doc,I("pv")))}appendField(e){this.ctx.host.change(n=>n.settings.roof.solar=[...n.settings.roof.solar??[],e]),this.solarId=e.id}selectField(e){this.fieldSel=e,this.sectionSel=null;let n=this.settings.solar?.find(r=>r.id===e);n?.face.startsWith("wall:")&&this.ctx.setFloorId(n.face.split(":")[1]),this.ctx.refresh()}patchField(e){this.editField((n,r)=>{Object.assign(n,e);let o=$e(r,n);o&&Object.assign(n,ft(o,n))})}toggleCellLine truncated
|
||||
</section>`}var wg=t=>Math.round(t*1e3)/1e3,qi=class{ctx;sectionSel=null;windowSel=null;chimneySel=null;fieldSel=null;pickMode=!1;constructor(e){this.ctx=e}get sectionId(){return this.sectionSel}set sectionId(e){this.sectionSel=e,this.ctx.refresh()}get windowId(){return this.windowSel}set windowId(e){this.windowSel=e,this.ctx.refresh()}get chimneyId(){return this.chimneySel}set chimneyId(e){this.chimneySel=e,e&&(this.windowSel=null),this.ctx.refresh()}get solarId(){return this.fieldSel}set solarId(e){this.fieldSel=e,this.ctx.refresh()}get picking(){return this.pickMode}set picking(e){this.pickMode=e,this.ctx.refresh()}get doc(){return this.ctx.host.doc}get settings(){return this.doc.settings.roof}get admin(){return this.ctx.host.admin}get section(){return this.sectionSel?this.settings.sections?.find(e=>e.id===this.sectionSel):void 0}get window(){return this.windowSel?this.settings.windows?.find(e=>e.id===this.windowSel):void 0}get chimney(){return this.chimneySel?this.settings.chimneys?.find(e=>e.id===this.chimneySel):void 0}get field(){return this.fieldSel?this.settings.solar?.find(e=>e.id===this.fieldSel):void 0}isFixed(e){return!!e&&(!!e.locked||!!this.doc.settings.lock_plan)}useSections(e=!1){if(!this.admin)return;let n=(this.settings.sections??[]).length>0;e&&n&&!this.ctx.confirm(this.ctx.host.t("roof_regen_confirm"))||(this.ctx.host.change(r=>{r.settings.roof.type="custom",(e||!n)&&(r.settings.roof.sections=la(r,()=>I("roof")))}),this.sectionId=null)}addSection(e,n){if(!this.admin)return;let r=of(this.doc,e,n);this.ctx.host.change(o=>{o.settings.roof.type="custom",o.settings.roof.sections=[...o.settings.roof.sections??[],r]}),this.sectionId=r.id}takeOutline(){let e=this.ctx.host.floor;if(!e||!this.sectionSel||!this.admin)return;let{wall_exterior:n,wall_interior:r}=this.doc.settings,o=ea(e.rooms,e.walls??[],n,r);if(!o)return;let i=o.map(([s,l])=>[wg(s),wg(l)]);this.patchSection({shape:"flat",points:i,...Nt(i)})}addDormer(e){let n=this.section;if(!n||!this.admin)return;let r=ta(n,e,I("roof"));this.ctx.host.change(o=>{o.settings.roof.sections=[...o.settings.roof.sections??[],r]}),this.sectionId=r.id}patchSection(e){let n=this.sectionSel;!n||!this.admin||this.ctx.host.change(r=>{let o=r.settings.roof.sections?.find(i=>i.id===n);o&&Object.assign(o,e)})}removeCorner(e){let n=this.sectionSel;!n||!this.admin||this.ctx.host.change(r=>{let o=r.settings.roof.sections?.find(i=>i.id===n);o&&cf(o,e)})}removeSection(){let e=this.sectionSel;!e||!this.admin||(this.ctx.host.change(n=>n.settings.roof.sections=(n.settings.roof.sections??[]).filter(r=>r.id!==e)),this.sectionId=null)}duplicateSection(){let e=this.section;if(!e||!this.admin)return;let n=sf(e);this.ctx.host.change(r=>r.settings.roof.sections=[...r.settings.roof.sections??[],n]),this.sectionId=n.id}addWindow(){if(!this.admin)return;let e=this.doc.settings.north??0,n=Yr(Z(this.doc).filter(o=>!o.flat),e)??Z(this.doc)[0];if(!n)return;let r=Zr(n,I("rwin"));this.ctx.host.change(o=>o.settings.roof.windows=[...o.settings.roof.windows??[],r]),this.windowSel=r.id,this.sectionId=null}patchWindow(e){let n=this.windowSel;!n||!this.admin||this.ctx.host.change(r=>{let o=r.settings.roof.windows?.find(s=>s.id===n);if(!o)return;Object.assign(o,e);let i=Z(r).find(s=>s.key===o.face);i&&Object.assign(o,ft(i,dn(o)))})}removeWindow(){let e=this.windowSel;!e||!this.admin||(this.ctx.host.change(n=>n.settings.roof.windows=(n.settings.roof.windows??[]).filter(r=>r.id!==e)),this.windowId=null)}addChimney(){if(!this.admin)return;let e=Z(this.doc),n=e.find(o=>!o.flat)??e[0];if(!n)return;let r=qr(n,I("chim"));this.ctx.host.change(o=>o.settings.roof.chimneys=[...o.settings.roof.chimneys??[],r]),this.chimneySel=r.id,this.windowSel=null,this.sectionId=null}patchChimney(e){let n=this.chimneySel;!n||!this.admin||this.ctx.host.change(r=>{let o=r.settings.roof.chimneys?.find(s=>s.id===n);if(!o)return;Object.assign(o,e);let i=Z(r).find(s=>s.key===o.face);i&&Object.assign(o,ft(i,kt(o,i)))})}removeChimney(){let e=this.chimneySel;!e||!this.admin||(this.ctx.host.change(n=>n.settings.roof.chimneys=(n.settings.roof.chimneys??[]).filter(r=>r.id!==e)),this.chimneyId=null)}addField(){if(!this.admin)return;let e=Z(this.doc),n=new Set((this.settings.solar??[]).map(i=>i.face)),r=this.doc.settings.north??0,o=Yr(e.filter(i=>!n.has(i.key)),r)??Yr(e,r);o&&(this.appendField(Vn(o,I("pv"))),this.sectionSel=null)}addWallField(){let e=this.ctx.floorId()??this.doc.floors[0]?.id,n=this.admin&&e?fa(this.doc,I("pv"),e):null;n&&this.appendField(n)}addGroundField(){this.admin&&this.appendField(Gr(this.doc,I("pv")))}appendField(e){this.ctx.host.change(n=>n.settings.roof.solar=[...n.settings.roof.solar??[],e]),this.solarId=e.id}selectField(e){this.fieldSel=e,this.sectionSel=null;let n=this.settings.solar?.find(r=>r.id===e);n?.face.startsWith("wall:")&&this.ctx.setFloorId(n.face.split(":")[1]),this.ctx.refresh()}patchField(e){this.editField((n,r)=>{Object.assign(n,e);let o=$e(r,n);o&&Object.assign(n,ft(o,n))})}toggleCellLine truncated
|
||||
<svg width="12" height="12" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M3 2v15h15M5 13l4-5 4 2 4-6"/></svg>
|
||||
</button>${this.error?m`<span role="alert">${this.error}</span>`:_}`}static styles=J`:host{position:relative;display:inline-flex;flex:0 0 18px;width:18px;height:18px;vertical-align:middle;margin-left:3px;font-weight:normal;line-height:0}button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:18px;height:18px;padding:2px;border:0;border-radius:3px;background:transparent;color:var(--nf-accent,#40c8ff);opacity:.8;cursor:pointer}svg{display:block;flex-shrink:0}button:hover,button:focus-visible{opacity:1;background:#40c8ff18}button:focus-visible{outline:1px solid currentColor;outline-offset:1px}button:disabled{opacity:.4}span{position:absolute;right:0;top:22px;z-index:10;box-sizing:border-box;width:200px;padding:8px;border:1px solid #ff9b9b50;border-radius:6px;background:var(--nf-chrome-solid,#1c1c1c);font:12px/1.4 system-ui;color:#ff9b9b;white-space:normal}`};customElements.get("nf-trend-button")||customElements.define("nf-trend-button",Vl);function Cg(t,e,n=""){let r=Wl(t,e);return r.length?m`<nf-trend-button .hass=${t} .ids=${r} .label=${n}></nf-trend-button>`:_}var Kl=class extends Y{static properties={hass:{attribute:!1},readings:{attribute:!1}};constructor(){super(),this.readings=[]}render(){return m`${Sn.filter(e=>this.readings.some(n=>n.kind===e)).map(e=>m`<section aria-label=${sr[e]}>
|
||||
<h4>${ts[e]} ${sr[e]}</h4>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
|
||||
var B=globalThis,j=B.ShadowRoot&&(B.ShadyCSS===void 0||B.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Z=Symbol(),ht=new WeakMap,H=class{constructor(t,i,r){if(this._$cssResult$=!0,r!==Z)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=i}get styleSheet(){let t=this.o,i=this.t;if(j&&t===void 0){let r=i!==void 0&&i.length===1;r&&(t=ht.get(i)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&ht.set(i,t))}return t}toString(){return this.cssText}},ct=s=>new H(typeof s=="string"?s:s+"",void 0,Z),y=(s,...t)=>{let i=s.length===1?s[0]:t.reduce((r,e,n)=>r+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(e)+s[n+1],s[0]);return new H(i,s,Z)},dt=(s,t)=>{if(j)s.adoptedStyleSheets=t.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet);else for(let i of t){let r=document.createElement("style"),e=B.litNonce;e!==void 0&&r.setAttribute("nonce",e),r.textContent=i.cssText,s.appendChild(r)}},F=j?s=>s:s=>s instanceof CSSStyleSheet?(t=>{let i="";for(let r of t.cssRules)i+=r.cssText;return ct(i)})(s):s;var{is:Rt,defineProperty:Ht,getOwnPropertyDescriptor:Ot,getOwnPropertyNames:Lt,getOwnPropertySymbols:Nt,getPrototypeOf:Ut}=Object,V=globalThis,pt=V.trustedTypes,Dt=pt?pt.emptyScript:"",It=V.reactiveElementPolyfillSupport,O=(s,t)=>s,K={toAttribute(s,t){switch(t){case Boolean:s=s?Dt:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,t){let i=s;switch(t){case Boolean:i=s!==null;break;case Number:i=s===null?null:Number(s);break;case Object:case Array:try{i=JSON.parse(s)}catch{i=null}}return i}},ft=(s,t)=>!Rt(s,t),ut={attribute:!0,type:String,converter:K,reflect:!1,useDefault:!1,hasChanged:ft};Symbol.metadata??=Symbol("metadata"),V.litPropertyMetadata??=new WeakMap;var _=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,i=ut){if(i.state&&(i.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((i=Object.create(i)).wrapped=!0),this.elementProperties.set(t,i),!i.noAccessor){let r=Symbol(),e=this.getPropertyDescriptor(t,r,i);e!==void 0&&Ht(this.prototype,t,e)}}static getPropertyDescriptor(t,i,r){let{get:e,set:n}=Ot(this.prototype,t)??{get(){return this[i]},set(o){this[i]=o}};return{get:e,set(o){let h=e?.call(this);n?.call(this,o),this.requestUpdate(t,h,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??ut}static _$Ei(){if(this.hasOwnProperty(O("elementProperties")))return;let t=Ut(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(O("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(O("properties"))){let i=this.properties,r=[...Lt(i),...Nt(i)];for(let e of r)this.createProperty(e,i[e])}let t=this[Symbol.metadata];if(t!==null){let i=litPropertyMetadata.get(t);if(i!==void 0)for(let[r,e]of i)this.elementProperties.set(r,e)}this._$Eh=new Map;for(let[i,r]of this.elementProperties){let e=this._$Eu(i,r);e!==void 0&&this._$Eh.set(e,i)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let i=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let e of r)i.unshift(F(e))}else t!==void 0&&i.push(F(t));return i}static _$Eu(t,i){let r=i.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,i=this.constructor.elementProperties;for(let r of i.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return dt(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,i,r){this._$AK(t,r)}_$ET(t,i){let r=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,r);if(e!==void 0&&r.reflect===!0){let n=(r.converter?.toAttribute!==void 0?r.converter:K).toAttribute(i,r.type);this._$Em=t,n==null?this.removeAttribute(e):this.setAttribute(e,n),Line truncated
|
||||
\f\r]`,L=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,bt=/-->/g,vt=/>/g,E=RegExp(`>|${Y}(?:([^\\s"'>=/]+)(${Y}*=${Y}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),$t=/'/g,xt=/"/g,St=/^(?:script|style|textarea|title)$/i,rt=s=>(t,...i)=>({_$litType$:s,strings:t,values:i}),g=rt(1),A=rt(2),Jt=rt(3),T=Symbol.for("lit-noChange"),u=Symbol.for("lit-nothing"),yt=new WeakMap,k=M.createTreeWalker(M,129);function At(s,t){if(!it(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return gt!==void 0?gt.createHTML(t):t}var Vt=(s,t)=>{let i=s.length-1,r=[],e,n=t===2?"<svg>":t===3?"<math>":"",o=L;for(let h=0;h<i;h++){let a=s[h],c,p,d=-1,v=0;for(;v<a.length&&(o.lastIndex=v,p=o.exec(a),p!==null);)v=o.lastIndex,o===L?p[1]==="!--"?o=bt:p[1]!==void 0?o=vt:p[2]!==void 0?(St.test(p[2])&&(e=RegExp("</"+p[2],"g")),o=E):p[3]!==void 0&&(o=E):o===E?p[0]===">"?(o=e??L,d=-1):p[1]===void 0?d=-2:(d=o.lastIndex-p[2].length,c=p[1],o=p[3]===void 0?E:p[3]==='"'?xt:$t):o===xt||o===$t?o=E:o===bt||o===vt?o=L:(o=E,e=void 0);let $=o===E&&s[h+1].startsWith("/>")?" ":"";n+=o===L?a+Bt:d>=0?(r.push(c),a.slice(0,d)+_t+a.slice(d)+S+$):a+S+(d===-2?h:$)}return[At(s,n+(s[i]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},D=class s{constructor({strings:t,_$litType$:i},r){let e;this.parts=[];let n=0,o=0,h=t.length-1,a=this.parts,[c,p]=Vt(t,i);if(this.el=s.createElement(c,r),k.currentNode=this.el.content,i===2||i===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(e=k.nextNode())!==null&&a.length<h;){if(e.nodeType===1){if(e.hasAttributes())for(let d of e.getAttributeNames())if(d.endsWith(_t)){let v=p[o++],$=e.getAttribute(d).split(S),w=/([.?@])?(.*)/.exec(v);a.push({type:1,index:n,name:w[2],strings:$,ctor:w[1]==="."?G:w[1]==="?"?X:w[1]==="@"?Q:R}),e.removeAttribute(d)}else d.startsWith(S)&&(a.push({type:6,index:n}),e.removeAttribute(d));if(St.test(e.tagName)){let d=e.textContent.split(S),v=d.length-1;if(v>0){e.textContent=W?W.emptyScript:"";for(let $=0;$<v;$++)e.append(d[$],N()),k.nextNode(),a.push({type:2,index:++n});e.append(d[v],N())}}}else if(e.nodeType===8)if(e.data===wt)a.push({type:2,index:n});else{let d=-1;for(;(d=e.data.indexOf(S,d+1))!==-1;)a.push({type:7,index:n}),d+=S.length-1}n++}}static createElement(t,i){let r=M.createElement("template");return r.innerHTML=t,r}};function P(s,t,i=s,r){if(t===T)return t;let e=r!==void 0?i._$Co?.[r]:i._$Cl,n=U(t)?void 0:t._$litDirective$;return e?.constructor!==n&&(e?._$AO?.(!1),n===void 0?e=void 0:(e=new n(s),e._$AT(s,i,r)),r!==void 0?(i._$Co??=[])[r]=e:i._$Cl=e),e!==void 0&&(t=P(s,e._$AS(s,t.values),e,r)),t}var J=class{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:i},parts:r}=this._$AD,e=(t?.creationScope??M).importNode(i,!0);k.currentNode=e;let n=k.nextNode(),o=0,h=0,a=r[0];for(;a!==void 0;){if(o===a.index){let c;a.type===2?c=new I(n,n.nextSibling,this,t):a.type===1?c=new a.ctor(n,a.name,a.strings,this,t):a.type===6&&(c=new tt(n,this,t)),this._$AV.push(c),a=r[++h]}o!==a?.index&&(n=k.nextNode(),o++)}return k.currentNode=M,e}p(t){let i=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,i),i+=r.strings.length-2):r._$AI(t[i])),i++}},I=class s{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,r,e){this.type=2,this._$AH=u,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=r,this.options=e,this._$Cv=e?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,i=this._$AM;return i!==void 0&&t?.nodeType===11&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=P(this,t,i),U(t)?t===u||t==null||t===""?(this._$AH!==u&&this._$AR(),this._$AH=u):t!==this._$AH&&t!==T&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):jt(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==u&&U(this._$AH)?this._$AA.nextSibling.data=t:this.T(M.createTextNode(t)),this._$AH=t}$(t){let{values:i,_$litType$:r}=t,e=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=D.createElement(At(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===e)this._$AH.p(i);else{let n=new J(e,this),o=n.u(this.options);n.p(i),this.T(o),this._$AH=n}}_$AC(t){let i=yt.get(t.strings);return i===void 0&&yt.set(t.strings,i=new D(t)),i}k(t){it(this._$AH)||(this._$AH=[],this._$AR());let i=this._$AH,r,e=0;for(let n of t)e===i.length?i.push(r=new s(this.O(N()),this.O(N()),this,this.options)):r=i[e],r._$AI(n),e++;e<i.length&&(this._$AR(r&&r._$AB.nextSibling,e),i.length=e)}_$AR(t=this._$AA.nextSibling,i){for(this._$AP?.(!1,!0,i);t!==this._$AB;){let r=mt(t).nextSibling;mt(t).remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},R=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,r,e,n){this.type=1,this._$AH=u,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this.Line truncated
|
||||
var j=globalThis,B=j.ShadowRoot&&(j.ShadyCSS===void 0||j.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,K=Symbol(),ct=new WeakMap,P=class{constructor(t,i,r){if(this._$cssResult$=!0,r!==K)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=i}get styleSheet(){let t=this.o,i=this.t;if(B&&t===void 0){let r=i!==void 0&&i.length===1;r&&(t=ct.get(i)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&ct.set(i,t))}return t}toString(){return this.cssText}},pt=s=>new P(typeof s=="string"?s:s+"",void 0,K),w=(s,...t)=>{let i=s.length===1?s[0]:t.reduce((r,e,n)=>r+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(e)+s[n+1],s[0]);return new P(i,s,K)},ut=(s,t)=>{if(B)s.adoptedStyleSheets=t.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet);else for(let i of t){let r=document.createElement("style"),e=j.litNonce;e!==void 0&&r.setAttribute("nonce",e),r.textContent=i.cssText,s.appendChild(r)}},Y=B?s=>s:s=>s instanceof CSSStyleSheet?(t=>{let i="";for(let r of t.cssRules)i+=r.cssText;return pt(i)})(s):s;var{is:Lt,defineProperty:Ot,getOwnPropertyDescriptor:Dt,getOwnPropertyNames:Nt,getOwnPropertySymbols:Ut,getPrototypeOf:It}=Object,V=globalThis,ft=V.trustedTypes,jt=ft?ft.emptyScript:"",Bt=V.reactiveElementPolyfillSupport,L=(s,t)=>s,J={toAttribute(s,t){switch(t){case Boolean:s=s?jt:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,t){let i=s;switch(t){case Boolean:i=s!==null;break;case Number:i=s===null?null:Number(s);break;case Object:case Array:try{i=JSON.parse(s)}catch{i=null}}return i}},mt=(s,t)=>!Lt(s,t),gt={attribute:!0,type:String,converter:J,reflect:!1,useDefault:!1,hasChanged:mt};Symbol.metadata??=Symbol("metadata"),V.litPropertyMetadata??=new WeakMap;var _=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,i=gt){if(i.state&&(i.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((i=Object.create(i)).wrapped=!0),this.elementProperties.set(t,i),!i.noAccessor){let r=Symbol(),e=this.getPropertyDescriptor(t,r,i);e!==void 0&&Ot(this.prototype,t,e)}}static getPropertyDescriptor(t,i,r){let{get:e,set:n}=Dt(this.prototype,t)??{get(){return this[i]},set(o){this[i]=o}};return{get:e,set(o){let d=e?.call(this);n?.call(this,o),this.requestUpdate(t,d,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??gt}static _$Ei(){if(this.hasOwnProperty(L("elementProperties")))return;let t=It(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(L("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(L("properties"))){let i=this.properties,r=[...Nt(i),...Ut(i)];for(let e of r)this.createProperty(e,i[e])}let t=this[Symbol.metadata];if(t!==null){let i=litPropertyMetadata.get(t);if(i!==void 0)for(let[r,e]of i)this.elementProperties.set(r,e)}this._$Eh=new Map;for(let[i,r]of this.elementProperties){let e=this._$Eu(i,r);e!==void 0&&this._$Eh.set(e,i)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let i=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let e of r)i.unshift(Y(e))}else t!==void 0&&i.push(Y(t));return i}static _$Eu(t,i){let r=i.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,i=this.constructor.elementProperties;for(let r of i.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ut(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,i,r){this._$AK(t,r)}_$ET(t,i){let r=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,r);if(e!==void 0&&r.reflect===!0){let n=(r.converter?.toAttribute!==void 0?r.converter:J).toAttribute(i,r.type);this._$Em=t,n==null?this.removeAttribute(e):this.setAttribute(e,n),Line truncated
|
||||
\f\r]`,O=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,xt=/-->/g,$t=/>/g,E=RegExp(`>|${G}(?:([^\\s"'>=/]+)(${G}*=${G}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),yt=/'/g,wt=/"/g,Et=/^(?:script|style|textarea|title)$/i,st=s=>(t,...i)=>({_$litType$:s,strings:t,values:i}),v=st(1),A=st(2),Xt=st(3),T=Symbol.for("lit-noChange"),u=Symbol.for("lit-nothing"),_t=new WeakMap,k=M.createTreeWalker(M,129);function kt(s,t){if(!nt(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return vt!==void 0?vt.createHTML(t):t}var qt=(s,t)=>{let i=s.length-1,r=[],e,n=t===2?"<svg>":t===3?"<math>":"",o=O;for(let d=0;d<i;d++){let l=s[d],h,p,c=-1,b=0;for(;b<l.length&&(o.lastIndex=b,p=o.exec(l),p!==null);)b=o.lastIndex,o===O?p[1]==="!--"?o=xt:p[1]!==void 0?o=$t:p[2]!==void 0?(Et.test(p[2])&&(e=RegExp("</"+p[2],"g")),o=E):p[3]!==void 0&&(o=E):o===E?p[0]===">"?(o=e??O,c=-1):p[1]===void 0?c=-2:(c=o.lastIndex-p[2].length,h=p[1],o=p[3]===void 0?E:p[3]==='"'?wt:yt):o===wt||o===yt?o=E:o===xt||o===$t?o=O:(o=E,e=void 0);let m=o===E&&s[d+1].startsWith("/>")?" ":"";n+=o===O?l+Vt:c>=0?(r.push(h),l.slice(0,c)+St+l.slice(c)+S+m):l+S+(c===-2?d:m)}return[kt(s,n+(s[i]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},U=class s{constructor({strings:t,_$litType$:i},r){let e;this.parts=[];let n=0,o=0,d=t.length-1,l=this.parts,[h,p]=qt(t,i);if(this.el=s.createElement(h,r),k.currentNode=this.el.content,i===2||i===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(e=k.nextNode())!==null&&l.length<d;){if(e.nodeType===1){if(e.hasAttributes())for(let c of e.getAttributeNames())if(c.endsWith(St)){let b=p[o++],m=e.getAttribute(c).split(S),y=/([.?@])?(.*)/.exec(b);l.push({type:1,index:n,name:y[2],strings:m,ctor:y[1]==="."?Q:y[1]==="?"?tt:y[1]==="@"?et:R}),e.removeAttribute(c)}else c.startsWith(S)&&(l.push({type:6,index:n}),e.removeAttribute(c));if(Et.test(e.tagName)){let c=e.textContent.split(S),b=c.length-1;if(b>0){e.textContent=W?W.emptyScript:"";for(let m=0;m<b;m++)e.append(c[m],D()),k.nextNode(),l.push({type:2,index:++n});e.append(c[b],D())}}}else if(e.nodeType===8)if(e.data===At)l.push({type:2,index:n});else{let c=-1;for(;(c=e.data.indexOf(S,c+1))!==-1;)l.push({type:7,index:n}),c+=S.length-1}n++}}static createElement(t,i){let r=M.createElement("template");return r.innerHTML=t,r}};function H(s,t,i=s,r){if(t===T)return t;let e=r!==void 0?i._$Co?.[r]:i._$Cl,n=N(t)?void 0:t._$litDirective$;return e?.constructor!==n&&(e?._$AO?.(!1),n===void 0?e=void 0:(e=new n(s),e._$AT(s,i,r)),r!==void 0?(i._$Co??=[])[r]=e:i._$Cl=e),e!==void 0&&(t=H(s,e._$AS(s,t.values),e,r)),t}var X=class{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:i},parts:r}=this._$AD,e=(t?.creationScope??M).importNode(i,!0);k.currentNode=e;let n=k.nextNode(),o=0,d=0,l=r[0];for(;l!==void 0;){if(o===l.index){let h;l.type===2?h=new I(n,n.nextSibling,this,t):l.type===1?h=new l.ctor(n,l.name,l.strings,this,t):l.type===6&&(h=new it(n,this,t)),this._$AV.push(h),l=r[++d]}o!==l?.index&&(n=k.nextNode(),o++)}return k.currentNode=M,e}p(t){let i=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,i),i+=r.strings.length-2):r._$AI(t[i])),i++}},I=class s{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,r,e){this.type=2,this._$AH=u,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=r,this.options=e,this._$Cv=e?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,i=this._$AM;return i!==void 0&&t?.nodeType===11&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=H(this,t,i),N(t)?t===u||t==null||t===""?(this._$AH!==u&&this._$AR(),this._$AH=u):t!==this._$AH&&t!==T&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Wt(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==u&&N(this._$AH)?this._$AA.nextSibling.data=t:this.T(M.createTextNode(t)),this._$AH=t}$(t){let{values:i,_$litType$:r}=t,e=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=U.createElement(kt(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===e)this._$AH.p(i);else{let n=new X(e,this),o=n.u(this.options);n.p(i),this.T(o),this._$AH=n}}_$AC(t){let i=_t.get(t.strings);return i===void 0&&_t.set(t.strings,i=new U(t)),i}k(t){nt(this._$AH)||(this._$AH=[],this._$AR());let i=this._$AH,r,e=0;for(let n of t)e===i.length?i.push(r=new s(this.O(D()),this.O(D()),this,this.options)):r=i[e],r._$AI(n),e++;e<i.length&&(this._$AR(r&&r._$AB.nextSibling,e),i.length=e)}_$AR(t=this._$AA.nextSibling,i){for(this._$AP?.(!1,!0,i);t!==this._$AB;){let r=bt(t).nextSibling;bt(t).remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},R=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,r,e,n){this.type=1,this._$AH=u,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):thiLine truncated
|
||||
:host {
|
||||
--nf-text: var(--primary-text-color, #e1e1e1);
|
||||
--nf-muted: var(--secondary-text-color, #9b9b9b);
|
||||
@@ -29,7 +29,7 @@ var B=globalThis,j=B.ShadowRoot&&(B.ShadyCSS===void 0||B.ShadyCSS.nativeShadow)&
|
||||
font-family: var(--nf-font);
|
||||
color: var(--nf-text);
|
||||
}
|
||||
`,ce=y`
|
||||
`,pe=w`
|
||||
:host([readable]) {
|
||||
--secondary-text-color: var(--primary-text-color, #e1e1e1);
|
||||
--divider-color: color-mix(in srgb, var(--primary-text-color, #e1e1e1) 40%, transparent);
|
||||
@@ -40,7 +40,7 @@ var B=globalThis,j=B.ShadowRoot&&(B.ShadyCSS===void 0||B.ShadyCSS.nativeShadow)&
|
||||
:host([readable]) .nf-overlay {
|
||||
zoom: 1.2;
|
||||
}
|
||||
`,de=y`
|
||||
`,ue=w`
|
||||
/* a group of switches: one rounded pill, the active one tinted with the accent */
|
||||
.nf-seg {
|
||||
display: inline-flex;
|
||||
@@ -203,12 +203,12 @@ var B=globalThis,j=B.ShadowRoot&&(B.ShadyCSS===void 0||B.ShadyCSS.nativeShadow)&
|
||||
min-height: 40px;
|
||||
}
|
||||
}
|
||||
`;var kt={auto:"Automatisch",raw:"Rohdaten",minute:"1 Minute","5minutes":"5 Minuten","15minutes":"15 Minuten",hour:"Stunde",day:"Tag",week:"Woche",month:"Monat",year:"Jahr"};function Mt(s,t){let i=new Set;return t.flatMap(r=>{let e=String(s?.states[r]?.attributes.symcon_source_entity||r),n=s?.states[e]?.attributes,o=Number(n?.symcon_id);return!o||!n?.symcon_archive||i.has(o)?[]:(i.add(o),[e])})}function st(s){if(!Number.isFinite(s))return"";let t=new Date(s*1e3);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}T${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function Tt(s,t,i,r){let e=c=>c.trim()&&Number.isFinite(Number(c.replace(",",".")))?Number(c.replace(",",".")):null,n=e(t),o=e(i),h=n??s.reduce((c,p)=>Math.min(c,p),r||!s.length?0:1/0),a=o??s.reduce((c,p)=>Math.max(c,p),r?0:s.length?-1/0:1);if(h===a&&(n===null&&!r&&(h-=Math.max(1,Math.abs(h)*.05)),o===null&&(a+=Math.max(1,Math.abs(a)*.05))),h>=a)throw new Error("Der untere Wertebereich muss kleiner als der obere sein.");return[h,a]}function Ct(s,t){let i=r=>{let e=String(r??"");return`"${/^[=+@\-\t\r]/.test(e)?"'":""}${e.replaceAll('"','""')}"`};return"\uFEFF"+[["Variable","Zeit","Wert","Minimum","Maximum"].join(";"),...s.flatMap(r=>r.points.map(e=>[t[r.entity_id]||r.entity_id,new Date(e.t*1e3).toISOString(),e.v,e.min??"",e.max??""].map(i).join(";")))].join(`\r
|
||||
`)}var ot=class extends x{static properties={text:{attribute:!1}};constructor(){super(),this.text=""}get dialog(){return this.renderRoot.querySelector("dialog")}render(){return g`<button class="info" type="button" aria-label="Information anzeigen" aria-haspopup="dialog" title="Information" @click=${()=>this.dialog?.showModal()}>ⓘ</button>
|
||||
`;var Tt={auto:"Automatisch",raw:"Rohdaten",minute:"1 Minute","5minutes":"5 Minuten","15minutes":"15 Minuten",hour:"Stunde",day:"Tag",week:"Woche",month:"Monat",year:"Jahr"};function zt(s,t){let i=new Set;return t.flatMap(r=>{let e=String(s?.states[r]?.attributes.symcon_source_entity||r),n=s?.states[e]?.attributes,o=Number(n?.symcon_id);return!o||!n?.symcon_archive||i.has(o)?[]:(i.add(o),[e])})}function at(s){if(!Number.isFinite(s))return"";let t=new Date(s*1e3);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}T${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function Ct(s,t,i,r){let e=h=>h.trim()&&Number.isFinite(Number(h.replace(",",".")))?Number(h.replace(",",".")):null,n=e(t),o=e(i),d=n??s.reduce((h,p)=>Math.min(h,p),r||!s.length?0:1/0),l=o??s.reduce((h,p)=>Math.max(h,p),r?0:s.length?-1/0:1);if(d===l&&(n===null&&!r&&(d-=Math.max(1,Math.abs(d)*.05)),o===null&&(l+=Math.max(1,Math.abs(l)*.05))),d>=l)throw new Error("Der untere Wertebereich muss kleiner als der obere sein.");return[d,l]}function Ht(s,t){let i=r=>{let e=String(r??"");return`"${/^[=+@\-\t\r]/.test(e)?"'":""}${e.replaceAll('"','""')}"`};return"\uFEFF"+[["Variable","Zeit","Wert","Minimum","Maximum"].join(";"),...s.flatMap(r=>r.points.map(e=>[t[r.entity_id]||r.entity_id,new Date(e.t*1e3).toISOString(),e.v,e.min??"",e.max??""].map(i).join(";")))].join(`\r
|
||||
`)}var lt=class extends ${static properties={text:{attribute:!1}};constructor(){super(),this.text=""}get dialog(){return this.renderRoot.querySelector("dialog")}render(){return v`<button class="info" type="button" aria-label="Information anzeigen" aria-haspopup="dialog" title="Information" @click=${()=>this.dialog?.showModal()}>ⓘ</button>
|
||||
<dialog aria-label="Information" @keydown=${t=>t.stopPropagation()} @click=${t=>{if(t.target!==t.currentTarget)return;let i=this.dialog.getBoundingClientRect();(t.clientX<i.left||t.clientX>i.right||t.clientY<i.top||t.clientY>i.bottom)&&this.dialog?.close()}}>
|
||||
<header><b>Information</b><button class="close" type="button" aria-label="Schließen" @click=${()=>this.dialog?.close()}>×</button></header>
|
||||
<p>${this.text}</p>
|
||||
</dialog>`}static styles=[q,y`
|
||||
</dialog>`}static styles=[q,w`
|
||||
:host { display:inline-block; margin:4px 0; vertical-align:middle; }
|
||||
button { font:inherit; cursor:pointer; color:var(--nf-muted); background:transparent; border:1px solid var(--nf-line); border-radius:50%; pointer-events:auto; }
|
||||
.info { width:26px; height:26px; padding:0; font-size:18px; line-height:24px; }
|
||||
@@ -219,45 +219,114 @@ var B=globalThis,j=B.ShadowRoot&&(B.ShadyCSS===void 0||B.ShadyCSS.nativeShadow)&
|
||||
header { display:flex; align-items:center; justify-content:space-between; gap:20px; font-size:16px; }
|
||||
.close { width:30px; height:30px; padding:0; font-size:23px; }
|
||||
p { white-space:pre-wrap; overflow-wrap:anywhere; margin:16px 0 4px; }
|
||||
`]};customElements.get("nf-help-popup")||customElements.define("nf-help-popup",ot);var zt=["#4ec9ff","#ffbe69","#ae9bff","#72deb0","#ff87aa","#ebde72"],C=(s,t)=>String(s.states[t]?.attributes.friendly_name||t),Pt=s=>({variable_not_logged:"Die Variable wird nicht mehr geloggt.",trend_range_too_large_for_resolution:"Bitte f\xFCr diesen Zeitraum eine gr\xF6bere Aufl\xF6sung w\xE4hlen.",invalid_trend_range:"Bitte einen g\xFCltigen Zeitraum w\xE4hlen."})[String(s instanceof Error?s.message:s)]||String(s instanceof Error?s.message:s),at=class extends x{static properties={hass:{attribute:!1},ids:{attribute:!1},label:{attribute:!1},from:{state:!0},to:{state:!0},resolution:{state:!0},chartStyle:{state:!0},field:{state:!0},min:{state:!0},max:{state:!0},zero:{state:!0},band:{state:!0},live:{state:!0},series:{state:!0},hiddenSeries:{state:!0},loading:{state:!0},errors:{state:!0},hover:{state:!0},width:{state:!0},page:{state:!0}};request=0;drag=null;timer;observer;constructor(){super(),this.ids=[],this.label="",this.to=Math.floor(Date.now()/1e3),this.from=this.to-86400,this.resolution="auto",this.chartStyle="auto",this.field="v",this.min="",this.max="",this.zero=!1,this.band=!0,this.live=!1,this.series=[],this.hiddenSeries=new Set,this.loading=!1,this.errors=[],this.hover=null,this.width=900,this.page=0}async open(){await this.updateComplete,this.renderRoot.querySelector("dialog").showModal(),this.observer=new ResizeObserver(([t])=>{this.width=Math.max(280,Math.floor(t.contentRect.width))}),this.observer.observe(this.renderRoot.querySelector(".body")),this.timer=setInterval(()=>{if(this.live&&!this.loading){let t=this.to-this.from;this.to=Math.floor(Date.now()/1e3),this.from=this.to-t,this.load()}},3e4),await this.load()}disconnectedCallback(){super.disconnectedCallback(),++this.request,clearInterval(this.timer),this.observer?.disconnect()}async load(){let t=++this.request,i=this.from,r=this.to;if(this.errors=[],this.series=[],this.hover=null,this.page=0,!Number.isSafeInteger(i)||!Number.isSafeInteger(r)||i<1||r<=i){this.errors=["Das Ende muss nach dem Beginn des Zeitraums liegen."],this.loading=!1;return}this.loading=!0;let e=[],n=[];for(let o=0;o<this.ids.length&&t===this.request;o+=3){let h=this.ids.slice(o,o+3);(await Promise.allSettled(h.map(c=>this.hass.callWS({type:"nextfloor/archive/trend",entity_id:c,start:i,end:r,aggregation:this.resolution})))).forEach((c,p)=>c.status==="fulfilled"?e.push(c.value):n.push(`${C(this.hass,h[p])}: ${Pt(c.reason)}`))}t!==this.request||!this.isConnected||(this.series=e,this.errors=n,this.loading=!1)}range(t,i){this.from=Math.max(1,Math.floor(t)),this.to=Math.max(this.from+1,Math.floor(i)),this.live=!1,this.load()}zoom(t,i=.5){let r=Math.max(60,Math.min(315576e3,(this.to-this.from)*t)),e=this.from+(this.to-this.from)*i;this.range(e-r*i,e+r*(1-i))}stamp(t){return new Date(t*1e3).toLocaleString(this.hass.language,{dateStyle:"short",timeStyle:"medium"})}number(t){return t.toLocaleString(this.hass.language,{maximumFractionDigits:Math.abs(t)<.01&&t!==0?5:2})}unit(t){return String(this.hass.states[t]?.attributes.unit_of_measurement??"")}selected(){return this.series.filter(t=>!this.hiddenSeries.has(t.entity_id))}value(t){let i=this.field==="v"?t.v:t[this.field]??t.v;return typeof i=="number"&&Number.isFinite(i)?i:null}color(t){return zt[this.ids.indexOf(t)%zt.length]}ratio(t){let i=t.currentTarget.getBoundingClientRect();return Math.max(0,Math.min(1,((t.clientX-i.left)/i.width*this.width-64)/(this.width-80)))}exportCsv(){let t=Object.fromEntries(this.ids.map(e=>[e,String(this.hass.states[e]?.attributes.symcon_path||C(this.hass,e))])),i=URL.createObjectURL(new Blob([Ct(this.selected(),t)],{type:"text/csv;charset=utf-8"})),r=document.createElement("a");r.href=i,r.download="Symcon-Trend.csv",r.click(),setTimeout(()=>URL.revokeObjectURL(i),1e3)}plot(t,i){let r=t.flatMap(l=>l.points.flatMap(f=>{let m=this.value(f);return m===null?[]:this.band&&!l.counter?[m,f.min??m,f.max??m]:[m]}));if(!r.length)return g`<p class="note">Keine numerischen Archivwerte in diesem Zeitraum.</p>`;let e,n;try{[e,n]=Tt(r,this.min,this.max,this.zero||this.chartStyle==="bar"||t.some(l=>l.type===0)||this.chartStyle==="auto"&&t.some(l=>l.counter&&l.aggregation!=="raw"))}catch(l){return g`<p role="alert">${Pt(l)}</p>`}let o=64,h=this.width-16,a=14,c=220,p=l=>o+(l-this.from)/(this.to-this.from)*(h-o),d=l=>c-(l-e)/(n-e)*(c-a),v=(l,f=this.field)=>Number(f==="v"?l.v:l[f]??l.v),$=(l,f=this.field)=>{let m=l.points.filter(z=>typeof z.v=="number"),b=this.chartStyle==="step"||this.chartStyle==="auto"&&l.type===0;return m.map((z,lt)=>`${lt?b?`H${p(z.t).toFixed(1)}V`:"L":"M"}${b&<?d(v(z,f)).toFixed(1):`${p(z.t).toFixed(1)},${d(v(z,f)).toFixed(1)}`}`).join("")+(m.length?b?`H${h}`:l.aggregation==="raw"?`L${h},${d(v(m[m.length-1],f)).toFixed(1)}`:"":"")},w=this.width<480?2:5;return g`<section class="chart-group"><h3>${i||"Wert"}</h3><svg class="plot" viewBox=${`0 0 ${this.width} 256`} role="img" aria-label=${`Trend ${i}`} @wheel=${Line truncated
|
||||
@pointerdown=${l=>{this.drag=this.ratio(l),l.currentTarget.setPointerCapture(l.pointerId)}}
|
||||
@pointerup=${l=>{if(this.drag===null)return;let f=this.drag,m=this.ratio(l);if(this.drag=null,Math.abs(f-m)>.02){let b=this.to-this.from;this.range(this.from+b*Math.min(f,m),this.from+b*Math.max(f,m))}}}
|
||||
@pointercancel=${()=>{this.drag=null}} @pointermove=${l=>{this.hover=this.from+(this.to-this.from)*this.ratio(l)}}>
|
||||
<defs><clipPath id="plot-clip"><rect x=${o} y=${a} width=${h-o} height=${c-a}/></clipPath></defs>
|
||||
${[0,1,2,3,4].map(l=>{let f=e+(n-e)*l/4;return A`<line class="grid" x1=${o} x2=${h} y1=${d(f)} y2=${d(f)}/><text x=${o-7} y=${d(f)+4} text-anchor="end">${this.number(f)}</text>`})}
|
||||
${Array.from({length:w},(l,f)=>{let m=this.from+(this.to-this.from)*f/(w-1);return A`<text x=${p(m)} y="244" text-anchor=${f===0?"start":f===w-1?"end":"middle"}>${new Date(m*1e3).toLocaleString(this.hass.language,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}</text>`})}
|
||||
<g clip-path="url(#plot-clip)">${t.map(l=>{let f=this.chartStyle==="bar"||this.chartStyle==="auto"&&l.counter&&l.aggregation!=="raw",m=this.color(l.entity_id);return f?l.points.filter(b=>this.value(b)!==null).map(b=>A`<rect fill=${m} opacity=".65" x=${p(b.t)} y=${Math.min(d(this.value(b)),d(0))} width=${Math.max(1,Math.min(h,p(b.t+Math.max(1,b.d)))-p(b.t)-1)} height=${Math.max(1,Math.abs(d(this.value(b))-d(0)))}/>`):A`${this.band&&l.aggregation!=="raw"&&!l.counter?A`<path d=${$(l,"min")} fill="none" stroke=${m} opacity=".3"/><path d=${$(l,"max")} fill="none" stroke=${m} opacity=".3"/>`:u}<path d=${$(l)} fill="none" stroke=${m} stroke-width="2" vector-effect="non-scaling-stroke"/>${l.points.length===1?A`<circle cx=${p(l.points[0].t)} cy=${d(v(l.points[0]))} r="3" fill=${m}/>`:u}`})}${this.hover!==null?A`<line x1=${p(this.hover)} x2=${p(this.hover)} y1=${a} y2=${c} stroke="currentColor" stroke-dasharray="3 4" opacity=".5"/>`:u}</g>
|
||||
</svg></section>`}table(t){let i=t.flatMap(n=>n.points.map(o=>({id:n.entity_id,...o}))).sort((n,o)=>o.t-n.t),r=Math.max(1,Math.ceil(i.length/100)),e=Math.min(this.page,r-1);return g`<div class="table"><table><thead><tr><th>Zeit</th><th>Variable</th><th>Wert</th></tr></thead><tbody>${i.slice(e*100,(e+1)*100).map(n=>g`<tr><td>${this.stamp(n.t)}</td><td>${C(this.hass,n.id)}</td><td>${typeof n.v=="number"?this.number(n.v):n.v} ${this.unit(n.id)}</td></tr>`)}</tbody></table></div><div class="actions"><button ?disabled=${!e} @click=${()=>{this.page=e-1}}>Zurück</button><span>${e+1} / ${r}</span><button ?disabled=${e>=r-1} @click=${()=>{this.page=e+1}}>Weiter</button></div>`}render(){let t=this.selected(),i=t.length>0&&t.every(e=>e.type===3),r=this.hover===null?"Letzter Wert":this.stamp(this.hover);return g`<dialog aria-label="Variablentrend" @close=${()=>this.remove()} @keydown=${e=>e.stopPropagation()}>
|
||||
<header><div><h2>${this.label||"Variablentrend"}</h2><span>Symcon Archiv</span></div><button aria-label="Schließen" @click=${()=>this.renderRoot.querySelector("dialog")?.close()}>×</button></header>
|
||||
<div class="body"><div class="presets">${[["1 h",3600],["6 h",21600],["24 h",86400],["7 Tage",604800],["30 Tage",2592e3],["1 Jahr",31536e3]].map(([e,n])=>g`<button @click=${()=>{let o=Math.floor(Date.now()/1e3);this.range(o-Number(n),o)}}>${e}</button>`)}</div>
|
||||
<form @submit=${e=>{e.preventDefault(),this.load()}}><div class="fields">
|
||||
<label>Von<input type="datetime-local" .value=${st(this.from)} @change=${e=>{this.from=Math.floor(new Date(e.target.value).getTime()/1e3),this.live=!1,this.load()}}/></label>
|
||||
<label>Bis<input type="datetime-local" .value=${st(this.to)} @change=${e=>{this.to=Math.floor(new Date(e.target.value).getTime()/1e3),this.live=!1,this.load()}}/></label>
|
||||
<label>Auflösung<select .value=${this.resolution} @change=${e=>{this.resolution=e.target.value,this.load()}}>${Object.entries(kt).map(([e,n])=>g`<option value=${e}>${n}</option>`)}</select></label>
|
||||
`]};customElements.get("nf-help-popup")||customElements.define("nf-help-popup",lt);var Rt=["#4ec9ff","#ffbe69","#ae9bff","#72deb0","#ff87aa","#ebde72"],z=(s,t)=>String(s.states[t]?.attributes.friendly_name||t),Pt=s=>({variable_not_logged:"Die Variable wird nicht mehr geloggt.",trend_range_too_large_for_resolution:"Bitte f\xFCr diesen Zeitraum eine gr\xF6bere Aufl\xF6sung w\xE4hlen.",invalid_trend_range:"Bitte einen g\xFCltigen Zeitraum w\xE4hlen."})[String(s instanceof Error?s.message:s)]||String(s instanceof Error?s.message:s),ht=class extends ${static properties={hass:{attribute:!1},ids:{attribute:!1},label:{attribute:!1},from:{state:!0},to:{state:!0},resolution:{state:!0},chartStyle:{state:!0},field:{state:!0},min:{state:!0},max:{state:!0},zero:{state:!0},band:{state:!0},live:{state:!0},series:{state:!0},hiddenSeries:{state:!0},loading:{state:!0},errors:{state:!0},hover:{state:!0},width:{state:!0},plotHeight:{state:!0},page:{state:!0}};request=0;drag=null;timer;observer;resize=()=>{this.plotHeight=Math.round(Math.min(600,Math.max(220,window.innerHeight*(window.innerWidth<600?.52:.65))))};constructor(){super(),this.ids=[],this.label="",this.to=Math.floor(Date.now()/1e3),this.from=this.to-86400,this.resolution="auto",this.chartStyle="auto",this.field="v",this.min="",this.max="",this.zero=!1,this.band=!0,this.live=!1,this.series=[],this.hiddenSeries=new Set,this.loading=!1,this.errors=[],this.hover=null,this.width=900,this.plotHeight=400,this.page=0}async open(){await this.updateComplete,this.renderRoot.querySelector("dialog").showModal(),this.observer=new ResizeObserver(([t])=>{this.width=Math.max(280,Math.floor(t.contentRect.width))}),this.observer.observe(this.renderRoot.querySelector(".body")),this.resize(),window.addEventListener("resize",this.resize),this.timer=setInterval(()=>{if(this.live&&!this.loading){let t=this.to-this.from;this.to=Math.floor(Date.now()/1e3),this.from=this.to-t,this.load()}},3e4),await this.load()}disconnectedCallback(){super.disconnectedCallback(),++this.request,clearInterval(this.timer),this.observer?.disconnect(),window.removeEventListener("resize",this.resize)}async load(){let t=++this.request,i=this.from,r=this.to;if(this.errors=[],this.series=[],this.hover=null,this.page=0,!Number.isSafeInteger(i)||!Number.isSafeInteger(r)||i<1||r<=i){this.errors=["Das Ende muss nach dem Beginn des Zeitraums liegen."],this.loading=!1;return}this.loading=!0;let e=[],n=[];for(let o=0;o<this.ids.length&&t===this.request;o+=3){let d=this.ids.slice(o,o+3);(await Promise.allSettled(d.map(h=>this.hass.callWS({type:"nextfloor/archive/trend",entity_id:h,start:i,end:r,aggregation:this.resolution})))).forEach((h,p)=>h.status==="fulfilled"?e.push(h.value):n.push(`${z(this.hass,d[p])}: ${Pt(h.reason)}`))}t!==this.request||!this.isConnected||(this.series=e,this.errors=n,this.loading=!1)}range(t,i){this.from=Math.max(1,Math.floor(t)),this.to=Math.max(this.from+1,Math.floor(i)),this.live=!1,this.load()}zoom(t,i=.5){let r=Math.max(60,Math.min(315576e3,(this.to-this.from)*t)),e=this.from+(this.to-this.from)*i;this.range(e-r*i,e+r*(1-i))}stamp(t){return new Date(t*1e3).toLocaleString(this.hass.language,{dateStyle:"short",timeStyle:"medium"})}number(t){return t.toLocaleString(this.hass.language,{maximumFractionDigits:Math.abs(t)<.01&&t!==0?5:2})}unit(t){return String(this.hass.states[t]?.attributes.unit_of_measurement??"")}selected(){return this.series.filter(t=>!this.hiddenSeries.has(t.entity_id))}value(t){let i=this.field==="v"?t.v:t[this.field]??t.v;return typeof i=="number"&&Number.isFinite(i)?i:null}color(t){return Rt[this.ids.indexOf(t)%Rt.length]}ratio(t){let i=t.currentTarget.getBoundingClientRect();return Math.max(0,Math.min(1,((t.clientX-i.left)/i.width*this.width-64)/(this.width-80)))}exportCsv(){let t=Object.fromEntries(this.ids.map(e=>[e,String(this.hass.states[e]?.attributes.symcon_path||z(this.hass,e))])),i=URL.createObjectURL(new Blob([Ht(this.selected(),t)],{type:"text/csv;charset=utf-8"})),r=document.createElement("a");r.href=i,r.download="Symcon-Trend.csv",r.click(),setTimeout(()=>URL.revokeObjectURL(i),1e3)}plot(t,i){let r=t.flatMap(a=>a.points.flatMap(f=>{let g=this.value(f);return g===null?[]:this.band&&!a.counter?[g,f.min??g,f.max??g]:[g]}));if(!r.length)return v`<p class="note">Keine numerischen Archivwerte in diesem Zeitraum.</p>`;let e,n;try{[e,n]=Ct(r,this.min,this.max,this.zero||this.chartStyle==="bar"||t.some(a=>a.type===0)||this.chartStyle==="auto"&&t.some(a=>a.counter&&a.aggregation!=="raw"))}catch(a){return v`<p role="alert">${Pt(a)}</p>`}let o=new Set(this.selected().filter(a=>a.type!==3).map(a=>this.unit(a.entity_id))).size,d=Math.max(200,Math.round(this.plotHeight/Math.max(1,Math.min(o,2)))),l=64,h=this.width-16,p=14,c=d-32,b=a=>l+(a-this.from)/(this.to-this.from)*(h-l),m=a=>c-(a-e)/(n-e)*(c-p),y=(a,f=this.field)=>Number(f==="v"?a.v:a[f]??a.v),Z=(a,f=this.field)=>{let g=a.points.filter(C=>typeof C.v=="number"),x=this.chartStyle==="step"||this.chartStyle==="auto"&&a.type==Line truncated
|
||||
@pointerdown=${a=>{this.drag=this.ratio(a),a.currentTarget.setPointerCapture(a.pointerId)}}
|
||||
@pointerup=${a=>{if(this.drag===null)return;let f=this.drag,g=this.ratio(a);if(this.drag=null,Math.abs(f-g)>.02){let x=this.to-this.from;this.range(this.from+x*Math.min(f,g),this.from+x*Math.max(f,g))}}}
|
||||
@pointercancel=${()=>{this.drag=null}} @pointermove=${a=>{this.hover=this.from+(this.to-this.from)*this.ratio(a)}}>
|
||||
<defs><clipPath id="plot-clip"><rect x=${l} y=${p} width=${h-l} height=${c-p}/></clipPath></defs>
|
||||
${[0,1,2,3,4].map(a=>{let f=e+(n-e)*a/4;return A`<line class="grid" x1=${l} x2=${h} y1=${m(f)} y2=${m(f)}/><text x=${l-7} y=${m(f)+4} text-anchor="end">${this.number(f)}</text>`})}
|
||||
${Array.from({length:F},(a,f)=>{let g=this.from+(this.to-this.from)*f/(F-1);return A`<text x=${b(g)} y=${d-8} text-anchor=${f===0?"start":f===F-1?"end":"middle"}>${new Date(g*1e3).toLocaleString(this.hass.language,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}</text>`})}
|
||||
<g clip-path="url(#plot-clip)">${t.map(a=>{let f=this.chartStyle==="bar"||this.chartStyle==="auto"&&a.counter&&a.aggregation!=="raw",g=this.color(a.entity_id);return f?a.points.filter(x=>this.value(x)!==null).map(x=>A`<rect fill=${g} opacity=".65" x=${b(x.t)} y=${Math.min(m(this.value(x)),m(0))} width=${Math.max(1,Math.min(h,b(x.t+Math.max(1,x.d)))-b(x.t)-1)} height=${Math.max(1,Math.abs(m(this.value(x))-m(0)))}/>`):A`${this.band&&a.aggregation!=="raw"&&!a.counter?A`<path d=${Z(a,"min")} fill="none" stroke=${g} opacity=".3"/><path d=${Z(a,"max")} fill="none" stroke=${g} opacity=".3"/>`:u}<path d=${Z(a)} fill="none" stroke=${g} stroke-width="2" vector-effect="non-scaling-stroke"/>${a.points.length===1?A`<circle cx=${b(a.points[0].t)} cy=${m(y(a.points[0]))} r="3" fill=${g}/>`:u}`})}${this.hover!==null?A`<line x1=${b(this.hover)} x2=${b(this.hover)} y1=${p} y2=${c} stroke="currentColor" stroke-dasharray="3 4" opacity=".5"/>`:u}</g>
|
||||
</svg></section>`}table(t){let i=t.flatMap(n=>n.points.map(o=>({id:n.entity_id,...o}))).sort((n,o)=>o.t-n.t),r=Math.max(1,Math.ceil(i.length/100)),e=Math.min(this.page,r-1);return v`<div class="table"><table><thead><tr><th>Zeit</th><th>Variable</th><th>Wert</th></tr></thead><tbody>${i.slice(e*100,(e+1)*100).map(n=>v`<tr><td>${this.stamp(n.t)}</td><td>${z(this.hass,n.id)}</td><td>${typeof n.v=="number"?this.number(n.v):n.v} ${this.unit(n.id)}</td></tr>`)}</tbody></table></div><div class="actions"><button ?disabled=${!e} @click=${()=>{this.page=e-1}}>Zurück</button><span>${e+1} / ${r}</span><button ?disabled=${e>=r-1} @click=${()=>{this.page=e+1}}>Weiter</button></div>`}render(){let t=this.selected(),i=t.length>0&&t.every(e=>e.type===3),r=this.hover===null?"Letzter Wert":this.stamp(this.hover);return v`<dialog aria-label="Variablentrend" @close=${()=>this.remove()} @keydown=${e=>{e.stopPropagation();let n=this.renderRoot.querySelector(".settings");e.key==="Escape"&&n?.open&&(e.preventDefault(),n.open=!1)}} @click=${e=>{let n=this.renderRoot.querySelector(".settings");n?.open&&!e.composedPath().includes(n)&&(n.open=!1)}}>
|
||||
<header><div><h2>${this.label||"Variablentrend"}</h2><span class="range">${new Date(this.from*1e3).toLocaleString(this.hass.language,{dateStyle:"short",timeStyle:"short"})} – ${new Date(this.to*1e3).toLocaleString(this.hass.language,{dateStyle:"short",timeStyle:"short"})}</span></div><button aria-label="Schließen" @click=${()=>this.renderRoot.querySelector("dialog")?.close()}>×</button></header>
|
||||
<div class="body"><div class="toolbar"><div class="presets">${[["1 h",3600],["6 h",21600],["24 h",86400],["7 Tage",604800],["30 Tage",2592e3],["1 Jahr",31536e3]].map(([e,n])=>v`<button aria-pressed=${this.to-this.from===n} @click=${()=>{let o=Math.floor(Date.now()/1e3);this.range(o-Number(n),o)}}>${e}</button>`)}</div>
|
||||
<div class="navigation"><button aria-label="Vorheriger Zeitraum" title="Vorheriger Zeitraum" @click=${()=>this.range(this.from-(this.to-this.from),this.from)}>←</button><button aria-label="Nächster Zeitraum" title="Nächster Zeitraum" @click=${()=>this.range(this.to,this.to+(this.to-this.from))}>→</button><button aria-label="Hineinzoomen" title="Hineinzoomen" @click=${()=>this.zoom(.5)}>+</button><button aria-label="Herauszoomen" title="Herauszoomen" @click=${()=>this.zoom(2)}>−</button><button aria-label="Aktualisieren" title="Aktualisieren" aria-busy=${this.loading} @click=${()=>{this.load()}} ?disabled=${this.loading}>↻</button></div>
|
||||
<label class="live-toggle" title="Alle 30 Sekunden aktualisieren"><input type="checkbox" .checked=${this.live} @change=${e=>{this.live=e.target.checked}}/> Live</label>
|
||||
<details class="settings"><summary aria-label="Trend-Einstellungen" title="Zeitraum, Auflösung und Darstellung">⚙︎</summary><div class="settings-panel">
|
||||
<form @submit=${e=>{e.preventDefault(),this.load()}}><div class="fields time-fields">
|
||||
<label>Von<input type="datetime-local" .value=${at(this.from)} @change=${e=>{this.from=Math.floor(new Date(e.target.value).getTime()/1e3),this.live=!1,this.load()}}/></label>
|
||||
<label>Bis<input type="datetime-local" .value=${at(this.to)} @change=${e=>{this.to=Math.floor(new Date(e.target.value).getTime()/1e3),this.live=!1,this.load()}}/></label>
|
||||
<label>Auflösung<select .value=${this.resolution} @change=${e=>{this.resolution=e.target.value,this.load()}}>${Object.entries(Tt).map(([e,n])=>v`<option value=${e}>${n}</option>`)}</select></label>
|
||||
<button type="submit" ?disabled=${this.loading}>${this.loading?"L\xE4dt \u2026":"Anzeigen"}</button>
|
||||
</div></form>
|
||||
<details class="settings"><summary>Darstellung und Wertebereich</summary><div class="fields">
|
||||
<label>Darstellung<select .value=${this.chartStyle} @change=${e=>{this.chartStyle=e.target.value}}>${Object.entries({auto:"Automatisch",line:"Linie",step:"Stufen",bar:"Balken",table:"Tabelle"}).map(([e,n])=>g`<option value=${e}>${n}</option>`)}</select></label>
|
||||
<div class="display-settings"><b class="group-title">Darstellung und Wertebereich</b><div class="fields display-fields">
|
||||
<label>Darstellung<select .value=${this.chartStyle} @change=${e=>{this.chartStyle=e.target.value}}>${Object.entries({auto:"Automatisch",line:"Linie",step:"Stufen",bar:"Balken",table:"Tabelle"}).map(([e,n])=>v`<option value=${e}>${n}</option>`)}</select></label>
|
||||
<label>Aggregierter Wert<select .value=${this.field} @change=${e=>{this.field=e.target.value}}><option value="v">Mittelwert / Verbrauch</option><option value="min">Minimum</option><option value="max">Maximum</option></select></label>
|
||||
<label>Y-Minimum<input type="number" step="any" placeholder="Automatisch" .value=${this.min} @input=${e=>{this.min=e.target.value}}/></label>
|
||||
<label>Y-Maximum<input type="number" step="any" placeholder="Automatisch" .value=${this.max} @input=${e=>{this.max=e.target.value}}/></label>
|
||||
</div><div class="checks"><label><input type="checkbox" .checked=${this.zero} @change=${e=>{this.zero=e.target.checked}}/> Nullpunkt einbeziehen</label><label><input type="checkbox" .checked=${this.band} @change=${e=>{this.band=e.target.checked}}/> Min/Max anzeigen</label></div></details>
|
||||
<div class="actions"><button aria-label="Vorheriger Zeitraum" @click=${()=>this.range(this.from-(this.to-this.from),this.from)}>←</button><button aria-label="Nächster Zeitraum" @click=${()=>this.range(this.to,this.to+(this.to-this.from))}>→</button><button aria-label="Hineinzoomen" @click=${()=>this.zoom(.5)}>+</button><button aria-label="Herauszoomen" @click=${()=>this.zoom(2)}>−</button><button @click=${()=>{this.load()}} ?disabled=${this.loading}>Aktualisieren</button><label><input type="checkbox" .checked=${this.live} @change=${e=>{this.live=e.target.checked}}/> Live (30 s)</label><button @click=${()=>this.exportCsv()} ?disabled=${!t.length}>CSV</button>
|
||||
</div><div class="checks"><label><input type="checkbox" .checked=${this.zero} @change=${e=>{this.zero=e.target.checked}}/> Nullpunkt einbeziehen</label><label><input type="checkbox" .checked=${this.band} @change=${e=>{this.band=e.target.checked}}/> Min/Max anzeigen</label></div></div>
|
||||
<div class="actions"><button @click=${()=>this.exportCsv()} ?disabled=${!t.length}>CSV</button>
|
||||
<nf-help-popup .text=${"Zeitraum und Aufl\xF6sung lesen die originalen Symcon-Archivdaten. Rohdaten zeigen gespeicherte \xC4nderungen; ein zuvor bekannter Wert wird zum Beginn fortgef\xFChrt. Bei Z\xE4hlern sind aggregierte Werte der Verbrauch pro Intervall, bei Messwerten der Mittelwert. Mehrere Variablen werden einzeln dargestellt; unterschiedliche Einheiten erhalten eigene Diagramme. Zoomen: +/\u2212, Mausrad oder im Diagramm einen Zeitraum ziehen. Eigene Y-Grenzen gelten f\xFCr alle Diagramme. Begrenzte Rohdatenabfragen werden gekennzeichnet; w\xE4hle dann einen k\xFCrzeren Zeitraum oder eine Aggregation."}></nf-help-popup>
|
||||
</div>
|
||||
<div class="legend">${this.ids.map(e=>g`<label title=${String(this.hass.states[e]?.attributes.symcon_path||C(this.hass,e))}><input type="checkbox" .checked=${!this.hiddenSeries.has(e)} @change=${n=>{let o=new Set(this.hiddenSeries);n.target.checked?o.delete(e):o.add(e),this.hiddenSeries=o,this.requestUpdate()}}/><i style=${`background:${this.color(e)}`}></i>${C(this.hass,e)}</label>`)}</div>
|
||||
${this.errors.map(e=>g`<p class="error" role="alert">${e}</p>`)}${this.loading?g`<p class="note" role="status">Archivwerte werden geladen …</p>`:u}
|
||||
${t.filter(e=>e.truncated).map(e=>g`<p class="error" role="status">${C(this.hass,e.entity_id)}: Die Abfrage ist auf ${(e.limit??1e4).toLocaleString(this.hass.language)} Einträge begrenzt. Bitte Zeitraum verkürzen oder Auflösung ändern.</p>`)}
|
||||
${t.some(e=>e.counter&&e.aggregation!=="raw")?g`<p class="note">Zähler: Verbrauch pro Intervall</p>`:u}
|
||||
</div></div></details></div>
|
||||
<div class="legend">${this.ids.map(e=>v`<label title=${String(this.hass.states[e]?.attributes.symcon_path||z(this.hass,e))}><input type="checkbox" .checked=${!this.hiddenSeries.has(e)} @change=${n=>{let o=new Set(this.hiddenSeries);n.target.checked?o.delete(e):o.add(e),this.hiddenSeries=o,this.requestUpdate()}}/><i style=${`background:${this.color(e)}`}></i>${z(this.hass,e)}</label>`)}</div>
|
||||
${this.errors.map(e=>v`<p class="error" role="alert">${e}</p>`)}${this.loading?v`<p class="note" role="status">Archivwerte werden geladen …</p>`:u}
|
||||
${t.filter(e=>e.truncated).map(e=>v`<p class="error" role="status">${z(this.hass,e.entity_id)}: Die Abfrage ist auf ${(e.limit??1e4).toLocaleString(this.hass.language)} Einträge begrenzt. Bitte Zeitraum verkürzen oder Auflösung ändern.</p>`)}
|
||||
${t.some(e=>e.counter&&e.aggregation!=="raw")?v`<p class="note">Zähler: Verbrauch pro Intervall</p>`:u}
|
||||
<div class="charts" style=${`min-height:${this.plotHeight}px`}>
|
||||
${this.chartStyle==="table"||i?this.table(t):[...new Set(t.filter(e=>e.type!==3).map(e=>this.unit(e.entity_id)))].map(e=>this.plot(t.filter(n=>n.type!==3&&this.unit(n.entity_id)===e),e))}
|
||||
${t.some(e=>e.type===3)&&!i&&this.chartStyle!=="table"?this.table(t.filter(e=>e.type===3)):u}
|
||||
${!this.loading&&t.length&&t.every(e=>!e.points.length)?g`<p class="note">Keine Archivwerte in diesem Zeitraum.</p>`:u}
|
||||
<div class="cursor"><b>${r}</b>${t.map(e=>{let n=e.points.at(-1);if(this.hover!==null){let o=0,h=e.points.length;for(;o<h;){let a=o+h>>>1;e.points[a].t<=this.hover?o=a+1:h=a}n=e.points[o-1]}return g`<span style=${`color:${this.color(e.entity_id)}`}>${C(this.hass,e.entity_id)}: ${n?typeof n.v=="number"?`${this.number(this.value(n))} ${this.unit(e.entity_id)}`:n.v:"\u2013"}</span>`})}</div>
|
||||
${!this.loading&&t.length&&t.every(e=>!e.points.length)?v`<p class="note">Keine Archivwerte in diesem Zeitraum.</p>`:u}
|
||||
</div>
|
||||
</dialog>`}static styles=[q,y`
|
||||
:host{font:14px/1.45 system-ui,sans-serif;color:var(--nf-text)}dialog{box-sizing:border-box;width:min(1080px,calc(100vw - 24px));max-height:92vh;max-height:92dvh;padding:0;border:1px solid var(--nf-line);border-radius:14px;background:var(--nf-chrome-solid,#1c1c1c);color:inherit;box-shadow:var(--nf-shadow);overflow:auto}dialog::backdrop{background:#050b16a8}header{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:16px 20px;border-bottom:1px solid var(--nf-line)}h2{font-size:18px;margin:0}header span,.note{font-size:12px;color:var(--nf-muted)}header button{font-size:23px;width:36px;height:36px;padding:0}.body{padding:16px 20px}.presets,.actions,.checks,.legend,.cursor{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin:0 0 14px}.fields{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px;align-items:end;margin:12px 0}.fields label{display:grid;gap:5px;color:var(--nf-muted);font-size:12px}button,input,select{font:inherit;box-sizing:border-box;color:var(--nf-text)}button,select,input:not([type=checkbox]){border:1px solid var(--nf-line);border-radius:7px;padding:8px;background:var(--nf-fill,#292929);min-width:0}button{cursor:pointer}button:disabled{opacity:.45}button:focus-visible,input:focus-visible,select:focus-visible{outline:2px solid var(--nf-accent);outline-offset:2px}.settings{border:1px solid var(--nf-line);padding:10px 12px;border-radius:9px;margin:12px 0}summary{cursor:pointer}.checks label,.actions label,.legend label{display:flex;align-items:center;gap:6px;font-size:12px}.legend i{display:inline-block;width:10px;height:10px;border-radius:50%;flex-shrink:0}.legend label{max-width:100%;overflow-wrap:anywhere}.plot{display:block;width:100%;touch-action:none;user-select:none}.plot text{fill:var(--nf-muted);font:11px system-ui}.grid{stroke:var(--nf-line)}h3{font-size:12px;color:var(--nf-muted);margin:12px 0 0}.chart-group{margin-bottom:10px}.cursor{font-size:12px;align-items:flex-start}.cursor>b{width:100%;color:var(--nf-muted)}.cursor span{overflow-wrap:anywhere}.error{color:#ffa5a5}.table{overflow:auto;max-height:380px;margin:12px 0}table{width:100%;border-collapse:collapse;font-size:12px}td,th{text-align:left;padding:7px;border-bottom:1px solid var(--nf-line);overflow-wrap:anywhere}td:first-child{white-space:nowrap}th{position:sticky;top:0;background:var(--nf-chrome-solid,#1c1c1c)}@media(max-width:500px){header{padding:12px}.body{padding:10px}.fields{grid-template-columns:repeat(2,minmax(0,1fr))}input[type=datetime-local]{font-size:12px;padding:7px 3px}.actions{gap:6px}.actions button{padding:7px}header h2{font-size:16px}}
|
||||
header{position:sticky;top:0;z-index:2;background:var(--nf-chrome-solid,#1c1c1c)}
|
||||
`]};customElements.get("nf-trend-dialog")||customElements.define("nf-trend-dialog",at);async function ye(s,t,i){let r=Mt(s,t);if(!r.length)return;let e=document.createElement("nf-trend-dialog");Object.assign(e,{hass:s,ids:r,label:i}),document.body.append(e);try{await e.open()}catch(n){throw e.remove(),n}}export{at as NfTrendDialog,ye as openTrend};
|
||||
<div class="cursor"><b>${r}</b>${t.map(e=>{let n=e.points.at(-1);if(this.hover!==null){let o=0,d=e.points.length;for(;o<d;){let l=o+d>>>1;e.points[l].t<=this.hover?o=l+1:d=l}n=e.points[o-1]}return v`<span style=${`color:${this.color(e.entity_id)}`}>${z(this.hass,e.entity_id)}: ${n?typeof n.v=="number"?`${this.number(this.value(n))} ${this.unit(e.entity_id)}`:n.v:"\u2013"}</span>`})}</div>
|
||||
</div>
|
||||
</dialog>`}static styles=[q,w`
|
||||
:host { font:13px/1.4 system-ui,sans-serif; color:var(--nf-text); }
|
||||
dialog { box-sizing:border-box; width:min(1080px,calc(100vw - 24px)); max-height:92vh; max-height:92dvh; padding:0; border:1px solid var(--nf-line); border-radius:12px; background:var(--nf-chrome-solid,#1c1c1c); color:inherit; box-shadow:var(--nf-shadow); overflow:auto; }
|
||||
dialog::backdrop { background:#050b16a8; }
|
||||
header { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:8px 12px; border-bottom:1px solid var(--nf-line); position:sticky; top:0; z-index:3; background:var(--nf-chrome-solid,#1c1c1c); }
|
||||
header>div { display:flex; align-items:baseline; flex-wrap:wrap; gap:3px 14px; min-width:0; }
|
||||
h2 { font-size:15px; margin:0; }
|
||||
.range { font-size:11px; color:var(--nf-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
|
||||
header button { width:26px; height:26px; font-size:19px; padding:0; flex-shrink:0; }
|
||||
.body { padding:8px 12px; }
|
||||
.toolbar { position:relative; display:flex; align-items:center; flex-wrap:wrap; gap:5px 10px; margin-bottom:6px; }
|
||||
.presets,.navigation { display:flex; align-items:center; gap:3px; }
|
||||
button,input,select { box-sizing:border-box; color:var(--nf-text); font:inherit; }
|
||||
button,select,input:not([type=checkbox]),summary { border:1px solid var(--nf-line); border-radius:5px; padding:4px 7px; background:var(--nf-fill,#292929); min-width:0; }
|
||||
button { cursor:pointer; font-size:12px; }
|
||||
button:disabled { opacity:.45; }
|
||||
button:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible { outline:2px solid var(--nf-accent); outline-offset:2px; }
|
||||
.toolbar button,.toolbar summary { height:26px; }
|
||||
.navigation button { width:26px; padding:0; font-size:16px; }
|
||||
.presets button { padding:3px 6px; font-size:11px; }
|
||||
.presets button[aria-pressed=true],.settings[open]>summary { border-color:var(--nf-accent); background:color-mix(in srgb,var(--nf-accent) 16%,var(--nf-fill)); }
|
||||
.live-toggle { display:flex; align-items:center; gap:3px; font-size:11px; white-space:nowrap; }
|
||||
input[type=checkbox] { margin:0; }
|
||||
.settings { margin-left:auto; }
|
||||
.settings:not([open])>.settings-panel { display:none; }
|
||||
summary { display:flex; align-items:center; justify-content:center; width:28px; padding:0; list-style:none; font-size:17px; cursor:pointer; }
|
||||
summary::-webkit-details-marker { display:none; }
|
||||
.settings-panel { position:absolute; z-index:2; top:calc(100% + 5px); right:0; box-sizing:border-box; width:min(620px,100%); max-height:min(62vh,480px); overflow:auto; padding:10px 12px; border:1px solid var(--nf-line); border-radius:8px; background:var(--nf-chrome-solid,#1c1c1c); box-shadow:var(--nf-shadow); }
|
||||
.fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-items:end; gap:7px 10px; margin:0 0 10px; }
|
||||
.fields label { display:grid; gap:3px; color:var(--nf-muted); font-size:11px; }
|
||||
.fields input,.fields select { height:28px; width:100%; font-size:12px; }
|
||||
.time-fields button { justify-self:start; }
|
||||
.display-settings { padding-top:8px; border-top:1px solid var(--nf-line); }
|
||||
.group-title { display:block; margin-bottom:6px; font-size:12px; }
|
||||
.actions,.checks,.legend,.cursor { display:flex; align-items:center; flex-wrap:wrap; gap:6px 10px; }
|
||||
.checks { margin:0 0 6px; }
|
||||
.checks label,.legend label { display:flex; align-items:center; gap:4px; font-size:11px; }
|
||||
.legend { margin:4px 0 0; }
|
||||
.legend i { display:inline-block; width:8px; height:8px; border-radius:50%; flex-shrink:0; }
|
||||
.legend label { max-width:100%; overflow-wrap:anywhere; }
|
||||
.plot { display:block; width:100%; touch-action:none; user-select:none; }
|
||||
.plot text { fill:var(--nf-muted); font:11px system-ui; }
|
||||
.grid { stroke:var(--nf-line); }
|
||||
h3 { font-size:11px; color:var(--nf-muted); margin:3px 0 0; }
|
||||
.chart-group { margin-bottom:4px; }
|
||||
.cursor { font-size:11px; align-items:baseline; border-top:1px solid var(--nf-line); padding-top:6px; }
|
||||
.cursor>b { color:var(--nf-muted); font-weight:normal; }
|
||||
.cursor span { overflow-wrap:anywhere; }
|
||||
.note,.error { font-size:12px; margin:6px 0; }
|
||||
.note { color:var(--nf-muted); }
|
||||
.error { color:#ffa5a5; }
|
||||
.table { overflow:auto; max-height:60vh; margin:8px 0; }
|
||||
table { width:100%; border-collapse:collapse; font-size:12px; }
|
||||
td,th { text-align:left; padding:5px; border-bottom:1px solid var(--nf-line); overflow-wrap:anywhere; }
|
||||
td:first-child { white-space:nowrap; }
|
||||
th { position:sticky; top:0; background:var(--nf-chrome-solid,#1c1c1c); }
|
||||
@media(max-width:500px) {
|
||||
header { padding:7px 9px; }
|
||||
header>div { display:grid; gap:1px; }
|
||||
h2 { font-size:14px; }
|
||||
.body { padding:7px 9px; }
|
||||
.toolbar { gap:4px 6px; }
|
||||
.presets { gap:2px; }
|
||||
.presets button { padding:3px 5px; }
|
||||
.settings-panel { padding:9px; }
|
||||
input[type=datetime-local] { font-size:11px; padding:3px; }
|
||||
}
|
||||
`]};customElements.get("nf-trend-dialog")||customElements.define("nf-trend-dialog",ht);async function _e(s,t,i){let r=zt(s,t);if(!r.length)return;let e=document.createElement("nf-trend-dialog");Object.assign(e,{hass:s,ids:r,label:i}),document.body.append(e);try{await e.open()}catch(n){throw e.remove(),n}}export{ht as NfTrendDialog,_e as openTrend};
|
||||
/*! Bundled license information:
|
||||
|
||||
@lit/reactive-element/css-tag.js:
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
|
||||
var x={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",fr:"6312d0f61ebf",hu:"27ba348531dc",it:"1b705e76dd00",nb:"c5ea24fb9ef6",nl:"b64142c67c2e",pl:"8527a4930402",pt:"31857a2d2277",ro:"e3cb5f449f0f",sk:"320611594db0",sl:"8071691ceda3",sv:"711b911ec8da",tr:"7c83ce1c3372",zh:"50518d9f494e"};Array.prototype.at||Object.defineProperty(Array.prototype,"at",{configurable:!0,writable:!0,value:function(e){let t=Math.trunc(e)||0;return this[t<0?this.length+t:t]}});typeof globalThis.structuredClone!="function"&&(globalThis.structuredClone=r=>r===void 0?r:JSON.parse(JSON.stringify(r)));var In=globalThis,Nn=In.ShadowRoot&&(In.ShadyCSS===void 0||In.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Xr=Symbol(),Go=new WeakMap,Ut=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Xr)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Nn&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=Go.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Go.set(t,e))}return e}toString(){return this.cssText}},Uo=r=>new Ut(typeof r=="string"?r:r+"",void 0,Xr),X=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((n,i,o)=>n+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+r[o+1],r[0]);return new Ut(t,r,Xr)},jo=(r,e)=>{if(Nn)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),i=In.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},ei=Nn?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return Uo(t)})(r):r;var{is:Lc,defineProperty:Oc,getOwnPropertyDescriptor:Bc,getOwnPropertyNames:Vc,getOwnPropertySymbols:Kc,getPrototypeOf:Gc}=Object,Cn=globalThis,qo=Cn.trustedTypes,Uc=qo?qo.emptyScript:"",jc=Cn.reactiveElementPolyfillSupport,jt=(r,e)=>r,ti={toAttribute(r,e){switch(e){case Boolean:r=r?Uc:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},Yo=(r,e)=>!Lc(r,e),Zo={attribute:!0,type:String,converter:ti,reflect:!1,useDefault:!1,hasChanged:Yo};Symbol.metadata??=Symbol("metadata"),Cn.litPropertyMetadata??=new WeakMap;var De=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Zo){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),i=this.getPropertyDescriptor(e,n,t);i!==void 0&&Oc(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){let{get:i,set:o}=Bc(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:i,set(s){let a=i?.call(this);o?.call(this,s),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Zo}static _$Ei(){if(this.hasOwnProperty(jt("elementProperties")))return;let e=Gc(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(jt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(jt("properties"))){let t=this.properties,n=[...Vc(t),...Kc(t)];for(let i of n)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,i]of t)this.elementProperties.set(n,i)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let i=this._$Eu(t,n);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let i of n)t.unshift(ei(i))}else e!==void 0&&t.push(ei(e));return t}static _$Eu(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadLine truncated
|
||||
\f\r]`,qt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Xo=/-->/g,es=/>/g,it=RegExp(`>|${ni}(?:([^\\s"'>=/]+)(${ni}*=${ni}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),ts=/'/g,ns=/"/g,ss=/^(?:script|style|textarea|title)$/i,ci=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),p=ci(1),ne=ci(2),Df=ci(3),at=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),rs=new WeakMap,ot=st.createTreeWalker(st,129);function as(r,e){if(!ui(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Qo!==void 0?Qo.createHTML(e):e}var Yc=(r,e)=>{let t=r.length-1,n=[],i,o=e===2?"<svg>":e===3?"<math>":"",s=qt;for(let a=0;a<t;a++){let l=r[a],u,c,d=-1,m=0;for(;m<l.length&&(s.lastIndex=m,c=s.exec(l),c!==null);)m=s.lastIndex,s===qt?c[1]==="!--"?s=Xo:c[1]!==void 0?s=es:c[2]!==void 0?(ss.test(c[2])&&(i=RegExp("</"+c[2],"g")),s=it):c[3]!==void 0&&(s=it):s===it?c[0]===">"?(s=i??qt,d=-1):c[1]===void 0?d=-2:(d=s.lastIndex-c[2].length,u=c[1],s=c[3]===void 0?it:c[3]==='"'?ns:ts):s===ns||s===ts?s=it:s===Xo||s===es?s=qt:(s=it,i=void 0);let h=s===it&&r[a+1].startsWith("/>")?" ":"";o+=s===qt?l+qc:d>=0?(n.push(u),l.slice(0,d)+is+l.slice(d)+je+h):l+je+(d===-2?a:h)}return[as(r,o+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},Jt=class r{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let o=0,s=0,a=e.length-1,l=this.parts,[u,c]=Yc(e,t);if(this.el=r.createElement(u,n),ot.currentNode=this.el.content,t===2||t===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(i=ot.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let d of i.getAttributeNames())if(d.endsWith(is)){let m=c[s++],h=i.getAttribute(d).split(je),g=/([.?@])?(.*)/.exec(m);l.push({type:1,index:o,name:g[2],strings:h,ctor:g[1]==="."?ii:g[1]==="?"?oi:g[1]==="@"?si:wt}),i.removeAttribute(d)}else d.startsWith(je)&&(l.push({type:6,index:o}),i.removeAttribute(d));if(ss.test(i.tagName)){let d=i.textContent.split(je),m=d.length-1;if(m>0){i.textContent=Wn?Wn.emptyScript:"";for(let h=0;h<m;h++)i.append(d[h],Zt()),ot.nextNode(),l.push({type:2,index:++o});i.append(d[m],Zt())}}}else if(i.nodeType===8)if(i.data===os)l.push({type:2,index:o});else{let d=-1;for(;(d=i.data.indexOf(je,d+1))!==-1;)l.push({type:7,index:o}),d+=je.length-1}o++}}static createElement(e,t){let n=st.createElement("template");return n.innerHTML=e,n}};function yt(r,e,t=r,n){if(e===at)return e;let i=n!==void 0?t._$Co?.[n]:t._$Cl,o=Yt(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(r),i._$AT(r,t,n)),n!==void 0?(t._$Co??=[])[n]=i:t._$Cl=i),i!==void 0&&(e=yt(r,i._$AS(r,e.values),i,n)),e}var ri=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,i=(e?.creationScope??st).importNode(t,!0);ot.currentNode=i;let o=ot.nextNode(),s=0,a=0,l=n[0];for(;l!==void 0;){if(s===l.index){let u;l.type===2?u=new Qt(o,o.nextSibling,this,e):l.type===1?u=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(u=new ai(o,this,e)),this._$AV.push(u),l=n[++a]}s!==l?.index&&(o=ot.nextNode(),s++)}return ot.currentNode=st,i}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},Qt=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=yt(this,e,t),Yt(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==at&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Zc(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==f&&Yt(this._$AH)?this._$AA.nextSibling.data=e:this.T(st.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,i=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=Jt.createElement(as(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{let o=new ri(i,this),s=o.u(this.options);o.p(t),this.T(s),this._$AH=o}}_$AC(e){let t=rs.get(e.strings);return t===void 0&&rs.set(e.strings,t=new Jt(e)),t}k(e){ui(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,i=0;for(let o of e)i===t.length?t.push(n=new r(this.O(Zt()),this.O(Zt()),this,this.options)):n=t[i],n._$AI(o),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=Jo(e).nextSibling;Jo(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},wt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,o){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=o,n.length>2||n[0]!==""||n[1]!==""?(this.Line truncated
|
||||
var x={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",fr:"6312d0f61ebf",hu:"27ba348531dc",it:"1b705e76dd00",nb:"c5ea24fb9ef6",nl:"b64142c67c2e",pl:"8527a4930402",pt:"31857a2d2277",ro:"e3cb5f449f0f",sk:"320611594db0",sl:"8071691ceda3",sv:"711b911ec8da",tr:"7c83ce1c3372",zh:"50518d9f494e"};Array.prototype.at||Object.defineProperty(Array.prototype,"at",{configurable:!0,writable:!0,value:function(e){let t=Math.trunc(e)||0;return this[t<0?this.length+t:t]}});typeof globalThis.structuredClone!="function"&&(globalThis.structuredClone=r=>r===void 0?r:JSON.parse(JSON.stringify(r)));var Wn=globalThis,Ln=Wn.ShadowRoot&&(Wn.ShadyCSS===void 0||Wn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ti=Symbol(),qo=new WeakMap,Yt=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==ti)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Ln&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=qo.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&qo.set(t,e))}return e}toString(){return this.cssText}},Zo=r=>new Yt(typeof r=="string"?r:r+"",void 0,ti),Y=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((n,i,o)=>n+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+r[o+1],r[0]);return new Yt(t,r,ti)},Yo=(r,e)=>{if(Ln)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),i=Wn.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},ni=Ln?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return Zo(t)})(r):r;var{is:Bc,defineProperty:Vc,getOwnPropertyDescriptor:Kc,getOwnPropertyNames:Gc,getOwnPropertySymbols:Uc,getPrototypeOf:jc}=Object,On=globalThis,Jo=On.trustedTypes,qc=Jo?Jo.emptyScript:"",Zc=On.reactiveElementPolyfillSupport,Jt=(r,e)=>r,ri={toAttribute(r,e){switch(e){case Boolean:r=r?qc:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},Xo=(r,e)=>!Bc(r,e),Qo={attribute:!0,type:String,converter:ri,reflect:!1,useDefault:!1,hasChanged:Xo};Symbol.metadata??=Symbol("metadata"),On.litPropertyMetadata??=new WeakMap;var Pe=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Qo){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),i=this.getPropertyDescriptor(e,n,t);i!==void 0&&Vc(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){let{get:i,set:o}=Kc(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:i,set(s){let a=i?.call(this);o?.call(this,s),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Qo}static _$Ei(){if(this.hasOwnProperty(Jt("elementProperties")))return;let e=jc(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Jt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Jt("properties"))){let t=this.properties,n=[...Gc(t),...Uc(t)];for(let i of n)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,i]of t)this.elementProperties.set(n,i)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let i=this._$Eu(t,n);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let i of n)t.unshift(ni(i))}else e!==void 0&&t.push(ni(e));return t}static _$Eu(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadLine truncated
|
||||
\f\r]`,Qt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ns=/-->/g,rs=/>/g,lt=RegExp(`>|${ii}(?:([^\\s"'>=/]+)(${ii}*=${ii}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),is=/'/g,os=/"/g,us=/^(?:script|style|textarea|title)$/i,hi=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),p=hi(1),ne=hi(2),Hf=hi(3),dt=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),ss=new WeakMap,ut=ct.createTreeWalker(ct,129);function cs(r,e){if(!di(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return ts!==void 0?ts.createHTML(e):e}var Qc=(r,e)=>{let t=r.length-1,n=[],i,o=e===2?"<svg>":e===3?"<math>":"",s=Qt;for(let a=0;a<t;a++){let l=r[a],u,c,d=-1,m=0;for(;m<l.length&&(s.lastIndex=m,c=s.exec(l),c!==null);)m=s.lastIndex,s===Qt?c[1]==="!--"?s=ns:c[1]!==void 0?s=rs:c[2]!==void 0?(us.test(c[2])&&(i=RegExp("</"+c[2],"g")),s=lt):c[3]!==void 0&&(s=lt):s===lt?c[0]===">"?(s=i??Qt,d=-1):c[1]===void 0?d=-2:(d=s.lastIndex-c[2].length,u=c[1],s=c[3]===void 0?lt:c[3]==='"'?os:is):s===os||s===is?s=lt:s===ns||s===rs?s=Qt:(s=lt,i=void 0);let h=s===lt&&r[a+1].startsWith("/>")?" ":"";o+=s===Qt?l+Yc:d>=0?(n.push(u),l.slice(0,d)+as+l.slice(d)+Ye+h):l+Ye+(d===-2?a:h)}return[cs(r,o+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},tn=class r{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let o=0,s=0,a=e.length-1,l=this.parts,[u,c]=Qc(e,t);if(this.el=r.createElement(u,n),ut.currentNode=this.el.content,t===2||t===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(i=ut.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let d of i.getAttributeNames())if(d.endsWith(as)){let m=c[s++],h=i.getAttribute(d).split(Ye),g=/([.?@])?(.*)/.exec(m);l.push({type:1,index:o,name:g[2],strings:h,ctor:g[1]==="."?si:g[1]==="?"?ai:g[1]==="@"?li:$t}),i.removeAttribute(d)}else d.startsWith(Ye)&&(l.push({type:6,index:o}),i.removeAttribute(d));if(us.test(i.tagName)){let d=i.textContent.split(Ye),m=d.length-1;if(m>0){i.textContent=Bn?Bn.emptyScript:"";for(let h=0;h<m;h++)i.append(d[h],Xt()),ut.nextNode(),l.push({type:2,index:++o});i.append(d[m],Xt())}}}else if(i.nodeType===8)if(i.data===ls)l.push({type:2,index:o});else{let d=-1;for(;(d=i.data.indexOf(Ye,d+1))!==-1;)l.push({type:7,index:o}),d+=Ye.length-1}o++}}static createElement(e,t){let n=ct.createElement("template");return n.innerHTML=e,n}};function St(r,e,t=r,n){if(e===dt)return e;let i=n!==void 0?t._$Co?.[n]:t._$Cl,o=en(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(r),i._$AT(r,t,n)),n!==void 0?(t._$Co??=[])[n]=i:t._$Cl=i),i!==void 0&&(e=St(r,i._$AS(r,e.values),i,n)),e}var oi=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,i=(e?.creationScope??ct).importNode(t,!0);ut.currentNode=i;let o=ut.nextNode(),s=0,a=0,l=n[0];for(;l!==void 0;){if(s===l.index){let u;l.type===2?u=new nn(o,o.nextSibling,this,e):l.type===1?u=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(u=new ui(o,this,e)),this._$AV.push(u),l=n[++a]}s!==l?.index&&(o=ut.nextNode(),s++)}return ut.currentNode=ct,i}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},nn=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=St(this,e,t),en(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==dt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Jc(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==f&&en(this._$AH)?this._$AA.nextSibling.data=e:this.T(ct.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,i=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=tn.createElement(cs(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{let o=new oi(i,this),s=o.u(this.options);o.p(t),this.T(s),this._$AH=o}}_$AC(e){let t=ss.get(e.strings);return t===void 0&&ss.set(e.strings,t=new tn(e)),t}k(e){di(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,i=0;for(let o of e)i===t.length?t.push(n=new r(this.O(Xt()),this.O(Xt()),this,this.options)):n=t[i],n._$AI(o),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=es(e).nextSibling;es(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},$t=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,o){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=o,n.length>2||n[0]!==""||n[1]!==""?(this.Line truncated
|
||||
|
||||
Ein Plugin l\xE4uft mit denselben Rechten wie NextFloor in deinem Browser. Die Datei wurde gepr\xFCft, ihr Inhalt ist festgelegt:
|
||||
{url}`,manual:"Anleitung",manual_more:"Mehr erfahren",feature_text_energy:"Energieteilchen fliegen in B\xF6gen von den Solarfeldern zum Wechselrichter, zwischen Haus, Akku, Netz und Verbrauchern \u2013 schneller und dichter, je mehr Strom flie\xDFt. Die Module funkeln mit ihrer Produktion, eine Glaskarte \xFCber dem Dach zeigt die Bilanz und wie autark das Haus gerade ist.",live_autarky:"autark",live_fold:"Karte verkleinern",live_unfold:"Karte aufklappen",live_day_hint:"Die letzten 24 Stunden: Solar (Fl\xE4che) und Verbrauch (Linie)",live_week_hint:"Die letzten 7 Tage: Sonne {solar} kWh, Verbrauch {use} kWh (gelb: Sonne, hell: Verbrauch)",live_days:"Tage",live_car_away:"Unterwegs",live_car_charging:"L\xE4dt",live_car_plugged:"Eingesteckt",live_car_lock:"Verriegeln",live_car_unlock:"Entriegeln",live_car_unlock_confirm:"{name} wirklich entriegeln?",live_car_climate:"Klimatisierung",live_car_charge:"Laden starten/stoppen",live_media_prev:"Zur\xFCck",live_media_playpause:"Abspielen/Pause",live_media_next:"Weiter",live_media_volume:"Lautst\xE4rke",live_car_device:"Auto (eine Entit\xE4t des Autos)",live_car_device_hint:"Ladestand, Reichweite, Laden, Stecker, Schloss und Klima findet NextFloor selbst am Ger\xE4t des Autos. Ohne Angabe nimmt es den Anwesenheitssensor des Stellplatzes.",live_car_departure_entity:"Abfahrtszeit (optional)",live_car_departure:"Abfahrt {time}",live_car_open:"Offen: {parts}",printer_printing:"druckt",printer_done:"fertig",printer_paused:"pausiert",printer_error:"Fehler",printer_idle:"bereit",printer_done_at:"fertig um {time}",printer_layer:"Schicht",printer_nozzle:"D\xFCse",printer_bed:"Bett",heatpump_heating:"heizt",heatpump_water:"macht Warmwasser",heatpump_cooling:"k\xFChlt",heatpump_defrost:"taut ab",heatpump_idle:"in Ruhe",heatpump_flow_return:"Vor- \u2192 R\xFCcklauf",heatpump_heat:"W\xE4rme",heatpump_power:"Strom",heatpump_outside:"au\xDFen",pack_missing_item:"M\xF6bel aus entferntem Pack",back_to_room:"Zur\xFCck zu {room}",back_to_floor:"Zur\xFCck zur Etage",hint_furniture:"Raum antippen, dann rechts ein M\xF6belst\xFCck w\xE4hlen \xB7 M\xF6bel ziehen, an den Ecken die Gr\xF6\xDFe \xE4ndern",furniture_into:"Neue M\xF6bel kommen in die Mitte von \u201E{room}\u201C.",furniture_pick_room:"Tipp: Erst einen Raum antippen \u2013 dann landen neue M\xF6bel in seiner Mitte.",flows:"Stromfluss",flows_hint:"Energieb\xF6gen zwischen Solarfeldern, Wechselrichter, Akku, Netz und Verbrauchern ein- oder ausblenden",chk_title:"Einrichtung",chk_hint:"Was der Energiefluss braucht. Antippen springt an die Stelle.",chk_solar:"Solarfeld angelegt",chk_solar_add:"Ein Solarfeld aufs Dach legen",chk_meter:"Stromz\xE4hler mit Netzsensor",chk_meter_sensor:"Stromz\xE4hler: Netzsensor (W) fehlt",chk_meter_add:"Stromz\xE4hler anlegen",chk_inverter:"Wechselrichter mit Leistungssensor",chk_inverter_sensor:"Wechselrichter: Leistungssensor fehlt",chk_inverter_add:"Wechselrichter anlegen",chk_battery:"Stromspeicher mit Leistung und Ladestand",chk_battery_sensor:"Stromspeicher: Leistung oder Ladestand fehlt",chk_battery_opt:"Stromspeicher (optional)",chk_grid:"Netzanschluss gesetzt",chk_grid_opt:"Netzanschluss (optional, sonst automatisch)",energy_sign_grid:"Das Haus zeigt Einspeisung, obwohl die Sonne nichts liefert. Der Netzsensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_battery:"Der Speicher l\xE4dt ohne Sonne und ohne Netzbezug. Sein Sensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_flip:"Vorzeichen umkehren",help_title:"Hilfe und R\xFCckmeldung",help_hint:"Fehler bitte als Issue auf GitHub, W\xFCnsche als Diskussion \u2013 so geht nichts verloren, und alle sehen den Stand.",help_issue:"Problem melden",help_idea:"Idee vorschlagen",furn_name:"Name (optional)",furn_mirror:"Spiegeln",furn_mirror_hint:"Links und rechts vertauschen \u2013 das L-Sofa andersherum, der Schrank mit der T\xFCr auf der anderen Seite, die K\xFCchenzeile gespiegelt.",hint_opening:"Auf eine Wand tippen, um eine T\xFCr oder ein Fenster einzusetzen \u2013 die Art w\xE4hlst du danach rechts",preset_door:"T\xFCr",preset_door_double:"Doppelt\xFCr",preset_window:"Fenster",preset_window_double:"Fenster 2-fl\xFCgelig",preset_terrace:"Terrassent\xFCr",preset_terrace_double:"Terrassent\xFCr 2-fl\xFCgelig",preset_lift_slide:"Hebe-Schiebet\xFCr",preset_garage:"Garagentor",preset_front:"Haust\xFCr",opening_style:"Stil",sidelight_auto:"automatisch",sidelight_hinge:"Seitenteil an der Anschlagseite",sidelight_hinge_hint:"Das Seitenteil sitzt sonst gegen\xFCber dem Anschlag; mit Haken neben den B\xE4ndern.",sidelight_width:"Breite Seitenteil (m)",sidelight_width_left:"Seitenteil links (m)",sidelight_width_right:"Seitenteil rechts (m)",style_auto:"Automatisch ({style})",style_interior:"Zimmert\xFCr",style_front:"Haust\xFCr",style_front_glass:"Haust\xFCr mit Glasausschnitt",style_sidelight:"Haust\xFCr mit Seitenteil",style_sidelights:"Haust\xFCr mit 2 Seitenteilen",style_glass:"Glast\xFCr",style_sliding:"Schiebet\xFCr",style_p
Line truncated
|
||||
{url}`,manual:"Anleitung",manual_more:"Mehr erfahren",feature_text_energy:"Energieteilchen fliegen in B\xF6gen von den Solarfeldern zum Wechselrichter, zwischen Haus, Akku, Netz und Verbrauchern \u2013 schneller und dichter, je mehr Strom flie\xDFt. Die Module funkeln mit ihrer Produktion, eine Glaskarte \xFCber dem Dach zeigt die Bilanz und wie autark das Haus gerade ist.",live_autarky:"autark",live_fold:"Karte verkleinern",live_unfold:"Karte aufklappen",live_day_hint:"Die letzten 24 Stunden: Solar (Fl\xE4che) und Verbrauch (Linie)",live_week_hint:"Die letzten 7 Tage: Sonne {solar} kWh, Verbrauch {use} kWh (gelb: Sonne, hell: Verbrauch)",live_days:"Tage",live_car_away:"Unterwegs",live_car_charging:"L\xE4dt",live_car_plugged:"Eingesteckt",live_car_lock:"Verriegeln",live_car_unlock:"Entriegeln",live_car_unlock_confirm:"{name} wirklich entriegeln?",live_car_climate:"Klimatisierung",live_car_charge:"Laden starten/stoppen",live_media_prev:"Zur\xFCck",live_media_playpause:"Abspielen/Pause",live_media_next:"Weiter",live_media_volume:"Lautst\xE4rke",live_car_device:"Auto (eine Entit\xE4t des Autos)",live_car_device_hint:"Ladestand, Reichweite, Laden, Stecker, Schloss und Klima findet NextFloor selbst am Ger\xE4t des Autos. Ohne Angabe nimmt es den Anwesenheitssensor des Stellplatzes.",live_car_departure_entity:"Abfahrtszeit (optional)",live_car_departure:"Abfahrt {time}",live_car_open:"Offen: {parts}",printer_printing:"druckt",printer_done:"fertig",printer_paused:"pausiert",printer_error:"Fehler",printer_idle:"bereit",printer_done_at:"fertig um {time}",printer_layer:"Schicht",printer_nozzle:"D\xFCse",printer_bed:"Bett",heatpump_heating:"heizt",heatpump_water:"macht Warmwasser",heatpump_cooling:"k\xFChlt",heatpump_defrost:"taut ab",heatpump_idle:"in Ruhe",heatpump_flow_return:"Vor- \u2192 R\xFCcklauf",heatpump_heat:"W\xE4rme",heatpump_power:"Strom",heatpump_outside:"au\xDFen",pack_missing_item:"M\xF6bel aus entferntem Pack",back_to_room:"Zur\xFCck zu {room}",back_to_floor:"Zur\xFCck zur Etage",hint_furniture:"Raum antippen, dann rechts ein M\xF6belst\xFCck w\xE4hlen \xB7 M\xF6bel ziehen, an den Ecken die Gr\xF6\xDFe \xE4ndern",furniture_into:"Neue M\xF6bel kommen in die Mitte von \u201E{room}\u201C.",furniture_pick_room:"Tipp: Erst einen Raum antippen \u2013 dann landen neue M\xF6bel in seiner Mitte.",flows:"Stromfluss",flows_hint:"Energieb\xF6gen zwischen Solarfeldern, Wechselrichter, Akku, Netz und Verbrauchern ein- oder ausblenden",chk_title:"Einrichtung",chk_hint:"Was der Energiefluss braucht. Antippen springt an die Stelle.",chk_solar:"Solarfeld angelegt",chk_solar_add:"Ein Solarfeld aufs Dach legen",chk_meter:"Stromz\xE4hler mit Netzsensor",chk_meter_sensor:"Stromz\xE4hler: Netzsensor (W) fehlt",chk_meter_add:"Stromz\xE4hler anlegen",chk_inverter:"Wechselrichter mit Leistungssensor",chk_inverter_sensor:"Wechselrichter: Leistungssensor fehlt",chk_inverter_add:"Wechselrichter anlegen",chk_battery:"Stromspeicher mit Leistung und Ladestand",chk_battery_sensor:"Stromspeicher: Leistung oder Ladestand fehlt",chk_battery_opt:"Stromspeicher (optional)",chk_grid:"Netzanschluss gesetzt",chk_grid_opt:"Netzanschluss (optional, sonst automatisch)",energy_sign_grid:"Das Haus zeigt Einspeisung, obwohl die Sonne nichts liefert. Der Netzsensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_battery:"Der Speicher l\xE4dt ohne Sonne und ohne Netzbezug. Sein Sensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_flip:"Vorzeichen umkehren",help_title:"Hilfe und R\xFCckmeldung",help_hint:"Fehler bitte als Issue auf GitHub, W\xFCnsche als Diskussion \u2013 so geht nichts verloren, und alle sehen den Stand.",help_issue:"Problem melden",help_idea:"Idee vorschlagen",furn_name:"Name (optional)",furn_mirror:"Spiegeln",furn_mirror_hint:"Links und rechts vertauschen \u2013 das L-Sofa andersherum, der Schrank mit der T\xFCr auf der anderen Seite, die K\xFCchenzeile gespiegelt.",hint_opening:"Auf eine Wand tippen, um eine T\xFCr oder ein Fenster einzusetzen \u2013 die Art w\xE4hlst du danach rechts",preset_door:"T\xFCr",preset_door_double:"Doppelt\xFCr",preset_window:"Fenster",preset_window_double:"Fenster 2-fl\xFCgelig",preset_terrace:"Terrassent\xFCr",preset_terrace_double:"Terrassent\xFCr 2-fl\xFCgelig",preset_lift_slide:"Hebe-Schiebet\xFCr",preset_garage:"Garagentor",preset_front:"Haust\xFCr",opening_style:"Stil",sidelight_auto:"automatisch",sidelight_hinge:"Seitenteil an der Anschlagseite",sidelight_hinge_hint:"Das Seitenteil sitzt sonst gegen\xFCber dem Anschlag; mit Haken neben den B\xE4ndern.",sidelight_width:"Breite Seitenteil (m)",sidelight_width_left:"Seitenteil links (m)",sidelight_width_right:"Seitenteil rechts (m)",style_auto:"Automatisch ({style})",style_interior:"Zimmert\xFCr",style_front:"Haust\xFCr",style_front_glass:"Haust\xFCr mit Glasausschnitt",style_sidelight:"Haust\xFCr mit Seitenteil",style_sidelights:"Haust\xFCr mit 2 Seitenteilen",style_glass:"Glast\xFCr",style_sliding:"Schiebet\xFCr",style_p
Line truncated
|
||||
|
||||
A plugin runs with the same rights as NextFloor in your browser. The file has been reviewed and its content is fixed:
|
||||
{url}`,manual:"Manual",manual_more:"Learn more",feature_text_energy:"Energy particles fly in arcs from the solar fields to the inverter, between house, battery, grid and consumers \u2013 faster and denser the more power flows. The modules sparkle with their production, a glass card over the roof shows the balance and how self-sufficient the house is right now.",live_autarky:"self-sufficient",live_fold:"Make the card small",live_unfold:"Open the card",live_day_hint:"The last 24 hours: solar (area) and consumption (line)",live_week_hint:"The last 7 days: sun {solar} kWh, use {use} kWh (yellow: sun, light: use)",live_days:"days",live_car_away:"On the road",live_car_charging:"Charging",live_car_plugged:"Plugged in",live_car_lock:"Lock",live_car_unlock:"Unlock",live_car_unlock_confirm:"Really unlock {name}?",live_car_climate:"Climate",live_car_charge:"Start/stop charging",live_media_prev:"Previous",live_media_playpause:"Play/pause",live_media_next:"Next",live_media_volume:"Volume",live_car_device:"Car (any entity of the car)",live_car_device_hint:"Charge, range, charging, plug, lock and climate are found by NextFloor on the car's device. Without one it takes the spot's presence sensor.",live_car_departure_entity:"Departure time (optional)",live_car_departure:"Departs {time}",live_car_open:"Open: {parts}",printer_printing:"printing",printer_done:"done",printer_paused:"paused",printer_error:"error",printer_idle:"idle",printer_done_at:"done at {time}",printer_layer:"Layer",printer_nozzle:"Nozzle",printer_bed:"Bed",heatpump_heating:"heating",heatpump_water:"making hot water",heatpump_cooling:"cooling",heatpump_defrost:"defrosting",heatpump_idle:"resting",heatpump_flow_return:"Flow \u2192 return",heatpump_heat:"Heat",heatpump_power:"Power",heatpump_outside:"outside",pack_missing_item:"Furniture of a removed pack",back_to_room:"Back to {room}",back_to_floor:"Back to the floor",hint_furniture:"Tap a room, then pick an item on the right \xB7 drag items, resize them by their corners",furniture_into:"New items go into the middle of \u201C{room}\u201D.",furniture_pick_room:"Tip: tap a room first \u2013 new items then land in its middle.",flows:"Power flow",flows_hint:"Show or hide the energy arcs between solar fields, inverter, battery, grid and consumers",chk_title:"Setup",chk_hint:"What the energy flow needs. Tap a row to jump there.",chk_solar:"Solar field in place",chk_solar_add:"Put a solar field on the roof",chk_meter:"Meter with grid sensor",chk_meter_sensor:"Meter: grid sensor (W) missing",chk_meter_add:"Add the meter",chk_inverter:"Inverter with power sensor",chk_inverter_sensor:"Inverter: power sensor missing",chk_inverter_add:"Add an inverter",chk_battery:"Home battery with power and charge",chk_battery_sensor:"Home battery: power or charge missing",chk_battery_opt:"Home battery (optional)",chk_grid:"Grid connection set",chk_grid_opt:"Grid connection (optional, else automatic)",energy_sign_grid:"The house shows export while the sun produces nothing. The grid sensor probably has its sign reversed.",energy_sign_battery:"The battery charges with no sun and no grid draw. Its sensor probably has its sign reversed.",energy_sign_flip:"Flip the sign",help_title:"Help and feedback",help_hint:"Please report problems as a GitHub issue and wishes as a discussion \u2013 nothing gets lost, and everyone sees the state.",help_issue:"Report a problem",help_idea:"Propose an idea",furn_name:"Name (optional)",furn_mirror:"Mirror",furn_mirror_hint:"Swap left and right \u2013 the L-sofa the other way round, the cabinet with its door on the other side, the kitchen run mirrored.",hint_opening:"Tap a wall to add a door or window \u2013 choose its kind on the right afterwards",preset_door:"Door",preset_door_double:"Double door",preset_window:"Window",preset_window_double:"Double window",preset_terrace:"Terrace door",preset_terrace_double:"French doors",preset_lift_slide:"Lift-and-slide door",preset_garage:"Garage door",preset_front:"Front door",opening_style:"Style",sidelight_auto:"automatic",sidelight_hinge:"Sidelight on the hinge side",sidelight_hinge_hint:"The sidelight sits opposite the hinge otherwise; ticked, it sits next to the hinges.",sidelight_width:"Sidelight width (m)",sidelight_width_left:"Left sidelight (m)",sidelight_width_right:"Right sidelight (m)",style_auto:"Automatic ({style})",style_interior:"Room door",style_front:"Front door",style_front_glass:"Front door with glass",style_sidelight:"Front door with sidelight",style_sidelights:"Front door with two sidelights",style_glass:"Glass door",style_sliding:"Sliding door",style_passage:"Opening (no door)",style_standard:"Standard",style_bars:"With glazing bars",style_glass_wall:"Glass wall (fixed)",preset_glass_wall:"Glass wall",glass_panes:"Panes",glass_panes_auto:"automatic (about 0.9 m)",glass_panes_hint:"0 = one single pane without mullions, empty = about every 0.9 m",flip_hinge:"Swap hinge side",flip_main_leaf:"Swap main leaf",flip_hinge_hint:"Hinges to the other side"
Line truncated
|
||||
{url}`,manual:"Manual",manual_more:"Learn more",feature_text_energy:"Energy particles fly in arcs from the solar fields to the inverter, between house, battery, grid and consumers \u2013 faster and denser the more power flows. The modules sparkle with their production, a glass card over the roof shows the balance and how self-sufficient the house is right now.",live_autarky:"self-sufficient",live_fold:"Make the card small",live_unfold:"Open the card",live_day_hint:"The last 24 hours: solar (area) and consumption (line)",live_week_hint:"The last 7 days: sun {solar} kWh, use {use} kWh (yellow: sun, light: use)",live_days:"days",live_car_away:"On the road",live_car_charging:"Charging",live_car_plugged:"Plugged in",live_car_lock:"Lock",live_car_unlock:"Unlock",live_car_unlock_confirm:"Really unlock {name}?",live_car_climate:"Climate",live_car_charge:"Start/stop charging",live_media_prev:"Previous",live_media_playpause:"Play/pause",live_media_next:"Next",live_media_volume:"Volume",live_car_device:"Car (any entity of the car)",live_car_device_hint:"Charge, range, charging, plug, lock and climate are found by NextFloor on the car's device. Without one it takes the spot's presence sensor.",live_car_departure_entity:"Departure time (optional)",live_car_departure:"Departs {time}",live_car_open:"Open: {parts}",printer_printing:"printing",printer_done:"done",printer_paused:"paused",printer_error:"error",printer_idle:"idle",printer_done_at:"done at {time}",printer_layer:"Layer",printer_nozzle:"Nozzle",printer_bed:"Bed",heatpump_heating:"heating",heatpump_water:"making hot water",heatpump_cooling:"cooling",heatpump_defrost:"defrosting",heatpump_idle:"resting",heatpump_flow_return:"Flow \u2192 return",heatpump_heat:"Heat",heatpump_power:"Power",heatpump_outside:"outside",pack_missing_item:"Furniture of a removed pack",back_to_room:"Back to {room}",back_to_floor:"Back to the floor",hint_furniture:"Tap a room, then pick an item on the right \xB7 drag items, resize them by their corners",furniture_into:"New items go into the middle of \u201C{room}\u201D.",furniture_pick_room:"Tip: tap a room first \u2013 new items then land in its middle.",flows:"Power flow",flows_hint:"Show or hide the energy arcs between solar fields, inverter, battery, grid and consumers",chk_title:"Setup",chk_hint:"What the energy flow needs. Tap a row to jump there.",chk_solar:"Solar field in place",chk_solar_add:"Put a solar field on the roof",chk_meter:"Meter with grid sensor",chk_meter_sensor:"Meter: grid sensor (W) missing",chk_meter_add:"Add the meter",chk_inverter:"Inverter with power sensor",chk_inverter_sensor:"Inverter: power sensor missing",chk_inverter_add:"Add an inverter",chk_battery:"Home battery with power and charge",chk_battery_sensor:"Home battery: power or charge missing",chk_battery_opt:"Home battery (optional)",chk_grid:"Grid connection set",chk_grid_opt:"Grid connection (optional, else automatic)",energy_sign_grid:"The house shows export while the sun produces nothing. The grid sensor probably has its sign reversed.",energy_sign_battery:"The battery charges with no sun and no grid draw. Its sensor probably has its sign reversed.",energy_sign_flip:"Flip the sign",help_title:"Help and feedback",help_hint:"Please report problems as a GitHub issue and wishes as a discussion \u2013 nothing gets lost, and everyone sees the state.",help_issue:"Report a problem",help_idea:"Propose an idea",furn_name:"Name (optional)",furn_mirror:"Mirror",furn_mirror_hint:"Swap left and right \u2013 the L-sofa the other way round, the cabinet with its door on the other side, the kitchen run mirrored.",hint_opening:"Tap a wall to add a door or window \u2013 choose its kind on the right afterwards",preset_door:"Door",preset_door_double:"Double door",preset_window:"Window",preset_window_double:"Double window",preset_terrace:"Terrace door",preset_terrace_double:"French doors",preset_lift_slide:"Lift-and-slide door",preset_garage:"Garage door",preset_front:"Front door",opening_style:"Style",sidelight_auto:"automatic",sidelight_hinge:"Sidelight on the hinge side",sidelight_hinge_hint:"The sidelight sits opposite the hinge otherwise; ticked, it sits next to the hinges.",sidelight_width:"Sidelight width (m)",sidelight_width_left:"Left sidelight (m)",sidelight_width_right:"Right sidelight (m)",style_auto:"Automatic ({style})",style_interior:"Room door",style_front:"Front door",style_front_glass:"Front door with glass",style_sidelight:"Front door with sidelight",style_sidelights:"Front door with two sidelights",style_glass:"Glass door",style_sliding:"Sliding door",style_passage:"Opening (no door)",style_standard:"Standard",style_bars:"With glazing bars",style_glass_wall:"Glass wall (fixed)",preset_glass_wall:"Glass wall",glass_panes:"Panes",glass_panes_auto:"automatic (about 0.9 m)",glass_panes_hint:"0 = one single pane without mullions, empty = about every 0.9 m",flip_hinge:"Swap hinge side",flip_main_leaf:"Swap main leaf",flip_hinge_hint:"Hinges to the other side"
Line truncated
|
||||
:host {
|
||||
--nf-text: var(--primary-text-color, #e1e1e1);
|
||||
--nf-muted: var(--secondary-text-color, #9b9b9b);
|
||||
@@ -35,7 +35,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
font-family: var(--nf-font);
|
||||
color: var(--nf-text);
|
||||
}
|
||||
`,yr=X`
|
||||
`,kr=Y`
|
||||
:host([readable]) {
|
||||
--secondary-text-color: var(--primary-text-color, #e1e1e1);
|
||||
--divider-color: color-mix(in srgb, var(--primary-text-color, #e1e1e1) 40%, transparent);
|
||||
@@ -46,7 +46,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
:host([readable]) .nf-overlay {
|
||||
zoom: 1.2;
|
||||
}
|
||||
`,Re=X`
|
||||
`,Re=Y`
|
||||
/* a group of switches: one rounded pill, the active one tinted with the accent */
|
||||
.nf-seg {
|
||||
display: inline-flex;
|
||||
@@ -209,10 +209,10 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
min-height: 40px;
|
||||
}
|
||||
}
|
||||
`;function wr(r){return r?.themes?.darkMode===!1?"light":"dark"}function cn(r,e){let t=new Set;return e.flatMap(n=>{let i=String(r?.states[n]?.attributes.symcon_source_entity||n),o=r?.states[i]?.attributes,s=Number(o?.symcon_id);return!s||!o?.symcon_archive||t.has(s)?[]:(t.add(s),[i])})}var Ua,Vi=class extends ee{static properties={hass:{attribute:!1},ids:{attribute:!1},label:{attribute:!1},busy:{state:!0},error:{state:!0}};constructor(){super(),this.ids=[],this.label="",this.busy=!1,this.error=""}async open(e){e.stopPropagation(),this.busy=!0,this.error="";try{let t=new URL("./nextfloor-trend.js?v=b32d63f21bee",import.meta.url).href;await(await(Ua??=import(t).catch(i=>{throw Ua=void 0,i}))).openTrend(this.hass,this.ids,this.label)}catch(t){this.error=t instanceof Error?t.message:String(t)}finally{this.busy=!1}}render(){if(!cn(this.hass,this.ids).length)return f;let e=this.label?`Trend anzeigen: ${this.label}`:"Trend anzeigen";return p`<button type="button" title=${e} aria-label=${e} aria-haspopup="dialog" ?disabled=${this.busy} @pointerdown=${t=>t.stopPropagation()} @click=${t=>{this.open(t)}}>
|
||||
`;function Sr(r){return r?.themes?.darkMode===!1?"light":"dark"}function mn(r,e){let t=new Set;return e.flatMap(n=>{let i=String(r?.states[n]?.attributes.symcon_source_entity||n),o=r?.states[i]?.attributes,s=Number(o?.symcon_id);return!s||!o?.symcon_archive||t.has(s)?[]:(t.add(s),[i])})}var Za,Gi=class extends Q{static properties={hass:{attribute:!1},ids:{attribute:!1},label:{attribute:!1},busy:{state:!0},error:{state:!0}};constructor(){super(),this.ids=[],this.label="",this.busy=!1,this.error=""}async open(e){e.stopPropagation(),this.busy=!0,this.error="";try{let t=new URL("./nextfloor-trend.js?v=84417e0b2573",import.meta.url).href;await(await(Za??=import(t).catch(i=>{throw Za=void 0,i}))).openTrend(this.hass,this.ids,this.label)}catch(t){this.error=t instanceof Error?t.message:String(t)}finally{this.busy=!1}}render(){if(!mn(this.hass,this.ids).length)return f;let e=this.label?`Trend anzeigen: ${this.label}`:"Trend anzeigen";return p`<button type="button" title=${e} aria-label=${e} aria-haspopup="dialog" ?disabled=${this.busy} @pointerdown=${t=>t.stopPropagation()} @click=${t=>{this.open(t)}}>
|
||||
<svg width="12" height="12" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M3 2v15h15M5 13l4-5 4 2 4-6"/></svg>
|
||||
</button>${this.error?p`<span role="alert">${this.error}</span>`:f}`}static styles=X`:host{position:relative;display:inline-flex;flex:0 0 18px;width:18px;height:18px;vertical-align:middle;margin-left:3px;font-weight:normal;line-height:0}button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:18px;height:18px;padding:2px;border:0;border-radius:3px;background:transparent;color:var(--nf-accent,#40c8ff);opacity:.8;cursor:pointer}svg{display:block;flex-shrink:0}button:hover,button:focus-visible{opacity:1;background:#40c8ff18}button:focus-visible{outline:1px solid currentColor;outline-offset:1px}button:disabled{opacity:.4}span{position:absolute;right:0;top:22px;z-index:10;box-sizing:border-box;width:200px;padding:8px;border:1px solid #ff9b9b50;border-radius:6px;background:var(--nf-chrome-solid,#1c1c1c);font:12px/1.4 system-ui;color:#ff9b9b;white-space:normal}`};customElements.get("nf-trend-button")||customElements.define("nf-trend-button",Vi);function j(r,e,t=""){let n=cn(r,e);return n.length?p`<nf-trend-button .hass=${r} .ids=${n} .label=${t}></nf-trend-button>`:f}var Ki=class extends ee{static properties={hass:{attribute:!1},room:{attribute:!1},_pending:{state:!0},_error:{state:!0}};constructor(){super(),this._pending=new Set,this._error=""}async send(e,t,n,i){this._pending=new Set([...this._pending,e]),this._error="";try{await this.hass.callService(t,n,{entity_id:e,...i})}catch(o){this._error=o instanceof Error?o.message:String(o)}finally{this._pending=new Set([...this._pending].filter(o=>o!==e))}}value(e,t,n){let i=this.hass.states[t],o=Je(i),s=i?.attributes,a=n&&!!s?.symcon_has_action&&o!==null&&!this._pending.has(t);return p`<div class="value"><span>${e}</span><b>${Qe(i)}${j(this.hass,[t],e)}</b>
|
||||
${n&&s?.symcon_has_action&&s.symcon_variable_type===0?p`<button class="nf-chip" aria-pressed=${se(i)===!0} ?disabled=${!a} @click=${()=>{this.send(t,"symcon","set_value",{value:!se(i)})}}>${se(i)?"Ein":"Aus"}</button>`:n&&s?.symcon_has_action&&[1,2].includes(Number(s.symcon_variable_type))?p`<input type="number" aria-label=${e} .value=${String(Ne(i)??"")} min=${String(s.symcon_min??0)} max=${String(s.symcon_max??100)} step=${String(s.symcon_step||(s.symcon_variable_type===1?1:.1))} ?disabled=${!a}
|
||||
</button>${this.error?p`<span role="alert">${this.error}</span>`:f}`}static styles=Y`:host{position:relative;display:inline-flex;flex:0 0 18px;width:18px;height:18px;vertical-align:middle;margin-left:3px;font-weight:normal;line-height:0}button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:18px;height:18px;padding:2px;border:0;border-radius:3px;background:transparent;color:var(--nf-accent,#40c8ff);opacity:.8;cursor:pointer}svg{display:block;flex-shrink:0}button:hover,button:focus-visible{opacity:1;background:#40c8ff18}button:focus-visible{outline:1px solid currentColor;outline-offset:1px}button:disabled{opacity:.4}span{position:absolute;right:0;top:22px;z-index:10;box-sizing:border-box;width:200px;padding:8px;border:1px solid #ff9b9b50;border-radius:6px;background:var(--nf-chrome-solid,#1c1c1c);font:12px/1.4 system-ui;color:#ff9b9b;white-space:normal}`};customElements.get("nf-trend-button")||customElements.define("nf-trend-button",Gi);function U(r,e,t=""){let n=mn(r,e);return n.length?p`<nf-trend-button .hass=${r} .ids=${n} .label=${t}></nf-trend-button>`:f}var Ui=class extends Q{static properties={hass:{attribute:!1},room:{attribute:!1},_pending:{state:!0},_error:{state:!0}};constructor(){super(),this._pending=new Set,this._error=""}async send(e,t,n,i){this._pending=new Set([...this._pending,e]),this._error="";try{await this.hass.callService(t,n,{entity_id:e,...i})}catch(o){this._error=o instanceof Error?o.message:String(o)}finally{this._pending=new Set([...this._pending].filter(o=>o!==e))}}value(e,t,n){let i=this.hass.states[t],o=tt(i),s=i?.attributes,a=n&&!!s?.symcon_has_action&&o!==null&&!this._pending.has(t);return p`<div class="value"><span>${e}</span><b>${nt(i)}${U(this.hass,[t],e)}</b>
|
||||
${n&&s?.symcon_has_action&&s.symcon_variable_type===0?p`<button class="nf-chip" aria-pressed=${se(i)===!0} ?disabled=${!a} @click=${()=>{this.send(t,"symcon","set_value",{value:!se(i)})}}>${se(i)?"Ein":"Aus"}</button>`:n&&s?.symcon_has_action&&[1,2].includes(Number(s.symcon_variable_type))?p`<input type="number" aria-label=${e} .value=${String(Le(i)??"")} min=${String(s.symcon_min??0)} max=${String(s.symcon_max??100)} step=${String(s.symcon_step||(s.symcon_variable_type===1?1:.1))} ?disabled=${!a}
|
||||
@change=${l=>{let u=l.target;u.value.trim()&&u.checkValidity()&&this.send(t,"symcon","set_value",{value:Number(u.value)})}} />`:f}
|
||||
</div>`}schedule(e){let t=this.hass.states[e];if(!t?.attributes.symcon_schedule)return p`<p class="missing">Schaltuhr nicht verfügbar</p>`;let n=t.attributes.actions??[],i=t.attributes.groups??[],o=Number(t.attributes.next_run??0),s=n.find(u=>u.id===t.attributes.next_action),a=["Mo","Di","Mi","Do","Fr","Sa","So"],l=u=>`${String(u.hour).padStart(2,"0")}:${String(u.minute).padStart(2,"0")}${u.second?`:${String(u.second).padStart(2,"0")}`:""}`;return p`<details class="schedule"><summary>${String(t.attributes.friendly_name??"Schaltuhr")}</summary>
|
||||
<label class="nf-check"><input type="checkbox" .checked=${t.state==="on"} ?disabled=${this._pending.has(e)} @change=${u=>{this.send(e,"schedule","set_active",{active:u.target.checked})}} /> Aktiv</label>
|
||||
@@ -220,9 +220,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
${i.length?i.map(u=>p`<div class="schedule-group"><b>${a.filter((c,d)=>u.days&1<<d).join(" \xB7 ")}</b><div class="points">
|
||||
${[...u.points].sort((c,d)=>c.hour*3600+c.minute*60+c.second-(d.hour*3600+d.minute*60+d.second)).map(c=>{let d=n.find(m=>m.id===c.action);return p`<span class="point"><time>${l(c)}</time><span class="dot" style=${`background:#${Number(d?.color??8885929).toString(16).padStart(6,"0").slice(-6)}`}></span>${d?.name||"Aktion"}</span>`})}
|
||||
</div></div>`):p`<p class="missing">Keine Schaltpunkte vorhanden.</p>`}
|
||||
</details>`}render(){if(!this.hass||!this.room)return f;let e=Ga.filter(i=>i.key!=="status"&&this.room.hvac?.[i.key]&&this.room.hvac[i.key]!=="none"),t=this.room.hvac?.schedules??[],n=this.room.floor_heating&&this.room.floor_heating!=="none"?this.room.floor_heating:null;return p`${n||e.length?p`<section><h3>Raumklima</h3>${n?this.value("Fu\xDFbodenheizung",n,!0):f}${e.map(i=>this.value(i.label,this.room.hvac[i.key],!!i.control))}</section>`:f}
|
||||
</details>`}render(){if(!this.hass||!this.room)return f;let e=qa.filter(i=>i.key!=="status"&&this.room.hvac?.[i.key]&&this.room.hvac[i.key]!=="none"),t=this.room.hvac?.schedules??[],n=this.room.floor_heating&&this.room.floor_heating!=="none"?this.room.floor_heating:null;return p`${n||e.length?p`<section><h3>Raumklima</h3>${n?this.value("Fu\xDFbodenheizung",n,!0):f}${e.map(i=>this.value(i.label,this.room.hvac[i.key],!!i.control))}</section>`:f}
|
||||
${t.length?p`<section><h3>Schaltuhren</h3>${t.map(i=>this.schedule(i))}</section>`:f}
|
||||
${this._error?p`<p role="alert" class="error">${this._error}</p>`:f}`}static styles=[ge,Re,X`
|
||||
${this._error?p`<p role="alert" class="error">${this._error}</p>`:f}`}static styles=[ge,Re,Y`
|
||||
:host { display:block; }
|
||||
section { margin:18px 0; }
|
||||
h3 { font-size:12px; text-transform:uppercase; letter-spacing:.05em; color:var(--nf-muted); margin:0 0 8px; }
|
||||
@@ -240,14 +240,14 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
.point time { font-variant-numeric:tabular-nums; }
|
||||
.dot { width:8px; height:8px; border-radius:50%; }
|
||||
.error { color:var(--nf-danger,#ff6b7a); font-size:12px; }
|
||||
`]};customElements.get("nf-room-hvac")||customElements.define("nf-room-hvac",Ki);var xr={electricity:"Strom",water:"Wasser",gas:"Gas",heating:"Heizen",cooling:"K\xFChlen"},Ya={electricity:"\u26A1",water:"\u{1F4A7}",gas:"\u{1F525}",heating:"\u2668",cooling:"\u2744"},Ui=r=>r.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/ß/g,"ss").replace(/[^a-z0-9]+/g," ").trim(),Dh="{485D0419-BE97-4548-AA9C-C083EB82E61E}",Fh=r=>r.object_type!==0&&!(r.object_type===1&&r.module_id?.toUpperCase()===Dh)?null:{elektro:"electricity",strom:"electricity","elektro strom":"electricity","strom elektro":"electricity",wasser:"water",gas:"gas",heizen:"heating",heizung:"heating",warme:"heating",waerme:"heating",kuhlen:"cooling",kuehlen:"cooling",kuhlung:"cooling",kuehlung:"cooling",kalte:"cooling",kaelte:"cooling"}[Ui(r.name)]??null,ja=r=>/^symcon-category-(\d+)$/.exec(r??"")?.[1],Ja=r=>/\b(heute|tag|tagesverbrauch|today|daily)\b/.test(r)?"day":/monat|month/.test(r)?"month":/jahr|year/.test(r)?"year":"total",ji=(r,e)=>String(r.states[e]?.attributes.symcon_source_entity||e);function Qa(r){let e=String(r?.attributes.unit_of_measurement??"").trim(),t=e.replace(/[³]/g,"3").replace(/[²]/g,"2").replace(/\s+/g,"").toLowerCase();return["w","kw","mw"].includes(t)?{metric:"power",unit:"W",factor:e==="mW"?.001:t==="kw"?1e3:t==="mw"?1e6:1}:["wh","kwh","mwh","j","kj","mj","gj"].includes(t)?{metric:"energy",unit:"kWh",factor:{wh:.001,kwh:1,mwh:1e3,j:1/36e5,kj:1/3600,mj:1/3.6,gj:1e3/3.6}[t]}:["m3/h","m3h","m3/min","m3/s","l/h","l/min","l/s","liter/h","liter/min"].includes(t)?{metric:"power",unit:"m\xB3/h",factor:{"m3/h":1,m3h:1,"m3/min":60,"m3/s":3600,"l/h":.001,"l/min":.06,"l/s":3.6,"liter/h":.001,"liter/min":.06}[t]}:["m3","l","liter"].includes(t)?{metric:"energy",unit:"m\xB3",factor:t==="m3"?1:.001}:null}function Hh(r,e){if(!e.entity_id||e.object_type!==2&&e.object_type!==6)return null;let t=ji(r,e.entity_id),n=r.states[t];if(!n||![1,2].includes(Number(n.attributes.symcon_variable_type)))return null;let i=Ui(e.name),o=Qa(n),s=/^(leistung|wirkleistung|gesamtleistung|aktuelle leistung|durchfluss|volumenstrom)(\b|$)/.test(i),a=/^(verbrauch|energie|energieverbrauch|gesamtverbrauch|gesamtenergie|zahlerstand|zaehlerstand|arbeit)(\b|$)/.test(i),l=o?.metric??(s?"power":a?"energy":null);if(!l)return null;let u=l==="power"?/^(leistung|wirkleistung|gesamtleistung|durchfluss|volumenstrom)$/.test(i):/^(verbrauch|energie|energieverbrauch|gesamtverbrauch|gesamtenergie|zahlerstand|zaehlerstand|arbeit)$/.test(i),c=l==="energy"?Ja(i):"total";return{metric:l,source:t,period:c,group:`${l}|${o?.unit??String(n.attributes.unit_of_measurement??"")}|${c}`,score:/^gesamt(leistung|verbrauch|energie)$/.test(i)?110:u?100:(l==="power"?s:a)?70:20}}var qa=new WeakMap,Za=new WeakMap;function Ph(r){let e=qa.get(r);if(e)return e;let t={nodes:new Map(r.map(n=>[n.object_id,n])),children:new Map};for(let n of r){let i=t.children.get(n.parent_id)??[];i.push(n),t.children.set(n.parent_id,i)}return qa.set(r,t),t}function qi(r,e,t){if(!G(r))return[];let n=[e.area_id,...e.sub_areas??[]].map(ja).filter(m=>!!m);if(!n.length)return[];let i=new Set(t.filter(m=>m.id!==e.id).flatMap(m=>[m.area_id,...m.sub_areas??[]]).map(ja).filter(m=>!!m&&!n.includes(m))),o=`${n.join(",")}|${[...i].sort().join(",")}`,s=Za.get(r)??new Map;Za.set(r,s);let a=s.get(o);if(a)return a;let l=Ph(r.symconObjects),u=[],c=new Set,d=(m,h,g)=>{if(c.has(m)||i.has(String(m)))return;c.add(m);let _=l.nodes.get(m);if(!_)return;let b=Fh(_),v=b??h,S=new Set(b&&b!==h?[]:g),k=l.children.get(m)??[];if(v){let M=k.map(z=>Hh(r,z)).filter(z=>z!==null);for(let z of new Set(M.map(R=>R.group))){if(S.has(z))continue;let R=M.filter(E=>E.group===z),F=Math.max(...R.map(E=>E.score)),T=R.filter(E=>E.score===F);for(let E of F>=100?T.slice(0,1):T)u.push({kind:v,metric:E.metric,id:E.source,period:E.period});S.add(z)}}for(let M of k)(M.object_type===0||M.object_type===1)&&d(M.object_id,v,S)};for(let m of n)d(Number(m),null,new Set);return s.set(o,u),u}function Xa(r,e,t=!1){let n=new Map,i=new Set;for(let o of e){let s=ji(r,o.id),a=`${o.kind}|${o.metric}|${s}`;if(i.has(a))continue;i.add(a);let l=r.states[s],u=Qa(l),c=u?.metric===o.metric?u.unit:String(l?.attributes.unit_of_measurement??"").trim(),d=`${o.kind}|${o.metric}|${c}|${o.period}`,m=n.get(d)??{kind:o.kind,metric:o.metric,unit:c,value:null,period:o.period,sources:[],manual:t,incomplete:!1},h=Ne(l);h===null?m.incomplete=!0:m.value=(m.value??0)+h*(u?.metric===o.metric?u.factor:1),m.sources.push(s),n.set(d,m)}return[...n.values()]}function Ft(r,e,t=[]){return Xa(r,qi(r,e,t))}function Gi(r,e,t,n){let i=e.utility_meters?.[t],o=i&&Object.prototype.hasOwnProperty.call(i,n)?i[n]:t==="electricity"&&n==="power"?e.power_entity:null;return o&&o!=="none"?ji(r,o):null}function dn(r,e,t=e.rooms){let n=e.rooms.flatMap(o=>qi(r,o,t)),i=[];for(let o of en)for(let s of["power","energy"]){let a=Gi(r,e,o,s);i.push(...Xa(r,a?[{kind:o,metric:s,id:a,period:s==="energy"?Ja(Ui(String(r.states[a]
Line truncated
|
||||
<h4>${Ya[e]} ${xr[e]}</h4>
|
||||
`]};customElements.get("nf-room-hvac")||customElements.define("nf-room-hvac",Ui);var ze={electricity:"Strom",water:"Wasser",gas:"Gas",heating:"Heizen",cooling:"K\xFChlen"},pn={electricity:"\u26A1",water:"\u{1F4A7}",gas:"\u{1F525}",heating:"\u2668",cooling:"\u2744"},qi=r=>r.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/ß/g,"ss").replace(/[^a-z0-9]+/g," ").trim(),Hh="{485D0419-BE97-4548-AA9C-C083EB82E61E}",Ph=r=>r.object_type!==0&&!(r.object_type===1&&r.module_id?.toUpperCase()===Hh)?null:{elektro:"electricity",strom:"electricity","elektro strom":"electricity","strom elektro":"electricity",wasser:"water",gas:"gas",heizen:"heating",heizung:"heating",warme:"heating",waerme:"heating",kuhlen:"cooling",kuehlen:"cooling",kuhlung:"cooling",kuehlung:"cooling",kalte:"cooling",kaelte:"cooling"}[qi(r.name)]??null,Ya=r=>/^symcon-category-(\d+)$/.exec(r??"")?.[1],Xa=r=>/\b(heute|tag|tagesverbrauch|today|daily)\b/.test(r)?"day":/monat|month/.test(r)?"month":/jahr|year/.test(r)?"year":"total",Zi=(r,e)=>String(r.states[e]?.attributes.symcon_source_entity||e);function el(r){let e=String(r?.attributes.unit_of_measurement??"").trim(),t=e.replace(/[³]/g,"3").replace(/[²]/g,"2").replace(/\s+/g,"").toLowerCase();return["w","kw","mw"].includes(t)?{metric:"power",unit:"W",factor:e==="mW"?.001:t==="kw"?1e3:t==="mw"?1e6:1}:["wh","kwh","mwh","j","kj","mj","gj"].includes(t)?{metric:"energy",unit:"kWh",factor:{wh:.001,kwh:1,mwh:1e3,j:1/36e5,kj:1/3600,mj:1/3.6,gj:1e3/3.6}[t]}:["m3/h","m3h","m3/min","m3/s","l/h","l/min","l/s","liter/h","liter/min"].includes(t)?{metric:"power",unit:"m\xB3/h",factor:{"m3/h":1,m3h:1,"m3/min":60,"m3/s":3600,"l/h":.001,"l/min":.06,"l/s":3.6,"liter/h":.001,"liter/min":.06}[t]}:["m3","l","liter"].includes(t)?{metric:"energy",unit:"m\xB3",factor:t==="m3"?1:.001}:null}function Ih(r,e){if(!e.entity_id||e.object_type!==2&&e.object_type!==6)return null;let t=Zi(r,e.entity_id),n=r.states[t];if(!n||![1,2].includes(Number(n.attributes.symcon_variable_type)))return null;let i=qi(e.name),o=el(n),s=/^(leistung|wirkleistung|gesamtleistung|aktuelle leistung|durchfluss|volumenstrom)(\b|$)/.test(i),a=/^(verbrauch|energie|energieverbrauch|gesamtverbrauch|gesamtenergie|zahlerstand|zaehlerstand|arbeit)(\b|$)/.test(i),l=o?.metric??(s?"power":a?"energy":null);if(!l)return null;let u=l==="power"?/^(leistung|wirkleistung|gesamtleistung|durchfluss|volumenstrom)$/.test(i):/^(verbrauch|energie|energieverbrauch|gesamtverbrauch|gesamtenergie|zahlerstand|zaehlerstand|arbeit)$/.test(i),c=l==="energy"?Xa(i):"total";return{metric:l,source:t,period:c,group:`${l}|${o?.unit??String(n.attributes.unit_of_measurement??"")}|${c}`,score:/^gesamt(leistung|verbrauch|energie)$/.test(i)?110:u?100:(l==="power"?s:a)?70:20}}var Ja=new WeakMap,Qa=new WeakMap;function Nh(r){let e=Ja.get(r);if(e)return e;let t={nodes:new Map(r.map(n=>[n.object_id,n])),children:new Map};for(let n of r){let i=t.children.get(n.parent_id)??[];i.push(n),t.children.set(n.parent_id,i)}return Ja.set(r,t),t}function Yi(r,e,t){if(!K(r))return[];let n=[e.area_id,...e.sub_areas??[]].map(Ya).filter(m=>!!m);if(!n.length)return[];let i=new Set(t.filter(m=>m.id!==e.id).flatMap(m=>[m.area_id,...m.sub_areas??[]]).map(Ya).filter(m=>!!m&&!n.includes(m))),o=`${n.join(",")}|${[...i].sort().join(",")}`,s=Qa.get(r)??new Map;Qa.set(r,s);let a=s.get(o);if(a)return a;let l=Nh(r.symconObjects),u=[],c=new Set,d=(m,h,g)=>{if(c.has(m)||i.has(String(m)))return;c.add(m);let _=l.nodes.get(m);if(!_)return;let b=Ph(_),v=b??h,S=new Set(b&&b!==h?[]:g),k=l.children.get(m)??[];if(v){let M=k.map(z=>Ih(r,z)).filter(z=>z!==null);for(let z of new Set(M.map(R=>R.group))){if(S.has(z))continue;let R=M.filter(E=>E.group===z),F=Math.max(...R.map(E=>E.score)),T=R.filter(E=>E.score===F);for(let E of F>=100?T.slice(0,1):T)u.push({kind:v,metric:E.metric,id:E.source,period:E.period});S.add(z)}}for(let M of k)(M.object_type===0||M.object_type===1)&&d(M.object_id,v,S)};for(let m of n)d(Number(m),null,new Set);return s.set(o,u),u}function Ji(r,e,t=!1){let n=new Map,i=new Set;for(let o of e){let s=Zi(r,o.id),a=`${o.kind}|${o.metric}|${s}`;if(i.has(a))continue;i.add(a);let l=r.states[s],u=el(l),c=u?.metric===o.metric?u.unit:String(l?.attributes.unit_of_measurement??"").trim(),d=`${o.kind}|${o.metric}|${c}|${o.period}`,m=n.get(d)??{kind:o.kind,metric:o.metric,unit:c,value:null,period:o.period,sources:[],manual:t,incomplete:!1},h=Le(l);h===null?m.incomplete=!0:m.value=(m.value??0)+h*(u?.metric===o.metric?u.factor:1),m.sources.push(s),n.set(d,m)}return[...n.values()]}function rt(r,e,t=[]){return Ji(r,Yi(r,e,t))}function ji(r,e,t,n){let i=e.utility_meters?.[t],o=i&&Object.prototype.hasOwnProperty.call(i,n)?i[n]:t==="electricity"&&n==="power"?e.power_entity:null;return o&&o!=="none"?Zi(r,o):null}function Te(r,e,t=e.rooms){let n=e.rooms.flatMap(o=>Yi(r,o,t)),i=[];for(let o of Je)for(let s of["power","energy"]){let a=ji(r,e,o,s);i.push(...Ji(r,a?[{kind:o,metric:s,id:a,period:s==="energy"?Xa(qi(String(r.states[a]
Line truncated
|
||||
<h4>${pn[e]} ${ze[e]}</h4>
|
||||
${this.readings.filter(t=>t.kind===e).map(t=>p`<div class="reading" title=${`${t.manual?"Stockwerksz\xE4hler":"Bereichsz\xE4hler"}${t.incomplete?" \xB7 Err: Mindestens ein Wert fehlt; angezeigt wird die Summe der verf\xFCgbaren Werte.":""}
|
||||
${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states[n]?.attributes.friendly_name||n).join(`
|
||||
`)}`}>
|
||||
<span>${Zi(t)}${t.manual?p` <small>· Zähler</small>`:""}</span><b>${Xe(this.hass,t)}${j(this.hass,t.sources,`${xr[t.kind]} \xB7 ${Zi(t)}`)}</b>
|
||||
<span>${Nt(t)}${t.manual?p` <small>· Zähler</small>`:""}</span><b>${De(this.hass,t)}${U(this.hass,t.sources,`${ze[t.kind]} \xB7 ${Nt(t)}`)}</b>
|
||||
</div>`)}
|
||||
</section>`)}`}static styles=X`
|
||||
</section>`)}`}static styles=Y`
|
||||
:host { display:block; color:var(--nf-text); font:inherit; }
|
||||
section { padding:10px 0; border-bottom:1px solid var(--nf-line,#ffffff20); }
|
||||
section:last-child { border:0; }
|
||||
@@ -256,12 +256,12 @@ ${t.sources.map(n=>this.hass.states[n]?.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",Yi);var Q=(r,e)=>[r[0]-e[0],r[1]-e[1]],ze=(r,e)=>[r[0]+e[0],r[1]+e[1]],we=(r,e)=>[r[0]*e,r[1]*e],le=(r,e)=>r[0]*e[0]+r[1]*e[1],Ce=(r,e)=>r[0]*e[1]-r[1]*e[0],We=r=>Math.hypot(r[0],r[1]),xe=r=>{let e=We(r)||1;return[r[0]/e,r[1]/e]},Ji=r=>[-r[1],r[0]],Qi=r=>[r[1],-r[0]];function tl(r){let e=r.heightEnd!==void 0;return{...r,a:r.b,b:r.a,left:r.right,right:r.left,roomLeft:r.roomRight,roomRight:r.roomLeft,height:e?r.heightEnd:r.height,heightEnd:e?r.height:void 0}}function Ih(r,e){let t=r.map(n=>({...n}));for(let n of e){let i=t.find(o=>o.room_id===n.room_id&&o.edge===n.edge&&(Math.abs(o.t1-n.t0)<1e-6||Math.abs(n.t1-o.t0)<1e-6));i?(i.t0=Math.min(i.t0,n.t0),i.t1=Math.max(i.t1,n.t1)):t.push({...n})}return t}function Nh(r,e,t){if(r.a===e.b)return!1;let n=xe(Q(t[r.b],t[r.a])),i=xe(Q(t[e.b],t[e.a]));return Math.abs(Ce(n,i))>1e-6||le(n,i)<=0||r.free||e.free||r.heightEnd!==void 0||e.heightEnd!==void 0?!1:r.height===e.height&&r.exterior===e.exterior&&r.roomLeft===e.roomLeft&&r.roomRight===e.roomRight&&Math.abs(r.left-e.left)<=1e-9&&Math.abs(r.right-e.right)<=1e-9}function nl(r,e,t=new Set){let n=r.slice();for(;;){let i=new Map;n.forEach((s,a)=>{for(let l of[s.a,s.b])i.set(l,[...i.get(l)??[],a])});let o=null;for(let[s,a]of i){if(a.length!==2||t.has(s))continue;let l=n[a[0]].b===s?n[a[0]]:tl(n[a[0]]),u=n[a[1]].a===s?n[a[1]]:tl(n[a[1]]);if(!Nh(l,u,e))continue;let c={...l,b:u.b,sources:Ih(l.sources,u.sources)};o=[...n.filter((d,m)=>m!==a[0]&&m!==a[1]),c];break}if(!o)return n;n=o}}function rl(r,e){let t=new Map;r.forEach((i,o)=>{let s=xe(Q(e[i.b],e[i.a])),a=[[i.a,{key:`${o}:a`,d:s,left:i.left,right:i.right,angle:Math.atan2(s[1],s[0])}],[i.b,{key:`${o}:b`,d:we(s,-1),left:i.right,right:i.left,angle:Math.atan2(-s[1],-s[0])}]];for(let[l,u]of a)t.set(l,[...t.get(l)??[],u])});let n=new Map;for(let[i,o]of t){let s=e[i];o.sort((l,u)=>l.angle-u.angle);for(let l of o)n.set(l.key,{left:ze(s,we(Ji(l.d),l.left)),right:ze(s,we(Qi(l.d),l.right))});if(o.length<2)continue;let a=4*Math.max(...o.map(l=>Math.max(l.left,l.right)))+1e-9;o.forEach((l,u)=>{let c=o[(u+1)%o.length],d=ze(s,we(Ji(l.d),l.left)),m=ze(s,we(Qi(c.d),c.right)),h=Ce(l.d,c.d);if(Math.abs(h)<1e-4)return;let g=ze(d,we(l.d,Ce(Q(m,d),c.d)/h));We(Q(g,s))>a||(n.get(l.key).left=g,n.get(c.key).right=g)})}return n}function il(r,e){let t=r.filter((n,i)=>We(Q(n,r[(i+1)%r.length]))>e);for(;;){if(t.length<=3)return t;let n=t.findIndex((i,o)=>{let s=t[(o+t.length-1)%t.length],a=t[(o+1)%t.length],[l,u]=[Q(i,s),Q(a,i)];return Math.abs(Ce(xe(l),xe(u)))<1e-7&&le(l,u)>0});if(n===-1)return t;t=t.filter((i,o)=>o!==n)}}function Ch(r){let e=[];return{points:e,idOf(t){let n=e.findIndex(i=>Math.abs(i[0]-t[0])<=r&&Math.abs(i[1]-t[1])<=r);return n>=0?n:(e.push([t[0],t[1]]),e.length-1)}}}function Wh(r,e){let t=[];for(let n of r){let i=n.points;if(i.length<3||Math.abs(ct(i))<1e-6)continue;let o=ct(i)>0,s=i.map(a=>e.idOf(a));s.forEach((a,l)=>{let u=s[(l+1)%s.length];a!==u&&t.push(o?{u:a,v:u,room:n.id,edge:l,forward:!0}:{u,v:a,room:n.id,edge:l,forward:!1})})}return t}function Lh(r,e,t){let n=[];for(let i of r){let[o,s]=[e[i.u],e[i.v]],a=Q(s,o),l=We(a),u=we(a,1/l),c=e.map((m,h)=>({id:h,rel:Q(m,o)})).filter(({id:m,rel:h})=>m!==i.u&&m!==i.v&&le(h,u)>t&&le(h,u)<l-t&&Math.abs(Ce(u,h))<=t).map(({id:m,rel:h})=>({t:le(h,u),id:m})).sort((m,h)=>m.t-h.t),d=[{t:0,id:i.u},...c,{t:l,id:i.v}];for(let m=0;m+1<d.length;m++){let[h,g]=[d[m],d[m+1]];n.push({u:h.id,v:g.id,room:i.room,edge:i.edge,t0:i.forward?h.t:l-g.t,t1:i.forward?g.t:l-h.t,forward:i.forward})}}return n}var ol=r=>({room_id:r.room,edge:r.edge,t0:r.t0,t1:r.t1});function Oh(r,e){let t=new Map(r.map(a=>[a.id,a])),n=new Map;for(let a of e){let l=`${a.room}:${a.edge}`;n.set(l,[...n.get(l)??[],a.t0].sort((u,c)=>u-c))}let i=a=>{let l=t.get(a.room)?.wall_heights?.[a.edge];return Array.isArray(l)?l[(n.get(`${a.room}:${a.edge}`)??[]).indexOf(a.t0)]??null:l},o=a=>{let l=t.get(a.room),[u,c]=[l?.wall_heights?.[a.edge],l?.wall_slopes?.[a.edge]];if(!l||typeof u!="number"||typeof c!="number"||u<=0||c<=0)return null;let[d,m]=[l.points[a.edge],l.points[(a.edge+1)%l.points.length]];return{from:u,to:c,length:Math.hypot(m[0]-d[0],m[1]-d[1])}},s=a=>{let l=o(a);if(!l||l.length<1e-9){let c=i(a);return typeof c=="number"&&c>0?[c,c]:[null,null]}let u=c=>l.from+(l.to-l.from)*c/l.length;return a.forward?[u(a.t0),u(a.t1)]:[u(a.t1),u(a.t0)]};return{heightsOf(a){let[l,u]=[1/0,1/0];for(let d of a){let[m,h]=s(d),[g,_]=d===a[0]?[m,h]:[h,m];g!==null&&(l=Math.min(l,g)),_!==null&&(u=Math.min(u,_))}let c=a.map(d=>t.get(d.room)?.ceiling);if(c.every(d=>typeof d=="number"&&d>0)){let d=Math.max(...c);l===1/0&&(l=d),u===1/0&&(u=d)}return{...l<1/0?{a:l}:{},...u<1/0?{b:u}:{}}},thicknessOf(a){let l=a.map(u=>{let c=t.get(u.room)?.wall_thickness?.[u.edge];return Array.isArray(c)?c[(n.get(`${u.room}:${u.edge}`)??[]).indexOf(u.t0)]:c}).filter(u=>typeof u=="number"&&u>0);return l.length?Math.max(...l):void 0},hasNoWall:a=>a.som
Line truncated
|
||||
<path d=${gr(r)} />
|
||||
</svg>`,zr={previous:"M6 6h2v12H6zM20 6v12l-10-6z",play:"M8 5v14l11-7z",pause:"M7 5h4v14H7zM13 5h4v14h-4z",next:"M16 6h2v12h-2zM4 6v12l10-6z"},io=r=>p`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d=${r} /></svg>`,Em=24,Rm=10,oo=class extends ee{static properties={hass:{attribute:!1},room:{attribute:!1},floor:{attribute:!1},confirmEntities:{attribute:!1},phrases:{attribute:!1},outside:{attribute:!1},_showAll:{state:!0},_said:{state:!0},_folded:{state:!0},_curve:{state:!0},_moodName:{state:!0},_undo:{state:!0},_energy:{state:!0},_sunYear:{state:!0},rooms:{attribute:!1},building:{attribute:!1}};saidTimer;memo=null;curveFor="";undoTimer;constructor(){super(),this.room=null,this.floor=null,this.phrases=null,this.outside=null,this._said=null,this._showAll=!1,this._folded=!1,this._curve=null,this._moodName=null,this._undo=null,this._energy=null,this._sunYear=!1,this.rooms=null,this.building=null}fireMoods(e,t){this.dispatchEvent(new CustomEvent("mood-change",{detail:{roomId:e.id,moods:t},bubbles:!0,composed:!0}))}runMood(e){for(let t of Rr(e))this.call("light",t.service,t.data)}renderMoods(e,t){let n=e.moods??[],i=!!this.rooms&&!!this.hass.user?.is_admin;if(!n.length&&!i)return f;let o=(this.rooms??[]).filter(l=>l.id!==e.id&&l.area_id),s=l=>K(this.hass,l).filter(u=>u.startsWith("light.")),a=()=>{let l=(this._moodName??"").trim()||this.t("mood_new");this.fireMoods(e,[...n,{id:`mood_${Date.now().toString(36)}`,name:l,lights:t.map(Er)}]),this._moodName=null};return p`<div class="nf-rp-moods">
|
||||
`};customElements.get("nf-utility-report")||customElements.define("nf-utility-report",Qi);var ee=(r,e)=>[r[0]-e[0],r[1]-e[1]],Fe=(r,e)=>[r[0]+e[0],r[1]+e[1]],we=(r,e)=>[r[0]*e,r[1]*e],le=(r,e)=>r[0]*e[0]+r[1]*e[1],Oe=(r,e)=>r[0]*e[1]-r[1]*e[0],Be=r=>Math.hypot(r[0],r[1]),xe=r=>{let e=Be(r)||1;return[r[0]/e,r[1]/e]},Xi=r=>[-r[1],r[0]],eo=r=>[r[1],-r[0]];function rl(r){let e=r.heightEnd!==void 0;return{...r,a:r.b,b:r.a,left:r.right,right:r.left,roomLeft:r.roomRight,roomRight:r.roomLeft,height:e?r.heightEnd:r.height,heightEnd:e?r.height:void 0}}function Ch(r,e){let t=r.map(n=>({...n}));for(let n of e){let i=t.find(o=>o.room_id===n.room_id&&o.edge===n.edge&&(Math.abs(o.t1-n.t0)<1e-6||Math.abs(n.t1-o.t0)<1e-6));i?(i.t0=Math.min(i.t0,n.t0),i.t1=Math.max(i.t1,n.t1)):t.push({...n})}return t}function Wh(r,e,t){if(r.a===e.b)return!1;let n=xe(ee(t[r.b],t[r.a])),i=xe(ee(t[e.b],t[e.a]));return Math.abs(Oe(n,i))>1e-6||le(n,i)<=0||r.free||e.free||r.heightEnd!==void 0||e.heightEnd!==void 0?!1:r.height===e.height&&r.exterior===e.exterior&&r.roomLeft===e.roomLeft&&r.roomRight===e.roomRight&&Math.abs(r.left-e.left)<=1e-9&&Math.abs(r.right-e.right)<=1e-9}function il(r,e,t=new Set){let n=r.slice();for(;;){let i=new Map;n.forEach((s,a)=>{for(let l of[s.a,s.b])i.set(l,[...i.get(l)??[],a])});let o=null;for(let[s,a]of i){if(a.length!==2||t.has(s))continue;let l=n[a[0]].b===s?n[a[0]]:rl(n[a[0]]),u=n[a[1]].a===s?n[a[1]]:rl(n[a[1]]);if(!Wh(l,u,e))continue;let c={...l,b:u.b,sources:Ch(l.sources,u.sources)};o=[...n.filter((d,m)=>m!==a[0]&&m!==a[1]),c];break}if(!o)return n;n=o}}function ol(r,e){let t=new Map;r.forEach((i,o)=>{let s=xe(ee(e[i.b],e[i.a])),a=[[i.a,{key:`${o}:a`,d:s,left:i.left,right:i.right,angle:Math.atan2(s[1],s[0])}],[i.b,{key:`${o}:b`,d:we(s,-1),left:i.right,right:i.left,angle:Math.atan2(-s[1],-s[0])}]];for(let[l,u]of a)t.set(l,[...t.get(l)??[],u])});let n=new Map;for(let[i,o]of t){let s=e[i];o.sort((l,u)=>l.angle-u.angle);for(let l of o)n.set(l.key,{left:Fe(s,we(Xi(l.d),l.left)),right:Fe(s,we(eo(l.d),l.right))});if(o.length<2)continue;let a=4*Math.max(...o.map(l=>Math.max(l.left,l.right)))+1e-9;o.forEach((l,u)=>{let c=o[(u+1)%o.length],d=Fe(s,we(Xi(l.d),l.left)),m=Fe(s,we(eo(c.d),c.right)),h=Oe(l.d,c.d);if(Math.abs(h)<1e-4)return;let g=Fe(d,we(l.d,Oe(ee(m,d),c.d)/h));Be(ee(g,s))>a||(n.get(l.key).left=g,n.get(c.key).right=g)})}return n}function sl(r,e){let t=r.filter((n,i)=>Be(ee(n,r[(i+1)%r.length]))>e);for(;;){if(t.length<=3)return t;let n=t.findIndex((i,o)=>{let s=t[(o+t.length-1)%t.length],a=t[(o+1)%t.length],[l,u]=[ee(i,s),ee(a,i)];return Math.abs(Oe(xe(l),xe(u)))<1e-7&&le(l,u)>0});if(n===-1)return t;t=t.filter((i,o)=>o!==n)}}function Lh(r){let e=[];return{points:e,idOf(t){let n=e.findIndex(i=>Math.abs(i[0]-t[0])<=r&&Math.abs(i[1]-t[1])<=r);return n>=0?n:(e.push([t[0],t[1]]),e.length-1)}}}function Oh(r,e){let t=[];for(let n of r){let i=n.points;if(i.length<3||Math.abs(pt(i))<1e-6)continue;let o=pt(i)>0,s=i.map(a=>e.idOf(a));s.forEach((a,l)=>{let u=s[(l+1)%s.length];a!==u&&t.push(o?{u:a,v:u,room:n.id,edge:l,forward:!0}:{u,v:a,room:n.id,edge:l,forward:!1})})}return t}function Bh(r,e,t){let n=[];for(let i of r){let[o,s]=[e[i.u],e[i.v]],a=ee(s,o),l=Be(a),u=we(a,1/l),c=e.map((m,h)=>({id:h,rel:ee(m,o)})).filter(({id:m,rel:h})=>m!==i.u&&m!==i.v&&le(h,u)>t&&le(h,u)<l-t&&Math.abs(Oe(u,h))<=t).map(({id:m,rel:h})=>({t:le(h,u),id:m})).sort((m,h)=>m.t-h.t),d=[{t:0,id:i.u},...c,{t:l,id:i.v}];for(let m=0;m+1<d.length;m++){let[h,g]=[d[m],d[m+1]];n.push({u:h.id,v:g.id,room:i.room,edge:i.edge,t0:i.forward?h.t:l-g.t,t1:i.forward?g.t:l-h.t,forward:i.forward})}}return n}var al=r=>({room_id:r.room,edge:r.edge,t0:r.t0,t1:r.t1});function Vh(r,e){let t=new Map(r.map(a=>[a.id,a])),n=new Map;for(let a of e){let l=`${a.room}:${a.edge}`;n.set(l,[...n.get(l)??[],a.t0].sort((u,c)=>u-c))}let i=a=>{let l=t.get(a.room)?.wall_heights?.[a.edge];return Array.isArray(l)?l[(n.get(`${a.room}:${a.edge}`)??[]).indexOf(a.t0)]??null:l},o=a=>{let l=t.get(a.room),[u,c]=[l?.wall_heights?.[a.edge],l?.wall_slopes?.[a.edge]];if(!l||typeof u!="number"||typeof c!="number"||u<=0||c<=0)return null;let[d,m]=[l.points[a.edge],l.points[(a.edge+1)%l.points.length]];return{from:u,to:c,length:Math.hypot(m[0]-d[0],m[1]-d[1])}},s=a=>{let l=o(a);if(!l||l.length<1e-9){let c=i(a);return typeof c=="number"&&c>0?[c,c]:[null,null]}let u=c=>l.from+(l.to-l.from)*c/l.length;return a.forward?[u(a.t0),u(a.t1)]:[u(a.t1),u(a.t0)]};return{heightsOf(a){let[l,u]=[1/0,1/0];for(let d of a){let[m,h]=s(d),[g,_]=d===a[0]?[m,h]:[h,m];g!==null&&(l=Math.min(l,g)),_!==null&&(u=Math.min(u,_))}let c=a.map(d=>t.get(d.room)?.ceiling);if(c.every(d=>typeof d=="number"&&d>0)){let d=Math.max(...c);l===1/0&&(l=d),u===1/0&&(u=d)}return{...l<1/0?{a:l}:{},...u<1/0?{b:u}:{}}},thicknessOf(a){let l=a.map(u=>{let c=t.get(u.room)?.wall_thickness?.[u.edge];return Array.isArray(c)?c[(n.get(`${u.room}:${u.edge}`)??[]).indexOf(u.t0)]:c}).filter(u=>typeof u=="number"&&u>0);return l.length?Math.max(...l):void 0},hasNoWa
Line truncated
|
||||
<path d=${vr(r)} />
|
||||
</svg>`,Dr={previous:"M6 6h2v12H6zM20 6v12l-10-6z",play:"M8 5v14l11-7z",pause:"M7 5h4v14H7zM13 5h4v14h-4z",next:"M16 6h2v12h-2zM4 6v12l10-6z"},so=r=>p`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d=${r} /></svg>`,zm=24,Tm=10,ao=class extends Q{static properties={hass:{attribute:!1},room:{attribute:!1},floor:{attribute:!1},confirmEntities:{attribute:!1},phrases:{attribute:!1},outside:{attribute:!1},_showAll:{state:!0},_said:{state:!0},_folded:{state:!0},_curve:{state:!0},_moodName:{state:!0},_undo:{state:!0},_energy:{state:!0},_sunYear:{state:!0},rooms:{attribute:!1},building:{attribute:!1}};saidTimer;memo=null;curveFor="";undoTimer;constructor(){super(),this.room=null,this.floor=null,this.phrases=null,this.outside=null,this._said=null,this._showAll=!1,this._folded=!1,this._curve=null,this._moodName=null,this._undo=null,this._energy=null,this._sunYear=!1,this.rooms=null,this.building=null}fireMoods(e,t){this.dispatchEvent(new CustomEvent("mood-change",{detail:{roomId:e.id,moods:t},bubbles:!0,composed:!0}))}runMood(e){for(let t of Tr(e))this.call("light",t.service,t.data)}renderMoods(e,t){let n=e.moods??[],i=!!this.rooms&&!!this.hass.user?.is_admin;if(!n.length&&!i)return f;let o=(this.rooms??[]).filter(l=>l.id!==e.id&&l.area_id),s=l=>G(this.hass,l).filter(u=>u.startsWith("light.")),a=()=>{let l=(this._moodName??"").trim()||this.t("mood_new");this.fireMoods(e,[...n,{id:`mood_${Date.now().toString(36)}`,name:l,lights:t.map(zr)}]),this._moodName=null};return p`<div class="nf-rp-moods">
|
||||
${n.map(l=>p`<span class="nf-rp-mood">
|
||||
<button class="nf-btn" title=${this.t("mood_set")} @click=${()=>this.runMood(l.lights)}>✨ ${l.name}</button>
|
||||
${o.length?p`<select class="nf-rp-mood-to" aria-label=${this.t("mood_carry")} title=${this.t("mood_carry")} @change=${u=>{let c=u.target,d=o.find(m=>m.id===c.value);c.value="",d&&this.runMood(Wl(l,s(d)))}}>
|
||||
${o.length?p`<select class="nf-rp-mood-to" aria-label=${this.t("mood_carry")} title=${this.t("mood_carry")} @change=${u=>{let c=u.target,d=o.find(m=>m.id===c.value);c.value="",d&&this.runMood(Ol(l,s(d)))}}>
|
||||
<option value="">→</option>
|
||||
${o.map(u=>p`<option value=${u.id}>${u.name}</option>`)}
|
||||
</select>`:f}
|
||||
@@ -271,33 +271,33 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
><input type="text" maxlength="40" placeholder=${this.t("mood_new")} .value=${this._moodName} @input=${l=>this._moodName=l.target.value} @keydown=${l=>l.key==="Enter"&&a()} />
|
||||
<button class="nf-btn" @click=${a}>${this.t("mood_save")}</button></span
|
||||
>`:f}
|
||||
</div>`}async loadCurve(e){let t=fe(this.hass,this.floor,e,"temperature"),n=t.length?t:K(this.hass,e).filter(s=>s.startsWith("climate."));if(!n.length)return;let i=Date.now(),o=i-24*36e5;try{let s=await vn(this.hass,n,o,i,!!t.length);if(this.room?.id!==e.id)return;let a=[];for(let l=1;l<=96;l++){let u=Nt(this.hass,s,o+(i-o)*l/96),c=n.map(d=>d.startsWith("climate.")?Number(u.states[d]?.attributes.current_temperature):Number(u.states[d]?.state)).filter(Number.isFinite);a.push(c.length?c.reduce((d,m)=>d+m,0)/c.length:null)}this._curve=a.some(l=>l!==null)?a:null}catch{this._curve=null}}async loadEnergy(e){if(!this.floor||!this.building)return;if(G(this.hass)){this._energy=null;return}let t=no(this.hass,this.building,this.floor,e);try{let n=await zl(this.hass,t);this.room?.id===e.id&&(this._energy=n)}catch{this._energy=null}}renderEmptyLights(e,t){if(!t.length||!this.room)return f;let n=K(this.hass,e).map(s=>this.hass.states[s]).filter(s=>!!s&&s.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(s.attributes.device_class)));if(!n.length||n.some(s=>s.state!=="off"))return f;let i=Math.max(...n.map(s=>Date.parse(String(s.last_changed??""))||0)),o=Math.floor((Date.now()-i)/6e4);return!i||o<Rm?f:p`<div class="nf-rp-shade">
|
||||
</div>`}async loadCurve(e){let t=fe(this.hass,this.floor,e,"temperature"),n=t.length?t:G(this.hass,e).filter(s=>s.startsWith("climate."));if(!n.length)return;let i=Date.now(),o=i-24*36e5;try{let s=await xn(this.hass,n,o,i,!!t.length);if(this.room?.id!==e.id)return;let a=[];for(let l=1;l<=96;l++){let u=Ot(this.hass,s,o+(i-o)*l/96),c=n.map(d=>d.startsWith("climate.")?Number(u.states[d]?.attributes.current_temperature):Number(u.states[d]?.state)).filter(Number.isFinite);a.push(c.length?c.reduce((d,m)=>d+m,0)/c.length:null)}this._curve=a.some(l=>l!==null)?a:null}catch{this._curve=null}}async loadEnergy(e){if(!this.floor||!this.building)return;if(K(this.hass)){this._energy=null;return}let t=io(this.hass,this.building,this.floor,e);try{let n=await Dl(this.hass,t);this.room?.id===e.id&&(this._energy=n)}catch{this._energy=null}}renderEmptyLights(e,t){if(!t.length||!this.room)return f;let n=G(this.hass,e).map(s=>this.hass.states[s]).filter(s=>!!s&&s.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(s.attributes.device_class)));if(!n.length||n.some(s=>s.state!=="off"))return f;let i=Math.max(...n.map(s=>Date.parse(String(s.last_changed??""))||0)),o=Math.floor((Date.now()-i)/6e4);return!i||o<Tm?f:p`<div class="nf-rp-shade">
|
||||
<span>💡 ${this.t("empty_lights_hint",{n:t.length,min:o})}</span>
|
||||
<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_off",{entity_id:t.map(s=>s.entity_id)})}>${this.t("empty_lights_off")}</button>
|
||||
</div>`}renderOpenWhileHeating(e){let t=this.room;if(!t||!this.floor)return f;let n=e.filter(a=>a.attributes.hvac_action==="heating"||a.state==="heat"&&a.attributes.hvac_action===void 0);if(!n.length)return f;let i=a=>!!a&&a!=="none"&&this.hass.states[a]?.state==="on",o=this.floor.openings.filter(a=>a.room_id===t.id&&[a.contact,a.contact2,a.tilt,a.tilt2].some(i));if(!o.length)return f;let s=()=>{for(let a of n)(a.attributes.hvac_modes??[]).includes("off")?this.call("climate","set_hvac_mode",{entity_id:a.entity_id,hvac_mode:"off"}):typeof a.attributes.min_temp=="number"&&this.call("climate","set_temperature",{entity_id:a.entity_id,temperature:a.attributes.min_temp})};return p`<div class="nf-rp-shade nf-rp-open-heat">
|
||||
<span>🪟 ${this.t("open_heating_hint",{n:o.length})}</span>
|
||||
<button class="nf-btn nf-rp-small" @click=${s}>${this.t("open_heating_off")}</button>
|
||||
</div>`}renderShade(){let e=this.room,{latitude:t,longitude:n}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||n===void 0)return f;let i=q(this.hass,this.floor,e,"temperature");if(i===null||i<Em)return f;let o=a=>{let l=a&&a!=="none"?this.hass.states[a]:void 0;if(!l||N(l))return!1;let u=l.attributes.current_position;return typeof u=="number"?u>30:l.state==="open"},s=[...new Set(kl(this.building,this.floor,e,{latitude:t,longitude:n}).flatMap(a=>[a.cover,a.cover2].filter(o)))];return s.length?p`<div class="nf-rp-shade">
|
||||
</div>`}renderShade(){let e=this.room,{latitude:t,longitude:n}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||n===void 0)return f;let i=q(this.hass,this.floor,e,"temperature");if(i===null||i<zm)return f;let o=a=>{let l=a&&a!=="none"?this.hass.states[a]:void 0;if(!l||N(l))return!1;let u=l.attributes.current_position;return typeof u=="number"?u>30:l.state==="open"},s=[...new Set($l(this.building,this.floor,e,{latitude:t,longitude:n}).flatMap(a=>[a.cover,a.cover2].filter(o)))];return s.length?p`<div class="nf-rp-shade">
|
||||
<span>☀ ${this.t("shade_hint",{n:s.length,temp:`${W(this.hass,ae(this.hass,i),1)} ${re(this.hass)}`})}</span>
|
||||
<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:s})}>${this.t("shade_close")}</button>
|
||||
</div>`:f}renderSunYear(){let e=this.room,{latitude:t,longitude:n}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||n===void 0)return f;let i={latitude:t,longitude:n};if(!Pt(this.building,this.floor,e,{...i,zone:this.hass.config?.time_zone}).facing.length)return f;let s=p`<button class="nf-rp-sun-year" aria-expanded=${this._sunYear} title=${this.t("room_sun_year_hint")} @click=${()=>this._sunYear=!this._sunYear}>
|
||||
</div>`:f}renderSunYear(){let e=this.room,{latitude:t,longitude:n}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||n===void 0)return f;let i={latitude:t,longitude:n};if(!Wt(this.building,this.floor,e,{...i,zone:this.hass.config?.time_zone}).facing.length)return f;let s=p`<button class="nf-rp-sun-year" aria-expanded=${this._sunYear} title=${this.t("room_sun_year_hint")} @click=${()=>this._sunYear=!this._sunYear}>
|
||||
☀ ${this.t("room_sun_year")}
|
||||
</button>`;if(!this._sunYear)return s;let a=xl(this.building,this.floor,e,i),l=Math.max(1,...a),u=Array.from({length:12},(c,d)=>new Date(2026,d,15).toLocaleDateString(this.hass.language,{month:"narrow"}));return p`${s}
|
||||
</button>`;if(!this._sunYear)return s;let a=Sl(this.building,this.floor,e,i),l=Math.max(1,...a),u=Array.from({length:12},(c,d)=>new Date(2026,d,15).toLocaleDateString(this.hass.language,{month:"narrow"}));return p`${s}
|
||||
<div class="nf-rp-sun-bars" role="img" aria-label=${a.map((c,d)=>`${u[d]} ${W(this.hass,c,1)} h`).join(", ")}>
|
||||
${a.map((c,d)=>p`<span title=${`${W(this.hass,c,1)} h`}><i style=${`height:${Math.round(c/l*100)}%`}></i><b>${u[d]}</b></span>`)}
|
||||
</div>`}renderEnergy(){let e=this._energy;if(!e||e.month<=0)return f;let t=this.building?.energy.tariff,n=t?this.hass.states[t]:void 0,i=n?{value:Number(n.state),unit:String(n.attributes.unit_of_measurement??"")}:null,o=Tl(e.month,i),s=a=>`${W(this.hass,a,a<10?2:1)} kWh`;return p`<p class="nf-rp-facts nf-rp-energy" title=${this.t("room_energy_hint")}>
|
||||
</div>`}renderEnergy(){let e=this._energy;if(!e||e.month<=0)return f;let t=this.building?.energy.tariff,n=t?this.hass.states[t]:void 0,i=n?{value:Number(n.state),unit:String(n.attributes.unit_of_measurement??"")}:null,o=Fl(e.month,i),s=a=>`${W(this.hass,a,a<10?2:1)} kWh`;return p`<p class="nf-rp-facts nf-rp-energy" title=${this.t("room_energy_hint")}>
|
||||
⚡ ${this.t("room_energy",{today:s(e.today),month:s(e.month)})}${o?` \xB7 ${W(this.hass,o.value,2)} ${o.currency}`:""}
|
||||
</p>`}renderCurve(){let e=this._curve;if(!e)return f;let t=e.filter(u=>u!==null),n=Math.min(...t),i=Math.max(...t),o=Math.max(1,i-n),s=e.map(u=>u===null?null:u-n+o*.1),a=yn(s,220,36,o*1.2),l=u=>`${W(this.hass,ae(this.hass,u),1)}\xB0`;return p`<div class="nf-rp-curve" title=${this.t("room_curve_hint")}>
|
||||
</p>`}renderCurve(){let e=this._curve;if(!e)return f;let t=e.filter(u=>u!==null),n=Math.min(...t),i=Math.max(...t),o=Math.max(1,i-n),s=e.map(u=>u===null?null:u-n+o*.1),a=kn(s,220,36,o*1.2),l=u=>`${W(this.hass,ae(this.hass,u),1)}\xB0`;return p`<div class="nf-rp-curve" title=${this.t("room_curve_hint")}>
|
||||
<svg viewBox="0 0 220 36" preserveAspectRatio="none" aria-hidden="true">${ne`<path d=${a}></path>`}</svg>
|
||||
<span>24 h · ${l(n)} – ${l(i)}</span>
|
||||
</div>`}willUpdate(e){let t=e.get("room");e.has("room")&&t?.id!==this.room?.id&&(this._folded=!1,this._undo=null),this.room&&this.hass&&this.curveFor!==this.room.id&&(this.curveFor=this.room.id,this._curve=null,this._energy=null,this.loadCurve(this.room),this.loadEnergy(this.room))}updated(e){e.has("_folded")&&this.toggleAttribute("folded",this._folded)}t(e,t){return $(this.hass,e,t)}call(e,t,n){this.hass.callService(e,t,n)}renderClean(e){let t=e.clean_entity,n=t?this.hass.states[t]:void 0;if(!t||!n)return f;let i=t.slice(0,t.indexOf(".")),o=()=>i==="script"?this.call("script","turn_on",{entity_id:t}):this.call(i,"press",{entity_id:t});return p`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" ?disabled=${N(n)} title=${this.t("room_clean_run_hint")} @click=${o}>🧹 ${this.t("room_clean_run")}</button></div>`}allOff(e){let t=bn(e);for(let n of t.off)this.call(n.domain,n.service,n.data);this._undo=t.undo,clearTimeout(this.undoTimer),this.undoTimer=setTimeout(()=>this._undo=null,1e4)}undoAllOff(){for(let e of this._undo??[])this.call(e.domain,e.service,e.data);this._undo=null,clearTimeout(this.undoTimer)}renderAllOff(e){if(this._undo)return p`<div class="nf-rp-alloff"><span>${this.t("all_off_done")}</span><button class="nf-btn nf-rp-small" @click=${()=>this.undoAllOff()}>↶ ${this.t("all_off_undo")}</button></div>`;let{count:t}=bn(e);return t<2?f:p`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" title=${this.t("all_off_hint")} @click=${()=>this.allOff(e)}>⏻ ${this.t("all_off_n",{n:t})}</button></div>`}get areaName(){return this.room?.area_id?this.hass.areas?.[this.room.area_id]?.name:void 0}placedAs(e){for(let t of this.building?.floors??[])for(let n of t.placements)if(n.entity_id===e)return n}name(e){return this.placedAs(e)?.name?.trim()||L(this.hass,e,this.areaName)}nameButton(e){return p`<button class="nf-rp-name" title=${this.t("details")} @click=${()=>ye(this,e)}>${this.name(e)}</button>`}askFor(e){return!this.confirmEntities?.has(e)||confirm(this.t("confirm_switch",{name:this.name(e)}))}toggle(e,t,n){let i=()=>{this.confirmEntities?.has(e.entity_id)&&!confirm(this.t("confirm_switch",{name:this.name(e.entity_id)}))||n()};return p`<button
|
||||
</div>`}willUpdate(e){let t=e.get("room");e.has("room")&&t?.id!==this.room?.id&&(this._folded=!1,this._undo=null),this.room&&this.hass&&this.curveFor!==this.room.id&&(this.curveFor=this.room.id,this._curve=null,this._energy=null,this.loadCurve(this.room),this.loadEnergy(this.room))}updated(e){e.has("_folded")&&this.toggleAttribute("folded",this._folded)}t(e,t){return $(this.hass,e,t)}call(e,t,n){this.hass.callService(e,t,n)}renderClean(e){let t=e.clean_entity,n=t?this.hass.states[t]:void 0;if(!t||!n)return f;let i=t.slice(0,t.indexOf(".")),o=()=>i==="script"?this.call("script","turn_on",{entity_id:t}):this.call(i,"press",{entity_id:t});return p`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" ?disabled=${N(n)} title=${this.t("room_clean_run_hint")} @click=${o}>🧹 ${this.t("room_clean_run")}</button></div>`}allOff(e){let t=wn(e);for(let n of t.off)this.call(n.domain,n.service,n.data);this._undo=t.undo,clearTimeout(this.undoTimer),this.undoTimer=setTimeout(()=>this._undo=null,1e4)}undoAllOff(){for(let e of this._undo??[])this.call(e.domain,e.service,e.data);this._undo=null,clearTimeout(this.undoTimer)}renderAllOff(e){if(this._undo)return p`<div class="nf-rp-alloff"><span>${this.t("all_off_done")}</span><button class="nf-btn nf-rp-small" @click=${()=>this.undoAllOff()}>↶ ${this.t("all_off_undo")}</button></div>`;let{count:t}=wn(e);return t<2?f:p`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" title=${this.t("all_off_hint")} @click=${()=>this.allOff(e)}>⏻ ${this.t("all_off_n",{n:t})}</button></div>`}get areaName(){return this.room?.area_id?this.hass.areas?.[this.room.area_id]?.name:void 0}placedAs(e){for(let t of this.building?.floors??[])for(let n of t.placements)if(n.entity_id===e)return n}name(e){return this.placedAs(e)?.name?.trim()||L(this.hass,e,this.areaName)}nameButton(e){return p`<button class="nf-rp-name" title=${this.t("details")} @click=${()=>ye(this,e)}>${this.name(e)}</button>`}askFor(e){return!this.confirmEntities?.has(e)||confirm(this.t("confirm_switch",{name:this.name(e)}))}toggle(e,t,n){let i=()=>{this.confirmEntities?.has(e.entity_id)&&!confirm(this.t("confirm_switch",{name:this.name(e.entity_id)}))||n()};return p`<button
|
||||
class="nf-switch"
|
||||
role="switch"
|
||||
aria-checked=${t?"true":"false"}
|
||||
aria-label=${this.name(e.entity_id)}
|
||||
?disabled=${N(e)}
|
||||
@click=${i}
|
||||
></button>`}outsideRoom=null;render(){let e=!this.room&&this.outside?this.outside:null;e&&!this.outsideRoom&&(this.outsideRoom={id:"nf-outside",name:this.t("outside_area"),area_id:null,points:[],floor_material:"grass"});let t=this.room??(e?this.outsideRoom:null);if(!t||!this.hass)return f;let n=e??K(this.hass,t),i=this.memo,{shown:o,more:s}=e?{shown:e,more:[]}:i&&i.entities===this.hass.entities&&i.floor===this.floor&&i.room===t?i:this.memo={entities:this.hass.entities,floor:this.floor,room:t,...this.floor?pa(this.hass,this.floor,t):{shown:n,more:[]}},a=Ri(this.hass,s).map(R=>R.primary),l=a.length,u=[t.floor_heating,...Object.values(t.hvac??{}).flat()].filter(R=>!!R&&R!=="none"),c=new Set(u.map(R=>this.hass.states[R]?.attributes.symcon_id).filter(Boolean)),d=(this._showAll?[...o,...a]:o).filter(R=>!G(this.hass)||!c.has(this.hass.states[R]?.attributes.symcon_id)),m=R=>d.filter(F=>R.includes(H(F))).map(F=>this.hass.states[F]),h=m(["light"]),g=m(["cover"]),_=m(["climate"]),b=m(["media"]),v=m(["switch","fan","lock"]),S=m(["sensor","binary"]),k=m(["scene","script"]),M=this.facts(_),z=h.filter(R=>R.state==="on");return p`<section class="nf-rp" aria-label=${t.name}>
|
||||
></button>`}outsideRoom=null;render(){let e=!this.room&&this.outside?this.outside:null;e&&!this.outsideRoom&&(this.outsideRoom={id:"nf-outside",name:this.t("outside_area"),area_id:null,points:[],floor_material:"grass"});let t=this.room??(e?this.outsideRoom:null);if(!t||!this.hass)return f;let n=e??G(this.hass,t),i=this.memo,{shown:o,more:s}=e?{shown:e,more:[]}:i&&i.entities===this.hass.entities&&i.floor===this.floor&&i.room===t?i:this.memo={entities:this.hass.entities,floor:this.floor,room:t,...this.floor?_a(this.hass,this.floor,t):{shown:n,more:[]}},a=Ti(this.hass,s).map(R=>R.primary),l=a.length,u=[t.floor_heating,...Object.values(t.hvac??{}).flat()].filter(R=>!!R&&R!=="none"),c=new Set(u.map(R=>this.hass.states[R]?.attributes.symcon_id).filter(Boolean)),d=(this._showAll?[...o,...a]:o).filter(R=>!K(this.hass)||!c.has(this.hass.states[R]?.attributes.symcon_id)),m=R=>d.filter(F=>R.includes(H(F))).map(F=>this.hass.states[F]),h=m(["light"]),g=m(["cover"]),_=m(["climate"]),b=m(["media"]),v=m(["switch","fan","lock"]),S=m(["sensor","binary"]),k=m(["scene","script"]),M=this.facts(_),z=h.filter(R=>R.state==="on");return p`<section class="nf-rp" aria-label=${t.name}>
|
||||
<header class="nf-rp-head">
|
||||
<div>
|
||||
<h2>${t.name}</h2>
|
||||
@@ -313,10 +313,10 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
</button>
|
||||
</header>
|
||||
<div class="nf-rp-body" ?hidden=${this._folded}>
|
||||
<nf-utility-report .hass=${this.hass} .readings=${Ft(this.hass,t,this.building?.floors.flatMap(R=>R.rooms))}></nf-utility-report>
|
||||
<nf-utility-report .hass=${this.hass} .readings=${rt(this.hass,t,this.building?.floors.flatMap(R=>R.rooms))}></nf-utility-report>
|
||||
${this.renderAllOff([...h,...b,...v])}
|
||||
${this.renderClean(t)}
|
||||
${!t.area_id&&!e&&!(G(this.hass)&&u.length)?p`<p class="nf-rp-note">${this.t("panel_no_area")}</p>`:!d.length&&!(G(this.hass)&&u.length)?p`<p class="nf-rp-note">${this.t("panel_empty")}</p>`:f}
|
||||
${!t.area_id&&!e&&!(K(this.hass)&&u.length)?p`<p class="nf-rp-note">${this.t("panel_no_area")}</p>`:!d.length&&!(K(this.hass)&&u.length)?p`<p class="nf-rp-note">${this.t("panel_empty")}</p>`:f}
|
||||
${k.length?this.section("panel_scenes",[p`<div class="nf-rp-scenes">
|
||||
${k.map(R=>p`<button
|
||||
class="nf-btn"
|
||||
@@ -331,38 +331,38 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
</button>`:f}${z.length?p`<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_off",{entity_id:z.map(R=>R.entity_id)})}>
|
||||
${this.t("panel_all_off")}
|
||||
</button>`:f}`):f}
|
||||
${g.length?this.section("panel_covers",g.map(R=>this.coverRow(R)),g.length>1&&nr(g,this.confirmEntities).length?p`<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","open_cover",{entity_id:nr(g,this.confirmEntities)})}>
|
||||
${g.length?this.section("panel_covers",g.map(R=>this.coverRow(R)),g.length>1&&or(g,this.confirmEntities).length?p`<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","open_cover",{entity_id:or(g,this.confirmEntities)})}>
|
||||
${this.t("panel_all_open")}</button
|
||||
><button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:nr(g,this.confirmEntities)})}>
|
||||
><button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:or(g,this.confirmEntities)})}>
|
||||
${this.t("panel_all_close")}
|
||||
</button>`:f):f}
|
||||
${G(this.hass)?p`<nf-room-hvac .hass=${this.hass} .room=${t}></nf-room-hvac>`:f}
|
||||
${K(this.hass)?p`<nf-room-hvac .hass=${this.hass} .room=${t}></nf-room-hvac>`:f}
|
||||
${_.length?this.section("panel_climate",_.map(R=>this.climateRow(R))):f}
|
||||
${b.length?this.section("panel_media",b.map(R=>this.mediaRow(R))):f}
|
||||
${v.length?this.section("panel_switches",v.map(R=>this.switchRow(R))):f}
|
||||
${S.length?this.section("panel_sensors",S.map(R=>this.sensorRow(R))):f}
|
||||
${this.extraValues(t)}
|
||||
${!G(this.hass)&&Va(this.hass)&&Ba(this.hass,this.floor,t)?this.announceSection(t):f}
|
||||
${!K(this.hass)&&Ua(this.hass)&&Ga(this.hass,this.floor,t)?this.announceSection(t):f}
|
||||
${this.pluginSections(t,d)}
|
||||
${l?p`<button class="nf-btn nf-rp-small nf-rp-more" @click=${()=>this._showAll=!this._showAll}>
|
||||
${this._showAll?this.t("panel_less"):this.t("panel_more",{n:l})}
|
||||
</button>`:f}
|
||||
</div>
|
||||
</section>`}extraValues(e){if(!this.floor)return f;let t=[...this.floor.placements.filter(n=>!n.outside&&I([n.x,n.z],e.points)).map(n=>({name:n.name||L(this.hass,n.entity_id),rows:_r(this.hass,n.values)})),...this.floor.furniture.filter(n=>I([n.x,n.z],e.points)).map(n=>({name:n.name||(n.entity&&n.entity!=="none"?L(this.hass,n.entity):this.t("device")),rows:_r(this.hass,n.values)}))].filter(n=>n.rows.length);return t.length?this.section("device_values",t.map(n=>p`<div class="nf-extra-values"><b>${n.name}</b>${n.rows.map(i=>p`<div class="nf-rp-row"><span class="nf-rp-icon">${i.icon}</span><span class="nf-rp-name">${i.label}</span><b class="nf-rp-state">${i.text}${j(this.hass,[i.entity],i.label)}</b></div>`)}</div>`)):f}facts(e){let t=[],n=this.room;if(!n)return t;let i=(T,E)=>{let A=q(this.hass,this.floor,n,T);if(A===null)return null;if(T==="temperature")return`${W(this.hass,ae(this.hass,A),1)} ${re(this.hass)}`;let P=fe(this.hass,this.floor,n,T)[0],C=this.hass.states[P]?.attributes.unit_of_measurement??E;return`${W(this.hass,A,1)} ${C}`},o=e.find(T=>typeof T.attributes.current_temperature=="number"),s=i("temperature","\xB0C");s?t.push(p`${s}${j(this.hass,fe(this.hass,this.floor,n,"temperature"),"Temperatur")}`):o&&n.climate?.temperature!=="none"&&t.push(p`${W(this.hass,o.attributes.current_temperature,1)} ${re(this.hass)}${j(this.hass,[o.entity_id],"Temperatur")}`);let a=i("humidity","%");a&&t.push(p`${a}${j(this.hass,fe(this.hass,this.floor,n,"humidity"),"Luftfeuchte")}`);let l=q(this.hass,this.floor??null,n,"illuminance");l!==null&&t.push(p`☀ ${W(this.hass,l,0)} lx${j(this.hass,fe(this.hass,this.floor,n,"illuminance"),"Helligkeit")}`);let u=Ft(this.hass,n,this.building?.floors.flatMap(T=>T.rooms)).find(T=>T.kind==="electricity"&&T.metric==="power"&&T.unit==="W"),c=!u&&this.floor&&this.building?to(this.hass,this.building,this.floor,n):null;u?t.push(p`⚡ ${Xe(this.hass,u)}${j(this.hass,u.sources,"Leistung")}`):c!==null&&t.push(`\u26A1 ${ft(this.hass,c)}`);let d=this.floor?this.floor.openings.filter(T=>T.room_id===n.id).flatMap(T=>[T.contact,T.contact2,T.tilt,T.tilt2]).map(T=>T&&T!=="none"?this.hass.states[T]:void 0).filter(T=>T?.state==="on").map(T=>Date.parse(String(T.last_changed??""))).filter(Number.isFinite):[];d.length&&t.push(`\u{1FA9F} ${this.t("open_since",{time:ro(Date.now()-Math.min(...d))})}`);let m=K(this.hass,n).map(T=>this.hass.states[T]).filter(T=>!!T&&T.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(T.attributes.device_class)));if(m.length)if(m.some(T=>T.state==="on"))t.push(`\u{1F6B6} ${this.t("presence_now")}`);else{let T=Math.max(...m.map(E=>Date.parse(String(E.last_changed??""))||0));T>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:ro(Date.now()-T)})}`)}let h=this.building?Hl(this.hass,this.building).filter(T=>T.roomId===n.id&&T.level<Fl):[];h.length&&t.push(`\u{1FAAB} ${this.t("battery_low_n",{n:h.length,names:h.map(T=>`${this.name(T.entity)} ${Math.round(T.level)} %`).join(", ")})}`);let g=(this.building?.settings.circuits??[]).filter(T=>T.rooms.includes(n.id)).map(T=>T.name),_=this.building?.settings.room_facts_off??[];g.length&&!_.includes("circuits")&&t.push(`\u{1F50C} ${g.join(", ")}`);let{latitude:b,longitude:v,time_zone:S}=this.hass.config??{};if(this.floor&&b!==void 0&&v!==void 0&&this.building&&!_.includes("sun")){let T=Pt(this.building,this.floor,n,{latitude:b,longitude:v,zone:S});T.facing.length&&t.push(`\u2600 ${this.t("room_sun_hours",{h:W(this.hass,T.hours,1),facing:T.facing.join(", ")})}`)}let k=q(this.hass,this.floor,n,"temperature"),M=q(this.hass,this.floor,n,"humidity"),z=$r(q(this.hass,this.floor,n,"co2"),M,It(k,M));z&&!_.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${z}`)}`);let R=Mr(k,M,q(this.hass,this.floor,n,"co2"),pt(new Date,this.hass.config?.latitude)),F=n.hvac?.status;return F&&F!=="none"?t.push(p`${Qe(this.hass.states[F])}${j(this.hass,[F],"Raumstatus")}`):R!==null&&(k!==null||M!==null)&&!_.includes("comfort")&&t.push(`\u{1F60A} ${this.t("comfort_n",{n:R})}`),t}announceSection(e){let t=this.phrases?.length?this.phrases:[1,2,3,4,5].map(o=>this.t(`announce_phrase_${o}`)),n=o=>{let s=o.trim();s&&(clearTimeout(this.saidTimer),this.hass.callService("nextfloor","announce",{message:s,rooms:[e.id],on_screens:!1}).then(()=>this._said={text:this.t("announce_sent",{message:s}),failed:!1},a=>this._said={text:this.t("announce_failed",{error:a?.message??String(a)}),failed:!0}),this.saidTimer=setTimeout(()=>this._said=null,6e3))},i=o=>{o.preventDefault();let s=o.currentTarget.querySelector("input");n(s.value),s.value=""};return this.section("panel_announce",[p`<div class="nf-rp-scenes">${t.map(o=>p`<button class="nf-btn" @click=${()=>n(o)}>${o}</button>`)}</div>
|
||||
</section>`}extraValues(e){if(!this.floor)return f;let t=[...this.floor.placements.filter(n=>!n.outside&&I([n.x,n.z],e.points)).map(n=>({name:n.name||L(this.hass,n.entity_id),rows:yr(this.hass,n.values)})),...this.floor.furniture.filter(n=>I([n.x,n.z],e.points)).map(n=>({name:n.name||(n.entity&&n.entity!=="none"?L(this.hass,n.entity):this.t("device")),rows:yr(this.hass,n.values)}))].filter(n=>n.rows.length);return t.length?this.section("device_values",t.map(n=>p`<div class="nf-extra-values"><b>${n.name}</b>${n.rows.map(i=>p`<div class="nf-rp-row"><span class="nf-rp-icon">${i.icon}</span><span class="nf-rp-name">${i.label}</span><b class="nf-rp-state">${i.text}${U(this.hass,[i.entity],i.label)}</b></div>`)}</div>`)):f}facts(e){let t=[],n=this.room;if(!n)return t;let i=(T,E)=>{let A=q(this.hass,this.floor,n,T);if(A===null)return null;if(T==="temperature")return`${W(this.hass,ae(this.hass,A),1)} ${re(this.hass)}`;let P=fe(this.hass,this.floor,n,T)[0],C=this.hass.states[P]?.attributes.unit_of_measurement??E;return`${W(this.hass,A,1)} ${C}`},o=e.find(T=>typeof T.attributes.current_temperature=="number"),s=i("temperature","\xB0C");s?t.push(p`${s}${U(this.hass,fe(this.hass,this.floor,n,"temperature"),"Temperatur")}`):o&&n.climate?.temperature!=="none"&&t.push(p`${W(this.hass,o.attributes.current_temperature,1)} ${re(this.hass)}${U(this.hass,[o.entity_id],"Temperatur")}`);let a=i("humidity","%");a&&t.push(p`${a}${U(this.hass,fe(this.hass,this.floor,n,"humidity"),"Luftfeuchte")}`);let l=q(this.hass,this.floor??null,n,"illuminance");l!==null&&t.push(p`☀ ${W(this.hass,l,0)} lx${U(this.hass,fe(this.hass,this.floor,n,"illuminance"),"Helligkeit")}`);let u=rt(this.hass,n,this.building?.floors.flatMap(T=>T.rooms)).find(T=>T.kind==="electricity"&&T.metric==="power"&&T.unit==="W"),c=!u&&this.floor&&this.building?ro(this.hass,this.building,this.floor,n):null;u?t.push(p`⚡ ${De(this.hass,u)}${U(this.hass,u.sources,"Leistung")}`):c!==null&&t.push(`\u26A1 ${vt(this.hass,c)}`);let d=this.floor?this.floor.openings.filter(T=>T.room_id===n.id).flatMap(T=>[T.contact,T.contact2,T.tilt,T.tilt2]).map(T=>T&&T!=="none"?this.hass.states[T]:void 0).filter(T=>T?.state==="on").map(T=>Date.parse(String(T.last_changed??""))).filter(Number.isFinite):[];d.length&&t.push(`\u{1FA9F} ${this.t("open_since",{time:oo(Date.now()-Math.min(...d))})}`);let m=G(this.hass,n).map(T=>this.hass.states[T]).filter(T=>!!T&&T.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(T.attributes.device_class)));if(m.length)if(m.some(T=>T.state==="on"))t.push(`\u{1F6B6} ${this.t("presence_now")}`);else{let T=Math.max(...m.map(E=>Date.parse(String(E.last_changed??""))||0));T>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:oo(Date.now()-T)})}`)}let h=this.building?Il(this.hass,this.building).filter(T=>T.roomId===n.id&&T.level<Pl):[];h.length&&t.push(`\u{1FAAB} ${this.t("battery_low_n",{n:h.length,names:h.map(T=>`${this.name(T.entity)} ${Math.round(T.level)} %`).join(", ")})}`);let g=(this.building?.settings.circuits??[]).filter(T=>T.rooms.includes(n.id)).map(T=>T.name),_=this.building?.settings.room_facts_off??[];g.length&&!_.includes("circuits")&&t.push(`\u{1F50C} ${g.join(", ")}`);let{latitude:b,longitude:v,time_zone:S}=this.hass.config??{};if(this.floor&&b!==void 0&&v!==void 0&&this.building&&!_.includes("sun")){let T=Wt(this.building,this.floor,n,{latitude:b,longitude:v,zone:S});T.facing.length&&t.push(`\u2600 ${this.t("room_sun_hours",{h:W(this.hass,T.hours,1),facing:T.facing.join(", ")})}`)}let k=q(this.hass,this.floor,n,"temperature"),M=q(this.hass,this.floor,n,"humidity"),z=Ar(q(this.hass,this.floor,n,"co2"),M,Lt(k,M));z&&!_.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${z}`)}`);let R=Er(k,M,q(this.hass,this.floor,n,"co2"),bt(new Date,this.hass.config?.latitude)),F=n.hvac?.status;return F&&F!=="none"?t.push(p`${nt(this.hass.states[F])}${U(this.hass,[F],"Raumstatus")}`):R!==null&&(k!==null||M!==null)&&!_.includes("comfort")&&t.push(`\u{1F60A} ${this.t("comfort_n",{n:R})}`),t}announceSection(e){let t=this.phrases?.length?this.phrases:[1,2,3,4,5].map(o=>this.t(`announce_phrase_${o}`)),n=o=>{let s=o.trim();s&&(clearTimeout(this.saidTimer),this.hass.callService("nextfloor","announce",{message:s,rooms:[e.id],on_screens:!1}).then(()=>this._said={text:this.t("announce_sent",{message:s}),failed:!1},a=>this._said={text:this.t("announce_failed",{error:a?.message??String(a)}),failed:!0}),this.saidTimer=setTimeout(()=>this._said=null,6e3))},i=o=>{o.preventDefault();let s=o.currentTarget.querySelector("input");n(s.value),s.value=""};return this.section("panel_announce",[p`<div class="nf-rp-scenes">${t.map(o=>p`<button class="nf-btn" @click=${()=>n(o)}>${o}</button>`)}</div>
|
||||
<form class="nf-rp-say" @submit=${i}>
|
||||
<input type="text" maxlength="500" placeholder=${this.t("announce_placeholder")} aria-label=${this.t("announce_placeholder")} />
|
||||
<button class="nf-btn nf-primary" type="submit">${this.t("announce_send")}</button>
|
||||
</form>
|
||||
${this._said?p`<p class="nf-rp-note ${this._said.failed?"nf-rp-fail":""}" role="status">${this._said.text}</p>`:f}`])}pluginSections(e,t){return $s({hass:this.hass,room:{id:e.id,name:e.name,area_id:e.area_id??null},entities:t}).map(i=>p`<div class="nf-rp-sec nf-rp-plugin" data-plugin=${i.key}>
|
||||
${this._said?p`<p class="nf-rp-note ${this._said.failed?"nf-rp-fail":""}" role="status">${this._said.text}</p>`:f}`])}pluginSections(e,t){return Es({hass:this.hass,room:{id:e.id,name:e.name,area_id:e.area_id??null},entities:t}).map(i=>p`<div class="nf-rp-sec nf-rp-plugin" data-plugin=${i.key}>
|
||||
<div class="nf-rp-sec-head"><h3>${i.title}</h3></div>
|
||||
${typeof i.content=="string"?p`<p class="nf-rp-note">${i.content}</p>`:i.content}
|
||||
</div>`)}section(e,t,n=f){return p`<div class="nf-rp-sec">
|
||||
<div class="nf-rp-sec-head"><h3>${this.t(e)}</h3>${n}</div>
|
||||
${t}
|
||||
</div>`}lightRow(e){let t=e.attributes,n=e.state==="on",i=t.supported_color_modes??[],o=i.some(h=>h!=="onoff"),s=i.includes("color_temp"),a=i.some(h=>["hs","rgb","rgbw","rgbww","xy"].includes(h)),l=typeof t.brightness=="number"?Math.round(t.brightness/255*100):100,u=t.min_color_temp_kelvin??2200,c=t.max_color_temp_kelvin??6500,d=e.entity_id,m=!!this.placedAs(d)?.simple;return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon ${n?"nf-rp-on":""}">${Ct("light")}</span>
|
||||
<span class="nf-rp-icon ${n?"nf-rp-on":""}">${Bt("light")}</span>
|
||||
${this.nameButton(d)}
|
||||
<span class="nf-rp-state">${this.stateOf(e)}${j(this.hass,[e.entity_id])}</span>
|
||||
<span class="nf-rp-state">${this.stateOf(e)}${U(this.hass,[e.entity_id])}</span>
|
||||
${this.toggle(e,n,()=>this.call("light","toggle",{entity_id:d}))}
|
||||
${o&&!m?p`<label class="nf-rp-slider"
|
||||
><span>${this.t("brightness")}</span>
|
||||
@@ -384,23 +384,23 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
@change=${h=>this.call("light","turn_on",{entity_id:d,color_temp_kelvin:Number(h.target.value)})}
|
||||
/></label>`:f}
|
||||
${n&&a&&!m?p`<div class="nf-rp-swatches" role="group" aria-label=${this.t("color")}>
|
||||
${Am.map(h=>p`<button
|
||||
${Rm.map(h=>p`<button
|
||||
class="nf-rp-swatch"
|
||||
style="--c: rgb(${h.join(",")})"
|
||||
aria-label="rgb(${h.join(", ")})"
|
||||
@click=${()=>this.call("light","turn_on",{entity_id:d,rgb_color:h})}
|
||||
></button>`)}
|
||||
</div>`:f}
|
||||
</div>`}coverRow(e){let t=hr(this.hass,this.building?.floors??[],e.entity_id);e=mr(this.hass,e,t);let n=e.attributes,i=n.supported_features??0,o=e.entity_id,s=N(e)&&!rn(e);return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon">${Ct("cover")}</span>
|
||||
</div>`}coverRow(e){let t=fr(this.hass,this.building?.floors??[],e.entity_id);e=gr(this.hass,e,t);let n=e.attributes,i=n.supported_features??0,o=e.entity_id,s=N(e)&&!an(e);return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon">${Bt("cover")}</span>
|
||||
${this.nameButton(o)}
|
||||
<span class="nf-rp-state">${this.stateOf(e)}${j(this.hass,[e.entity_id])}</span>
|
||||
<span class="nf-rp-state">${this.stateOf(e)}${U(this.hass,[e.entity_id])}</span>
|
||||
<div class="nf-rp-buttons">
|
||||
<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.askFor(o)&&this.call("cover","open_cover",{entity_id:o})}>${this.t("cover_open")}</button>
|
||||
${i&Mm?p`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","stop_cover",{entity_id:o})}>${this.t("cover_stop")}</button>`:f}
|
||||
${i&Em?p`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","stop_cover",{entity_id:o})}>${this.t("cover_stop")}</button>`:f}
|
||||
<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.askFor(o)&&this.call("cover","close_cover",{entity_id:o})}>${this.t("cover_close")}</button>
|
||||
</div>
|
||||
${i&$m&&typeof n.current_position=="number"?p`<label class="nf-rp-slider"
|
||||
${i&Am&&typeof n.current_position=="number"?p`<label class="nf-rp-slider"
|
||||
><span>${this.t("position")}</span>
|
||||
<input
|
||||
type="range"
|
||||
@@ -424,9 +424,9 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${i&32?p`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","close_cover_tilt",{entity_id:o})}>${this.t("cover_tilt_close")}</button>`:f}
|
||||
</div>`:f}
|
||||
</div>`}climateRow(e){let t=e.attributes,n=e.entity_id,i=typeof t.temperature=="number"?t.temperature:null,o=t.target_temp_step??.5,s=t.min_temp??5,a=t.max_temp??30,l=t.hvac_modes??[],u=c=>this.call("climate","set_temperature",{entity_id:n,temperature:Math.min(a,Math.max(s,Math.round(c/o)*o))});return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon ${t.hvac_action==="heating"?"nf-rp-on":""}">${Ct("climate")}</span>
|
||||
<span class="nf-rp-icon ${t.hvac_action==="heating"?"nf-rp-on":""}">${Bt("climate")}</span>
|
||||
${this.nameButton(n)}
|
||||
<span class="nf-rp-state">${this.stateOf(e)}${j(this.hass,[e.entity_id])}</span>
|
||||
<span class="nf-rp-state">${this.stateOf(e)}${U(this.hass,[e.entity_id])}</span>
|
||||
${i!==null?p`<div class="nf-rp-stepper nf-rp-wide">
|
||||
<button class="nf-btn" aria-label=${this.t("temp_down")} @click=${()=>u(i-o)}>−</button>
|
||||
<span><small>${this.t("target_temp")}</small> ${W(this.hass,i,1)} ${re(this.hass)}</span>
|
||||
@@ -442,19 +442,19 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
</button>`)}
|
||||
</div>`:f}
|
||||
</div>`}stateOf(e,t=oe(this.hass,e)){if(this.room?.no_state?.includes(e.entity_id))return"";let n=H(e.entity_id);return e.state==="unknown"&&n!=="sensor"&&n!=="binary"?"":t}stateLabel(e){let t=`state_${e}`,n=this.t(t);return n===t?e:n}mediaRow(e){let t=e.attributes,n=e.entity_id,i=N(e)||e.state==="off",o=[t.media_title,t.media_artist].filter(s=>typeof s=="string"&&s).join(" \xB7 ");return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon ${e.state==="playing"?"nf-rp-on":""}">${Ct("media")}</span>
|
||||
<span class="nf-rp-icon ${e.state==="playing"?"nf-rp-on":""}">${Bt("media")}</span>
|
||||
${this.nameButton(n)}
|
||||
<span class="nf-rp-state">${this.stateOf(e,this.stateLabel(e.state))}${j(this.hass,[e.entity_id])}</span>
|
||||
<span class="nf-rp-state">${this.stateOf(e,this.stateLabel(e.state))}${U(this.hass,[e.entity_id])}</span>
|
||||
${o?p`<p class="nf-rp-media nf-rp-wide">${o}</p>`:f}
|
||||
<div class="nf-rp-buttons nf-rp-wide">
|
||||
<button class="nf-btn nf-rp-small" aria-label=${this.t("previous")} ?disabled=${i} @click=${()=>this.call("media_player","media_previous_track",{entity_id:n})}>
|
||||
${io(zr.previous)}
|
||||
${so(Dr.previous)}
|
||||
</button>
|
||||
<button class="nf-btn nf-rp-small" aria-label=${this.t("play_pause")} ?disabled=${N(e)} @click=${()=>this.call("media_player","media_play_pause",{entity_id:n})}>
|
||||
${io(e.state==="playing"?zr.pause:zr.play)}
|
||||
${so(e.state==="playing"?Dr.pause:Dr.play)}
|
||||
</button>
|
||||
<button class="nf-btn nf-rp-small" aria-label=${this.t("next")} ?disabled=${i} @click=${()=>this.call("media_player","media_next_track",{entity_id:n})}>
|
||||
${io(zr.next)}
|
||||
${so(Dr.next)}
|
||||
</button>
|
||||
</div>
|
||||
${typeof t.volume_level=="number"?p`<label class="nf-rp-slider"
|
||||
@@ -467,15 +467,15 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
@change=${s=>this.call("media_player","volume_set",{entity_id:n,volume_level:Number(s.target.value)/100})}
|
||||
/></label>`:f}
|
||||
</div>`}switchRow(e){let t=e.entity_id,n=H(t),i=t.slice(0,t.indexOf(".")),o=n==="lock"?e.state==="unlocked"||e.state==="open":te(e),s=()=>n==="lock"?this.call("lock",o?"lock":"unlock",{entity_id:t}):this.call(i,"toggle",{entity_id:t});return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon ${o?"nf-rp-on":""}">${Ct(n)}</span>
|
||||
<span class="nf-rp-icon ${o?"nf-rp-on":""}">${Bt(n)}</span>
|
||||
${this.nameButton(t)}
|
||||
<span class="nf-rp-state">${this.stateOf(e)}${j(this.hass,[e.entity_id])}</span>
|
||||
<span class="nf-rp-state">${this.stateOf(e)}${U(this.hass,[e.entity_id])}</span>
|
||||
${this.toggle(e,o,s)}
|
||||
</div>`}sensorRow(e){let t=H(e.entity_id),n=t==="binary"&&e.state==="on";return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon ${n?"nf-rp-on":""}">${Ct(t)}</span>
|
||||
<span class="nf-rp-icon ${n?"nf-rp-on":""}">${Bt(t)}</span>
|
||||
${this.nameButton(e.entity_id)}
|
||||
<span class="nf-rp-state">${this.stateOf(e)}${j(this.hass,[e.entity_id])}</span>
|
||||
</div>`}fire(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))}static styles=[ge,Re,X`
|
||||
<span class="nf-rp-state">${this.stateOf(e)}${U(this.hass,[e.entity_id])}</span>
|
||||
</div>`}fire(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))}static styles=[ge,Re,Y`
|
||||
:host {
|
||||
display: block;
|
||||
}
|
||||
@@ -856,32 +856,32 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
outline: 2px solid var(--nf-accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
`]};customElements.get("nf-room-panel")||customElements.define("nf-room-panel",oo);function Gl(r){if(!r)return"";let e=Math.min(.8,Math.max(0,r.dim??.35)),t=r.image&&/^(https:\/\/|\/local\/|\/api\/)[^"'()\\\s]+$/.test(r.image)?r.image:null,n=r.color&&/^#[0-9a-f]{6}$/i.test(r.color)?r.color:null;return t?`;background:linear-gradient(rgba(0,0,0,${e}),rgba(0,0,0,${e})),center / cover no-repeat url("${t}")${n?` ${n}`:""}`:n?`;background:${n}`:""}var zm=[[/spotify/i,[30,215,96]],[/netflix/i,[229,9,20]],[/youtube/i,[255,0,51]],[/prime|amazon/i,[0,168,225]],[/disney/i,[17,60,207]],[/apple ?music|itunes/i,[250,45,72]],[/apple ?tv/i,[200,200,210]],[/plex/i,[229,160,13]],[/tidal/i,[0,255,255]],[/deezer/i,[162,56,255]],[/radio|tunein/i,[255,140,60]]],Ul=[34,211,238];function so(r){return r?zm.find(([e])=>e.test(r))?.[1]??Ul:Ul}function ao(r){if(r.state==="playing"||r.state==="paused")return!0;let e=t=>typeof r.attributes[t]=="string"&&r.attributes[t]!=="";return r.state==="on"&&(e("media_title")||e("media_channel")||e("source")||e("app_name"))}var lo=r=>r.state==="playing"||r.state==="on"&&ao(r);function jl(r,e){let t=[],n=new Set;for(let i of e){if(!i.entity.startsWith("media_player.")||n.has(i.entity))continue;n.add(i.entity);let o=r.states[i.entity];if(!o)continue;let s=o.attributes,a=c=>typeof s[c]=="string"?s[c]:"",l=a("app_name")||a("source")||a("app_id")||null,u=typeof s.volume_level=="number"?s.volume_level:null;t.push({entity:i.entity,name:i.name,at:i.at,playing:lo(o),title:a("media_title")||a("media_channel")||l||"",artist:a("media_artist")||a("media_album_name")||a("media_series_title"),picture:a("entity_picture")||null,volume:u,color:so(l),app:l,group:Array.isArray(s.group_members)?s.group_members.filter(c=>typeof c=="string"&&c!==i.entity):[],rings:i.rings??1})}return t}function ql(r){let e=new Map(r.filter(i=>i.playing).map(i=>[i.entity,i])),t=[],n=new Set;for(let i of e.values())for(let o of i.group){let s=e.get(o),a=[i.entity,o].sort().join("|");s&&!n.has(a)&&(n.add(a),t.push([i,s]))}return t}var Tm=3;function Zl(r,e,t){let n=[];for(let i of e.floors)for(let o of i.furniture){if(!o.type.endsWith(":sprinkler"))continue;let s=t?.get(o.id)?.entity??null;!s||!te(r.states[s])||n.push({id:o.id,at:{floorId:i.id,x:o.x,y:he(i,o)+o.h,z:o.z},reach:Math.min(15,Math.max(.5,o.spray??Tm))})}return n}var Tr=r=>r&&r!=="none"?r:null,Yl=r=>Math.min(1,Math.max(0,r));function Jl(r,e){let t=new Map;for(let n of e.settings.roof?.windows??[]){let i=Pe(r,{cover:Tr(n.cover),contact:Tr(n.contact),tilt:Tr(n.tilt)},"window"),o=Tr(n.window),s=o?r.states[o]:void 0,a=i.open;if(s&&!N(s)){let l=s.attributes.current_position;a=typeof l=="number"?Yl(l/100):s.state==="open"||s.state==="opening"?1:0}t.set(n.id,{open:a,tilt:i.tilt,cover:i.cover??0})}return t}function Dm(r,e){let t=i=>Math.hypot(i.x-e.x,i.z-e.z);return r.placements.filter(i=>i.entity_id.startsWith("media_player.")&&t(i)<Math.max(2,e.w)).sort((i,o)=>t(i)-t(o))[0]?.entity_id??null}var et=(r,e)=>typeof r[e]=="string"?r[e]:"";function Ql(r,e,t){let n=[];for(let i of e.floors)for(let o of i.furniture){if(!ur(o.type))continue;let s=t?.get(o.id)?.entity??null,a=s?.startsWith("media_player.")?s:Dm(i,o),l=a?r.states[a]:void 0;if(!l||!ao(l))continue;let u=l.attributes,c=et(u,"app_name")||et(u,"source")||null;n.push({id:o.id,furnitureId:o.id,floorId:i.id,color:so(c),title:et(u,"media_title")||et(u,"media_channel")||c||"",subtitle:et(u,"media_artist")||et(u,"media_series_title")||et(u,"media_album_name"),app:c,picture:et(u,"entity_picture")||null,playing:lo(l),ambilight:o.ambilight??1})}return n}function Xl(r){let e=r.states["sun.sun"]?.attributes;return typeof e?.elevation=="number"&&typeof e.azimuth=="number"?{elevation:e.elevation,azimuth:e.azimuth}:null}function eu(r,e){return(r===null?0:Yl((r+4)/16))*(1-.45*e)}function tt(r,e){return r.states["weather.nextfloor_symcon"]?"weather.nextfloor_symcon":e&&r.states[e]?e:Object.keys(r.states).filter(t=>t.startsWith("weather.")).sort()[0]??null}var Dr=new Set(["contact_lost","unlocked_night","own"]);function Fm(r,e){let t=r.states[e.entity];if(!t||["unavailable","unknown"].includes(t.state))return!1;let n=(e.state??"on").trim(),i=/^([<>])\s*(-?\d+(?:[.,]\d+)?)$/.exec(n);if(i){let o=Number(t.state),s=Number(i[2].replace(",","."));return Number.isFinite(o)&&(i[1]==="<"?o<s:o>s)}return n.split(",").map(o=>o.trim().toLowerCase()).filter(Boolean).includes(String(t.state).toLowerCase())}var Hm=600*1e3,Pm=new Set(["rainy","pouring","lightning-rainy","hail","snowy-rainy"]),Im=new Map([["smoke","smoke"],["gas","gas"],["carbon_monoxide","co"],["moisture","water"]]),tu=(r,e)=>{if(e.startsWith("binary_sensor."))return Im.get(String(r.states[e]?.attributes.device_class))};function Nm(r,e){let t=new Set,n=[];for(let i of r.floors)for(let o of i.openings){let s=e.get(o.id);for(let a of s?[s.contact,s.contact2,s.tilt,s.tilt2]:[])!a||t.has(a)||(t.add(a),n.push({floorId:i.id,roomId:o.room_id,entity:a}))}return n}function nu(r,e,t,n){let i=[];for(let a o
Line truncated
|
||||
`]};customElements.get("nf-room-panel")||customElements.define("nf-room-panel",ao);function jl(r){if(!r)return"";let e=Math.min(.8,Math.max(0,r.dim??.35)),t=r.image&&/^(https:\/\/|\/local\/|\/api\/)[^"'()\\\s]+$/.test(r.image)?r.image:null,n=r.color&&/^#[0-9a-f]{6}$/i.test(r.color)?r.color:null;return t?`;background:linear-gradient(rgba(0,0,0,${e}),rgba(0,0,0,${e})),center / cover no-repeat url("${t}")${n?` ${n}`:""}`:n?`;background:${n}`:""}var Dm=[[/spotify/i,[30,215,96]],[/netflix/i,[229,9,20]],[/youtube/i,[255,0,51]],[/prime|amazon/i,[0,168,225]],[/disney/i,[17,60,207]],[/apple ?music|itunes/i,[250,45,72]],[/apple ?tv/i,[200,200,210]],[/plex/i,[229,160,13]],[/tidal/i,[0,255,255]],[/deezer/i,[162,56,255]],[/radio|tunein/i,[255,140,60]]],ql=[34,211,238];function lo(r){return r?Dm.find(([e])=>e.test(r))?.[1]??ql:ql}function uo(r){if(r.state==="playing"||r.state==="paused")return!0;let e=t=>typeof r.attributes[t]=="string"&&r.attributes[t]!=="";return r.state==="on"&&(e("media_title")||e("media_channel")||e("source")||e("app_name"))}var co=r=>r.state==="playing"||r.state==="on"&&uo(r);function Zl(r,e){let t=[],n=new Set;for(let i of e){if(!i.entity.startsWith("media_player.")||n.has(i.entity))continue;n.add(i.entity);let o=r.states[i.entity];if(!o)continue;let s=o.attributes,a=c=>typeof s[c]=="string"?s[c]:"",l=a("app_name")||a("source")||a("app_id")||null,u=typeof s.volume_level=="number"?s.volume_level:null;t.push({entity:i.entity,name:i.name,at:i.at,playing:co(o),title:a("media_title")||a("media_channel")||l||"",artist:a("media_artist")||a("media_album_name")||a("media_series_title"),picture:a("entity_picture")||null,volume:u,color:lo(l),app:l,group:Array.isArray(s.group_members)?s.group_members.filter(c=>typeof c=="string"&&c!==i.entity):[],rings:i.rings??1})}return t}function Yl(r){let e=new Map(r.filter(i=>i.playing).map(i=>[i.entity,i])),t=[],n=new Set;for(let i of e.values())for(let o of i.group){let s=e.get(o),a=[i.entity,o].sort().join("|");s&&!n.has(a)&&(n.add(a),t.push([i,s]))}return t}var Fm=3;function Jl(r,e,t){let n=[];for(let i of e.floors)for(let o of i.furniture){if(!o.type.endsWith(":sprinkler"))continue;let s=t?.get(o.id)?.entity??null;!s||!te(r.states[s])||n.push({id:o.id,at:{floorId:i.id,x:o.x,y:he(i,o)+o.h,z:o.z},reach:Math.min(15,Math.max(.5,o.spray??Fm))})}return n}var Fr=r=>r&&r!=="none"?r:null,Ql=r=>Math.min(1,Math.max(0,r));function Xl(r,e){let t=new Map;for(let n of e.settings.roof?.windows??[]){let i=Ce(r,{cover:Fr(n.cover),contact:Fr(n.contact),tilt:Fr(n.tilt)},"window"),o=Fr(n.window),s=o?r.states[o]:void 0,a=i.open;if(s&&!N(s)){let l=s.attributes.current_position;a=typeof l=="number"?Ql(l/100):s.state==="open"||s.state==="opening"?1:0}t.set(n.id,{open:a,tilt:i.tilt,cover:i.cover??0})}return t}function Hm(r,e){let t=i=>Math.hypot(i.x-e.x,i.z-e.z);return r.placements.filter(i=>i.entity_id.startsWith("media_player.")&&t(i)<Math.max(2,e.w)).sort((i,o)=>t(i)-t(o))[0]?.entity_id??null}var it=(r,e)=>typeof r[e]=="string"?r[e]:"";function eu(r,e,t){let n=[];for(let i of e.floors)for(let o of i.furniture){if(!hr(o.type))continue;let s=t?.get(o.id)?.entity??null,a=s?.startsWith("media_player.")?s:Hm(i,o),l=a?r.states[a]:void 0;if(!l||!uo(l))continue;let u=l.attributes,c=it(u,"app_name")||it(u,"source")||null;n.push({id:o.id,furnitureId:o.id,floorId:i.id,color:lo(c),title:it(u,"media_title")||it(u,"media_channel")||c||"",subtitle:it(u,"media_artist")||it(u,"media_series_title")||it(u,"media_album_name"),app:c,picture:it(u,"entity_picture")||null,playing:co(l),ambilight:o.ambilight??1})}return n}function tu(r){let e=r.states["sun.sun"]?.attributes;return typeof e?.elevation=="number"&&typeof e.azimuth=="number"?{elevation:e.elevation,azimuth:e.azimuth}:null}function nu(r,e){return(r===null?0:Ql((r+4)/16))*(1-.45*e)}function ot(r,e){return r.states["weather.nextfloor_symcon"]?"weather.nextfloor_symcon":e&&r.states[e]?e:Object.keys(r.states).filter(t=>t.startsWith("weather.")).sort()[0]??null}var Hr=new Set(["contact_lost","unlocked_night","own"]);function Pm(r,e){let t=r.states[e.entity];if(!t||["unavailable","unknown"].includes(t.state))return!1;let n=(e.state??"on").trim(),i=/^([<>])\s*(-?\d+(?:[.,]\d+)?)$/.exec(n);if(i){let o=Number(t.state),s=Number(i[2].replace(",","."));return Number.isFinite(o)&&(i[1]==="<"?o<s:o>s)}return n.split(",").map(o=>o.trim().toLowerCase()).filter(Boolean).includes(String(t.state).toLowerCase())}var Im=600*1e3,Nm=new Set(["rainy","pouring","lightning-rainy","hail","snowy-rainy"]),Cm=new Map([["smoke","smoke"],["gas","gas"],["carbon_monoxide","co"],["moisture","water"]]),ru=(r,e)=>{if(e.startsWith("binary_sensor."))return Cm.get(String(r.states[e]?.attributes.device_class))};function Wm(r,e){let t=new Set,n=[];for(let i of r.floors)for(let o of i.openings){let s=e.get(o.id);for(let a of s?[s.contact,s.contact2,s.tilt,s.tilt2]:[])!a||t.has(a)||(t.add(a),n.push({floorId:i.id,roomId:o.room_id,entity:a}))}return n}function iu(r,e,t,n){let i=[];for(let a o
Line truncated
|
||||
${ne`<circle cx="27" cy="27" r=${22} class="live-ring-bg"></circle>
|
||||
<circle cx="27" cy="27" r=${22} stroke=${e} stroke-dasharray=${`${(n*Math.max(0,Math.min(1,r))).toFixed(1)} ${n.toFixed(1)}`} transform="rotate(-90 27 27)" class="live-ring-fg"></circle>`}
|
||||
</svg>`}function jp(r,e,t,n){let i=e.summary,o=u=>$(r,u),s=e.autarky,a=n?p`<button class="live-fold" title=${o(n.folded?"live_unfold":"live_fold")} aria-label=${o(n.folded?"live_unfold":"live_fold")} aria-expanded=${!n.folded} @click=${n.toggle}>${n.folded?"+":"\u2212"}</button>`:f;if(n?.folded){let u=i.solar!==null?`\u2600 ${Te(r,i.solar)}`:i.consumption!==null?`\u2302 ${Te(r,i.consumption)}`:null;return p`<div class="live-card live-card-house live-folded" data-i=${t}>
|
||||
${s!==null?p`<div class="live-own">${zn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)}%</b></div></div>`:f}
|
||||
</svg>`}function Zp(r,e,t,n){let i=e.summary,o=u=>$(r,u),s=e.autarky,a=n?p`<button class="live-fold" title=${o(n.folded?"live_unfold":"live_fold")} aria-label=${o(n.folded?"live_unfold":"live_fold")} aria-expanded=${!n.folded} @click=${n.toggle}>${n.folded?"+":"\u2212"}</button>`:f;if(n?.folded){let u=i.solar!==null?`\u2600 ${He(r,i.solar)}`:i.consumption!==null?`\u2302 ${He(r,i.consumption)}`:null;return p`<div class="live-card live-card-house live-folded" data-i=${t}>
|
||||
${s!==null?p`<div class="live-own">${Fn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)}%</b></div></div>`:f}
|
||||
${u?p`<b>${u}</b>`:s===null?p`<b>⌂</b>`:f}
|
||||
${a}
|
||||
</div>`}let l=[];if(i.solar!==null&&l.push(p`<div class="live-row live-solar"><span>☀ ${o("energy_solar")}</span><b>${Te(r,i.solar)}</b></div>`),i.consumption!==null&&l.push(p`<div class="live-row live-house"><span>⌂ ${o("energy_consumption")}</span><b>${Te(r,i.consumption)}</b></div>`),i.rest!==void 0&&i.rest!==null&&l.push(p`<div class="live-row live-house"><span>⌂ ${o("energy_rest")}</span><b>${Te(r,i.rest)}</b></div>`),i.battery!==null||i.soc!==null){let u=i.battery===null||Math.abs(i.battery)<15?"":i.battery>0?" \u2193":" \u2191";l.push(p`<div class="live-row live-battery"><span>▮ ${o("energy_battery")}${u}</span><b>${i.soc!==null?`${Math.round(i.soc)} %`:""}${i.battery!==null&&Math.abs(i.battery)>=15?` \xB7 ${Te(r,i.battery)}`:""}</b></div>`)}if(i.grid!==null){let u=i.grid<-15;l.push(p`<div class="live-row ${u?"live-export":"live-import"}"><span>⇄ ${o(u?"energy_grid_export":"energy_grid_import")}</span><b>${Te(r,i.grid)}</b></div>`)}for(let u of e.meters??[])l.push(p`<div class="live-row live-meter"><span>${u.icon} ${u.label}</span><b>${u.value}</b></div>`);return p`<div class="live-card live-card-house" data-i=${t}>
|
||||
</div>`}let l=[];if(i.solar!==null&&l.push(p`<div class="live-row live-solar"><span>☀ ${o("energy_solar")}</span><b>${He(r,i.solar)}</b></div>`),i.consumption!==null&&l.push(p`<div class="live-row live-house"><span>⌂ ${o("energy_consumption")}</span><b>${He(r,i.consumption)}</b></div>`),i.rest!==void 0&&i.rest!==null&&l.push(p`<div class="live-row live-house"><span>⌂ ${o("energy_rest")}</span><b>${He(r,i.rest)}</b></div>`),i.battery!==null||i.soc!==null){let u=i.battery===null||Math.abs(i.battery)<15?"":i.battery>0?" \u2193":" \u2191";l.push(p`<div class="live-row live-battery"><span>▮ ${o("energy_battery")}${u}</span><b>${i.soc!==null?`${Math.round(i.soc)} %`:""}${i.battery!==null&&Math.abs(i.battery)>=15?` \xB7 ${He(r,i.battery)}`:""}</b></div>`)}if(i.grid!==null){let u=i.grid<-15;l.push(p`<div class="live-row ${u?"live-export":"live-import"}"><span>⇄ ${o(u?"energy_grid_export":"energy_grid_import")}</span><b>${He(r,i.grid)}</b></div>`)}for(let u of e.meters??[])l.push(p`<div class="live-row live-meter"><span>${u.icon} ${u.label}</span><b>${u.value}</b></div>`);return p`<div class="live-card live-card-house" data-i=${t}>
|
||||
${a}
|
||||
${s!==null?p`<div class="live-own">${zn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)} %</b><span>${o("live_autarky")}</span></div></div>`:f}
|
||||
${s!==null?p`<div class="live-own">${Fn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)} %</b><span>${o("live_autarky")}</span></div></div>`:f}
|
||||
<div class="live-rows">${l}</div>
|
||||
${Zp(r,e.curves)} ${qp(r,e.week)}
|
||||
</div>`}function qp(r,e){if(!e)return f;let t=[...e.solar,...e.use].filter(u=>u!==null&&u>0);if(!t.length)return f;let n=Math.max(...t)*1.1||1,[i,o]=[150,30],s=i/7,a=(u,c,d)=>u===null||u<=0?f:ne`<rect x=${c.toFixed(1)} y=${(o-u/n*o).toFixed(1)} width=${(s*.36).toFixed(1)} height=${(u/n*o).toFixed(1)} class=${d}></rect>`,l=u=>u.reduce((c,d)=>c+(d??0),0);return p`<div class="live-day live-week" title=${$(r,"live_week_hint",{solar:W(r,l(e.solar),0),use:W(r,l(e.use),0)})}>
|
||||
${Jp(r,e.curves)} ${Yp(r,e.week)}
|
||||
</div>`}function Yp(r,e){if(!e)return f;let t=[...e.solar,...e.use].filter(u=>u!==null&&u>0);if(!t.length)return f;let n=Math.max(...t)*1.1||1,[i,o]=[150,30],s=i/7,a=(u,c,d)=>u===null||u<=0?f:ne`<rect x=${c.toFixed(1)} y=${(o-u/n*o).toFixed(1)} width=${(s*.36).toFixed(1)} height=${(u/n*o).toFixed(1)} class=${d}></rect>`,l=u=>u.reduce((c,d)=>c+(d??0),0);return p`<div class="live-day live-week" title=${$(r,"live_week_hint",{solar:W(r,l(e.solar),0),use:W(r,l(e.use),0)})}>
|
||||
<svg viewBox=${`0 0 ${i} ${o}`} preserveAspectRatio="none" aria-hidden="true">
|
||||
${e.days.map((u,c)=>ne`${a(e.solar[c],c*s+s*.1,"live-week-solar")}${a(e.use[c],c*s+s*.5,"live-week-use")}`)}
|
||||
</svg>
|
||||
<span>7 ${$(r,"live_days")}</span>
|
||||
</div>`}function Zp(r,e){if(!e)return f;let t=[...e.solar,...e.use].filter(l=>l!==null);if(t.length<4)return f;let n=Math.max(...t)*1.08||1,[i,o]=[150,34],s=yn(e.solar,i,o,n),a=yn(e.use,i,o,n);return p`<div class="live-day" title=${$(r,"live_day_hint")}>
|
||||
</div>`}function Jp(r,e){if(!e)return f;let t=[...e.solar,...e.use].filter(l=>l!==null);if(t.length<4)return f;let n=Math.max(...t)*1.08||1,[i,o]=[150,34],s=kn(e.solar,i,o,n),a=kn(e.use,i,o,n);return p`<div class="live-day" title=${$(r,"live_day_hint")}>
|
||||
<svg viewBox=${`0 0 ${i} ${o}`} preserveAspectRatio="none" aria-hidden="true">
|
||||
${s?ne`<path d=${`${s}L${i},${o}L0,${o}Z`} class="live-day-solar"></path>`:f}
|
||||
${a?ne`<path d=${a} class="live-day-use"></path>`:f}
|
||||
</svg>
|
||||
<span>24 h</span>
|
||||
</div>`}function Yp(r,e,t,n){let i=e.car,o=(c,d)=>$(r,c,d),s=qu(i.soc),a=i.home?i.charging?`\u26A1 ${o("live_car_charging")}${i.chargingW?` \xB7 ${Te(r,i.chargingW)}`:""}`:i.plugged?`\u{1F50C} ${o("live_car_plugged")}`:"":`${o("live_car_away")}${i.where?` \xB7 ${i.where}`:""}${i.distance!==null?` \xB7 ${W(r,i.distance,i.distance<10?1:0)} km`:""}`,l=i.entities,u=(c,d,m,h)=>p`<button class="live-btn ${c?"live-on":""}" title=${d} aria-label=${d} aria-pressed=${c??!1} @click=${g=>(g.stopPropagation(),h())}>${m}</button>`;return p`<div class="live-card live-card-car ${i.charging?"live-charging":""} ${i.home?"":"live-away"}" data-i=${t} style=${`--live-soc:${s}`}>
|
||||
</div>`}function Qp(r,e,t,n){let i=e.car,o=(c,d)=>$(r,c,d),s=Yu(i.soc),a=i.home?i.charging?`\u26A1 ${o("live_car_charging")}${i.chargingW?` \xB7 ${He(r,i.chargingW)}`:""}`:i.plugged?`\u{1F50C} ${o("live_car_plugged")}`:"":`${o("live_car_away")}${i.where?` \xB7 ${i.where}`:""}${i.distance!==null?` \xB7 ${W(r,i.distance,i.distance<10?1:0)} km`:""}`,l=i.entities,u=(c,d,m,h)=>p`<button class="live-btn ${c?"live-on":""}" title=${d} aria-label=${d} aria-pressed=${c??!1} @click=${g=>(g.stopPropagation(),h())}>${m}</button>`;return p`<div class="live-card live-card-car ${i.charging?"live-charging":""} ${i.home?"":"live-away"}" data-i=${t} style=${`--live-soc:${s}`}>
|
||||
<div class="live-own">
|
||||
${zn((i.soc??0)/100,s)}
|
||||
${Fn((i.soc??0)/100,s)}
|
||||
<div class="live-own-text"><b>${i.soc!==null?`${Math.round(i.soc)} %`:"\u2013"}</b><span>${i.range!==null?`${Math.round(i.range)} ${i.rangeUnit}`:""}</span></div>
|
||||
</div>
|
||||
<div class="live-rows">
|
||||
@@ -896,7 +896,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${l.charge&&i.home?u(i.charging,o("live_car_charge"),"\u26A1",()=>n(l.charge.split(".")[0],"toggle",l.charge)):f}
|
||||
</div>
|
||||
</div>
|
||||
</div>`}function Jp(r,e,t,n){let i=e.media,o=l=>$(r,l),s=`rgb(${i.color.join(",")})`,a=(l,u,c)=>p`<button class="live-btn" title=${l} aria-label=${l} @click=${d=>(d.stopPropagation(),n("media_player",c,i.entity))}>${u}</button>`;return p`<div class="live-card live-card-media" data-i=${t} style=${`--live-soc:${s}`} @click=${l=>l.currentTarget.classList.toggle("live-open")}>
|
||||
</div>`}function Xp(r,e,t,n){let i=e.media,o=l=>$(r,l),s=`rgb(${i.color.join(",")})`,a=(l,u,c)=>p`<button class="live-btn" title=${l} aria-label=${l} @click=${d=>(d.stopPropagation(),n("media_player",c,i.entity))}>${u}</button>`;return p`<div class="live-card live-card-media" data-i=${t} style=${`--live-soc:${s}`} @click=${l=>l.currentTarget.classList.toggle("live-open")}>
|
||||
${i.picture?p`<img class="live-cover" src=${i.picture} alt="" loading="lazy" />`:p`<div class="live-cover live-cover-none">♪</div>`}
|
||||
<div class="live-rows">
|
||||
<div class="live-title" title=${i.title}>${i.title||i.name}</div>
|
||||
@@ -915,9 +915,9 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
/>`:f}
|
||||
</div>
|
||||
</div>
|
||||
</div>`}function Zu(r){let e=[...r.querySelectorAll(".live-card")].filter(o=>o.style.visibility!=="hidden"),t=[],n=e[0]?.parentElement?.clientWidth??0,i=e.map(o=>{let[s,a]=[Number(o.dataset.x),o.offsetWidth],l=n?n>a+16?Math.min(Math.max(s,a/2+8),n-a/2-8):n/2:s;return o.style.setProperty("--live-dx",`${Math.round(s-l)}px`),{el:o,x:l,y:Number(o.dataset.y),w:a,h:o.offsetHeight}}).sort((o,s)=>s.y-o.y);for(let o of i){let s=o.y;for(let l=0;l<12;l++){let u={x0:o.x-o.w/2,x1:o.x+o.w/2,y0:s-o.h,y1:s},c=t.find(d=>u.x0<d.x1+6&&u.x1>d.x0-6&&u.y0<d.y1+6&&u.y1>d.y0-6);if(!c)break;s=c.y0-8}t.push({x0:o.x-o.w/2,x1:o.x+o.w/2,y0:s-o.h,y1:s});let a=o.y-s;o.el.style.transform=`translate(${Math.round(o.x)}px, ${Math.round(s)}px) translate(-50%, -100%)`,o.el.style.setProperty("--live-thread",`${Math.round(18+a)}px`)}}function Qp(r,e,t){let n=e.printer,i=(u,c)=>$(r,u,c),o=n.progress??0,s=u=>new Intl.DateTimeFormat(r?.language??navigator.language,{hour:"2-digit",minute:"2-digit"}).format(new Date(u)),a=n.remaining!==null?n.remaining>=60?`${Math.floor(n.remaining/60)} h ${Math.round(n.remaining%60)} min`:`${Math.round(n.remaining)} min`:null,l=[n.nozzle!==null?`${i("printer_nozzle")} ${Math.round(n.nozzle)}\xB0`:null,n.bed!==null?`${i("printer_bed")} ${Math.round(n.bed)}\xB0`:null].filter(Boolean).join(" \xB7 ");return p`<div class="live-card live-card-printer ${n.printing?"live-charging":""}" data-i=${t}>
|
||||
</div>`}function Ju(r){let e=[...r.querySelectorAll(".live-card")].filter(o=>o.style.visibility!=="hidden"),t=[],n=e[0]?.parentElement?.clientWidth??0,i=e.map(o=>{let[s,a]=[Number(o.dataset.x),o.offsetWidth],l=n?n>a+16?Math.min(Math.max(s,a/2+8),n-a/2-8):n/2:s;return o.style.setProperty("--live-dx",`${Math.round(s-l)}px`),{el:o,x:l,y:Number(o.dataset.y),w:a,h:o.offsetHeight}}).sort((o,s)=>s.y-o.y);for(let o of i){let s=o.y;for(let l=0;l<12;l++){let u={x0:o.x-o.w/2,x1:o.x+o.w/2,y0:s-o.h,y1:s},c=t.find(d=>u.x0<d.x1+6&&u.x1>d.x0-6&&u.y0<d.y1+6&&u.y1>d.y0-6);if(!c)break;s=c.y0-8}t.push({x0:o.x-o.w/2,x1:o.x+o.w/2,y0:s-o.h,y1:s});let a=o.y-s;o.el.style.transform=`translate(${Math.round(o.x)}px, ${Math.round(s)}px) translate(-50%, -100%)`,o.el.style.setProperty("--live-thread",`${Math.round(18+a)}px`)}}function ef(r,e,t){let n=e.printer,i=(u,c)=>$(r,u,c),o=n.progress??0,s=u=>new Intl.DateTimeFormat(r?.language??navigator.language,{hour:"2-digit",minute:"2-digit"}).format(new Date(u)),a=n.remaining!==null?n.remaining>=60?`${Math.floor(n.remaining/60)} h ${Math.round(n.remaining%60)} min`:`${Math.round(n.remaining)} min`:null,l=[n.nozzle!==null?`${i("printer_nozzle")} ${Math.round(n.nozzle)}\xB0`:null,n.bed!==null?`${i("printer_bed")} ${Math.round(n.bed)}\xB0`:null].filter(Boolean).join(" \xB7 ");return p`<div class="live-card live-card-printer ${n.printing?"live-charging":""}" data-i=${t}>
|
||||
<div class="live-own">
|
||||
${n.picture?p`<img class="live-print-pic" src=${n.picture} alt="" />`:zn(o/100,n.printing?"#38bdf8":"#8aa0c8")}
|
||||
${n.picture?p`<img class="live-print-pic" src=${n.picture} alt="" />`:Fn(o/100,n.printing?"#38bdf8":"#8aa0c8")}
|
||||
<div class="live-own-text"><b>${n.progress!==null?`${Math.round(o)} %`:"\u2013"}</b><span>${i(`printer_${n.printing?"printing":/finish|complete|fertig/.test(n.status)?"done":/pause/.test(n.status)?"paused":/error|fail/.test(n.status)?"error":"idle"}`)}</span></div>
|
||||
</div>
|
||||
<div class="live-rows">
|
||||
@@ -928,27 +928,27 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${l?p`<div class="live-status">🌡 ${l}</div>`:f}
|
||||
${n.filaments.length?p`<div class="live-filaments">${n.filaments.map(u=>p`<i style=${`background:${u}`}></i>`)}</div>`:f}
|
||||
</div>
|
||||
</div>`}function Xp(r,e,t){let n=e.pump,i=a=>$(r,a),o=a=>a===null?"\u2013":`${W(r,a,1)}\xB0`,s={heating:"\u{1F525}",water:"\u{1F6BF}",cooling:"\u2744",defrost:"\u{1F9CA}",idle:"\u23F8"}[n.mode];return p`<div class="live-card live-card-heatpump ${n.mode==="idle"?"":"live-charging"}" data-i=${t}>
|
||||
</div>`}function tf(r,e,t){let n=e.pump,i=a=>$(r,a),o=a=>a===null?"\u2013":`${W(r,a,1)}\xB0`,s={heating:"\u{1F525}",water:"\u{1F6BF}",cooling:"\u2744",defrost:"\u{1F9CA}",idle:"\u23F8"}[n.mode];return p`<div class="live-card live-card-heatpump ${n.mode==="idle"?"":"live-charging"}" data-i=${t}>
|
||||
<div class="live-own">
|
||||
${zn(Math.min(1,(n.cop??0)/6),(n.cop??0)>=3.5?"#4ade80":(n.cop??0)>=2.5?"#facc15":"#fb923c")}
|
||||
${Fn(Math.min(1,(n.cop??0)/6),(n.cop??0)>=3.5?"#4ade80":(n.cop??0)>=2.5?"#facc15":"#fb923c")}
|
||||
<div class="live-own-text"><b>${n.cop!==null?W(r,n.cop,1):s}</b><span>${n.cop!==null?"COP":""}</span></div>
|
||||
</div>
|
||||
<div class="live-rows">
|
||||
<div class="live-title">${e.name}</div>
|
||||
<div class="live-status">${s} ${i(`heatpump_${n.mode}`)}</div>
|
||||
${n.flow!==null||n.return!==null?p`<div class="live-row live-heat"><span>${i("heatpump_flow_return")}</span><b>${o(n.flow)} → ${o(n.return)}</b></div>`:f}
|
||||
${n.heat!==null?p`<div class="live-row live-heat"><span>${i("heatpump_heat")}</span><b>${Te(r,n.heat)}</b></div>`:f}
|
||||
${n.power!==null?p`<div class="live-row live-house"><span>${i("heatpump_power")}</span><b>${Te(r,n.power)}</b></div>`:f}
|
||||
${n.heat!==null?p`<div class="live-row live-heat"><span>${i("heatpump_heat")}</span><b>${He(r,n.heat)}</b></div>`:f}
|
||||
${n.power!==null?p`<div class="live-row live-house"><span>${i("heatpump_power")}</span><b>${He(r,n.power)}</b></div>`:f}
|
||||
${n.outside!==null?p`<div class="live-status">🌡 ${i("heatpump_outside")} ${o(n.outside)}</div>`:f}
|
||||
</div>
|
||||
</div>`}function ef(r,e,t){let n=(o,s,a)=>o===null?"\u2013":`${W(r,o,s)} ${a}`,i=Object.values(e.sources??{}).some(o=>cn(r,o).length>0);return p`<div class="live-card live-card-roomclimate ${i?"live-climate-trends":""}" data-i=${t} data-room=${e.roomId} role="group" aria-label=${`${e.name||$(r,"room")} \xB7 ${$(r,"climate")}`}>
|
||||
${e.showTemperature?p`<div class="live-row live-climate-temperature"><span title=${$(r,"climate_temperature")} aria-label=${$(r,"climate_temperature")}>🌡</span><b>${n(e.temperature===null?null:r?ae(r,e.temperature):e.temperature,1,r?re(r):"\xB0C")}</b>${j(r,e.sources?.temperature??[],$(r,"climate_temperature"))}</div>`:f}
|
||||
${e.showHumidity?p`<div class="live-row live-climate-humidity"><span title=${$(r,"climate_humidity")} aria-label=${$(r,"climate_humidity")}>💧</span><b>${n(e.humidity,0,"%")}</b>${j(r,e.sources?.humidity??[],$(r,"climate_humidity"))}</div>`:f}
|
||||
${e.showCo2?p`<div class="live-row live-climate-co2"><span title=${$(r,"climate_co2")} aria-label=${$(r,"climate_co2")}>☁</span><b>${n(e.co2,0,"ppm")}</b>${j(r,e.sources?.co2??[],$(r,"climate_co2"))}</div>`:f}
|
||||
${e.showIlluminance?p`<div class="live-row live-climate-illuminance"><span title=${$(r,"climate_illuminance")} aria-label=${$(r,"climate_illuminance")}>☀</span><b>${n(e.illuminance,0,"lx")}</b>${j(r,e.sources?.illuminance??[],$(r,"climate_illuminance"))}</div>`:f}
|
||||
</div>`}function Yu(r,e,t,n,i=!1){return e.length?p`<div class="live-cards">
|
||||
${e.map((o,s)=>o.kind==="roomclimate"?ef(r,o,s):i?f:o.kind==="house"?jp(r,o,s,n):o.kind==="car"?Yp(r,o,s,t):o.kind==="printer"?Qp(r,o,s):o.kind==="heatpump"?Xp(r,o,s):Jp(r,o,s,t))}
|
||||
</div>`:f}var Ju=X`
|
||||
</div>`}function nf(r,e,t){let n=(o,s,a)=>o===null?"\u2013":`${W(r,o,s)} ${a}`,i=Object.values(e.sources??{}).some(o=>mn(r,o).length>0);return p`<div class="live-card live-card-roomclimate ${i?"live-climate-trends":""}" data-i=${t} data-room=${e.roomId} role="group" aria-label=${`${e.name||$(r,"room")} \xB7 ${$(r,"climate")}`}>
|
||||
${e.showTemperature?p`<div class="live-row live-climate-temperature"><span title=${$(r,"climate_temperature")} aria-label=${$(r,"climate_temperature")}>🌡</span><b>${n(e.temperature===null?null:r?ae(r,e.temperature):e.temperature,1,r?re(r):"\xB0C")}</b>${U(r,e.sources?.temperature??[],$(r,"climate_temperature"))}</div>`:f}
|
||||
${e.showHumidity?p`<div class="live-row live-climate-humidity"><span title=${$(r,"climate_humidity")} aria-label=${$(r,"climate_humidity")}>💧</span><b>${n(e.humidity,0,"%")}</b>${U(r,e.sources?.humidity??[],$(r,"climate_humidity"))}</div>`:f}
|
||||
${e.showCo2?p`<div class="live-row live-climate-co2"><span title=${$(r,"climate_co2")} aria-label=${$(r,"climate_co2")}>☁</span><b>${n(e.co2,0,"ppm")}</b>${U(r,e.sources?.co2??[],$(r,"climate_co2"))}</div>`:f}
|
||||
${e.showIlluminance?p`<div class="live-row live-climate-illuminance"><span title=${$(r,"climate_illuminance")} aria-label=${$(r,"climate_illuminance")}>☀</span><b>${n(e.illuminance,0,"lx")}</b>${U(r,e.sources?.illuminance??[],$(r,"climate_illuminance"))}</div>`:f}
|
||||
</div>`}function Qu(r,e,t,n,i=!1){return e.length?p`<div class="live-cards">
|
||||
${e.map((o,s)=>o.kind==="roomclimate"?nf(r,o,s):i?f:o.kind==="house"?Zp(r,o,s,n):o.kind==="car"?Qp(r,o,s,t):o.kind==="printer"?ef(r,o,s):o.kind==="heatpump"?tf(r,o,s):Xp(r,o,s,t))}
|
||||
</div>`:f}var Xu=Y`
|
||||
.live-cards {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
@@ -1285,7 +1285,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
`;function Gr(r){return r.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var Ro=r=>r.points.length>=3;function Qu(r,e,t){return r.rooms.filter(Ro).find(n=>I([e,t],n.points))}function tf(r,e,t,n){let i=[];for(let a of e.rooms.filter(Ro)){let[l,u]=Ae(a.points);i.push({kind:"room",name:a.name,where:n?e.name:"",floorId:e.id,roomId:a.id,entity:null,icon:null,x:l,z:u,y:0})}let o=new Set,s=(a,l,u,c)=>{if(o.has(a)||!(a in r.states))return;o.add(a);let d=Qu(e,l,u),m=[d?.name,n?e.name:void 0].filter(h=>!!h).join(" \xB7 ");i.push({kind:"device",name:L(r,a),where:m,floorId:e.id,roomId:d?.id??null,entity:a,icon:H(a),x:l,z:u,y:c})};for(let a of e.placements){let l=a.y??Et(H(a.entity_id)??"sensor",ve(e,a.x,a.z),a.mount);s(a.entity_id,a.x,a.z,l)}for(let a of e.furniture){let l=t.get(a.id),u=l?.entity??l?.power;if(!u)continue;let c=ve(e,a.x,a.z)-.3;s(u,a.x,a.z,Math.min(c,Math.max(.5,a.h)))}for(let a of e.notes??[]){if(!a.text)continue;let l=Qu(e,a.x,a.z),u=[l?.name,n?e.name:void 0].filter(c=>!!c).join(" \xB7 ");i.push({kind:"note",name:`\u270E ${a.text.length>60?`${a.text.slice(0,59)}\u2026`:a.text}`,where:u,floorId:e.id,roomId:l?.id??null,entity:null,icon:null,x:a.x,z:a.z,y:1.3})}return i}function Xu(r,e){let t=ht(r,e.floors),n=e.floors.length>1,i=e.floors.flatMap(o=>tf(r,o,t,n));for(let o of e.settings.circuits??[]){let s=e.floors.flatMap(d=>d.rooms.filter(m=>o.rooms.includes(m.id)&&Ro(m)).map(m=>({f:d,r:m})));if(!s.length)continue;let[{f:a,r:l}]=s,[u,c]=Ae(l.points);i.push({kind:"circuit",name:`\u{1F50C} ${o.name}`,where:s.map(d=>d.r.name).join(", "),floorId:a.id,roomId:l.id,entity:null,icon:null,x:u,z:c,y:0})}return i}function nf(r,e){return(Gr(r.name).startsWith(e)?0:2)+(r.kind==="room"?0:1)}function ec(r,e,t=8){let n=Gr(e).split(/\s+/).filter(Boolean);if(n.length===0)return[];let i=Gr(e.trim());return r.filter(o=>{let s=Gr([o.name,o.where,o.entity].filter(Boolean).join(" "));return n.every(a=>s.includes(a))}).map(o=>({item:o,cost:nf(o,i)})).sort((o,s)=>o.cost-s.cost||o.item.name.localeCompare(s.item.name)).slice(0,t).map(o=>o.item)}var rf=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[190,90,255],[255,95,210],[255,70,70],[120,255,150]],of=[2200,2700,3200,4e3,5e3,6500],sf=["hs","rgb","rgbw","rgbww","xy"],af=4,tc=16,nc=32,lf=128;function To(r){let e=r.attributes.supported_color_modes??[],t=e.some(n=>sf.includes(n));return{dim:e.some(n=>n!=="onoff"),color:t,temp:e.includes("color_temp")}}function Do(r){return((r.attributes.supported_features??0)&af)!==0&&typeof r.attributes.current_position=="number"}var zo=class extends ee{static properties={hass:{attribute:!1},entity:{attribute:!1},car:{attribute:!1},presets:{attribute:!1},confirmSwitch:{type:Boolean},myPosition:{attribute:!1},tiltEntity:{attribute:!1},low:{type:Boolean,reflect:!0}};t(e,t){return $(this.hass,e,t)}ask(){return!this.confirmSwitch||confirm(this.t("confirm_switch",{name:L(this.hass,this.entity)}))}call(e,t,n={}){this.hass.callService(e,t,{entity_id:this.entity,...n})}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}details(){ye(this,this.entity),this.close()}ring(e){let t=e.length;return e.map((n,i)=>{let o=i/t*Math.PI*2-Math.PI/2;return p`<div class="qm-at" style="left:${50+Math.cos(o)*39}%;top:${50+Math.sin(o)*39}%">${n}</div>`})}renderLight(e){let t=To(e),n=e.state==="on",i=n&&typeof e.attributes.brightness=="number"?Math.round(e.attributes.brightness/2.55):n?100:0,o=t.color?rf.map(s=>p`<button class="qm-swatch" style="background:rgb(${s.join(",")})" aria-label=${`RGB ${s.join(", ")}`} @click=${()=>this.call("light","turn_on",{rgb_color:s})}></button>`):t.temp?of.map(s=>p`<button class="qm-swatch" style="background:${uf(s)}" aria-label=${`${s} K`} @click=${()=>this.call("light","turn_on",{color_temp_kelvin:s})}></button>`):[];return p`<div class="qm-ring ${o.length?"":"qm-ring-small"}">
|
||||
`;function jr(r){return r.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var To=r=>r.points.length>=3;function ec(r,e,t){return r.rooms.filter(To).find(n=>I([e,t],n.points))}function rf(r,e,t,n){let i=[];for(let a of e.rooms.filter(To)){let[l,u]=Ae(a.points);i.push({kind:"room",name:a.name,where:n?e.name:"",floorId:e.id,roomId:a.id,entity:null,icon:null,x:l,z:u,y:0})}let o=new Set,s=(a,l,u,c)=>{if(o.has(a)||!(a in r.states))return;o.add(a);let d=ec(e,l,u),m=[d?.name,n?e.name:void 0].filter(h=>!!h).join(" \xB7 ");i.push({kind:"device",name:L(r,a),where:m,floorId:e.id,roomId:d?.id??null,entity:a,icon:H(a),x:l,z:u,y:c})};for(let a of e.placements){let l=a.y??Dt(H(a.entity_id)??"sensor",ve(e,a.x,a.z),a.mount);s(a.entity_id,a.x,a.z,l)}for(let a of e.furniture){let l=t.get(a.id),u=l?.entity??l?.power;if(!u)continue;let c=ve(e,a.x,a.z)-.3;s(u,a.x,a.z,Math.min(c,Math.max(.5,a.h)))}for(let a of e.notes??[]){if(!a.text)continue;let l=ec(e,a.x,a.z),u=[l?.name,n?e.name:void 0].filter(c=>!!c).join(" \xB7 ");i.push({kind:"note",name:`\u270E ${a.text.length>60?`${a.text.slice(0,59)}\u2026`:a.text}`,where:u,floorId:e.id,roomId:l?.id??null,entity:null,icon:null,x:a.x,z:a.z,y:1.3})}return i}function tc(r,e){let t=gt(r,e.floors),n=e.floors.length>1,i=e.floors.flatMap(o=>rf(r,o,t,n));for(let o of e.settings.circuits??[]){let s=e.floors.flatMap(d=>d.rooms.filter(m=>o.rooms.includes(m.id)&&To(m)).map(m=>({f:d,r:m})));if(!s.length)continue;let[{f:a,r:l}]=s,[u,c]=Ae(l.points);i.push({kind:"circuit",name:`\u{1F50C} ${o.name}`,where:s.map(d=>d.r.name).join(", "),floorId:a.id,roomId:l.id,entity:null,icon:null,x:u,z:c,y:0})}return i}function of(r,e){return(jr(r.name).startsWith(e)?0:2)+(r.kind==="room"?0:1)}function nc(r,e,t=8){let n=jr(e).split(/\s+/).filter(Boolean);if(n.length===0)return[];let i=jr(e.trim());return r.filter(o=>{let s=jr([o.name,o.where,o.entity].filter(Boolean).join(" "));return n.every(a=>s.includes(a))}).map(o=>({item:o,cost:of(o,i)})).sort((o,s)=>o.cost-s.cost||o.item.name.localeCompare(s.item.name)).slice(0,t).map(o=>o.item)}var sf=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[190,90,255],[255,95,210],[255,70,70],[120,255,150]],af=[2200,2700,3200,4e3,5e3,6500],lf=["hs","rgb","rgbw","rgbww","xy"],uf=4,rc=16,ic=32,cf=128;function Fo(r){let e=r.attributes.supported_color_modes??[],t=e.some(n=>lf.includes(n));return{dim:e.some(n=>n!=="onoff"),color:t,temp:e.includes("color_temp")}}function Ho(r){return((r.attributes.supported_features??0)&uf)!==0&&typeof r.attributes.current_position=="number"}var Do=class extends Q{static properties={hass:{attribute:!1},entity:{attribute:!1},car:{attribute:!1},presets:{attribute:!1},confirmSwitch:{type:Boolean},myPosition:{attribute:!1},tiltEntity:{attribute:!1},low:{type:Boolean,reflect:!0}};t(e,t){return $(this.hass,e,t)}ask(){return!this.confirmSwitch||confirm(this.t("confirm_switch",{name:L(this.hass,this.entity)}))}call(e,t,n={}){this.hass.callService(e,t,{entity_id:this.entity,...n})}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}details(){ye(this,this.entity),this.close()}ring(e){let t=e.length;return e.map((n,i)=>{let o=i/t*Math.PI*2-Math.PI/2;return p`<div class="qm-at" style="left:${50+Math.cos(o)*39}%;top:${50+Math.sin(o)*39}%">${n}</div>`})}renderLight(e){let t=Fo(e),n=e.state==="on",i=n&&typeof e.attributes.brightness=="number"?Math.round(e.attributes.brightness/2.55):n?100:0,o=t.color?sf.map(s=>p`<button class="qm-swatch" style="background:rgb(${s.join(",")})" aria-label=${`RGB ${s.join(", ")}`} @click=${()=>this.call("light","turn_on",{rgb_color:s})}></button>`):t.temp?af.map(s=>p`<button class="qm-swatch" style="background:${df(s)}" aria-label=${`${s} K`} @click=${()=>this.call("light","turn_on",{color_temp_kelvin:s})}></button>`):[];return p`<div class="qm-ring ${o.length?"":"qm-ring-small"}">
|
||||
${this.ring(o)}
|
||||
<button class="qm-power ${n?"qm-on":""}" aria-pressed=${n} @click=${()=>this.ask()&&this.call("light","toggle")}>
|
||||
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M12 3v8M6.3 6.8a8 8 0 1 0 11.4 0" /></svg>
|
||||
@@ -1300,7 +1300,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.value=${String(Math.max(1,i))}
|
||||
aria-label=${this.t("brightness")}
|
||||
@change=${s=>this.call("light","turn_on",{brightness_pct:Number(s.target.value)})}
|
||||
/>`:f}`}renderCover(e){e=mr(this.hass,e,this.tiltEntity);let t=typeof e.attributes.current_position=="number"?e.attributes.current_position:null,n=e.state==="opening"||e.state==="closing",i=Do(e),o=(c,d,m,h=!1)=>p`<button class="qm-swatch qm-slot ${h?"qm-slot-on":""}" aria-label=${d} @click=${m}>${c}</button>`,s=c=>t!==null&&Math.abs(t-c)<3,a=[o("\u25B2",this.t("cover_open"),()=>this.ask()&&this.call("cover","open_cover"),s(100)),...i?[75,50].map(c=>o(`${c}`,`${c} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:c}),s(c))):[],o("\u25BC",this.t("cover_close"),()=>this.ask()&&this.call("cover","close_cover"),s(0)),...i?[25].map(c=>o(`${c}`,`${c} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:c}),s(c))):[],...Number(e.attributes.supported_features??0)&8?[o("\u25A0",this.t("cover_stop"),()=>this.call("cover","stop_cover"),n)]:[],...this.myPosition!=null&&(i||Number(e.attributes.supported_features??0)&8)?[o("My",this.t("cover_my_go",{p:this.myPosition}),()=>this.ask()&&(i?this.call("cover","set_cover_position",{position:this.myPosition}):this.call("cover","stop_cover")),s(this.myPosition))]:[]],l=t===null?e.state==="closed"?100:0:100-t,u=t!==null||n||e.state==="open"||e.state==="closed";return p`<div class="qm-ring">
|
||||
/>`:f}`}renderCover(e){e=gr(this.hass,e,this.tiltEntity);let t=typeof e.attributes.current_position=="number"?e.attributes.current_position:null,n=e.state==="opening"||e.state==="closing",i=Ho(e),o=(c,d,m,h=!1)=>p`<button class="qm-swatch qm-slot ${h?"qm-slot-on":""}" aria-label=${d} @click=${m}>${c}</button>`,s=c=>t!==null&&Math.abs(t-c)<3,a=[o("\u25B2",this.t("cover_open"),()=>this.ask()&&this.call("cover","open_cover"),s(100)),...i?[75,50].map(c=>o(`${c}`,`${c} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:c}),s(c))):[],o("\u25BC",this.t("cover_close"),()=>this.ask()&&this.call("cover","close_cover"),s(0)),...i?[25].map(c=>o(`${c}`,`${c} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:c}),s(c))):[],...Number(e.attributes.supported_features??0)&8?[o("\u25A0",this.t("cover_stop"),()=>this.call("cover","stop_cover"),n)]:[],...this.myPosition!=null&&(i||Number(e.attributes.supported_features??0)&8)?[o("My",this.t("cover_my_go",{p:this.myPosition}),()=>this.ask()&&(i?this.call("cover","set_cover_position",{position:this.myPosition}):this.call("cover","stop_cover")),s(this.myPosition))]:[]],l=t===null?e.state==="closed"?100:0:100-t,u=t!==null||n||e.state==="open"||e.state==="closed";return p`<div class="qm-ring">
|
||||
${this.ring(a)}
|
||||
<button
|
||||
class="qm-power qm-blind ${u&&l<100?"qm-on":""}"
|
||||
@@ -1322,7 +1322,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
aria-label=${this.t("position")}
|
||||
@change=${c=>this.call("cover","set_cover_position",{position:Number(c.target.value)})}
|
||||
/>`:f}
|
||||
${this.renderTilt(e)}`}renderTilt(e){let t=(e.attributes.supported_features??0)|0,n=typeof e.attributes.current_tilt_position=="number"?e.attributes.current_tilt_position:null;return t&lf&&n!==null?p`<label class="qm-tilt"
|
||||
${this.renderTilt(e)}`}renderTilt(e){let t=(e.attributes.supported_features??0)|0,n=typeof e.attributes.current_tilt_position=="number"?e.attributes.current_tilt_position:null;return t&cf&&n!==null?p`<label class="qm-tilt"
|
||||
><span>${this.t("cover_tilt")} · ${Math.round(n)} %</span>
|
||||
<input
|
||||
class="qm-slider"
|
||||
@@ -1332,9 +1332,9 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.value=${String(n)}
|
||||
aria-label=${this.t("cover_tilt")}
|
||||
@change=${i=>this.call("cover","set_cover_tilt_position",{entity_id:e.attributes.nf_cover_control?this.entity:this.tiltEntity||this.entity,tilt_position:Number(i.target.value)})}
|
||||
/></label>`:t&(tc|nc)?p`<div class="qm-tilt-buttons">
|
||||
${t&tc?p`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","open_cover_tilt")}>${this.t("cover_tilt_open")}</button>`:f}
|
||||
${t&nc?p`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","close_cover_tilt")}>${this.t("cover_tilt_close")}</button>`:f}
|
||||
/></label>`:t&(rc|ic)?p`<div class="qm-tilt-buttons">
|
||||
${t&rc?p`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","open_cover_tilt")}>${this.t("cover_tilt_open")}</button>`:f}
|
||||
${t&ic?p`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","close_cover_tilt")}>${this.t("cover_tilt_close")}</button>`:f}
|
||||
</div>`:f}renderToggle(e){let t=e.state==="on"||e.state==="unlocked"||e.state==="playing",n=e.entity_id.split(".")[0];return p`<div class="qm-ring qm-ring-small">
|
||||
<button
|
||||
class="qm-power ${t?"qm-on":""}"
|
||||
@@ -1356,11 +1356,11 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${s.length?p`<div class="qm-play-head">${this.t("media_sources")}</div>
|
||||
<div class="qm-play">${s.map(d=>p`<button class="qm-chip ${i.source===d?"qm-chip-on":""}" @click=${()=>this.call("media_player","select_source",{source:d})}>${d}</button>`)}</div>`:f}
|
||||
${this.presets?.length?p`<div class="qm-play-head">${this.t("presets")}</div>
|
||||
<div class="qm-play">${this.presets.map(d=>p`<button class="qm-chip" @click=${()=>this.call("media_player","play_media",{media_content_type:d.type,media_content_id:d.content})}>${d.label}</button>`)}</div>`:f}`}render(){let e=this.hass?.states[this.entity];if(!e)return f;let t=H(this.entity),n=N(e)&&!rn(e)?p`<p class="qm-note">${oe(this.hass,e)}</p>`:t==="light"?this.renderLight(e):t==="cover"?this.renderCover(e):t==="media"?this.renderMedia(e):this.renderToggle(e);return p`<div class="qm" role="dialog" aria-label=${L(this.hass,this.entity)}>
|
||||
<div class="qm-play">${this.presets.map(d=>p`<button class="qm-chip" @click=${()=>this.call("media_player","play_media",{media_content_type:d.type,media_content_id:d.content})}>${d.label}</button>`)}</div>`:f}`}render(){let e=this.hass?.states[this.entity];if(!e)return f;let t=H(this.entity),n=N(e)&&!an(e)?p`<p class="qm-note">${oe(this.hass,e)}</p>`:t==="light"?this.renderLight(e):t==="cover"?this.renderCover(e):t==="media"?this.renderMedia(e):this.renderToggle(e);return p`<div class="qm" role="dialog" aria-label=${L(this.hass,this.entity)}>
|
||||
<div class="qm-title">${L(this.hass,this.entity)}</div>
|
||||
${n}
|
||||
<button class="qm-details" @click=${()=>this.details()}>${this.t("details")} …</button>
|
||||
</div>`}static styles=[ge,X`
|
||||
</div>`}static styles=[ge,Y`
|
||||
.qm-play-head {
|
||||
margin: 10px 0 4px;
|
||||
font-size: 11px;
|
||||
@@ -1603,9 +1603,43 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.qm-note {
|
||||
color: var(--nf-muted);
|
||||
}
|
||||
`]};function uf(r){let e=Math.min(1,Math.max(0,(r-2200)/4300)),t=(n,i)=>Math.round(n+(i-n)*e);return`rgb(${t(255,200)},${t(170,225)},${t(80,255)})`}customElements.get("nf-quick-menu")||customElements.define("nf-quick-menu",zo);var cf=new URL(import.meta.url),df=new URL("./nextfloor-3d.js?v=74227cd20cc3",cf).href,rc;function ic(){return rc??=import(df),rc}function oc(r){if(!r||r.state!=="on")return 0;let e=typeof r.attributes.percentage=="number"?r.attributes.percentage:60;return e<=0?0:.2+.6*Math.min(100,e)/100}var sc="weather.nextfloor_symcon",lc={condition:"Wetterzustand",temperature:"Au\xDFentemperatur",humidity:"Au\xDFenluftfeuchte",pressure:"Luftdruck",wind_speed:"Windgeschwindigkeit",wind_gust_speed:"Windb\xF6en",wind_bearing:"Windrichtung",cloud_coverage:"Bew\xF6lkung",precipitation:"Niederschlagsrate",precipitation_total:"Niederschlagsmenge",illuminance:"Au\xDFenhelligkeit",uv_index:"UV-Index",visibility:"Sichtweite",snow:"Schnee",fog:"Nebel",lightning:"Gewitter"},ac=new WeakMap;function hf(r){let e=r.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").trim();return["sunny","clear-night","partlycloudy","cloudy","fog","rainy","pouring","lightning-rainy","lightning","hail","snowy","snowy-rainy","windy","windy-variant"].includes(e)?e:/kein regen|trocken|wolkenlos|klar|sonnig/.test(e)?"sunny":/gewitter|blitz/.test(e)?"lightning-rainy":/schneeregen/.test(e)?"snowy-rainy":/schnee/.test(e)?"snowy":/hagel/.test(e)?"hail":/starkregen/.test(e)?"pouring":/regen|niesel/.test(e)?"rainy":/nebel/.test(e)?"fog":/teil.*wolk|heiter|leicht.*wolk/.test(e)?"partlycloudy":/wolk|bedeckt/.test(e)?"cloudy":/wind|sturm/.test(e)?"windy":null}function Ur(r,e){if(!G(r))return r;let t=e.weather_variables??{};if(!e.rain_sensor&&!Object.values(t).some(h=>h&&h!=="none"))return r;let n=ac.get(r)??new WeakMap;ac.set(r,n);let i=n.get(e);if(i)return i;let o={friendly_name:"Wetter",nf_symcon_weather:!0},s=h=>t[h]&&t[h]!=="none"?r.states[t[h]]:void 0;for(let h of["temperature","humidity","pressure","cloud_coverage","precipitation","precipitation_total","illuminance","uv_index","visibility"]){let g=s(h),_=Ne(g);_!==null&&(o[h]=h==="cloud_coverage"&&g?.attributes.symcon_max===1?_*100:_),g?.attributes.unit_of_measurement&&(o[`${h}_unit`]=g.attributes.unit_of_measurement)}for(let h of["wind_speed","wind_gust_speed"]){let g=s(h),_=Ne(g);_!==null&&(o[h]=Nr(_,g?.attributes.unit_of_measurement))}o.wind_speed_unit="km/h";let a=Je(s("wind_bearing"));a!==null&&(o.wind_bearing=a);let l=hf(Qe(s("condition"))),u=e.rain_sensor?r.states[e.rain_sensor]:void 0,c=se(u);c!==null&&e.rain_sensor_inverted&&(c=!c),c===null&&typeof o.precipitation=="number"&&(c=o.precipitation>0),se(s("lightning"))?l=c?"lightning-rainy":"lightning":se(s("snow"))?l=c?"snowy-rainy":"snowy":se(s("fog"))?l="fog":c===!0?l=Number(o.precipitation??0)>=8?"pouring":"rainy":c===!1&&l&&/rain|pouring/.test(l)&&(l=null),!l&&typeof o.cloud_coverage=="number"&&(l=o.cloud_coverage>70?"cloudy":o.cloud_coverage>20?"partlycloudy":"sunny"),!l&&c===!1&&(l="sunny");let d={entity_id:sc,state:l??"unknown",attributes:o},m={...r,states:{...r.states,[sc]:d}};return n.set(e,m),m}var mf=new Set(["on","home","open","true","active","playing","heat","heating"]);function jr(r,e){let t=e.show_when;if(!t?.entity||!r)return!0;let n=r.states[t.entity];if(!n||N(n))return!0;let i=String(n.state).toLowerCase(),o=(t.state??"").split(",").map(a=>a.trim().toLowerCase()).filter(Boolean),s=o.length?o.includes(i):mf.has(i)||Number.isFinite(Number(i))&&Number(i)>0;return t.invert?!s:s}function Fo(r,e){let t=[];for(let n of e.floors)for(let i of n.furniture)jr(r,i)||t.push(i.id);return t.sort()}function uc(r,e){if(!e.length)return r;let t=new Set(e);return{...r,floors:r.floors.map(n=>n.furniture.some(i=>t.has(i.id))?{...n,furniture:n.furniture.filter(i=>!t.has(i.id))}:n)}}var cc="image:";function Ho(r,e,t){let n=(e??"").trim();if(!n)return null;if(n.startsWith(cc))return t(n.slice(cc.length));if(/^(https?:\/\/|\/)/.test(n))return n;if(/^[a-z_]+\.[a-z0-9_]+$/.test(n)){let i=r?.states[n]?.attributes.entity_picture;return typeof i=="string"&&i?i:null}return null}var Tn=r=>Number(r);function Fn(r){if(Array.isArray(r)){let[o,s]=[Tn(r[0]),Tn(r[1])];return Number.isFinite(o)&&Number.isFinite(s)?[o,s]:null}if(!r||typeof r!="object")return null;let{x:e,y:t}=r,[n,i]=[Tn(e),Tn(t)];return Number.isFinite(n)&&Number.isFinite(i)?[n,i]:null}function dc(r){return r?Fn(r.charger)??Fn(r.charger_position):null}function hc(r){for(let[e,t]of Object.entries(r.states))if(e.startsWith("camera.")&&(Fn(t.attributes?.vacuum_position)??dc(t.attributes)))return e;return null}var pf=r=>Array.isArray(r)?typeof r[0]=="number":!!r&&typeof r=="object",Dn=(r,e)=>e?[r[0],-r[1]]:r;function ff(r){if(!r)return null;let e=r.mirror===!0,[t,n]=Dn(r.ga,e),[i,o]=Dn(r.gb,e),[s,a]=r.a,[l,u]=r.b,[c,d]=[i-t,o-n],[m,h]=[l-s,u-a],g=Math.hypot(c,d),_=Math.hypot(m,h);if(!(g>1e-6)||!(_>1e-6))return null;let b=_/g,v=Math.atan2(h,m)-Math.atan2(d,c),[S,k]=[Math.cos(
Line truncated
|
||||
`]};function df(r){let e=Math.min(1,Math.max(0,(r-2200)/4300)),t=(n,i)=>Math.round(n+(i-n)*e);return`rgb(${t(255,200)},${t(170,225)},${t(80,255)})`}customElements.get("nf-quick-menu")||customElements.define("nf-quick-menu",Do);var hf=new URL(import.meta.url),mf=new URL("./nextfloor-3d.js?v=74227cd20cc3",hf).href,oc;function sc(){return oc??=import(mf),oc}function ac(r){if(!r||r.state!=="on")return 0;let e=typeof r.attributes.percentage=="number"?r.attributes.percentage:60;return e<=0?0:.2+.6*Math.min(100,e)/100}var lc="weather.nextfloor_symcon",cc={condition:"Wetterzustand",temperature:"Au\xDFentemperatur",humidity:"Au\xDFenluftfeuchte",pressure:"Luftdruck",wind_speed:"Windgeschwindigkeit",wind_gust_speed:"Windb\xF6en",wind_bearing:"Windrichtung",cloud_coverage:"Bew\xF6lkung",precipitation:"Niederschlagsrate",precipitation_total:"Niederschlagsmenge",illuminance:"Au\xDFenhelligkeit",uv_index:"UV-Index",visibility:"Sichtweite",snow:"Schnee",fog:"Nebel",lightning:"Gewitter"},uc=new WeakMap;function pf(r){let e=r.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").trim();return["sunny","clear-night","partlycloudy","cloudy","fog","rainy","pouring","lightning-rainy","lightning","hail","snowy","snowy-rainy","windy","windy-variant"].includes(e)?e:/kein regen|trocken|wolkenlos|klar|sonnig/.test(e)?"sunny":/gewitter|blitz/.test(e)?"lightning-rainy":/schneeregen/.test(e)?"snowy-rainy":/schnee/.test(e)?"snowy":/hagel/.test(e)?"hail":/starkregen/.test(e)?"pouring":/regen|niesel/.test(e)?"rainy":/nebel/.test(e)?"fog":/teil.*wolk|heiter|leicht.*wolk/.test(e)?"partlycloudy":/wolk|bedeckt/.test(e)?"cloudy":/wind|sturm/.test(e)?"windy":null}function qr(r,e){if(!K(r))return r;let t=e.weather_variables??{};if(!e.rain_sensor&&!Object.values(t).some(h=>h&&h!=="none"))return r;let n=uc.get(r)??new WeakMap;uc.set(r,n);let i=n.get(e);if(i)return i;let o={friendly_name:"Wetter",nf_symcon_weather:!0},s=h=>t[h]&&t[h]!=="none"?r.states[t[h]]:void 0;for(let h of["temperature","humidity","pressure","cloud_coverage","precipitation","precipitation_total","illuminance","uv_index","visibility"]){let g=s(h),_=Le(g);_!==null&&(o[h]=h==="cloud_coverage"&&g?.attributes.symcon_max===1?_*100:_),g?.attributes.unit_of_measurement&&(o[`${h}_unit`]=g.attributes.unit_of_measurement)}for(let h of["wind_speed","wind_gust_speed"]){let g=s(h),_=Le(g);_!==null&&(o[h]=Wr(_,g?.attributes.unit_of_measurement))}o.wind_speed_unit="km/h";let a=tt(s("wind_bearing"));a!==null&&(o.wind_bearing=a);let l=pf(nt(s("condition"))),u=e.rain_sensor?r.states[e.rain_sensor]:void 0,c=se(u);c!==null&&e.rain_sensor_inverted&&(c=!c),c===null&&typeof o.precipitation=="number"&&(c=o.precipitation>0),se(s("lightning"))?l=c?"lightning-rainy":"lightning":se(s("snow"))?l=c?"snowy-rainy":"snowy":se(s("fog"))?l="fog":c===!0?l=Number(o.precipitation??0)>=8?"pouring":"rainy":c===!1&&l&&/rain|pouring/.test(l)&&(l=null),!l&&typeof o.cloud_coverage=="number"&&(l=o.cloud_coverage>70?"cloudy":o.cloud_coverage>20?"partlycloudy":"sunny"),!l&&c===!1&&(l="sunny");let d={entity_id:lc,state:l??"unknown",attributes:o},m={...r,states:{...r.states,[lc]:d}};return n.set(e,m),m}var Po=class extends Q{static properties={hass:{attribute:!1},floors:{attribute:!1},floorId:{attribute:!1},inline:{type:Boolean,reflect:!0},compact:{type:Boolean},folded:{state:!0}};constructor(){super(),this.floors=[],this.floorId=null,this.inline=!1,this.compact=!1,this.folded=null}value(e){return e?p`<span class="value" title=${`${Nt(e)}${e.manual?" \xB7 eigener Stockwerksz\xE4hler":""}`}><b>${De(this.hass,e)}</b>${e.period!=="total"?p`<small>${{day:"heute",month:"Monat",year:"Jahr"}[e.period]}</small>`:f}${U(this.hass,e.sources,`${ze[e.kind]} \xB7 ${Nt(e)}`)}</span>`:f}open(e,t){this.dispatchEvent(new CustomEvent("utility-open",{detail:{floorId:t?this.floorId:e,roomId:t?e:null},bubbles:!0,composed:!0}))}render(){if(!this.hass)return f;let e=this.floors.flatMap(s=>s.rooms),t=this.floors.find(s=>s.id===this.floorId);if(this.inline){let s=t?Te(this.hass,t,e):tl(this.hass,this.floors);return p`${Je.map(a=>{let l=s.filter(u=>u.kind===a);return l.length?p`<div class="meter" aria-label=${`${t?.name||"Gesamtgeb\xE4ude"} \xB7 ${ze[a]}`}><span class="medium" title=${t?.name||"Gesamtgeb\xE4ude"}>${pn[a]} ${ze[a]}</span><div class="values">${l.map(u=>this.value(u))}</div></div>`:f})}`}let i=(t?t.rooms.map(s=>({id:s.id,name:s.name,readings:rt(this.hass,s,e)})):[...this.floors].sort((s,a)=>a.elevation-s.elevation).map(s=>({id:s.id,name:s.name,readings:Te(this.hass,s,e)}))).filter(s=>s.readings.length);if(!i.length)return f;let o=this.folded??this.compact;return p`<section class="panel" aria-label=${t?"Bereichsz\xE4hler":"Stockwerksz\xE4hler"}>
|
||||
<button class="heading" aria-expanded=${!o} @click=${()=>{this.folded=!o}}><span>${t?"Bereiche":"Stockwerke"}<small>${t?.name||"Gesamtgeb\xE4ude"}</small></span><span aria-hidden="true">${o?"+":"\u2212"}</span></button>
|
||||
${o?f:p`<div class="entries"><div class="columns"><span></span><span title="Leistung bzw. Durchfluss">Leistung</span><span>Energie / Verbrauch</span></div>
|
||||
${i.map(s=>p`<section class="entry"><button class="entry-name" title=${s.name} @click=${()=>this.open(s.id,!!t)}>${s.name}</button>
|
||||
${Je.map(a=>{let l=s.readings.filter(c=>c.kind===a&&c.metric==="power"),u=s.readings.filter(c=>c.kind===a&&c.metric==="energy");return Array.from({length:Math.max(l.length,u.length)},(c,d)=>p`<div class="row"><span class="kind" title=${ze[a]}>${d?"":`${pn[a]} ${ze[a]}`}</span>${l[d]?this.value(l[d]):p`<span></span>`}${u[d]?this.value(u[d]):p`<span></span>`}</div>`)})}
|
||||
</section>`)}
|
||||
</div>`}
|
||||
</section>`}static styles=Y`
|
||||
:host { display:flex; width:100%; min-height:0; max-height:100%; color:var(--nf-text); font:12px/1.4 system-ui,sans-serif; pointer-events:auto; }
|
||||
:host([inline]) { display:flex; flex-wrap:wrap; align-items:stretch; gap:6px; width:auto; max-width:100%; }
|
||||
.meter { padding:5px 9px; border-radius:10px; background:var(--nf-chrome); border-left:2px solid var(--nf-line); backdrop-filter:blur(6px); }
|
||||
.medium { font-size:11px; color:var(--nf-muted); }
|
||||
.medium small { font-size:10px; }
|
||||
.values { display:flex; flex-wrap:wrap; gap:3px 10px; }
|
||||
.value { display:inline-flex; align-items:center; justify-content:flex-end; gap:3px; min-width:0; white-space:nowrap; font-variant-numeric:tabular-nums; }
|
||||
.value b { font-size:12px; font-weight:600; }
|
||||
.value small { color:var(--nf-muted); font-size:9px; }
|
||||
nf-trend-button { margin-left:0; }
|
||||
.panel { display:flex; flex-direction:column; box-sizing:border-box; width:100%; max-height:100%; border:1px solid var(--nf-line); border-radius:12px; background:var(--nf-chrome); backdrop-filter:blur(8px); overflow:hidden; }
|
||||
button { color:inherit; font:inherit; border:0; background:none; cursor:pointer; text-align:left; }
|
||||
button:focus-visible { outline:2px solid var(--nf-accent); outline-offset:-2px; }
|
||||
.heading { display:flex; flex-shrink:0; align-items:center; justify-content:space-between; gap:12px; width:100%; padding:8px 10px; font-weight:600; }
|
||||
.heading small { display:block; color:var(--nf-muted); font-size:10px; font-weight:normal; }
|
||||
.entries { min-height:0; max-height:min(50vh,480px); overflow:auto; padding:0 10px 8px; }
|
||||
.columns,.row { display:grid; grid-template-columns:54px minmax(0,1fr) minmax(0,1.2fr); align-items:center; gap:5px; }
|
||||
.columns { color:var(--nf-muted); font-size:9px; text-align:right; margin-bottom:2px; }
|
||||
.entry { border-top:1px solid var(--nf-line); padding:6px 0; }
|
||||
.entry:last-child { padding-bottom:0; }
|
||||
.entry-name { display:block; width:100%; padding:0 0 3px; font-size:11px; font-weight:600; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
|
||||
.entry-name:hover { color:var(--nf-accent); }
|
||||
.row { min-height:20px; }
|
||||
.kind { color:var(--nf-muted); font-size:10px; white-space:nowrap; }
|
||||
.row .value b { font-size:11px; font-weight:normal; }
|
||||
@media(max-width:600px) { .entries { max-height:32vh; } }
|
||||
`};customElements.get("nf-utility-overview")||customElements.define("nf-utility-overview",Po);var ff=new Set(["on","home","open","true","active","playing","heat","heating"]);function Zr(r,e){let t=e.show_when;if(!t?.entity||!r)return!0;let n=r.states[t.entity];if(!n||N(n))return!0;let i=String(n.state).toLowerCase(),o=(t.state??"").split(",").map(a=>a.trim().toLowerCase()).filter(Boolean),s=o.length?o.includes(i):ff.has(i)||Number.isFinite(Number(i))&&Number(i)>0;return t.invert?!s:s}function Io(r,e){let t=[];for(let n of e.floors)for(let i of n.furniture)Zr(r,i)||t.push(i.id);return t.sort()}function dc(r,e){if(!e.length)return r;let t=new Set(e);return{...r,floors:r.floors.map(n=>n.furniture.some(i=>t.has(i.id))?{...n,furniture:n.furniture.filter(i=>!t.has(i.id))}:n)}}var hc="image:";function No(r,e,t){let n=(e??"").trim();if(!n)return null;if(n.startsWith(hc))return t(n.slice(hc.length));if(/^(https?:\/\/|\/)/.test(n))return n;if(/^[a-z_]+\.[a-z0-9_]+$/.test(n)){let i=r?.states[n]?.attributes.entity_picture;return typeof i=="string"&&i?i:null}return null}var Hn=r=>Number(r);function In(r){if(Array.isArray(r)){let[o,s]=[Hn(r[0]),Hn(r[1])];return Number.isFinite(o)&&Number.isFinite(s)?[o,s]:null}if(!r||typeof r!="object")return null;let{x:e,y:t}=r,[n,i]=[Hn(e),Hn(t)];return Number.isFinite(n)&&Number.isFinite(i)?[n,i]:null}function mc(r){return r?In(r.charger)??In(r.charger_position):null}function pc(r){for(let[e,t]of Object.entries(r.states))if(e.startsWith("camera.")&&(In(t.attributes?.vacuum_position)??mc(t.attributes)))return e;return null}var gf=r=>Array.isArray(r)?typeof r[0]=="number":!!r&&typeof r=="object",Pn=(r,e)=>e?[r[0],-r[1]]:r;function _f(r){if(!r)return null;let e=r.mirror===!0,[t,n]=Pn(r.ga,e),[i,o]=Pn(r.gb,e),[s,a]=r.a,[l,u]=r.b,[c,d]=[i-t,o-n],[m,h]=[l-s,u-a],g=Math.hypot(c,d),_=Math.hypot(m,h);if(!(g>1e-6)||!(_>1e-6))return null;let b=_/g,v=Math.atan2(h,m)-Math.atan2(d,c),[S,k]=[Math.cos(v),Math.sin(v)];return M=>{let z=Pn(M,e),[R,F]=[z[0]-t,z[1]-n];return[s+b*(R*S-F*k),a+b*(R*k+F*S)]}}function bf(r){if(!r)return null;let e=r.mirror===!0,[t,n]=Pn(r.ga,e),[i,o]=Pn(r.gb,e),s=Math.atan2(r.b[1]-r.a[1],r.b[0]-r.a[0])-Math.atan2(o-n,i-t);return Number.isFinite(s)?s:null}function fc(r,e,t){if(!e)return null;let n=r.states[e]?.attributes;if(!n)return null;let i=_f(t)??(g=>g),o=bf(t)??0,s=t?.mirror===!0?-1:1,a=n.vacuum_position,l=In(a),u=l?(()=>{let[g,_]=i(l),b=Hn(a?.a)*s;if(!Number.isFinite(b))return{x:g,z:_,heading:0};let v=b*Math.PI/180+o;return{x:g,z:_,heading:Math.atan2(Math.cos(v),Math.sin(v))}})():null,c=mc(n),d=Array.isArray(n.path)?n.path:[],m=d.length>0&&gf(d[0])?[d]:d,h=[];for(let g of m){let _=[];for(let b of Array.isArray(g)?g:[]){let v=In(b);v&&_.push(i(v))}_.length>1&&h.push(_)}return!u&&!c&&!h.length?null:{pose:u,charger:c?i(c):null,path:h}}var gc="nextfloor.lock3d",_c=520,Wo=class extends Q{static properties={hass:{attribute:!1},building:{attribute:!1},floorId:{attribute:!1},roomId:{attribute:!1},wallMode:{attribute:!1},solidWalls:{attribute:!1},glassWalls:{attribute:!1},explode:{type:Boolean},keepRoof:{attribute:!1},markerMode:{attribute:!1},markerNames:{attribute:!1},markersOutside:{attribute:!1},tapInRoom:{type:Boolean},roomDoubleTap:{attribute:!1},heatMode:{attribute:!1},theme:{attribute:!1},accent:{attribute:!1},furnitureColors:{attribute:!1},packs:{attribute:!1},showEnergy:{attribute:!1},flows:{attribute:!1},holograms:{attribute:!1},furnish:{type:Boolean},surfaceGrab:{attribute:!1},furnishTypes:{attribute:!1},weather:{type:Boolean},weatherEntityId:{attribute:!1},weatherDensity:{attribute:!1},timeOfDay:{attribute:!1},selectedFurniture:{attribute:!1},selectedDevice:{attribute:!1},_sky:{state:!0},quality:{attribute:!1},showStats:{type:Boolean},_stats:{state:!0},_error:{state:!0},_energy:{state:!0},_flows:{state:!0},_liveEnergy:{state:!0},_liveCards:{state:!0},_liveCardOn:{state:!0},_houseFolded:{state:!0},_swipe:{state:!0},_menu:{state:!0},_pluginWindow:{state:!0},_plate:{state:!0},_blend:{state:!0},_wallBig:{state:!0},_find:{state:!0},_central:{state:!0},_thumbsCompact:{state:!0},_armed:{state:!0},central:{attribute:!1},centralOpen:{attribute:!1},keepCamera:{attribute:!1},plain:{attribute:!1},rightBack:{attribute:!1},templateName:{attribute:!1},readable:{type:Boolean,reflect:!0},today:{attribute:!1},_todayOpen:{state:!0},_todayItems:{state:!0},_forecast:{state:!0},zoom:{attribute:!1},buttons:{attribute:!1},_thumbs:{state:!0},floorThumbs:{attribute:!1},clean:{attribute:!1},cleanButton:{attribute:!1},clock:{attribute:!1},lockButton:{attribute:!1},walkButton:{attribute:!1},travelButton:{attribute:!1},_travel:{state:!0},_walking:{state:!0},_stick:{state:!0},_locked:{state:!0},_now:{state:!0},roomLabels:{attribute:!1},roomNamesButton:{attribute:!1},floorStack:{attribute:!1},panelOpen:{attribute:!1},alerts:{attribute:!1},alertJump:{attribute:!1},scenes:{attribute:!1},announcements:{attribute:!1},sensorBar:{attribute:!1},screenName:{attribute:!1},_announcement:{state:!0},dimmed:
Line truncated
|
||||
${e.map(t=>p`<button class="nf-chip" aria-pressed=${!this.hiddenLayers.has(t.id)} @click=${()=>this.toggleLayer(t.id)}>${this.hiddenLayers.has(t.id)?"\u25CC":"\u{1F441}"} ${t.name}</button>`)}
|
||||
</div>`}syncDevices(e){let t=this.viewer,n=this.building;if(!t||!n||!this.hass)return;let i=this._travel,o=i&&!i.loading?Nt(this.hass,i.history,i.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==o.entities)&&(this.openingLinks=He(o,n.floors),this.furnitureLinks=ht(o,n.floors),this.linkedRegistry=o.entities,this.findIndex=null,this.alertSrc=this.alerts?nu(o,n,this.weatherEntityId,this.openingLinks):null,this.watched=uu({hass:o,building:n,openingLinks:this.openingLinks,furnitureLinks:this.furnitureLinks,needsRoomSensors:this.heatMode!=="none"||this.roomLabels,alertSources:this.alertSrc,weatherEntityId:this.weatherEntityId}),e=!0),!(e||this.watched.some(y=>this.shownStates.get(y)!==o.states[y])))return;Fo(o,n).join(",")!==this.shownFor?.key&&t.setBuilding(this.shownBuilding(o)),this.shownStates=new Map(this.watched.map(y=>[y,o.states[y]])),this.refreshToday(n),this.refreshForecast(n);let a=fn(o,n),l=Da(o,n.floors.some(y=>y.layer&&this.hiddenLayers.has(y.id))?this.shownBuilding(o):n);this.placementInfo=new Map(l.map(y=>[y.id,{floorId:y.floorId,roomId:y.roomId,x:y.x,z:y.z,y:y.y,rotation:y.rotation??0}]));let u=this.furnitureMarkers(o,n,new Set(l.map(y=>y.id)),new Set(a.map(y=>y.powerEntity)));a.push(...u.consumers);let c=gn(o,n,a,Le(n,y=>this.furnitureLinks?.get(y.id)?.power??null)),d=new Map(a.filter(y=>y.id!==y.powerEntity).map(y=>[y.id,y.power]));this.confirmSet=mt(o,n.floors);let m=new Set(this.liveCardsOn?this._liveCards.flatMap(y=>y.kind==="media"?[y.media.entity]:y.kind==="car"?[y.spot]:[]):[]);for(let y of n.floors)for(let w of y.outdoor??[]){if(!w.area_id&&!w.temp_entity&&!w.pump_entity)continue;let B=w.temp_entity?o.states[w.temp_entity]:void 0,D=w.pump_entity?o.states[w.pump_entity]:void 0,[O,pe]=Ae(w.points),rt=B&&Number.isFinite(Number(B.state))?`${W(o,ae(o,ir(Number(B.state),B.attributes.unit_of_measurement)),1)} ${re(o)}`:"",vt=!!D&&te(D);l.push({id:w.area_id?`outdoor:${w.id}`:w.pump_entity??w.temp_entity,floorId:y.id,roomId:null,x:O,z:pe,y:Qn(y,w,O,pe)+.7,icon:Ee(w.type==="pool"?"pool":w.type==="terrace"?"table-chair":"tree-outline"),name:w.area_id&&o.areas?.[w.area_id]?.name||$(o,`out_${w.type}`),text:[rt,vt?$(o,"pool_pump_on"):""].filter(Boolean).join(" \xB7 "),active:vt,unavailable:!1,glow:null,show:"always"})}let h=new Map;for(let y of n.floors){for(let w of y.placements)w.pin_offset&&h.set(`${y.id}:${w.entity_id}`,w.pin_offset);for(let w of y.furniture)w.pin_offset&&h.set(`f:${w.id}`,w.pin_offset)}let g=y=>{let w=y.lamp?void 0:(y.furnitureId?h.get(`f:${y.furnitureId}`):void 0)??h.get(`${y.floorId}:${y.id}`);return w?{...y,x:y.x+(w.x??0),z:y.z+(w.z??0),y:y.y+(w.y??0)}:y};t.setDevices([...[...l,...u.markers].map(g).map(y=>{let w=y.show==="no_power"||"energyDevice"in y&&y.energyDevice?null:d.get(y.id)??null,B={...y,power:w,powerText:w===null?void 0:ce(o,w),effect:this.dimmed?void 0:y.effect,text:this.subMeterText(o,n,c,y.furnitureId)??y.text},D=y.ownName&&(y.showName||this.markerNames)?y.ownName:"",O=m.has(y.id)||!!y.furnitureId&&m.has(y.furnitureId);return{...B,pin:this.showPin(B)&&!O,full:y.show==="always",caption:D}})]),t.setPickTargets(u.targets,this.openingTargets(),this.secondBlinds()),t.setScreens(u.screens),t.setFridgeDoors(ma(o,n.floors)),t.setCovers(Sa(o,n)),t.setRobots(this.robotInfos(o,n));let _=new Map;for(let y of n.floors)for(let w of y.furniture)!J(w.type)?.pet||!w.room_sensor||w.room_sensor==="none"||_.set(w.id,Di(o,y.rooms.filter(B=>B.points.length>=3),null,w.room_sensor)?.id??null);_.size&&t.setPetRooms(_),t.setRoofWindows(Jl(o,n)),t.setParked(mo(o,n)),t.setGateStates(fu(o,n));let b=new Map(n.floors.flatMap(y=>y.openings.map(w=>[w.id,w.type]))),v=new Map([...this.openingLinks].map(([y,w])=>[y,Pe(o,w,b.get(y))]));t.setOpeningStates(v),this.setAlerts(this.alertSrc?uo(o,n,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(o);let S=[...l,...u.markers].map(y=>`${y.id}:${y.glow?`${y.glow.level.toFixed(1)}/${y.glow.color.map(w=>w.toFixed(1)).join("/")}`:0}`).join(";")+"|"+[...v].map(([y,w])=>`${y}:${w.open}:${w.cover===null?"-":w.cover.toFixed(1)}`).join(";");if(S!==this.thumbSig){let y=this.thumbSig==="";this.thumbSig=S,y||this.scheduleThumbs(1500)}let k=Ru(o,n,a,n.energy.advanced?y=>this.furnitureLinks?.get(y.id)?.power??null:void 0),M=this.liveCars(o,n);for(let y of M){if(!y.car.home||!y.car.charging&&!y.car.plugged)continue;let w=n.floors.flatMap(O=>O.furniture.filter(pe=>pe.type==="wallbox").map(pe=>({floorId:O.id,x:pe.x,z:pe.z,y:1}))).sort((O,pe)=>Math.hypot(O.x-y.at.x,O.z-y.at.z)-Math.hypot(pe.x-y.at.x,pe.z-y.at.z))[0],B=w&&w.floorId===y.at.floorId&&Math.hypot(w.x-y.at.x,w.z-y.at.z)<9,D=w??An(n);!D||!y.car.charging&&!B||k.arcs.push({key:`car:${y.spot}`,from:D,to:{...y.at,y:.8},power:y.car.charging?y.car.chargingW??7e3:0,color:[80,175,255],...B?{via:[{...D,y:.35},{floorId:y.at.floorId,x:(D.x+y.at.x)/2,z:(D.z+y.at.z)/2,y:.08},{...y.at,y:.5}],cable:!0}:{}})}let z=An(n);for(let y of this.liveHeatPumps(n)){let w=y.pump.heat??(y.pump.mode==="heating"||y.pLine truncated
|
||||
</div>`}syncDevices(e){let t=this.viewer,n=this.building;if(!t||!n||!this.hass)return;let i=this._travel,o=i&&!i.loading?Ot(this.hass,i.history,i.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==o.entities)&&(this.openingLinks=Ne(o,n.floors),this.furnitureLinks=gt(o,n.floors),this.linkedRegistry=o.entities,this.findIndex=null,this.alertSrc=this.alerts?iu(o,n,this.weatherEntityId,this.openingLinks):null,this.watched=du({hass:o,building:n,openingLinks:this.openingLinks,furnitureLinks:this.furnitureLinks,needsRoomSensors:this.heatMode!=="none"||this.roomLabels,alertSources:this.alertSrc,weatherEntityId:this.weatherEntityId}),e=!0),!(e||this.watched.some(y=>this.shownStates.get(y)!==o.states[y])))return;Io(o,n).join(",")!==this.shownFor?.key&&t.setBuilding(this.shownBuilding(o)),this.shownStates=new Map(this.watched.map(y=>[y,o.states[y]])),this.refreshToday(n),this.refreshForecast(n);let a=bn(o,n),l=Pa(o,n.floors.some(y=>y.layer&&this.hiddenLayers.has(y.id))?this.shownBuilding(o):n);this.placementInfo=new Map(l.map(y=>[y.id,{floorId:y.floorId,roomId:y.roomId,x:y.x,z:y.z,y:y.y,rotation:y.rotation??0}]));let u=this.furnitureMarkers(o,n,new Set(l.map(y=>y.id)),new Set(a.map(y=>y.powerEntity)));a.push(...u.consumers);let c=vn(o,n,a,Ve(n,y=>this.furnitureLinks?.get(y.id)?.power??null)),d=new Map(a.filter(y=>y.id!==y.powerEntity).map(y=>[y.id,y.power]));this.confirmSet=_t(o,n.floors);let m=new Set(this.liveCardsOn?this._liveCards.flatMap(y=>y.kind==="media"?[y.media.entity]:y.kind==="car"?[y.spot]:[]):[]);for(let y of n.floors)for(let w of y.outdoor??[]){if(!w.area_id&&!w.temp_entity&&!w.pump_entity)continue;let B=w.temp_entity?o.states[w.temp_entity]:void 0,D=w.pump_entity?o.states[w.pump_entity]:void 0,[O,pe]=Ae(w.points),at=B&&Number.isFinite(Number(B.state))?`${W(o,ae(o,ar(Number(B.state),B.attributes.unit_of_measurement)),1)} ${re(o)}`:"",kt=!!D&&te(D);l.push({id:w.area_id?`outdoor:${w.id}`:w.pump_entity??w.temp_entity,floorId:y.id,roomId:null,x:O,z:pe,y:tr(y,w,O,pe)+.7,icon:Ee(w.type==="pool"?"pool":w.type==="terrace"?"table-chair":"tree-outline"),name:w.area_id&&o.areas?.[w.area_id]?.name||$(o,`out_${w.type}`),text:[at,kt?$(o,"pool_pump_on"):""].filter(Boolean).join(" \xB7 "),active:kt,unavailable:!1,glow:null,show:"always"})}let h=new Map;for(let y of n.floors){for(let w of y.placements)w.pin_offset&&h.set(`${y.id}:${w.entity_id}`,w.pin_offset);for(let w of y.furniture)w.pin_offset&&h.set(`f:${w.id}`,w.pin_offset)}let g=y=>{let w=y.lamp?void 0:(y.furnitureId?h.get(`f:${y.furnitureId}`):void 0)??h.get(`${y.floorId}:${y.id}`);return w?{...y,x:y.x+(w.x??0),z:y.z+(w.z??0),y:y.y+(w.y??0)}:y};t.setDevices([...[...l,...u.markers].map(g).map(y=>{let w=y.show==="no_power"||"energyDevice"in y&&y.energyDevice?null:d.get(y.id)??null,B={...y,power:w,powerText:w===null?void 0:ce(o,w),effect:this.dimmed?void 0:y.effect,text:this.subMeterText(o,n,c,y.furnitureId)??y.text},D=y.ownName&&(y.showName||this.markerNames)?y.ownName:"",O=m.has(y.id)||!!y.furnitureId&&m.has(y.furnitureId);return{...B,pin:this.showPin(B)&&!O,full:y.show==="always",caption:D}})]),t.setPickTargets(u.targets,this.openingTargets(),this.secondBlinds()),t.setScreens(u.screens),t.setFridgeDoors(ga(o,n.floors)),t.setCovers(Aa(o,n)),t.setRobots(this.robotInfos(o,n));let _=new Map;for(let y of n.floors)for(let w of y.furniture)!X(w.type)?.pet||!w.room_sensor||w.room_sensor==="none"||_.set(w.id,Hi(o,y.rooms.filter(B=>B.points.length>=3),null,w.room_sensor)?.id??null);_.size&&t.setPetRooms(_),t.setRoofWindows(Xl(o,n)),t.setParked(fo(o,n)),t.setGateStates(_u(o,n));let b=new Map(n.floors.flatMap(y=>y.openings.map(w=>[w.id,w.type]))),v=new Map([...this.openingLinks].map(([y,w])=>[y,Ce(o,w,b.get(y))]));t.setOpeningStates(v),this.setAlerts(this.alertSrc?ho(o,n,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(o);let S=[...l,...u.markers].map(y=>`${y.id}:${y.glow?`${y.glow.level.toFixed(1)}/${y.glow.color.map(w=>w.toFixed(1)).join("/")}`:0}`).join(";")+"|"+[...v].map(([y,w])=>`${y}:${w.open}:${w.cover===null?"-":w.cover.toFixed(1)}`).join(";");if(S!==this.thumbSig){let y=this.thumbSig==="";this.thumbSig=S,y||this.scheduleThumbs(1500)}let k=Tu(o,n,a,n.energy.advanced?y=>this.furnitureLinks?.get(y.id)?.power??null:void 0),M=this.liveCars(o,n);for(let y of M){if(!y.car.home||!y.car.charging&&!y.car.plugged)continue;let w=n.floors.flatMap(O=>O.furniture.filter(pe=>pe.type==="wallbox").map(pe=>({floorId:O.id,x:pe.x,z:pe.z,y:1}))).sort((O,pe)=>Math.hypot(O.x-y.at.x,O.z-y.at.z)-Math.hypot(pe.x-y.at.x,pe.z-y.at.z))[0],B=w&&w.floorId===y.at.floorId&&Math.hypot(w.x-y.at.x,w.z-y.at.z)<9,D=w??zn(n);!D||!y.car.charging&&!B||k.arcs.push({key:`car:${y.spot}`,from:D,to:{...y.at,y:.8},power:y.car.charging?y.car.chargingW??7e3:0,color:[80,175,255],...B?{via:[{...D,y:.35},{floorId:y.at.floorId,x:(D.x+y.at.x)/2,z:(D.z+y.at.z)/2,y:.08},{...y.at,y:.5}],cable:!0}:{}})}let z=zn(n);for(let y of this.liveHeatPumps(n)){let w=y.pump.heat??(y.pump.mode==="heating"||y.pLine truncated
|
||||
<button class="nf-thumbs-fold" title=${$(this.hass,n?"thumbs_show":"thumbs_fold")} aria-label=${$(this.hass,n?"thumbs_show":"thumbs_fold")} @click=${i}>${n?"\u25B8":"\u25C2"}</button>
|
||||
<button class="nf-thumb nf-thumb-house" aria-pressed=${this.floorId===null} @click=${()=>this.fire("floor-tap",{floorId:null})}>
|
||||
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"><path d="M3 11l9-7 9 7M5 10v10h14V10" /></svg>
|
||||
@@ -1615,16 +1649,16 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${n?f:p`<img src=${o.url} alt="" />`}
|
||||
<span>${e.get(o.floorId)??""}</span>
|
||||
</button>`)}
|
||||
</nav>`}onDeviceHold(e,t,n){let i=H(e);i==="light"||i==="cover"||i==="switch"||i==="fan"||i==="lock"?this._menu={entity:e,x:t,y:n}:ye(this,e)}onDeviceSwipe(e,t,n,i,o){let s=this.hass?.states[e];if(t==="start"){if(!s||N(s)||this.confirmSet.has(e))return!1;let l=H(e);if(l==="light"&&To(s).dim){let u=s.state==="on"?typeof s.attributes.brightness=="number"?Math.round(s.attributes.brightness/2.55):100:0;return this._swipe={entity:e,kind:"light",start:u,value:u,x:i,y:o},!0}if(l==="fan"&&typeof s.attributes.percentage_step=="number"){let u=s.state==="on"&&typeof s.attributes.percentage=="number"?s.attributes.percentage:0;return this._swipe={entity:e,kind:"fan",start:u,value:u,x:i,y:o},!0}if(l==="cover"&&Do(s)){let u=s.attributes.current_position;return this._swipe={entity:e,kind:"cover",start:u,value:u,x:i,y:o},!0}return!1}let a=this._swipe;if(!a||a.entity!==e)return!1;if(t==="move"){let l=Math.round(Math.min(100,Math.max(0,a.start-n/220*100)));l!==a.value&&(this._swipe={...a,value:l});let u=performance.now();u-this.swipeSent>350&&(this.swipeSent=u,this.applySwipe())}else this.applySwipe(),clearTimeout(this.swipeTimer),this.swipeTimer=setTimeout(()=>this._swipe=null,700);return!0}applySwipe(){let e=this._swipe;!e||!this.hass||(e.kind==="light"?e.value<=0?this.hass.callService("light","turn_off",{entity_id:e.entity}):this.hass.callService("light","turn_on",{entity_id:e.entity,brightness_pct:e.value}):e.kind==="fan"?e.value<=0?this.hass.callService("fan","turn_off",{entity_id:e.entity}):this.hass.callService("fan","set_percentage",{entity_id:e.entity,percentage:e.value}):this.hass.callService("cover","set_cover_position",{entity_id:e.entity,position:e.value}))}openRoom(e,t){this.floorId===e&&this.roomId===t||(this.floorId!==e?(this.fire("floor-tap",{floorId:e}),setTimeout(()=>this.fire("room-tap",{floorId:e,roomId:t}),60)):this.fire("room-tap",{floorId:e,roomId:t}))}goTo(e){if(this._find=null,e.kind==="room"||e.kind==="circuit"){e.roomId&&this.openRoom(e.floorId,e.roomId);return}this.floorId!==e.floorId&&this.fire("floor-tap",{floorId:e.floorId}),setTimeout(()=>this.viewer?.focus(e.floorId,e.x,e.z,e.y,e.entity),120)}listenToAnnouncements(e){if(!e){this.stopAnnouncements?.(),this.stopAnnouncements=null,clearTimeout(this.announceTimer);return}if(this.stopAnnouncements)return;let t=!1;this.stopAnnouncements=()=>t=!0,Oa(this.hass,n=>this.announce(n)).then(n=>{t?n():this.stopAnnouncements=n})}announce(e){let t=e;if(t?.reload===!0){(!t.template||t.template===this.templateName)&&setTimeout(()=>location.reload(),500+Math.random()*6e3);return}if(typeof e?.message!="string"||!e.message.trim()||!Na(e,this.screenName)||!Ca(e))return;let n=Wa(e.message);this._announcement={message:e.message,until:Date.now()+n},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,n),La(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?p`<button class="nf-announcement" role="alert" title=${$(this.hass,"close")} @click=${()=>this._announcement=null}>
|
||||
</nav>`}onDeviceHold(e,t,n){let i=H(e);i==="light"||i==="cover"||i==="switch"||i==="fan"||i==="lock"?this._menu={entity:e,x:t,y:n}:ye(this,e)}onDeviceSwipe(e,t,n,i,o){let s=this.hass?.states[e];if(t==="start"){if(!s||N(s)||this.confirmSet.has(e))return!1;let l=H(e);if(l==="light"&&Fo(s).dim){let u=s.state==="on"?typeof s.attributes.brightness=="number"?Math.round(s.attributes.brightness/2.55):100:0;return this._swipe={entity:e,kind:"light",start:u,value:u,x:i,y:o},!0}if(l==="fan"&&typeof s.attributes.percentage_step=="number"){let u=s.state==="on"&&typeof s.attributes.percentage=="number"?s.attributes.percentage:0;return this._swipe={entity:e,kind:"fan",start:u,value:u,x:i,y:o},!0}if(l==="cover"&&Ho(s)){let u=s.attributes.current_position;return this._swipe={entity:e,kind:"cover",start:u,value:u,x:i,y:o},!0}return!1}let a=this._swipe;if(!a||a.entity!==e)return!1;if(t==="move"){let l=Math.round(Math.min(100,Math.max(0,a.start-n/220*100)));l!==a.value&&(this._swipe={...a,value:l});let u=performance.now();u-this.swipeSent>350&&(this.swipeSent=u,this.applySwipe())}else this.applySwipe(),clearTimeout(this.swipeTimer),this.swipeTimer=setTimeout(()=>this._swipe=null,700);return!0}applySwipe(){let e=this._swipe;!e||!this.hass||(e.kind==="light"?e.value<=0?this.hass.callService("light","turn_off",{entity_id:e.entity}):this.hass.callService("light","turn_on",{entity_id:e.entity,brightness_pct:e.value}):e.kind==="fan"?e.value<=0?this.hass.callService("fan","turn_off",{entity_id:e.entity}):this.hass.callService("fan","set_percentage",{entity_id:e.entity,percentage:e.value}):this.hass.callService("cover","set_cover_position",{entity_id:e.entity,position:e.value}))}openRoom(e,t){this.floorId===e&&this.roomId===t||(this.floorId!==e?(this.fire("floor-tap",{floorId:e}),setTimeout(()=>this.fire("room-tap",{floorId:e,roomId:t}),60)):this.fire("room-tap",{floorId:e,roomId:t}))}goTo(e){if(this._find=null,e.kind==="room"||e.kind==="circuit"){e.roomId&&this.openRoom(e.floorId,e.roomId);return}this.floorId!==e.floorId&&this.fire("floor-tap",{floorId:e.floorId}),setTimeout(()=>this.viewer?.focus(e.floorId,e.x,e.z,e.y,e.entity),120)}listenToAnnouncements(e){if(!e){this.stopAnnouncements?.(),this.stopAnnouncements=null,clearTimeout(this.announceTimer);return}if(this.stopAnnouncements)return;let t=!1;this.stopAnnouncements=()=>t=!0,Ka(this.hass,n=>this.announce(n)).then(n=>{t?n():this.stopAnnouncements=n})}announce(e){let t=e;if(t?.reload===!0){(!t.template||t.template===this.templateName)&&setTimeout(()=>location.reload(),500+Math.random()*6e3);return}if(typeof e?.message!="string"||!e.message.trim()||!La(e,this.screenName)||!Oa(e))return;let n=Ba(e.message);this._announcement={message:e.message,until:Date.now()+n},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,n),Va(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?p`<button class="nf-announcement" role="alert" title=${$(this.hass,"close")} @click=${()=>this._announcement=null}>
|
||||
<span class="nf-announcement-icon" aria-hidden="true">📢</span><span class="nf-announcement-text">${e.message}</span>
|
||||
</button>`:f}renderAlerts(){let e=this.building;if(!this._alerts.length||!e)return f;let t=this._alerts.slice(0,3);return p`<div class="nf-alert-banner" role="alert">
|
||||
${t.map(n=>p`<button class="nf-alert nf-alert-${n.kind}" style=${n.color?`border-left-color:${n.color}`:""} title=${co(this.hass,e,n)} @click=${()=>this.jumpTo(n)}>${co(this.hass,e,n)}</button>`)}
|
||||
${t.map(n=>p`<button class="nf-alert nf-alert-${n.kind}" style=${n.color?`border-left-color:${n.color}`:""} title=${mo(this.hass,e,n)} @click=${()=>this.jumpTo(n)}>${mo(this.hass,e,n)}</button>`)}
|
||||
${this._alerts.length>3?p`<span class="nf-alert-more">+${this._alerts.length-3}</span>`:f}
|
||||
</div>`}renderScenes(){let e=this.building;if(!this.scenes||!this.roomId||this.panelOpen||!e||!this.hass)return f;let t=e.floors.flatMap(o=>o.rooms).find(o=>o.id===this.roomId),n=t?K(this.hass,t).filter(o=>H(o)==="scene"||H(o)==="script").slice(0,6):[];if(!n.length)return f;let i=t?.area_id?this.hass.areas?.[t.area_id]?.name:void 0;return p`<div class="nf-scenes">
|
||||
</div>`}renderScenes(){let e=this.building;if(!this.scenes||!this.roomId||this.panelOpen||!e||!this.hass)return f;let t=e.floors.flatMap(o=>o.rooms).find(o=>o.id===this.roomId),n=t?G(this.hass,t).filter(o=>H(o)==="scene"||H(o)==="script").slice(0,6):[];if(!n.length)return f;let i=t?.area_id?this.hass.areas?.[t.area_id]?.name:void 0;return p`<div class="nf-scenes">
|
||||
${n.map(o=>p`<button class="nf-chip" aria-pressed=${this._sceneFired===o} @click=${()=>this.runScene(o)}>${L(this.hass,o,i)}</button>`)}
|
||||
</div>`}renderFind(){let e=this.building;if(!e||!this.hass)return f;if(this._find===null)return p`<button class="nf-find-btn" title=${$(this.hass,"find")} aria-label=${$(this.hass,"find")} @click=${()=>this._find=""}>
|
||||
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="6.5" /><path d="M16 16l4.5 4.5" /></svg>
|
||||
</button>`;let t=ec(this.findIndex??=Xu(this.hass,e),this._find);return p`<div class="nf-find">
|
||||
</button>`;let t=nc(this.findIndex??=tc(this.hass,e),this._find);return p`<div class="nf-find">
|
||||
<input
|
||||
type="search"
|
||||
placeholder=${$(this.hass,"find_placeholder")}
|
||||
@@ -1635,7 +1669,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
<button class="nf-find-close" aria-label=${$(this.hass,"close")} @click=${()=>this._find=null}>✕</button>
|
||||
${this._find.trim()?p`<div class="nf-find-list">
|
||||
${t.length?t.map(n=>p`<button @click=${()=>this.goTo(n)}>
|
||||
<span class="nf-find-icon"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d=${n.icon?gr(n.icon):"M4 10l8-6 8 6v10H4z"} /></svg></span>
|
||||
<span class="nf-find-icon"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d=${n.icon?vr(n.icon):"M4 10l8-6 8 6v10H4z"} /></svg></span>
|
||||
<span><b>${n.name}</b>${n.where?p`<small>${n.where}</small>`:f}</span>
|
||||
</button>`):p`<p>${$(this.hass,"find_none")}</p>`}
|
||||
</div>`:f}
|
||||
@@ -1647,7 +1681,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
@click=${()=>{this._central=!this._central,this._armed=null}}
|
||||
>
|
||||
<svg viewBox="0 0 24 24" width="19" height="19" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linejoin="round"><path d="M12 3.5l2.6 5.3 5.9.9-4.3 4.1 1 5.8L12 16.9l-5.2 2.7 1-5.8-4.3-4.1 5.9-.9z" /></svg>
|
||||
</button>`;if(!this._central)return i;let o=this.floorId?e.floors.find(b=>b.id===this.floorId):void 0,s=o?[o]:e.floors,a=s.flatMap(b=>Fi(t,b).lights),l=s.flatMap(b=>Fi(t,b).covers),u=a.filter(b=>t.states[b]?.state==="on").length,c=!o,d=(b,v,S,k)=>{if(k.length){if(c&&this._armed!==b){this._armed=b,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(v,S,{entity_id:k})}},m=(b,v,S,k,M)=>p`<button class="nf-btn ${this._armed===b?"nf-central-armed":""}" ?disabled=${!M.length} @click=${()=>d(b,S,k,M)}>
|
||||
</button>`;if(!this._central)return i;let o=this.floorId?e.floors.find(b=>b.id===this.floorId):void 0,s=o?[o]:e.floors,a=s.flatMap(b=>Pi(t,b).lights),l=s.flatMap(b=>Pi(t,b).covers),u=a.filter(b=>t.states[b]?.state==="on").length,c=!o,d=(b,v,S,k)=>{if(k.length){if(c&&this._armed!==b){this._armed=b,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(v,S,{entity_id:k})}},m=(b,v,S,k,M)=>p`<button class="nf-btn ${this._armed===b?"nf-central-armed":""}" ?disabled=${!M.length} @click=${()=>d(b,S,k,M)}>
|
||||
${this._armed===b?n("central_sure"):n(v)}
|
||||
</button>`,h=e.settings.favorite_floors??{},g=(e.settings.favorites??[]).filter(b=>t.states[b]&&(!h[b]||!o||h[b]===o.id)),_=this.buttons??e.settings.buttons??[];return p`${i}
|
||||
<div class="nf-central ${this.centralOpen?"nf-central-big":""}" role="dialog" aria-label=${n("central")}>
|
||||
@@ -1664,7 +1698,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
</div>`:f}
|
||||
<b>${n("central_favorites")}</b>
|
||||
${g.length?p`<div class="nf-central-favs">
|
||||
${g.map(b=>{let[v,S]=ba(b),k=t.states[b],M=v==="homeassistant"&&k?.state==="on";return p`<button
|
||||
${g.map(b=>{let[v,S]=wa(b),k=t.states[b],M=v==="homeassistant"&&k?.state==="on";return p`<button
|
||||
class="nf-chip"
|
||||
aria-pressed=${M||this._sceneFired===b}
|
||||
?disabled=${N(k)}
|
||||
@@ -1676,13 +1710,13 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${_.length?p`<div class="nf-central-favs">
|
||||
${_.map(b=>p`<button
|
||||
class="nf-chip nf-own-btn"
|
||||
aria-pressed=${va(t,b)}
|
||||
@click=${v=>{Hi(t,v.currentTarget,b),b.action!=="service"&&(this._central=!1)}}
|
||||
aria-pressed=${xa(t,b)}
|
||||
@click=${v=>{Ii(t,v.currentTarget,b),b.action!=="service"&&(this._central=!1)}}
|
||||
>
|
||||
${b.icon?p`<ha-icon .icon=${b.icon.startsWith("mdi:")?b.icon:`mdi:${b.icon}`}></ha-icon>`:f}${b.label}
|
||||
</button>`)}
|
||||
</div>`:f}
|
||||
</div>`}toggleLock(){this._locked=!this._locked;try{localStorage.setItem(pc,this._locked?"1":"0")}catch{}}async openTravel(e){if(clearInterval(this.travelTimer),this.travelTimer=void 0,e===null||!this.hass){this._travel=null,this.syncDevices(!0);return}let t=Date.now(),n=t-e*36e5;this._travel={history:new Map,from:n,to:t,t:n,playing:!1,speed:e>24?3600:600,hours:e,moments:[],loading:!0};try{let i=await vn(this.hass,Ol(this.watched),n,t);if(!this._travel||this._travel.from!==n)return;this._travel={...this._travel,history:i,moments:Bl(i,n,t),loading:!1}}catch{this._travel=null,this._error=$(this.hass,"travel_failed");return}this.syncDevices(!0)}travelTo(e){let t=this._travel;t&&(this._travel={...t,t:Math.min(t.to,Math.max(t.from,e))},this.syncDevices(!0))}playTravel(e){let t=this._travel;t&&(clearInterval(this.travelTimer),this.travelTimer=void 0,this._travel={...t,playing:e,t:e&&t.t>=t.to?t.from:t.t},e&&(this.travelTimer=setInterval(()=>{let n=this._travel;if(!n)return;let i=n.t+250*n.speed;i>=n.to&&this.playTravel(!1),this.travelTo(i)},250)))}renderTravel(){if(!this.hass||this.clean)return f;let e=a=>$(this.hass,a),t=this._travel;if(!t)return this.travelButton?p`<button class="nf-travel-btn" title=${e("travel")} aria-label=${e("travel")} @click=${()=>{this.openTravel(24)}}>⏪</button>`:f;let n=this.hass.language??navigator.language,i=new Intl.DateTimeFormat(n,{weekday:"short",hour:"2-digit",minute:"2-digit"}).format(new Date(t.t)),o=t.to-t.from||1,s=[[60,"travel_speed_min"],[600,"travel_speed_10min"],[3600,"travel_speed_hour"]];return p`<div class="nf-travel" role="group" aria-label=${e("travel")}>
|
||||
</div>`}toggleLock(){this._locked=!this._locked;try{localStorage.setItem(gc,this._locked?"1":"0")}catch{}}async openTravel(e){if(clearInterval(this.travelTimer),this.travelTimer=void 0,e===null||!this.hass){this._travel=null,this.syncDevices(!0);return}let t=Date.now(),n=t-e*36e5;this._travel={history:new Map,from:n,to:t,t:n,playing:!1,speed:e>24?3600:600,hours:e,moments:[],loading:!0};try{let i=await xn(this.hass,Vl(this.watched),n,t);if(!this._travel||this._travel.from!==n)return;this._travel={...this._travel,history:i,moments:Kl(i,n,t),loading:!1}}catch{this._travel=null,this._error=$(this.hass,"travel_failed");return}this.syncDevices(!0)}travelTo(e){let t=this._travel;t&&(this._travel={...t,t:Math.min(t.to,Math.max(t.from,e))},this.syncDevices(!0))}playTravel(e){let t=this._travel;t&&(clearInterval(this.travelTimer),this.travelTimer=void 0,this._travel={...t,playing:e,t:e&&t.t>=t.to?t.from:t.t},e&&(this.travelTimer=setInterval(()=>{let n=this._travel;if(!n)return;let i=n.t+250*n.speed;i>=n.to&&this.playTravel(!1),this.travelTo(i)},250)))}renderTravel(){if(!this.hass||this.clean)return f;let e=a=>$(this.hass,a),t=this._travel;if(!t)return this.travelButton?p`<button class="nf-travel-btn" title=${e("travel")} aria-label=${e("travel")} @click=${()=>{this.openTravel(24)}}>⏪</button>`:f;let n=this.hass.language??navigator.language,i=new Intl.DateTimeFormat(n,{weekday:"short",hour:"2-digit",minute:"2-digit"}).format(new Date(t.t)),o=t.to-t.from||1,s=[[60,"travel_speed_min"],[600,"travel_speed_10min"],[3600,"travel_speed_hour"]];return p`<div class="nf-travel" role="group" aria-label=${e("travel")}>
|
||||
<button class="nf-travel-play" aria-label=${e(t.playing?"travel_pause":"travel_play")} ?disabled=${t.loading} @click=${()=>this.playTravel(!t.playing)}>${t.playing?"\u23F8":"\u25B6"}</button>
|
||||
<b class="nf-travel-when">${t.loading?e("travel_loading"):i}</b>
|
||||
<div class="nf-travel-track">
|
||||
@@ -1718,7 +1752,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
<span>${L(this.hass,e.entity)}</span>
|
||||
<b>${t?$(this.hass,"swipe_off"):`${e.value} %`}</b>
|
||||
<i><em style="height:${e.value}%"></em></i>
|
||||
</div>`}tapPlate(e,t,n){let i=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),o=i?Pi(i.gang_entities,J(i.type)?.gangs??0):[];if(o.length===1)return this.onDeviceTap(o[0],t,n);o.length>1&&(this._plate={ids:o,x:t,y:n})}renderPlate(){let e=this._plate;if(!e||!this.hass)return f;let t=this.hass,n=()=>this._plate=null;return p`<div class="nf-menu-backdrop" @click=${n}></div>
|
||||
</div>`}tapPlate(e,t,n){let i=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),o=i?Ni(i.gang_entities,X(i.type)?.gangs??0):[];if(o.length===1)return this.onDeviceTap(o[0],t,n);o.length>1&&(this._plate={ids:o,x:t,y:n})}renderPlate(){let e=this._plate;if(!e||!this.hass)return f;let t=this.hass,n=()=>this._plate=null;return p`<div class="nf-menu-backdrop" @click=${n}></div>
|
||||
<div class="nf-plate-menu" style="left:${Math.max(8,e.x-110)}px;top:${Math.max(8,e.y-20-e.ids.length*46)}px" role="menu">
|
||||
${e.ids.map((i,o)=>{let s=t.states[i],a=te(s)||s?.state==="on";return p`<button role="menuitem" class=${a?"on":""} @click=${()=>{n(),this.onDeviceTap(i,e.x,e.y)}}><b>${o+1}</b><span>${L(t,i)}</span><i>${s?oe(t,s):"\u2013"}</i></button>`})}
|
||||
</div>`}renderMenu(){let e=this._menu;if(!e||!this.hass)return f;let t=this.renderRoot.querySelector(".nf-stage"),n=t?.clientWidth??800,i=t?.clientHeight??600,o=Math.max(8,Math.min(n-240,e.x-116)),s=Math.max(8,Math.min(i-360,e.y-170));return p`<div class="nf-menu-backdrop" @click=${()=>this._menu=null}></div>
|
||||
@@ -1731,12 +1765,12 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.presets=${(this.building?.settings.media_presets??[]).filter(a=>!a.speakers?.length||a.speakers.includes(e.entity))}
|
||||
?confirmSwitch=${this.confirmSet.has(e.entity)}
|
||||
.myPosition=${this.myPositionOf(e.entity)}
|
||||
.tiltEntity=${hr(this.hass,this.building?.floors??[],e.entity)}
|
||||
.tiltEntity=${fr(this.hass,this.building?.floors??[],e.entity)}
|
||||
@close=${()=>this._menu=null}
|
||||
></nf-quick-menu>`}myPositionOf(e){for(let t of this.building?.floors??[])for(let n of t.openings){let i=this.openingLinks?.get(n.id);if(n.my_position!=null&&(i?.cover===e||i?.cover2===e))return n.my_position}return null}onDeviceTap(e,t=0,n=0){if(e.startsWith("lamp:")||this._travel)return;let i=e.startsWith("tap:")?e.slice(4):this.tapPins.get(e);if(i){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===i);s?.tap&&Hi(this.hass,this,s.tap);return}if(this.pluginTapped(e))return;if(e.startsWith("gang:"))return this.tapPlate(e.slice(5),t,n);if(e.startsWith("outdoor:")){this.fire("room-tap",{floorId:null,roomId:"nf-outside"});return}if(e==="grid"){let s=this.building,a=s?s.energy.grid??Le(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&ye(this,a);return}let o=H(e);if(o==="cover"||o==="media"){this._menu={entity:e,x:t,y:n};return}if(o==="lock"){let s=zi(this.hass,e),a=L(this.hass,e);confirm($(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(o&&Gs.has(o)){if(this.confirmSet.has(e)&&!confirm($(this.hass,"confirm_switch",{name:L(this.hass,e)})))return;Ha(this.hass,e)}else ye(this,e)}pluginTapped(e){let t=this.hass?.states[e],n=this.placementInfo.get(e);if(!t||!n)return!1;let i=this.building?.floors.find(o=>o.id===n.floorId)?.placements.find(o=>o.entity_id===e);return Ss({hass:this.hass,entityId:e,state:t},n,i?.plugin??void 0,{showWindow:(o,s)=>{o&&"hass"in o&&(o.hass=this.hass),this._pluginWindow=o?{node:o,title:s?.title??""}:null},moreInfo:o=>ye(this,o??e)})}renderPluginWindow(){let e=this._pluginWindow;return e?p`<div class="nf-plugin-window" @pointerdown=${t=>t.stopPropagation()}>
|
||||
></nf-quick-menu>`}myPositionOf(e){for(let t of this.building?.floors??[])for(let n of t.openings){let i=this.openingLinks?.get(n.id);if(n.my_position!=null&&(i?.cover===e||i?.cover2===e))return n.my_position}return null}onDeviceTap(e,t=0,n=0){if(e.startsWith("lamp:")||this._travel)return;let i=e.startsWith("tap:")?e.slice(4):this.tapPins.get(e);if(i){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===i);s?.tap&&Ii(this.hass,this,s.tap);return}if(this.pluginTapped(e))return;if(e.startsWith("gang:"))return this.tapPlate(e.slice(5),t,n);if(e.startsWith("outdoor:")){this.fire("room-tap",{floorId:null,roomId:"nf-outside"});return}if(e==="grid"){let s=this.building,a=s?s.energy.grid??Ve(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&ye(this,a);return}let o=H(e);if(o==="cover"||o==="media"){this._menu={entity:e,x:t,y:n};return}if(o==="lock"){let s=Di(this.hass,e),a=L(this.hass,e);confirm($(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(o&&qs.has(o)){if(this.confirmSet.has(e)&&!confirm($(this.hass,"confirm_switch",{name:L(this.hass,e)})))return;Na(this.hass,e)}else ye(this,e)}pluginTapped(e){let t=this.hass?.states[e],n=this.placementInfo.get(e);if(!t||!n)return!1;let i=this.building?.floors.find(o=>o.id===n.floorId)?.placements.find(o=>o.entity_id===e);return As({hass:this.hass,entityId:e,state:t},n,i?.plugin??void 0,{showWindow:(o,s)=>{o&&"hass"in o&&(o.hass=this.hass),this._pluginWindow=o?{node:o,title:s?.title??""}:null},moreInfo:o=>ye(this,o??e)})}renderPluginWindow(){let e=this._pluginWindow;return e?p`<div class="nf-plugin-window" @pointerdown=${t=>t.stopPropagation()}>
|
||||
<div class="nf-pw-head"><span>${e.title}</span><button class="nf-pw-close" aria-label=${$(this.hass,"close")} @click=${()=>this._pluginWindow=null}>✕</button></div>
|
||||
<div class="nf-pw-body">${e.node}</div>
|
||||
</div>`:f}startViewOf(){return this.startView??this.building?.settings.start_view??null}currentView(){return this.viewer?.currentView()??null}resetView(){this.viewer?.resetView()}fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}toggleFlows(){this._flows=!this._flows;try{localStorage.setItem("nextfloor.flows",this._flows?"1":"0")}catch{}this.syncDevices(!0)}liveHeatPumps(e){let t=this.hass;if(!t)return[];let n=[];for(let i of e.floors)for(let o of i.furniture){if(!Bu(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=Ou(t,s?.entity??s?.power??null);a&&n.push({id:o.id,name:o.name||_e(t,o.type),floorId:i.id,x:o.x,z:o.z,at:{floorId:i.id,x:o.x,z:o.z,y:he(i,o)+o.h+.5},pump:a})}return n}livePrinters(e){let t=this.hass,n=[];if(!t)return n;for(let i of e.floors)for(let o of i.furniture){if(!Mo(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=$o(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||n.push({id:o.id,name:o.name||_e(t,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:he(i,o)+o.h+.5},printer:a})}return n}liveCars(e,t){let n=[];for(let i of t.floors)for(let o of i.furniture){if(o.type!=="parking")continue;let s=ju(e,o);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=ho(e,o),l=a?lu(o,a):null,u=o.name||(a?_e(e,a):_e(e,o.type));n.push({spot:o.id,name:u,at:{floorId:i.id,x:o.x,z:o.z,y:he(i,o)+(l?.h??.2)+.6},car:s})}return n}liveMedia(e,t){let n=[];for(let i of t.floors){for(let o of i.furniture){let s=this.furnitureLinks?.get(o.id)?.entity;s?.startsWith("media_player.")&&n.push({entity:s,name:o.name||_e(e,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:he(i,o)+o.h+.15},rings:o.sound_rings})}for(let o of i.placements)o.entity_id.startsWith("media_player.")&&n.push({entity:o.entity_id,name:o.name||L(e,o.entity_id),at:{floorId:i.id,x:o.x,z:o.z,y:(o.y??1.1)+.15},rings:o.sound_rings})}return jl(e,n)}refreshToday(e){let t=this.hass,n=e.settings.calendars??[],i=Math.max(1,Math.min(7,e.settings.today_days??1)),o=`${new Date().toDateString()}|${i}`;!t||!n.length||Date.now()-this.todayAt<9e5&&o===this.todayDay||(this.todayAt=Date.now(),this.todayDay=o,Iu(t,n,i).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,n=e.settings.forecast&&t?tt(t,this.weatherEntityId??e.settings.weather_entity):null;if(!t||!n)return;let i=`${n}|${new Date().toDateString()}`;Date.now()-this.forecastAt<18e5&&i===this.forecastKey||(this.forecastAt=Date.now(),this.forecastKey=i,Wu(t,n).then(o=>this._forecast=o))}renderForecast(e){let t=this.building,n=this.hass,i=t?.settings.forecast;if(!t||!n||!i||i.corner!==e||this.clean)return f;if(e==="top_right"&&(this.roomId||this.panelOpen))return f;let o=Cu(this._forecast,Math.max(1,Math.min(7,i.days)));if(!o.length)return f;let s=tt(n,this.weatherEntityId??t.settings.weather_entity),a=s?n.states[s]?.attributes:void 0,l=String(a?.temperature_unit??"\xB0"),u=String(a?.precipitation_unit??"mm"),c=n.language??navigator.language,d=new Intl.DateTimeFormat(c,{weekday:"short"}),m=h=>h===null?"\u2013":`${Math.round(h)}\xB0`;return p`<section class="nf-forecast" aria-label=${$(n,"forecast")}>
|
||||
</div>`:f}startViewOf(){return this.startView??this.building?.settings.start_view??null}currentView(){return this.viewer?.currentView()??null}resetView(){this.viewer?.resetView()}fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}toggleFlows(){this._flows=!this._flows;try{localStorage.setItem("nextfloor.flows",this._flows?"1":"0")}catch{}this.syncDevices(!0)}liveHeatPumps(e){let t=this.hass;if(!t)return[];let n=[];for(let i of e.floors)for(let o of i.furniture){if(!Ku(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=Vu(t,s?.entity??s?.power??null);a&&n.push({id:o.id,name:o.name||_e(t,o.type),floorId:i.id,x:o.x,z:o.z,at:{floorId:i.id,x:o.x,z:o.z,y:he(i,o)+o.h+.5},pump:a})}return n}livePrinters(e){let t=this.hass,n=[];if(!t)return n;for(let i of e.floors)for(let o of i.furniture){if(!Eo(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=Ao(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||n.push({id:o.id,name:o.name||_e(t,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:he(i,o)+o.h+.5},printer:a})}return n}liveCars(e,t){let n=[];for(let i of t.floors)for(let o of i.furniture){if(o.type!=="parking")continue;let s=Zu(e,o);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=po(e,o),l=a?cu(o,a):null,u=o.name||(a?_e(e,a):_e(e,o.type));n.push({spot:o.id,name:u,at:{floorId:i.id,x:o.x,z:o.z,y:he(i,o)+(l?.h??.2)+.6},car:s})}return n}liveMedia(e,t){let n=[];for(let i of t.floors){for(let o of i.furniture){let s=this.furnitureLinks?.get(o.id)?.entity;s?.startsWith("media_player.")&&n.push({entity:s,name:o.name||_e(e,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:he(i,o)+o.h+.15},rings:o.sound_rings})}for(let o of i.placements)o.entity_id.startsWith("media_player.")&&n.push({entity:o.entity_id,name:o.name||L(e,o.entity_id),at:{floorId:i.id,x:o.x,z:o.z,y:(o.y??1.1)+.15},rings:o.sound_rings})}return Zl(e,n)}refreshToday(e){let t=this.hass,n=e.settings.calendars??[],i=Math.max(1,Math.min(7,e.settings.today_days??1)),o=`${new Date().toDateString()}|${i}`;!t||!n.length||Date.now()-this.todayAt<9e5&&o===this.todayDay||(this.todayAt=Date.now(),this.todayDay=o,Cu(t,n,i).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,n=e.settings.forecast&&t?ot(t,this.weatherEntityId??e.settings.weather_entity):null;if(!t||!n)return;let i=`${n}|${new Date().toDateString()}`;Date.now()-this.forecastAt<18e5&&i===this.forecastKey||(this.forecastAt=Date.now(),this.forecastKey=i,Ou(t,n).then(o=>this._forecast=o))}renderForecast(e){let t=this.building,n=this.hass,i=t?.settings.forecast;if(!t||!n||!i||i.corner!==e||this.clean)return f;if(e==="top_right"&&(this.roomId||this.panelOpen))return f;let o=Lu(this._forecast,Math.max(1,Math.min(7,i.days)));if(!o.length)return f;let s=ot(n,this.weatherEntityId??t.settings.weather_entity),a=s?n.states[s]?.attributes:void 0,l=String(a?.temperature_unit??"\xB0"),u=String(a?.precipitation_unit??"mm"),c=n.language??navigator.language,d=new Intl.DateTimeFormat(c,{weekday:"short"}),m=h=>h===null?"\u2013":`${Math.round(h)}\xB0`;return p`<section class="nf-forecast" aria-label=${$(n,"forecast")}>
|
||||
<ul>
|
||||
${o.map((h,g)=>p`<li>
|
||||
<span class="nf-fc-day">${g===0?$(n,"today"):d.format(new Date(h.day))}</span>
|
||||
@@ -1745,14 +1779,14 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
<span class="nf-fc-rain">${h.rain!==null&&h.rain>0?`\u{1F4A7}${h.rain.toLocaleString(c,{maximumFractionDigits:1})} ${u}`:h.chance!==null&&h.chance>0?`\u{1F4A7}${Math.round(h.chance)} %`:""}</span>
|
||||
</li>`)}
|
||||
</ul>
|
||||
</section>`}renderToday(){let e=this.building,t=this.hass;if(!e||!t||this.clean||this.roomId||this.panelOpen)return f;let n=this.renderForecast("top_right"),i=this.today===!1?f:this.renderTodayCard(e,t);return i===f&&n===f?f:p`<div class="nf-right-col" style=${this.clock==="top_right"?"top: 78px":""}>${i}${n}</div>`}renderTodayCard(e,t){let n=Hu(t,e,Date.now(),{today:$(t,"care_bin_today"),tomorrow:$(t,"care_bin_tomorrow")}),i=Pu([...n,...this._todayItems??[]]);if(!i.length&&!(e.settings.calendars??[]).length)return f;let o=this._todayOpen!==!1,s=new Intl.DateTimeFormat(t.language??navigator.language,{weekday:"long",day:"numeric",month:"long"}).format(new Date),a=t.language??navigator.language,l=c=>{if(c===1)return $(t,"tomorrow");let d=new Date;return d.setDate(d.getDate()+c),new Intl.DateTimeFormat(a,{weekday:"long",day:"numeric",month:"numeric"}).format(d)},u=i.flatMap((c,d)=>[(c.day??0)>0&&(i[d-1]?.day??0)!==c.day?p`<li class="nf-today-day">${l(c.day??0)}</li>`:f,p`<li class=${c.past?"nf-today-past":""}><time>${c.kind==="bin"?"\u{1F5D1}":c.time||"\u25CF"}</time><span>${c.title}<small>${c.source}</small></span></li>`]);return p`<section class="nf-today ${o?"":"nf-today-folded"}" aria-label=${$(t,"today")}>
|
||||
</section>`}renderToday(e){let t=this.building,n=this.hass;if(!t||!n||this.clean||this.roomId||this.panelOpen)return f;let i=this.renderForecast("top_right"),o=this.today===!1?f:this.renderTodayCard(t,n);return o===f&&i===f&&e===f?f:p`<div class="nf-right-col ${e!==f?"nf-utility-right":""}" style=${this.clock==="top_right"?"top: 78px":""}>${e}${o}${i}</div>`}renderTodayCard(e,t){let n=Iu(t,e,Date.now(),{today:$(t,"care_bin_today"),tomorrow:$(t,"care_bin_tomorrow")}),i=Nu([...n,...this._todayItems??[]]);if(!i.length&&!(e.settings.calendars??[]).length)return f;let o=this._todayOpen!==!1,s=new Intl.DateTimeFormat(t.language??navigator.language,{weekday:"long",day:"numeric",month:"long"}).format(new Date),a=t.language??navigator.language,l=c=>{if(c===1)return $(t,"tomorrow");let d=new Date;return d.setDate(d.getDate()+c),new Intl.DateTimeFormat(a,{weekday:"long",day:"numeric",month:"numeric"}).format(d)},u=i.flatMap((c,d)=>[(c.day??0)>0&&(i[d-1]?.day??0)!==c.day?p`<li class="nf-today-day">${l(c.day??0)}</li>`:f,p`<li class=${c.past?"nf-today-past":""}><time>${c.kind==="bin"?"\u{1F5D1}":c.time||"\u25CF"}</time><span>${c.title}<small>${c.source}</small></span></li>`]);return p`<section class="nf-today ${o?"":"nf-today-folded"}" aria-label=${$(t,"today")}>
|
||||
<button class="nf-today-head" aria-expanded=${o} @click=${()=>this._todayOpen=!o}>
|
||||
<b>📅 ${$(t,"today")}</b><span>${s}</span>
|
||||
</button>
|
||||
${o?i.length?p`<ul>
|
||||
${u}
|
||||
</ul>`:p`<p class="nf-today-none">${$(t,"today_none")}</p>`:f}
|
||||
</section>`}week=null;weekAt=0;refreshWeek(e){let t=this.hass;if(!t||this._travel||Date.now()-this.weekAt<36e5)return;this.weekAt=Date.now();let n=Le(e,s=>this.furnitureLinks?.get(s.id)?.power??null),i=e.energy,o={solar:i.solar?[i.solar]:n.solar,grid:i.grid??n.grid,gridInvert:!!i.grid_invert,battery:i.battery?[i.battery]:n.battery,batteryInvert:!!i.battery_invert,consumption:i.consumption};El(t,o).then(s=>{this.week=s,this.syncDevices(!0)}).catch(()=>this.week=null)}meterRows(e,t=null){let n=this.hass,i=[],o=this.floorId?e.floors.find(l=>l.id===this.floorId):void 0,s=o&&G(n)?dn(n,o,e.floors.flatMap(l=>l.rooms)).find(l=>l.kind==="electricity"&&l.metric==="power"&&l.unit==="W"):void 0,a=G(n)?s?.value??null:o?.power_entity?Y(n?.states[o.power_entity]):null;if(o&&(s||a!==null)){let l=!s?.incomplete&&a!==null&&t&&t>0?` \xB7 ${$(n,"floor_power_share",{n:Math.round(Math.max(0,a)/t*100)})}`:"";i.push({icon:"\u26A1",label:o.name,value:`${s?Xe(n,s):ft(n,a)}${l}`})}for(let[l,u,c]of[["gas","\u{1F525}","energy_gas_short"],["water","\u{1F4A7}","energy_water_short"]]){let d=e.energy[l],m=d?n?.states[d]:void 0;m&&!N(m)&&i.push({icon:u,label:$(n,c),value:oe(n,m)})}return i}refreshDayCurves(e){let t=this.hass;if(!t||this._travel||Date.now()-this.curvesAt<6e5)return;this.curvesAt=Date.now();let n=a=>gn(a,e,fn(a,e),Le(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),i=Vl(t,n),o=Date.now(),s=o-24*36e5;vn(t,i,s,o,!0).then(a=>{this.dayCurves=Kl(t,a,s,o,n),this.syncDevices(!0)}).catch(()=>this.dayCurves=null)}syncLhCards(e,t,n,i,o,s){let a=[],l=n.summary,u=l.solar!==null||l.grid!==null||l.battery!==null||l.consumption!==null,c=An(t),d=(this.floorId?t.floors.find(m=>m.id===this.floorId):void 0)??[...t.floors].sort((m,h)=>h.elevation-m.elevation)[0];if(this.liveCardsOn&&!this.dimmed&&!this.roomId&&u&&c&&d){let m=0,h=0,g=0;for(let _ of d.rooms)for(let[b,v]of _.points)m+=b,h+=v,g++;a.push({kind:"house",at:{floorId:d.id,x:g?m/g:c.x,z:g?h/g:c.z,y:d.height+(this.floorId?1.2:3.2)},summary:l,autarky:n.autarky,curves:this.dayCurves??void 0,week:this.week??void 0,meters:this.meterRows(t,l.consumption)}),this.refreshDayCurves(t),this.refreshWeek(t)}if(this.liveCardsOn&&!this.dimmed&&!this.roomId){for(let m of i)a.push({kind:"car",at:m.at,spot:m.spot,name:m.name,car:m.car});for(let m of this.livePrinters(t))a.push({kind:"printer",at:m.at,name:m.name,printer:m.printer});for(let m of this.liveHeatPumps(t))a.push({kind:"heatpump",at:m.at,name:m.name,pump:m.pump});for(let m of o)a.push({kind:"media",at:{...m.at,y:m.at.y+.5},media:m})}this.liveCardsOn&&!this.dimmed&&a.push(...zu(s,t,this.floorId,this.roomId)),JSON.stringify(a)!==JSON.stringify(this._liveCards)&&(this._liveCards=a),e.setLiveAnchors(a.map(m=>m.at),a.length?(m,h,g,_)=>this.placeLhCard(m,h,g,_):null)}placeLhCard(e,t,n,i){let o=this.renderRoot.querySelector(`.live-card[data-i="${e}"]`);o&&(o.dataset.x=String(t),o.dataset.y=String(n),o.style.visibility=i?"visible":"hidden",e===this._liveCards.length-1&&Zu(this.renderRoot))}toggleHouseFold(){this._houseFolded=!this._houseFolded;try{localStorage.setItem("nextfloor.house_card_folded",this._houseFolded?"1":"0")}catch{}}toggleLhCards(){this._liveCardOn=!this._liveCardOn;try{localStorage.setItem("nextfloor.cards",this._liveCardOn?"1":"0")}catch{}this.syncDevices(!0)}renderTopLeft(){let e=this.clean?f:this.renderLhEnergy(),t=this.renderForecast("top_left");return this.clock!=="top_left"&&t===f||!this.hass?e:p`<div class="nf-topleft">${this.clock==="top_left"?this.renderClock(!0):f}${e}${t}</div>`}renderLhEnergy(){let e=this.ownSensors(),t=this._liveEnergy?.summary,n=!!t&&!this.roomId&&this.showEnergy&&!!this.hass&&!(t.consumption===null&&t.grid===null&&t.solar===null&&t.battery===null),o=this.building?.floors.some(u=>u.rooms.some(c=>c.climate_card))?this.renderCardToggle():f,s=this.roomNamesButton?p`<button class="nf-energy-item nf-flow-toggle nf-room-names-toggle" aria-pressed=${this.roomLabels} title=${$(this.hass,"room_names_toggle_hint")} @click=${()=>{this.roomLabels=!this.roomLabels,this.dispatchEvent(new CustomEvent("room-names-change",{detail:{value:this.roomLabels},bubbles:!0,composed:!0}))}}><span>${$(this.hass,"room_names_short")}</span><b aria-hidden="true">Aa</b></button>`:f;if(!n)return e.length||o!==f||s!==f?p`<div class="nf-energy" aria-live="off">${s}${e}${o}</div>`:f;let a=u=>$(this.hass,u),l=[];if(t.solar!==null&&l.push({cls:"solar",label:a("energy_solar"),value:ce(this.hass,t.solar)}),t.consumption!==null&&l.push({cls:"total",label:a("energy_consumption"),value:ce(this.hass,t.consumption)}),t.rest!==void 0&&t.rest!==null&&l.push({cls:"total",label:a("energy_rest"),value:ce(this.hass,t.rest)}),t.battery!==null||t.soc!==null){let u=[t.battery!==null?ce(this.hass,Math.abs(t.battery)):null,t.soc!==null?`${Math.round(t.soc)} %`:null].filter(Boolean);l.push({cls:"battery",label:a("energy_battery"),value:u.join(" \xB7 ")})}if(t.grid!==null){let u=t.grid<0;l.push({cls:u?"export":"grid",label:a(u?"energy_grid_export":"energy_gLine truncated
|
||||
</section>`}week=null;weekAt=0;refreshWeek(e){let t=this.hass;if(!t||this._travel||Date.now()-this.weekAt<36e5)return;this.weekAt=Date.now();let n=Ve(e,s=>this.furnitureLinks?.get(s.id)?.power??null),i=e.energy,o={solar:i.solar?[i.solar]:n.solar,grid:i.grid??n.grid,gridInvert:!!i.grid_invert,battery:i.battery?[i.battery]:n.battery,batteryInvert:!!i.battery_invert,consumption:i.consumption};zl(t,o).then(s=>{this.week=s,this.syncDevices(!0)}).catch(()=>this.week=null)}meterRows(e,t=null){let n=this.hass,i=[],o=this.floorId?e.floors.find(l=>l.id===this.floorId):void 0,s=o&&K(n)?Te(n,o,e.floors.flatMap(l=>l.rooms)).find(l=>l.kind==="electricity"&&l.metric==="power"&&l.unit==="W"):void 0,a=K(n)?s?.value??null:o?.power_entity?J(n?.states[o.power_entity]):null;if(o&&(s||a!==null)){let l=!s?.incomplete&&a!==null&&t&&t>0?` \xB7 ${$(n,"floor_power_share",{n:Math.round(Math.max(0,a)/t*100)})}`:"";i.push({icon:"\u26A1",label:o.name,value:`${s?De(n,s):vt(n,a)}${l}`})}for(let[l,u,c]of[["gas","\u{1F525}","energy_gas_short"],["water","\u{1F4A7}","energy_water_short"]]){let d=e.energy[l],m=d?n?.states[d]:void 0;m&&!N(m)&&i.push({icon:u,label:$(n,c),value:oe(n,m)})}return i}refreshDayCurves(e){let t=this.hass;if(!t||this._travel||Date.now()-this.curvesAt<6e5)return;this.curvesAt=Date.now();let n=a=>vn(a,e,bn(a,e),Ve(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),i=Gl(t,n),o=Date.now(),s=o-24*36e5;xn(t,i,s,o,!0).then(a=>{this.dayCurves=Ul(t,a,s,o,n),this.syncDevices(!0)}).catch(()=>this.dayCurves=null)}syncLhCards(e,t,n,i,o,s){let a=[],l=n.summary,u=l.solar!==null||l.grid!==null||l.battery!==null||l.consumption!==null,c=zn(t),d=(this.floorId?t.floors.find(m=>m.id===this.floorId):void 0)??[...t.floors].sort((m,h)=>h.elevation-m.elevation)[0];if(this.liveCardsOn&&!this.dimmed&&!this.roomId&&u&&c&&d){let m=0,h=0,g=0;for(let _ of d.rooms)for(let[b,v]of _.points)m+=b,h+=v,g++;a.push({kind:"house",at:{floorId:d.id,x:g?m/g:c.x,z:g?h/g:c.z,y:d.height+(this.floorId?1.2:3.2)},summary:l,autarky:n.autarky,curves:this.dayCurves??void 0,week:this.week??void 0,meters:this.meterRows(t,l.consumption)}),this.refreshDayCurves(t),this.refreshWeek(t)}if(this.liveCardsOn&&!this.dimmed&&!this.roomId){for(let m of i)a.push({kind:"car",at:m.at,spot:m.spot,name:m.name,car:m.car});for(let m of this.livePrinters(t))a.push({kind:"printer",at:m.at,name:m.name,printer:m.printer});for(let m of this.liveHeatPumps(t))a.push({kind:"heatpump",at:m.at,name:m.name,pump:m.pump});for(let m of o)a.push({kind:"media",at:{...m.at,y:m.at.y+.5},media:m})}this.liveCardsOn&&!this.dimmed&&a.push(...Du(s,t,this.floorId,this.roomId)),JSON.stringify(a)!==JSON.stringify(this._liveCards)&&(this._liveCards=a),e.setLiveAnchors(a.map(m=>m.at),a.length?(m,h,g,_)=>this.placeLhCard(m,h,g,_):null)}placeLhCard(e,t,n,i){let o=this.renderRoot.querySelector(`.live-card[data-i="${e}"]`);o&&(o.dataset.x=String(t),o.dataset.y=String(n),o.style.visibility=i?"visible":"hidden",e===this._liveCards.length-1&&Ju(this.renderRoot))}toggleHouseFold(){this._houseFolded=!this._houseFolded;try{localStorage.setItem("nextfloor.house_card_folded",this._houseFolded?"1":"0")}catch{}}toggleLhCards(){this._liveCardOn=!this._liveCardOn;try{localStorage.setItem("nextfloor.cards",this._liveCardOn?"1":"0")}catch{}this.syncDevices(!0)}renderTopLeft(){let e=this.clean?f:this.renderLhEnergy(),t=this.renderForecast("top_left");return this.clock!=="top_left"&&t===f||!this.hass?e:p`<div class="nf-topleft">${this.clock==="top_left"?this.renderClock(!0):f}${e}${t}</div>`}renderLhEnergy(){let e=this.ownSensors(),t=this._liveEnergy?.summary,n=!!t&&!this.roomId&&this.showEnergy&&!!this.hass&&!(t.consumption===null&&t.grid===null&&t.solar===null&&t.battery===null),o=this.building?.floors.some(u=>u.rooms.some(c=>c.climate_card))?this.renderCardToggle():f,s=this.roomNamesButton?p`<button class="nf-energy-item nf-flow-toggle nf-room-names-toggle" aria-pressed=${this.roomLabels} title=${$(this.hass,"room_names_toggle_hint")} @click=${()=>{this.roomLabels=!this.roomLabels,this.dispatchEvent(new CustomEvent("room-names-change",{detail:{value:this.roomLabels},bubbles:!0,composed:!0}))}}><span>${$(this.hass,"room_names_short")}</span><b aria-hidden="true">Aa</b></button>`:f;if(!n)return e.length||o!==f||s!==f?p`<div class="nf-energy" aria-live="off">${s}${e}${o}</div>`:f;let a=u=>$(this.hass,u),l=[];if(t.solar!==null&&l.push({cls:"solar",label:a("energy_solar"),value:ce(this.hass,t.solar)}),t.consumption!==null&&l.push({cls:"total",label:a("energy_consumption"),value:ce(this.hass,t.consumption)}),t.rest!==void 0&&t.rest!==null&&l.push({cls:"total",label:a("energy_rest"),value:ce(this.hass,t.rest)}),t.battery!==null||t.soc!==null){let u=[t.battery!==null?ce(this.hass,Math.abs(t.battery)):null,t.soc!==null?`${Math.round(t.soc)} %`:null].filter(Boolean);l.push({cls:"battery",label:a("energy_battery"),value:u.join(" \xB7 ")})}if(t.grid!==null){let u=t.grid<0;l.push({cls:u?"export":"grid",label:a(u?"energy_grid_export":"energy_gLine truncated
|
||||
${s}
|
||||
${this.liveCardsOn&&this._liveCards.some(u=>u.kind==="house")?f:l.map(u=>p`<div class="nf-energy-item nf-energy-${u.cls}"><span>${u.label}</span><b>${u.value}</b></div>`)}
|
||||
${this.flows!==null?f:p`<button class="nf-energy-item nf-flow-toggle" aria-pressed=${this._flows} title=${a("flows_hint")} aria-label=${a("flows")} @click=${()=>this.toggleFlows()}>
|
||||
@@ -1762,35 +1796,36 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${e}
|
||||
</div>`}renderCardToggle(){return this.holograms!==null?f:p`<button class="nf-energy-item nf-flow-toggle nf-card-toggle" aria-pressed=${this._liveCardOn} title=${$(this.hass,"holos_hint")} aria-label=${$(this.hass,"holos")} @click=${()=>this.toggleLhCards()}>
|
||||
<span>${$(this.hass,"holos")}</span><b>◫</b>
|
||||
</button>`}ownSensors(){let e=this.sensorBar&&this.hass?this.building?.settings.status_entities??[]:[],t=G(this.hass)?(this.building?.presence??[]).filter(a=>Ka(this.hass,a.person,[0])).map(a=>p`<div class="nf-energy-item nf-presence-state"><span>${a.name||L(this.hass,a.person)}</span><b>${se(this.hass.states[a.person])===null?"\u2013":se(this.hass.states[a.person])?"Anwesend":"Abwesend"}${j(this.hass,[a.person],a.name||"Anwesenheit")}</b></div>`):[],n=G(this.hass)?Object.entries(this.building?.settings.weather_variables??{}).filter(a=>!!a[1]&&a[1]!=="none").map(([a,l])=>[lc[a]||a,l]):[];G(this.hass)&&this.building?.settings.rain_sensor&&this.building.settings.rain_sensor!=="none"&&n.push(["Regensensor",this.building.settings.rain_sensor]);let i=n.length?p`<button class="nf-energy-item nf-flow-toggle nf-weather-values" aria-label="Wetterwerte anzeigen" title="Wetterwerte anzeigen" aria-haspopup="dialog" @click=${()=>this.renderRoot.querySelector(".nf-weather-dialog")?.showModal()}><span>Wetter</span><b aria-hidden="true">⛅</b></button>
|
||||
<dialog class="nf-weather-dialog" aria-label="Wetterwerte" @keydown=${a=>a.stopPropagation()}><header><b>Wetter</b><button type="button" class="nf-chip" aria-label="Schließen" @click=${()=>this.renderRoot.querySelector(".nf-weather-dialog")?.close()}>×</button></header>${n.map(([a,l])=>p`<p><span>${a}</span><b>${Qe(this.hass.states[l])}${j(this.hass,[l],a)}</b></p>`)}</dialog>`:f,o=G(this.hass)?(this.building?.floors??[]).filter(a=>!this.floorId||a.id===this.floorId).map(a=>({floor:a,readings:dn(this.hass,a,this.building?.floors.flatMap(l=>l.rooms))})).filter(a=>a.readings.length):[],s=o.length?p`<button class="nf-energy-item nf-flow-toggle nf-utility-toggle" aria-label="Stockwerkszähler anzeigen" title="Stockwerkszähler anzeigen" aria-haspopup="dialog" @click=${()=>this.renderRoot.querySelector(".nf-utility-dialog")?.showModal()}><span>Stockwerkszähler</span><b aria-hidden="true">⚡ 💧</b></button>
|
||||
<dialog class="nf-weather-dialog nf-utility-dialog" aria-label="Stockwerkszähler" @keydown=${a=>a.stopPropagation()}><header><b>Stockwerkszähler</b><button type="button" class="nf-chip" aria-label="Schließen" @click=${()=>this.renderRoot.querySelector(".nf-utility-dialog")?.close()}>×</button></header>${o.map(({floor:a,readings:l})=>p`<h3>${a.name}</h3><nf-utility-report .hass=${this.hass} .readings=${l}></nf-utility-report>`)}</dialog>`:f;return[...t,i,s,...e.filter(a=>this.hass.states[a]).map(a=>p`<button class="nf-energy-item nf-own-sensor" title=${L(this.hass,a)} @click=${()=>ye(this,a)}>
|
||||
</button>`}utilityOverview(e){let t=this.building;if(!t||!K(this.hass)||!this.showEnergy||this.clean||this.roomId||this.panelOpen)return f;let n=t.floors.flatMap(o=>o.rooms);return(this.floorId?t.floors.filter(o=>o.id===this.floorId):t.floors).some(o=>Te(this.hass,o,n).length)?p`<nf-utility-overview ?inline=${e} .hass=${this.hass} .floors=${t.floors} .floorId=${this.floorId} .compact=${this._narrowStage}
|
||||
@utility-open=${o=>{o.stopPropagation(),o.detail.roomId?this.openRoom(o.detail.floorId,o.detail.roomId):this.fire("floor-tap",{floorId:o.detail.floorId})}}></nf-utility-overview>`:f}ownSensors(){let e=this.sensorBar&&this.hass?this.building?.settings.status_entities??[]:[],t=K(this.hass)?(this.building?.presence??[]).filter(a=>ja(this.hass,a.person,[0])).map(a=>p`<div class="nf-energy-item nf-presence-state"><span>${a.name||L(this.hass,a.person)}</span><b>${se(this.hass.states[a.person])===null?"\u2013":se(this.hass.states[a.person])?"Anwesend":"Abwesend"}${U(this.hass,[a.person],a.name||"Anwesenheit")}</b></div>`):[],n=K(this.hass)?Object.entries(this.building?.settings.weather_variables??{}).filter(a=>!!a[1]&&a[1]!=="none").map(([a,l])=>[cc[a]||a,l]):[];K(this.hass)&&this.building?.settings.rain_sensor&&this.building.settings.rain_sensor!=="none"&&n.push(["Regensensor",this.building.settings.rain_sensor]);let i=n.length?p`<button class="nf-energy-item nf-flow-toggle nf-weather-values" aria-label="Wetterwerte anzeigen" title="Wetterwerte anzeigen" aria-haspopup="dialog" @click=${()=>this.renderRoot.querySelector(".nf-weather-dialog")?.showModal()}><span>Wetter</span><b aria-hidden="true">⛅</b></button>
|
||||
<dialog class="nf-weather-dialog" aria-label="Wetterwerte" @keydown=${a=>a.stopPropagation()}><header><b>Wetter</b><button type="button" class="nf-chip" aria-label="Schließen" @click=${()=>this.renderRoot.querySelector(".nf-weather-dialog")?.close()}>×</button></header>${n.map(([a,l])=>p`<p><span>${a}</span><b>${nt(this.hass.states[l])}${U(this.hass,[l],a)}</b></p>`)}</dialog>`:f,o=K(this.hass)?(this.building?.floors??[]).filter(a=>!this.floorId||a.id===this.floorId).map(a=>({floor:a,readings:Te(this.hass,a,this.building?.floors.flatMap(l=>l.rooms))})).filter(a=>a.readings.length):[],s=o.length?p`<button class="nf-energy-item nf-flow-toggle nf-utility-toggle" aria-label="Stockwerkszähler anzeigen" title="Stockwerkszähler anzeigen" aria-haspopup="dialog" @click=${()=>this.renderRoot.querySelector(".nf-utility-dialog")?.showModal()}><span>Stockwerkszähler</span><b aria-hidden="true">⚡ 💧</b></button>
|
||||
<dialog class="nf-weather-dialog nf-utility-dialog" aria-label="Stockwerkszähler" @keydown=${a=>a.stopPropagation()}><header><b>Stockwerkszähler</b><button type="button" class="nf-chip" aria-label="Schließen" @click=${()=>this.renderRoot.querySelector(".nf-utility-dialog")?.close()}>×</button></header>${o.map(({floor:a,readings:l})=>p`<h3>${a.name}</h3><nf-utility-report .hass=${this.hass} .readings=${l}></nf-utility-report>`)}</dialog>`:f;return[this.utilityOverview(!0),...t,i,s,...e.filter(a=>this.hass.states[a]).map(a=>p`<button class="nf-energy-item nf-own-sensor" title=${L(this.hass,a)} @click=${()=>ye(this,a)}>
|
||||
<span>${L(this.hass,a)}</span><b>${oe(this.hass,this.hass.states[a])}</b>
|
||||
</button>${j(this.hass,[a],L(this.hass,a))}`)]}renderMapCredit(){let e=this.building?.settings.map;return pu(e)?p`<a class="nf-map-credit" href=${fo(e).href} target="_blank" rel="noopener">${fo(e).text}</a>`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=pt(new Date,this.hass?.config?.latitude??50),t=Ar(this.heatMode,e),n=this.heatMode==="temperature",i=n?ae(this.hass,t.stops[0][0]):t.stops[0][0],o=n?ae(this.hass,t.stops[t.stops.length-1][0]):t.stops[t.stops.length-1][0],s=n?re(this.hass):t.unit,a=l=>$(this.hass,l);return p`<div class="nf-legend">
|
||||
</button>${U(this.hass,[a],L(this.hass,a))}`)]}renderMapCredit(){let e=this.building?.settings.map;return gu(e)?p`<a class="nf-map-credit" href=${_o(e).href} target="_blank" rel="noopener">${_o(e).text}</a>`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=bt(new Date,this.hass?.config?.latitude??50),t=Rr(this.heatMode,e),n=this.heatMode==="temperature",i=n?ae(this.hass,t.stops[0][0]):t.stops[0][0],o=n?ae(this.hass,t.stops[t.stops.length-1][0]):t.stops[t.stops.length-1][0],s=n?re(this.hass):t.unit,a=l=>$(this.hass,l);return p`<div class="nf-legend">
|
||||
<b>${a(`heat_${this.heatMode}`)}${this.heatMode==="temperature"?p` <small>${a(e?"heat_summer":"heat_winter")}</small>`:f}</b>
|
||||
<span class="nf-legend-bar" style="background:${Al(this.heatMode,e)}"></span>
|
||||
<span class="nf-legend-bar" style="background:${Rl(this.heatMode,e)}"></span>
|
||||
<span class="nf-legend-range"><span>${W(this.hass,i,0)} ${s}</span><span>${W(this.hass,o,0)} ${s}</span></span>
|
||||
${this.heatValues.size?f:p`<span class="nf-legend-none">${a("heat_none_found")}</span>`}
|
||||
</div>`}renderWifiLegend(){let e=this.hass,t=this.building;if(!e||!t)return f;let n=(u,c)=>$(e,u,c),i=t.floors.flatMap(u=>u.furniture.filter(c=>Ao(c.type)).map(c=>Eo(e,this.furnitureLinks?.get(c.id)?.entity??this.furnitureLinks?.get(c.id)?.power??null))),s=i.filter(u=>!!u).reduce((u,c)=>u+(c.clients??0),0),a=t.floors.flatMap(u=>u.placements.map(c=>e.states[c.entity_id])),l=Gu(a);return p`<div class="nf-legend">
|
||||
</div>`}renderWifiLegend(){let e=this.hass,t=this.building;if(!e||!t)return f;let n=(u,c)=>$(e,u,c),i=t.floors.flatMap(u=>u.furniture.filter(c=>Ro(c.type)).map(c=>zo(e,this.furnitureLinks?.get(c.id)?.entity??this.furnitureLinks?.get(c.id)?.power??null))),s=i.filter(u=>!!u).reduce((u,c)=>u+(c.clients??0),0),a=t.floors.flatMap(u=>u.placements.map(c=>e.states[c.entity_id])),l=ju(a);return p`<div class="nf-legend">
|
||||
<b>📶 ${n("heat_wifi")}</b>
|
||||
<span>${n("wifi_aps",{n:i.length,clients:s})}</span>
|
||||
${l.online+l.offline.length?p`<span>${n("wifi_network",{online:l.online,offline:l.offline.length})}</span>`:f}
|
||||
${l.offline.length?p`<span class="nf-legend-none">${l.offline.slice(0,4).join(", ")}</span>`:f}
|
||||
${i.length?f:p`<span class="nf-legend-none">${n("wifi_none")}</span>`}
|
||||
</div>`}skyColor(){let e=wn[this.theme]??wn.neon,t=this._sky;return e.night[0].map((n,i)=>Math.round(n+(e.day[0][i]-n)*t))}render(){let e=this._sky,t=(o,s)=>`rgb(${o.map((a,l)=>Math.round(a+(s[l]-a)*e)).join(",")})`,n=wn[this.theme]??wn.neon,i=`--nf-sky:${t(n.night[0],n.day[0])};--nf-ground:${t(n.night[1],n.day[1])}`+Gl(this.building?.settings.backdrop);return p`<div
|
||||
class="nf-stage ${this.roomLabels?"":"nf-no-room-names"} ${this._low?"nf-low":""} ${this.panelOpen?"nf-panel-open":""} ${this._alerts.length?"nf-has-alerts":""} ${this._narrowStage?"nf-narrow":""}"
|
||||
style=${i}
|
||||
</div>`}skyColor(){let e=Sn[this.theme]??Sn.neon,t=this._sky;return e.night[0].map((n,i)=>Math.round(n+(e.day[0][i]-n)*t))}render(){let e=this.utilityOverview(!1),t=this._sky,n=(s,a)=>`rgb(${s.map((l,u)=>Math.round(l+(a[u]-l)*t)).join(",")})`,i=Sn[this.theme]??Sn.neon,o=`--nf-sky:${n(i.night[0],i.day[0])};--nf-ground:${n(i.night[1],i.day[1])}`+jl(this.building?.settings.backdrop);return p`<div
|
||||
class="nf-stage ${this.roomLabels?"":"nf-no-room-names"} ${this._low?"nf-low":""} ${this.panelOpen?"nf-panel-open":""} ${this._alerts.length?"nf-has-alerts":""} ${this._narrowStage?"nf-narrow":""} ${e!==f?"nf-has-utility-overview":""}"
|
||||
style=${o}
|
||||
>
|
||||
${this._error?p`<p class="nf-error">${this._error}</p>`:f} ${this.renderTopLeft()} ${Yu(this.hass,this._liveCards,(o,s,a,l)=>this.hass?.callService(o,s,{entity_id:a,...l}),{folded:this._houseFolded,toggle:()=>this.toggleHouseFold()},!!this.roomId||this.panelOpen)} ${this.clean?f:this.renderLegend()} ${this.renderMapCredit()}
|
||||
${this._error?p`<p class="nf-error">${this._error}</p>`:f} ${this.renderTopLeft()} ${Qu(this.hass,this._liveCards,(s,a,l,u)=>this.hass?.callService(s,a,{entity_id:l,...u}),{folded:this._houseFolded,toggle:()=>this.toggleHouseFold()},!!this.roomId||this.panelOpen)} ${this.clean?f:this.renderLegend()} ${this.renderMapCredit()}
|
||||
${this.renderAlerts()} ${this.renderAnnouncement()} ${this.clean?f:p`${this.renderThumbs()} ${this.renderScenes()} ${this.renderFind()} ${this.renderCentral()}`} ${this.renderSwipe()}
|
||||
${this.renderMenu()} ${this.renderPlate()} ${this.renderEye()} ${this.renderLock()} ${this.renderWalk()} ${this.renderTravel()} ${this.renderClock()} ${this.renderToday()} ${this.renderLayers()} ${this.renderPluginWindow()}
|
||||
${this.renderMenu()} ${this.renderPlate()} ${this.renderEye()} ${this.renderLock()} ${this.renderWalk()} ${this.renderTravel()} ${this.renderClock()} ${this.renderToday(e)} ${this.renderLayers()} ${this.renderPluginWindow()}
|
||||
${this.showStats&&this._stats?p`<span class="nf-stats"
|
||||
><b>${this._stats.fps?$(this.hass,"stats_fps",{fps:this._stats.fps,ms:this._stats.worstMs}):$(this.hass,"stats_idle")}</b>
|
||||
${this._stats.busy.length?p`(${this._stats.busy.map(o=>$(this.hass,`stats_busy_${o}`)).join(", ")})`:f} ·
|
||||
${this._stats.busy.length?p`(${this._stats.busy.map(s=>$(this.hass,`stats_busy_${s}`)).join(", ")})`:f} ·
|
||||
${$(this.hass,"stats",{calls:this._stats.calls,tris:this._stats.triangles.toLocaleString()})} ·
|
||||
${$(this.hass,this._stats.low?"stats_low":"stats_full",{r:W(this.hass,this._stats.pixelRatio,2)})}</span
|
||||
>`:f}
|
||||
</div>`}static styles=[ge,Re,Ju,X`
|
||||
</div>`}static styles=[ge,Re,Xu,Y`
|
||||
:host {
|
||||
display: block;
|
||||
position: relative;
|
||||
@@ -2356,6 +2391,24 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.nf-right-col > * {
|
||||
pointer-events: auto;
|
||||
}
|
||||
.nf-utility-right {
|
||||
height: calc(100% - 140px);
|
||||
}
|
||||
.nf-has-utility-overview:not(.nf-narrow) > .nf-energy,
|
||||
.nf-has-utility-overview:not(.nf-narrow) > .nf-topleft {
|
||||
max-width: calc(100% - 316px);
|
||||
}
|
||||
.nf-has-utility-overview .nf-energy {
|
||||
align-items: flex-start;
|
||||
}
|
||||
.nf-narrow .nf-utility-right {
|
||||
top: auto !important;
|
||||
bottom: 64px;
|
||||
height: 42%;
|
||||
max-height: 42%;
|
||||
justify-content: flex-end;
|
||||
width: min(280px, calc(100% - 24px));
|
||||
}
|
||||
.nf-has-alerts .nf-right-col {
|
||||
top: 58px;
|
||||
}
|
||||
@@ -3373,26 +3426,26 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
inset: auto 16px 16px;
|
||||
color: var(--nf-danger);
|
||||
}
|
||||
`]};customElements.get("nf-view3d")||customElements.define("nf-view3d",Io);function ce(r,e){return Math.abs(e)>=1e3?`${W(r,e/1e3,1)} kW`:`${Math.round(e)} W`}function Po(r){return r.type==="tv_board"?r.h+.9:r.type==="tv_wall"||r.type==="kitchen_wall"?r.h+.25:r.h+.35}function bf(r,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:oe(r,e)}var gc;function _c(){let r=new URL("./nextfloor-editor.js?v=a5e498ee85e7",new URL(import.meta.url)).href;return gc??=import(r),gc}var vf=.25,bc=r=>Math.round(r*1e3)/1e3,vc=(r,e,t)=>r.rooms.find(n=>n.points.length>=3&&I([e,t],n.points));function Co(r,e,t,n,i){let o=vc(r,e,t);if(!o)return[n,i];let s=(a,l)=>I([a,l],o.points);return s(n,i)?[n,i]:s(n,t)?[n,t]:s(e,i)?[e,i]:[e,t]}function yf(r,e,t,n){return r.rooms.some(i=>i.id!==e.id&&i.points.some((o,s)=>{let a=i.points[(s+1)%i.points.length];return Math.abs(le(Q(o,t),n))<.02&&Math.abs(le(Q(a,t),n))<.02}))}var No=(r,e)=>Math.abs((r-e+540)%360-180);function yc(r,e,t,n=vf){let i=vc(r,e.x,e.z);if(!i)return null;let o=i.points,s=ct(o)>=0?1:-1,a=null;return o.forEach((l,u)=>{let c=o[(u+1)%o.length],d=We(Q(c,l));if(d<.3)return;let m=[(c[0]-l[0])/d,(c[1]-l[1])/d],h=[-m[1]*s,m[0]*s],g=le(Q([e.x,e.z],l),m);if(g<0||g>d)return;let _=yf(r,i,l,h)?t/2:0,b=le(Q([e.x,e.z],l),h)-_,v=Math.atan2(-h[0],h[1])*180/Math.PI,k=[{rotation:v,extent:e.d/2},{rotation:v+90,extent:e.w/2},{rotation:v-90,extent:e.w/2}].reduce((z,R)=>No(e.rotation,R.rotation)<No(e.rotation,z.rotation)?R:z);if(No(e.rotation,k.rotation)>50)return;let M=b-k.extent;Math.abs(M)>n||a&&Math.abs(M)>=Math.abs(a.gap)||(a={x:bc(e.x-h[0]*M),z:bc(e.z-h[1]*M),rotation:(Math.round(k.rotation)%360+360)%360,gap:M})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function qr(r,e,t){let n=structuredClone(r);for(let i of n.floors){let o=i.furniture.find(s=>s.id===e);o&&t(o,i)}return n}function Zr(r,e,t){let n=structuredClone(r);for(let i of n.floors){let o=i.placements.find(s=>s.entity_id===e);o&&t(o,i)}return n}function wc(r,e){let t=structuredClone(r);for(let n of t.floors)n.furniture=n.furniture.filter(i=>i.id!==e);return t}function xc(r,e){let t=structuredClone(r);for(let n of t.floors)n.placements=n.placements.filter(i=>i.entity_id!==e);return t}function kc(r,e,t,n){return Zr(r,e,(i,o)=>{[i.x,i.z]=Co(o,i.x,i.z,t,n)})}function Sc(r,e,t,n){let i=r.settings.wall_interior??.12;return qr(r,e,(o,s)=>{[o.x,o.z]=Co(s,o.x,o.z,t,n);let a=yc(s,o,i);a&&Object.assign(o,a)})}var Wo=(r,e)=>((r+e)%360+360)%360,$c=r=>Number.parseFloat(r.replace(",",".")),Hn=(r,e)=>Math.round(r*10**e)/10**e;function Lo(r){let{min:e,max:t,accepts:n=()=>!0}=r,i=o=>{let s=$c(o.target.value);!Number.isFinite(s)||!n(s)||r.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return p`<label class="nf-size" title=${r.title}
|
||||
`]};customElements.get("nf-view3d")||customElements.define("nf-view3d",Wo);function ce(r,e){return Math.abs(e)>=1e3?`${W(r,e/1e3,1)} kW`:`${Math.round(e)} W`}function Co(r){return r.type==="tv_board"?r.h+.9:r.type==="tv_wall"||r.type==="kitchen_wall"?r.h+.25:r.h+.35}function yf(r,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:oe(r,e)}var bc;function vc(){let r=new URL("./nextfloor-editor.js?v=178935170cc1",new URL(import.meta.url)).href;return bc??=import(r),bc}var wf=.25,yc=r=>Math.round(r*1e3)/1e3,wc=(r,e,t)=>r.rooms.find(n=>n.points.length>=3&&I([e,t],n.points));function Oo(r,e,t,n,i){let o=wc(r,e,t);if(!o)return[n,i];let s=(a,l)=>I([a,l],o.points);return s(n,i)?[n,i]:s(n,t)?[n,t]:s(e,i)?[e,i]:[e,t]}function xf(r,e,t,n){return r.rooms.some(i=>i.id!==e.id&&i.points.some((o,s)=>{let a=i.points[(s+1)%i.points.length];return Math.abs(le(ee(o,t),n))<.02&&Math.abs(le(ee(a,t),n))<.02}))}var Lo=(r,e)=>Math.abs((r-e+540)%360-180);function xc(r,e,t,n=wf){let i=wc(r,e.x,e.z);if(!i)return null;let o=i.points,s=pt(o)>=0?1:-1,a=null;return o.forEach((l,u)=>{let c=o[(u+1)%o.length],d=Be(ee(c,l));if(d<.3)return;let m=[(c[0]-l[0])/d,(c[1]-l[1])/d],h=[-m[1]*s,m[0]*s],g=le(ee([e.x,e.z],l),m);if(g<0||g>d)return;let _=xf(r,i,l,h)?t/2:0,b=le(ee([e.x,e.z],l),h)-_,v=Math.atan2(-h[0],h[1])*180/Math.PI,k=[{rotation:v,extent:e.d/2},{rotation:v+90,extent:e.w/2},{rotation:v-90,extent:e.w/2}].reduce((z,R)=>Lo(e.rotation,R.rotation)<Lo(e.rotation,z.rotation)?R:z);if(Lo(e.rotation,k.rotation)>50)return;let M=b-k.extent;Math.abs(M)>n||a&&Math.abs(M)>=Math.abs(a.gap)||(a={x:yc(e.x-h[0]*M),z:yc(e.z-h[1]*M),rotation:(Math.round(k.rotation)%360+360)%360,gap:M})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function Yr(r,e,t){let n=structuredClone(r);for(let i of n.floors){let o=i.furniture.find(s=>s.id===e);o&&t(o,i)}return n}function Jr(r,e,t){let n=structuredClone(r);for(let i of n.floors){let o=i.placements.find(s=>s.entity_id===e);o&&t(o,i)}return n}function kc(r,e){let t=structuredClone(r);for(let n of t.floors)n.furniture=n.furniture.filter(i=>i.id!==e);return t}function Sc(r,e){let t=structuredClone(r);for(let n of t.floors)n.placements=n.placements.filter(i=>i.entity_id!==e);return t}function $c(r,e,t,n){return Jr(r,e,(i,o)=>{[i.x,i.z]=Oo(o,i.x,i.z,t,n)})}function Mc(r,e,t,n){let i=r.settings.wall_interior??.12;return Yr(r,e,(o,s)=>{[o.x,o.z]=Oo(s,o.x,o.z,t,n);let a=xc(s,o,i);a&&Object.assign(o,a)})}var Bo=(r,e)=>((r+e)%360+360)%360,Ac=r=>Number.parseFloat(r.replace(",",".")),Nn=(r,e)=>Math.round(r*10**e)/10**e;function Vo(r){let{min:e,max:t,accepts:n=()=>!0}=r,i=o=>{let s=Ac(o.target.value);!Number.isFinite(s)||!n(s)||r.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return p`<label class="nf-size" title=${r.title}
|
||||
>${r.label}
|
||||
<input type="number" inputmode="decimal" step=${r.step} min=${e} max=${t??f} .value=${String(Hn(r.value,2))} @change=${i} />
|
||||
</label>`}var Ac=(r,e)=>p`<button class="nf-chip" @click=${e}>${r.t("height_auto")}</button>`,Mc=(r,e)=>p`<button class="nf-chip" @click=${()=>e(-r)}>↺ ${r}°</button><button class="nf-chip" @click=${()=>e(r)}>↻ ${r}°</button>`;function wf(r,e){let t=r.building.floors.find(s=>s.furniture.some(a=>a.id===e)),n=t?.furniture.find(s=>s.id===e);if(!t||!n)return f;let i=(s,a)=>Lo({label:r.t(a),title:r.t(`size_${s}`),value:n[s],step:.05,min:.05,accepts:l=>l>0,apply:l=>r.editFurniture(e,u=>u[s]=Hn(l,3))}),o=Ls(n)?p`${Lo({label:"\u2195",title:r.t("mount_height"),value:n.mount_y??he(t,n),step:.05,min:0,accepts:s=>s>=0,apply:s=>r.editFurniture(e,a=>a.mount_y=Hn(s,3))})}
|
||||
${n.mount_y!=null?Ac(r,()=>r.editFurniture(e,s=>s.mount_y=null)):f}`:f;return p`${i("w","size_short_w")}${i("d","size_short_d")}${i("h","size_short_h")} ${o}`}function xf(r,e){let t=r.building.floors.find(l=>l.placements.some(u=>u.entity_id===e)),n=t?.placements.find(l=>l.entity_id===e);if(!t||!n)return f;let i=H(e),o=(l,u,c)=>p`<select class="nf-size-select" title=${r.t(l)} @change=${d=>r.editDevice(e,m=>Object.assign(m,{mount:d.target.value,y:null}))}>
|
||||
<input type="number" inputmode="decimal" step=${r.step} min=${e} max=${t??f} .value=${String(Nn(r.value,2))} @change=${i} />
|
||||
</label>`}var Rc=(r,e)=>p`<button class="nf-chip" @click=${e}>${r.t("height_auto")}</button>`,Ec=(r,e)=>p`<button class="nf-chip" @click=${()=>e(-r)}>↺ ${r}°</button><button class="nf-chip" @click=${()=>e(r)}>↻ ${r}°</button>`;function kf(r,e){let t=r.building.floors.find(s=>s.furniture.some(a=>a.id===e)),n=t?.furniture.find(s=>s.id===e);if(!t||!n)return f;let i=(s,a)=>Vo({label:r.t(a),title:r.t(`size_${s}`),value:n[s],step:.05,min:.05,accepts:l=>l>0,apply:l=>r.editFurniture(e,u=>u[s]=Nn(l,3))}),o=Vs(n)?p`${Vo({label:"\u2195",title:r.t("mount_height"),value:n.mount_y??he(t,n),step:.05,min:0,accepts:s=>s>=0,apply:s=>r.editFurniture(e,a=>a.mount_y=Nn(s,3))})}
|
||||
${n.mount_y!=null?Rc(r,()=>r.editFurniture(e,s=>s.mount_y=null)):f}`:f;return p`${i("w","size_short_w")}${i("d","size_short_d")}${i("h","size_short_h")} ${o}`}function Sf(r,e){let t=r.building.floors.find(l=>l.placements.some(u=>u.entity_id===e)),n=t?.placements.find(l=>l.entity_id===e);if(!t||!n)return f;let i=H(e),o=(l,u,c)=>p`<select class="nf-size-select" title=${r.t(l)} @change=${d=>r.editDevice(e,m=>Object.assign(m,{mount:d.target.value,y:null}))}>
|
||||
${u.map(([d,m])=>p`<option value=${d} ?selected=${d===c}>${m}</option>`)}
|
||||
</select>`,s=["ceiling","floor","table","wall"].map(l=>[l,r.t(`lamp_${l}`)]),a=i?Et(i,ve(t,n.x,n.z),i==="light"?n.mount??"ceiling":null):1;return p`${i==="light"?o("lamp_mount",s,n.mount??"ceiling"):f}
|
||||
${Lo({label:r.t("size_short_h"),title:r.t("marker_height"),value:n.y??a,step:.05,min:0,accepts:l=>l>=0,apply:l=>r.editDevice(e,u=>u.y=Hn(l,3))})}
|
||||
${n.y!==null?Ac(r,()=>r.editDevice(e,l=>l.y=null)):f}`}function Ec(r,e,t){let n=r.t,i;if(e){let o=r.building.floors.flatMap(s=>s.furniture).find(s=>s.id===e)?.type;i=p`<span>${o?_e(r.hass,o):""}</span>
|
||||
${wf(r,e)} ${Mc(45,s=>r.turnFurniture(e,s))}
|
||||
</select>`,s=["ceiling","floor","table","wall"].map(l=>[l,r.t(`lamp_${l}`)]),a=i?Dt(i,ve(t,n.x,n.z),i==="light"?n.mount??"ceiling":null):1;return p`${i==="light"?o("lamp_mount",s,n.mount??"ceiling"):f}
|
||||
${Vo({label:r.t("size_short_h"),title:r.t("marker_height"),value:n.y??a,step:.05,min:0,accepts:l=>l>=0,apply:l=>r.editDevice(e,u=>u.y=Nn(l,3))})}
|
||||
${n.y!==null?Rc(r,()=>r.editDevice(e,l=>l.y=null)):f}`}function zc(r,e,t){let n=r.t,i;if(e){let o=r.building.floors.flatMap(s=>s.furniture).find(s=>s.id===e)?.type;i=p`<span>${o?_e(r.hass,o):""}</span>
|
||||
${kf(r,e)} ${Ec(45,s=>r.turnFurniture(e,s))}
|
||||
<button class="nf-chip" title=${n("furn_mirror_hint")} @click=${()=>r.editFurniture(e,s=>s.mirror=!s.mirror)}>⇋ ${n("furn_mirror")}</button>
|
||||
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeFurniture(e)}>${n("delete")}</button>`}else t?i=p`<span>${L(r.hass,t)}</span>
|
||||
${xf(r,t)} ${Mc(45,o=>r.turnDevice(t,o))}
|
||||
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeDevice(t)}>${n("delete")}</button>`:i=p`<span>${n("furnish_hint")}</span>`;return p`<div class="nf-furnish-bar">${i}<button class="nf-chip nf-chip-on" @click=${()=>r.finish()}>${n("done")}</button></div>`}var Rc=ne`<svg class="nf-mark" viewBox="60 40 392 420" aria-hidden="true">
|
||||
${Sf(r,t)} ${Ec(45,o=>r.turnDevice(t,o))}
|
||||
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeDevice(t)}>${n("delete")}</button>`:i=p`<span>${n("furnish_hint")}</span>`;return p`<div class="nf-furnish-bar">${i}<button class="nf-chip nf-chip-on" @click=${()=>r.finish()}>${n("done")}</button></div>`}var Tc=ne`<svg class="nf-mark" viewBox="60 40 392 420" aria-hidden="true">
|
||||
<polygon points="106,150 256,66 406,150 256,234" fill="none" stroke="currentColor" stroke-opacity=".55" stroke-width="12" stroke-dasharray="6 22" stroke-linecap="round"/>
|
||||
<polygon points="106,382 256,466 256,488 106,404" fill="#34507d"/><polygon points="406,382 256,466 256,488 406,404" fill="#2a4068"/><polygon points="106,382 256,298 406,382 256,466" fill="#5f7fb6"/>
|
||||
<polygon points="106,310 256,394 256,416 106,332" fill="#4a72b8"/><polygon points="406,310 256,394 256,416 406,332" fill="#3b5c98"/><polygon points="106,310 256,226 406,310 256,394" fill="#8ab6f5"/>
|
||||
<polygon points="106,238 256,322 256,344 106,260" fill="#2a74d8"/><polygon points="406,238 256,322 256,344 406,260" fill="#2161b8"/><polygon points="106,238 256,154 406,238 256,322" fill="#4fb6ff"/>
|
||||
<circle cx="256" cy="236" r="16" fill="#ffe08a"/>
|
||||
</svg>`;var de=(r,e)=>({name:r,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),Kt=(r,e,t)=>({name:r,fallback:t,read:n=>e.find(i=>i===n)??t,write:n=>n}),Oo={explode:de("explode",!0),keepRoof:de("roof",!1),solidWalls:de("solid_walls",!1),quality:Kt("quality",["auto","low","high"],"auto"),stats:de("stats",!1),markers:Kt("markers",["none","important","all"],"important"),heat:Kt("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:Kt("theme",Hr,"neon"),clock:Kt("clock",["none","top_left","top_right","bottom_left","bottom_right"],"none"),accent:{name:"accent",fallback:null,read:r=>/^#[0-9a-f]{6}$/i.test(r)?r:null,write:r=>r??""},floorStack:Kt("floor_stack",["dim","stacked","single"],"dim"),roomNames:de("room_names",!0),clean:de("clean",!1),navWrap:de("nav_wrap",!1),weather:de("weather",!0),timeSlider:de("time_slider",!1),menuOpen:de("menu_open",!1),keepCamera:de("keep_camera",!1),readable:de("readable",!1),plain:de("plain",!1),rightBack:de("right_back",!1),zoom:{name:"zoom",fallback:100,read:r=>/^\d{2,3}$/.test(r)?Math.min(250,Math.max(60,Number(r))):100,write:r=>String(Math.round(Math.min(250,Math.max(60,r))))},screenName:{name:"screen_name",fallback:"",read:r=>r.slice(0,60),write:r=>r.trim().slice(0,60)},announceMuted:de("announce_muted",!1),glassWalls:{name:"glass_walls",fallback:20,read:r=>/^\d{1,3}$/.test(r)?Math.min(100,Number(r)):20,write:r=>String(Math.round(Math.min(100,Math.max(0,r))))}};function zc(r=Jr()){try{return r?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function Tc(r=Jr()){try{return r?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function Jr(){try{return localStorage}catch{return null}}var Yr=class{storage;constructor(e){this.storage=e}raw(e){try{return this.storage?.getItem(`nextfloor.${e}`)??null}catch{return null}}load(e=""){let t={};for(let n of Object.keys(Oo)){let i=Oo[n],o=this.raw(i.name);t[n]=o===null?i.fallback:i.read(o)}return new URLSearchParams(e).has("nf_stats")&&(t.stats=!0),t}save(e,t){let n=Oo[e];try{this.storage?.setItem(`nextfloor.${n.name}`,n.write(t))}catch{}}};var Dc=X`
|
||||
</svg>`;var de=(r,e)=>({name:r,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),qt=(r,e,t)=>({name:r,fallback:t,read:n=>e.find(i=>i===n)??t,write:n=>n}),Ko={explode:de("explode",!0),keepRoof:de("roof",!1),solidWalls:de("solid_walls",!1),quality:qt("quality",["auto","low","high"],"auto"),stats:de("stats",!1),markers:qt("markers",["none","important","all"],"important"),heat:qt("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:qt("theme",Ir,"neon"),clock:qt("clock",["none","top_left","top_right","bottom_left","bottom_right"],"none"),accent:{name:"accent",fallback:null,read:r=>/^#[0-9a-f]{6}$/i.test(r)?r:null,write:r=>r??""},floorStack:qt("floor_stack",["dim","stacked","single"],"dim"),roomNames:de("room_names",!0),clean:de("clean",!1),navWrap:de("nav_wrap",!1),weather:de("weather",!0),timeSlider:de("time_slider",!1),menuOpen:de("menu_open",!1),keepCamera:de("keep_camera",!1),readable:de("readable",!1),plain:de("plain",!1),rightBack:de("right_back",!1),zoom:{name:"zoom",fallback:100,read:r=>/^\d{2,3}$/.test(r)?Math.min(250,Math.max(60,Number(r))):100,write:r=>String(Math.round(Math.min(250,Math.max(60,r))))},screenName:{name:"screen_name",fallback:"",read:r=>r.slice(0,60),write:r=>r.trim().slice(0,60)},announceMuted:de("announce_muted",!1),glassWalls:{name:"glass_walls",fallback:20,read:r=>/^\d{1,3}$/.test(r)?Math.min(100,Number(r)):20,write:r=>String(Math.round(Math.min(100,Math.max(0,r))))}};function Dc(r=Xr()){try{return r?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function Fc(r=Xr()){try{return r?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function Xr(){try{return localStorage}catch{return null}}var Qr=class{storage;constructor(e){this.storage=e}raw(e){try{return this.storage?.getItem(`nextfloor.${e}`)??null}catch{return null}}load(e=""){let t={};for(let n of Object.keys(Ko)){let i=Ko[n],o=this.raw(i.name);t[n]=o===null?i.fallback:i.read(o)}return new URLSearchParams(e).has("nf_stats")&&(t.stats=!0),t}save(e,t){let n=Ko[e];try{this.storage?.setItem(`nextfloor.${n.name}`,n.write(t))}catch{}}};var Hc=Y`
|
||||
.nf-dot {
|
||||
display: inline-block;
|
||||
width: 8px;
|
||||
@@ -3884,11 +3937,11 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
gap: 12px;
|
||||
margin: auto;
|
||||
}
|
||||
`;var Fc=new WeakMap,Hc=new WeakMap;function bt(r,e){let t=Hc.get(r)??r,n=Fc.get(t)??new WeakMap;Fc.set(t,n);let i=n.get(e);if(i)return i;let o=new Map;for(let l of e)for(let u of l.placements)u.entity_id.startsWith("cover.")&&o.set(u.entity_id,{tilt:u.cover_tilt==="none"?null:u.cover_tilt,position:u.position});for(let l of He(t,e).values())l.cover&&!o.has(l.cover)&&o.set(l.cover,{tilt:l.coverTilt,position:l.position}),l.cover2&&!o.has(l.cover2)&&o.set(l.cover2,{tilt:l.cover2Tilt});let s={...t.states};for(let[l,u]of o){let c=t.states[l];if(!c)continue;let d={...c.attributes,nf_cover_control:!0},m=Rt(t,u.position);m===null&&(m=typeof c.attributes.current_position=="number"?c.attributes.current_position:null),m!==null&&(d.current_position=m);let h=u.tilt?t.states[u.tilt]:c,g=typeof h?.attributes.current_tilt_position=="number"?h.attributes.current_tilt_position:u.tilt?Rt(t,u.tilt):null;g!==null&&(d.current_tilt_position=g,d.supported_features=Number(d.supported_features??0)|128);let _=c.state;typeof d.current_position=="number"&&_!=="unavailable"&&_!=="unknown"&&_!=="opening"&&_!=="closing"&&(_=d.current_position>0?"open":"closed"),s[l]={...c,state:_,attributes:d}}let a={...t,states:s,callService:async(l,u,c={})=>{if(l!=="cover")return t.callService(l,u,c);let d=Array.isArray(c.entity_id)?c.entity_id:[c.entity_id],m=async h=>{let g=typeof h=="string"?o.get(h):void 0;if(!g)return t.callService(l,u,{...c,entity_id:h});let _={...c,entity_id:h},b=u;(b==="toggle"||b==="toggle_cover")&&(b=s[String(h)]?.state==="closed"?"open_cover":"close_cover");let v=b.includes("tilt");v&&g.tilt&&(_.entity_id=g.tilt);let S=g.tilt?t.states[g.tilt]:void 0;return v&&g.tilt&&!S?.attributes.symcon_id&&typeof S?.attributes.current_tilt_position!="number"&&(b==="set_cover_tilt_position"?(b="set_cover_position",_.position=_.tilt_position,delete _.tilt_position):b==="open_cover_tilt"?b="open_cover":b==="close_cover_tilt"&&(b="close_cover")),t.callService(l,b,_)};return Array.isArray(c.entity_id)?Promise.all(d.map(m)):m(d[0])}};return Hc.set(a,t),n.set(e,a),a}var Bo=class extends ee{static properties={hass:{attribute:!1},narrow:{type:Boolean},route:{attribute:!1},panel:{attribute:!1},_mode:{state:!0},_editorReady:{state:!0},_floorId:{state:!0},_roomId:{state:!0},_wallMode:{state:!0},_prefs:{state:!0},_furnish:{state:!0},_selFurniture:{state:!0},_selDevice:{state:!0},_optsOpen:{state:!0},_switchesOpen:{state:!0},_timeOfDay:{state:!0},_outside:{state:!0},_timeDrag:{state:!0},_floorUndo:{state:!0},_variablesLoading:{state:!0},_variablesNotice:{state:!0},_variablesError:{state:!0}};outsideMemo=null;floorUndoTimer;data=new At(this);store=new Yr(Jr());constructor(){super(),this.narrow=!1,this._mode="view",this._editorReady=!!customElements.get("nf-editor"),this._floorId=null,this._roomId=null,this._wallMode="auto",this._prefs=this.store.load(location.search),this._furnish=!1,this._selFurniture=null,this._selDevice=null,this._optsOpen=!1,this._switchesOpen=!1,this._timeOfDay=null,this._outside=!1,this._timeDrag=null,this._floorUndo=null,this._variablesLoading=!1,this._variablesNotice="",this._variablesError=!1}toggleTimeSlider(e){this.setPref("timeSlider",e),e||([this._timeOfDay,this._timeDrag]=[null,null])}sunState(){let e=this.hass?.config;return this._timeOfDay===null||e?.latitude===void 0||e.longitude===void 0?this.hass?.states["sun.sun"]?.state:ut(xt(this._timeOfDay,e.time_zone),e.latitude,e.longitude).elevation>0?"above_horizon":"below_horizon"}renderTimeOfDay(){let e=this.t;if(this.hass?.config?.latitude===void 0)return f;let t=this._timeDrag??this._timeOfDay,n=o=>`${String(Math.floor(o)).padStart(2,"0")}:${String(Math.round(o%1*60)).padStart(2,"0")}`,i=()=>{let o=new Date;return Math.round((o.getHours()+o.getMinutes()/60)*4)/4};return p`<button class="nf-chip" aria-pressed=${t!==null} title=${e("time_of_day_hint")} @click=${()=>(this._timeDrag=null,this._timeOfDay=t===null?i():null)}>☀ ${t===null?e("time_of_day"):n(t)}</button>
|
||||
`;var Pc=new WeakMap,Ic=new WeakMap;function xt(r,e){let t=Ic.get(r)??r,n=Pc.get(t)??new WeakMap;Pc.set(t,n);let i=n.get(e);if(i)return i;let o=new Map;for(let l of e)for(let u of l.placements)u.entity_id.startsWith("cover.")&&o.set(u.entity_id,{tilt:u.cover_tilt==="none"?null:u.cover_tilt,position:u.position});for(let l of Ne(t,e).values())l.cover&&!o.has(l.cover)&&o.set(l.cover,{tilt:l.coverTilt,position:l.position}),l.cover2&&!o.has(l.cover2)&&o.set(l.cover2,{tilt:l.cover2Tilt});let s={...t.states};for(let[l,u]of o){let c=t.states[l];if(!c)continue;let d={...c.attributes,nf_cover_control:!0},m=Ft(t,u.position);m===null&&(m=typeof c.attributes.current_position=="number"?c.attributes.current_position:null),m!==null&&(d.current_position=m);let h=u.tilt?t.states[u.tilt]:c,g=typeof h?.attributes.current_tilt_position=="number"?h.attributes.current_tilt_position:u.tilt?Ft(t,u.tilt):null;g!==null&&(d.current_tilt_position=g,d.supported_features=Number(d.supported_features??0)|128);let _=c.state;typeof d.current_position=="number"&&_!=="unavailable"&&_!=="unknown"&&_!=="opening"&&_!=="closing"&&(_=d.current_position>0?"open":"closed"),s[l]={...c,state:_,attributes:d}}let a={...t,states:s,callService:async(l,u,c={})=>{if(l!=="cover")return t.callService(l,u,c);let d=Array.isArray(c.entity_id)?c.entity_id:[c.entity_id],m=async h=>{let g=typeof h=="string"?o.get(h):void 0;if(!g)return t.callService(l,u,{...c,entity_id:h});let _={...c,entity_id:h},b=u;(b==="toggle"||b==="toggle_cover")&&(b=s[String(h)]?.state==="closed"?"open_cover":"close_cover");let v=b.includes("tilt");v&&g.tilt&&(_.entity_id=g.tilt);let S=g.tilt?t.states[g.tilt]:void 0;return v&&g.tilt&&!S?.attributes.symcon_id&&typeof S?.attributes.current_tilt_position!="number"&&(b==="set_cover_tilt_position"?(b="set_cover_position",_.position=_.tilt_position,delete _.tilt_position):b==="open_cover_tilt"?b="open_cover":b==="close_cover_tilt"&&(b="close_cover")),t.callService(l,b,_)};return Array.isArray(c.entity_id)?Promise.all(d.map(m)):m(d[0])}};return Ic.set(a,t),n.set(e,a),a}var Go=class extends Q{static properties={hass:{attribute:!1},narrow:{type:Boolean},route:{attribute:!1},panel:{attribute:!1},_mode:{state:!0},_editorReady:{state:!0},_floorId:{state:!0},_roomId:{state:!0},_wallMode:{state:!0},_prefs:{state:!0},_furnish:{state:!0},_selFurniture:{state:!0},_selDevice:{state:!0},_optsOpen:{state:!0},_switchesOpen:{state:!0},_timeOfDay:{state:!0},_outside:{state:!0},_timeDrag:{state:!0},_floorUndo:{state:!0},_variablesLoading:{state:!0},_variablesNotice:{state:!0},_variablesError:{state:!0}};outsideMemo=null;floorUndoTimer;data=new Tt(this);store=new Qr(Xr());constructor(){super(),this.narrow=!1,this._mode="view",this._editorReady=!!customElements.get("nf-editor"),this._floorId=null,this._roomId=null,this._wallMode="auto",this._prefs=this.store.load(location.search),this._furnish=!1,this._selFurniture=null,this._selDevice=null,this._optsOpen=!1,this._switchesOpen=!1,this._timeOfDay=null,this._outside=!1,this._timeDrag=null,this._floorUndo=null,this._variablesLoading=!1,this._variablesNotice="",this._variablesError=!1}toggleTimeSlider(e){this.setPref("timeSlider",e),e||([this._timeOfDay,this._timeDrag]=[null,null])}sunState(){let e=this.hass?.config;return this._timeOfDay===null||e?.latitude===void 0||e.longitude===void 0?this.hass?.states["sun.sun"]?.state:mt(Mt(this._timeOfDay,e.time_zone),e.latitude,e.longitude).elevation>0?"above_horizon":"below_horizon"}renderTimeOfDay(){let e=this.t;if(this.hass?.config?.latitude===void 0)return f;let t=this._timeDrag??this._timeOfDay,n=o=>`${String(Math.floor(o)).padStart(2,"0")}:${String(Math.round(o%1*60)).padStart(2,"0")}`,i=()=>{let o=new Date;return Math.round((o.getHours()+o.getMinutes()/60)*4)/4};return p`<button class="nf-chip" aria-pressed=${t!==null} title=${e("time_of_day_hint")} @click=${()=>(this._timeDrag=null,this._timeOfDay=t===null?i():null)}>☀ ${t===null?e("time_of_day"):n(t)}</button>
|
||||
${t!==null?p`<label class="nf-chip nf-time-slider"
|
||||
><input type="range" min="0" max="23.75" step="0.25" .value=${String(t)} aria-label=${e("time_of_day")} @input=${o=>this._timeDrag=Number(o.target.value)}
|
||||
@change=${o=>(this._timeDrag=null,this._timeOfDay=Number(o.target.value))}
|
||||
/></label>`:f}`}t=(e,t)=>$(this.hass,e,t);setPref(e,t){this._prefs={...this._prefs,[e]:t},this.store.save(e,t)}willUpdate(e){this.toggleAttribute("readable",!!this._prefs?.readable),e.has("hass")&&this.hass&&(this.style.colorScheme=wr(this.hass),this.data.setHass(this.hass));let t=this.data.building;t&&this._floorId&&!t.floors.some(n=>n.id===this._floorId)&&(this._floorId=null,this._roomId=null)}get isAdmin(){return this.hass?.user?.is_admin??!1}setMode(e){e!==this._mode&&(e==="view"&&this.data.flush(),this._mode=e)}openFloor(e){this._floorId=e,this._roomId=null,this._outside=!1}outsideIds(e){let t=this.outsideMemo;if(t&&t.building===e&&t.entities===this.hass.entities)return t.ids;let n=an(this.hass,e.floors,e.settings.outside_hidden);return this.outsideMemo={building:e,entities:this.hass.entities,ids:n},n}openOutside(){let e=!this._outside;this.openFloor(null),this._outside=e}onRoomTap(e){let{floorId:t,roomId:n}=e.detail;if(n==="nf-outside")return this.openOutside();if((this.data.building?.floors.length??0)>1&&t&&this._floorId!==t)return this.openFloor(t);n&&(this._roomId=n===this._roomId?null:n,this._outside=!1)}furnishHost={hass:void 0,building:void 0,t:this.t,editFurniture:(e,t)=>this.applyEdit(n=>qr(n,e,t)),editDevice:(e,t)=>this.applyEdit(n=>Zr(n,e,t)),turnFurniture:(e,t)=>this.applyEdit(n=>qr(n,e,i=>i.rotation=Wo(i.rotation,t))),turnDevice:(e,t)=>this.applyEdit(n=>Zr(n,e,i=>i.rotation=Wo(i.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>wc(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>xc(t,e)),this._selDevice=null},finish:()=>{this._furnish=!1,this._selFurniture=null,this._selDevice=null}};saveMoods(e,t){this.applyEdit(n=>({...n,floors:n.floors.map(i=>({...i,rooms:i.rooms.map(o=>o.id===e?{...o,moods:t.length?t:void 0}:o)}))}))}applyEdit(e){let t=this.data.building;t&&this.data.edit(e(t))}view3d(){return this.renderRoot.querySelector("nf-view3d")}back(){this._outside?this._outside=!1:this._roomId?this._roomId=null:this._floorId&&(this.data.building?.floors.length??0)>1?this._floorId=null:this.view3d()?.resetView()}onKey=e=>{e.key!=="Escape"||this._mode!=="view"||(this._prefs.clean?this.setPref("clean",!1):this.back())};connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this.onKey)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.onKey)}render(){if(this.hass&&fr(this.hass,this))return f;let e=this.data.building,t=this._prefs.clean&&this._mode==="view",n=f;return e&&(this._mode==="editor"&&this.isAdmin?n=this.renderEditor(e):this._mode==="extensions"&&this.isAdmin?n=this.renderExtensions():n=this.renderView(e)),p`<div class="nf-app ${t?"nf-clean":""}" style=${this._prefs.accent?`--nf-accent:${this._prefs.accent}`:""}>
|
||||
/></label>`:f}`}t=(e,t)=>$(this.hass,e,t);setPref(e,t){this._prefs={...this._prefs,[e]:t},this.store.save(e,t)}willUpdate(e){this.toggleAttribute("readable",!!this._prefs?.readable),e.has("hass")&&this.hass&&(this.style.colorScheme=Sr(this.hass),this.data.setHass(this.hass));let t=this.data.building;t&&this._floorId&&!t.floors.some(n=>n.id===this._floorId)&&(this._floorId=null,this._roomId=null)}get isAdmin(){return this.hass?.user?.is_admin??!1}setMode(e){e!==this._mode&&(e==="view"&&this.data.flush(),this._mode=e)}openFloor(e){this._floorId=e,this._roomId=null,this._outside=!1}outsideIds(e){let t=this.outsideMemo;if(t&&t.building===e&&t.entities===this.hass.entities)return t.ids;let n=cn(this.hass,e.floors,e.settings.outside_hidden);return this.outsideMemo={building:e,entities:this.hass.entities,ids:n},n}openOutside(){let e=!this._outside;this.openFloor(null),this._outside=e}onRoomTap(e){let{floorId:t,roomId:n}=e.detail;if(n==="nf-outside")return this.openOutside();if((this.data.building?.floors.length??0)>1&&t&&this._floorId!==t)return this.openFloor(t);n&&(this._roomId=n===this._roomId?null:n,this._outside=!1)}furnishHost={hass:void 0,building:void 0,t:this.t,editFurniture:(e,t)=>this.applyEdit(n=>Yr(n,e,t)),editDevice:(e,t)=>this.applyEdit(n=>Jr(n,e,t)),turnFurniture:(e,t)=>this.applyEdit(n=>Yr(n,e,i=>i.rotation=Bo(i.rotation,t))),turnDevice:(e,t)=>this.applyEdit(n=>Jr(n,e,i=>i.rotation=Bo(i.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>kc(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>Sc(t,e)),this._selDevice=null},finish:()=>{this._furnish=!1,this._selFurniture=null,this._selDevice=null}};saveMoods(e,t){this.applyEdit(n=>({...n,floors:n.floors.map(i=>({...i,rooms:i.rooms.map(o=>o.id===e?{...o,moods:t.length?t:void 0}:o)}))}))}applyEdit(e){let t=this.data.building;t&&this.data.edit(e(t))}view3d(){return this.renderRoot.querySelector("nf-view3d")}back(){this._outside?this._outside=!1:this._roomId?this._roomId=null:this._floorId&&(this.data.building?.floors.length??0)>1?this._floorId=null:this.view3d()?.resetView()}onKey=e=>{e.key!=="Escape"||this._mode!=="view"||(this._prefs.clean?this.setPref("clean",!1):this.back())};connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this.onKey)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.onKey)}render(){if(this.hass&&br(this.hass,this))return f;let e=this.data.building,t=this._prefs.clean&&this._mode==="view",n=f;return e&&(this._mode==="editor"&&this.isAdmin?n=this.renderEditor(e):this._mode==="extensions"&&this.isAdmin?n=this.renderExtensions():n=this.renderView(e)),p`<div class="nf-app ${t?"nf-clean":""}" style=${this._prefs.accent?`--nf-accent:${this._prefs.accent}`:""}>
|
||||
${t?f:p`${this.renderHeader(e)}${this.renderNotices()}`}
|
||||
${this.data.error&&!e?p`<p class="nf-message">${this.t("load_error")}: ${this.data.error}</p>`:f}
|
||||
${!e&&!this.data.error?p`<p class="nf-message">${this.t("loading")}</p>`:f}
|
||||
@@ -3901,7 +3954,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
</label>`}renderViewOptions(){let e=this._prefs;return p`<button class="nf-opts-btn" aria-expanded=${this._optsOpen} title=${this.t("view_options")} aria-label=${this.t("view_options")} @click=${()=>this._optsOpen=!this._optsOpen}>⚙</button>
|
||||
<div class="nf-view-opts ${this._optsOpen?"nf-opts-open":""}">
|
||||
${this.choiceRow("quality",["auto","low","high"],e.quality,t=>this.t(`quality_${t}`),t=>this.setPref("quality",t))}
|
||||
${this.choiceRow("theme",Hr,e.theme,t=>this.t(`theme_${t}`),t=>this.setPref("theme",t),this.accentPicker())}
|
||||
${this.choiceRow("theme",Ir,e.theme,t=>this.t(`theme_${t}`),t=>this.setPref("theme",t),this.accentPicker())}
|
||||
${this.choiceRow("markers",["none","important","all"],e.markers,t=>this.t(`markers_${t}`),t=>this.setPref("markers",t))}
|
||||
<label class="nf-seg nf-clock-pick" title=${this.t("clock")}
|
||||
>🕒
|
||||
@@ -3917,7 +3970,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
>${this.t("glass_walls")}
|
||||
<input type="range" min="0" max="100" step="5" .value=${String(e.glassWalls)} aria-label=${this.t("glass_walls")} @input=${t=>this.setPref("glassWalls",Number(t.target.value))} />
|
||||
</label>
|
||||
${G(this.hass)?f:p`<details class="nf-seg nf-screen-pick">
|
||||
${K(this.hass)?f:p`<details class="nf-seg nf-screen-pick">
|
||||
<summary title=${this.t(e.announceMuted?"announce_muted":"announce_on")} aria-label=${this.t(e.announceMuted?"announce_muted":"announce_on")}>${e.announceMuted?"\u{1F507}":"\u{1F4E2}"}</summary>
|
||||
<div class="nf-screen-menu">
|
||||
<label class="nf-check"><input type="checkbox" .checked=${!e.announceMuted} @change=${t=>this.setPref("announceMuted",!t.target.checked)} /> ${this.t("announce_on")}</label>
|
||||
@@ -3940,7 +3993,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
</div>
|
||||
</div>`}async reloadVariables(){if(!(this._variablesLoading||!this.hass.symconRefresh)){this._variablesLoading=!0,this._variablesNotice="",this._variablesError=!1;try{await this.hass.symconRefresh(),this._variablesNotice=this.t("symcon_variables_loaded")}catch(e){this._variablesError=!0,this._variablesNotice=this.t("symcon_variables_error",{error:e instanceof Error?e.message:String(e)})}finally{this._variablesLoading=!1}}}renderHeader(e){let t=this.hass?.symconTitle?.trim()||"NextFloor",n=this.data.saveState,i=(s,a,l="")=>p`<button role="tab" class=${l} aria-pressed=${this._mode===s} @click=${()=>this.setMode(s)}>${a}</button>`,o=n==="saving"?"saving":n==="saved"?"saved":"save_error";return p`<header class="nf-header">
|
||||
<ha-menu-button .hass=${this.hass} .narrow=${this.narrow}></ha-menu-button>
|
||||
<h1 title=${t}>${Rc}<span class="nf-view-title">${t}</span></h1>
|
||||
<h1 title=${t}>${Tc}<span class="nf-view-title">${t}</span></h1>
|
||||
${this.isAdmin?p`<div class="nf-seg" role="tablist">${i("view",this.t("view"))}${i("editor",this.t("editor"))}${i("extensions",`\u2726 ${this.t("ext_tab")}`,"nf-tab-ext")}</div>`:f}
|
||||
<span class="nf-grow"></span>
|
||||
${this._mode==="view"&&e?.floors.some(s=>s.rooms.length)?p`<button class="nf-chip nf-room-names-toggle" aria-pressed=${this._prefs.roomNames} title=${this.t("room_names_toggle_hint")} @click=${()=>this.setPref("roomNames",!this._prefs.roomNames)}>${this.t("room_names_short")}</button>`:f}
|
||||
@@ -3955,7 +4008,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
<span>${this.t("draft_found",{time:n})}</span>
|
||||
<button class="nf-btn nf-primary" @click=${()=>e.restoreDraft()}>${this.t("draft_restore")}</button>
|
||||
<button class="nf-btn" @click=${()=>e.discardDraft()}>${this.t("draft_discard")}</button>
|
||||
</div>`)}return t.length>0?p`<div class="nf-notices">${t}</div>`:f}whenEditorLoaded(e){return this._editorReady?e():(_c().then(()=>this._editorReady=!0,t=>this.data.error=String(t)),p`<div class="nf-empty"><p>${this.t("loading")}</p></div>`)}renderExtensions(){return this.whenEditorLoaded(()=>p`<nf-extensions class="nf-body" .hass=${this.hass} .packs=${this.data.packs} .plugins=${this.data.building?.settings.plugins??[]}
|
||||
</div>`)}return t.length>0?p`<div class="nf-notices">${t}</div>`:f}whenEditorLoaded(e){return this._editorReady?e():(vc().then(()=>this._editorReady=!0,t=>this.data.error=String(t)),p`<div class="nf-empty"><p>${this.t("loading")}</p></div>`)}renderExtensions(){return this.whenEditorLoaded(()=>p`<nf-extensions class="nf-body" .hass=${this.hass} .packs=${this.data.packs} .plugins=${this.data.building?.settings.plugins??[]}
|
||||
@packs-changed=${()=>{this.data.reloadPacks()}}
|
||||
@plugins-changed=${e=>this.applyEdit(t=>({...t,settings:{...t.settings,plugins:e.detail}}))}></nf-extensions>`)}renderEditor(e){return this.whenEditorLoaded(()=>p`<nf-editor
|
||||
class="nf-body"
|
||||
@@ -3965,10 +4018,10 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.roomLabels=${this._prefs.roomNames}
|
||||
@room-names-change=${t=>this.setPref("roomNames",t.detail.value)}
|
||||
.packs=${this.data.packs}
|
||||
.loadCardEditor=${Ln}
|
||||
.loadCardEditor=${Vn}
|
||||
@packs-changed=${()=>{this.data.reloadPacks()}}
|
||||
@building-changed=${t=>this.data.edit(t.detail.building)}
|
||||
></nf-editor>`)}onNavWheel=e=>{if(this._prefs.navWrap||!e.deltaY||e.deltaX)return;let t=e.currentTarget;t.scrollWidth<=t.clientWidth||(t.scrollLeft+=e.deltaY,e.preventDefault())};allOffChip(e){let t=this._floorId?e.floors.find(i=>i.id===this._floorId):e.floors.length===1?e.floors[0]:void 0;if(!t||!this.hass)return f;if(this._floorUndo){let i=this._floorUndo;return p`<button class="nf-chip" aria-pressed="true" @click=${()=>{for(let o of i)this.hass.callService(o.domain,o.service,o.data);this._floorUndo=null,clearTimeout(this.floorUndoTimer)}}>↶ ${this.t("all_off_undo")}</button>`}let n=bn(Ll(t).map(i=>this.hass.states[i]));return n.count<2?f:p`<button class="nf-chip" title=${this.t("all_off_floor",{floor:t.name,n:n.count})} @click=${()=>{for(let i of n.off)this.hass.callService(i.domain,i.service,i.data);this._floorUndo=n.undo,clearTimeout(this.floorUndoTimer),this.floorUndoTimer=setTimeout(()=>this._floorUndo=null,1e4)}}>⏻ ${n.count}</button>`}renderNav(e){let t=e.floors.filter(u=>!this._floorId||u.id===this._floorId),n=e.floors.length>1,i=this._prefs.navWrap,o=this.outsideIds(e).length?p`<button class="nf-chip" aria-pressed=${this._outside} title=${this.t("outside_area_hint")} @click=${()=>this.openOutside()}>🌳 ${this.t("outside_area")}</button>`:f,s=n?p`<button class="nf-chip" aria-pressed=${this._floorId===null} @click=${()=>this.openFloor(null)}>${this.t("all_floors")}</button>
|
||||
></nf-editor>`)}onNavWheel=e=>{if(this._prefs.navWrap||!e.deltaY||e.deltaX)return;let t=e.currentTarget;t.scrollWidth<=t.clientWidth||(t.scrollLeft+=e.deltaY,e.preventDefault())};allOffChip(e){let t=this._floorId?e.floors.find(i=>i.id===this._floorId):e.floors.length===1?e.floors[0]:void 0;if(!t||!this.hass)return f;if(this._floorUndo){let i=this._floorUndo;return p`<button class="nf-chip" aria-pressed="true" @click=${()=>{for(let o of i)this.hass.callService(o.domain,o.service,o.data);this._floorUndo=null,clearTimeout(this.floorUndoTimer)}}>↶ ${this.t("all_off_undo")}</button>`}let n=wn(Bl(t).map(i=>this.hass.states[i]));return n.count<2?f:p`<button class="nf-chip" title=${this.t("all_off_floor",{floor:t.name,n:n.count})} @click=${()=>{for(let i of n.off)this.hass.callService(i.domain,i.service,i.data);this._floorUndo=n.undo,clearTimeout(this.floorUndoTimer),this.floorUndoTimer=setTimeout(()=>this._floorUndo=null,1e4)}}>⏻ ${n.count}</button>`}renderNav(e){let t=e.floors.filter(u=>!this._floorId||u.id===this._floorId),n=e.floors.length>1,i=this._prefs.navWrap,o=this.outsideIds(e).length?p`<button class="nf-chip" aria-pressed=${this._outside} title=${this.t("outside_area_hint")} @click=${()=>this.openOutside()}>🌳 ${this.t("outside_area")}</button>`:f,s=n?p`<button class="nf-chip" aria-pressed=${this._floorId===null} @click=${()=>this.openFloor(null)}>${this.t("all_floors")}</button>
|
||||
${[...e.floors].reverse().map(u=>p`<button class="nf-chip" aria-pressed=${u.id===this._floorId} @click=${()=>this.openFloor(u.id)}>${u.name}</button>`)}
|
||||
${o} ${this.allOffChip(e)}
|
||||
<span class="nf-sep"></span>`:p`${o} ${this.allOffChip(e)}`,a=t.flatMap(u=>[t.length>1&&u.rooms.length?p`<span class="nf-nav-floor">${u.name}</span>`:f,...u.rooms.map(c=>p`<button
|
||||
@@ -4009,7 +4062,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
<div class="nf-stage-wrap ${this._roomId?"nf-room-open":""}">
|
||||
<nf-view3d
|
||||
class="nf-body"
|
||||
.hass=${Ur(bt(this.hass,e.floors),e.settings)}
|
||||
.hass=${qr(xt(this.hass,e.floors),e.settings)}
|
||||
.building=${e}
|
||||
.packs=${this.data.packs}
|
||||
.floorStack=${t.floorStack}
|
||||
@@ -4028,10 +4081,10 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.keepRoof=${t.keepRoof}
|
||||
.markerMode=${t.markers}
|
||||
.heatMode=${t.heat}
|
||||
.theme=${Pr(t.theme,this.sunState())}
|
||||
.theme=${Nr(t.theme,this.sunState())}
|
||||
.timeOfDay=${this._timeOfDay}
|
||||
.clock=${t.clock==="none"?null:t.clock}
|
||||
.announcements=${!G(this.hass)&&!t.announceMuted}
|
||||
.announcements=${!K(this.hass)&&!t.announceMuted}
|
||||
.glassWalls=${t.glassWalls}
|
||||
.screenName=${t.screenName||null}
|
||||
.lockButton=${!0}
|
||||
@@ -4047,9 +4100,9 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
?furnish=${this._furnish}
|
||||
.selectedFurniture=${this._selFurniture}
|
||||
@furniture-select=${i=>this._selFurniture=i.detail.id}
|
||||
@furniture-move=${i=>this.applyEdit(o=>Sc(o,i.detail.id,i.detail.x,i.detail.z))}
|
||||
@furniture-move=${i=>this.applyEdit(o=>Mc(o,i.detail.id,i.detail.x,i.detail.z))}
|
||||
@device-select=${i=>this._selDevice=i.detail.id}
|
||||
@device-move=${i=>this.applyEdit(o=>kc(o,i.detail.id,i.detail.x,i.detail.z))}
|
||||
@device-move=${i=>this.applyEdit(o=>$c(o,i.detail.id,i.detail.x,i.detail.z))}
|
||||
.quality=${t.quality}
|
||||
?showStats=${t.stats}
|
||||
@room-tap=${this.onRoomTap}
|
||||
@@ -4059,10 +4112,10 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${n?p`<nf-room-panel
|
||||
.building=${this.data.building??null}
|
||||
class="nf-room-panel"
|
||||
.hass=${bt(this.hass,e.floors)}
|
||||
.hass=${xt(this.hass,e.floors)}
|
||||
.room=${n}
|
||||
.floor=${e.floors.find(i=>i.rooms.some(o=>o.id===this._roomId))??null}
|
||||
.confirmEntities=${mt(this.hass,e.floors)}
|
||||
.confirmEntities=${_t(this.hass,e.floors)}
|
||||
.phrases=${e.settings.announce_phrases??null}
|
||||
.rooms=${e.floors.flatMap(i=>i.rooms)}
|
||||
@mood-change=${i=>this.saveMoods(i.detail.roomId,i.detail.moods)}
|
||||
@@ -4070,17 +4123,17 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
></nf-room-panel>`:this._outside?p`<nf-room-panel
|
||||
.building=${this.data.building??null}
|
||||
class="nf-room-panel"
|
||||
.hass=${bt(this.hass,e.floors)}
|
||||
.hass=${xt(this.hass,e.floors)}
|
||||
.room=${null}
|
||||
.outside=${this.outsideIds(e)}
|
||||
.confirmEntities=${mt(this.hass,e.floors)}
|
||||
.confirmEntities=${_t(this.hass,e.floors)}
|
||||
.phrases=${e.settings.announce_phrases??null}
|
||||
@close=${()=>this._outside=!1}
|
||||
></nf-room-panel>`:f}
|
||||
${t.clean?f:this.renderOverlay(e)}
|
||||
${this._furnish?Ec(this.furnishHost,this._selFurniture,this._selDevice):f}
|
||||
${this._furnish?zc(this.furnishHost,this._selFurniture,this._selDevice):f}
|
||||
</div>
|
||||
`}static styles=[ge,Re,Dc,yr]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",Bo);var kf=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,Pc=(r,e)=>Number(r)*60+Number(e);function Pn(r,e,t=new Date){if(!r||r==="off")return!1;if(r==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let n=kf.exec(r.trim());if(!n)return!1;let i=Pc(n[1],n[2]),o=Pc(n[3],n[4]),s=t.getHours()*60+t.getMinutes();return i>o?s>=i||s<o:s>=i&&s<o}var Qr=class{host;cleanTimer;idleTimer;nightTimer;constructor(e){this.host=e}armClean(e=!1){clearTimeout(this.cleanTimer);let t=this.host.config()?.controls_hide_after??0;t>0&&(e&&this.host.isClean()&&this.host.setClean(!1),this.cleanTimer=setTimeout(()=>this.host.setClean(!0),t*1e3))}stopClean(){clearTimeout(this.cleanTimer)}armIdle(){clearTimeout(this.idleTimer);let e=this.host.config()?.idle_return??0;e>0&&(this.idleTimer=setTimeout(()=>this.host.goHome(),e*1e3))}touched(){this.host.isOrbit()&&this.host.setOrbit(!1),this.armIdle(),this.armClean(!0)}start(){this.armIdle(),this.nightTimer=setInterval(()=>this.host.setNight(Pn(this.host.config()?.night,this.host.hass())),6e4)}stop(){clearTimeout(this.cleanTimer),clearTimeout(this.idleTimer),clearInterval(this.nightTimer)}};function Ic(r,e){return r?r.floors.filter(t=>(e===null||t.id===e)&&t.rooms.length>0).map(t=>({floorId:t.id,floorName:t.name,rooms:t.rooms.map(n=>({id:n.id,name:n.name||"\u2013",floorId:t.id}))})):[]}var Nc=X`
|
||||
`}static styles=[ge,Re,Hc,kr]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",Go);var $f=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,Nc=(r,e)=>Number(r)*60+Number(e);function Cn(r,e,t=new Date){if(!r||r==="off")return!1;if(r==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let n=$f.exec(r.trim());if(!n)return!1;let i=Nc(n[1],n[2]),o=Nc(n[3],n[4]),s=t.getHours()*60+t.getMinutes();return i>o?s>=i||s<o:s>=i&&s<o}var ei=class{host;cleanTimer;idleTimer;nightTimer;constructor(e){this.host=e}armClean(e=!1){clearTimeout(this.cleanTimer);let t=this.host.config()?.controls_hide_after??0;t>0&&(e&&this.host.isClean()&&this.host.setClean(!1),this.cleanTimer=setTimeout(()=>this.host.setClean(!0),t*1e3))}stopClean(){clearTimeout(this.cleanTimer)}armIdle(){clearTimeout(this.idleTimer);let e=this.host.config()?.idle_return??0;e>0&&(this.idleTimer=setTimeout(()=>this.host.goHome(),e*1e3))}touched(){this.host.isOrbit()&&this.host.setOrbit(!1),this.armIdle(),this.armClean(!0)}start(){this.armIdle(),this.nightTimer=setInterval(()=>this.host.setNight(Cn(this.host.config()?.night,this.host.hass())),6e4)}stop(){clearTimeout(this.cleanTimer),clearTimeout(this.idleTimer),clearInterval(this.nightTimer)}};function Cc(r,e){return r?r.floors.filter(t=>(e===null||t.id===e)&&t.rooms.length>0).map(t=>({floorId:t.id,floorName:t.name,rooms:t.rooms.map(n=>({id:n.id,name:n.name||"\u2013",floorId:t.id}))})):[]}var Wc=Y`
|
||||
ha-card {
|
||||
overflow: hidden;
|
||||
background: var(--nf-bg);
|
||||
@@ -4204,26 +4257,26 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
`;function Vo(r,e){let t=r.template,n=t?e?.[t]:void 0;if(!n)return r;let{type:i,template:o,...s}=n;return{...s,...r}}function Cc(r,e){let t=new Set(e),n=[];for(let o of r.floors){let s=o.rooms.filter(u=>t.has(u.id));if(!s.length)continue;let a=(u,c)=>s.some(d=>d.points.length>=3&&I([u,c],d.points)),l=new Set(s.map(u=>u.id));n.push({...o,rooms:s,openings:o.openings.filter(u=>l.has(u.room_id)),furniture:o.furniture.filter(u=>a(u.x,u.z)),placements:o.placements.filter(u=>a(u.x,u.z)),walls:(o.walls??[]).filter(u=>a((u.a[0]+u.b[0])/2,(u.a[1]+u.b[1])/2)),outdoor:[]})}let i={...r.settings.roof,type:"none",sections:[],solar:[]};return{...r,floors:n,settings:{...r.settings,roof:i}}}var Gt="nf-outside",Ko=class extends ee{static properties={hass:{attribute:!1},_config:{state:!0},_roomId:{state:!0},_floorId:{state:!0},_walls:{state:!0},_heat:{state:!0},_explode:{state:!0},_fullscreen:{state:!0},_clean:{state:!0},_night:{state:!0},_orbit:{state:!0},_roomNames:{state:!0}};_own=null;templatesSeen;roomApplied=!1;data=new At(this);kiosk=new Qr({config:()=>this._config,hass:()=>this.hass,setClean:e=>this._clean=e,isClean:()=>this._clean,setOrbit:e=>this._orbit=e,isOrbit:()=>this._orbit,setNight:e=>this._night=e,goHome:()=>this.returnHome()});constructor(){super(),this._roomId=null,this._floorId=void 0,this._walls=null,this._heat=null,this._explode=null,this._fullscreen=!1,this._clean=!1,this._night=!1,this._orbit=!1,this._roomNames=null}view3d(){return this.shadowRoot?.querySelector("nf-view3d")}returnHome(){this._roomId=this._config?.room??null,this._floorId=void 0,this.view3d()?.resetView(),this._config?.idle_orbit&&(this._orbit=!0)}openDashboard(e){history.pushState(null,"",e),window.dispatchEvent(new CustomEvent("location-changed",{bubbles:!0,composed:!0,detail:{replace:!1}}))}onFullscreen=()=>this._fullscreen=!!document.fullscreenElement&&this.shadowRoot?.contains(document.fullscreenElement)===!0;connectedCallback(){super.connectedCallback(),document.addEventListener("fullscreenchange",this.onFullscreen),this.kiosk.start()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("fullscreenchange",this.onFullscreen),this.kiosk.stop()}toggleFullscreen(){document.fullscreenElement?document.exitFullscreen():this.shadowRoot?.querySelector("ha-card")?.requestFullscreen?.()}static async getConfigElement(){return await Ln(),document.createElement("nextfloor-card-editor")}static getStubConfig(){return{type:"custom:nextfloor-card"}}setConfig(e){if(e.height!==void 0&&!(e.height>100))throw new Error("height must be a number of pixels above 100");this._roomNames=null,this._own=e,this._config=Vo(e,this.data.building?.settings.card_templates),this._floorId=void 0,this._walls=null,this._heat=null,this._explode=null,this._orbit=!1,this._night=Pn(e.night,this.hass),this._clean=e.controls_hidden===!0,this.kiosk.armClean(),this.kiosk.armIdle()}getCardSize(){return Math.ceil((this._config?.height??420)/50)}getGridOptions(){return{columns:"full",rows:this._config?.fill?12:Math.ceil((this._config?.height??420)/56),min_rows:4}}willUpdate(e){let t=this.data.building?.settings.card_templates;if(this._own?.template&&t!==this.templatesSeen&&(this.templatesSeen=t,this._config=Vo(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=wr(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let n=Pn(this._config?.night,this.hass);n!==this._night&&(this._night=n)}get canSwitch(){return!this._config?.floor||this.thumbs}get thumbs(){return this._config?.floor_thumbs??!this._config?.floor}back(){this._roomId?this._roomId=null:this.canSwitch&&(this._floorId=null)}roomsMemo=null;plan(){let e=this.data.building??null,t=this._config?.rooms;if(!e||!t?.length)return e;let n=t.join(",");return(!this.roomsMemo||this.roomsMemo.source!==e||this.roomsMemo.ids!==n)&&(this.roomsMemo={source:e,ids:n,result:Cc(e,t)}),this.roomsMemo.result}t=e=>$(this.hass,e);stage(){let e=this.plan(),t=this._config,n=this._floorId===void 0?t?.floor??null:this._floorId,i=e&&e.floors.length===1?e.floors[0].id:e?.floors.some(a=>a.id===n)?n:null,o=!!this._roomId&&t?.room_panel!==!1,s=!!this._roomId&&t?.room_panel===!1||!this.thumbs&&this.canSwitch&&!this._roomId&&!!i&&(e?.floors.length??0)>1;return{floorId:i,walls:this._walls??t?.walls??"auto",heat:this._heat??t?.heatmap??"none",explode:this._explode??t?.explode??!0,canGoBack:s,showBar:!!e&&!this._clean&&(s||!!t?.controls&&!o)}}shows(e){let t=this._config?.controls;return t===!0||Array.isArray(t)&&t.includes(e)}renderBar(e){let t=this.plan(),n=this.t,i=["temperature","humidity","co2"].filter(s=>this.shows(s)),o=(s,a)=>p`<div class="nf-seg" role=${s?"group":f} aria-label=${s??f}>${a.map(([l,u,c])=>p`<button aria-pressed=${l} @click=${u}>${c}</button>`)}</div>`;return p`<div class="nf-card-controls">
|
||||
`;function Uo(r,e){let t=r.template,n=t?e?.[t]:void 0;if(!n)return r;let{type:i,template:o,...s}=n;return{...s,...r}}function Lc(r,e){let t=new Set(e),n=[];for(let o of r.floors){let s=o.rooms.filter(u=>t.has(u.id));if(!s.length)continue;let a=(u,c)=>s.some(d=>d.points.length>=3&&I([u,c],d.points)),l=new Set(s.map(u=>u.id));n.push({...o,rooms:s,openings:o.openings.filter(u=>l.has(u.room_id)),furniture:o.furniture.filter(u=>a(u.x,u.z)),placements:o.placements.filter(u=>a(u.x,u.z)),walls:(o.walls??[]).filter(u=>a((u.a[0]+u.b[0])/2,(u.a[1]+u.b[1])/2)),outdoor:[]})}let i={...r.settings.roof,type:"none",sections:[],solar:[]};return{...r,floors:n,settings:{...r.settings,roof:i}}}var Zt="nf-outside",jo=class extends Q{static properties={hass:{attribute:!1},_config:{state:!0},_roomId:{state:!0},_floorId:{state:!0},_walls:{state:!0},_heat:{state:!0},_explode:{state:!0},_fullscreen:{state:!0},_clean:{state:!0},_night:{state:!0},_orbit:{state:!0},_roomNames:{state:!0}};_own=null;templatesSeen;roomApplied=!1;data=new Tt(this);kiosk=new ei({config:()=>this._config,hass:()=>this.hass,setClean:e=>this._clean=e,isClean:()=>this._clean,setOrbit:e=>this._orbit=e,isOrbit:()=>this._orbit,setNight:e=>this._night=e,goHome:()=>this.returnHome()});constructor(){super(),this._roomId=null,this._floorId=void 0,this._walls=null,this._heat=null,this._explode=null,this._fullscreen=!1,this._clean=!1,this._night=!1,this._orbit=!1,this._roomNames=null}view3d(){return this.shadowRoot?.querySelector("nf-view3d")}returnHome(){this._roomId=this._config?.room??null,this._floorId=void 0,this.view3d()?.resetView(),this._config?.idle_orbit&&(this._orbit=!0)}openDashboard(e){history.pushState(null,"",e),window.dispatchEvent(new CustomEvent("location-changed",{bubbles:!0,composed:!0,detail:{replace:!1}}))}onFullscreen=()=>this._fullscreen=!!document.fullscreenElement&&this.shadowRoot?.contains(document.fullscreenElement)===!0;connectedCallback(){super.connectedCallback(),document.addEventListener("fullscreenchange",this.onFullscreen),this.kiosk.start()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("fullscreenchange",this.onFullscreen),this.kiosk.stop()}toggleFullscreen(){document.fullscreenElement?document.exitFullscreen():this.shadowRoot?.querySelector("ha-card")?.requestFullscreen?.()}static async getConfigElement(){return await Vn(),document.createElement("nextfloor-card-editor")}static getStubConfig(){return{type:"custom:nextfloor-card"}}setConfig(e){if(e.height!==void 0&&!(e.height>100))throw new Error("height must be a number of pixels above 100");this._roomNames=null,this._own=e,this._config=Uo(e,this.data.building?.settings.card_templates),this._floorId=void 0,this._walls=null,this._heat=null,this._explode=null,this._orbit=!1,this._night=Cn(e.night,this.hass),this._clean=e.controls_hidden===!0,this.kiosk.armClean(),this.kiosk.armIdle()}getCardSize(){return Math.ceil((this._config?.height??420)/50)}getGridOptions(){return{columns:"full",rows:this._config?.fill?12:Math.ceil((this._config?.height??420)/56),min_rows:4}}willUpdate(e){let t=this.data.building?.settings.card_templates;if(this._own?.template&&t!==this.templatesSeen&&(this.templatesSeen=t,this._config=Uo(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=Sr(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let n=Cn(this._config?.night,this.hass);n!==this._night&&(this._night=n)}get canSwitch(){return!this._config?.floor||this.thumbs}get thumbs(){return this._config?.floor_thumbs??!this._config?.floor}back(){this._roomId?this._roomId=null:this.canSwitch&&(this._floorId=null)}roomsMemo=null;plan(){let e=this.data.building??null,t=this._config?.rooms;if(!e||!t?.length)return e;let n=t.join(",");return(!this.roomsMemo||this.roomsMemo.source!==e||this.roomsMemo.ids!==n)&&(this.roomsMemo={source:e,ids:n,result:Lc(e,t)}),this.roomsMemo.result}t=e=>$(this.hass,e);stage(){let e=this.plan(),t=this._config,n=this._floorId===void 0?t?.floor??null:this._floorId,i=e&&e.floors.length===1?e.floors[0].id:e?.floors.some(a=>a.id===n)?n:null,o=!!this._roomId&&t?.room_panel!==!1,s=!!this._roomId&&t?.room_panel===!1||!this.thumbs&&this.canSwitch&&!this._roomId&&!!i&&(e?.floors.length??0)>1;return{floorId:i,walls:this._walls??t?.walls??"auto",heat:this._heat??t?.heatmap??"none",explode:this._explode??t?.explode??!0,canGoBack:s,showBar:!!e&&!this._clean&&(s||!!t?.controls&&!o)}}shows(e){let t=this._config?.controls;return t===!0||Array.isArray(t)&&t.includes(e)}renderBar(e){let t=this.plan(),n=this.t,i=["temperature","humidity","co2"].filter(s=>this.shows(s)),o=(s,a)=>p`<div class="nf-seg" role=${s?"group":f} aria-label=${s??f}>${a.map(([l,u,c])=>p`<button aria-pressed=${l} @click=${u}>${c}</button>`)}</div>`;return p`<div class="nf-card-controls">
|
||||
${e.canGoBack?p`<button class="nf-chip" @click=${()=>this.back()}>${n("back")}</button>`:f}
|
||||
${this.shows("walls")?o(void 0,[[e.walls==="auto",()=>this._walls="auto",n("walls_auto")],[e.walls==="cut",()=>this._walls="cut",n("walls_cut")],[e.walls==="slope",()=>this._walls="slope",n("walls_slope")]]):f}
|
||||
${this.shows("floors")&&t.floors.length>1&&!e.floorId?o(void 0,[[e.explode,()=>this._explode=!0,n("floors_apart")],[!e.explode,()=>this._explode=!1,n("floors_stacked")]]):f}
|
||||
${i.length>0?o(n("heatmap"),["none",...i].map(s=>[e.heat===s,()=>this._heat=s,n(s==="none"?"heat_off":`heat_short_${s}`)])):f}
|
||||
</div>`}renderRoomButtons(e){let t=this.plan();if(!this._config?.room_buttons||!t||this._clean)return f;let n=Ic(t,e.floorId);if(!n.length)return f;let i=n.length>1,o=(l,u)=>{this.canSwitch&&l!==e.floorId&&(this._floorId=l),this._roomId=u===this._roomId?null:u},s=an(this.hass,t.floors).length>0,a=()=>{this.canSwitch&&(this._floorId=null),this._roomId=this._roomId===Gt?null:Gt};return p`<div class="nf-card-rooms ${this._roomId&&this._config?.room_panel!==!1?"nf-card-rooms-beside":""}" role="group" aria-label=${this.t("card_room_buttons")}>
|
||||
</div>`}renderRoomButtons(e){let t=this.plan();if(!this._config?.room_buttons||!t||this._clean)return f;let n=Cc(t,e.floorId);if(!n.length)return f;let i=n.length>1,o=(l,u)=>{this.canSwitch&&l!==e.floorId&&(this._floorId=l),this._roomId=u===this._roomId?null:u},s=cn(this.hass,t.floors).length>0,a=()=>{this.canSwitch&&(this._floorId=null),this._roomId=this._roomId===Zt?null:Zt};return p`<div class="nf-card-rooms ${this._roomId&&this._config?.room_panel!==!1?"nf-card-rooms-beside":""}" role="group" aria-label=${this.t("card_room_buttons")}>
|
||||
${n.map(l=>p`${i?p`<span class="nf-card-rooms-floor">${l.floorName}</span>`:f}${l.rooms.map(u=>p`<button class="nf-chip" aria-pressed=${u.id===this._roomId} @click=${()=>o(l.floorId,u.id)}>${u.name}</button>`)}`)}
|
||||
${s?p`<button class="nf-chip" aria-pressed=${this._roomId===Gt} title=${this.t("outside_area_hint")} @click=${a}>🌳 ${this.t("outside_area")}</button>`:f}
|
||||
${s?p`<button class="nf-chip" aria-pressed=${this._roomId===Zt} title=${this.t("outside_area_hint")} @click=${a}>🌳 ${this.t("outside_area")}</button>`:f}
|
||||
</div>`}renderCorners(){let e=this._config,t=this.t,n=this._clean||!!this._roomId&&e?.room_panel!==!1;return p`${e?.fullscreen_button&&!n?p`<button class="nf-card-full" title=${t(this._fullscreen?"fullscreen_exit":"fullscreen")} aria-label=${t(this._fullscreen?"fullscreen_exit":"fullscreen")} @click=${()=>this.toggleFullscreen()}>
|
||||
${this._fullscreen?"\u2715":"\u26F6"}
|
||||
</button>`:f}
|
||||
${e?.dashboard&&!n?p`<button class="nf-card-full nf-card-dash ${e.fullscreen_button?"nf-card-dash-2":""}" title=${e.dashboard_label||e.dashboard} aria-label=${e.dashboard_label||e.dashboard} @click=${()=>this.openDashboard(e.dashboard)}>
|
||||
${e.dashboard_label?p`<span>${e.dashboard_label}</span>`:"\u2302"}
|
||||
</button>`:f}`}renderStage(e){let t=this.plan(),n=this._config,i=()=>{this._clean=!this._clean,this._clean?this.kiosk.stopClean():this.kiosk.armClean()},o=n?.controls_hidden!==void 0||(n?.controls_hide_after??0)>0;return p`<nf-view3d
|
||||
.hass=${Ur(bt(this.hass,t.floors),t.settings)}
|
||||
.hass=${qr(xt(this.hass,t.floors),t.settings)}
|
||||
.building=${t}
|
||||
.packs=${this.data.packs}
|
||||
.floorId=${e.floorId}
|
||||
.roomId=${this._roomId===Gt?null:this._roomId}
|
||||
.outsideOpen=${this._roomId===Gt}
|
||||
.roomId=${this._roomId===Zt?null:this._roomId}
|
||||
.outsideOpen=${this._roomId===Zt}
|
||||
.wallMode=${e.walls}
|
||||
.solidWalls=${n?.solid_walls===!0}
|
||||
.explode=${e.explode}
|
||||
@@ -4246,7 +4299,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.zoom=${typeof n?.zoom=="number"?n.zoom:1}
|
||||
.buttons=${n?.buttons?.map((s,a)=>({id:`card_${a}`,...s}))??null}
|
||||
.heatMode=${e.heat}
|
||||
.theme=${Pr(n?.theme,this.hass?.states["sun.sun"]?.state)}
|
||||
.theme=${Nr(n?.theme,this.hass?.states["sun.sun"]?.state)}
|
||||
.clock=${n?.clock&&n.clock!=="none"?n.clock:null}
|
||||
.lockButton=${n?.lock_button!==!1}
|
||||
.walkButton=${n?.walk_button!==!1}
|
||||
@@ -4264,10 +4317,10 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.panelOpen=${!!this._roomId&&n?.room_panel!==!1}
|
||||
.alerts=${n?.alerts!==!1}
|
||||
.alertJump=${!!n?.alert_jump}
|
||||
.announcements=${!G(this.hass)&&n?.announcements!==!1&&!Tc()}
|
||||
.announcements=${!K(this.hass)&&n?.announcements!==!1&&!Fc()}
|
||||
.sensorBar=${n?.sensor_bar!==!1}
|
||||
.glassWalls=${typeof n?.glass_walls=="number"?Math.min(100,Math.max(0,n.glass_walls)):null}
|
||||
.screenName=${n?.screen_name??zc()}
|
||||
.screenName=${n?.screen_name??Dc()}
|
||||
.scenes=${n?.scenes!==!1}
|
||||
.clean=${this._clean}
|
||||
.cleanButton=${o}
|
||||
@@ -4285,14 +4338,14 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
></nf-view3d>`}renderRoomPanel(){let e=this.plan();return p`<nf-room-panel
|
||||
.building=${this.plan()??null}
|
||||
class="nf-card-panel"
|
||||
.hass=${bt(this.hass,e.floors)}
|
||||
.hass=${xt(this.hass,e.floors)}
|
||||
.room=${e.floors.flatMap(t=>t.rooms).find(t=>t.id===this._roomId)??null}
|
||||
.floor=${e.floors.find(t=>t.rooms.some(n=>n.id===this._roomId))??null}
|
||||
.outside=${this._roomId===Gt?an(this.hass,e.floors):null}
|
||||
.confirmEntities=${mt(this.hass,e.floors)}
|
||||
.outside=${this._roomId===Zt?cn(this.hass,e.floors):null}
|
||||
.confirmEntities=${_t(this.hass,e.floors)}
|
||||
.phrases=${e.settings.announce_phrases??null}
|
||||
@close=${()=>this._roomId=null}
|
||||
></nf-room-panel>`}render(){if(this.hass&&fr(this.hass,this))return f;let e=this.plan(),t=this._config;!this.roomApplied&&e&&t?.room&&(this.roomApplied=!0,e.floors.some(a=>a.rooms.some(l=>l.id===t.room))&&(this._roomId=t.room));let n=this.stage(),i=this._fullscreen?"100vh":t?.fill?"calc(100vh - var(--header-height, 56px) - 16px)":`${t?.height??420}px`,o=/^#[0-9a-f]{6}$/i.test(t?.accent??"")?t.accent:null,s=()=>this.kiosk.touched();return p`<ha-card class=${this._night?"nf-night":""} style=${o?`--nf-accent:${o}`:""} @pointerdown=${s} @keydown=${s} @wheel=${s}>
|
||||
></nf-room-panel>`}render(){if(this.hass&&br(this.hass,this))return f;let e=this.plan(),t=this._config;!this.roomApplied&&e&&t?.room&&(this.roomApplied=!0,e.floors.some(a=>a.rooms.some(l=>l.id===t.room))&&(this._roomId=t.room));let n=this.stage(),i=this._fullscreen?"100vh":t?.fill?"calc(100vh - var(--header-height, 56px) - 16px)":`${t?.height??420}px`,o=/^#[0-9a-f]{6}$/i.test(t?.accent??"")?t.accent:null,s=()=>this.kiosk.touched();return p`<ha-card class=${this._night?"nf-night":""} style=${o?`--nf-accent:${o}`:""} @pointerdown=${s} @keydown=${s} @wheel=${s}>
|
||||
<div class="nf-card-body" style="height:${i}">
|
||||
${e&&e.floors.some(a=>a.rooms.length)?this.renderStage(n):p`<p class="nf-card-msg">${this.data.error??(e?$(this.hass,"no_building"):$(this.hass,"loading"))}</p>`}
|
||||
${this._roomId&&e&&t?.room_panel!==!1?this.renderRoomPanel():f}
|
||||
@@ -4300,7 +4353,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${n.showBar&&e?this.renderBar(n):f}
|
||||
${this.renderCorners()}
|
||||
</div>
|
||||
</ha-card>`}static styles=[ge,Re,Nc,yr]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",Ko);let r=window;r.customCards=r.customCards??[],r.customCards.push({type:"nextfloor-card",name:$(void 0,"card_name"),description:$(void 0,"card_description"),preview:!1})}_i();
|
||||
</ha-card>`}static styles=[ge,Re,Wc,kr]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",jo);let r=window;r.customCards=r.customCards??[],r.customCards.push({type:"nextfloor-card",name:$(void 0,"card_name"),description:$(void 0,"card_description"),preview:!1})}vi();
|
||||
/*! Bundled license information:
|
||||
|
||||
@lit/reactive-element/css-tag.js:
|
||||
|
||||
+2
-2
@@ -110,8 +110,8 @@ function copySymconAssets() {
|
||||
|
||||
// Size budgets, small enough for old wall tablets. The editor bundles only load for admins and the card's settings, so they
|
||||
// may grow more than the view; German and English texts ride in every bundle.
|
||||
// Native multi-utility discovery and reports add about 8 KB to the shared runtime.
|
||||
const BUDGET = { "nextfloor.js": 660 * 1024, "nextfloor-3d.js": 1000 * 1024, "nextfloor-editor.js": 720 * 1024, "nextfloor-card-editor.js": 240 * 1024, "nextfloor-trend.js": 100 * 1024 };
|
||||
// Native utility discovery/reports plus the building/floor overview need about 14 KB in the shared runtime.
|
||||
const BUDGET = { "nextfloor.js": 668 * 1024, "nextfloor-3d.js": 1000 * 1024, "nextfloor-editor.js": 720 * 1024, "nextfloor-card-editor.js": 240 * 1024, "nextfloor-trend.js": 100 * 1024 };
|
||||
|
||||
copyAssets();
|
||||
copySymconAssets();
|
||||
|
||||
@@ -14,7 +14,7 @@ export class NfTrendDialog extends LitElement {
|
||||
hass: { attribute: false }, ids: { attribute: false }, label: { attribute: false },
|
||||
from: { state: true }, to: { state: true }, resolution: { state: true }, chartStyle: { state: true }, field: { state: true },
|
||||
min: { state: true }, max: { state: true }, zero: { state: true }, band: { state: true }, live: { state: true },
|
||||
series: { state: true }, hiddenSeries: { state: true }, loading: { state: true }, errors: { state: true }, hover: { state: true }, width: { state: true }, page: { state: true },
|
||||
series: { state: true }, hiddenSeries: { state: true }, loading: { state: true }, errors: { state: true }, hover: { state: true }, width: { state: true }, plotHeight: { state: true }, page: { state: true },
|
||||
};
|
||||
declare hass: HomeAssistant;
|
||||
declare ids: string[];
|
||||
@@ -36,18 +36,20 @@ export class NfTrendDialog extends LitElement {
|
||||
private declare errors: string[];
|
||||
private declare hover: number | null;
|
||||
private declare width: number;
|
||||
private declare plotHeight: number;
|
||||
private declare page: number;
|
||||
private request = 0;
|
||||
private drag: number | null = null;
|
||||
private timer?: ReturnType<typeof setInterval>;
|
||||
private observer?: ResizeObserver;
|
||||
private resize = () => { this.plotHeight = Math.round(Math.min(600, Math.max(220, window.innerHeight * (window.innerWidth < 600 ? .52 : .65)))); };
|
||||
|
||||
constructor() {
|
||||
super(); this.ids = []; this.label = "";
|
||||
this.to = Math.floor(Date.now() / 1000); this.from = this.to - 86400;
|
||||
this.resolution = "auto"; this.chartStyle = "auto"; this.field = "v"; this.min = ""; this.max = "";
|
||||
this.zero = false; this.band = true; this.live = false; this.series = []; this.hiddenSeries = new Set();
|
||||
this.loading = false; this.errors = []; this.hover = null; this.width = 900; this.page = 0;
|
||||
this.loading = false; this.errors = []; this.hover = null; this.width = 900; this.plotHeight = 400; this.page = 0;
|
||||
}
|
||||
|
||||
async open() {
|
||||
@@ -55,11 +57,12 @@ export class NfTrendDialog extends LitElement {
|
||||
this.renderRoot.querySelector<HTMLDialogElement>("dialog")!.showModal();
|
||||
this.observer = new ResizeObserver(([e]) => { this.width = Math.max(280, Math.floor(e.contentRect.width)); });
|
||||
this.observer.observe(this.renderRoot.querySelector(".body")!);
|
||||
this.resize(); window.addEventListener("resize", this.resize);
|
||||
this.timer = setInterval(() => { if (this.live && !this.loading) { const span = this.to - this.from; this.to = Math.floor(Date.now() / 1000); this.from = this.to - span; void this.load(); } }, 30000);
|
||||
await this.load();
|
||||
}
|
||||
|
||||
disconnectedCallback() { super.disconnectedCallback(); ++this.request; clearInterval(this.timer); this.observer?.disconnect(); }
|
||||
disconnectedCallback() { super.disconnectedCallback(); ++this.request; clearInterval(this.timer); this.observer?.disconnect(); window.removeEventListener("resize", this.resize); }
|
||||
private async load() {
|
||||
const request = ++this.request, start = this.from, end = this.to;
|
||||
this.errors = []; this.series = []; this.hover = null; this.page = 0;
|
||||
@@ -97,7 +100,9 @@ export class NfTrendDialog extends LitElement {
|
||||
let low: number, high: number;
|
||||
try { [low, high] = trendBounds(numbers, this.min, this.max, this.zero || this.chartStyle === "bar" || series.some((s) => s.type === 0) || (this.chartStyle === "auto" && series.some((s) => s.counter && s.aggregation !== "raw"))); }
|
||||
catch (e) { return html`<p role="alert">${errorText(e)}</p>`; }
|
||||
const left = 64, right = this.width - 16, top = 14, bottom = 220;
|
||||
const groups = new Set(this.selected().filter((s) => s.type !== 3).map((s) => this.unit(s.entity_id))).size;
|
||||
const height = Math.max(200, Math.round(this.plotHeight / Math.max(1, Math.min(groups, 2))));
|
||||
const left = 64, right = this.width - 16, top = 14, bottom = height - 32;
|
||||
const x = (t: number) => left + (t - this.from) / (this.to - this.from) * (right - left);
|
||||
const y = (v: number) => bottom - (v - low) / (high - low) * (bottom - top);
|
||||
const point = (p: TrendPoint, field = this.field) => Number(field === "v" ? p.v : p[field] ?? p.v);
|
||||
@@ -107,13 +112,13 @@ export class NfTrendDialog extends LitElement {
|
||||
return ps.map((p, i) => `${i ? stepped ? `H${x(p.t).toFixed(1)}V` : "L" : "M"}${stepped && i ? y(point(p, field)).toFixed(1) : `${x(p.t).toFixed(1)},${y(point(p, field)).toFixed(1)}`}`).join("") + (ps.length ? stepped ? `H${right}` : s.aggregation === "raw" ? `L${right},${y(point(ps[ps.length - 1], field)).toFixed(1)}` : "" : "");
|
||||
};
|
||||
const ticks = this.width < 480 ? 2 : 5;
|
||||
return html`<section class="chart-group"><h3>${unit || "Wert"}</h3><svg class="plot" viewBox=${`0 0 ${this.width} 256`} role="img" aria-label=${`Trend ${unit}`} @wheel=${(e: WheelEvent) => { e.preventDefault(); this.zoom(e.deltaY > 0 ? 1.5 : 1 / 1.5, this.ratio(e)); }}
|
||||
return html`<section class="chart-group"><h3>${unit || "Wert"}</h3><svg class="plot" viewBox=${`0 0 ${this.width} ${height}`} role="img" aria-label=${`Trend ${unit}`} @wheel=${(e: WheelEvent) => { e.preventDefault(); this.zoom(e.deltaY > 0 ? 1.5 : 1 / 1.5, this.ratio(e)); }}
|
||||
@pointerdown=${(e: PointerEvent) => { this.drag = this.ratio(e); (e.currentTarget as Element).setPointerCapture(e.pointerId); }}
|
||||
@pointerup=${(e: PointerEvent) => { if (this.drag === null) return; const start = this.drag, end = this.ratio(e); this.drag = null; if (Math.abs(start - end) > .02) { const span = this.to - this.from; this.range(this.from + span * Math.min(start, end), this.from + span * Math.max(start, end)); } }}
|
||||
@pointercancel=${() => { this.drag = null; }} @pointermove=${(e: PointerEvent) => { this.hover = this.from + (this.to - this.from) * this.ratio(e); }}>
|
||||
<defs><clipPath id="plot-clip"><rect x=${left} y=${top} width=${right - left} height=${bottom - top}/></clipPath></defs>
|
||||
${[0, 1, 2, 3, 4].map((i) => { const v = low + (high - low) * i / 4; return svg`<line class="grid" x1=${left} x2=${right} y1=${y(v)} y2=${y(v)}/><text x=${left - 7} y=${y(v) + 4} text-anchor="end">${this.number(v)}</text>`; })}
|
||||
${Array.from({ length: ticks }, (_, i) => { const t = this.from + (this.to - this.from) * i / (ticks - 1); return svg`<text x=${x(t)} y="244" text-anchor=${i === 0 ? "start" : i === ticks - 1 ? "end" : "middle"}>${new Date(t * 1000).toLocaleString(this.hass.language, { month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit" })}</text>`; })}
|
||||
${Array.from({ length: ticks }, (_, i) => { const t = this.from + (this.to - this.from) * i / (ticks - 1); return svg`<text x=${x(t)} y=${height - 8} text-anchor=${i === 0 ? "start" : i === ticks - 1 ? "end" : "middle"}>${new Date(t * 1000).toLocaleString(this.hass.language, { month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit" })}</text>`; })}
|
||||
<g clip-path="url(#plot-clip)">${series.map((s) => {
|
||||
const bars = this.chartStyle === "bar" || (this.chartStyle === "auto" && s.counter && s.aggregation !== "raw");
|
||||
const color = this.color(s.entity_id);
|
||||
@@ -132,39 +137,112 @@ export class NfTrendDialog extends LitElement {
|
||||
render() {
|
||||
const selected = this.selected(), allString = selected.length > 0 && selected.every((s) => s.type === 3);
|
||||
const text = this.hover === null ? "Letzter Wert" : this.stamp(this.hover);
|
||||
return html`<dialog aria-label="Variablentrend" @close=${() => this.remove()} @keydown=${(e: KeyboardEvent) => e.stopPropagation()}>
|
||||
<header><div><h2>${this.label || "Variablentrend"}</h2><span>Symcon Archiv</span></div><button aria-label="Schließen" @click=${() => this.renderRoot.querySelector<HTMLDialogElement>("dialog")?.close()}>×</button></header>
|
||||
<div class="body"><div class="presets">${[["1 h", 3600], ["6 h", 21600], ["24 h", 86400], ["7 Tage", 604800], ["30 Tage", 2592000], ["1 Jahr", 31536000]].map(([label, seconds]) => html`<button @click=${() => { const end = Math.floor(Date.now() / 1000); this.range(end - Number(seconds), end); }}>${label}</button>`)}</div>
|
||||
<form @submit=${(e: Event) => { e.preventDefault(); void this.load(); }}><div class="fields">
|
||||
return html`<dialog aria-label="Variablentrend" @close=${() => this.remove()} @keydown=${(e: KeyboardEvent) => {
|
||||
e.stopPropagation();
|
||||
const settings = this.renderRoot.querySelector<HTMLDetailsElement>(".settings");
|
||||
if (e.key === "Escape" && settings?.open) { e.preventDefault(); settings.open = false; }
|
||||
}} @click=${(e: Event) => { const settings = this.renderRoot.querySelector<HTMLDetailsElement>(".settings"); if (settings?.open && !e.composedPath().includes(settings)) settings.open = false; }}>
|
||||
<header><div><h2>${this.label || "Variablentrend"}</h2><span class="range">${new Date(this.from * 1000).toLocaleString(this.hass.language, { dateStyle: "short", timeStyle: "short" })} – ${new Date(this.to * 1000).toLocaleString(this.hass.language, { dateStyle: "short", timeStyle: "short" })}</span></div><button aria-label="Schließen" @click=${() => this.renderRoot.querySelector<HTMLDialogElement>("dialog")?.close()}>×</button></header>
|
||||
<div class="body"><div class="toolbar"><div class="presets">${[["1 h", 3600], ["6 h", 21600], ["24 h", 86400], ["7 Tage", 604800], ["30 Tage", 2592000], ["1 Jahr", 31536000]].map(([label, seconds]) => html`<button aria-pressed=${this.to - this.from === seconds} @click=${() => { const end = Math.floor(Date.now() / 1000); this.range(end - Number(seconds), end); }}>${label}</button>`)}</div>
|
||||
<div class="navigation"><button aria-label="Vorheriger Zeitraum" title="Vorheriger Zeitraum" @click=${() => this.range(this.from - (this.to - this.from), this.from)}>←</button><button aria-label="Nächster Zeitraum" title="Nächster Zeitraum" @click=${() => this.range(this.to, this.to + (this.to - this.from))}>→</button><button aria-label="Hineinzoomen" title="Hineinzoomen" @click=${() => this.zoom(.5)}>+</button><button aria-label="Herauszoomen" title="Herauszoomen" @click=${() => this.zoom(2)}>−</button><button aria-label="Aktualisieren" title="Aktualisieren" aria-busy=${this.loading} @click=${() => void this.load()} ?disabled=${this.loading}>↻</button></div>
|
||||
<label class="live-toggle" title="Alle 30 Sekunden aktualisieren"><input type="checkbox" .checked=${this.live} @change=${(e: Event) => { this.live = (e.target as HTMLInputElement).checked; }}/> Live</label>
|
||||
<details class="settings"><summary aria-label="Trend-Einstellungen" title="Zeitraum, Auflösung und Darstellung">⚙︎</summary><div class="settings-panel">
|
||||
<form @submit=${(e: Event) => { e.preventDefault(); void this.load(); }}><div class="fields time-fields">
|
||||
<label>Von<input type="datetime-local" .value=${localDateTime(this.from)} @change=${(e: Event) => { this.from = Math.floor(new Date((e.target as HTMLInputElement).value).getTime() / 1000); this.live = false; void this.load(); }}/></label>
|
||||
<label>Bis<input type="datetime-local" .value=${localDateTime(this.to)} @change=${(e: Event) => { this.to = Math.floor(new Date((e.target as HTMLInputElement).value).getTime() / 1000); this.live = false; void this.load(); }}/></label>
|
||||
<label>Auflösung<select .value=${this.resolution} @change=${(e: Event) => { this.resolution = (e.target as HTMLSelectElement).value as TrendResolution; void this.load(); }}>${Object.entries(TREND_RESOLUTIONS).map(([id, label]) => html`<option value=${id}>${label}</option>`)}</select></label>
|
||||
<button type="submit" ?disabled=${this.loading}>${this.loading ? "Lädt …" : "Anzeigen"}</button>
|
||||
</div></form>
|
||||
<details class="settings"><summary>Darstellung und Wertebereich</summary><div class="fields">
|
||||
<div class="display-settings"><b class="group-title">Darstellung und Wertebereich</b><div class="fields display-fields">
|
||||
<label>Darstellung<select .value=${this.chartStyle} @change=${(e: Event) => { this.chartStyle = (e.target as HTMLSelectElement).value as typeof this.chartStyle; }}>${Object.entries({ auto: "Automatisch", line: "Linie", step: "Stufen", bar: "Balken", table: "Tabelle" }).map(([id, label]) => html`<option value=${id}>${label}</option>`)}</select></label>
|
||||
<label>Aggregierter Wert<select .value=${this.field} @change=${(e: Event) => { this.field = (e.target as HTMLSelectElement).value as typeof this.field; }}><option value="v">Mittelwert / Verbrauch</option><option value="min">Minimum</option><option value="max">Maximum</option></select></label>
|
||||
<label>Y-Minimum<input type="number" step="any" placeholder="Automatisch" .value=${this.min} @input=${(e: Event) => { this.min = (e.target as HTMLInputElement).value; }}/></label>
|
||||
<label>Y-Maximum<input type="number" step="any" placeholder="Automatisch" .value=${this.max} @input=${(e: Event) => { this.max = (e.target as HTMLInputElement).value; }}/></label>
|
||||
</div><div class="checks"><label><input type="checkbox" .checked=${this.zero} @change=${(e: Event) => { this.zero = (e.target as HTMLInputElement).checked; }}/> Nullpunkt einbeziehen</label><label><input type="checkbox" .checked=${this.band} @change=${(e: Event) => { this.band = (e.target as HTMLInputElement).checked; }}/> Min/Max anzeigen</label></div></details>
|
||||
<div class="actions"><button aria-label="Vorheriger Zeitraum" @click=${() => this.range(this.from - (this.to - this.from), this.from)}>←</button><button aria-label="Nächster Zeitraum" @click=${() => this.range(this.to, this.to + (this.to - this.from))}>→</button><button aria-label="Hineinzoomen" @click=${() => this.zoom(.5)}>+</button><button aria-label="Herauszoomen" @click=${() => this.zoom(2)}>−</button><button @click=${() => void this.load()} ?disabled=${this.loading}>Aktualisieren</button><label><input type="checkbox" .checked=${this.live} @change=${(e: Event) => { this.live = (e.target as HTMLInputElement).checked; }}/> Live (30 s)</label><button @click=${() => this.exportCsv()} ?disabled=${!selected.length}>CSV</button>
|
||||
</div><div class="checks"><label><input type="checkbox" .checked=${this.zero} @change=${(e: Event) => { this.zero = (e.target as HTMLInputElement).checked; }}/> Nullpunkt einbeziehen</label><label><input type="checkbox" .checked=${this.band} @change=${(e: Event) => { this.band = (e.target as HTMLInputElement).checked; }}/> Min/Max anzeigen</label></div></div>
|
||||
<div class="actions"><button @click=${() => this.exportCsv()} ?disabled=${!selected.length}>CSV</button>
|
||||
<nf-help-popup .text=${"Zeitraum und Auflösung lesen die originalen Symcon-Archivdaten. Rohdaten zeigen gespeicherte Änderungen; ein zuvor bekannter Wert wird zum Beginn fortgeführt. Bei Zählern sind aggregierte Werte der Verbrauch pro Intervall, bei Messwerten der Mittelwert. Mehrere Variablen werden einzeln dargestellt; unterschiedliche Einheiten erhalten eigene Diagramme. Zoomen: +/−, Mausrad oder im Diagramm einen Zeitraum ziehen. Eigene Y-Grenzen gelten für alle Diagramme. Begrenzte Rohdatenabfragen werden gekennzeichnet; wähle dann einen kürzeren Zeitraum oder eine Aggregation."}></nf-help-popup>
|
||||
</div>
|
||||
</div></div></details></div>
|
||||
<div class="legend">${this.ids.map((id) => html`<label title=${String(this.hass.states[id]?.attributes.symcon_path || entityName(this.hass, id))}><input type="checkbox" .checked=${!this.hiddenSeries.has(id)} @change=${(e: Event) => { const set = new Set(this.hiddenSeries); if ((e.target as HTMLInputElement).checked) set.delete(id); else set.add(id); this.hiddenSeries = set; this.requestUpdate(); }}/><i style=${`background:${this.color(id)}`}></i>${entityName(this.hass, id)}</label>`)}</div>
|
||||
${this.errors.map((e) => html`<p class="error" role="alert">${e}</p>`)}${this.loading ? html`<p class="note" role="status">Archivwerte werden geladen …</p>` : nothing}
|
||||
${selected.filter((s) => s.truncated).map((s) => html`<p class="error" role="status">${entityName(this.hass, s.entity_id)}: Die Abfrage ist auf ${(s.limit ?? 10000).toLocaleString(this.hass.language)} Einträge begrenzt. Bitte Zeitraum verkürzen oder Auflösung ändern.</p>`)}
|
||||
${selected.some((s) => s.counter && s.aggregation !== "raw") ? html`<p class="note">Zähler: Verbrauch pro Intervall</p>` : nothing}
|
||||
<div class="charts" style=${`min-height:${this.plotHeight}px`}>
|
||||
${this.chartStyle === "table" || allString ? this.table(selected) : [...new Set(selected.filter((s) => s.type !== 3).map((s) => this.unit(s.entity_id)))].map((unit) => this.plot(selected.filter((s) => s.type !== 3 && this.unit(s.entity_id) === unit), unit))}
|
||||
${selected.some((s) => s.type === 3) && !allString && this.chartStyle !== "table" ? this.table(selected.filter((s) => s.type === 3)) : nothing}
|
||||
${!this.loading && selected.length && selected.every((s) => !s.points.length) ? html`<p class="note">Keine Archivwerte in diesem Zeitraum.</p>` : nothing}
|
||||
</div>
|
||||
<div class="cursor"><b>${text}</b>${selected.map((s) => { let p = s.points.at(-1); if (this.hover !== null) { let lo = 0, hi = s.points.length; while (lo < hi) { const mid = (lo + hi) >>> 1; if (s.points[mid].t <= this.hover) lo = mid + 1; else hi = mid; } p = s.points[lo - 1]; } return html`<span style=${`color:${this.color(s.entity_id)}`}>${entityName(this.hass, s.entity_id)}: ${p ? typeof p.v === "number" ? `${this.number(this.value(p)!)} ${this.unit(s.entity_id)}` : p.v : "–"}</span>`; })}</div>
|
||||
</div>
|
||||
</dialog>`;
|
||||
}
|
||||
|
||||
static styles = [tokens, css`
|
||||
:host{font:14px/1.45 system-ui,sans-serif;color:var(--nf-text)}dialog{box-sizing:border-box;width:min(1080px,calc(100vw - 24px));max-height:92vh;max-height:92dvh;padding:0;border:1px solid var(--nf-line);border-radius:14px;background:var(--nf-chrome-solid,#1c1c1c);color:inherit;box-shadow:var(--nf-shadow);overflow:auto}dialog::backdrop{background:#050b16a8}header{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:16px 20px;border-bottom:1px solid var(--nf-line)}h2{font-size:18px;margin:0}header span,.note{font-size:12px;color:var(--nf-muted)}header button{font-size:23px;width:36px;height:36px;padding:0}.body{padding:16px 20px}.presets,.actions,.checks,.legend,.cursor{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin:0 0 14px}.fields{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px;align-items:end;margin:12px 0}.fields label{display:grid;gap:5px;color:var(--nf-muted);font-size:12px}button,input,select{font:inherit;box-sizing:border-box;color:var(--nf-text)}button,select,input:not([type=checkbox]){border:1px solid var(--nf-line);border-radius:7px;padding:8px;background:var(--nf-fill,#292929);min-width:0}button{cursor:pointer}button:disabled{opacity:.45}button:focus-visible,input:focus-visible,select:focus-visible{outline:2px solid var(--nf-accent);outline-offset:2px}.settings{border:1px solid var(--nf-line);padding:10px 12px;border-radius:9px;margin:12px 0}summary{cursor:pointer}.checks label,.actions label,.legend label{display:flex;align-items:center;gap:6px;font-size:12px}.legend i{display:inline-block;width:10px;height:10px;border-radius:50%;flex-shrink:0}.legend label{max-width:100%;overflow-wrap:anywhere}.plot{display:block;width:100%;touch-action:none;user-select:none}.plot text{fill:var(--nf-muted);font:11px system-ui}.grid{stroke:var(--nf-line)}h3{font-size:12px;color:var(--nf-muted);margin:12px 0 0}.chart-group{margin-bottom:10px}.cursor{font-size:12px;align-items:flex-start}.cursor>b{width:100%;color:var(--nf-muted)}.cursor span{overflow-wrap:anywhere}.error{color:#ffa5a5}.table{overflow:auto;max-height:380px;margin:12px 0}table{width:100%;border-collapse:collapse;font-size:12px}td,th{text-align:left;padding:7px;border-bottom:1px solid var(--nf-line);overflow-wrap:anywhere}td:first-child{white-space:nowrap}th{position:sticky;top:0;background:var(--nf-chrome-solid,#1c1c1c)}@media(max-width:500px){header{padding:12px}.body{padding:10px}.fields{grid-template-columns:repeat(2,minmax(0,1fr))}input[type=datetime-local]{font-size:12px;padding:7px 3px}.actions{gap:6px}.actions button{padding:7px}header h2{font-size:16px}}
|
||||
header{position:sticky;top:0;z-index:2;background:var(--nf-chrome-solid,#1c1c1c)}
|
||||
:host { font:13px/1.4 system-ui,sans-serif; color:var(--nf-text); }
|
||||
dialog { box-sizing:border-box; width:min(1080px,calc(100vw - 24px)); max-height:92vh; max-height:92dvh; padding:0; border:1px solid var(--nf-line); border-radius:12px; background:var(--nf-chrome-solid,#1c1c1c); color:inherit; box-shadow:var(--nf-shadow); overflow:auto; }
|
||||
dialog::backdrop { background:#050b16a8; }
|
||||
header { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:8px 12px; border-bottom:1px solid var(--nf-line); position:sticky; top:0; z-index:3; background:var(--nf-chrome-solid,#1c1c1c); }
|
||||
header>div { display:flex; align-items:baseline; flex-wrap:wrap; gap:3px 14px; min-width:0; }
|
||||
h2 { font-size:15px; margin:0; }
|
||||
.range { font-size:11px; color:var(--nf-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
|
||||
header button { width:26px; height:26px; font-size:19px; padding:0; flex-shrink:0; }
|
||||
.body { padding:8px 12px; }
|
||||
.toolbar { position:relative; display:flex; align-items:center; flex-wrap:wrap; gap:5px 10px; margin-bottom:6px; }
|
||||
.presets,.navigation { display:flex; align-items:center; gap:3px; }
|
||||
button,input,select { box-sizing:border-box; color:var(--nf-text); font:inherit; }
|
||||
button,select,input:not([type=checkbox]),summary { border:1px solid var(--nf-line); border-radius:5px; padding:4px 7px; background:var(--nf-fill,#292929); min-width:0; }
|
||||
button { cursor:pointer; font-size:12px; }
|
||||
button:disabled { opacity:.45; }
|
||||
button:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible { outline:2px solid var(--nf-accent); outline-offset:2px; }
|
||||
.toolbar button,.toolbar summary { height:26px; }
|
||||
.navigation button { width:26px; padding:0; font-size:16px; }
|
||||
.presets button { padding:3px 6px; font-size:11px; }
|
||||
.presets button[aria-pressed=true],.settings[open]>summary { border-color:var(--nf-accent); background:color-mix(in srgb,var(--nf-accent) 16%,var(--nf-fill)); }
|
||||
.live-toggle { display:flex; align-items:center; gap:3px; font-size:11px; white-space:nowrap; }
|
||||
input[type=checkbox] { margin:0; }
|
||||
.settings { margin-left:auto; }
|
||||
.settings:not([open])>.settings-panel { display:none; }
|
||||
summary { display:flex; align-items:center; justify-content:center; width:28px; padding:0; list-style:none; font-size:17px; cursor:pointer; }
|
||||
summary::-webkit-details-marker { display:none; }
|
||||
.settings-panel { position:absolute; z-index:2; top:calc(100% + 5px); right:0; box-sizing:border-box; width:min(620px,100%); max-height:min(62vh,480px); overflow:auto; padding:10px 12px; border:1px solid var(--nf-line); border-radius:8px; background:var(--nf-chrome-solid,#1c1c1c); box-shadow:var(--nf-shadow); }
|
||||
.fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-items:end; gap:7px 10px; margin:0 0 10px; }
|
||||
.fields label { display:grid; gap:3px; color:var(--nf-muted); font-size:11px; }
|
||||
.fields input,.fields select { height:28px; width:100%; font-size:12px; }
|
||||
.time-fields button { justify-self:start; }
|
||||
.display-settings { padding-top:8px; border-top:1px solid var(--nf-line); }
|
||||
.group-title { display:block; margin-bottom:6px; font-size:12px; }
|
||||
.actions,.checks,.legend,.cursor { display:flex; align-items:center; flex-wrap:wrap; gap:6px 10px; }
|
||||
.checks { margin:0 0 6px; }
|
||||
.checks label,.legend label { display:flex; align-items:center; gap:4px; font-size:11px; }
|
||||
.legend { margin:4px 0 0; }
|
||||
.legend i { display:inline-block; width:8px; height:8px; border-radius:50%; flex-shrink:0; }
|
||||
.legend label { max-width:100%; overflow-wrap:anywhere; }
|
||||
.plot { display:block; width:100%; touch-action:none; user-select:none; }
|
||||
.plot text { fill:var(--nf-muted); font:11px system-ui; }
|
||||
.grid { stroke:var(--nf-line); }
|
||||
h3 { font-size:11px; color:var(--nf-muted); margin:3px 0 0; }
|
||||
.chart-group { margin-bottom:4px; }
|
||||
.cursor { font-size:11px; align-items:baseline; border-top:1px solid var(--nf-line); padding-top:6px; }
|
||||
.cursor>b { color:var(--nf-muted); font-weight:normal; }
|
||||
.cursor span { overflow-wrap:anywhere; }
|
||||
.note,.error { font-size:12px; margin:6px 0; }
|
||||
.note { color:var(--nf-muted); }
|
||||
.error { color:#ffa5a5; }
|
||||
.table { overflow:auto; max-height:60vh; margin:8px 0; }
|
||||
table { width:100%; border-collapse:collapse; font-size:12px; }
|
||||
td,th { text-align:left; padding:5px; border-bottom:1px solid var(--nf-line); overflow-wrap:anywhere; }
|
||||
td:first-child { white-space:nowrap; }
|
||||
th { position:sticky; top:0; background:var(--nf-chrome-solid,#1c1c1c); }
|
||||
@media(max-width:500px) {
|
||||
header { padding:7px 9px; }
|
||||
header>div { display:grid; gap:1px; }
|
||||
h2 { font-size:14px; }
|
||||
.body { padding:7px 9px; }
|
||||
.toolbar { gap:4px 6px; }
|
||||
.presets { gap:2px; }
|
||||
.presets button { padding:3px 5px; }
|
||||
.settings-panel { padding:9px; }
|
||||
input[type=datetime-local] { font-size:11px; padding:3px; }
|
||||
}
|
||||
`];
|
||||
}
|
||||
// Each lazy bundle has its own Lit copy; use an existing registration when another host loaded it first.
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
import { css, html, LitElement, nothing } from "lit";
|
||||
import { UTILITY_KINDS, type Floor } from "../model.ts";
|
||||
import type { HomeAssistant } from "../types.ts";
|
||||
import { buildingUtilityReadings, floorUtilityReadings, roomUtilityReadings, UTILITY_ICONS, UTILITY_LABELS, utilityMetricLabel, utilityText, type UtilityReading } from "../utilities.ts";
|
||||
import { trendButton } from "./trend-button.ts";
|
||||
|
||||
/** Building → floors, floor → rooms: the same native readings in the bar and the quiet side card. */
|
||||
class NfUtilityOverview extends LitElement {
|
||||
static properties = { hass: { attribute: false }, floors: { attribute: false }, floorId: { attribute: false }, inline: { type: Boolean, reflect: true }, compact: { type: Boolean }, folded: { state: true } };
|
||||
declare hass: HomeAssistant;
|
||||
declare floors: readonly Floor[];
|
||||
declare floorId: string | null;
|
||||
declare inline: boolean;
|
||||
declare compact: boolean;
|
||||
private declare folded: boolean | null;
|
||||
|
||||
constructor() { super(); this.floors = []; this.floorId = null; this.inline = false; this.compact = false; this.folded = null; }
|
||||
private value(row: UtilityReading | undefined) {
|
||||
return row ? html`<span class="value" title=${`${utilityMetricLabel(row)}${row.manual ? " · eigener Stockwerkszähler" : ""}`}><b>${utilityText(this.hass, row)}</b>${row.period !== "total" ? html`<small>${({ day: "heute", month: "Monat", year: "Jahr" })[row.period]}</small>` : nothing}${trendButton(this.hass, row.sources, `${UTILITY_LABELS[row.kind]} · ${utilityMetricLabel(row)}`)}</span>` : nothing;
|
||||
}
|
||||
private open(id: string, room: boolean) { this.dispatchEvent(new CustomEvent("utility-open", { detail: { floorId: room ? this.floorId : id, roomId: room ? id : null }, bubbles: true, composed: true })); }
|
||||
|
||||
render() {
|
||||
if (!this.hass) return nothing;
|
||||
const rooms = this.floors.flatMap((f) => f.rooms), floor = this.floors.find((f) => f.id === this.floorId);
|
||||
if (this.inline) {
|
||||
const rows = floor ? floorUtilityReadings(this.hass, floor, rooms) : buildingUtilityReadings(this.hass, this.floors);
|
||||
return html`${UTILITY_KINDS.map((kind) => {
|
||||
const readings = rows.filter((r) => r.kind === kind);
|
||||
return readings.length ? html`<div class="meter" aria-label=${`${floor?.name || "Gesamtgebäude"} · ${UTILITY_LABELS[kind]}`}><span class="medium" title=${floor?.name || "Gesamtgebäude"}>${UTILITY_ICONS[kind]} ${UTILITY_LABELS[kind]}</span><div class="values">${readings.map((r) => this.value(r))}</div></div>` : nothing;
|
||||
})}`;
|
||||
}
|
||||
const entries = floor ? floor.rooms.map((r) => ({ id: r.id, name: r.name, readings: roomUtilityReadings(this.hass, r, rooms) }))
|
||||
: [...this.floors].sort((a, b) => b.elevation - a.elevation).map((f) => ({ id: f.id, name: f.name, readings: floorUtilityReadings(this.hass, f, rooms) }));
|
||||
const shown = entries.filter((e) => e.readings.length);
|
||||
if (!shown.length) return nothing;
|
||||
const folded = this.folded ?? this.compact;
|
||||
return html`<section class="panel" aria-label=${floor ? "Bereichszähler" : "Stockwerkszähler"}>
|
||||
<button class="heading" aria-expanded=${!folded} @click=${() => { this.folded = !folded; }}><span>${floor ? "Bereiche" : "Stockwerke"}<small>${floor?.name || "Gesamtgebäude"}</small></span><span aria-hidden="true">${folded ? "+" : "−"}</span></button>
|
||||
${folded ? nothing : html`<div class="entries"><div class="columns"><span></span><span title="Leistung bzw. Durchfluss">Leistung</span><span>Energie / Verbrauch</span></div>
|
||||
${shown.map((entry) => html`<section class="entry"><button class="entry-name" title=${entry.name} @click=${() => this.open(entry.id, !!floor)}>${entry.name}</button>
|
||||
${UTILITY_KINDS.map((kind) => {
|
||||
const powers = entry.readings.filter((r) => r.kind === kind && r.metric === "power"), energies = entry.readings.filter((r) => r.kind === kind && r.metric === "energy");
|
||||
return Array.from({ length: Math.max(powers.length, energies.length) }, (_, i) => html`<div class="row"><span class="kind" title=${UTILITY_LABELS[kind]}>${i ? "" : `${UTILITY_ICONS[kind]} ${UTILITY_LABELS[kind]}`}</span>${powers[i] ? this.value(powers[i]) : html`<span></span>`}${energies[i] ? this.value(energies[i]) : html`<span></span>`}</div>`);
|
||||
})}
|
||||
</section>`)}
|
||||
</div>`}
|
||||
</section>`;
|
||||
}
|
||||
|
||||
static styles = css`
|
||||
:host { display:flex; width:100%; min-height:0; max-height:100%; color:var(--nf-text); font:12px/1.4 system-ui,sans-serif; pointer-events:auto; }
|
||||
:host([inline]) { display:flex; flex-wrap:wrap; align-items:stretch; gap:6px; width:auto; max-width:100%; }
|
||||
.meter { padding:5px 9px; border-radius:10px; background:var(--nf-chrome); border-left:2px solid var(--nf-line); backdrop-filter:blur(6px); }
|
||||
.medium { font-size:11px; color:var(--nf-muted); }
|
||||
.medium small { font-size:10px; }
|
||||
.values { display:flex; flex-wrap:wrap; gap:3px 10px; }
|
||||
.value { display:inline-flex; align-items:center; justify-content:flex-end; gap:3px; min-width:0; white-space:nowrap; font-variant-numeric:tabular-nums; }
|
||||
.value b { font-size:12px; font-weight:600; }
|
||||
.value small { color:var(--nf-muted); font-size:9px; }
|
||||
nf-trend-button { margin-left:0; }
|
||||
.panel { display:flex; flex-direction:column; box-sizing:border-box; width:100%; max-height:100%; border:1px solid var(--nf-line); border-radius:12px; background:var(--nf-chrome); backdrop-filter:blur(8px); overflow:hidden; }
|
||||
button { color:inherit; font:inherit; border:0; background:none; cursor:pointer; text-align:left; }
|
||||
button:focus-visible { outline:2px solid var(--nf-accent); outline-offset:-2px; }
|
||||
.heading { display:flex; flex-shrink:0; align-items:center; justify-content:space-between; gap:12px; width:100%; padding:8px 10px; font-weight:600; }
|
||||
.heading small { display:block; color:var(--nf-muted); font-size:10px; font-weight:normal; }
|
||||
.entries { min-height:0; max-height:min(50vh,480px); overflow:auto; padding:0 10px 8px; }
|
||||
.columns,.row { display:grid; grid-template-columns:54px minmax(0,1fr) minmax(0,1.2fr); align-items:center; gap:5px; }
|
||||
.columns { color:var(--nf-muted); font-size:9px; text-align:right; margin-bottom:2px; }
|
||||
.entry { border-top:1px solid var(--nf-line); padding:6px 0; }
|
||||
.entry:last-child { padding-bottom:0; }
|
||||
.entry-name { display:block; width:100%; padding:0 0 3px; font-size:11px; font-weight:600; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
|
||||
.entry-name:hover { color:var(--nf-accent); }
|
||||
.row { min-height:20px; }
|
||||
.kind { color:var(--nf-muted); font-size:10px; white-space:nowrap; }
|
||||
.row .value b { font-size:11px; font-weight:normal; }
|
||||
@media(max-width:600px) { .entries { max-height:32vh; } }
|
||||
`;
|
||||
}
|
||||
if (!customElements.get("nf-utility-overview")) customElements.define("nf-utility-overview", NfUtilityOverview);
|
||||
@@ -54,6 +54,7 @@ import { isSymcon, isSymconVariable, nativeBool, nativeText } from "../entities/
|
||||
import { WEATHER_VARIABLE_LABELS } from "../symcon-weather.ts";
|
||||
import { floorUtilityReadings, utilityText } from "../utilities.ts";
|
||||
import "./utility-report.ts";
|
||||
import "./utility-overview.ts";
|
||||
import { trendButton } from "./trend-button.ts";
|
||||
import { deviceValuesText } from "../entities/device-values.ts";
|
||||
import { furnitureShown, hiddenFurniture, withoutHidden } from "../entities/visibility.ts";
|
||||
@@ -2527,15 +2528,15 @@ export class NfView3d extends LitElement {
|
||||
</section>`;
|
||||
}
|
||||
|
||||
private renderToday() {
|
||||
private renderToday(utilities: ReturnType<NfView3d["utilityOverview"]>) {
|
||||
const b = this.building;
|
||||
const hass = this.hass;
|
||||
// the room panel (a room, or Outside) takes the right side; the Today card would lie under it and catch its taps (#83)
|
||||
if (!b || !hass || this.clean || this.roomId || this.panelOpen) return nothing;
|
||||
const forecast = this.renderForecast("top_right");
|
||||
const today = this.today === false ? nothing : this.renderTodayCard(b, hass);
|
||||
if (today === nothing && forecast === nothing) return nothing;
|
||||
return html`<div class="nf-right-col" style=${this.clock === "top_right" ? "top: 78px" : ""}>${today}${forecast}</div>`;
|
||||
if (today === nothing && forecast === nothing && utilities === nothing) return nothing;
|
||||
return html`<div class="nf-right-col ${utilities !== nothing ? "nf-utility-right" : ""}" style=${this.clock === "top_right" ? "top: 78px" : ""}>${utilities}${today}${forecast}</div>`;
|
||||
}
|
||||
|
||||
private renderTodayCard(b: Building, hass: HomeAssistant) {
|
||||
@@ -2746,6 +2747,15 @@ export class NfView3d extends LitElement {
|
||||
}
|
||||
|
||||
/** The plan's own sensors at the top (outside temperature, the alarm…): their name and state; a tap opens their details. */
|
||||
private utilityOverview(inline: boolean) {
|
||||
const b = this.building;
|
||||
if (!b || !isSymcon(this.hass) || !this.showEnergy || this.clean || this.roomId || this.panelOpen) return nothing;
|
||||
const rooms = b.floors.flatMap((f) => f.rooms), floors = this.floorId ? b.floors.filter((f) => f.id === this.floorId) : b.floors;
|
||||
if (!floors.some((f) => floorUtilityReadings(this.hass, f, rooms).length)) return nothing;
|
||||
return html`<nf-utility-overview ?inline=${inline} .hass=${this.hass} .floors=${b.floors} .floorId=${this.floorId} .compact=${this._narrowStage}
|
||||
@utility-open=${(e: CustomEvent<{ floorId: string; roomId: string | null }>) => { e.stopPropagation(); if (e.detail.roomId) this.openRoom(e.detail.floorId, e.detail.roomId); else this.fire("floor-tap", { floorId: e.detail.floorId }); }}></nf-utility-overview>`;
|
||||
}
|
||||
|
||||
private ownSensors() {
|
||||
const ids = this.sensorBar && this.hass ? (this.building?.settings.status_entities ?? []) : [];
|
||||
const people = isSymcon(this.hass) ? (this.building?.presence ?? []).filter((link) => isSymconVariable(this.hass, link.person, [0])).map((link) => html`<div class="nf-energy-item nf-presence-state"><span>${link.name || entityName(this.hass, link.person)}</span><b>${nativeBool(this.hass.states[link.person]) === null ? "–" : nativeBool(this.hass.states[link.person]) ? "Anwesend" : "Abwesend"}${trendButton(this.hass, [link.person], link.name || "Anwesenheit")}</b></div>`) : [];
|
||||
@@ -2756,7 +2766,7 @@ export class NfView3d extends LitElement {
|
||||
const floors = isSymcon(this.hass) ? (this.building?.floors ?? []).filter((f) => !this.floorId || f.id === this.floorId).map((f) => ({ floor: f, readings: floorUtilityReadings(this.hass, f, this.building?.floors.flatMap((x) => x.rooms)) })).filter((f) => f.readings.length) : [];
|
||||
const utilities = floors.length ? html`<button class="nf-energy-item nf-flow-toggle nf-utility-toggle" aria-label="Stockwerkszähler anzeigen" title="Stockwerkszähler anzeigen" aria-haspopup="dialog" @click=${() => this.renderRoot.querySelector<HTMLDialogElement>(".nf-utility-dialog")?.showModal()}><span>Stockwerkszähler</span><b aria-hidden="true">⚡ 💧</b></button>
|
||||
<dialog class="nf-weather-dialog nf-utility-dialog" aria-label="Stockwerkszähler" @keydown=${(event: KeyboardEvent) => event.stopPropagation()}><header><b>Stockwerkszähler</b><button type="button" class="nf-chip" aria-label="Schließen" @click=${() => this.renderRoot.querySelector<HTMLDialogElement>(".nf-utility-dialog")?.close()}>×</button></header>${floors.map(({ floor, readings }) => html`<h3>${floor.name}</h3><nf-utility-report .hass=${this.hass} .readings=${readings}></nf-utility-report>`)}</dialog>` : nothing;
|
||||
return [...people, weatherValues, utilities, ...ids
|
||||
return [this.utilityOverview(true), ...people, weatherValues, utilities, ...ids
|
||||
.filter((id) => this.hass.states[id])
|
||||
.map(
|
||||
(id) => html`<button class="nf-energy-item nf-own-sensor" title=${entityName(this.hass, id)} @click=${() => openMoreInfo(this, id)}>
|
||||
@@ -2819,17 +2829,18 @@ export class NfView3d extends LitElement {
|
||||
}
|
||||
|
||||
protected render() {
|
||||
const utilities = this.utilityOverview(false);
|
||||
const sky = this._sky;
|
||||
const mix = (a: number[], b: number[]) => `rgb(${a.map((v, i) => Math.round(v + (b[i] - v) * sky)).join(",")})`;
|
||||
const stage = STAGE[this.theme] ?? STAGE.neon;
|
||||
const style = `--nf-sky:${mix(stage.night[0], stage.day[0])};--nf-ground:${mix(stage.night[1], stage.day[1])}` + backdropStyle(this.building?.settings.backdrop);
|
||||
return html`<div
|
||||
class="nf-stage ${this.roomLabels ? "" : "nf-no-room-names"} ${this._low ? "nf-low" : ""} ${this.panelOpen ? "nf-panel-open" : ""} ${this._alerts.length ? "nf-has-alerts" : ""} ${this._narrowStage ? "nf-narrow" : ""}"
|
||||
class="nf-stage ${this.roomLabels ? "" : "nf-no-room-names"} ${this._low ? "nf-low" : ""} ${this.panelOpen ? "nf-panel-open" : ""} ${this._alerts.length ? "nf-has-alerts" : ""} ${this._narrowStage ? "nf-narrow" : ""} ${utilities !== nothing ? "nf-has-utility-overview" : ""}"
|
||||
style=${style}
|
||||
>
|
||||
${this._error ? html`<p class="nf-error">${this._error}</p>` : nothing} ${this.renderTopLeft()} ${renderLhCards(this.hass, this._liveCards, (domain, service, entity, data) => this.hass?.callService(domain, service, { entity_id: entity, ...data }), { folded: this._houseFolded, toggle: () => this.toggleHouseFold() }, !!this.roomId || this.panelOpen)} ${this.clean ? nothing : this.renderLegend()} ${this.renderMapCredit()}
|
||||
${this.renderAlerts()} ${this.renderAnnouncement()} ${this.clean ? nothing : html`${this.renderThumbs()} ${this.renderScenes()} ${this.renderFind()} ${this.renderCentral()}`} ${this.renderSwipe()}
|
||||
${this.renderMenu()} ${this.renderPlate()} ${this.renderEye()} ${this.renderLock()} ${this.renderWalk()} ${this.renderTravel()} ${this.renderClock()} ${this.renderToday()} ${this.renderLayers()} ${this.renderPluginWindow()}
|
||||
${this.renderMenu()} ${this.renderPlate()} ${this.renderEye()} ${this.renderLock()} ${this.renderWalk()} ${this.renderTravel()} ${this.renderClock()} ${this.renderToday(utilities)} ${this.renderLayers()} ${this.renderPluginWindow()}
|
||||
${this.showStats && this._stats
|
||||
? html`<span class="nf-stats"
|
||||
><b>${this._stats.fps ? translate(this.hass, "stats_fps", { fps: this._stats.fps, ms: this._stats.worstMs }) : translate(this.hass, "stats_idle")}</b>
|
||||
@@ -3411,6 +3422,24 @@ export class NfView3d extends LitElement {
|
||||
.nf-right-col > * {
|
||||
pointer-events: auto;
|
||||
}
|
||||
.nf-utility-right {
|
||||
height: calc(100% - 140px);
|
||||
}
|
||||
.nf-has-utility-overview:not(.nf-narrow) > .nf-energy,
|
||||
.nf-has-utility-overview:not(.nf-narrow) > .nf-topleft {
|
||||
max-width: calc(100% - 316px);
|
||||
}
|
||||
.nf-has-utility-overview .nf-energy {
|
||||
align-items: flex-start;
|
||||
}
|
||||
.nf-narrow .nf-utility-right {
|
||||
top: auto !important;
|
||||
bottom: 64px;
|
||||
height: 42%;
|
||||
max-height: 42%;
|
||||
justify-content: flex-end;
|
||||
width: min(280px, calc(100% - 24px));
|
||||
}
|
||||
.nf-has-alerts .nf-right-col {
|
||||
top: 58px;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { test } from "node:test";
|
||||
import { box, entity, floorWith, hassOf } from "./entities/fixtures.ts";
|
||||
import type { HomeAssistant, SymconObject } from "./types.ts";
|
||||
import { emptyBuilding, UTILITY_KINDS } from "./model.ts";
|
||||
import { floorMeter, floorUtilityReadings, roomUtilityReadings, utilityText, utilityWatched } from "./utilities.ts";
|
||||
import { buildingUtilityReadings, floorMeter, floorUtilityReadings, roomUtilityReadings, utilityText, utilityWatched } from "./utilities.ts";
|
||||
import { roomPower, roomPowerSensors } from "./heatmap.ts";
|
||||
import { floorCounts, floorInfoText } from "./presence.ts";
|
||||
import { watchedEntities } from "./components/view3d/watch-list.ts";
|
||||
@@ -165,3 +165,22 @@ test("the view watches automatic and all five manual floor meters even without h
|
||||
test("HA rooms do not gain guessed native utility readings", () => {
|
||||
assert.deepEqual(roomUtilityReadings(hassOf([]), box("r", 0, 0, 4, 3, "living")), []);
|
||||
});
|
||||
|
||||
test("building totals use effective floor meters, deduplicate shared sources and retain units and Err: partial sums", () => {
|
||||
const f = fixture(); f.node(10, 0, "A"); f.node(11, 10, "Strom");
|
||||
f.variable(12, 11, "Leistung", 100, "W"); f.variable(13, 11, "Verbrauch", 1, "kWh");
|
||||
f.node(20, 0, "B"); f.node(21, 20, "Strom");
|
||||
const bPower = f.variable(22, 21, "Leistung", 200, "W"); f.variable(23, 21, "Verbrauch", 2000, "Wh");
|
||||
f.node(24, 20, "Wasser"); f.variable(25, 24, "Verbrauch", 5, "m³");
|
||||
const manual = f.variable(90, 0, "Stockwerksleistung", 0.5, "kW");
|
||||
const a = floorWith([f.room()], { id: "a", utility_meters: { electricity: { power: manual } } }), b = floorWith([f.room(20)], { id: "b" });
|
||||
const h = f.hass();
|
||||
let rows = buildingUtilityReadings(h, [a, b]);
|
||||
assert.deepEqual(rows.map((r) => [r.kind, r.metric, r.unit, r.value]), [["electricity", "power", "W", 700], ["electricity", "energy", "kWh", 3], ["water", "energy", "m³", 5]]);
|
||||
const offline = { ...h, states: { ...h.states, [bPower]: { ...h.states[bPower], state: "unavailable" } } };
|
||||
assert.equal(utilityText(offline, buildingUtilityReadings(offline, [a, b])[0]), "Err: 500 W");
|
||||
b.utility_meters = { electricity: { power: manual } };
|
||||
rows = buildingUtilityReadings(h, [a, b]);
|
||||
assert.equal(rows[0].value, 500, "one shared native meter must not count twice in the building");
|
||||
assert.deepEqual(rows[0].sources, [manual]);
|
||||
});
|
||||
@@ -139,6 +139,13 @@ export function floorUtilityReadings(hass: HomeAssistant, floor: Floor, rooms: r
|
||||
return result;
|
||||
}
|
||||
|
||||
/** Sum the effective floor meters; shared native sources count only once for the building. */
|
||||
export function buildingUtilityReadings(hass: HomeAssistant, floors: readonly Floor[]): UtilityReading[] {
|
||||
const rooms = floors.flatMap((f) => f.rooms);
|
||||
const sources = floors.flatMap((f) => floorUtilityReadings(hass, f, rooms).flatMap((r) => r.sources.map((id) => ({ kind: r.kind, metric: r.metric, period: r.period, id }))));
|
||||
return readings(hass, sources);
|
||||
}
|
||||
|
||||
export function utilityWatched(hass: HomeAssistant, floors: readonly Floor[]): string[] {
|
||||
const rooms = floors.flatMap((f) => f.rooms);
|
||||
return [...new Set(floors.flatMap((f) => [
|
||||
|
||||
@@ -277,6 +277,15 @@ try {
|
||||
await page.evaluate(async () => {
|
||||
const d = window.trendDialog;
|
||||
if (!d.shadowRoot.querySelector("dialog").open) throw new Error("Trend must open as a modal");
|
||||
window.assertTrendLayout = () => {
|
||||
const d = document.querySelector("nf-trend-dialog"), root = d.shadowRoot;
|
||||
const dialog = root.querySelector("dialog").getBoundingClientRect(), plot = root.querySelector(".plot").getBoundingClientRect(), toolbar = root.querySelector(".toolbar").getBoundingClientRect();
|
||||
if (root.querySelector(".settings").open || root.querySelector(".settings-panel").getBoundingClientRect().height) throw new Error("Advanced controls must start collapsed");
|
||||
if (plot.height < dialog.height * .6 || toolbar.height > (innerWidth < 600 ? 60 : 30)) throw new Error("The graph must dominate the popup and controls must stay compact");
|
||||
if ([...root.querySelectorAll(".toolbar button")].some((b) => b.getBoundingClientRect().height > 27)) throw new Error("Toolbar buttons must remain compact");
|
||||
if (dialog.left < 0 || dialog.right > innerWidth) throw new Error("Trend dialog must fit the viewport");
|
||||
};
|
||||
window.assertTrendLayout();
|
||||
[...d.shadowRoot.querySelectorAll(".presets button")].find((b) => b.textContent === "7 Tage").click();
|
||||
});
|
||||
await page.waitForFunction(() => window.trendDialog.series[0]?.aggregation === "hour");
|
||||
@@ -285,7 +294,7 @@ try {
|
||||
const d = window.trendDialog; d.shadowRoot.querySelector(".settings").open = true;
|
||||
const inputs = d.shadowRoot.querySelectorAll('input[type="number"]');
|
||||
for (const [i, value] of [[0, "15"], [1, "30"]]) { inputs[i].value = value; inputs[i].dispatchEvent(new Event("input", { bubbles: true })); }
|
||||
const selects = d.shadowRoot.querySelectorAll(".settings select"); selects[0].value = "bar"; selects[0].dispatchEvent(new Event("change", { bubbles: true }));
|
||||
const selects = d.shadowRoot.querySelectorAll(".display-fields select"); selects[0].value = "bar"; selects[0].dispatchEvent(new Event("change", { bubbles: true }));
|
||||
await d.updateComplete;
|
||||
if (!d.shadowRoot.querySelector(".plot g rect")) throw new Error("Selectable bar chart is missing");
|
||||
const resolution = d.shadowRoot.querySelector("form select"); resolution.value = "day"; resolution.dispatchEvent(new Event("change", { bubbles: true }));
|
||||
@@ -303,14 +312,15 @@ try {
|
||||
await page.waitForFunction(() => window.trendDialog.series[0]?.points.length === 6);
|
||||
await page.evaluate(async () => {
|
||||
window.trendEmpty = true;
|
||||
[...window.trendDialog.shadowRoot.querySelectorAll("button")].find((b) => b.textContent === "Aktualisieren").click();
|
||||
window.trendDialog.shadowRoot.querySelector('[aria-label="Aktualisieren"]').click();
|
||||
});
|
||||
await page.waitForFunction(() => window.trendDialog.shadowRoot.textContent.includes("Keine Archivwerte"));
|
||||
await page.evaluate(() => { window.trendEmpty = false; window.trendReject = true; [...window.trendDialog.shadowRoot.querySelectorAll("button")].find((b) => b.textContent === "Aktualisieren").click(); });
|
||||
await page.evaluate(() => { window.trendEmpty = false; window.trendReject = true; window.trendDialog.shadowRoot.querySelector('[aria-label="Aktualisieren"]').click(); });
|
||||
await page.waitForFunction(() => window.trendDialog.shadowRoot.textContent.includes("fixture_archive_unavailable"));
|
||||
await page.evaluate(() => { window.trendReject = false; window.trendTruncated = true; [...window.trendDialog.shadowRoot.querySelectorAll("button")].find((b) => b.textContent === "Aktualisieren").click(); });
|
||||
await page.evaluate(() => { window.trendReject = false; window.trendTruncated = true; window.trendDialog.shadowRoot.querySelector('[aria-label="Aktualisieren"]').click(); });
|
||||
await page.waitForFunction(() => window.trendDialog.shadowRoot.textContent.includes("10.000 Einträge"));
|
||||
await page.evaluate(async () => {
|
||||
window.trendDialog.shadowRoot.querySelector(".settings summary").click();
|
||||
const original = URL.createObjectURL.bind(URL), click = HTMLAnchorElement.prototype.click;
|
||||
URL.createObjectURL = (blob) => { window.exportedTrendCsv = blob; return original(blob); };
|
||||
HTMLAnchorElement.prototype.click = function() { if (this.download !== "Symcon-Trend.csv") return click.call(this); };
|
||||
@@ -318,14 +328,19 @@ try {
|
||||
URL.createObjectURL = original; HTMLAnchorElement.prototype.click = click;
|
||||
if (!(await window.exportedTrendCsv.text()).includes("Zeit;Wert")) throw new Error("CSV export is missing");
|
||||
window.trendTruncated = false;
|
||||
[...window.trendDialog.shadowRoot.querySelectorAll("button")].find((b) => b.textContent === "Aktualisieren").click();
|
||||
window.trendDialog.shadowRoot.querySelector('[aria-label="Aktualisieren"]').click();
|
||||
});
|
||||
await page.waitForFunction(() => window.trendDialog.series[0]?.points.length === 6 && !window.trendDialog.loading);
|
||||
await page.evaluate(() => window.assertTrendLayout());
|
||||
await page.screenshot({ path: join(out, "symcon-trend-desktop.png") });
|
||||
await page.setViewport({ width: 390, height: 844 });
|
||||
await page.waitForFunction(() => window.trendDialog.width < 400);
|
||||
await page.evaluate(() => window.assertTrendLayout());
|
||||
assert.equal(await page.evaluate(() => { const r = window.trendDialog.shadowRoot.querySelector("dialog").getBoundingClientRect(); return r.left >= 0 && r.right <= innerWidth; }), true);
|
||||
await page.screenshot({ path: join(out, "symcon-trend-mobile.png") });
|
||||
await page.evaluate(() => window.trendDialog.shadowRoot.querySelector(".settings summary").click());
|
||||
await page.keyboard.press("Escape");
|
||||
assert.equal(await page.evaluate(() => window.trendDialog.shadowRoot.querySelector("dialog").open && !window.trendDialog.shadowRoot.querySelector(".settings").open), true, "Escape closes the settings before the whole chart");
|
||||
await page.keyboard.press("Escape");
|
||||
await page.waitForFunction(() => !document.querySelector("nf-trend-dialog"));
|
||||
for (const [ids, table] of [[["sensor.219"], true], [["light.213"], false], [["sensor.201", "sensor.203"], false]]) {
|
||||
|
||||
@@ -37,10 +37,13 @@ try {
|
||||
variable(id + 2, id, "Verbrauch", 10 + index, index === 1 ? "m³" : "kWh");
|
||||
}
|
||||
node(9200, 9020, "Strom"); variable(9201, 9200, "Leistung", 500, "W"); variable(9202, 9200, "Verbrauch", 5, "kWh");
|
||||
node(9030, 9000, "Serverraum"); node(9300, 9030, "Strom"); variable(9301, 9300, "Leistung", 2, "kW"); variable(9302, 9300, "Verbrauch", 20, "kWh");
|
||||
variable(9900, 9000, "Eigener Stockwerksverbrauch", 75, "kWh", "cover");
|
||||
const b = structuredClone(p.data.building), floor = b.floors[0];
|
||||
floor.rooms[0].area_id = "symcon-category-9010"; floor.rooms[1].area_id = "symcon-category-9020";
|
||||
floor.power_entity = null; floor.utility_meters = null;
|
||||
b.floors[1].rooms[0].area_id = "symcon-category-9030";
|
||||
b.floors[1].power_entity = null; b.floors[1].utility_meters = null;
|
||||
window.utilityFloorId = floor.id;
|
||||
p.data.edit(b);
|
||||
p.hass = { ...p.hass, language: "de", states, symconObjects: objects };
|
||||
@@ -82,7 +85,19 @@ try {
|
||||
});
|
||||
assert.equal(await page.evaluate(() => window.nfPanel.data.building.floors[0].utility_meters.electricity.energy), null);
|
||||
await page.waitForFunction(() => window.nfPanel.shadowRoot.querySelector("nf-view3d")?.shadowRoot.querySelector(".nf-utility-toggle"));
|
||||
await page.evaluate(() => { window.utilityView = window.nfPanel.shadowRoot.querySelector("nf-view3d"); window.utilityView.shadowRoot.querySelector(".nf-utility-toggle").click(); });
|
||||
await page.evaluate(() => { window.utilityView = window.nfPanel.shadowRoot.querySelector("nf-view3d"); });
|
||||
await page.waitForFunction(() => window.utilityView.shadowRoot.querySelector('nf-utility-overview[inline]')?.shadowRoot.textContent.includes("35 kWh"));
|
||||
assert.match(await page.evaluate(() => window.utilityView.shadowRoot.querySelector('nf-utility-overview[inline]').shadowRoot.textContent), /3,5 kW/);
|
||||
assert.equal(await page.evaluate(() => window.utilityView.shadowRoot.querySelector('.nf-utility-right nf-utility-overview').shadowRoot.querySelectorAll('.entry').length), 2, "building view lists both floors in the side card");
|
||||
await page.evaluate(async () => {
|
||||
const overview = window.utilityView.shadowRoot.querySelector('.nf-utility-right nf-utility-overview');
|
||||
const name = window.nfPanel.data.building.floors[0].name;
|
||||
[...overview.shadowRoot.querySelectorAll('.entry-name')].find((b) => b.textContent === name).click();
|
||||
});
|
||||
await page.waitForFunction(() => window.utilityView.floorId === window.utilityFloorId && window.utilityView.shadowRoot.querySelector('nf-utility-overview[inline]').shadowRoot.textContent.includes("15 kWh"));
|
||||
assert.match(await page.evaluate(() => window.utilityView.shadowRoot.querySelector('nf-utility-overview[inline]').shadowRoot.textContent), /1,5 kW/);
|
||||
assert.equal(await page.evaluate(() => window.utilityView.shadowRoot.querySelector('.nf-utility-right nf-utility-overview').shadowRoot.querySelectorAll('.entry').length), 2, "floor view lists its two metered rooms");
|
||||
await page.evaluate(() => window.utilityView.shadowRoot.querySelector(".nf-utility-toggle").click());
|
||||
assert.equal(await page.evaluate(() => window.utilityView.shadowRoot.querySelector(".nf-utility-dialog").open), true);
|
||||
assert.match(await page.evaluate(async () => { const r = window.utilityView.shadowRoot.querySelector(".nf-utility-dialog nf-utility-report"); await r.updateComplete; return r.shadowRoot.textContent; }), /15 kWh/);
|
||||
await page.evaluate(async () => {
|
||||
@@ -91,6 +106,7 @@ try {
|
||||
await p.updateComplete;
|
||||
});
|
||||
await page.waitForFunction(() => window.utilityView.shadowRoot.querySelector(".nf-utility-dialog nf-utility-report").shadowRoot.textContent.includes("18 kWh"));
|
||||
assert.match(await page.evaluate(() => window.utilityView.shadowRoot.querySelector('nf-utility-overview[inline]').shadowRoot.textContent), /18 kWh/);
|
||||
await page.evaluate(async () => {
|
||||
const p = window.nfPanel, states = { ...p.hass.states };
|
||||
for (const id of ["sensor.9201", "sensor.9202"]) states[id] = { ...states[id], state: "unavailable" };
|
||||
@@ -122,6 +138,29 @@ try {
|
||||
p.hass = { ...p.hass, states }; await p.updateComplete;
|
||||
});
|
||||
await page.waitForFunction(() => { const text = window.utilityView.shadowRoot.querySelector(".nf-utility-dialog nf-utility-report").shadowRoot.textContent; return text.includes("18 kWh") && !text.includes("Err:"); });
|
||||
await page.keyboard.press("Escape");
|
||||
const mobilePanel = await page.evaluate(() => {
|
||||
const host = window.utilityView.shadowRoot.querySelector('.nf-utility-right nf-utility-overview'), panel = host.shadowRoot.querySelector('.panel');
|
||||
const r = panel.getBoundingClientRect();
|
||||
return { folded: host.shadowRoot.querySelector('.heading').getAttribute('aria-expanded'), left: r.left, right: r.right, bottom: r.bottom, stageBottom: window.utilityView.getBoundingClientRect().bottom };
|
||||
});
|
||||
assert.equal(mobilePanel.folded, "false", "the narrow view starts with a folded overview");
|
||||
assert.ok(mobilePanel.left >= 0 && mobilePanel.right <= 390 && mobilePanel.bottom <= mobilePanel.stageBottom, "side card fits the narrow view");
|
||||
await page.evaluate(() => window.utilityView.shadowRoot.querySelector('.nf-utility-right nf-utility-overview').shadowRoot.querySelector('.heading').click());
|
||||
await page.waitForFunction(() => window.utilityView.shadowRoot.querySelector('.nf-utility-right nf-utility-overview').shadowRoot.querySelectorAll('.entry').length === 2);
|
||||
await page.screenshot({ path: join(out, "symcon-utility-overview-mobile.png") });
|
||||
await page.setViewport({ width: 1440, height: 1000 });
|
||||
await page.waitForFunction(() => !window.utilityView._narrowStage);
|
||||
await page.screenshot({ path: join(out, "symcon-utility-overview-floor.png") });
|
||||
await page.evaluate(() => { const p = window.nfPanel; [...p.shadowRoot.querySelectorAll('.nf-nav button')].find((b) => b.textContent.trim() === p.t('all_floors')).click(); });
|
||||
await page.waitForFunction(() => window.utilityView.floorId === null && window.utilityView.shadowRoot.querySelector('nf-utility-overview[inline]').shadowRoot.textContent.includes("38 kWh"));
|
||||
await page.screenshot({ path: join(out, "symcon-utility-overview-building.png") });
|
||||
assert.equal(await page.evaluate(() => window.utilityView.shadowRoot.querySelector('.nf-utility-right nf-utility-overview').shadowRoot.querySelectorAll('.entry').length), 2);
|
||||
await page.evaluate(() => { const p = window.nfPanel, card = window.utilityView.shadowRoot.querySelector('.nf-utility-right nf-utility-overview'); [...card.shadowRoot.querySelectorAll('.entry-name')].find((b) => b.textContent === p.data.building.floors[0].name).click(); });
|
||||
await page.waitForFunction(() => window.utilityView.floorId === window.utilityFloorId);
|
||||
await page.evaluate(() => window.utilityView.shadowRoot.querySelector('.nf-utility-right nf-utility-overview').shadowRoot.querySelector('.entry-name').click());
|
||||
await page.waitForFunction(() => window.utilityView.roomId === window.nfPanel.data.building.floors[0].rooms[0].id && window.utilityView.panelOpen);
|
||||
assert.equal(await page.evaluate(() => !!window.utilityView.shadowRoot.querySelector('.nf-utility-right')), false, "the overview leaves space for the opened room menu");
|
||||
assert.deepEqual(errors, []);
|
||||
console.log("OK: hidden category/dummy discovery, room/floor totals and headers, native meter selectors, clear-to-automatic, live updates, Err: partial sums, missing readings, recovery and desktop/mobile dialog");
|
||||
} finally {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
|
||||
var x={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",fr:"6312d0f61ebf",hu:"27ba348531dc",it:"1b705e76dd00",nb:"c5ea24fb9ef6",nl:"b64142c67c2e",pl:"8527a4930402",pt:"31857a2d2277",ro:"e3cb5f449f0f",sk:"320611594db0",sl:"8071691ceda3",sv:"711b911ec8da",tr:"7c83ce1c3372",zh:"50518d9f494e"};Array.prototype.at||Object.defineProperty(Array.prototype,"at",{configurable:!0,writable:!0,value:function(e){let t=Math.trunc(e)||0;return this[t<0?this.length+t:t]}});typeof globalThis.structuredClone!="function"&&(globalThis.structuredClone=r=>r===void 0?r:JSON.parse(JSON.stringify(r)));var Nn=globalThis,Cn=Nn.ShadowRoot&&(Nn.ShadyCSS===void 0||Nn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ti=Symbol(),Zo=new WeakMap,jt=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==ti)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Cn&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=Zo.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Zo.set(t,e))}return e}toString(){return this.cssText}},Yo=r=>new jt(typeof r=="string"?r:r+"",void 0,ti),X=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((n,i,o)=>n+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+r[o+1],r[0]);return new jt(t,r,ti)},Jo=(r,e)=>{if(Cn)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),i=Nn.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},ni=Cn?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return Yo(t)})(r):r;var{is:Ku,defineProperty:Gu,getOwnPropertyDescriptor:Uu,getOwnPropertyNames:ju,getOwnPropertySymbols:qu,getPrototypeOf:Zu}=Object,Wn=globalThis,Qo=Wn.trustedTypes,Yu=Qo?Qo.emptyScript:"",Ju=Wn.reactiveElementPolyfillSupport,qt=(r,e)=>r,ri={toAttribute(r,e){switch(e){case Boolean:r=r?Yu:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},es=(r,e)=>!Ku(r,e),Xo={attribute:!0,type:String,converter:ri,reflect:!1,useDefault:!1,hasChanged:es};Symbol.metadata??=Symbol("metadata"),Wn.litPropertyMetadata??=new WeakMap;var De=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Xo){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),i=this.getPropertyDescriptor(e,n,t);i!==void 0&&Gu(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){let{get:i,set:o}=Uu(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:i,set(s){let a=i?.call(this);o?.call(this,s),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Xo}static _$Ei(){if(this.hasOwnProperty(qt("elementProperties")))return;let e=Zu(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(qt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(qt("properties"))){let t=this.properties,n=[...ju(t),...qu(t)];for(let i of n)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,i]of t)this.elementProperties.set(n,i)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let i=this._$Eu(t,n);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let i of n)t.unshift(ni(i))}else e!==void 0&&t.push(ni(e));return t}static _$Eu(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadLine truncated
|
||||
\f\r]`,Zt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,rs=/-->/g,is=/>/g,it=RegExp(`>|${ii}(?:([^\\s"'>=/]+)(${ii}*=${ii}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),os=/'/g,ss=/"/g,us=/^(?:script|style|textarea|title)$/i,hi=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),p=hi(1),ne=hi(2),Lf=hi(3),at=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),as=new WeakMap,ot=st.createTreeWalker(st,129);function ds(r,e){if(!di(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return ns!==void 0?ns.createHTML(e):e}var ed=(r,e)=>{let t=r.length-1,n=[],i,o=e===2?"<svg>":e===3?"<math>":"",s=Zt;for(let a=0;a<t;a++){let l=r[a],c,u,d=-1,m=0;for(;m<l.length&&(s.lastIndex=m,u=s.exec(l),u!==null);)m=s.lastIndex,s===Zt?u[1]==="!--"?s=rs:u[1]!==void 0?s=is:u[2]!==void 0?(us.test(u[2])&&(i=RegExp("</"+u[2],"g")),s=it):u[3]!==void 0&&(s=it):s===it?u[0]===">"?(s=i??Zt,d=-1):u[1]===void 0?d=-2:(d=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?it:u[3]==='"'?ss:os):s===ss||s===os?s=it:s===rs||s===is?s=Zt:(s=it,i=void 0);let h=s===it&&r[a+1].startsWith("/>")?" ":"";o+=s===Zt?l+Qu:d>=0?(n.push(c),l.slice(0,d)+ls+l.slice(d)+je+h):l+je+(d===-2?a:h)}return[ds(r,o+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},Qt=class r{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let o=0,s=0,a=e.length-1,l=this.parts,[c,u]=ed(e,t);if(this.el=r.createElement(c,n),ot.currentNode=this.el.content,t===2||t===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(i=ot.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let d of i.getAttributeNames())if(d.endsWith(ls)){let m=u[s++],h=i.getAttribute(d).split(je),g=/([.?@])?(.*)/.exec(m);l.push({type:1,index:o,name:g[2],strings:h,ctor:g[1]==="."?si:g[1]==="?"?ai:g[1]==="@"?li:wt}),i.removeAttribute(d)}else d.startsWith(je)&&(l.push({type:6,index:o}),i.removeAttribute(d));if(us.test(i.tagName)){let d=i.textContent.split(je),m=d.length-1;if(m>0){i.textContent=Ln?Ln.emptyScript:"";for(let h=0;h<m;h++)i.append(d[h],Yt()),ot.nextNode(),l.push({type:2,index:++o});i.append(d[m],Yt())}}}else if(i.nodeType===8)if(i.data===cs)l.push({type:2,index:o});else{let d=-1;for(;(d=i.data.indexOf(je,d+1))!==-1;)l.push({type:7,index:o}),d+=je.length-1}o++}}static createElement(e,t){let n=st.createElement("template");return n.innerHTML=e,n}};function yt(r,e,t=r,n){if(e===at)return e;let i=n!==void 0?t._$Co?.[n]:t._$Cl,o=Jt(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(r),i._$AT(r,t,n)),n!==void 0?(t._$Co??=[])[n]=i:t._$Cl=i),i!==void 0&&(e=yt(r,i._$AS(r,e.values),i,n)),e}var oi=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,i=(e?.creationScope??st).importNode(t,!0);ot.currentNode=i;let o=ot.nextNode(),s=0,a=0,l=n[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new Xt(o,o.nextSibling,this,e):l.type===1?c=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(c=new ci(o,this,e)),this._$AV.push(c),l=n[++a]}s!==l?.index&&(o=ot.nextNode(),s++)}return ot.currentNode=st,i}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},Xt=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=yt(this,e,t),Jt(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==at&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Xu(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==f&&Jt(this._$AH)?this._$AA.nextSibling.data=e:this.T(st.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,i=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=Qt.createElement(ds(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{let o=new oi(i,this),s=o.u(this.options);o.p(t),this.T(s),this._$AH=o}}_$AC(e){let t=as.get(e.strings);return t===void 0&&as.set(e.strings,t=new Qt(e)),t}k(e){di(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,i=0;for(let o of e)i===t.length?t.push(n=new r(this.O(Yt()),this.O(Yt()),this,this.options)):n=t[i],n._$AI(o),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=ts(e).nextSibling;ts(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},wt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,o){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=o,n.length>2||n[0]!==""||n[1]!==""?(this.Line truncated
|
||||
var x={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",fr:"6312d0f61ebf",hu:"27ba348531dc",it:"1b705e76dd00",nb:"c5ea24fb9ef6",nl:"b64142c67c2e",pl:"8527a4930402",pt:"31857a2d2277",ro:"e3cb5f449f0f",sk:"320611594db0",sl:"8071691ceda3",sv:"711b911ec8da",tr:"7c83ce1c3372",zh:"50518d9f494e"};Array.prototype.at||Object.defineProperty(Array.prototype,"at",{configurable:!0,writable:!0,value:function(e){let t=Math.trunc(e)||0;return this[t<0?this.length+t:t]}});typeof globalThis.structuredClone!="function"&&(globalThis.structuredClone=r=>r===void 0?r:JSON.parse(JSON.stringify(r)));var On=globalThis,Wn=On.ShadowRoot&&(On.ShadyCSS===void 0||On.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ri=Symbol(),Qo=new WeakMap,Jt=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==ri)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Wn&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=Qo.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Qo.set(t,e))}return e}toString(){return this.cssText}},Xo=r=>new Jt(typeof r=="string"?r:r+"",void 0,ri),Y=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((n,i,o)=>n+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+r[o+1],r[0]);return new Jt(t,r,ri)},es=(r,e)=>{if(Wn)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),i=On.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},ii=Wn?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return Xo(t)})(r):r;var{is:Uu,defineProperty:ju,getOwnPropertyDescriptor:qu,getOwnPropertyNames:Zu,getOwnPropertySymbols:Yu,getPrototypeOf:Ju}=Object,Bn=globalThis,ts=Bn.trustedTypes,Qu=ts?ts.emptyScript:"",Xu=Bn.reactiveElementPolyfillSupport,Qt=(r,e)=>r,oi={toAttribute(r,e){switch(e){case Boolean:r=r?Qu:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},rs=(r,e)=>!Uu(r,e),ns={attribute:!0,type:String,converter:oi,reflect:!1,useDefault:!1,hasChanged:rs};Symbol.metadata??=Symbol("metadata"),Bn.litPropertyMetadata??=new WeakMap;var Pe=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=ns){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),i=this.getPropertyDescriptor(e,n,t);i!==void 0&&ju(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){let{get:i,set:o}=qu(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:i,set(s){let a=i?.call(this);o?.call(this,s),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??ns}static _$Ei(){if(this.hasOwnProperty(Qt("elementProperties")))return;let e=Ju(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Qt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Qt("properties"))){let t=this.properties,n=[...Zu(t),...Yu(t)];for(let i of n)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,i]of t)this.elementProperties.set(n,i)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let i=this._$Eu(t,n);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let i of n)t.unshift(ii(i))}else e!==void 0&&t.push(ii(e));return t}static _$Eu(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadLine truncated
|
||||
\f\r]`,Xt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ss=/-->/g,as=/>/g,lt=RegExp(`>|${si}(?:([^\\s"'>=/]+)(${si}*=${si}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),ls=/'/g,cs=/"/g,ms=/^(?:script|style|textarea|title)$/i,pi=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),p=pi(1),ne=pi(2),Bf=pi(3),dt=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),us=new WeakMap,ct=ut.createTreeWalker(ut,129);function ps(r,e){if(!mi(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return os!==void 0?os.createHTML(e):e}var nd=(r,e)=>{let t=r.length-1,n=[],i,o=e===2?"<svg>":e===3?"<math>":"",s=Xt;for(let a=0;a<t;a++){let l=r[a],c,u,d=-1,m=0;for(;m<l.length&&(s.lastIndex=m,u=s.exec(l),u!==null);)m=s.lastIndex,s===Xt?u[1]==="!--"?s=ss:u[1]!==void 0?s=as:u[2]!==void 0?(ms.test(u[2])&&(i=RegExp("</"+u[2],"g")),s=lt):u[3]!==void 0&&(s=lt):s===lt?u[0]===">"?(s=i??Xt,d=-1):u[1]===void 0?d=-2:(d=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?lt:u[3]==='"'?cs:ls):s===cs||s===ls?s=lt:s===ss||s===as?s=Xt:(s=lt,i=void 0);let h=s===lt&&r[a+1].startsWith("/>")?" ":"";o+=s===Xt?l+ed:d>=0?(n.push(c),l.slice(0,d)+ds+l.slice(d)+Ye+h):l+Ye+(d===-2?a:h)}return[ps(r,o+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},nn=class r{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let o=0,s=0,a=e.length-1,l=this.parts,[c,u]=nd(e,t);if(this.el=r.createElement(c,n),ct.currentNode=this.el.content,t===2||t===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(i=ct.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let d of i.getAttributeNames())if(d.endsWith(ds)){let m=u[s++],h=i.getAttribute(d).split(Ye),g=/([.?@])?(.*)/.exec(m);l.push({type:1,index:o,name:g[2],strings:h,ctor:g[1]==="."?li:g[1]==="?"?ci:g[1]==="@"?ui:$t}),i.removeAttribute(d)}else d.startsWith(Ye)&&(l.push({type:6,index:o}),i.removeAttribute(d));if(ms.test(i.tagName)){let d=i.textContent.split(Ye),m=d.length-1;if(m>0){i.textContent=Vn?Vn.emptyScript:"";for(let h=0;h<m;h++)i.append(d[h],en()),ct.nextNode(),l.push({type:2,index:++o});i.append(d[m],en())}}}else if(i.nodeType===8)if(i.data===hs)l.push({type:2,index:o});else{let d=-1;for(;(d=i.data.indexOf(Ye,d+1))!==-1;)l.push({type:7,index:o}),d+=Ye.length-1}o++}}static createElement(e,t){let n=ut.createElement("template");return n.innerHTML=e,n}};function St(r,e,t=r,n){if(e===dt)return e;let i=n!==void 0?t._$Co?.[n]:t._$Cl,o=tn(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(r),i._$AT(r,t,n)),n!==void 0?(t._$Co??=[])[n]=i:t._$Cl=i),i!==void 0&&(e=St(r,i._$AS(r,e.values),i,n)),e}var ai=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,i=(e?.creationScope??ut).importNode(t,!0);ct.currentNode=i;let o=ct.nextNode(),s=0,a=0,l=n[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new rn(o,o.nextSibling,this,e):l.type===1?c=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(c=new di(o,this,e)),this._$AV.push(c),l=n[++a]}s!==l?.index&&(o=ct.nextNode(),s++)}return ct.currentNode=ut,i}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},rn=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=St(this,e,t),tn(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==dt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):td(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==f&&tn(this._$AH)?this._$AA.nextSibling.data=e:this.T(ut.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,i=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=nn.createElement(ps(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{let o=new ai(i,this),s=o.u(this.options);o.p(t),this.T(s),this._$AH=o}}_$AC(e){let t=us.get(e.strings);return t===void 0&&us.set(e.strings,t=new nn(e)),t}k(e){mi(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,i=0;for(let o of e)i===t.length?t.push(n=new r(this.O(en()),this.O(en()),this,this.options)):n=t[i],n._$AI(o),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=is(e).nextSibling;is(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},$t=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,o){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=o,n.length>2||n[0]!==""||n[1]!==""?(this.Line truncated
|
||||
|
||||
Ein Plugin l\xE4uft mit denselben Rechten wie NextFloor in deinem Browser. Die Datei wurde gepr\xFCft, ihr Inhalt ist festgelegt:
|
||||
{url}`,manual:"Anleitung",manual_more:"Mehr erfahren",feature_text_energy:"Energieteilchen fliegen in B\xF6gen von den Solarfeldern zum Wechselrichter, zwischen Haus, Akku, Netz und Verbrauchern \u2013 schneller und dichter, je mehr Strom flie\xDFt. Die Module funkeln mit ihrer Produktion, eine Glaskarte \xFCber dem Dach zeigt die Bilanz und wie autark das Haus gerade ist.",live_autarky:"autark",live_fold:"Karte verkleinern",live_unfold:"Karte aufklappen",live_day_hint:"Die letzten 24 Stunden: Solar (Fl\xE4che) und Verbrauch (Linie)",live_week_hint:"Die letzten 7 Tage: Sonne {solar} kWh, Verbrauch {use} kWh (gelb: Sonne, hell: Verbrauch)",live_days:"Tage",live_car_away:"Unterwegs",live_car_charging:"L\xE4dt",live_car_plugged:"Eingesteckt",live_car_lock:"Verriegeln",live_car_unlock:"Entriegeln",live_car_unlock_confirm:"{name} wirklich entriegeln?",live_car_climate:"Klimatisierung",live_car_charge:"Laden starten/stoppen",live_media_prev:"Zur\xFCck",live_media_playpause:"Abspielen/Pause",live_media_next:"Weiter",live_media_volume:"Lautst\xE4rke",live_car_device:"Auto (eine Entit\xE4t des Autos)",live_car_device_hint:"Ladestand, Reichweite, Laden, Stecker, Schloss und Klima findet NextFloor selbst am Ger\xE4t des Autos. Ohne Angabe nimmt es den Anwesenheitssensor des Stellplatzes.",live_car_departure_entity:"Abfahrtszeit (optional)",live_car_departure:"Abfahrt {time}",live_car_open:"Offen: {parts}",printer_printing:"druckt",printer_done:"fertig",printer_paused:"pausiert",printer_error:"Fehler",printer_idle:"bereit",printer_done_at:"fertig um {time}",printer_layer:"Schicht",printer_nozzle:"D\xFCse",printer_bed:"Bett",heatpump_heating:"heizt",heatpump_water:"macht Warmwasser",heatpump_cooling:"k\xFChlt",heatpump_defrost:"taut ab",heatpump_idle:"in Ruhe",heatpump_flow_return:"Vor- \u2192 R\xFCcklauf",heatpump_heat:"W\xE4rme",heatpump_power:"Strom",heatpump_outside:"au\xDFen",pack_missing_item:"M\xF6bel aus entferntem Pack",back_to_room:"Zur\xFCck zu {room}",back_to_floor:"Zur\xFCck zur Etage",hint_furniture:"Raum antippen, dann rechts ein M\xF6belst\xFCck w\xE4hlen \xB7 M\xF6bel ziehen, an den Ecken die Gr\xF6\xDFe \xE4ndern",furniture_into:"Neue M\xF6bel kommen in die Mitte von \u201E{room}\u201C.",furniture_pick_room:"Tipp: Erst einen Raum antippen \u2013 dann landen neue M\xF6bel in seiner Mitte.",flows:"Stromfluss",flows_hint:"Energieb\xF6gen zwischen Solarfeldern, Wechselrichter, Akku, Netz und Verbrauchern ein- oder ausblenden",chk_title:"Einrichtung",chk_hint:"Was der Energiefluss braucht. Antippen springt an die Stelle.",chk_solar:"Solarfeld angelegt",chk_solar_add:"Ein Solarfeld aufs Dach legen",chk_meter:"Stromz\xE4hler mit Netzsensor",chk_meter_sensor:"Stromz\xE4hler: Netzsensor (W) fehlt",chk_meter_add:"Stromz\xE4hler anlegen",chk_inverter:"Wechselrichter mit Leistungssensor",chk_inverter_sensor:"Wechselrichter: Leistungssensor fehlt",chk_inverter_add:"Wechselrichter anlegen",chk_battery:"Stromspeicher mit Leistung und Ladestand",chk_battery_sensor:"Stromspeicher: Leistung oder Ladestand fehlt",chk_battery_opt:"Stromspeicher (optional)",chk_grid:"Netzanschluss gesetzt",chk_grid_opt:"Netzanschluss (optional, sonst automatisch)",energy_sign_grid:"Das Haus zeigt Einspeisung, obwohl die Sonne nichts liefert. Der Netzsensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_battery:"Der Speicher l\xE4dt ohne Sonne und ohne Netzbezug. Sein Sensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_flip:"Vorzeichen umkehren",help_title:"Hilfe und R\xFCckmeldung",help_hint:"Fehler bitte als Issue auf GitHub, W\xFCnsche als Diskussion \u2013 so geht nichts verloren, und alle sehen den Stand.",help_issue:"Problem melden",help_idea:"Idee vorschlagen",furn_name:"Name (optional)",furn_mirror:"Spiegeln",furn_mirror_hint:"Links und rechts vertauschen \u2013 das L-Sofa andersherum, der Schrank mit der T\xFCr auf der anderen Seite, die K\xFCchenzeile gespiegelt.",hint_opening:"Auf eine Wand tippen, um eine T\xFCr oder ein Fenster einzusetzen \u2013 die Art w\xE4hlst du danach rechts",preset_door:"T\xFCr",preset_door_double:"Doppelt\xFCr",preset_window:"Fenster",preset_window_double:"Fenster 2-fl\xFCgelig",preset_terrace:"Terrassent\xFCr",preset_terrace_double:"Terrassent\xFCr 2-fl\xFCgelig",preset_lift_slide:"Hebe-Schiebet\xFCr",preset_garage:"Garagentor",preset_front:"Haust\xFCr",opening_style:"Stil",sidelight_auto:"automatisch",sidelight_hinge:"Seitenteil an der Anschlagseite",sidelight_hinge_hint:"Das Seitenteil sitzt sonst gegen\xFCber dem Anschlag; mit Haken neben den B\xE4ndern.",sidelight_width:"Breite Seitenteil (m)",sidelight_width_left:"Seitenteil links (m)",sidelight_width_right:"Seitenteil rechts (m)",style_auto:"Automatisch ({style})",style_interior:"Zimmert\xFCr",style_front:"Haust\xFCr",style_front_glass:"Haust\xFCr mit Glasausschnitt",style_sidelight:"Haust\xFCr mit Seitenteil",style_sidelights:"Haust\xFCr mit 2 Seitenteilen",style_glass:"Glast\xFCr",style_sliding:"Schiebet\xFCr",style_p
Line truncated
|
||||
{url}`,manual:"Anleitung",manual_more:"Mehr erfahren",feature_text_energy:"Energieteilchen fliegen in B\xF6gen von den Solarfeldern zum Wechselrichter, zwischen Haus, Akku, Netz und Verbrauchern \u2013 schneller und dichter, je mehr Strom flie\xDFt. Die Module funkeln mit ihrer Produktion, eine Glaskarte \xFCber dem Dach zeigt die Bilanz und wie autark das Haus gerade ist.",live_autarky:"autark",live_fold:"Karte verkleinern",live_unfold:"Karte aufklappen",live_day_hint:"Die letzten 24 Stunden: Solar (Fl\xE4che) und Verbrauch (Linie)",live_week_hint:"Die letzten 7 Tage: Sonne {solar} kWh, Verbrauch {use} kWh (gelb: Sonne, hell: Verbrauch)",live_days:"Tage",live_car_away:"Unterwegs",live_car_charging:"L\xE4dt",live_car_plugged:"Eingesteckt",live_car_lock:"Verriegeln",live_car_unlock:"Entriegeln",live_car_unlock_confirm:"{name} wirklich entriegeln?",live_car_climate:"Klimatisierung",live_car_charge:"Laden starten/stoppen",live_media_prev:"Zur\xFCck",live_media_playpause:"Abspielen/Pause",live_media_next:"Weiter",live_media_volume:"Lautst\xE4rke",live_car_device:"Auto (eine Entit\xE4t des Autos)",live_car_device_hint:"Ladestand, Reichweite, Laden, Stecker, Schloss und Klima findet NextFloor selbst am Ger\xE4t des Autos. Ohne Angabe nimmt es den Anwesenheitssensor des Stellplatzes.",live_car_departure_entity:"Abfahrtszeit (optional)",live_car_departure:"Abfahrt {time}",live_car_open:"Offen: {parts}",printer_printing:"druckt",printer_done:"fertig",printer_paused:"pausiert",printer_error:"Fehler",printer_idle:"bereit",printer_done_at:"fertig um {time}",printer_layer:"Schicht",printer_nozzle:"D\xFCse",printer_bed:"Bett",heatpump_heating:"heizt",heatpump_water:"macht Warmwasser",heatpump_cooling:"k\xFChlt",heatpump_defrost:"taut ab",heatpump_idle:"in Ruhe",heatpump_flow_return:"Vor- \u2192 R\xFCcklauf",heatpump_heat:"W\xE4rme",heatpump_power:"Strom",heatpump_outside:"au\xDFen",pack_missing_item:"M\xF6bel aus entferntem Pack",back_to_room:"Zur\xFCck zu {room}",back_to_floor:"Zur\xFCck zur Etage",hint_furniture:"Raum antippen, dann rechts ein M\xF6belst\xFCck w\xE4hlen \xB7 M\xF6bel ziehen, an den Ecken die Gr\xF6\xDFe \xE4ndern",furniture_into:"Neue M\xF6bel kommen in die Mitte von \u201E{room}\u201C.",furniture_pick_room:"Tipp: Erst einen Raum antippen \u2013 dann landen neue M\xF6bel in seiner Mitte.",flows:"Stromfluss",flows_hint:"Energieb\xF6gen zwischen Solarfeldern, Wechselrichter, Akku, Netz und Verbrauchern ein- oder ausblenden",chk_title:"Einrichtung",chk_hint:"Was der Energiefluss braucht. Antippen springt an die Stelle.",chk_solar:"Solarfeld angelegt",chk_solar_add:"Ein Solarfeld aufs Dach legen",chk_meter:"Stromz\xE4hler mit Netzsensor",chk_meter_sensor:"Stromz\xE4hler: Netzsensor (W) fehlt",chk_meter_add:"Stromz\xE4hler anlegen",chk_inverter:"Wechselrichter mit Leistungssensor",chk_inverter_sensor:"Wechselrichter: Leistungssensor fehlt",chk_inverter_add:"Wechselrichter anlegen",chk_battery:"Stromspeicher mit Leistung und Ladestand",chk_battery_sensor:"Stromspeicher: Leistung oder Ladestand fehlt",chk_battery_opt:"Stromspeicher (optional)",chk_grid:"Netzanschluss gesetzt",chk_grid_opt:"Netzanschluss (optional, sonst automatisch)",energy_sign_grid:"Das Haus zeigt Einspeisung, obwohl die Sonne nichts liefert. Der Netzsensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_battery:"Der Speicher l\xE4dt ohne Sonne und ohne Netzbezug. Sein Sensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_flip:"Vorzeichen umkehren",help_title:"Hilfe und R\xFCckmeldung",help_hint:"Fehler bitte als Issue auf GitHub, W\xFCnsche als Diskussion \u2013 so geht nichts verloren, und alle sehen den Stand.",help_issue:"Problem melden",help_idea:"Idee vorschlagen",furn_name:"Name (optional)",furn_mirror:"Spiegeln",furn_mirror_hint:"Links und rechts vertauschen \u2013 das L-Sofa andersherum, der Schrank mit der T\xFCr auf der anderen Seite, die K\xFCchenzeile gespiegelt.",hint_opening:"Auf eine Wand tippen, um eine T\xFCr oder ein Fenster einzusetzen \u2013 die Art w\xE4hlst du danach rechts",preset_door:"T\xFCr",preset_door_double:"Doppelt\xFCr",preset_window:"Fenster",preset_window_double:"Fenster 2-fl\xFCgelig",preset_terrace:"Terrassent\xFCr",preset_terrace_double:"Terrassent\xFCr 2-fl\xFCgelig",preset_lift_slide:"Hebe-Schiebet\xFCr",preset_garage:"Garagentor",preset_front:"Haust\xFCr",opening_style:"Stil",sidelight_auto:"automatisch",sidelight_hinge:"Seitenteil an der Anschlagseite",sidelight_hinge_hint:"Das Seitenteil sitzt sonst gegen\xFCber dem Anschlag; mit Haken neben den B\xE4ndern.",sidelight_width:"Breite Seitenteil (m)",sidelight_width_left:"Seitenteil links (m)",sidelight_width_right:"Seitenteil rechts (m)",style_auto:"Automatisch ({style})",style_interior:"Zimmert\xFCr",style_front:"Haust\xFCr",style_front_glass:"Haust\xFCr mit Glasausschnitt",style_sidelight:"Haust\xFCr mit Seitenteil",style_sidelights:"Haust\xFCr mit 2 Seitenteilen",style_glass:"Glast\xFCr",style_sliding:"Schiebet\xFCr",style_p
Line truncated
|
||||
|
||||
A plugin runs with the same rights as NextFloor in your browser. The file has been reviewed and its content is fixed:
|
||||
{url}`,manual:"Manual",manual_more:"Learn more",feature_text_energy:"Energy particles fly in arcs from the solar fields to the inverter, between house, battery, grid and consumers \u2013 faster and denser the more power flows. The modules sparkle with their production, a glass card over the roof shows the balance and how self-sufficient the house is right now.",live_autarky:"self-sufficient",live_fold:"Make the card small",live_unfold:"Open the card",live_day_hint:"The last 24 hours: solar (area) and consumption (line)",live_week_hint:"The last 7 days: sun {solar} kWh, use {use} kWh (yellow: sun, light: use)",live_days:"days",live_car_away:"On the road",live_car_charging:"Charging",live_car_plugged:"Plugged in",live_car_lock:"Lock",live_car_unlock:"Unlock",live_car_unlock_confirm:"Really unlock {name}?",live_car_climate:"Climate",live_car_charge:"Start/stop charging",live_media_prev:"Previous",live_media_playpause:"Play/pause",live_media_next:"Next",live_media_volume:"Volume",live_car_device:"Car (any entity of the car)",live_car_device_hint:"Charge, range, charging, plug, lock and climate are found by NextFloor on the car's device. Without one it takes the spot's presence sensor.",live_car_departure_entity:"Departure time (optional)",live_car_departure:"Departs {time}",live_car_open:"Open: {parts}",printer_printing:"printing",printer_done:"done",printer_paused:"paused",printer_error:"error",printer_idle:"idle",printer_done_at:"done at {time}",printer_layer:"Layer",printer_nozzle:"Nozzle",printer_bed:"Bed",heatpump_heating:"heating",heatpump_water:"making hot water",heatpump_cooling:"cooling",heatpump_defrost:"defrosting",heatpump_idle:"resting",heatpump_flow_return:"Flow \u2192 return",heatpump_heat:"Heat",heatpump_power:"Power",heatpump_outside:"outside",pack_missing_item:"Furniture of a removed pack",back_to_room:"Back to {room}",back_to_floor:"Back to the floor",hint_furniture:"Tap a room, then pick an item on the right \xB7 drag items, resize them by their corners",furniture_into:"New items go into the middle of \u201C{room}\u201D.",furniture_pick_room:"Tip: tap a room first \u2013 new items then land in its middle.",flows:"Power flow",flows_hint:"Show or hide the energy arcs between solar fields, inverter, battery, grid and consumers",chk_title:"Setup",chk_hint:"What the energy flow needs. Tap a row to jump there.",chk_solar:"Solar field in place",chk_solar_add:"Put a solar field on the roof",chk_meter:"Meter with grid sensor",chk_meter_sensor:"Meter: grid sensor (W) missing",chk_meter_add:"Add the meter",chk_inverter:"Inverter with power sensor",chk_inverter_sensor:"Inverter: power sensor missing",chk_inverter_add:"Add an inverter",chk_battery:"Home battery with power and charge",chk_battery_sensor:"Home battery: power or charge missing",chk_battery_opt:"Home battery (optional)",chk_grid:"Grid connection set",chk_grid_opt:"Grid connection (optional, else automatic)",energy_sign_grid:"The house shows export while the sun produces nothing. The grid sensor probably has its sign reversed.",energy_sign_battery:"The battery charges with no sun and no grid draw. Its sensor probably has its sign reversed.",energy_sign_flip:"Flip the sign",help_title:"Help and feedback",help_hint:"Please report problems as a GitHub issue and wishes as a discussion \u2013 nothing gets lost, and everyone sees the state.",help_issue:"Report a problem",help_idea:"Propose an idea",furn_name:"Name (optional)",furn_mirror:"Mirror",furn_mirror_hint:"Swap left and right \u2013 the L-sofa the other way round, the cabinet with its door on the other side, the kitchen run mirrored.",hint_opening:"Tap a wall to add a door or window \u2013 choose its kind on the right afterwards",preset_door:"Door",preset_door_double:"Double door",preset_window:"Window",preset_window_double:"Double window",preset_terrace:"Terrace door",preset_terrace_double:"French doors",preset_lift_slide:"Lift-and-slide door",preset_garage:"Garage door",preset_front:"Front door",opening_style:"Style",sidelight_auto:"automatic",sidelight_hinge:"Sidelight on the hinge side",sidelight_hinge_hint:"The sidelight sits opposite the hinge otherwise; ticked, it sits next to the hinges.",sidelight_width:"Sidelight width (m)",sidelight_width_left:"Left sidelight (m)",sidelight_width_right:"Right sidelight (m)",style_auto:"Automatic ({style})",style_interior:"Room door",style_front:"Front door",style_front_glass:"Front door with glass",style_sidelight:"Front door with sidelight",style_sidelights:"Front door with two sidelights",style_glass:"Glass door",style_sliding:"Sliding door",style_passage:"Opening (no door)",style_standard:"Standard",style_bars:"With glazing bars",style_glass_wall:"Glass wall (fixed)",preset_glass_wall:"Glass wall",glass_panes:"Panes",glass_panes_auto:"automatic (about 0.9 m)",glass_panes_hint:"0 = one single pane without mullions, empty = about every 0.9 m",flip_hinge:"Swap hinge side",flip_main_leaf:"Swap main leaf",flip_hinge_hint:"Hinges to the other side"
Line truncated
|
||||
{url}`,manual:"Manual",manual_more:"Learn more",feature_text_energy:"Energy particles fly in arcs from the solar fields to the inverter, between house, battery, grid and consumers \u2013 faster and denser the more power flows. The modules sparkle with their production, a glass card over the roof shows the balance and how self-sufficient the house is right now.",live_autarky:"self-sufficient",live_fold:"Make the card small",live_unfold:"Open the card",live_day_hint:"The last 24 hours: solar (area) and consumption (line)",live_week_hint:"The last 7 days: sun {solar} kWh, use {use} kWh (yellow: sun, light: use)",live_days:"days",live_car_away:"On the road",live_car_charging:"Charging",live_car_plugged:"Plugged in",live_car_lock:"Lock",live_car_unlock:"Unlock",live_car_unlock_confirm:"Really unlock {name}?",live_car_climate:"Climate",live_car_charge:"Start/stop charging",live_media_prev:"Previous",live_media_playpause:"Play/pause",live_media_next:"Next",live_media_volume:"Volume",live_car_device:"Car (any entity of the car)",live_car_device_hint:"Charge, range, charging, plug, lock and climate are found by NextFloor on the car's device. Without one it takes the spot's presence sensor.",live_car_departure_entity:"Departure time (optional)",live_car_departure:"Departs {time}",live_car_open:"Open: {parts}",printer_printing:"printing",printer_done:"done",printer_paused:"paused",printer_error:"error",printer_idle:"idle",printer_done_at:"done at {time}",printer_layer:"Layer",printer_nozzle:"Nozzle",printer_bed:"Bed",heatpump_heating:"heating",heatpump_water:"making hot water",heatpump_cooling:"cooling",heatpump_defrost:"defrosting",heatpump_idle:"resting",heatpump_flow_return:"Flow \u2192 return",heatpump_heat:"Heat",heatpump_power:"Power",heatpump_outside:"outside",pack_missing_item:"Furniture of a removed pack",back_to_room:"Back to {room}",back_to_floor:"Back to the floor",hint_furniture:"Tap a room, then pick an item on the right \xB7 drag items, resize them by their corners",furniture_into:"New items go into the middle of \u201C{room}\u201D.",furniture_pick_room:"Tip: tap a room first \u2013 new items then land in its middle.",flows:"Power flow",flows_hint:"Show or hide the energy arcs between solar fields, inverter, battery, grid and consumers",chk_title:"Setup",chk_hint:"What the energy flow needs. Tap a row to jump there.",chk_solar:"Solar field in place",chk_solar_add:"Put a solar field on the roof",chk_meter:"Meter with grid sensor",chk_meter_sensor:"Meter: grid sensor (W) missing",chk_meter_add:"Add the meter",chk_inverter:"Inverter with power sensor",chk_inverter_sensor:"Inverter: power sensor missing",chk_inverter_add:"Add an inverter",chk_battery:"Home battery with power and charge",chk_battery_sensor:"Home battery: power or charge missing",chk_battery_opt:"Home battery (optional)",chk_grid:"Grid connection set",chk_grid_opt:"Grid connection (optional, else automatic)",energy_sign_grid:"The house shows export while the sun produces nothing. The grid sensor probably has its sign reversed.",energy_sign_battery:"The battery charges with no sun and no grid draw. Its sensor probably has its sign reversed.",energy_sign_flip:"Flip the sign",help_title:"Help and feedback",help_hint:"Please report problems as a GitHub issue and wishes as a discussion \u2013 nothing gets lost, and everyone sees the state.",help_issue:"Report a problem",help_idea:"Propose an idea",furn_name:"Name (optional)",furn_mirror:"Mirror",furn_mirror_hint:"Swap left and right \u2013 the L-sofa the other way round, the cabinet with its door on the other side, the kitchen run mirrored.",hint_opening:"Tap a wall to add a door or window \u2013 choose its kind on the right afterwards",preset_door:"Door",preset_door_double:"Double door",preset_window:"Window",preset_window_double:"Double window",preset_terrace:"Terrace door",preset_terrace_double:"French doors",preset_lift_slide:"Lift-and-slide door",preset_garage:"Garage door",preset_front:"Front door",opening_style:"Style",sidelight_auto:"automatic",sidelight_hinge:"Sidelight on the hinge side",sidelight_hinge_hint:"The sidelight sits opposite the hinge otherwise; ticked, it sits next to the hinges.",sidelight_width:"Sidelight width (m)",sidelight_width_left:"Left sidelight (m)",sidelight_width_right:"Right sidelight (m)",style_auto:"Automatic ({style})",style_interior:"Room door",style_front:"Front door",style_front_glass:"Front door with glass",style_sidelight:"Front door with sidelight",style_sidelights:"Front door with two sidelights",style_glass:"Glass door",style_sliding:"Sliding door",style_passage:"Opening (no door)",style_standard:"Standard",style_bars:"With glazing bars",style_glass_wall:"Glass wall (fixed)",preset_glass_wall:"Glass wall",glass_panes:"Panes",glass_panes_auto:"automatic (about 0.9 m)",glass_panes_hint:"0 = one single pane without mullions, empty = about every 0.9 m",flip_hinge:"Swap hinge side",flip_main_leaf:"Swap main leaf",flip_hinge_hint:"Hinges to the other side"
Line truncated
|
||||
:host {
|
||||
--nf-text: var(--primary-text-color, #e1e1e1);
|
||||
--nf-muted: var(--secondary-text-color, #9b9b9b);
|
||||
@@ -35,7 +35,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
font-family: var(--nf-font);
|
||||
color: var(--nf-text);
|
||||
}
|
||||
`,wr=X`
|
||||
`,Sr=Y`
|
||||
:host([readable]) {
|
||||
--secondary-text-color: var(--primary-text-color, #e1e1e1);
|
||||
--divider-color: color-mix(in srgb, var(--primary-text-color, #e1e1e1) 40%, transparent);
|
||||
@@ -46,7 +46,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
:host([readable]) .nf-overlay {
|
||||
zoom: 1.2;
|
||||
}
|
||||
`,Re=X`
|
||||
`,Re=Y`
|
||||
/* a group of switches: one rounded pill, the active one tinted with the accent */
|
||||
.nf-seg {
|
||||
display: inline-flex;
|
||||
@@ -209,10 +209,10 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
min-height: 40px;
|
||||
}
|
||||
}
|
||||
`;function xr(r){return r?.themes?.darkMode===!1?"light":"dark"}function dn(r,e){let t=new Set;return e.flatMap(n=>{let i=String(r?.states[n]?.attributes.symcon_source_entity||n),o=r?.states[i]?.attributes,s=Number(o?.symcon_id);return!s||!o?.symcon_archive||t.has(s)?[]:(t.add(s),[i])})}var Ya,Ui=class extends ee{static properties={hass:{attribute:!1},ids:{attribute:!1},label:{attribute:!1},busy:{state:!0},error:{state:!0}};constructor(){super(),this.ids=[],this.label="",this.busy=!1,this.error=""}async open(e){e.stopPropagation(),this.busy=!0,this.error="";try{let t=new URL("./nextfloor-trend.js?v=b32d63f21bee",import.meta.url).href;await(await(Ya??=import(t).catch(i=>{throw Ya=void 0,i}))).openTrend(this.hass,this.ids,this.label)}catch(t){this.error=t instanceof Error?t.message:String(t)}finally{this.busy=!1}}render(){if(!dn(this.hass,this.ids).length)return f;let e=this.label?`Trend anzeigen: ${this.label}`:"Trend anzeigen";return p`<button type="button" title=${e} aria-label=${e} aria-haspopup="dialog" ?disabled=${this.busy} @pointerdown=${t=>t.stopPropagation()} @click=${t=>{this.open(t)}}>
|
||||
`;function $r(r){return r?.themes?.darkMode===!1?"light":"dark"}function pn(r,e){let t=new Set;return e.flatMap(n=>{let i=String(r?.states[n]?.attributes.symcon_source_entity||n),o=r?.states[i]?.attributes,s=Number(o?.symcon_id);return!s||!o?.symcon_archive||t.has(s)?[]:(t.add(s),[i])})}var Xa,qi=class extends Q{static properties={hass:{attribute:!1},ids:{attribute:!1},label:{attribute:!1},busy:{state:!0},error:{state:!0}};constructor(){super(),this.ids=[],this.label="",this.busy=!1,this.error=""}async open(e){e.stopPropagation(),this.busy=!0,this.error="";try{let t=new URL("./nextfloor-trend.js?v=84417e0b2573",import.meta.url).href;await(await(Xa??=import(t).catch(i=>{throw Xa=void 0,i}))).openTrend(this.hass,this.ids,this.label)}catch(t){this.error=t instanceof Error?t.message:String(t)}finally{this.busy=!1}}render(){if(!pn(this.hass,this.ids).length)return f;let e=this.label?`Trend anzeigen: ${this.label}`:"Trend anzeigen";return p`<button type="button" title=${e} aria-label=${e} aria-haspopup="dialog" ?disabled=${this.busy} @pointerdown=${t=>t.stopPropagation()} @click=${t=>{this.open(t)}}>
|
||||
<svg width="12" height="12" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M3 2v15h15M5 13l4-5 4 2 4-6"/></svg>
|
||||
</button>${this.error?p`<span role="alert">${this.error}</span>`:f}`}static styles=X`:host{position:relative;display:inline-flex;flex:0 0 18px;width:18px;height:18px;vertical-align:middle;margin-left:3px;font-weight:normal;line-height:0}button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:18px;height:18px;padding:2px;border:0;border-radius:3px;background:transparent;color:var(--nf-accent,#40c8ff);opacity:.8;cursor:pointer}svg{display:block;flex-shrink:0}button:hover,button:focus-visible{opacity:1;background:#40c8ff18}button:focus-visible{outline:1px solid currentColor;outline-offset:1px}button:disabled{opacity:.4}span{position:absolute;right:0;top:22px;z-index:10;box-sizing:border-box;width:200px;padding:8px;border:1px solid #ff9b9b50;border-radius:6px;background:var(--nf-chrome-solid,#1c1c1c);font:12px/1.4 system-ui;color:#ff9b9b;white-space:normal}`};customElements.get("nf-trend-button")||customElements.define("nf-trend-button",Ui);function j(r,e,t=""){let n=dn(r,e);return n.length?p`<nf-trend-button .hass=${r} .ids=${n} .label=${t}></nf-trend-button>`:f}var ji=class extends ee{static properties={hass:{attribute:!1},room:{attribute:!1},_pending:{state:!0},_error:{state:!0}};constructor(){super(),this._pending=new Set,this._error=""}async send(e,t,n,i){this._pending=new Set([...this._pending,e]),this._error="";try{await this.hass.callService(t,n,{entity_id:e,...i})}catch(o){this._error=o instanceof Error?o.message:String(o)}finally{this._pending=new Set([...this._pending].filter(o=>o!==e))}}value(e,t,n){let i=this.hass.states[t],o=Je(i),s=i?.attributes,a=n&&!!s?.symcon_has_action&&o!==null&&!this._pending.has(t);return p`<div class="value"><span>${e}</span><b>${Qe(i)}${j(this.hass,[t],e)}</b>
|
||||
${n&&s?.symcon_has_action&&s.symcon_variable_type===0?p`<button class="nf-chip" aria-pressed=${se(i)===!0} ?disabled=${!a} @click=${()=>{this.send(t,"symcon","set_value",{value:!se(i)})}}>${se(i)?"Ein":"Aus"}</button>`:n&&s?.symcon_has_action&&[1,2].includes(Number(s.symcon_variable_type))?p`<input type="number" aria-label=${e} .value=${String(Ne(i)??"")} min=${String(s.symcon_min??0)} max=${String(s.symcon_max??100)} step=${String(s.symcon_step||(s.symcon_variable_type===1?1:.1))} ?disabled=${!a}
|
||||
</button>${this.error?p`<span role="alert">${this.error}</span>`:f}`}static styles=Y`:host{position:relative;display:inline-flex;flex:0 0 18px;width:18px;height:18px;vertical-align:middle;margin-left:3px;font-weight:normal;line-height:0}button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:18px;height:18px;padding:2px;border:0;border-radius:3px;background:transparent;color:var(--nf-accent,#40c8ff);opacity:.8;cursor:pointer}svg{display:block;flex-shrink:0}button:hover,button:focus-visible{opacity:1;background:#40c8ff18}button:focus-visible{outline:1px solid currentColor;outline-offset:1px}button:disabled{opacity:.4}span{position:absolute;right:0;top:22px;z-index:10;box-sizing:border-box;width:200px;padding:8px;border:1px solid #ff9b9b50;border-radius:6px;background:var(--nf-chrome-solid,#1c1c1c);font:12px/1.4 system-ui;color:#ff9b9b;white-space:normal}`};customElements.get("nf-trend-button")||customElements.define("nf-trend-button",qi);function U(r,e,t=""){let n=pn(r,e);return n.length?p`<nf-trend-button .hass=${r} .ids=${n} .label=${t}></nf-trend-button>`:f}var Zi=class extends Q{static properties={hass:{attribute:!1},room:{attribute:!1},_pending:{state:!0},_error:{state:!0}};constructor(){super(),this._pending=new Set,this._error=""}async send(e,t,n,i){this._pending=new Set([...this._pending,e]),this._error="";try{await this.hass.callService(t,n,{entity_id:e,...i})}catch(o){this._error=o instanceof Error?o.message:String(o)}finally{this._pending=new Set([...this._pending].filter(o=>o!==e))}}value(e,t,n){let i=this.hass.states[t],o=tt(i),s=i?.attributes,a=n&&!!s?.symcon_has_action&&o!==null&&!this._pending.has(t);return p`<div class="value"><span>${e}</span><b>${nt(i)}${U(this.hass,[t],e)}</b>
|
||||
${n&&s?.symcon_has_action&&s.symcon_variable_type===0?p`<button class="nf-chip" aria-pressed=${se(i)===!0} ?disabled=${!a} @click=${()=>{this.send(t,"symcon","set_value",{value:!se(i)})}}>${se(i)?"Ein":"Aus"}</button>`:n&&s?.symcon_has_action&&[1,2].includes(Number(s.symcon_variable_type))?p`<input type="number" aria-label=${e} .value=${String(Oe(i)??"")} min=${String(s.symcon_min??0)} max=${String(s.symcon_max??100)} step=${String(s.symcon_step||(s.symcon_variable_type===1?1:.1))} ?disabled=${!a}
|
||||
@change=${l=>{let c=l.target;c.value.trim()&&c.checkValidity()&&this.send(t,"symcon","set_value",{value:Number(c.value)})}} />`:f}
|
||||
</div>`}schedule(e){let t=this.hass.states[e];if(!t?.attributes.symcon_schedule)return p`<p class="missing">Schaltuhr nicht verfügbar</p>`;let n=t.attributes.actions??[],i=t.attributes.groups??[],o=Number(t.attributes.next_run??0),s=n.find(c=>c.id===t.attributes.next_action),a=["Mo","Di","Mi","Do","Fr","Sa","So"],l=c=>`${String(c.hour).padStart(2,"0")}:${String(c.minute).padStart(2,"0")}${c.second?`:${String(c.second).padStart(2,"0")}`:""}`;return p`<details class="schedule"><summary>${String(t.attributes.friendly_name??"Schaltuhr")}</summary>
|
||||
<label class="nf-check"><input type="checkbox" .checked=${t.state==="on"} ?disabled=${this._pending.has(e)} @change=${c=>{this.send(e,"schedule","set_active",{active:c.target.checked})}} /> Aktiv</label>
|
||||
@@ -220,9 +220,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
${i.length?i.map(c=>p`<div class="schedule-group"><b>${a.filter((u,d)=>c.days&1<<d).join(" \xB7 ")}</b><div class="points">
|
||||
${[...c.points].sort((u,d)=>u.hour*3600+u.minute*60+u.second-(d.hour*3600+d.minute*60+d.second)).map(u=>{let d=n.find(m=>m.id===u.action);return p`<span class="point"><time>${l(u)}</time><span class="dot" style=${`background:#${Number(d?.color??8885929).toString(16).padStart(6,"0").slice(-6)}`}></span>${d?.name||"Aktion"}</span>`})}
|
||||
</div></div>`):p`<p class="missing">Keine Schaltpunkte vorhanden.</p>`}
|
||||
</details>`}render(){if(!this.hass||!this.room)return f;let e=Za.filter(i=>i.key!=="status"&&this.room.hvac?.[i.key]&&this.room.hvac[i.key]!=="none"),t=this.room.hvac?.schedules??[],n=this.room.floor_heating&&this.room.floor_heating!=="none"?this.room.floor_heating:null;return p`${n||e.length?p`<section><h3>Raumklima</h3>${n?this.value("Fu\xDFbodenheizung",n,!0):f}${e.map(i=>this.value(i.label,this.room.hvac[i.key],!!i.control))}</section>`:f}
|
||||
</details>`}render(){if(!this.hass||!this.room)return f;let e=Qa.filter(i=>i.key!=="status"&&this.room.hvac?.[i.key]&&this.room.hvac[i.key]!=="none"),t=this.room.hvac?.schedules??[],n=this.room.floor_heating&&this.room.floor_heating!=="none"?this.room.floor_heating:null;return p`${n||e.length?p`<section><h3>Raumklima</h3>${n?this.value("Fu\xDFbodenheizung",n,!0):f}${e.map(i=>this.value(i.label,this.room.hvac[i.key],!!i.control))}</section>`:f}
|
||||
${t.length?p`<section><h3>Schaltuhren</h3>${t.map(i=>this.schedule(i))}</section>`:f}
|
||||
${this._error?p`<p role="alert" class="error">${this._error}</p>`:f}`}static styles=[ge,Re,X`
|
||||
${this._error?p`<p role="alert" class="error">${this._error}</p>`:f}`}static styles=[ge,Re,Y`
|
||||
:host { display:block; }
|
||||
section { margin:18px 0; }
|
||||
h3 { font-size:12px; text-transform:uppercase; letter-spacing:.05em; color:var(--nf-muted); margin:0 0 8px; }
|
||||
@@ -240,14 +240,14 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
.point time { font-variant-numeric:tabular-nums; }
|
||||
.dot { width:8px; height:8px; border-radius:50%; }
|
||||
.error { color:var(--nf-danger,#ff6b7a); font-size:12px; }
|
||||
`]};customElements.get("nf-room-hvac")||customElements.define("nf-room-hvac",ji);var kr={electricity:"Strom",water:"Wasser",gas:"Gas",heating:"Heizen",cooling:"K\xFChlen"},el={electricity:"\u26A1",water:"\u{1F4A7}",gas:"\u{1F525}",heating:"\u2668",cooling:"\u2744"},Zi=r=>r.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/ß/g,"ss").replace(/[^a-z0-9]+/g," ").trim(),Ih="{485D0419-BE97-4548-AA9C-C083EB82E61E}",Nh=r=>r.object_type!==0&&!(r.object_type===1&&r.module_id?.toUpperCase()===Ih)?null:{elektro:"electricity",strom:"electricity","elektro strom":"electricity","strom elektro":"electricity",wasser:"water",gas:"gas",heizen:"heating",heizung:"heating",warme:"heating",waerme:"heating",kuhlen:"cooling",kuehlen:"cooling",kuhlung:"cooling",kuehlung:"cooling",kalte:"cooling",kaelte:"cooling"}[Zi(r.name)]??null,Ja=r=>/^symcon-category-(\d+)$/.exec(r??"")?.[1],tl=r=>/\b(heute|tag|tagesverbrauch|today|daily)\b/.test(r)?"day":/monat|month/.test(r)?"month":/jahr|year/.test(r)?"year":"total",Yi=(r,e)=>String(r.states[e]?.attributes.symcon_source_entity||e);function nl(r){let e=String(r?.attributes.unit_of_measurement??"").trim(),t=e.replace(/[³]/g,"3").replace(/[²]/g,"2").replace(/\s+/g,"").toLowerCase();return["w","kw","mw"].includes(t)?{metric:"power",unit:"W",factor:e==="mW"?.001:t==="kw"?1e3:t==="mw"?1e6:1}:["wh","kwh","mwh","j","kj","mj","gj"].includes(t)?{metric:"energy",unit:"kWh",factor:{wh:.001,kwh:1,mwh:1e3,j:1/36e5,kj:1/3600,mj:1/3.6,gj:1e3/3.6}[t]}:["m3/h","m3h","m3/min","m3/s","l/h","l/min","l/s","liter/h","liter/min"].includes(t)?{metric:"power",unit:"m\xB3/h",factor:{"m3/h":1,m3h:1,"m3/min":60,"m3/s":3600,"l/h":.001,"l/min":.06,"l/s":3.6,"liter/h":.001,"liter/min":.06}[t]}:["m3","l","liter"].includes(t)?{metric:"energy",unit:"m\xB3",factor:t==="m3"?1:.001}:null}function Ch(r,e){if(!e.entity_id||e.object_type!==2&&e.object_type!==6)return null;let t=Yi(r,e.entity_id),n=r.states[t];if(!n||![1,2].includes(Number(n.attributes.symcon_variable_type)))return null;let i=Zi(e.name),o=nl(n),s=/^(leistung|wirkleistung|gesamtleistung|aktuelle leistung|durchfluss|volumenstrom)(\b|$)/.test(i),a=/^(verbrauch|energie|energieverbrauch|gesamtverbrauch|gesamtenergie|zahlerstand|zaehlerstand|arbeit)(\b|$)/.test(i),l=o?.metric??(s?"power":a?"energy":null);if(!l)return null;let c=l==="power"?/^(leistung|wirkleistung|gesamtleistung|durchfluss|volumenstrom)$/.test(i):/^(verbrauch|energie|energieverbrauch|gesamtverbrauch|gesamtenergie|zahlerstand|zaehlerstand|arbeit)$/.test(i),u=l==="energy"?tl(i):"total";return{metric:l,source:t,period:u,group:`${l}|${o?.unit??String(n.attributes.unit_of_measurement??"")}|${u}`,score:/^gesamt(leistung|verbrauch|energie)$/.test(i)?110:c?100:(l==="power"?s:a)?70:20}}var Qa=new WeakMap,Xa=new WeakMap;function Wh(r){let e=Qa.get(r);if(e)return e;let t={nodes:new Map(r.map(n=>[n.object_id,n])),children:new Map};for(let n of r){let i=t.children.get(n.parent_id)??[];i.push(n),t.children.set(n.parent_id,i)}return Qa.set(r,t),t}function Ji(r,e,t){if(!G(r))return[];let n=[e.area_id,...e.sub_areas??[]].map(Ja).filter(m=>!!m);if(!n.length)return[];let i=new Set(t.filter(m=>m.id!==e.id).flatMap(m=>[m.area_id,...m.sub_areas??[]]).map(Ja).filter(m=>!!m&&!n.includes(m))),o=`${n.join(",")}|${[...i].sort().join(",")}`,s=Xa.get(r)??new Map;Xa.set(r,s);let a=s.get(o);if(a)return a;let l=Wh(r.symconObjects),c=[],u=new Set,d=(m,h,g)=>{if(u.has(m)||i.has(String(m)))return;u.add(m);let _=l.nodes.get(m);if(!_)return;let b=Nh(_),v=b??h,S=new Set(b&&b!==h?[]:g),k=l.children.get(m)??[];if(v){let M=k.map(z=>Ch(r,z)).filter(z=>z!==null);for(let z of new Set(M.map(R=>R.group))){if(S.has(z))continue;let R=M.filter(E=>E.group===z),F=Math.max(...R.map(E=>E.score)),T=R.filter(E=>E.score===F);for(let E of F>=100?T.slice(0,1):T)c.push({kind:v,metric:E.metric,id:E.source,period:E.period});S.add(z)}}for(let M of k)(M.object_type===0||M.object_type===1)&&d(M.object_id,v,S)};for(let m of n)d(Number(m),null,new Set);return s.set(o,c),c}function rl(r,e,t=!1){let n=new Map,i=new Set;for(let o of e){let s=Yi(r,o.id),a=`${o.kind}|${o.metric}|${s}`;if(i.has(a))continue;i.add(a);let l=r.states[s],c=nl(l),u=c?.metric===o.metric?c.unit:String(l?.attributes.unit_of_measurement??"").trim(),d=`${o.kind}|${o.metric}|${u}|${o.period}`,m=n.get(d)??{kind:o.kind,metric:o.metric,unit:u,value:null,period:o.period,sources:[],manual:t,incomplete:!1},h=Ne(l);h===null?m.incomplete=!0:m.value=(m.value??0)+h*(c?.metric===o.metric?c.factor:1),m.sources.push(s),n.set(d,m)}return[...n.values()]}function Ft(r,e,t=[]){return rl(r,Ji(r,e,t))}function qi(r,e,t,n){let i=e.utility_meters?.[t],o=i&&Object.prototype.hasOwnProperty.call(i,n)?i[n]:t==="electricity"&&n==="power"?e.power_entity:null;return o&&o!=="none"?Yi(r,o):null}function hn(r,e,t=e.rooms){let n=e.rooms.flatMap(o=>Ji(r,o,t)),i=[];for(let o of tn)for(let s of["power","energy"]){let a=qi(r,e,o,s);i.push(...rl(r,a?[{kind:o,metric:s,id:a,period:s==="energy"?tl(Zi(String(r.states[a]
Line truncated
|
||||
<h4>${el[e]} ${kr[e]}</h4>
|
||||
`]};customElements.get("nf-room-hvac")||customElements.define("nf-room-hvac",Zi);var ze={electricity:"Strom",water:"Wasser",gas:"Gas",heating:"Heizen",cooling:"K\xFChlen"},fn={electricity:"\u26A1",water:"\u{1F4A7}",gas:"\u{1F525}",heating:"\u2668",cooling:"\u2744"},Ji=r=>r.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/ß/g,"ss").replace(/[^a-z0-9]+/g," ").trim(),Ch="{485D0419-BE97-4548-AA9C-C083EB82E61E}",Lh=r=>r.object_type!==0&&!(r.object_type===1&&r.module_id?.toUpperCase()===Ch)?null:{elektro:"electricity",strom:"electricity","elektro strom":"electricity","strom elektro":"electricity",wasser:"water",gas:"gas",heizen:"heating",heizung:"heating",warme:"heating",waerme:"heating",kuhlen:"cooling",kuehlen:"cooling",kuhlung:"cooling",kuehlung:"cooling",kalte:"cooling",kaelte:"cooling"}[Ji(r.name)]??null,el=r=>/^symcon-category-(\d+)$/.exec(r??"")?.[1],rl=r=>/\b(heute|tag|tagesverbrauch|today|daily)\b/.test(r)?"day":/monat|month/.test(r)?"month":/jahr|year/.test(r)?"year":"total",Qi=(r,e)=>String(r.states[e]?.attributes.symcon_source_entity||e);function il(r){let e=String(r?.attributes.unit_of_measurement??"").trim(),t=e.replace(/[³]/g,"3").replace(/[²]/g,"2").replace(/\s+/g,"").toLowerCase();return["w","kw","mw"].includes(t)?{metric:"power",unit:"W",factor:e==="mW"?.001:t==="kw"?1e3:t==="mw"?1e6:1}:["wh","kwh","mwh","j","kj","mj","gj"].includes(t)?{metric:"energy",unit:"kWh",factor:{wh:.001,kwh:1,mwh:1e3,j:1/36e5,kj:1/3600,mj:1/3.6,gj:1e3/3.6}[t]}:["m3/h","m3h","m3/min","m3/s","l/h","l/min","l/s","liter/h","liter/min"].includes(t)?{metric:"power",unit:"m\xB3/h",factor:{"m3/h":1,m3h:1,"m3/min":60,"m3/s":3600,"l/h":.001,"l/min":.06,"l/s":3.6,"liter/h":.001,"liter/min":.06}[t]}:["m3","l","liter"].includes(t)?{metric:"energy",unit:"m\xB3",factor:t==="m3"?1:.001}:null}function Oh(r,e){if(!e.entity_id||e.object_type!==2&&e.object_type!==6)return null;let t=Qi(r,e.entity_id),n=r.states[t];if(!n||![1,2].includes(Number(n.attributes.symcon_variable_type)))return null;let i=Ji(e.name),o=il(n),s=/^(leistung|wirkleistung|gesamtleistung|aktuelle leistung|durchfluss|volumenstrom)(\b|$)/.test(i),a=/^(verbrauch|energie|energieverbrauch|gesamtverbrauch|gesamtenergie|zahlerstand|zaehlerstand|arbeit)(\b|$)/.test(i),l=o?.metric??(s?"power":a?"energy":null);if(!l)return null;let c=l==="power"?/^(leistung|wirkleistung|gesamtleistung|durchfluss|volumenstrom)$/.test(i):/^(verbrauch|energie|energieverbrauch|gesamtverbrauch|gesamtenergie|zahlerstand|zaehlerstand|arbeit)$/.test(i),u=l==="energy"?rl(i):"total";return{metric:l,source:t,period:u,group:`${l}|${o?.unit??String(n.attributes.unit_of_measurement??"")}|${u}`,score:/^gesamt(leistung|verbrauch|energie)$/.test(i)?110:c?100:(l==="power"?s:a)?70:20}}var tl=new WeakMap,nl=new WeakMap;function Wh(r){let e=tl.get(r);if(e)return e;let t={nodes:new Map(r.map(n=>[n.object_id,n])),children:new Map};for(let n of r){let i=t.children.get(n.parent_id)??[];i.push(n),t.children.set(n.parent_id,i)}return tl.set(r,t),t}function Xi(r,e,t){if(!K(r))return[];let n=[e.area_id,...e.sub_areas??[]].map(el).filter(m=>!!m);if(!n.length)return[];let i=new Set(t.filter(m=>m.id!==e.id).flatMap(m=>[m.area_id,...m.sub_areas??[]]).map(el).filter(m=>!!m&&!n.includes(m))),o=`${n.join(",")}|${[...i].sort().join(",")}`,s=nl.get(r)??new Map;nl.set(r,s);let a=s.get(o);if(a)return a;let l=Wh(r.symconObjects),c=[],u=new Set,d=(m,h,g)=>{if(u.has(m)||i.has(String(m)))return;u.add(m);let _=l.nodes.get(m);if(!_)return;let b=Lh(_),v=b??h,S=new Set(b&&b!==h?[]:g),k=l.children.get(m)??[];if(v){let M=k.map(z=>Oh(r,z)).filter(z=>z!==null);for(let z of new Set(M.map(R=>R.group))){if(S.has(z))continue;let R=M.filter(E=>E.group===z),F=Math.max(...R.map(E=>E.score)),T=R.filter(E=>E.score===F);for(let E of F>=100?T.slice(0,1):T)c.push({kind:v,metric:E.metric,id:E.source,period:E.period});S.add(z)}}for(let M of k)(M.object_type===0||M.object_type===1)&&d(M.object_id,v,S)};for(let m of n)d(Number(m),null,new Set);return s.set(o,c),c}function eo(r,e,t=!1){let n=new Map,i=new Set;for(let o of e){let s=Qi(r,o.id),a=`${o.kind}|${o.metric}|${s}`;if(i.has(a))continue;i.add(a);let l=r.states[s],c=il(l),u=c?.metric===o.metric?c.unit:String(l?.attributes.unit_of_measurement??"").trim(),d=`${o.kind}|${o.metric}|${u}|${o.period}`,m=n.get(d)??{kind:o.kind,metric:o.metric,unit:u,value:null,period:o.period,sources:[],manual:t,incomplete:!1},h=Oe(l);h===null?m.incomplete=!0:m.value=(m.value??0)+h*(c?.metric===o.metric?c.factor:1),m.sources.push(s),n.set(d,m)}return[...n.values()]}function rt(r,e,t=[]){return eo(r,Xi(r,e,t))}function Yi(r,e,t,n){let i=e.utility_meters?.[t],o=i&&Object.prototype.hasOwnProperty.call(i,n)?i[n]:t==="electricity"&&n==="power"?e.power_entity:null;return o&&o!=="none"?Qi(r,o):null}function Te(r,e,t=e.rooms){let n=e.rooms.flatMap(o=>Xi(r,o,t)),i=[];for(let o of Je)for(let s of["power","energy"]){let a=Yi(r,e,o,s);i.push(...eo(r,a?[{kind:o,metric:s,id:a,period:s==="energy"?rl(Ji(String(r.states[a]
Line truncated
|
||||
<h4>${fn[e]} ${ze[e]}</h4>
|
||||
${this.readings.filter(t=>t.kind===e).map(t=>p`<div class="reading" title=${`${t.manual?"Stockwerksz\xE4hler":"Bereichsz\xE4hler"}${t.incomplete?" \xB7 Err: Mindestens ein Wert fehlt; angezeigt wird die Summe der verf\xFCgbaren Werte.":""}
|
||||
${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states[n]?.attributes.friendly_name||n).join(`
|
||||
`)}`}>
|
||||
<span>${Qi(t)}${t.manual?p` <small>· Zähler</small>`:""}</span><b>${Xe(this.hass,t)}${j(this.hass,t.sources,`${kr[t.kind]} \xB7 ${Qi(t)}`)}</b>
|
||||
<span>${Nt(t)}${t.manual?p` <small>· Zähler</small>`:""}</span><b>${De(this.hass,t)}${U(this.hass,t.sources,`${ze[t.kind]} \xB7 ${Nt(t)}`)}</b>
|
||||
</div>`)}
|
||||
</section>`)}`}static styles=X`
|
||||
</section>`)}`}static styles=Y`
|
||||
:host { display:block; color:var(--nf-text); font:inherit; }
|
||||
section { padding:10px 0; border-bottom:1px solid var(--nf-line,#ffffff20); }
|
||||
section:last-child { border:0; }
|
||||
@@ -256,12 +256,12 @@ ${t.sources.map(n=>this.hass.states[n]?.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",Xi);var Q=(r,e)=>[r[0]-e[0],r[1]-e[1]],ze=(r,e)=>[r[0]+e[0],r[1]+e[1]],we=(r,e)=>[r[0]*e,r[1]*e],le=(r,e)=>r[0]*e[0]+r[1]*e[1],Ce=(r,e)=>r[0]*e[1]-r[1]*e[0],We=r=>Math.hypot(r[0],r[1]),xe=r=>{let e=We(r)||1;return[r[0]/e,r[1]/e]},eo=r=>[-r[1],r[0]],to=r=>[r[1],-r[0]];function ol(r){let e=r.heightEnd!==void 0;return{...r,a:r.b,b:r.a,left:r.right,right:r.left,roomLeft:r.roomRight,roomRight:r.roomLeft,height:e?r.heightEnd:r.height,heightEnd:e?r.height:void 0}}function Lh(r,e){let t=r.map(n=>({...n}));for(let n of e){let i=t.find(o=>o.room_id===n.room_id&&o.edge===n.edge&&(Math.abs(o.t1-n.t0)<1e-6||Math.abs(n.t1-o.t0)<1e-6));i?(i.t0=Math.min(i.t0,n.t0),i.t1=Math.max(i.t1,n.t1)):t.push({...n})}return t}function Oh(r,e,t){if(r.a===e.b)return!1;let n=xe(Q(t[r.b],t[r.a])),i=xe(Q(t[e.b],t[e.a]));return Math.abs(Ce(n,i))>1e-6||le(n,i)<=0||r.free||e.free||r.heightEnd!==void 0||e.heightEnd!==void 0?!1:r.height===e.height&&r.exterior===e.exterior&&r.roomLeft===e.roomLeft&&r.roomRight===e.roomRight&&Math.abs(r.left-e.left)<=1e-9&&Math.abs(r.right-e.right)<=1e-9}function sl(r,e,t=new Set){let n=r.slice();for(;;){let i=new Map;n.forEach((s,a)=>{for(let l of[s.a,s.b])i.set(l,[...i.get(l)??[],a])});let o=null;for(let[s,a]of i){if(a.length!==2||t.has(s))continue;let l=n[a[0]].b===s?n[a[0]]:ol(n[a[0]]),c=n[a[1]].a===s?n[a[1]]:ol(n[a[1]]);if(!Oh(l,c,e))continue;let u={...l,b:c.b,sources:Lh(l.sources,c.sources)};o=[...n.filter((d,m)=>m!==a[0]&&m!==a[1]),u];break}if(!o)return n;n=o}}function al(r,e){let t=new Map;r.forEach((i,o)=>{let s=xe(Q(e[i.b],e[i.a])),a=[[i.a,{key:`${o}:a`,d:s,left:i.left,right:i.right,angle:Math.atan2(s[1],s[0])}],[i.b,{key:`${o}:b`,d:we(s,-1),left:i.right,right:i.left,angle:Math.atan2(-s[1],-s[0])}]];for(let[l,c]of a)t.set(l,[...t.get(l)??[],c])});let n=new Map;for(let[i,o]of t){let s=e[i];o.sort((l,c)=>l.angle-c.angle);for(let l of o)n.set(l.key,{left:ze(s,we(eo(l.d),l.left)),right:ze(s,we(to(l.d),l.right))});if(o.length<2)continue;let a=4*Math.max(...o.map(l=>Math.max(l.left,l.right)))+1e-9;o.forEach((l,c)=>{let u=o[(c+1)%o.length],d=ze(s,we(eo(l.d),l.left)),m=ze(s,we(to(u.d),u.right)),h=Ce(l.d,u.d);if(Math.abs(h)<1e-4)return;let g=ze(d,we(l.d,Ce(Q(m,d),u.d)/h));We(Q(g,s))>a||(n.get(l.key).left=g,n.get(u.key).right=g)})}return n}function ll(r,e){let t=r.filter((n,i)=>We(Q(n,r[(i+1)%r.length]))>e);for(;;){if(t.length<=3)return t;let n=t.findIndex((i,o)=>{let s=t[(o+t.length-1)%t.length],a=t[(o+1)%t.length],[l,c]=[Q(i,s),Q(a,i)];return Math.abs(Ce(xe(l),xe(c)))<1e-7&&le(l,c)>0});if(n===-1)return t;t=t.filter((i,o)=>o!==n)}}function Bh(r){let e=[];return{points:e,idOf(t){let n=e.findIndex(i=>Math.abs(i[0]-t[0])<=r&&Math.abs(i[1]-t[1])<=r);return n>=0?n:(e.push([t[0],t[1]]),e.length-1)}}}function Vh(r,e){let t=[];for(let n of r){let i=n.points;if(i.length<3||Math.abs(ut(i))<1e-6)continue;let o=ut(i)>0,s=i.map(a=>e.idOf(a));s.forEach((a,l)=>{let c=s[(l+1)%s.length];a!==c&&t.push(o?{u:a,v:c,room:n.id,edge:l,forward:!0}:{u:c,v:a,room:n.id,edge:l,forward:!1})})}return t}function Kh(r,e,t){let n=[];for(let i of r){let[o,s]=[e[i.u],e[i.v]],a=Q(s,o),l=We(a),c=we(a,1/l),u=e.map((m,h)=>({id:h,rel:Q(m,o)})).filter(({id:m,rel:h})=>m!==i.u&&m!==i.v&&le(h,c)>t&&le(h,c)<l-t&&Math.abs(Ce(c,h))<=t).map(({id:m,rel:h})=>({t:le(h,c),id:m})).sort((m,h)=>m.t-h.t),d=[{t:0,id:i.u},...u,{t:l,id:i.v}];for(let m=0;m+1<d.length;m++){let[h,g]=[d[m],d[m+1]];n.push({u:h.id,v:g.id,room:i.room,edge:i.edge,t0:i.forward?h.t:l-g.t,t1:i.forward?g.t:l-h.t,forward:i.forward})}}return n}var cl=r=>({room_id:r.room,edge:r.edge,t0:r.t0,t1:r.t1});function Gh(r,e){let t=new Map(r.map(a=>[a.id,a])),n=new Map;for(let a of e){let l=`${a.room}:${a.edge}`;n.set(l,[...n.get(l)??[],a.t0].sort((c,u)=>c-u))}let i=a=>{let l=t.get(a.room)?.wall_heights?.[a.edge];return Array.isArray(l)?l[(n.get(`${a.room}:${a.edge}`)??[]).indexOf(a.t0)]??null:l},o=a=>{let l=t.get(a.room),[c,u]=[l?.wall_heights?.[a.edge],l?.wall_slopes?.[a.edge]];if(!l||typeof c!="number"||typeof u!="number"||c<=0||u<=0)return null;let[d,m]=[l.points[a.edge],l.points[(a.edge+1)%l.points.length]];return{from:c,to:u,length:Math.hypot(m[0]-d[0],m[1]-d[1])}},s=a=>{let l=o(a);if(!l||l.length<1e-9){let u=i(a);return typeof u=="number"&&u>0?[u,u]:[null,null]}let c=u=>l.from+(l.to-l.from)*u/l.length;return a.forward?[c(a.t0),c(a.t1)]:[c(a.t1),c(a.t0)]};return{heightsOf(a){let[l,c]=[1/0,1/0];for(let d of a){let[m,h]=s(d),[g,_]=d===a[0]?[m,h]:[h,m];g!==null&&(l=Math.min(l,g)),_!==null&&(c=Math.min(c,_))}let u=a.map(d=>t.get(d.room)?.ceiling);if(u.every(d=>typeof d=="number"&&d>0)){let d=Math.max(...u);l===1/0&&(l=d),c===1/0&&(c=d)}return{...l<1/0?{a:l}:{},...c<1/0?{b:c}:{}}},thicknessOf(a){let l=a.map(c=>{let u=t.get(c.room)?.wall_thickness?.[c.edge];return Array.isArray(u)?u[(n.get(`${c.room}:${c.edge}`)??[]).indexOf(c.t0)]:u}).filter(c=>typeof c=="number"&&c>0);return l.length?Math.max(...l):void 0},hasNoWall:a=>a.s
Line truncated
|
||||
<path d=${_r(r)} />
|
||||
</svg>`,Tr={previous:"M6 6h2v12H6zM20 6v12l-10-6z",play:"M8 5v14l11-7z",pause:"M7 5h4v14H7zM13 5h4v14h-4z",next:"M16 6h2v12h-2zM4 6v12l10-6z"},ao=r=>p`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d=${r} /></svg>`,Dm=24,Fm=10,lo=class extends ee{static properties={hass:{attribute:!1},room:{attribute:!1},floor:{attribute:!1},confirmEntities:{attribute:!1},phrases:{attribute:!1},outside:{attribute:!1},_showAll:{state:!0},_said:{state:!0},_folded:{state:!0},_curve:{state:!0},_moodName:{state:!0},_undo:{state:!0},_energy:{state:!0},_sunYear:{state:!0},rooms:{attribute:!1},building:{attribute:!1}};saidTimer;memo=null;curveFor="";undoTimer;constructor(){super(),this.room=null,this.floor=null,this.phrases=null,this.outside=null,this._said=null,this._showAll=!1,this._folded=!1,this._curve=null,this._moodName=null,this._undo=null,this._energy=null,this._sunYear=!1,this.rooms=null,this.building=null}fireMoods(e,t){this.dispatchEvent(new CustomEvent("mood-change",{detail:{roomId:e.id,moods:t},bubbles:!0,composed:!0}))}runMood(e){for(let t of zr(e))this.call("light",t.service,t.data)}renderMoods(e,t){let n=e.moods??[],i=!!this.rooms&&!!this.hass.user?.is_admin;if(!n.length&&!i)return f;let o=(this.rooms??[]).filter(l=>l.id!==e.id&&l.area_id),s=l=>K(this.hass,l).filter(c=>c.startsWith("light.")),a=()=>{let l=(this._moodName??"").trim()||this.t("mood_new");this.fireMoods(e,[...n,{id:`mood_${Date.now().toString(36)}`,name:l,lights:t.map(Rr)}]),this._moodName=null};return p`<div class="nf-rp-moods">
|
||||
`};customElements.get("nf-utility-report")||customElements.define("nf-utility-report",to);var ee=(r,e)=>[r[0]-e[0],r[1]-e[1]],Fe=(r,e)=>[r[0]+e[0],r[1]+e[1]],we=(r,e)=>[r[0]*e,r[1]*e],le=(r,e)=>r[0]*e[0]+r[1]*e[1],We=(r,e)=>r[0]*e[1]-r[1]*e[0],Be=r=>Math.hypot(r[0],r[1]),xe=r=>{let e=Be(r)||1;return[r[0]/e,r[1]/e]},no=r=>[-r[1],r[0]],ro=r=>[r[1],-r[0]];function al(r){let e=r.heightEnd!==void 0;return{...r,a:r.b,b:r.a,left:r.right,right:r.left,roomLeft:r.roomRight,roomRight:r.roomLeft,height:e?r.heightEnd:r.height,heightEnd:e?r.height:void 0}}function Bh(r,e){let t=r.map(n=>({...n}));for(let n of e){let i=t.find(o=>o.room_id===n.room_id&&o.edge===n.edge&&(Math.abs(o.t1-n.t0)<1e-6||Math.abs(n.t1-o.t0)<1e-6));i?(i.t0=Math.min(i.t0,n.t0),i.t1=Math.max(i.t1,n.t1)):t.push({...n})}return t}function Vh(r,e,t){if(r.a===e.b)return!1;let n=xe(ee(t[r.b],t[r.a])),i=xe(ee(t[e.b],t[e.a]));return Math.abs(We(n,i))>1e-6||le(n,i)<=0||r.free||e.free||r.heightEnd!==void 0||e.heightEnd!==void 0?!1:r.height===e.height&&r.exterior===e.exterior&&r.roomLeft===e.roomLeft&&r.roomRight===e.roomRight&&Math.abs(r.left-e.left)<=1e-9&&Math.abs(r.right-e.right)<=1e-9}function ll(r,e,t=new Set){let n=r.slice();for(;;){let i=new Map;n.forEach((s,a)=>{for(let l of[s.a,s.b])i.set(l,[...i.get(l)??[],a])});let o=null;for(let[s,a]of i){if(a.length!==2||t.has(s))continue;let l=n[a[0]].b===s?n[a[0]]:al(n[a[0]]),c=n[a[1]].a===s?n[a[1]]:al(n[a[1]]);if(!Vh(l,c,e))continue;let u={...l,b:c.b,sources:Bh(l.sources,c.sources)};o=[...n.filter((d,m)=>m!==a[0]&&m!==a[1]),u];break}if(!o)return n;n=o}}function cl(r,e){let t=new Map;r.forEach((i,o)=>{let s=xe(ee(e[i.b],e[i.a])),a=[[i.a,{key:`${o}:a`,d:s,left:i.left,right:i.right,angle:Math.atan2(s[1],s[0])}],[i.b,{key:`${o}:b`,d:we(s,-1),left:i.right,right:i.left,angle:Math.atan2(-s[1],-s[0])}]];for(let[l,c]of a)t.set(l,[...t.get(l)??[],c])});let n=new Map;for(let[i,o]of t){let s=e[i];o.sort((l,c)=>l.angle-c.angle);for(let l of o)n.set(l.key,{left:Fe(s,we(no(l.d),l.left)),right:Fe(s,we(ro(l.d),l.right))});if(o.length<2)continue;let a=4*Math.max(...o.map(l=>Math.max(l.left,l.right)))+1e-9;o.forEach((l,c)=>{let u=o[(c+1)%o.length],d=Fe(s,we(no(l.d),l.left)),m=Fe(s,we(ro(u.d),u.right)),h=We(l.d,u.d);if(Math.abs(h)<1e-4)return;let g=Fe(d,we(l.d,We(ee(m,d),u.d)/h));Be(ee(g,s))>a||(n.get(l.key).left=g,n.get(u.key).right=g)})}return n}function ul(r,e){let t=r.filter((n,i)=>Be(ee(n,r[(i+1)%r.length]))>e);for(;;){if(t.length<=3)return t;let n=t.findIndex((i,o)=>{let s=t[(o+t.length-1)%t.length],a=t[(o+1)%t.length],[l,c]=[ee(i,s),ee(a,i)];return Math.abs(We(xe(l),xe(c)))<1e-7&&le(l,c)>0});if(n===-1)return t;t=t.filter((i,o)=>o!==n)}}function Kh(r){let e=[];return{points:e,idOf(t){let n=e.findIndex(i=>Math.abs(i[0]-t[0])<=r&&Math.abs(i[1]-t[1])<=r);return n>=0?n:(e.push([t[0],t[1]]),e.length-1)}}}function Gh(r,e){let t=[];for(let n of r){let i=n.points;if(i.length<3||Math.abs(pt(i))<1e-6)continue;let o=pt(i)>0,s=i.map(a=>e.idOf(a));s.forEach((a,l)=>{let c=s[(l+1)%s.length];a!==c&&t.push(o?{u:a,v:c,room:n.id,edge:l,forward:!0}:{u:c,v:a,room:n.id,edge:l,forward:!1})})}return t}function Uh(r,e,t){let n=[];for(let i of r){let[o,s]=[e[i.u],e[i.v]],a=ee(s,o),l=Be(a),c=we(a,1/l),u=e.map((m,h)=>({id:h,rel:ee(m,o)})).filter(({id:m,rel:h})=>m!==i.u&&m!==i.v&&le(h,c)>t&&le(h,c)<l-t&&Math.abs(We(c,h))<=t).map(({id:m,rel:h})=>({t:le(h,c),id:m})).sort((m,h)=>m.t-h.t),d=[{t:0,id:i.u},...u,{t:l,id:i.v}];for(let m=0;m+1<d.length;m++){let[h,g]=[d[m],d[m+1]];n.push({u:h.id,v:g.id,room:i.room,edge:i.edge,t0:i.forward?h.t:l-g.t,t1:i.forward?g.t:l-h.t,forward:i.forward})}}return n}var dl=r=>({room_id:r.room,edge:r.edge,t0:r.t0,t1:r.t1});function jh(r,e){let t=new Map(r.map(a=>[a.id,a])),n=new Map;for(let a of e){let l=`${a.room}:${a.edge}`;n.set(l,[...n.get(l)??[],a.t0].sort((c,u)=>c-u))}let i=a=>{let l=t.get(a.room)?.wall_heights?.[a.edge];return Array.isArray(l)?l[(n.get(`${a.room}:${a.edge}`)??[]).indexOf(a.t0)]??null:l},o=a=>{let l=t.get(a.room),[c,u]=[l?.wall_heights?.[a.edge],l?.wall_slopes?.[a.edge]];if(!l||typeof c!="number"||typeof u!="number"||c<=0||u<=0)return null;let[d,m]=[l.points[a.edge],l.points[(a.edge+1)%l.points.length]];return{from:c,to:u,length:Math.hypot(m[0]-d[0],m[1]-d[1])}},s=a=>{let l=o(a);if(!l||l.length<1e-9){let u=i(a);return typeof u=="number"&&u>0?[u,u]:[null,null]}let c=u=>l.from+(l.to-l.from)*u/l.length;return a.forward?[c(a.t0),c(a.t1)]:[c(a.t1),c(a.t0)]};return{heightsOf(a){let[l,c]=[1/0,1/0];for(let d of a){let[m,h]=s(d),[g,_]=d===a[0]?[m,h]:[h,m];g!==null&&(l=Math.min(l,g)),_!==null&&(c=Math.min(c,_))}let u=a.map(d=>t.get(d.room)?.ceiling);if(u.every(d=>typeof d=="number"&&d>0)){let d=Math.max(...u);l===1/0&&(l=d),c===1/0&&(c=d)}return{...l<1/0?{a:l}:{},...c<1/0?{b:c}:{}}},thicknessOf(a){let l=a.map(c=>{let u=t.get(c.room)?.wall_thickness?.[c.edge];return Array.isArray(u)?u[(n.get(`${c.room}:${c.edge}`)??[]).indexOf(c.t0)]:u}).filter(c=>typeof c=="number"&&c>0);return l.length?Math.max(...l):void 0},hasNo
Line truncated
|
||||
<path d=${yr(r)} />
|
||||
</svg>`,Fr={previous:"M6 6h2v12H6zM20 6v12l-10-6z",play:"M8 5v14l11-7z",pause:"M7 5h4v14H7zM13 5h4v14h-4z",next:"M16 6h2v12h-2zM4 6v12l10-6z"},co=r=>p`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d=${r} /></svg>`,Hm=24,Pm=10,uo=class extends Q{static properties={hass:{attribute:!1},room:{attribute:!1},floor:{attribute:!1},confirmEntities:{attribute:!1},phrases:{attribute:!1},outside:{attribute:!1},_showAll:{state:!0},_said:{state:!0},_folded:{state:!0},_curve:{state:!0},_moodName:{state:!0},_undo:{state:!0},_energy:{state:!0},_sunYear:{state:!0},rooms:{attribute:!1},building:{attribute:!1}};saidTimer;memo=null;curveFor="";undoTimer;constructor(){super(),this.room=null,this.floor=null,this.phrases=null,this.outside=null,this._said=null,this._showAll=!1,this._folded=!1,this._curve=null,this._moodName=null,this._undo=null,this._energy=null,this._sunYear=!1,this.rooms=null,this.building=null}fireMoods(e,t){this.dispatchEvent(new CustomEvent("mood-change",{detail:{roomId:e.id,moods:t},bubbles:!0,composed:!0}))}runMood(e){for(let t of Dr(e))this.call("light",t.service,t.data)}renderMoods(e,t){let n=e.moods??[],i=!!this.rooms&&!!this.hass.user?.is_admin;if(!n.length&&!i)return f;let o=(this.rooms??[]).filter(l=>l.id!==e.id&&l.area_id),s=l=>G(this.hass,l).filter(c=>c.startsWith("light.")),a=()=>{let l=(this._moodName??"").trim()||this.t("mood_new");this.fireMoods(e,[...n,{id:`mood_${Date.now().toString(36)}`,name:l,lights:t.map(Tr)}]),this._moodName=null};return p`<div class="nf-rp-moods">
|
||||
${n.map(l=>p`<span class="nf-rp-mood">
|
||||
<button class="nf-btn" title=${this.t("mood_set")} @click=${()=>this.runMood(l.lights)}>✨ ${l.name}</button>
|
||||
${o.length?p`<select class="nf-rp-mood-to" aria-label=${this.t("mood_carry")} title=${this.t("mood_carry")} @change=${c=>{let u=c.target,d=o.find(m=>m.id===u.value);u.value="",d&&this.runMood(Vl(l,s(d)))}}>
|
||||
${o.length?p`<select class="nf-rp-mood-to" aria-label=${this.t("mood_carry")} title=${this.t("mood_carry")} @change=${c=>{let u=c.target,d=o.find(m=>m.id===u.value);u.value="",d&&this.runMood(Gl(l,s(d)))}}>
|
||||
<option value="">→</option>
|
||||
${o.map(c=>p`<option value=${c.id}>${c.name}</option>`)}
|
||||
</select>`:f}
|
||||
@@ -271,33 +271,33 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
><input type="text" maxlength="40" placeholder=${this.t("mood_new")} .value=${this._moodName} @input=${l=>this._moodName=l.target.value} @keydown=${l=>l.key==="Enter"&&a()} />
|
||||
<button class="nf-btn" @click=${a}>${this.t("mood_save")}</button></span
|
||||
>`:f}
|
||||
</div>`}async loadCurve(e){let t=fe(this.hass,this.floor,e,"temperature"),n=t.length?t:K(this.hass,e).filter(s=>s.startsWith("climate."));if(!n.length)return;let i=Date.now(),o=i-24*36e5;try{let s=await yn(this.hass,n,o,i,!!t.length);if(this.room?.id!==e.id)return;let a=[];for(let l=1;l<=96;l++){let c=Nt(this.hass,s,o+(i-o)*l/96),u=n.map(d=>d.startsWith("climate.")?Number(c.states[d]?.attributes.current_temperature):Number(c.states[d]?.state)).filter(Number.isFinite);a.push(u.length?u.reduce((d,m)=>d+m,0)/u.length:null)}this._curve=a.some(l=>l!==null)?a:null}catch{this._curve=null}}async loadEnergy(e){if(!this.floor||!this.building)return;if(G(this.hass)){this._energy=null;return}let t=oo(this.hass,this.building,this.floor,e);try{let n=await Hl(this.hass,t);this.room?.id===e.id&&(this._energy=n)}catch{this._energy=null}}renderEmptyLights(e,t){if(!t.length||!this.room)return f;let n=K(this.hass,e).map(s=>this.hass.states[s]).filter(s=>!!s&&s.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(s.attributes.device_class)));if(!n.length||n.some(s=>s.state!=="off"))return f;let i=Math.max(...n.map(s=>Date.parse(String(s.last_changed??""))||0)),o=Math.floor((Date.now()-i)/6e4);return!i||o<Fm?f:p`<div class="nf-rp-shade">
|
||||
</div>`}async loadCurve(e){let t=fe(this.hass,this.floor,e,"temperature"),n=t.length?t:G(this.hass,e).filter(s=>s.startsWith("climate."));if(!n.length)return;let i=Date.now(),o=i-24*36e5;try{let s=await kn(this.hass,n,o,i,!!t.length);if(this.room?.id!==e.id)return;let a=[];for(let l=1;l<=96;l++){let c=Wt(this.hass,s,o+(i-o)*l/96),u=n.map(d=>d.startsWith("climate.")?Number(c.states[d]?.attributes.current_temperature):Number(c.states[d]?.state)).filter(Number.isFinite);a.push(u.length?u.reduce((d,m)=>d+m,0)/u.length:null)}this._curve=a.some(l=>l!==null)?a:null}catch{this._curve=null}}async loadEnergy(e){if(!this.floor||!this.building)return;if(K(this.hass)){this._energy=null;return}let t=ao(this.hass,this.building,this.floor,e);try{let n=await Il(this.hass,t);this.room?.id===e.id&&(this._energy=n)}catch{this._energy=null}}renderEmptyLights(e,t){if(!t.length||!this.room)return f;let n=G(this.hass,e).map(s=>this.hass.states[s]).filter(s=>!!s&&s.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(s.attributes.device_class)));if(!n.length||n.some(s=>s.state!=="off"))return f;let i=Math.max(...n.map(s=>Date.parse(String(s.last_changed??""))||0)),o=Math.floor((Date.now()-i)/6e4);return!i||o<Pm?f:p`<div class="nf-rp-shade">
|
||||
<span>💡 ${this.t("empty_lights_hint",{n:t.length,min:o})}</span>
|
||||
<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_off",{entity_id:t.map(s=>s.entity_id)})}>${this.t("empty_lights_off")}</button>
|
||||
</div>`}renderOpenWhileHeating(e){let t=this.room;if(!t||!this.floor)return f;let n=e.filter(a=>a.attributes.hvac_action==="heating"||a.state==="heat"&&a.attributes.hvac_action===void 0);if(!n.length)return f;let i=a=>!!a&&a!=="none"&&this.hass.states[a]?.state==="on",o=this.floor.openings.filter(a=>a.room_id===t.id&&[a.contact,a.contact2,a.tilt,a.tilt2].some(i));if(!o.length)return f;let s=()=>{for(let a of n)(a.attributes.hvac_modes??[]).includes("off")?this.call("climate","set_hvac_mode",{entity_id:a.entity_id,hvac_mode:"off"}):typeof a.attributes.min_temp=="number"&&this.call("climate","set_temperature",{entity_id:a.entity_id,temperature:a.attributes.min_temp})};return p`<div class="nf-rp-shade nf-rp-open-heat">
|
||||
<span>🪟 ${this.t("open_heating_hint",{n:o.length})}</span>
|
||||
<button class="nf-btn nf-rp-small" @click=${s}>${this.t("open_heating_off")}</button>
|
||||
</div>`}renderShade(){let e=this.room,{latitude:t,longitude:n}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||n===void 0)return f;let i=q(this.hass,this.floor,e,"temperature");if(i===null||i<Dm)return f;let o=a=>{let l=a&&a!=="none"?this.hass.states[a]:void 0;if(!l||N(l))return!1;let c=l.attributes.current_position;return typeof c=="number"?c>30:l.state==="open"},s=[...new Set(Al(this.building,this.floor,e,{latitude:t,longitude:n}).flatMap(a=>[a.cover,a.cover2].filter(o)))];return s.length?p`<div class="nf-rp-shade">
|
||||
<span>☀ ${this.t("shade_hint",{n:s.length,temp:`${W(this.hass,ae(this.hass,i),1)} ${re(this.hass)}`})}</span>
|
||||
</div>`}renderShade(){let e=this.room,{latitude:t,longitude:n}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||n===void 0)return f;let i=q(this.hass,this.floor,e,"temperature");if(i===null||i<Hm)return f;let o=a=>{let l=a&&a!=="none"?this.hass.states[a]:void 0;if(!l||N(l))return!1;let c=l.attributes.current_position;return typeof c=="number"?c>30:l.state==="open"},s=[...new Set(Rl(this.building,this.floor,e,{latitude:t,longitude:n}).flatMap(a=>[a.cover,a.cover2].filter(o)))];return s.length?p`<div class="nf-rp-shade">
|
||||
<span>☀ ${this.t("shade_hint",{n:s.length,temp:`${L(this.hass,ae(this.hass,i),1)} ${re(this.hass)}`})}</span>
|
||||
<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:s})}>${this.t("shade_close")}</button>
|
||||
</div>`:f}renderSunYear(){let e=this.room,{latitude:t,longitude:n}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||n===void 0)return f;let i={latitude:t,longitude:n};if(!Pt(this.building,this.floor,e,{...i,zone:this.hass.config?.time_zone}).facing.length)return f;let s=p`<button class="nf-rp-sun-year" aria-expanded=${this._sunYear} title=${this.t("room_sun_year_hint")} @click=${()=>this._sunYear=!this._sunYear}>
|
||||
</div>`:f}renderSunYear(){let e=this.room,{latitude:t,longitude:n}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||n===void 0)return f;let i={latitude:t,longitude:n};if(!Lt(this.building,this.floor,e,{...i,zone:this.hass.config?.time_zone}).facing.length)return f;let s=p`<button class="nf-rp-sun-year" aria-expanded=${this._sunYear} title=${this.t("room_sun_year_hint")} @click=${()=>this._sunYear=!this._sunYear}>
|
||||
☀ ${this.t("room_sun_year")}
|
||||
</button>`;if(!this._sunYear)return s;let a=Ml(this.building,this.floor,e,i),l=Math.max(1,...a),c=Array.from({length:12},(u,d)=>new Date(2026,d,15).toLocaleDateString(this.hass.language,{month:"narrow"}));return p`${s}
|
||||
<div class="nf-rp-sun-bars" role="img" aria-label=${a.map((u,d)=>`${c[d]} ${W(this.hass,u,1)} h`).join(", ")}>
|
||||
${a.map((u,d)=>p`<span title=${`${W(this.hass,u,1)} h`}><i style=${`height:${Math.round(u/l*100)}%`}></i><b>${c[d]}</b></span>`)}
|
||||
</div>`}renderEnergy(){let e=this._energy;if(!e||e.month<=0)return f;let t=this.building?.energy.tariff,n=t?this.hass.states[t]:void 0,i=n?{value:Number(n.state),unit:String(n.attributes.unit_of_measurement??"")}:null,o=Pl(e.month,i),s=a=>`${W(this.hass,a,a<10?2:1)} kWh`;return p`<p class="nf-rp-facts nf-rp-energy" title=${this.t("room_energy_hint")}>
|
||||
⚡ ${this.t("room_energy",{today:s(e.today),month:s(e.month)})}${o?` \xB7 ${W(this.hass,o.value,2)} ${o.currency}`:""}
|
||||
</p>`}renderCurve(){let e=this._curve;if(!e)return f;let t=e.filter(c=>c!==null),n=Math.min(...t),i=Math.max(...t),o=Math.max(1,i-n),s=e.map(c=>c===null?null:c-n+o*.1),a=wn(s,220,36,o*1.2),l=c=>`${W(this.hass,ae(this.hass,c),1)}\xB0`;return p`<div class="nf-rp-curve" title=${this.t("room_curve_hint")}>
|
||||
</button>`;if(!this._sunYear)return s;let a=El(this.building,this.floor,e,i),l=Math.max(1,...a),c=Array.from({length:12},(u,d)=>new Date(2026,d,15).toLocaleDateString(this.hass.language,{month:"narrow"}));return p`${s}
|
||||
<div class="nf-rp-sun-bars" role="img" aria-label=${a.map((u,d)=>`${c[d]} ${L(this.hass,u,1)} h`).join(", ")}>
|
||||
${a.map((u,d)=>p`<span title=${`${L(this.hass,u,1)} h`}><i style=${`height:${Math.round(u/l*100)}%`}></i><b>${c[d]}</b></span>`)}
|
||||
</div>`}renderEnergy(){let e=this._energy;if(!e||e.month<=0)return f;let t=this.building?.energy.tariff,n=t?this.hass.states[t]:void 0,i=n?{value:Number(n.state),unit:String(n.attributes.unit_of_measurement??"")}:null,o=Nl(e.month,i),s=a=>`${L(this.hass,a,a<10?2:1)} kWh`;return p`<p class="nf-rp-facts nf-rp-energy" title=${this.t("room_energy_hint")}>
|
||||
⚡ ${this.t("room_energy",{today:s(e.today),month:s(e.month)})}${o?` \xB7 ${L(this.hass,o.value,2)} ${o.currency}`:""}
|
||||
</p>`}renderCurve(){let e=this._curve;if(!e)return f;let t=e.filter(c=>c!==null),n=Math.min(...t),i=Math.max(...t),o=Math.max(1,i-n),s=e.map(c=>c===null?null:c-n+o*.1),a=Sn(s,220,36,o*1.2),l=c=>`${L(this.hass,ae(this.hass,c),1)}\xB0`;return p`<div class="nf-rp-curve" title=${this.t("room_curve_hint")}>
|
||||
<svg viewBox="0 0 220 36" preserveAspectRatio="none" aria-hidden="true">${ne`<path d=${a}></path>`}</svg>
|
||||
<span>24 h · ${l(n)} – ${l(i)}</span>
|
||||
</div>`}willUpdate(e){let t=e.get("room");e.has("room")&&t?.id!==this.room?.id&&(this._folded=!1,this._undo=null),this.room&&this.hass&&this.curveFor!==this.room.id&&(this.curveFor=this.room.id,this._curve=null,this._energy=null,this.loadCurve(this.room),this.loadEnergy(this.room))}updated(e){e.has("_folded")&&this.toggleAttribute("folded",this._folded)}t(e,t){return $(this.hass,e,t)}call(e,t,n){this.hass.callService(e,t,n)}renderClean(e){let t=e.clean_entity,n=t?this.hass.states[t]:void 0;if(!t||!n)return f;let i=t.slice(0,t.indexOf(".")),o=()=>i==="script"?this.call("script","turn_on",{entity_id:t}):this.call(i,"press",{entity_id:t});return p`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" ?disabled=${N(n)} title=${this.t("room_clean_run_hint")} @click=${o}>🧹 ${this.t("room_clean_run")}</button></div>`}allOff(e){let t=vn(e);for(let n of t.off)this.call(n.domain,n.service,n.data);this._undo=t.undo,clearTimeout(this.undoTimer),this.undoTimer=setTimeout(()=>this._undo=null,1e4)}undoAllOff(){for(let e of this._undo??[])this.call(e.domain,e.service,e.data);this._undo=null,clearTimeout(this.undoTimer)}renderAllOff(e){if(this._undo)return p`<div class="nf-rp-alloff"><span>${this.t("all_off_done")}</span><button class="nf-btn nf-rp-small" @click=${()=>this.undoAllOff()}>↶ ${this.t("all_off_undo")}</button></div>`;let{count:t}=vn(e);return t<2?f:p`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" title=${this.t("all_off_hint")} @click=${()=>this.allOff(e)}>⏻ ${this.t("all_off_n",{n:t})}</button></div>`}get areaName(){return this.room?.area_id?this.hass.areas?.[this.room.area_id]?.name:void 0}placedAs(e){for(let t of this.building?.floors??[])for(let n of t.placements)if(n.entity_id===e)return n}name(e){return this.placedAs(e)?.name?.trim()||L(this.hass,e,this.areaName)}nameButton(e){return p`<button class="nf-rp-name" title=${this.t("details")} @click=${()=>ye(this,e)}>${this.name(e)}</button>`}askFor(e){return!this.confirmEntities?.has(e)||confirm(this.t("confirm_switch",{name:this.name(e)}))}toggle(e,t,n){let i=()=>{this.confirmEntities?.has(e.entity_id)&&!confirm(this.t("confirm_switch",{name:this.name(e.entity_id)}))||n()};return p`<button
|
||||
</div>`}willUpdate(e){let t=e.get("room");e.has("room")&&t?.id!==this.room?.id&&(this._folded=!1,this._undo=null),this.room&&this.hass&&this.curveFor!==this.room.id&&(this.curveFor=this.room.id,this._curve=null,this._energy=null,this.loadCurve(this.room),this.loadEnergy(this.room))}updated(e){e.has("_folded")&&this.toggleAttribute("folded",this._folded)}t(e,t){return $(this.hass,e,t)}call(e,t,n){this.hass.callService(e,t,n)}renderClean(e){let t=e.clean_entity,n=t?this.hass.states[t]:void 0;if(!t||!n)return f;let i=t.slice(0,t.indexOf(".")),o=()=>i==="script"?this.call("script","turn_on",{entity_id:t}):this.call(i,"press",{entity_id:t});return p`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" ?disabled=${N(n)} title=${this.t("room_clean_run_hint")} @click=${o}>🧹 ${this.t("room_clean_run")}</button></div>`}allOff(e){let t=xn(e);for(let n of t.off)this.call(n.domain,n.service,n.data);this._undo=t.undo,clearTimeout(this.undoTimer),this.undoTimer=setTimeout(()=>this._undo=null,1e4)}undoAllOff(){for(let e of this._undo??[])this.call(e.domain,e.service,e.data);this._undo=null,clearTimeout(this.undoTimer)}renderAllOff(e){if(this._undo)return p`<div class="nf-rp-alloff"><span>${this.t("all_off_done")}</span><button class="nf-btn nf-rp-small" @click=${()=>this.undoAllOff()}>↶ ${this.t("all_off_undo")}</button></div>`;let{count:t}=xn(e);return t<2?f:p`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" title=${this.t("all_off_hint")} @click=${()=>this.allOff(e)}>⏻ ${this.t("all_off_n",{n:t})}</button></div>`}get areaName(){return this.room?.area_id?this.hass.areas?.[this.room.area_id]?.name:void 0}placedAs(e){for(let t of this.building?.floors??[])for(let n of t.placements)if(n.entity_id===e)return n}name(e){return this.placedAs(e)?.name?.trim()||O(this.hass,e,this.areaName)}nameButton(e){return p`<button class="nf-rp-name" title=${this.t("details")} @click=${()=>ye(this,e)}>${this.name(e)}</button>`}askFor(e){return!this.confirmEntities?.has(e)||confirm(this.t("confirm_switch",{name:this.name(e)}))}toggle(e,t,n){let i=()=>{this.confirmEntities?.has(e.entity_id)&&!confirm(this.t("confirm_switch",{name:this.name(e.entity_id)}))||n()};return p`<button
|
||||
class="nf-switch"
|
||||
role="switch"
|
||||
aria-checked=${t?"true":"false"}
|
||||
aria-label=${this.name(e.entity_id)}
|
||||
?disabled=${N(e)}
|
||||
@click=${i}
|
||||
></button>`}outsideRoom=null;render(){let e=!this.room&&this.outside?this.outside:null;e&&!this.outsideRoom&&(this.outsideRoom={id:"nf-outside",name:this.t("outside_area"),area_id:null,points:[],floor_material:"grass"});let t=this.room??(e?this.outsideRoom:null);if(!t||!this.hass)return f;let n=e??K(this.hass,t),i=this.memo,{shown:o,more:s}=e?{shown:e,more:[]}:i&&i.entities===this.hass.entities&&i.floor===this.floor&&i.room===t?i:this.memo={entities:this.hass.entities,floor:this.floor,room:t,...this.floor?ba(this.hass,this.floor,t):{shown:n,more:[]}},a=Ti(this.hass,s).map(R=>R.primary),l=a.length,c=[t.floor_heating,...Object.values(t.hvac??{}).flat()].filter(R=>!!R&&R!=="none"),u=new Set(c.map(R=>this.hass.states[R]?.attributes.symcon_id).filter(Boolean)),d=(this._showAll?[...o,...a]:o).filter(R=>!G(this.hass)||!u.has(this.hass.states[R]?.attributes.symcon_id)),m=R=>d.filter(F=>R.includes(H(F))).map(F=>this.hass.states[F]),h=m(["light"]),g=m(["cover"]),_=m(["climate"]),b=m(["media"]),v=m(["switch","fan","lock"]),S=m(["sensor","binary"]),k=m(["scene","script"]),M=this.facts(_),z=h.filter(R=>R.state==="on");return p`<section class="nf-rp" aria-label=${t.name}>
|
||||
></button>`}outsideRoom=null;render(){let e=!this.room&&this.outside?this.outside:null;e&&!this.outsideRoom&&(this.outsideRoom={id:"nf-outside",name:this.t("outside_area"),area_id:null,points:[],floor_material:"grass"});let t=this.room??(e?this.outsideRoom:null);if(!t||!this.hass)return f;let n=e??G(this.hass,t),i=this.memo,{shown:o,more:s}=e?{shown:e,more:[]}:i&&i.entities===this.hass.entities&&i.floor===this.floor&&i.room===t?i:this.memo={entities:this.hass.entities,floor:this.floor,room:t,...this.floor?wa(this.hass,this.floor,t):{shown:n,more:[]}},a=Fi(this.hass,s).map(R=>R.primary),l=a.length,c=[t.floor_heating,...Object.values(t.hvac??{}).flat()].filter(R=>!!R&&R!=="none"),u=new Set(c.map(R=>this.hass.states[R]?.attributes.symcon_id).filter(Boolean)),d=(this._showAll?[...o,...a]:o).filter(R=>!K(this.hass)||!u.has(this.hass.states[R]?.attributes.symcon_id)),m=R=>d.filter(F=>R.includes(H(F))).map(F=>this.hass.states[F]),h=m(["light"]),g=m(["cover"]),_=m(["climate"]),b=m(["media"]),v=m(["switch","fan","lock"]),S=m(["sensor","binary"]),k=m(["scene","script"]),M=this.facts(_),z=h.filter(R=>R.state==="on");return p`<section class="nf-rp" aria-label=${t.name}>
|
||||
<header class="nf-rp-head">
|
||||
<div>
|
||||
<h2>${t.name}</h2>
|
||||
@@ -313,10 +313,10 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
</button>
|
||||
</header>
|
||||
<div class="nf-rp-body" ?hidden=${this._folded}>
|
||||
<nf-utility-report .hass=${this.hass} .readings=${Ft(this.hass,t,this.building?.floors.flatMap(R=>R.rooms))}></nf-utility-report>
|
||||
<nf-utility-report .hass=${this.hass} .readings=${rt(this.hass,t,this.building?.floors.flatMap(R=>R.rooms))}></nf-utility-report>
|
||||
${this.renderAllOff([...h,...b,...v])}
|
||||
${this.renderClean(t)}
|
||||
${!t.area_id&&!e&&!(G(this.hass)&&c.length)?p`<p class="nf-rp-note">${this.t("panel_no_area")}</p>`:!d.length&&!(G(this.hass)&&c.length)?p`<p class="nf-rp-note">${this.t("panel_empty")}</p>`:f}
|
||||
${!t.area_id&&!e&&!(K(this.hass)&&c.length)?p`<p class="nf-rp-note">${this.t("panel_no_area")}</p>`:!d.length&&!(K(this.hass)&&c.length)?p`<p class="nf-rp-note">${this.t("panel_empty")}</p>`:f}
|
||||
${k.length?this.section("panel_scenes",[p`<div class="nf-rp-scenes">
|
||||
${k.map(R=>p`<button
|
||||
class="nf-btn"
|
||||
@@ -331,38 +331,38 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
</button>`:f}${z.length?p`<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_off",{entity_id:z.map(R=>R.entity_id)})}>
|
||||
${this.t("panel_all_off")}
|
||||
</button>`:f}`):f}
|
||||
${g.length?this.section("panel_covers",g.map(R=>this.coverRow(R)),g.length>1&&rr(g,this.confirmEntities).length?p`<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","open_cover",{entity_id:rr(g,this.confirmEntities)})}>
|
||||
${g.length?this.section("panel_covers",g.map(R=>this.coverRow(R)),g.length>1&&sr(g,this.confirmEntities).length?p`<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","open_cover",{entity_id:sr(g,this.confirmEntities)})}>
|
||||
${this.t("panel_all_open")}</button
|
||||
><button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:rr(g,this.confirmEntities)})}>
|
||||
><button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:sr(g,this.confirmEntities)})}>
|
||||
${this.t("panel_all_close")}
|
||||
</button>`:f):f}
|
||||
${G(this.hass)?p`<nf-room-hvac .hass=${this.hass} .room=${t}></nf-room-hvac>`:f}
|
||||
${K(this.hass)?p`<nf-room-hvac .hass=${this.hass} .room=${t}></nf-room-hvac>`:f}
|
||||
${_.length?this.section("panel_climate",_.map(R=>this.climateRow(R))):f}
|
||||
${b.length?this.section("panel_media",b.map(R=>this.mediaRow(R))):f}
|
||||
${v.length?this.section("panel_switches",v.map(R=>this.switchRow(R))):f}
|
||||
${S.length?this.section("panel_sensors",S.map(R=>this.sensorRow(R))):f}
|
||||
${this.extraValues(t)}
|
||||
${!G(this.hass)&&ja(this.hass)&&Ua(this.hass,this.floor,t)?this.announceSection(t):f}
|
||||
${!K(this.hass)&&Ya(this.hass)&&Za(this.hass,this.floor,t)?this.announceSection(t):f}
|
||||
${this.pluginSections(t,d)}
|
||||
${l?p`<button class="nf-btn nf-rp-small nf-rp-more" @click=${()=>this._showAll=!this._showAll}>
|
||||
${this._showAll?this.t("panel_less"):this.t("panel_more",{n:l})}
|
||||
</button>`:f}
|
||||
</div>
|
||||
</section>`}extraValues(e){if(!this.floor)return f;let t=[...this.floor.placements.filter(n=>!n.outside&&I([n.x,n.z],e.points)).map(n=>({name:n.name||L(this.hass,n.entity_id),rows:br(this.hass,n.values)})),...this.floor.furniture.filter(n=>I([n.x,n.z],e.points)).map(n=>({name:n.name||(n.entity&&n.entity!=="none"?L(this.hass,n.entity):this.t("device")),rows:br(this.hass,n.values)}))].filter(n=>n.rows.length);return t.length?this.section("device_values",t.map(n=>p`<div class="nf-extra-values"><b>${n.name}</b>${n.rows.map(i=>p`<div class="nf-rp-row"><span class="nf-rp-icon">${i.icon}</span><span class="nf-rp-name">${i.label}</span><b class="nf-rp-state">${i.text}${j(this.hass,[i.entity],i.label)}</b></div>`)}</div>`)):f}facts(e){let t=[],n=this.room;if(!n)return t;let i=(T,E)=>{let A=q(this.hass,this.floor,n,T);if(A===null)return null;if(T==="temperature")return`${W(this.hass,ae(this.hass,A),1)} ${re(this.hass)}`;let P=fe(this.hass,this.floor,n,T)[0],C=this.hass.states[P]?.attributes.unit_of_measurement??E;return`${W(this.hass,A,1)} ${C}`},o=e.find(T=>typeof T.attributes.current_temperature=="number"),s=i("temperature","\xB0C");s?t.push(p`${s}${j(this.hass,fe(this.hass,this.floor,n,"temperature"),"Temperatur")}`):o&&n.climate?.temperature!=="none"&&t.push(p`${W(this.hass,o.attributes.current_temperature,1)} ${re(this.hass)}${j(this.hass,[o.entity_id],"Temperatur")}`);let a=i("humidity","%");a&&t.push(p`${a}${j(this.hass,fe(this.hass,this.floor,n,"humidity"),"Luftfeuchte")}`);let l=q(this.hass,this.floor??null,n,"illuminance");l!==null&&t.push(p`☀ ${W(this.hass,l,0)} lx${j(this.hass,fe(this.hass,this.floor,n,"illuminance"),"Helligkeit")}`);let c=Ft(this.hass,n,this.building?.floors.flatMap(T=>T.rooms)).find(T=>T.kind==="electricity"&&T.metric==="power"&&T.unit==="W"),u=!c&&this.floor&&this.building?io(this.hass,this.building,this.floor,n):null;c?t.push(p`⚡ ${Xe(this.hass,c)}${j(this.hass,c.sources,"Leistung")}`):u!==null&&t.push(`\u26A1 ${ft(this.hass,u)}`);let d=this.floor?this.floor.openings.filter(T=>T.room_id===n.id).flatMap(T=>[T.contact,T.contact2,T.tilt,T.tilt2]).map(T=>T&&T!=="none"?this.hass.states[T]:void 0).filter(T=>T?.state==="on").map(T=>Date.parse(String(T.last_changed??""))).filter(Number.isFinite):[];d.length&&t.push(`\u{1FA9F} ${this.t("open_since",{time:so(Date.now()-Math.min(...d))})}`);let m=K(this.hass,n).map(T=>this.hass.states[T]).filter(T=>!!T&&T.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(T.attributes.device_class)));if(m.length)if(m.some(T=>T.state==="on"))t.push(`\u{1F6B6} ${this.t("presence_now")}`);else{let T=Math.max(...m.map(E=>Date.parse(String(E.last_changed??""))||0));T>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:so(Date.now()-T)})}`)}let h=this.building?Cl(this.hass,this.building).filter(T=>T.roomId===n.id&&T.level<Nl):[];h.length&&t.push(`\u{1FAAB} ${this.t("battery_low_n",{n:h.length,names:h.map(T=>`${this.name(T.entity)} ${Math.round(T.level)} %`).join(", ")})}`);let g=(this.building?.settings.circuits??[]).filter(T=>T.rooms.includes(n.id)).map(T=>T.name),_=this.building?.settings.room_facts_off??[];g.length&&!_.includes("circuits")&&t.push(`\u{1F50C} ${g.join(", ")}`);let{latitude:b,longitude:v,time_zone:S}=this.hass.config??{};if(this.floor&&b!==void 0&&v!==void 0&&this.building&&!_.includes("sun")){let T=Pt(this.building,this.floor,n,{latitude:b,longitude:v,zone:S});T.facing.length&&t.push(`\u2600 ${this.t("room_sun_hours",{h:W(this.hass,T.hours,1),facing:T.facing.join(", ")})}`)}let k=q(this.hass,this.floor,n,"temperature"),M=q(this.hass,this.floor,n,"humidity"),z=Mr(q(this.hass,this.floor,n,"co2"),M,It(k,M));z&&!_.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${z}`)}`);let R=Ar(k,M,q(this.hass,this.floor,n,"co2"),pt(new Date,this.hass.config?.latitude)),F=n.hvac?.status;return F&&F!=="none"?t.push(p`${Qe(this.hass.states[F])}${j(this.hass,[F],"Raumstatus")}`):R!==null&&(k!==null||M!==null)&&!_.includes("comfort")&&t.push(`\u{1F60A} ${this.t("comfort_n",{n:R})}`),t}announceSection(e){let t=this.phrases?.length?this.phrases:[1,2,3,4,5].map(o=>this.t(`announce_phrase_${o}`)),n=o=>{let s=o.trim();s&&(clearTimeout(this.saidTimer),this.hass.callService("nextfloor","announce",{message:s,rooms:[e.id],on_screens:!1}).then(()=>this._said={text:this.t("announce_sent",{message:s}),failed:!1},a=>this._said={text:this.t("announce_failed",{error:a?.message??String(a)}),failed:!0}),this.saidTimer=setTimeout(()=>this._said=null,6e3))},i=o=>{o.preventDefault();let s=o.currentTarget.querySelector("input");n(s.value),s.value=""};return this.section("panel_announce",[p`<div class="nf-rp-scenes">${t.map(o=>p`<button class="nf-btn" @click=${()=>n(o)}>${o}</button>`)}</div>
|
||||
</section>`}extraValues(e){if(!this.floor)return f;let t=[...this.floor.placements.filter(n=>!n.outside&&I([n.x,n.z],e.points)).map(n=>({name:n.name||O(this.hass,n.entity_id),rows:wr(this.hass,n.values)})),...this.floor.furniture.filter(n=>I([n.x,n.z],e.points)).map(n=>({name:n.name||(n.entity&&n.entity!=="none"?O(this.hass,n.entity):this.t("device")),rows:wr(this.hass,n.values)}))].filter(n=>n.rows.length);return t.length?this.section("device_values",t.map(n=>p`<div class="nf-extra-values"><b>${n.name}</b>${n.rows.map(i=>p`<div class="nf-rp-row"><span class="nf-rp-icon">${i.icon}</span><span class="nf-rp-name">${i.label}</span><b class="nf-rp-state">${i.text}${U(this.hass,[i.entity],i.label)}</b></div>`)}</div>`)):f}facts(e){let t=[],n=this.room;if(!n)return t;let i=(T,E)=>{let A=q(this.hass,this.floor,n,T);if(A===null)return null;if(T==="temperature")return`${L(this.hass,ae(this.hass,A),1)} ${re(this.hass)}`;let P=fe(this.hass,this.floor,n,T)[0],C=this.hass.states[P]?.attributes.unit_of_measurement??E;return`${L(this.hass,A,1)} ${C}`},o=e.find(T=>typeof T.attributes.current_temperature=="number"),s=i("temperature","\xB0C");s?t.push(p`${s}${U(this.hass,fe(this.hass,this.floor,n,"temperature"),"Temperatur")}`):o&&n.climate?.temperature!=="none"&&t.push(p`${L(this.hass,o.attributes.current_temperature,1)} ${re(this.hass)}${U(this.hass,[o.entity_id],"Temperatur")}`);let a=i("humidity","%");a&&t.push(p`${a}${U(this.hass,fe(this.hass,this.floor,n,"humidity"),"Luftfeuchte")}`);let l=q(this.hass,this.floor??null,n,"illuminance");l!==null&&t.push(p`☀ ${L(this.hass,l,0)} lx${U(this.hass,fe(this.hass,this.floor,n,"illuminance"),"Helligkeit")}`);let c=rt(this.hass,n,this.building?.floors.flatMap(T=>T.rooms)).find(T=>T.kind==="electricity"&&T.metric==="power"&&T.unit==="W"),u=!c&&this.floor&&this.building?so(this.hass,this.building,this.floor,n):null;c?t.push(p`⚡ ${De(this.hass,c)}${U(this.hass,c.sources,"Leistung")}`):u!==null&&t.push(`\u26A1 ${vt(this.hass,u)}`);let d=this.floor?this.floor.openings.filter(T=>T.room_id===n.id).flatMap(T=>[T.contact,T.contact2,T.tilt,T.tilt2]).map(T=>T&&T!=="none"?this.hass.states[T]:void 0).filter(T=>T?.state==="on").map(T=>Date.parse(String(T.last_changed??""))).filter(Number.isFinite):[];d.length&&t.push(`\u{1FA9F} ${this.t("open_since",{time:lo(Date.now()-Math.min(...d))})}`);let m=G(this.hass,n).map(T=>this.hass.states[T]).filter(T=>!!T&&T.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(T.attributes.device_class)));if(m.length)if(m.some(T=>T.state==="on"))t.push(`\u{1F6B6} ${this.t("presence_now")}`);else{let T=Math.max(...m.map(E=>Date.parse(String(E.last_changed??""))||0));T>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:lo(Date.now()-T)})}`)}let h=this.building?Ol(this.hass,this.building).filter(T=>T.roomId===n.id&&T.level<Ll):[];h.length&&t.push(`\u{1FAAB} ${this.t("battery_low_n",{n:h.length,names:h.map(T=>`${this.name(T.entity)} ${Math.round(T.level)} %`).join(", ")})}`);let g=(this.building?.settings.circuits??[]).filter(T=>T.rooms.includes(n.id)).map(T=>T.name),_=this.building?.settings.room_facts_off??[];g.length&&!_.includes("circuits")&&t.push(`\u{1F50C} ${g.join(", ")}`);let{latitude:b,longitude:v,time_zone:S}=this.hass.config??{};if(this.floor&&b!==void 0&&v!==void 0&&this.building&&!_.includes("sun")){let T=Lt(this.building,this.floor,n,{latitude:b,longitude:v,zone:S});T.facing.length&&t.push(`\u2600 ${this.t("room_sun_hours",{h:L(this.hass,T.hours,1),facing:T.facing.join(", ")})}`)}let k=q(this.hass,this.floor,n,"temperature"),M=q(this.hass,this.floor,n,"humidity"),z=Er(q(this.hass,this.floor,n,"co2"),M,Ot(k,M));z&&!_.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${z}`)}`);let R=Rr(k,M,q(this.hass,this.floor,n,"co2"),bt(new Date,this.hass.config?.latitude)),F=n.hvac?.status;return F&&F!=="none"?t.push(p`${nt(this.hass.states[F])}${U(this.hass,[F],"Raumstatus")}`):R!==null&&(k!==null||M!==null)&&!_.includes("comfort")&&t.push(`\u{1F60A} ${this.t("comfort_n",{n:R})}`),t}announceSection(e){let t=this.phrases?.length?this.phrases:[1,2,3,4,5].map(o=>this.t(`announce_phrase_${o}`)),n=o=>{let s=o.trim();s&&(clearTimeout(this.saidTimer),this.hass.callService("nextfloor","announce",{message:s,rooms:[e.id],on_screens:!1}).then(()=>this._said={text:this.t("announce_sent",{message:s}),failed:!1},a=>this._said={text:this.t("announce_failed",{error:a?.message??String(a)}),failed:!0}),this.saidTimer=setTimeout(()=>this._said=null,6e3))},i=o=>{o.preventDefault();let s=o.currentTarget.querySelector("input");n(s.value),s.value=""};return this.section("panel_announce",[p`<div class="nf-rp-scenes">${t.map(o=>p`<button class="nf-btn" @click=${()=>n(o)}>${o}</button>`)}</div>
|
||||
<form class="nf-rp-say" @submit=${i}>
|
||||
<input type="text" maxlength="500" placeholder=${this.t("announce_placeholder")} aria-label=${this.t("announce_placeholder")} />
|
||||
<button class="nf-btn nf-primary" type="submit">${this.t("announce_send")}</button>
|
||||
</form>
|
||||
${this._said?p`<p class="nf-rp-note ${this._said.failed?"nf-rp-fail":""}" role="status">${this._said.text}</p>`:f}`])}pluginSections(e,t){return Rs({hass:this.hass,room:{id:e.id,name:e.name,area_id:e.area_id??null},entities:t}).map(i=>p`<div class="nf-rp-sec nf-rp-plugin" data-plugin=${i.key}>
|
||||
${this._said?p`<p class="nf-rp-note ${this._said.failed?"nf-rp-fail":""}" role="status">${this._said.text}</p>`:f}`])}pluginSections(e,t){return Ds({hass:this.hass,room:{id:e.id,name:e.name,area_id:e.area_id??null},entities:t}).map(i=>p`<div class="nf-rp-sec nf-rp-plugin" data-plugin=${i.key}>
|
||||
<div class="nf-rp-sec-head"><h3>${i.title}</h3></div>
|
||||
${typeof i.content=="string"?p`<p class="nf-rp-note">${i.content}</p>`:i.content}
|
||||
</div>`)}section(e,t,n=f){return p`<div class="nf-rp-sec">
|
||||
<div class="nf-rp-sec-head"><h3>${this.t(e)}</h3>${n}</div>
|
||||
${t}
|
||||
</div>`}lightRow(e){let t=e.attributes,n=e.state==="on",i=t.supported_color_modes??[],o=i.some(h=>h!=="onoff"),s=i.includes("color_temp"),a=i.some(h=>["hs","rgb","rgbw","rgbww","xy"].includes(h)),l=typeof t.brightness=="number"?Math.round(t.brightness/255*100):100,c=t.min_color_temp_kelvin??2200,u=t.max_color_temp_kelvin??6500,d=e.entity_id,m=!!this.placedAs(d)?.simple;return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon ${n?"nf-rp-on":""}">${Ct("light")}</span>
|
||||
<span class="nf-rp-icon ${n?"nf-rp-on":""}">${Bt("light")}</span>
|
||||
${this.nameButton(d)}
|
||||
<span class="nf-rp-state">${this.stateOf(e)}${j(this.hass,[e.entity_id])}</span>
|
||||
<span class="nf-rp-state">${this.stateOf(e)}${U(this.hass,[e.entity_id])}</span>
|
||||
${this.toggle(e,n,()=>this.call("light","toggle",{entity_id:d}))}
|
||||
${o&&!m?p`<label class="nf-rp-slider"
|
||||
><span>${this.t("brightness")}</span>
|
||||
@@ -384,23 +384,23 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
@change=${h=>this.call("light","turn_on",{entity_id:d,color_temp_kelvin:Number(h.target.value)})}
|
||||
/></label>`:f}
|
||||
${n&&a&&!m?p`<div class="nf-rp-swatches" role="group" aria-label=${this.t("color")}>
|
||||
${Tm.map(h=>p`<button
|
||||
${Fm.map(h=>p`<button
|
||||
class="nf-rp-swatch"
|
||||
style="--c: rgb(${h.join(",")})"
|
||||
aria-label="rgb(${h.join(", ")})"
|
||||
@click=${()=>this.call("light","turn_on",{entity_id:d,rgb_color:h})}
|
||||
></button>`)}
|
||||
</div>`:f}
|
||||
</div>`}coverRow(e){let t=mr(this.hass,this.building?.floors??[],e.entity_id);e=pr(this.hass,e,t);let n=e.attributes,i=n.supported_features??0,o=e.entity_id,s=N(e)&&!on(e);return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon">${Ct("cover")}</span>
|
||||
</div>`}coverRow(e){let t=gr(this.hass,this.building?.floors??[],e.entity_id);e=_r(this.hass,e,t);let n=e.attributes,i=n.supported_features??0,o=e.entity_id,s=N(e)&&!ln(e);return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon">${Bt("cover")}</span>
|
||||
${this.nameButton(o)}
|
||||
<span class="nf-rp-state">${this.stateOf(e)}${j(this.hass,[e.entity_id])}</span>
|
||||
<span class="nf-rp-state">${this.stateOf(e)}${U(this.hass,[e.entity_id])}</span>
|
||||
<div class="nf-rp-buttons">
|
||||
<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.askFor(o)&&this.call("cover","open_cover",{entity_id:o})}>${this.t("cover_open")}</button>
|
||||
${i&zm?p`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","stop_cover",{entity_id:o})}>${this.t("cover_stop")}</button>`:f}
|
||||
${i&Dm?p`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","stop_cover",{entity_id:o})}>${this.t("cover_stop")}</button>`:f}
|
||||
<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.askFor(o)&&this.call("cover","close_cover",{entity_id:o})}>${this.t("cover_close")}</button>
|
||||
</div>
|
||||
${i&Rm&&typeof n.current_position=="number"?p`<label class="nf-rp-slider"
|
||||
${i&Tm&&typeof n.current_position=="number"?p`<label class="nf-rp-slider"
|
||||
><span>${this.t("position")}</span>
|
||||
<input
|
||||
type="range"
|
||||
@@ -424,12 +424,12 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${i&32?p`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","close_cover_tilt",{entity_id:o})}>${this.t("cover_tilt_close")}</button>`:f}
|
||||
</div>`:f}
|
||||
</div>`}climateRow(e){let t=e.attributes,n=e.entity_id,i=typeof t.temperature=="number"?t.temperature:null,o=t.target_temp_step??.5,s=t.min_temp??5,a=t.max_temp??30,l=t.hvac_modes??[],c=u=>this.call("climate","set_temperature",{entity_id:n,temperature:Math.min(a,Math.max(s,Math.round(u/o)*o))});return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon ${t.hvac_action==="heating"?"nf-rp-on":""}">${Ct("climate")}</span>
|
||||
<span class="nf-rp-icon ${t.hvac_action==="heating"?"nf-rp-on":""}">${Bt("climate")}</span>
|
||||
${this.nameButton(n)}
|
||||
<span class="nf-rp-state">${this.stateOf(e)}${j(this.hass,[e.entity_id])}</span>
|
||||
<span class="nf-rp-state">${this.stateOf(e)}${U(this.hass,[e.entity_id])}</span>
|
||||
${i!==null?p`<div class="nf-rp-stepper nf-rp-wide">
|
||||
<button class="nf-btn" aria-label=${this.t("temp_down")} @click=${()=>c(i-o)}>−</button>
|
||||
<span><small>${this.t("target_temp")}</small> ${W(this.hass,i,1)} ${re(this.hass)}</span>
|
||||
<span><small>${this.t("target_temp")}</small> ${L(this.hass,i,1)} ${re(this.hass)}</span>
|
||||
<button class="nf-btn" aria-label=${this.t("temp_up")} @click=${()=>c(i+o)}>+</button>
|
||||
</div>`:f}
|
||||
${l.length>1?p`<div class="nf-rp-chips">
|
||||
@@ -442,19 +442,19 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
</button>`)}
|
||||
</div>`:f}
|
||||
</div>`}stateOf(e,t=oe(this.hass,e)){if(this.room?.no_state?.includes(e.entity_id))return"";let n=H(e.entity_id);return e.state==="unknown"&&n!=="sensor"&&n!=="binary"?"":t}stateLabel(e){let t=`state_${e}`,n=this.t(t);return n===t?e:n}mediaRow(e){let t=e.attributes,n=e.entity_id,i=N(e)||e.state==="off",o=[t.media_title,t.media_artist].filter(s=>typeof s=="string"&&s).join(" \xB7 ");return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon ${e.state==="playing"?"nf-rp-on":""}">${Ct("media")}</span>
|
||||
<span class="nf-rp-icon ${e.state==="playing"?"nf-rp-on":""}">${Bt("media")}</span>
|
||||
${this.nameButton(n)}
|
||||
<span class="nf-rp-state">${this.stateOf(e,this.stateLabel(e.state))}${j(this.hass,[e.entity_id])}</span>
|
||||
<span class="nf-rp-state">${this.stateOf(e,this.stateLabel(e.state))}${U(this.hass,[e.entity_id])}</span>
|
||||
${o?p`<p class="nf-rp-media nf-rp-wide">${o}</p>`:f}
|
||||
<div class="nf-rp-buttons nf-rp-wide">
|
||||
<button class="nf-btn nf-rp-small" aria-label=${this.t("previous")} ?disabled=${i} @click=${()=>this.call("media_player","media_previous_track",{entity_id:n})}>
|
||||
${ao(Tr.previous)}
|
||||
${co(Fr.previous)}
|
||||
</button>
|
||||
<button class="nf-btn nf-rp-small" aria-label=${this.t("play_pause")} ?disabled=${N(e)} @click=${()=>this.call("media_player","media_play_pause",{entity_id:n})}>
|
||||
${ao(e.state==="playing"?Tr.pause:Tr.play)}
|
||||
${co(e.state==="playing"?Fr.pause:Fr.play)}
|
||||
</button>
|
||||
<button class="nf-btn nf-rp-small" aria-label=${this.t("next")} ?disabled=${i} @click=${()=>this.call("media_player","media_next_track",{entity_id:n})}>
|
||||
${ao(Tr.next)}
|
||||
${co(Fr.next)}
|
||||
</button>
|
||||
</div>
|
||||
${typeof t.volume_level=="number"?p`<label class="nf-rp-slider"
|
||||
@@ -467,15 +467,15 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
@change=${s=>this.call("media_player","volume_set",{entity_id:n,volume_level:Number(s.target.value)/100})}
|
||||
/></label>`:f}
|
||||
</div>`}switchRow(e){let t=e.entity_id,n=H(t),i=t.slice(0,t.indexOf(".")),o=n==="lock"?e.state==="unlocked"||e.state==="open":te(e),s=()=>n==="lock"?this.call("lock",o?"lock":"unlock",{entity_id:t}):this.call(i,"toggle",{entity_id:t});return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon ${o?"nf-rp-on":""}">${Ct(n)}</span>
|
||||
<span class="nf-rp-icon ${o?"nf-rp-on":""}">${Bt(n)}</span>
|
||||
${this.nameButton(t)}
|
||||
<span class="nf-rp-state">${this.stateOf(e)}${j(this.hass,[e.entity_id])}</span>
|
||||
<span class="nf-rp-state">${this.stateOf(e)}${U(this.hass,[e.entity_id])}</span>
|
||||
${this.toggle(e,o,s)}
|
||||
</div>`}sensorRow(e){let t=H(e.entity_id),n=t==="binary"&&e.state==="on";return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon ${n?"nf-rp-on":""}">${Ct(t)}</span>
|
||||
<span class="nf-rp-icon ${n?"nf-rp-on":""}">${Bt(t)}</span>
|
||||
${this.nameButton(e.entity_id)}
|
||||
<span class="nf-rp-state">${this.stateOf(e)}${j(this.hass,[e.entity_id])}</span>
|
||||
</div>`}fire(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))}static styles=[ge,Re,X`
|
||||
<span class="nf-rp-state">${this.stateOf(e)}${U(this.hass,[e.entity_id])}</span>
|
||||
</div>`}fire(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))}static styles=[ge,Re,Y`
|
||||
:host {
|
||||
display: block;
|
||||
}
|
||||
@@ -856,38 +856,38 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
outline: 2px solid var(--nf-accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
`]};customElements.get("nf-room-panel")||customElements.define("nf-room-panel",lo);function Zl(r){if(!r)return"";let e=Math.min(.8,Math.max(0,r.dim??.35)),t=r.image&&/^(https:\/\/|\/local\/|\/api\/)[^"'()\\\s]+$/.test(r.image)?r.image:null,n=r.color&&/^#[0-9a-f]{6}$/i.test(r.color)?r.color:null;return t?`;background:linear-gradient(rgba(0,0,0,${e}),rgba(0,0,0,${e})),center / cover no-repeat url("${t}")${n?` ${n}`:""}`:n?`;background:${n}`:""}var Hm=[[/spotify/i,[30,215,96]],[/netflix/i,[229,9,20]],[/youtube/i,[255,0,51]],[/prime|amazon/i,[0,168,225]],[/disney/i,[17,60,207]],[/apple ?music|itunes/i,[250,45,72]],[/apple ?tv/i,[200,200,210]],[/plex/i,[229,160,13]],[/tidal/i,[0,255,255]],[/deezer/i,[162,56,255]],[/radio|tunein/i,[255,140,60]]],Yl=[34,211,238];function co(r){return r?Hm.find(([e])=>e.test(r))?.[1]??Yl:Yl}function uo(r){if(r.state==="playing"||r.state==="paused")return!0;let e=t=>typeof r.attributes[t]=="string"&&r.attributes[t]!=="";return r.state==="on"&&(e("media_title")||e("media_channel")||e("source")||e("app_name"))}var ho=r=>r.state==="playing"||r.state==="on"&&uo(r);function Jl(r,e){let t=[],n=new Set;for(let i of e){if(!i.entity.startsWith("media_player.")||n.has(i.entity))continue;n.add(i.entity);let o=r.states[i.entity];if(!o)continue;let s=o.attributes,a=u=>typeof s[u]=="string"?s[u]:"",l=a("app_name")||a("source")||a("app_id")||null,c=typeof s.volume_level=="number"?s.volume_level:null;t.push({entity:i.entity,name:i.name,at:i.at,playing:ho(o),title:a("media_title")||a("media_channel")||l||"",artist:a("media_artist")||a("media_album_name")||a("media_series_title"),picture:a("entity_picture")||null,volume:c,color:co(l),app:l,group:Array.isArray(s.group_members)?s.group_members.filter(u=>typeof u=="string"&&u!==i.entity):[],rings:i.rings??1})}return t}function Ql(r){let e=new Map(r.filter(i=>i.playing).map(i=>[i.entity,i])),t=[],n=new Set;for(let i of e.values())for(let o of i.group){let s=e.get(o),a=[i.entity,o].sort().join("|");s&&!n.has(a)&&(n.add(a),t.push([i,s]))}return t}var Pm=3;function Xl(r,e,t){let n=[];for(let i of e.floors)for(let o of i.furniture){if(!o.type.endsWith(":sprinkler"))continue;let s=t?.get(o.id)?.entity??null;!s||!te(r.states[s])||n.push({id:o.id,at:{floorId:i.id,x:o.x,y:he(i,o)+o.h,z:o.z},reach:Math.min(15,Math.max(.5,o.spray??Pm))})}return n}var Dr=r=>r&&r!=="none"?r:null,ec=r=>Math.min(1,Math.max(0,r));function tc(r,e){let t=new Map;for(let n of e.settings.roof?.windows??[]){let i=Pe(r,{cover:Dr(n.cover),contact:Dr(n.contact),tilt:Dr(n.tilt)},"window"),o=Dr(n.window),s=o?r.states[o]:void 0,a=i.open;if(s&&!N(s)){let l=s.attributes.current_position;a=typeof l=="number"?ec(l/100):s.state==="open"||s.state==="opening"?1:0}t.set(n.id,{open:a,tilt:i.tilt,cover:i.cover??0})}return t}function Im(r,e){let t=i=>Math.hypot(i.x-e.x,i.z-e.z);return r.placements.filter(i=>i.entity_id.startsWith("media_player.")&&t(i)<Math.max(2,e.w)).sort((i,o)=>t(i)-t(o))[0]?.entity_id??null}var et=(r,e)=>typeof r[e]=="string"?r[e]:"";function nc(r,e,t){let n=[];for(let i of e.floors)for(let o of i.furniture){if(!ur(o.type))continue;let s=t?.get(o.id)?.entity??null,a=s?.startsWith("media_player.")?s:Im(i,o),l=a?r.states[a]:void 0;if(!l||!uo(l))continue;let c=l.attributes,u=et(c,"app_name")||et(c,"source")||null;n.push({id:o.id,furnitureId:o.id,floorId:i.id,color:co(u),title:et(c,"media_title")||et(c,"media_channel")||u||"",subtitle:et(c,"media_artist")||et(c,"media_series_title")||et(c,"media_album_name"),app:u,picture:et(c,"entity_picture")||null,playing:ho(l),ambilight:o.ambilight??1})}return n}function rc(r){let e=r.states["sun.sun"]?.attributes;return typeof e?.elevation=="number"&&typeof e.azimuth=="number"?{elevation:e.elevation,azimuth:e.azimuth}:null}function ic(r,e){return(r===null?0:ec((r+4)/16))*(1-.45*e)}function tt(r,e){return r.states["weather.nextfloor_symcon"]?"weather.nextfloor_symcon":e&&r.states[e]?e:Object.keys(r.states).filter(t=>t.startsWith("weather.")).sort()[0]??null}var Fr=new Set(["contact_lost","unlocked_night","own"]);function Nm(r,e){let t=r.states[e.entity];if(!t||["unavailable","unknown"].includes(t.state))return!1;let n=(e.state??"on").trim(),i=/^([<>])\s*(-?\d+(?:[.,]\d+)?)$/.exec(n);if(i){let o=Number(t.state),s=Number(i[2].replace(",","."));return Number.isFinite(o)&&(i[1]==="<"?o<s:o>s)}return n.split(",").map(o=>o.trim().toLowerCase()).filter(Boolean).includes(String(t.state).toLowerCase())}var Cm=600*1e3,Wm=new Set(["rainy","pouring","lightning-rainy","hail","snowy-rainy"]),Lm=new Map([["smoke","smoke"],["gas","gas"],["carbon_monoxide","co"],["moisture","water"]]),oc=(r,e)=>{if(e.startsWith("binary_sensor."))return Lm.get(String(r.states[e]?.attributes.device_class))};function Om(r,e){let t=new Set,n=[];for(let i of r.floors)for(let o of i.openings){let s=e.get(o.id);for(let a of s?[s.contact,s.contact2,s.tilt,s.tilt2]:[])!a||t.has(a)||(t.add(a),n.push({floorId:i.id,roomId:o.room_id,entity:a}))}return n}function sc(r,e,t,n){let i=[];for(let a o
Line truncated
|
||||
`]};customElements.get("nf-room-panel")||customElements.define("nf-room-panel",uo);function Jl(r){if(!r)return"";let e=Math.min(.8,Math.max(0,r.dim??.35)),t=r.image&&/^(https:\/\/|\/local\/|\/api\/)[^"'()\\\s]+$/.test(r.image)?r.image:null,n=r.color&&/^#[0-9a-f]{6}$/i.test(r.color)?r.color:null;return t?`;background:linear-gradient(rgba(0,0,0,${e}),rgba(0,0,0,${e})),center / cover no-repeat url("${t}")${n?` ${n}`:""}`:n?`;background:${n}`:""}var Im=[[/spotify/i,[30,215,96]],[/netflix/i,[229,9,20]],[/youtube/i,[255,0,51]],[/prime|amazon/i,[0,168,225]],[/disney/i,[17,60,207]],[/apple ?music|itunes/i,[250,45,72]],[/apple ?tv/i,[200,200,210]],[/plex/i,[229,160,13]],[/tidal/i,[0,255,255]],[/deezer/i,[162,56,255]],[/radio|tunein/i,[255,140,60]]],Ql=[34,211,238];function ho(r){return r?Im.find(([e])=>e.test(r))?.[1]??Ql:Ql}function mo(r){if(r.state==="playing"||r.state==="paused")return!0;let e=t=>typeof r.attributes[t]=="string"&&r.attributes[t]!=="";return r.state==="on"&&(e("media_title")||e("media_channel")||e("source")||e("app_name"))}var po=r=>r.state==="playing"||r.state==="on"&&mo(r);function Xl(r,e){let t=[],n=new Set;for(let i of e){if(!i.entity.startsWith("media_player.")||n.has(i.entity))continue;n.add(i.entity);let o=r.states[i.entity];if(!o)continue;let s=o.attributes,a=u=>typeof s[u]=="string"?s[u]:"",l=a("app_name")||a("source")||a("app_id")||null,c=typeof s.volume_level=="number"?s.volume_level:null;t.push({entity:i.entity,name:i.name,at:i.at,playing:po(o),title:a("media_title")||a("media_channel")||l||"",artist:a("media_artist")||a("media_album_name")||a("media_series_title"),picture:a("entity_picture")||null,volume:c,color:ho(l),app:l,group:Array.isArray(s.group_members)?s.group_members.filter(u=>typeof u=="string"&&u!==i.entity):[],rings:i.rings??1})}return t}function ec(r){let e=new Map(r.filter(i=>i.playing).map(i=>[i.entity,i])),t=[],n=new Set;for(let i of e.values())for(let o of i.group){let s=e.get(o),a=[i.entity,o].sort().join("|");s&&!n.has(a)&&(n.add(a),t.push([i,s]))}return t}var Nm=3;function tc(r,e,t){let n=[];for(let i of e.floors)for(let o of i.furniture){if(!o.type.endsWith(":sprinkler"))continue;let s=t?.get(o.id)?.entity??null;!s||!te(r.states[s])||n.push({id:o.id,at:{floorId:i.id,x:o.x,y:he(i,o)+o.h,z:o.z},reach:Math.min(15,Math.max(.5,o.spray??Nm))})}return n}var Hr=r=>r&&r!=="none"?r:null,nc=r=>Math.min(1,Math.max(0,r));function rc(r,e){let t=new Map;for(let n of e.settings.roof?.windows??[]){let i=Ce(r,{cover:Hr(n.cover),contact:Hr(n.contact),tilt:Hr(n.tilt)},"window"),o=Hr(n.window),s=o?r.states[o]:void 0,a=i.open;if(s&&!N(s)){let l=s.attributes.current_position;a=typeof l=="number"?nc(l/100):s.state==="open"||s.state==="opening"?1:0}t.set(n.id,{open:a,tilt:i.tilt,cover:i.cover??0})}return t}function Cm(r,e){let t=i=>Math.hypot(i.x-e.x,i.z-e.z);return r.placements.filter(i=>i.entity_id.startsWith("media_player.")&&t(i)<Math.max(2,e.w)).sort((i,o)=>t(i)-t(o))[0]?.entity_id??null}var it=(r,e)=>typeof r[e]=="string"?r[e]:"";function ic(r,e,t){let n=[];for(let i of e.floors)for(let o of i.furniture){if(!mr(o.type))continue;let s=t?.get(o.id)?.entity??null,a=s?.startsWith("media_player.")?s:Cm(i,o),l=a?r.states[a]:void 0;if(!l||!mo(l))continue;let c=l.attributes,u=it(c,"app_name")||it(c,"source")||null;n.push({id:o.id,furnitureId:o.id,floorId:i.id,color:ho(u),title:it(c,"media_title")||it(c,"media_channel")||u||"",subtitle:it(c,"media_artist")||it(c,"media_series_title")||it(c,"media_album_name"),app:u,picture:it(c,"entity_picture")||null,playing:po(l),ambilight:o.ambilight??1})}return n}function oc(r){let e=r.states["sun.sun"]?.attributes;return typeof e?.elevation=="number"&&typeof e.azimuth=="number"?{elevation:e.elevation,azimuth:e.azimuth}:null}function sc(r,e){return(r===null?0:nc((r+4)/16))*(1-.45*e)}function ot(r,e){return r.states["weather.nextfloor_symcon"]?"weather.nextfloor_symcon":e&&r.states[e]?e:Object.keys(r.states).filter(t=>t.startsWith("weather.")).sort()[0]??null}var Pr=new Set(["contact_lost","unlocked_night","own"]);function Lm(r,e){let t=r.states[e.entity];if(!t||["unavailable","unknown"].includes(t.state))return!1;let n=(e.state??"on").trim(),i=/^([<>])\s*(-?\d+(?:[.,]\d+)?)$/.exec(n);if(i){let o=Number(t.state),s=Number(i[2].replace(",","."));return Number.isFinite(o)&&(i[1]==="<"?o<s:o>s)}return n.split(",").map(o=>o.trim().toLowerCase()).filter(Boolean).includes(String(t.state).toLowerCase())}var Om=600*1e3,Wm=new Set(["rainy","pouring","lightning-rainy","hail","snowy-rainy"]),Bm=new Map([["smoke","smoke"],["gas","gas"],["carbon_monoxide","co"],["moisture","water"]]),ac=(r,e)=>{if(e.startsWith("binary_sensor."))return Bm.get(String(r.states[e]?.attributes.device_class))};function Vm(r,e){let t=new Set,n=[];for(let i of r.floors)for(let o of i.openings){let s=e.get(o.id);for(let a of s?[s.contact,s.contact2,s.tilt,s.tilt2]:[])!a||t.has(a)||(t.add(a),n.push({floorId:i.id,roomId:o.room_id,entity:a}))}return n}function lc(r,e,t,n){let i=[];for(let a o
Line truncated
|
||||
${ne`<circle cx="27" cy="27" r=${22} class="live-ring-bg"></circle>
|
||||
<circle cx="27" cy="27" r=${22} stroke=${e} stroke-dasharray=${`${(n*Math.max(0,Math.min(1,r))).toFixed(1)} ${n.toFixed(1)}`} transform="rotate(-90 27 27)" class="live-ring-fg"></circle>`}
|
||||
</svg>`}function Jp(r,e,t,n){let i=e.summary,o=c=>$(r,c),s=e.autarky,a=n?p`<button class="live-fold" title=${o(n.folded?"live_unfold":"live_fold")} aria-label=${o(n.folded?"live_unfold":"live_fold")} aria-expanded=${!n.folded} @click=${n.toggle}>${n.folded?"+":"\u2212"}</button>`:f;if(n?.folded){let c=i.solar!==null?`\u2600 ${Te(r,i.solar)}`:i.consumption!==null?`\u2302 ${Te(r,i.consumption)}`:null;return p`<div class="live-card live-card-house live-folded" data-i=${t}>
|
||||
${s!==null?p`<div class="live-own">${Tn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)}%</b></div></div>`:f}
|
||||
</svg>`}function Xp(r,e,t,n){let i=e.summary,o=c=>$(r,c),s=e.autarky,a=n?p`<button class="live-fold" title=${o(n.folded?"live_unfold":"live_fold")} aria-label=${o(n.folded?"live_unfold":"live_fold")} aria-expanded=${!n.folded} @click=${n.toggle}>${n.folded?"+":"\u2212"}</button>`:f;if(n?.folded){let c=i.solar!==null?`\u2600 ${He(r,i.solar)}`:i.consumption!==null?`\u2302 ${He(r,i.consumption)}`:null;return p`<div class="live-card live-card-house live-folded" data-i=${t}>
|
||||
${s!==null?p`<div class="live-own">${Hn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)}%</b></div></div>`:f}
|
||||
${c?p`<b>${c}</b>`:s===null?p`<b>⌂</b>`:f}
|
||||
${a}
|
||||
</div>`}let l=[];if(i.solar!==null&&l.push(p`<div class="live-row live-solar"><span>☀ ${o("energy_solar")}</span><b>${Te(r,i.solar)}</b></div>`),i.consumption!==null&&l.push(p`<div class="live-row live-house"><span>⌂ ${o("energy_consumption")}</span><b>${Te(r,i.consumption)}</b></div>`),i.rest!==void 0&&i.rest!==null&&l.push(p`<div class="live-row live-house"><span>⌂ ${o("energy_rest")}</span><b>${Te(r,i.rest)}</b></div>`),i.battery!==null||i.soc!==null){let c=i.battery===null||Math.abs(i.battery)<15?"":i.battery>0?" \u2193":" \u2191";l.push(p`<div class="live-row live-battery"><span>▮ ${o("energy_battery")}${c}</span><b>${i.soc!==null?`${Math.round(i.soc)} %`:""}${i.battery!==null&&Math.abs(i.battery)>=15?` \xB7 ${Te(r,i.battery)}`:""}</b></div>`)}if(i.grid!==null){let c=i.grid<-15;l.push(p`<div class="live-row ${c?"live-export":"live-import"}"><span>⇄ ${o(c?"energy_grid_export":"energy_grid_import")}</span><b>${Te(r,i.grid)}</b></div>`)}for(let c of e.meters??[])l.push(p`<div class="live-row live-meter"><span>${c.icon} ${c.label}</span><b>${c.value}</b></div>`);return p`<div class="live-card live-card-house" data-i=${t}>
|
||||
</div>`}let l=[];if(i.solar!==null&&l.push(p`<div class="live-row live-solar"><span>☀ ${o("energy_solar")}</span><b>${He(r,i.solar)}</b></div>`),i.consumption!==null&&l.push(p`<div class="live-row live-house"><span>⌂ ${o("energy_consumption")}</span><b>${He(r,i.consumption)}</b></div>`),i.rest!==void 0&&i.rest!==null&&l.push(p`<div class="live-row live-house"><span>⌂ ${o("energy_rest")}</span><b>${He(r,i.rest)}</b></div>`),i.battery!==null||i.soc!==null){let c=i.battery===null||Math.abs(i.battery)<15?"":i.battery>0?" \u2193":" \u2191";l.push(p`<div class="live-row live-battery"><span>▮ ${o("energy_battery")}${c}</span><b>${i.soc!==null?`${Math.round(i.soc)} %`:""}${i.battery!==null&&Math.abs(i.battery)>=15?` \xB7 ${He(r,i.battery)}`:""}</b></div>`)}if(i.grid!==null){let c=i.grid<-15;l.push(p`<div class="live-row ${c?"live-export":"live-import"}"><span>⇄ ${o(c?"energy_grid_export":"energy_grid_import")}</span><b>${He(r,i.grid)}</b></div>`)}for(let c of e.meters??[])l.push(p`<div class="live-row live-meter"><span>${c.icon} ${c.label}</span><b>${c.value}</b></div>`);return p`<div class="live-card live-card-house" data-i=${t}>
|
||||
${a}
|
||||
${s!==null?p`<div class="live-own">${Tn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)} %</b><span>${o("live_autarky")}</span></div></div>`:f}
|
||||
${s!==null?p`<div class="live-own">${Hn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)} %</b><span>${o("live_autarky")}</span></div></div>`:f}
|
||||
<div class="live-rows">${l}</div>
|
||||
${Xp(r,e.curves)} ${Qp(r,e.week)}
|
||||
</div>`}function Qp(r,e){if(!e)return f;let t=[...e.solar,...e.use].filter(c=>c!==null&&c>0);if(!t.length)return f;let n=Math.max(...t)*1.1||1,[i,o]=[150,30],s=i/7,a=(c,u,d)=>c===null||c<=0?f:ne`<rect x=${u.toFixed(1)} y=${(o-c/n*o).toFixed(1)} width=${(s*.36).toFixed(1)} height=${(c/n*o).toFixed(1)} class=${d}></rect>`,l=c=>c.reduce((u,d)=>u+(d??0),0);return p`<div class="live-day live-week" title=${$(r,"live_week_hint",{solar:W(r,l(e.solar),0),use:W(r,l(e.use),0)})}>
|
||||
${tf(r,e.curves)} ${ef(r,e.week)}
|
||||
</div>`}function ef(r,e){if(!e)return f;let t=[...e.solar,...e.use].filter(c=>c!==null&&c>0);if(!t.length)return f;let n=Math.max(...t)*1.1||1,[i,o]=[150,30],s=i/7,a=(c,u,d)=>c===null||c<=0?f:ne`<rect x=${u.toFixed(1)} y=${(o-c/n*o).toFixed(1)} width=${(s*.36).toFixed(1)} height=${(c/n*o).toFixed(1)} class=${d}></rect>`,l=c=>c.reduce((u,d)=>u+(d??0),0);return p`<div class="live-day live-week" title=${$(r,"live_week_hint",{solar:L(r,l(e.solar),0),use:L(r,l(e.use),0)})}>
|
||||
<svg viewBox=${`0 0 ${i} ${o}`} preserveAspectRatio="none" aria-hidden="true">
|
||||
${e.days.map((c,u)=>ne`${a(e.solar[u],u*s+s*.1,"live-week-solar")}${a(e.use[u],u*s+s*.5,"live-week-use")}`)}
|
||||
</svg>
|
||||
<span>7 ${$(r,"live_days")}</span>
|
||||
</div>`}function Xp(r,e){if(!e)return f;let t=[...e.solar,...e.use].filter(l=>l!==null);if(t.length<4)return f;let n=Math.max(...t)*1.08||1,[i,o]=[150,34],s=wn(e.solar,i,o,n),a=wn(e.use,i,o,n);return p`<div class="live-day" title=${$(r,"live_day_hint")}>
|
||||
</div>`}function tf(r,e){if(!e)return f;let t=[...e.solar,...e.use].filter(l=>l!==null);if(t.length<4)return f;let n=Math.max(...t)*1.08||1,[i,o]=[150,34],s=Sn(e.solar,i,o,n),a=Sn(e.use,i,o,n);return p`<div class="live-day" title=${$(r,"live_day_hint")}>
|
||||
<svg viewBox=${`0 0 ${i} ${o}`} preserveAspectRatio="none" aria-hidden="true">
|
||||
${s?ne`<path d=${`${s}L${i},${o}L0,${o}Z`} class="live-day-solar"></path>`:f}
|
||||
${a?ne`<path d=${a} class="live-day-use"></path>`:f}
|
||||
</svg>
|
||||
<span>24 h</span>
|
||||
</div>`}function ef(r,e,t,n){let i=e.car,o=(u,d)=>$(r,u,d),s=Qc(i.soc),a=i.home?i.charging?`\u26A1 ${o("live_car_charging")}${i.chargingW?` \xB7 ${Te(r,i.chargingW)}`:""}`:i.plugged?`\u{1F50C} ${o("live_car_plugged")}`:"":`${o("live_car_away")}${i.where?` \xB7 ${i.where}`:""}${i.distance!==null?` \xB7 ${W(r,i.distance,i.distance<10?1:0)} km`:""}`,l=i.entities,c=(u,d,m,h)=>p`<button class="live-btn ${u?"live-on":""}" title=${d} aria-label=${d} aria-pressed=${u??!1} @click=${g=>(g.stopPropagation(),h())}>${m}</button>`;return p`<div class="live-card live-card-car ${i.charging?"live-charging":""} ${i.home?"":"live-away"}" data-i=${t} style=${`--live-soc:${s}`}>
|
||||
</div>`}function nf(r,e,t,n){let i=e.car,o=(u,d)=>$(r,u,d),s=eu(i.soc),a=i.home?i.charging?`\u26A1 ${o("live_car_charging")}${i.chargingW?` \xB7 ${He(r,i.chargingW)}`:""}`:i.plugged?`\u{1F50C} ${o("live_car_plugged")}`:"":`${o("live_car_away")}${i.where?` \xB7 ${i.where}`:""}${i.distance!==null?` \xB7 ${L(r,i.distance,i.distance<10?1:0)} km`:""}`,l=i.entities,c=(u,d,m,h)=>p`<button class="live-btn ${u?"live-on":""}" title=${d} aria-label=${d} aria-pressed=${u??!1} @click=${g=>(g.stopPropagation(),h())}>${m}</button>`;return p`<div class="live-card live-card-car ${i.charging?"live-charging":""} ${i.home?"":"live-away"}" data-i=${t} style=${`--live-soc:${s}`}>
|
||||
<div class="live-own">
|
||||
${Tn((i.soc??0)/100,s)}
|
||||
${Hn((i.soc??0)/100,s)}
|
||||
<div class="live-own-text"><b>${i.soc!==null?`${Math.round(i.soc)} %`:"\u2013"}</b><span>${i.range!==null?`${Math.round(i.range)} ${i.rangeUnit}`:""}</span></div>
|
||||
</div>
|
||||
<div class="live-rows">
|
||||
<div class="live-title">${e.name}</div>
|
||||
${a?p`<div class="live-status">${a}</div>`:f}
|
||||
${i.inside!==null?p`<div class="live-status">🌡 ${W(r,i.inside,1)} °C</div>`:f}
|
||||
${i.inside!==null?p`<div class="live-status">🌡 ${L(r,i.inside,1)} °C</div>`:f}
|
||||
${i.departure?p`<div class="live-status">⏰ ${o("live_car_departure",{time:i.departure})}</div>`:f}
|
||||
${i.open.length?p`<div class="live-status live-warn">⚠ ${o("live_car_open",{parts:i.open.join(", ")})}</div>`:f}
|
||||
<div class="live-actions">
|
||||
@@ -896,7 +896,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${l.charge&&i.home?c(i.charging,o("live_car_charge"),"\u26A1",()=>n(l.charge.split(".")[0],"toggle",l.charge)):f}
|
||||
</div>
|
||||
</div>
|
||||
</div>`}function tf(r,e,t,n){let i=e.media,o=l=>$(r,l),s=`rgb(${i.color.join(",")})`,a=(l,c,u)=>p`<button class="live-btn" title=${l} aria-label=${l} @click=${d=>(d.stopPropagation(),n("media_player",u,i.entity))}>${c}</button>`;return p`<div class="live-card live-card-media" data-i=${t} style=${`--live-soc:${s}`} @click=${l=>l.currentTarget.classList.toggle("live-open")}>
|
||||
</div>`}function rf(r,e,t,n){let i=e.media,o=l=>$(r,l),s=`rgb(${i.color.join(",")})`,a=(l,c,u)=>p`<button class="live-btn" title=${l} aria-label=${l} @click=${d=>(d.stopPropagation(),n("media_player",u,i.entity))}>${c}</button>`;return p`<div class="live-card live-card-media" data-i=${t} style=${`--live-soc:${s}`} @click=${l=>l.currentTarget.classList.toggle("live-open")}>
|
||||
${i.picture?p`<img class="live-cover" src=${i.picture} alt="" loading="lazy" />`:p`<div class="live-cover live-cover-none">♪</div>`}
|
||||
<div class="live-rows">
|
||||
<div class="live-title" title=${i.title}>${i.title||i.name}</div>
|
||||
@@ -915,9 +915,9 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
/>`:f}
|
||||
</div>
|
||||
</div>
|
||||
</div>`}function Xc(r){let e=[...r.querySelectorAll(".live-card")].filter(o=>o.style.visibility!=="hidden"),t=[],n=e[0]?.parentElement?.clientWidth??0,i=e.map(o=>{let[s,a]=[Number(o.dataset.x),o.offsetWidth],l=n?n>a+16?Math.min(Math.max(s,a/2+8),n-a/2-8):n/2:s;return o.style.setProperty("--live-dx",`${Math.round(s-l)}px`),{el:o,x:l,y:Number(o.dataset.y),w:a,h:o.offsetHeight}}).sort((o,s)=>s.y-o.y);for(let o of i){let s=o.y;for(let l=0;l<12;l++){let c={x0:o.x-o.w/2,x1:o.x+o.w/2,y0:s-o.h,y1:s},u=t.find(d=>c.x0<d.x1+6&&c.x1>d.x0-6&&c.y0<d.y1+6&&c.y1>d.y0-6);if(!u)break;s=u.y0-8}t.push({x0:o.x-o.w/2,x1:o.x+o.w/2,y0:s-o.h,y1:s});let a=o.y-s;o.el.style.transform=`translate(${Math.round(o.x)}px, ${Math.round(s)}px) translate(-50%, -100%)`,o.el.style.setProperty("--live-thread",`${Math.round(18+a)}px`)}}function nf(r,e,t){let n=e.printer,i=(c,u)=>$(r,c,u),o=n.progress??0,s=c=>new Intl.DateTimeFormat(r?.language??navigator.language,{hour:"2-digit",minute:"2-digit"}).format(new Date(c)),a=n.remaining!==null?n.remaining>=60?`${Math.floor(n.remaining/60)} h ${Math.round(n.remaining%60)} min`:`${Math.round(n.remaining)} min`:null,l=[n.nozzle!==null?`${i("printer_nozzle")} ${Math.round(n.nozzle)}\xB0`:null,n.bed!==null?`${i("printer_bed")} ${Math.round(n.bed)}\xB0`:null].filter(Boolean).join(" \xB7 ");return p`<div class="live-card live-card-printer ${n.printing?"live-charging":""}" data-i=${t}>
|
||||
</div>`}function tu(r){let e=[...r.querySelectorAll(".live-card")].filter(o=>o.style.visibility!=="hidden"),t=[],n=e[0]?.parentElement?.clientWidth??0,i=e.map(o=>{let[s,a]=[Number(o.dataset.x),o.offsetWidth],l=n?n>a+16?Math.min(Math.max(s,a/2+8),n-a/2-8):n/2:s;return o.style.setProperty("--live-dx",`${Math.round(s-l)}px`),{el:o,x:l,y:Number(o.dataset.y),w:a,h:o.offsetHeight}}).sort((o,s)=>s.y-o.y);for(let o of i){let s=o.y;for(let l=0;l<12;l++){let c={x0:o.x-o.w/2,x1:o.x+o.w/2,y0:s-o.h,y1:s},u=t.find(d=>c.x0<d.x1+6&&c.x1>d.x0-6&&c.y0<d.y1+6&&c.y1>d.y0-6);if(!u)break;s=u.y0-8}t.push({x0:o.x-o.w/2,x1:o.x+o.w/2,y0:s-o.h,y1:s});let a=o.y-s;o.el.style.transform=`translate(${Math.round(o.x)}px, ${Math.round(s)}px) translate(-50%, -100%)`,o.el.style.setProperty("--live-thread",`${Math.round(18+a)}px`)}}function of(r,e,t){let n=e.printer,i=(c,u)=>$(r,c,u),o=n.progress??0,s=c=>new Intl.DateTimeFormat(r?.language??navigator.language,{hour:"2-digit",minute:"2-digit"}).format(new Date(c)),a=n.remaining!==null?n.remaining>=60?`${Math.floor(n.remaining/60)} h ${Math.round(n.remaining%60)} min`:`${Math.round(n.remaining)} min`:null,l=[n.nozzle!==null?`${i("printer_nozzle")} ${Math.round(n.nozzle)}\xB0`:null,n.bed!==null?`${i("printer_bed")} ${Math.round(n.bed)}\xB0`:null].filter(Boolean).join(" \xB7 ");return p`<div class="live-card live-card-printer ${n.printing?"live-charging":""}" data-i=${t}>
|
||||
<div class="live-own">
|
||||
${n.picture?p`<img class="live-print-pic" src=${n.picture} alt="" />`:Tn(o/100,n.printing?"#38bdf8":"#8aa0c8")}
|
||||
${n.picture?p`<img class="live-print-pic" src=${n.picture} alt="" />`:Hn(o/100,n.printing?"#38bdf8":"#8aa0c8")}
|
||||
<div class="live-own-text"><b>${n.progress!==null?`${Math.round(o)} %`:"\u2013"}</b><span>${i(`printer_${n.printing?"printing":/finish|complete|fertig/.test(n.status)?"done":/pause/.test(n.status)?"paused":/error|fail/.test(n.status)?"error":"idle"}`)}</span></div>
|
||||
</div>
|
||||
<div class="live-rows">
|
||||
@@ -928,27 +928,27 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${l?p`<div class="live-status">🌡 ${l}</div>`:f}
|
||||
${n.filaments.length?p`<div class="live-filaments">${n.filaments.map(c=>p`<i style=${`background:${c}`}></i>`)}</div>`:f}
|
||||
</div>
|
||||
</div>`}function rf(r,e,t){let n=e.pump,i=a=>$(r,a),o=a=>a===null?"\u2013":`${W(r,a,1)}\xB0`,s={heating:"\u{1F525}",water:"\u{1F6BF}",cooling:"\u2744",defrost:"\u{1F9CA}",idle:"\u23F8"}[n.mode];return p`<div class="live-card live-card-heatpump ${n.mode==="idle"?"":"live-charging"}" data-i=${t}>
|
||||
</div>`}function sf(r,e,t){let n=e.pump,i=a=>$(r,a),o=a=>a===null?"\u2013":`${L(r,a,1)}\xB0`,s={heating:"\u{1F525}",water:"\u{1F6BF}",cooling:"\u2744",defrost:"\u{1F9CA}",idle:"\u23F8"}[n.mode];return p`<div class="live-card live-card-heatpump ${n.mode==="idle"?"":"live-charging"}" data-i=${t}>
|
||||
<div class="live-own">
|
||||
${Tn(Math.min(1,(n.cop??0)/6),(n.cop??0)>=3.5?"#4ade80":(n.cop??0)>=2.5?"#facc15":"#fb923c")}
|
||||
<div class="live-own-text"><b>${n.cop!==null?W(r,n.cop,1):s}</b><span>${n.cop!==null?"COP":""}</span></div>
|
||||
${Hn(Math.min(1,(n.cop??0)/6),(n.cop??0)>=3.5?"#4ade80":(n.cop??0)>=2.5?"#facc15":"#fb923c")}
|
||||
<div class="live-own-text"><b>${n.cop!==null?L(r,n.cop,1):s}</b><span>${n.cop!==null?"COP":""}</span></div>
|
||||
</div>
|
||||
<div class="live-rows">
|
||||
<div class="live-title">${e.name}</div>
|
||||
<div class="live-status">${s} ${i(`heatpump_${n.mode}`)}</div>
|
||||
${n.flow!==null||n.return!==null?p`<div class="live-row live-heat"><span>${i("heatpump_flow_return")}</span><b>${o(n.flow)} → ${o(n.return)}</b></div>`:f}
|
||||
${n.heat!==null?p`<div class="live-row live-heat"><span>${i("heatpump_heat")}</span><b>${Te(r,n.heat)}</b></div>`:f}
|
||||
${n.power!==null?p`<div class="live-row live-house"><span>${i("heatpump_power")}</span><b>${Te(r,n.power)}</b></div>`:f}
|
||||
${n.heat!==null?p`<div class="live-row live-heat"><span>${i("heatpump_heat")}</span><b>${He(r,n.heat)}</b></div>`:f}
|
||||
${n.power!==null?p`<div class="live-row live-house"><span>${i("heatpump_power")}</span><b>${He(r,n.power)}</b></div>`:f}
|
||||
${n.outside!==null?p`<div class="live-status">🌡 ${i("heatpump_outside")} ${o(n.outside)}</div>`:f}
|
||||
</div>
|
||||
</div>`}function of(r,e,t){let n=(o,s,a)=>o===null?"\u2013":`${W(r,o,s)} ${a}`,i=Object.values(e.sources??{}).some(o=>dn(r,o).length>0);return p`<div class="live-card live-card-roomclimate ${i?"live-climate-trends":""}" data-i=${t} data-room=${e.roomId} role="group" aria-label=${`${e.name||$(r,"room")} \xB7 ${$(r,"climate")}`}>
|
||||
${e.showTemperature?p`<div class="live-row live-climate-temperature"><span title=${$(r,"climate_temperature")} aria-label=${$(r,"climate_temperature")}>🌡</span><b>${n(e.temperature===null?null:r?ae(r,e.temperature):e.temperature,1,r?re(r):"\xB0C")}</b>${j(r,e.sources?.temperature??[],$(r,"climate_temperature"))}</div>`:f}
|
||||
${e.showHumidity?p`<div class="live-row live-climate-humidity"><span title=${$(r,"climate_humidity")} aria-label=${$(r,"climate_humidity")}>💧</span><b>${n(e.humidity,0,"%")}</b>${j(r,e.sources?.humidity??[],$(r,"climate_humidity"))}</div>`:f}
|
||||
${e.showCo2?p`<div class="live-row live-climate-co2"><span title=${$(r,"climate_co2")} aria-label=${$(r,"climate_co2")}>☁</span><b>${n(e.co2,0,"ppm")}</b>${j(r,e.sources?.co2??[],$(r,"climate_co2"))}</div>`:f}
|
||||
${e.showIlluminance?p`<div class="live-row live-climate-illuminance"><span title=${$(r,"climate_illuminance")} aria-label=${$(r,"climate_illuminance")}>☀</span><b>${n(e.illuminance,0,"lx")}</b>${j(r,e.sources?.illuminance??[],$(r,"climate_illuminance"))}</div>`:f}
|
||||
</div>`}function eu(r,e,t,n,i=!1){return e.length?p`<div class="live-cards">
|
||||
${e.map((o,s)=>o.kind==="roomclimate"?of(r,o,s):i?f:o.kind==="house"?Jp(r,o,s,n):o.kind==="car"?ef(r,o,s,t):o.kind==="printer"?nf(r,o,s):o.kind==="heatpump"?rf(r,o,s):tf(r,o,s,t))}
|
||||
</div>`:f}var tu=X`
|
||||
</div>`}function af(r,e,t){let n=(o,s,a)=>o===null?"\u2013":`${L(r,o,s)} ${a}`,i=Object.values(e.sources??{}).some(o=>pn(r,o).length>0);return p`<div class="live-card live-card-roomclimate ${i?"live-climate-trends":""}" data-i=${t} data-room=${e.roomId} role="group" aria-label=${`${e.name||$(r,"room")} \xB7 ${$(r,"climate")}`}>
|
||||
${e.showTemperature?p`<div class="live-row live-climate-temperature"><span title=${$(r,"climate_temperature")} aria-label=${$(r,"climate_temperature")}>🌡</span><b>${n(e.temperature===null?null:r?ae(r,e.temperature):e.temperature,1,r?re(r):"\xB0C")}</b>${U(r,e.sources?.temperature??[],$(r,"climate_temperature"))}</div>`:f}
|
||||
${e.showHumidity?p`<div class="live-row live-climate-humidity"><span title=${$(r,"climate_humidity")} aria-label=${$(r,"climate_humidity")}>💧</span><b>${n(e.humidity,0,"%")}</b>${U(r,e.sources?.humidity??[],$(r,"climate_humidity"))}</div>`:f}
|
||||
${e.showCo2?p`<div class="live-row live-climate-co2"><span title=${$(r,"climate_co2")} aria-label=${$(r,"climate_co2")}>☁</span><b>${n(e.co2,0,"ppm")}</b>${U(r,e.sources?.co2??[],$(r,"climate_co2"))}</div>`:f}
|
||||
${e.showIlluminance?p`<div class="live-row live-climate-illuminance"><span title=${$(r,"climate_illuminance")} aria-label=${$(r,"climate_illuminance")}>☀</span><b>${n(e.illuminance,0,"lx")}</b>${U(r,e.sources?.illuminance??[],$(r,"climate_illuminance"))}</div>`:f}
|
||||
</div>`}function nu(r,e,t,n,i=!1){return e.length?p`<div class="live-cards">
|
||||
${e.map((o,s)=>o.kind==="roomclimate"?af(r,o,s):i?f:o.kind==="house"?Xp(r,o,s,n):o.kind==="car"?nf(r,o,s,t):o.kind==="printer"?of(r,o,s):o.kind==="heatpump"?sf(r,o,s):rf(r,o,s,t))}
|
||||
</div>`:f}var ru=Y`
|
||||
.live-cards {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
@@ -1285,7 +1285,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
`;function Ur(r){return r.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var Do=r=>r.points.length>=3;function nu(r,e,t){return r.rooms.filter(Do).find(n=>I([e,t],n.points))}function sf(r,e,t,n){let i=[];for(let a of e.rooms.filter(Do)){let[l,c]=Ae(a.points);i.push({kind:"room",name:a.name,where:n?e.name:"",floorId:e.id,roomId:a.id,entity:null,icon:null,x:l,z:c,y:0})}let o=new Set,s=(a,l,c,u)=>{if(o.has(a)||!(a in r.states))return;o.add(a);let d=nu(e,l,c),m=[d?.name,n?e.name:void 0].filter(h=>!!h).join(" \xB7 ");i.push({kind:"device",name:L(r,a),where:m,floorId:e.id,roomId:d?.id??null,entity:a,icon:H(a),x:l,z:c,y:u})};for(let a of e.placements){let l=a.y??Et(H(a.entity_id)??"sensor",ve(e,a.x,a.z),a.mount);s(a.entity_id,a.x,a.z,l)}for(let a of e.furniture){let l=t.get(a.id),c=l?.entity??l?.power;if(!c)continue;let u=ve(e,a.x,a.z)-.3;s(c,a.x,a.z,Math.min(u,Math.max(.5,a.h)))}for(let a of e.notes??[]){if(!a.text)continue;let l=nu(e,a.x,a.z),c=[l?.name,n?e.name:void 0].filter(u=>!!u).join(" \xB7 ");i.push({kind:"note",name:`\u270E ${a.text.length>60?`${a.text.slice(0,59)}\u2026`:a.text}`,where:c,floorId:e.id,roomId:l?.id??null,entity:null,icon:null,x:a.x,z:a.z,y:1.3})}return i}function ru(r,e){let t=ht(r,e.floors),n=e.floors.length>1,i=e.floors.flatMap(o=>sf(r,o,t,n));for(let o of e.settings.circuits??[]){let s=e.floors.flatMap(d=>d.rooms.filter(m=>o.rooms.includes(m.id)&&Do(m)).map(m=>({f:d,r:m})));if(!s.length)continue;let[{f:a,r:l}]=s,[c,u]=Ae(l.points);i.push({kind:"circuit",name:`\u{1F50C} ${o.name}`,where:s.map(d=>d.r.name).join(", "),floorId:a.id,roomId:l.id,entity:null,icon:null,x:c,z:u,y:0})}return i}function af(r,e){return(Ur(r.name).startsWith(e)?0:2)+(r.kind==="room"?0:1)}function iu(r,e,t=8){let n=Ur(e).split(/\s+/).filter(Boolean);if(n.length===0)return[];let i=Ur(e.trim());return r.filter(o=>{let s=Ur([o.name,o.where,o.entity].filter(Boolean).join(" "));return n.every(a=>s.includes(a))}).map(o=>({item:o,cost:af(o,i)})).sort((o,s)=>o.cost-s.cost||o.item.name.localeCompare(s.item.name)).slice(0,t).map(o=>o.item)}var lf=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[190,90,255],[255,95,210],[255,70,70],[120,255,150]],cf=[2200,2700,3200,4e3,5e3,6500],uf=["hs","rgb","rgbw","rgbww","xy"],df=4,ou=16,su=32,hf=128;function Ho(r){let e=r.attributes.supported_color_modes??[],t=e.some(n=>uf.includes(n));return{dim:e.some(n=>n!=="onoff"),color:t,temp:e.includes("color_temp")}}function Po(r){return((r.attributes.supported_features??0)&df)!==0&&typeof r.attributes.current_position=="number"}var Fo=class extends ee{static properties={hass:{attribute:!1},entity:{attribute:!1},car:{attribute:!1},presets:{attribute:!1},confirmSwitch:{type:Boolean},myPosition:{attribute:!1},tiltEntity:{attribute:!1},low:{type:Boolean,reflect:!0}};t(e,t){return $(this.hass,e,t)}ask(){return!this.confirmSwitch||confirm(this.t("confirm_switch",{name:L(this.hass,this.entity)}))}call(e,t,n={}){this.hass.callService(e,t,{entity_id:this.entity,...n})}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}details(){ye(this,this.entity),this.close()}ring(e){let t=e.length;return e.map((n,i)=>{let o=i/t*Math.PI*2-Math.PI/2;return p`<div class="qm-at" style="left:${50+Math.cos(o)*39}%;top:${50+Math.sin(o)*39}%">${n}</div>`})}renderLight(e){let t=Ho(e),n=e.state==="on",i=n&&typeof e.attributes.brightness=="number"?Math.round(e.attributes.brightness/2.55):n?100:0,o=t.color?lf.map(s=>p`<button class="qm-swatch" style="background:rgb(${s.join(",")})" aria-label=${`RGB ${s.join(", ")}`} @click=${()=>this.call("light","turn_on",{rgb_color:s})}></button>`):t.temp?cf.map(s=>p`<button class="qm-swatch" style="background:${mf(s)}" aria-label=${`${s} K`} @click=${()=>this.call("light","turn_on",{color_temp_kelvin:s})}></button>`):[];return p`<div class="qm-ring ${o.length?"":"qm-ring-small"}">
|
||||
`;function qr(r){return r.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var Ho=r=>r.points.length>=3;function iu(r,e,t){return r.rooms.filter(Ho).find(n=>I([e,t],n.points))}function lf(r,e,t,n){let i=[];for(let a of e.rooms.filter(Ho)){let[l,c]=Ae(a.points);i.push({kind:"room",name:a.name,where:n?e.name:"",floorId:e.id,roomId:a.id,entity:null,icon:null,x:l,z:c,y:0})}let o=new Set,s=(a,l,c,u)=>{if(o.has(a)||!(a in r.states))return;o.add(a);let d=iu(e,l,c),m=[d?.name,n?e.name:void 0].filter(h=>!!h).join(" \xB7 ");i.push({kind:"device",name:O(r,a),where:m,floorId:e.id,roomId:d?.id??null,entity:a,icon:H(a),x:l,z:c,y:u})};for(let a of e.placements){let l=a.y??Dt(H(a.entity_id)??"sensor",ve(e,a.x,a.z),a.mount);s(a.entity_id,a.x,a.z,l)}for(let a of e.furniture){let l=t.get(a.id),c=l?.entity??l?.power;if(!c)continue;let u=ve(e,a.x,a.z)-.3;s(c,a.x,a.z,Math.min(u,Math.max(.5,a.h)))}for(let a of e.notes??[]){if(!a.text)continue;let l=iu(e,a.x,a.z),c=[l?.name,n?e.name:void 0].filter(u=>!!u).join(" \xB7 ");i.push({kind:"note",name:`\u270E ${a.text.length>60?`${a.text.slice(0,59)}\u2026`:a.text}`,where:c,floorId:e.id,roomId:l?.id??null,entity:null,icon:null,x:a.x,z:a.z,y:1.3})}return i}function ou(r,e){let t=gt(r,e.floors),n=e.floors.length>1,i=e.floors.flatMap(o=>lf(r,o,t,n));for(let o of e.settings.circuits??[]){let s=e.floors.flatMap(d=>d.rooms.filter(m=>o.rooms.includes(m.id)&&Ho(m)).map(m=>({f:d,r:m})));if(!s.length)continue;let[{f:a,r:l}]=s,[c,u]=Ae(l.points);i.push({kind:"circuit",name:`\u{1F50C} ${o.name}`,where:s.map(d=>d.r.name).join(", "),floorId:a.id,roomId:l.id,entity:null,icon:null,x:c,z:u,y:0})}return i}function cf(r,e){return(qr(r.name).startsWith(e)?0:2)+(r.kind==="room"?0:1)}function su(r,e,t=8){let n=qr(e).split(/\s+/).filter(Boolean);if(n.length===0)return[];let i=qr(e.trim());return r.filter(o=>{let s=qr([o.name,o.where,o.entity].filter(Boolean).join(" "));return n.every(a=>s.includes(a))}).map(o=>({item:o,cost:cf(o,i)})).sort((o,s)=>o.cost-s.cost||o.item.name.localeCompare(s.item.name)).slice(0,t).map(o=>o.item)}var uf=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[190,90,255],[255,95,210],[255,70,70],[120,255,150]],df=[2200,2700,3200,4e3,5e3,6500],hf=["hs","rgb","rgbw","rgbww","xy"],mf=4,au=16,lu=32,pf=128;function Io(r){let e=r.attributes.supported_color_modes??[],t=e.some(n=>hf.includes(n));return{dim:e.some(n=>n!=="onoff"),color:t,temp:e.includes("color_temp")}}function No(r){return((r.attributes.supported_features??0)&mf)!==0&&typeof r.attributes.current_position=="number"}var Po=class extends Q{static properties={hass:{attribute:!1},entity:{attribute:!1},car:{attribute:!1},presets:{attribute:!1},confirmSwitch:{type:Boolean},myPosition:{attribute:!1},tiltEntity:{attribute:!1},low:{type:Boolean,reflect:!0}};t(e,t){return $(this.hass,e,t)}ask(){return!this.confirmSwitch||confirm(this.t("confirm_switch",{name:O(this.hass,this.entity)}))}call(e,t,n={}){this.hass.callService(e,t,{entity_id:this.entity,...n})}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}details(){ye(this,this.entity),this.close()}ring(e){let t=e.length;return e.map((n,i)=>{let o=i/t*Math.PI*2-Math.PI/2;return p`<div class="qm-at" style="left:${50+Math.cos(o)*39}%;top:${50+Math.sin(o)*39}%">${n}</div>`})}renderLight(e){let t=Io(e),n=e.state==="on",i=n&&typeof e.attributes.brightness=="number"?Math.round(e.attributes.brightness/2.55):n?100:0,o=t.color?uf.map(s=>p`<button class="qm-swatch" style="background:rgb(${s.join(",")})" aria-label=${`RGB ${s.join(", ")}`} @click=${()=>this.call("light","turn_on",{rgb_color:s})}></button>`):t.temp?df.map(s=>p`<button class="qm-swatch" style="background:${ff(s)}" aria-label=${`${s} K`} @click=${()=>this.call("light","turn_on",{color_temp_kelvin:s})}></button>`):[];return p`<div class="qm-ring ${o.length?"":"qm-ring-small"}">
|
||||
${this.ring(o)}
|
||||
<button class="qm-power ${n?"qm-on":""}" aria-pressed=${n} @click=${()=>this.ask()&&this.call("light","toggle")}>
|
||||
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M12 3v8M6.3 6.8a8 8 0 1 0 11.4 0" /></svg>
|
||||
@@ -1300,7 +1300,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.value=${String(Math.max(1,i))}
|
||||
aria-label=${this.t("brightness")}
|
||||
@change=${s=>this.call("light","turn_on",{brightness_pct:Number(s.target.value)})}
|
||||
/>`:f}`}renderCover(e){e=pr(this.hass,e,this.tiltEntity);let t=typeof e.attributes.current_position=="number"?e.attributes.current_position:null,n=e.state==="opening"||e.state==="closing",i=Po(e),o=(u,d,m,h=!1)=>p`<button class="qm-swatch qm-slot ${h?"qm-slot-on":""}" aria-label=${d} @click=${m}>${u}</button>`,s=u=>t!==null&&Math.abs(t-u)<3,a=[o("\u25B2",this.t("cover_open"),()=>this.ask()&&this.call("cover","open_cover"),s(100)),...i?[75,50].map(u=>o(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],o("\u25BC",this.t("cover_close"),()=>this.ask()&&this.call("cover","close_cover"),s(0)),...i?[25].map(u=>o(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],...Number(e.attributes.supported_features??0)&8?[o("\u25A0",this.t("cover_stop"),()=>this.call("cover","stop_cover"),n)]:[],...this.myPosition!=null&&(i||Number(e.attributes.supported_features??0)&8)?[o("My",this.t("cover_my_go",{p:this.myPosition}),()=>this.ask()&&(i?this.call("cover","set_cover_position",{position:this.myPosition}):this.call("cover","stop_cover")),s(this.myPosition))]:[]],l=t===null?e.state==="closed"?100:0:100-t,c=t!==null||n||e.state==="open"||e.state==="closed";return p`<div class="qm-ring">
|
||||
/>`:f}`}renderCover(e){e=_r(this.hass,e,this.tiltEntity);let t=typeof e.attributes.current_position=="number"?e.attributes.current_position:null,n=e.state==="opening"||e.state==="closing",i=No(e),o=(u,d,m,h=!1)=>p`<button class="qm-swatch qm-slot ${h?"qm-slot-on":""}" aria-label=${d} @click=${m}>${u}</button>`,s=u=>t!==null&&Math.abs(t-u)<3,a=[o("\u25B2",this.t("cover_open"),()=>this.ask()&&this.call("cover","open_cover"),s(100)),...i?[75,50].map(u=>o(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],o("\u25BC",this.t("cover_close"),()=>this.ask()&&this.call("cover","close_cover"),s(0)),...i?[25].map(u=>o(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],...Number(e.attributes.supported_features??0)&8?[o("\u25A0",this.t("cover_stop"),()=>this.call("cover","stop_cover"),n)]:[],...this.myPosition!=null&&(i||Number(e.attributes.supported_features??0)&8)?[o("My",this.t("cover_my_go",{p:this.myPosition}),()=>this.ask()&&(i?this.call("cover","set_cover_position",{position:this.myPosition}):this.call("cover","stop_cover")),s(this.myPosition))]:[]],l=t===null?e.state==="closed"?100:0:100-t,c=t!==null||n||e.state==="open"||e.state==="closed";return p`<div class="qm-ring">
|
||||
${this.ring(a)}
|
||||
<button
|
||||
class="qm-power qm-blind ${c&&l<100?"qm-on":""}"
|
||||
@@ -1322,7 +1322,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
aria-label=${this.t("position")}
|
||||
@change=${u=>this.call("cover","set_cover_position",{position:Number(u.target.value)})}
|
||||
/>`:f}
|
||||
${this.renderTilt(e)}`}renderTilt(e){let t=(e.attributes.supported_features??0)|0,n=typeof e.attributes.current_tilt_position=="number"?e.attributes.current_tilt_position:null;return t&hf&&n!==null?p`<label class="qm-tilt"
|
||||
${this.renderTilt(e)}`}renderTilt(e){let t=(e.attributes.supported_features??0)|0,n=typeof e.attributes.current_tilt_position=="number"?e.attributes.current_tilt_position:null;return t&pf&&n!==null?p`<label class="qm-tilt"
|
||||
><span>${this.t("cover_tilt")} · ${Math.round(n)} %</span>
|
||||
<input
|
||||
class="qm-slider"
|
||||
@@ -1332,9 +1332,9 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.value=${String(n)}
|
||||
aria-label=${this.t("cover_tilt")}
|
||||
@change=${i=>this.call("cover","set_cover_tilt_position",{entity_id:e.attributes.nf_cover_control?this.entity:this.tiltEntity||this.entity,tilt_position:Number(i.target.value)})}
|
||||
/></label>`:t&(ou|su)?p`<div class="qm-tilt-buttons">
|
||||
${t&ou?p`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","open_cover_tilt")}>${this.t("cover_tilt_open")}</button>`:f}
|
||||
${t&su?p`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","close_cover_tilt")}>${this.t("cover_tilt_close")}</button>`:f}
|
||||
/></label>`:t&(au|lu)?p`<div class="qm-tilt-buttons">
|
||||
${t&au?p`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","open_cover_tilt")}>${this.t("cover_tilt_open")}</button>`:f}
|
||||
${t&lu?p`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","close_cover_tilt")}>${this.t("cover_tilt_close")}</button>`:f}
|
||||
</div>`:f}renderToggle(e){let t=e.state==="on"||e.state==="unlocked"||e.state==="playing",n=e.entity_id.split(".")[0];return p`<div class="qm-ring qm-ring-small">
|
||||
<button
|
||||
class="qm-power ${t?"qm-on":""}"
|
||||
@@ -1356,11 +1356,11 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${s.length?p`<div class="qm-play-head">${this.t("media_sources")}</div>
|
||||
<div class="qm-play">${s.map(d=>p`<button class="qm-chip ${i.source===d?"qm-chip-on":""}" @click=${()=>this.call("media_player","select_source",{source:d})}>${d}</button>`)}</div>`:f}
|
||||
${this.presets?.length?p`<div class="qm-play-head">${this.t("presets")}</div>
|
||||
<div class="qm-play">${this.presets.map(d=>p`<button class="qm-chip" @click=${()=>this.call("media_player","play_media",{media_content_type:d.type,media_content_id:d.content})}>${d.label}</button>`)}</div>`:f}`}render(){let e=this.hass?.states[this.entity];if(!e)return f;let t=H(this.entity),n=N(e)&&!on(e)?p`<p class="qm-note">${oe(this.hass,e)}</p>`:t==="light"?this.renderLight(e):t==="cover"?this.renderCover(e):t==="media"?this.renderMedia(e):this.renderToggle(e);return p`<div class="qm" role="dialog" aria-label=${L(this.hass,this.entity)}>
|
||||
<div class="qm-title">${L(this.hass,this.entity)}</div>
|
||||
<div class="qm-play">${this.presets.map(d=>p`<button class="qm-chip" @click=${()=>this.call("media_player","play_media",{media_content_type:d.type,media_content_id:d.content})}>${d.label}</button>`)}</div>`:f}`}render(){let e=this.hass?.states[this.entity];if(!e)return f;let t=H(this.entity),n=N(e)&&!ln(e)?p`<p class="qm-note">${oe(this.hass,e)}</p>`:t==="light"?this.renderLight(e):t==="cover"?this.renderCover(e):t==="media"?this.renderMedia(e):this.renderToggle(e);return p`<div class="qm" role="dialog" aria-label=${O(this.hass,this.entity)}>
|
||||
<div class="qm-title">${O(this.hass,this.entity)}</div>
|
||||
${n}
|
||||
<button class="qm-details" @click=${()=>this.details()}>${this.t("details")} …</button>
|
||||
</div>`}static styles=[ge,X`
|
||||
</div>`}static styles=[ge,Y`
|
||||
.qm-play-head {
|
||||
margin: 10px 0 4px;
|
||||
font-size: 11px;
|
||||
@@ -1603,9 +1603,43 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.qm-note {
|
||||
color: var(--nf-muted);
|
||||
}
|
||||
`]};function mf(r){let e=Math.min(1,Math.max(0,(r-2200)/4300)),t=(n,i)=>Math.round(n+(i-n)*e);return`rgb(${t(255,200)},${t(170,225)},${t(80,255)})`}customElements.get("nf-quick-menu")||customElements.define("nf-quick-menu",Fo);var pf=new URL(import.meta.url),ff=new URL("./nextfloor-3d.js?v=74227cd20cc3",pf).href,au;function lu(){return au??=import(ff),au}function cu(r){if(!r||r.state!=="on")return 0;let e=typeof r.attributes.percentage=="number"?r.attributes.percentage:60;return e<=0?0:.2+.6*Math.min(100,e)/100}var uu="weather.nextfloor_symcon",hu={condition:"Wetterzustand",temperature:"Au\xDFentemperatur",humidity:"Au\xDFenluftfeuchte",pressure:"Luftdruck",wind_speed:"Windgeschwindigkeit",wind_gust_speed:"Windb\xF6en",wind_bearing:"Windrichtung",cloud_coverage:"Bew\xF6lkung",precipitation:"Niederschlagsrate",precipitation_total:"Niederschlagsmenge",illuminance:"Au\xDFenhelligkeit",uv_index:"UV-Index",visibility:"Sichtweite",snow:"Schnee",fog:"Nebel",lightning:"Gewitter"},du=new WeakMap;function gf(r){let e=r.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").trim();return["sunny","clear-night","partlycloudy","cloudy","fog","rainy","pouring","lightning-rainy","lightning","hail","snowy","snowy-rainy","windy","windy-variant"].includes(e)?e:/kein regen|trocken|wolkenlos|klar|sonnig/.test(e)?"sunny":/gewitter|blitz/.test(e)?"lightning-rainy":/schneeregen/.test(e)?"snowy-rainy":/schnee/.test(e)?"snowy":/hagel/.test(e)?"hail":/starkregen/.test(e)?"pouring":/regen|niesel/.test(e)?"rainy":/nebel/.test(e)?"fog":/teil.*wolk|heiter|leicht.*wolk/.test(e)?"partlycloudy":/wolk|bedeckt/.test(e)?"cloudy":/wind|sturm/.test(e)?"windy":null}function jr(r,e){if(!G(r))return r;let t=e.weather_variables??{};if(!e.rain_sensor&&!Object.values(t).some(h=>h&&h!=="none"))return r;let n=du.get(r)??new WeakMap;du.set(r,n);let i=n.get(e);if(i)return i;let o={friendly_name:"Wetter",nf_symcon_weather:!0},s=h=>t[h]&&t[h]!=="none"?r.states[t[h]]:void 0;for(let h of["temperature","humidity","pressure","cloud_coverage","precipitation","precipitation_total","illuminance","uv_index","visibility"]){let g=s(h),_=Ne(g);_!==null&&(o[h]=h==="cloud_coverage"&&g?.attributes.symcon_max===1?_*100:_),g?.attributes.unit_of_measurement&&(o[`${h}_unit`]=g.attributes.unit_of_measurement)}for(let h of["wind_speed","wind_gust_speed"]){let g=s(h),_=Ne(g);_!==null&&(o[h]=Cr(_,g?.attributes.unit_of_measurement))}o.wind_speed_unit="km/h";let a=Je(s("wind_bearing"));a!==null&&(o.wind_bearing=a);let l=gf(Qe(s("condition"))),c=e.rain_sensor?r.states[e.rain_sensor]:void 0,u=se(c);u!==null&&e.rain_sensor_inverted&&(u=!u),u===null&&typeof o.precipitation=="number"&&(u=o.precipitation>0),se(s("lightning"))?l=u?"lightning-rainy":"lightning":se(s("snow"))?l=u?"snowy-rainy":"snowy":se(s("fog"))?l="fog":u===!0?l=Number(o.precipitation??0)>=8?"pouring":"rainy":u===!1&&l&&/rain|pouring/.test(l)&&(l=null),!l&&typeof o.cloud_coverage=="number"&&(l=o.cloud_coverage>70?"cloudy":o.cloud_coverage>20?"partlycloudy":"sunny"),!l&&u===!1&&(l="sunny");let d={entity_id:uu,state:l??"unknown",attributes:o},m={...r,states:{...r.states,[uu]:d}};return n.set(e,m),m}var _f=new Set(["on","home","open","true","active","playing","heat","heating"]);function qr(r,e){let t=e.show_when;if(!t?.entity||!r)return!0;let n=r.states[t.entity];if(!n||N(n))return!0;let i=String(n.state).toLowerCase(),o=(t.state??"").split(",").map(a=>a.trim().toLowerCase()).filter(Boolean),s=o.length?o.includes(i):_f.has(i)||Number.isFinite(Number(i))&&Number(i)>0;return t.invert?!s:s}function Io(r,e){let t=[];for(let n of e.floors)for(let i of n.furniture)qr(r,i)||t.push(i.id);return t.sort()}function mu(r,e){if(!e.length)return r;let t=new Set(e);return{...r,floors:r.floors.map(n=>n.furniture.some(i=>t.has(i.id))?{...n,furniture:n.furniture.filter(i=>!t.has(i.id))}:n)}}var pu="image:";function No(r,e,t){let n=(e??"").trim();if(!n)return null;if(n.startsWith(pu))return t(n.slice(pu.length));if(/^(https?:\/\/|\/)/.test(n))return n;if(/^[a-z_]+\.[a-z0-9_]+$/.test(n)){let i=r?.states[n]?.attributes.entity_picture;return typeof i=="string"&&i?i:null}return null}var Dn=r=>Number(r);function Hn(r){if(Array.isArray(r)){let[o,s]=[Dn(r[0]),Dn(r[1])];return Number.isFinite(o)&&Number.isFinite(s)?[o,s]:null}if(!r||typeof r!="object")return null;let{x:e,y:t}=r,[n,i]=[Dn(e),Dn(t)];return Number.isFinite(n)&&Number.isFinite(i)?[n,i]:null}function fu(r){return r?Hn(r.charger)??Hn(r.charger_position):null}function gu(r){for(let[e,t]of Object.entries(r.states))if(e.startsWith("camera.")&&(Hn(t.attributes?.vacuum_position)??fu(t.attributes)))return e;return null}var bf=r=>Array.isArray(r)?typeof r[0]=="number":!!r&&typeof r=="object",Fn=(r,e)=>e?[r[0],-r[1]]:r;function vf(r){if(!r)return null;let e=r.mirror===!0,[t,n]=Fn(r.ga,e),[i,o]=Fn(r.gb,e),[s,a]=r.a,[l,c]=r.b,[u,d]=[i-t,o-n],[m,h]=[l-s,c-a],g=Math.hypot(u,d),_=Math.hypot(m,h);if(!(g>1e-6)||!(_>1e-6))return null;let b=_/g,v=Math.atan2(h,m)-Math.atan2(d,u),[S,k]=[Math.cos(
Line truncated
|
||||
`]};function ff(r){let e=Math.min(1,Math.max(0,(r-2200)/4300)),t=(n,i)=>Math.round(n+(i-n)*e);return`rgb(${t(255,200)},${t(170,225)},${t(80,255)})`}customElements.get("nf-quick-menu")||customElements.define("nf-quick-menu",Po);var gf=new URL(import.meta.url),_f=new URL("./nextfloor-3d.js?v=74227cd20cc3",gf).href,cu;function uu(){return cu??=import(_f),cu}function du(r){if(!r||r.state!=="on")return 0;let e=typeof r.attributes.percentage=="number"?r.attributes.percentage:60;return e<=0?0:.2+.6*Math.min(100,e)/100}var hu="weather.nextfloor_symcon",pu={condition:"Wetterzustand",temperature:"Au\xDFentemperatur",humidity:"Au\xDFenluftfeuchte",pressure:"Luftdruck",wind_speed:"Windgeschwindigkeit",wind_gust_speed:"Windb\xF6en",wind_bearing:"Windrichtung",cloud_coverage:"Bew\xF6lkung",precipitation:"Niederschlagsrate",precipitation_total:"Niederschlagsmenge",illuminance:"Au\xDFenhelligkeit",uv_index:"UV-Index",visibility:"Sichtweite",snow:"Schnee",fog:"Nebel",lightning:"Gewitter"},mu=new WeakMap;function bf(r){let e=r.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").trim();return["sunny","clear-night","partlycloudy","cloudy","fog","rainy","pouring","lightning-rainy","lightning","hail","snowy","snowy-rainy","windy","windy-variant"].includes(e)?e:/kein regen|trocken|wolkenlos|klar|sonnig/.test(e)?"sunny":/gewitter|blitz/.test(e)?"lightning-rainy":/schneeregen/.test(e)?"snowy-rainy":/schnee/.test(e)?"snowy":/hagel/.test(e)?"hail":/starkregen/.test(e)?"pouring":/regen|niesel/.test(e)?"rainy":/nebel/.test(e)?"fog":/teil.*wolk|heiter|leicht.*wolk/.test(e)?"partlycloudy":/wolk|bedeckt/.test(e)?"cloudy":/wind|sturm/.test(e)?"windy":null}function Zr(r,e){if(!K(r))return r;let t=e.weather_variables??{};if(!e.rain_sensor&&!Object.values(t).some(h=>h&&h!=="none"))return r;let n=mu.get(r)??new WeakMap;mu.set(r,n);let i=n.get(e);if(i)return i;let o={friendly_name:"Wetter",nf_symcon_weather:!0},s=h=>t[h]&&t[h]!=="none"?r.states[t[h]]:void 0;for(let h of["temperature","humidity","pressure","cloud_coverage","precipitation","precipitation_total","illuminance","uv_index","visibility"]){let g=s(h),_=Oe(g);_!==null&&(o[h]=h==="cloud_coverage"&&g?.attributes.symcon_max===1?_*100:_),g?.attributes.unit_of_measurement&&(o[`${h}_unit`]=g.attributes.unit_of_measurement)}for(let h of["wind_speed","wind_gust_speed"]){let g=s(h),_=Oe(g);_!==null&&(o[h]=Or(_,g?.attributes.unit_of_measurement))}o.wind_speed_unit="km/h";let a=tt(s("wind_bearing"));a!==null&&(o.wind_bearing=a);let l=bf(nt(s("condition"))),c=e.rain_sensor?r.states[e.rain_sensor]:void 0,u=se(c);u!==null&&e.rain_sensor_inverted&&(u=!u),u===null&&typeof o.precipitation=="number"&&(u=o.precipitation>0),se(s("lightning"))?l=u?"lightning-rainy":"lightning":se(s("snow"))?l=u?"snowy-rainy":"snowy":se(s("fog"))?l="fog":u===!0?l=Number(o.precipitation??0)>=8?"pouring":"rainy":u===!1&&l&&/rain|pouring/.test(l)&&(l=null),!l&&typeof o.cloud_coverage=="number"&&(l=o.cloud_coverage>70?"cloudy":o.cloud_coverage>20?"partlycloudy":"sunny"),!l&&u===!1&&(l="sunny");let d={entity_id:hu,state:l??"unknown",attributes:o},m={...r,states:{...r.states,[hu]:d}};return n.set(e,m),m}var Co=class extends Q{static properties={hass:{attribute:!1},floors:{attribute:!1},floorId:{attribute:!1},inline:{type:Boolean,reflect:!0},compact:{type:Boolean},folded:{state:!0}};constructor(){super(),this.floors=[],this.floorId=null,this.inline=!1,this.compact=!1,this.folded=null}value(e){return e?p`<span class="value" title=${`${Nt(e)}${e.manual?" \xB7 eigener Stockwerksz\xE4hler":""}`}><b>${De(this.hass,e)}</b>${e.period!=="total"?p`<small>${{day:"heute",month:"Monat",year:"Jahr"}[e.period]}</small>`:f}${U(this.hass,e.sources,`${ze[e.kind]} \xB7 ${Nt(e)}`)}</span>`:f}open(e,t){this.dispatchEvent(new CustomEvent("utility-open",{detail:{floorId:t?this.floorId:e,roomId:t?e:null},bubbles:!0,composed:!0}))}render(){if(!this.hass)return f;let e=this.floors.flatMap(s=>s.rooms),t=this.floors.find(s=>s.id===this.floorId);if(this.inline){let s=t?Te(this.hass,t,e):ol(this.hass,this.floors);return p`${Je.map(a=>{let l=s.filter(c=>c.kind===a);return l.length?p`<div class="meter" aria-label=${`${t?.name||"Gesamtgeb\xE4ude"} \xB7 ${ze[a]}`}><span class="medium" title=${t?.name||"Gesamtgeb\xE4ude"}>${fn[a]} ${ze[a]}</span><div class="values">${l.map(c=>this.value(c))}</div></div>`:f})}`}let i=(t?t.rooms.map(s=>({id:s.id,name:s.name,readings:rt(this.hass,s,e)})):[...this.floors].sort((s,a)=>a.elevation-s.elevation).map(s=>({id:s.id,name:s.name,readings:Te(this.hass,s,e)}))).filter(s=>s.readings.length);if(!i.length)return f;let o=this.folded??this.compact;return p`<section class="panel" aria-label=${t?"Bereichsz\xE4hler":"Stockwerksz\xE4hler"}>
|
||||
<button class="heading" aria-expanded=${!o} @click=${()=>{this.folded=!o}}><span>${t?"Bereiche":"Stockwerke"}<small>${t?.name||"Gesamtgeb\xE4ude"}</small></span><span aria-hidden="true">${o?"+":"\u2212"}</span></button>
|
||||
${o?f:p`<div class="entries"><div class="columns"><span></span><span title="Leistung bzw. Durchfluss">Leistung</span><span>Energie / Verbrauch</span></div>
|
||||
${i.map(s=>p`<section class="entry"><button class="entry-name" title=${s.name} @click=${()=>this.open(s.id,!!t)}>${s.name}</button>
|
||||
${Je.map(a=>{let l=s.readings.filter(u=>u.kind===a&&u.metric==="power"),c=s.readings.filter(u=>u.kind===a&&u.metric==="energy");return Array.from({length:Math.max(l.length,c.length)},(u,d)=>p`<div class="row"><span class="kind" title=${ze[a]}>${d?"":`${fn[a]} ${ze[a]}`}</span>${l[d]?this.value(l[d]):p`<span></span>`}${c[d]?this.value(c[d]):p`<span></span>`}</div>`)})}
|
||||
</section>`)}
|
||||
</div>`}
|
||||
</section>`}static styles=Y`
|
||||
:host { display:flex; width:100%; min-height:0; max-height:100%; color:var(--nf-text); font:12px/1.4 system-ui,sans-serif; pointer-events:auto; }
|
||||
:host([inline]) { display:flex; flex-wrap:wrap; align-items:stretch; gap:6px; width:auto; max-width:100%; }
|
||||
.meter { padding:5px 9px; border-radius:10px; background:var(--nf-chrome); border-left:2px solid var(--nf-line); backdrop-filter:blur(6px); }
|
||||
.medium { font-size:11px; color:var(--nf-muted); }
|
||||
.medium small { font-size:10px; }
|
||||
.values { display:flex; flex-wrap:wrap; gap:3px 10px; }
|
||||
.value { display:inline-flex; align-items:center; justify-content:flex-end; gap:3px; min-width:0; white-space:nowrap; font-variant-numeric:tabular-nums; }
|
||||
.value b { font-size:12px; font-weight:600; }
|
||||
.value small { color:var(--nf-muted); font-size:9px; }
|
||||
nf-trend-button { margin-left:0; }
|
||||
.panel { display:flex; flex-direction:column; box-sizing:border-box; width:100%; max-height:100%; border:1px solid var(--nf-line); border-radius:12px; background:var(--nf-chrome); backdrop-filter:blur(8px); overflow:hidden; }
|
||||
button { color:inherit; font:inherit; border:0; background:none; cursor:pointer; text-align:left; }
|
||||
button:focus-visible { outline:2px solid var(--nf-accent); outline-offset:-2px; }
|
||||
.heading { display:flex; flex-shrink:0; align-items:center; justify-content:space-between; gap:12px; width:100%; padding:8px 10px; font-weight:600; }
|
||||
.heading small { display:block; color:var(--nf-muted); font-size:10px; font-weight:normal; }
|
||||
.entries { min-height:0; max-height:min(50vh,480px); overflow:auto; padding:0 10px 8px; }
|
||||
.columns,.row { display:grid; grid-template-columns:54px minmax(0,1fr) minmax(0,1.2fr); align-items:center; gap:5px; }
|
||||
.columns { color:var(--nf-muted); font-size:9px; text-align:right; margin-bottom:2px; }
|
||||
.entry { border-top:1px solid var(--nf-line); padding:6px 0; }
|
||||
.entry:last-child { padding-bottom:0; }
|
||||
.entry-name { display:block; width:100%; padding:0 0 3px; font-size:11px; font-weight:600; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
|
||||
.entry-name:hover { color:var(--nf-accent); }
|
||||
.row { min-height:20px; }
|
||||
.kind { color:var(--nf-muted); font-size:10px; white-space:nowrap; }
|
||||
.row .value b { font-size:11px; font-weight:normal; }
|
||||
@media(max-width:600px) { .entries { max-height:32vh; } }
|
||||
`};customElements.get("nf-utility-overview")||customElements.define("nf-utility-overview",Co);var vf=new Set(["on","home","open","true","active","playing","heat","heating"]);function Yr(r,e){let t=e.show_when;if(!t?.entity||!r)return!0;let n=r.states[t.entity];if(!n||N(n))return!0;let i=String(n.state).toLowerCase(),o=(t.state??"").split(",").map(a=>a.trim().toLowerCase()).filter(Boolean),s=o.length?o.includes(i):vf.has(i)||Number.isFinite(Number(i))&&Number(i)>0;return t.invert?!s:s}function Lo(r,e){let t=[];for(let n of e.floors)for(let i of n.furniture)Yr(r,i)||t.push(i.id);return t.sort()}function fu(r,e){if(!e.length)return r;let t=new Set(e);return{...r,floors:r.floors.map(n=>n.furniture.some(i=>t.has(i.id))?{...n,furniture:n.furniture.filter(i=>!t.has(i.id))}:n)}}var gu="image:";function Oo(r,e,t){let n=(e??"").trim();if(!n)return null;if(n.startsWith(gu))return t(n.slice(gu.length));if(/^(https?:\/\/|\/)/.test(n))return n;if(/^[a-z_]+\.[a-z0-9_]+$/.test(n)){let i=r?.states[n]?.attributes.entity_picture;return typeof i=="string"&&i?i:null}return null}var Pn=r=>Number(r);function Nn(r){if(Array.isArray(r)){let[o,s]=[Pn(r[0]),Pn(r[1])];return Number.isFinite(o)&&Number.isFinite(s)?[o,s]:null}if(!r||typeof r!="object")return null;let{x:e,y:t}=r,[n,i]=[Pn(e),Pn(t)];return Number.isFinite(n)&&Number.isFinite(i)?[n,i]:null}function _u(r){return r?Nn(r.charger)??Nn(r.charger_position):null}function bu(r){for(let[e,t]of Object.entries(r.states))if(e.startsWith("camera.")&&(Nn(t.attributes?.vacuum_position)??_u(t.attributes)))return e;return null}var yf=r=>Array.isArray(r)?typeof r[0]=="number":!!r&&typeof r=="object",In=(r,e)=>e?[r[0],-r[1]]:r;function wf(r){if(!r)return null;let e=r.mirror===!0,[t,n]=In(r.ga,e),[i,o]=In(r.gb,e),[s,a]=r.a,[l,c]=r.b,[u,d]=[i-t,o-n],[m,h]=[l-s,c-a],g=Math.hypot(u,d),_=Math.hypot(m,h);if(!(g>1e-6)||!(_>1e-6))return null;let b=_/g,v=Math.atan2(h,m)-Math.atan2(d,u),[S,k]=[Math.cos(v),Math.sin(v)];return M=>{let z=In(M,e),[R,F]=[z[0]-t,z[1]-n];return[s+b*(R*S-F*k),a+b*(R*k+F*S)]}}function xf(r){if(!r)return null;let e=r.mirror===!0,[t,n]=In(r.ga,e),[i,o]=In(r.gb,e),s=Math.atan2(r.b[1]-r.a[1],r.b[0]-r.a[0])-Math.atan2(o-n,i-t);return Number.isFinite(s)?s:null}function vu(r,e,t){if(!e)return null;let n=r.states[e]?.attributes;if(!n)return null;let i=wf(t)??(g=>g),o=xf(t)??0,s=t?.mirror===!0?-1:1,a=n.vacuum_position,l=Nn(a),c=l?(()=>{let[g,_]=i(l),b=Pn(a?.a)*s;if(!Number.isFinite(b))return{x:g,z:_,heading:0};let v=b*Math.PI/180+o;return{x:g,z:_,heading:Math.atan2(Math.cos(v),Math.sin(v))}})():null,u=_u(n),d=Array.isArray(n.path)?n.path:[],m=d.length>0&&yf(d[0])?[d]:d,h=[];for(let g of m){let _=[];for(let b of Array.isArray(g)?g:[]){let v=Nn(b);v&&_.push(i(v))}_.length>1&&h.push(_)}return!c&&!u&&!h.length?null:{pose:c,charger:u?i(u):null,path:h}}var yu="nextfloor.lock3d",wu=520,Bo=class extends Q{static properties={hass:{attribute:!1},building:{attribute:!1},floorId:{attribute:!1},roomId:{attribute:!1},wallMode:{attribute:!1},solidWalls:{attribute:!1},glassWalls:{attribute:!1},explode:{type:Boolean},keepRoof:{attribute:!1},markerMode:{attribute:!1},markerNames:{attribute:!1},markersOutside:{attribute:!1},tapInRoom:{type:Boolean},roomDoubleTap:{attribute:!1},heatMode:{attribute:!1},theme:{attribute:!1},accent:{attribute:!1},furnitureColors:{attribute:!1},packs:{attribute:!1},showEnergy:{attribute:!1},flows:{attribute:!1},holograms:{attribute:!1},furnish:{type:Boolean},surfaceGrab:{attribute:!1},furnishTypes:{attribute:!1},weather:{type:Boolean},weatherEntityId:{attribute:!1},weatherDensity:{attribute:!1},timeOfDay:{attribute:!1},selectedFurniture:{attribute:!1},selectedDevice:{attribute:!1},_sky:{state:!0},quality:{attribute:!1},showStats:{type:Boolean},_stats:{state:!0},_error:{state:!0},_energy:{state:!0},_flows:{state:!0},_liveEnergy:{state:!0},_liveCards:{state:!0},_liveCardOn:{state:!0},_houseFolded:{state:!0},_swipe:{state:!0},_menu:{state:!0},_pluginWindow:{state:!0},_plate:{state:!0},_blend:{state:!0},_wallBig:{state:!0},_find:{state:!0},_central:{state:!0},_thumbsCompact:{state:!0},_armed:{state:!0},central:{attribute:!1},centralOpen:{attribute:!1},keepCamera:{attribute:!1},plain:{attribute:!1},rightBack:{attribute:!1},templateName:{attribute:!1},readable:{type:Boolean,reflect:!0},today:{attribute:!1},_todayOpen:{state:!0},_todayItems:{state:!0},_forecast:{state:!0},zoom:{attribute:!1},buttons:{attribute:!1},_thumbs:{state:!0},floorThumbs:{attribute:!1},clean:{attribute:!1},cleanButton:{attribute:!1},clock:{attribute:!1},lockButton:{attribute:!1},walkButton:{attribute:!1},travelButton:{attribute:!1},_travel:{state:!0},_walking:{state:!0},_stick:{state:!0},_locked:{state:!0},_now:{state:!0},roomLabels:{attribute:!1},roomNamesButton:{attribute:!1},floorStack:{attribute:!1},panelOpen:{attribute:!1},alerts:{attribute:!1},alertJump:{attribute:!1},scenes:{attribute:!1},announcements:{attribute:!1},sensorBar:{attribute:!1},screenName:{attribute:!1},_announcement:{state:!0},dimmed:
Line truncated
|
||||
${e.map(t=>p`<button class="nf-chip" aria-pressed=${!this.hiddenLayers.has(t.id)} @click=${()=>this.toggleLayer(t.id)}>${this.hiddenLayers.has(t.id)?"\u25CC":"\u{1F441}"} ${t.name}</button>`)}
|
||||
</div>`}syncDevices(e){let t=this.viewer,n=this.building;if(!t||!n||!this.hass)return;let i=this._travel,o=i&&!i.loading?Nt(this.hass,i.history,i.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==o.entities)&&(this.openingLinks=He(o,n.floors),this.furnitureLinks=ht(o,n.floors),this.linkedRegistry=o.entities,this.findIndex=null,this.alertSrc=this.alerts?sc(o,n,this.weatherEntityId,this.openingLinks):null,this.watched=mc({hass:o,building:n,openingLinks:this.openingLinks,furnitureLinks:this.furnitureLinks,needsRoomSensors:this.heatMode!=="none"||this.roomLabels,alertSources:this.alertSrc,weatherEntityId:this.weatherEntityId}),e=!0),!(e||this.watched.some(y=>this.shownStates.get(y)!==o.states[y])))return;Io(o,n).join(",")!==this.shownFor?.key&&t.setBuilding(this.shownBuilding(o)),this.shownStates=new Map(this.watched.map(y=>[y,o.states[y]])),this.refreshToday(n),this.refreshForecast(n);let a=gn(o,n),l=Ia(o,n.floors.some(y=>y.layer&&this.hiddenLayers.has(y.id))?this.shownBuilding(o):n);this.placementInfo=new Map(l.map(y=>[y.id,{floorId:y.floorId,roomId:y.roomId,x:y.x,z:y.z,y:y.y,rotation:y.rotation??0}]));let c=this.furnitureMarkers(o,n,new Set(l.map(y=>y.id)),new Set(a.map(y=>y.powerEntity)));a.push(...c.consumers);let u=_n(o,n,a,Le(n,y=>this.furnitureLinks?.get(y.id)?.power??null)),d=new Map(a.filter(y=>y.id!==y.powerEntity).map(y=>[y.id,y.power]));this.confirmSet=mt(o,n.floors);let m=new Set(this.liveCardsOn?this._liveCards.flatMap(y=>y.kind==="media"?[y.media.entity]:y.kind==="car"?[y.spot]:[]):[]);for(let y of n.floors)for(let w of y.outdoor??[]){if(!w.area_id&&!w.temp_entity&&!w.pump_entity)continue;let B=w.temp_entity?o.states[w.temp_entity]:void 0,D=w.pump_entity?o.states[w.pump_entity]:void 0,[O,pe]=Ae(w.points),rt=B&&Number.isFinite(Number(B.state))?`${W(o,ae(o,or(Number(B.state),B.attributes.unit_of_measurement)),1)} ${re(o)}`:"",vt=!!D&&te(D);l.push({id:w.area_id?`outdoor:${w.id}`:w.pump_entity??w.temp_entity,floorId:y.id,roomId:null,x:O,z:pe,y:Xn(y,w,O,pe)+.7,icon:Ee(w.type==="pool"?"pool":w.type==="terrace"?"table-chair":"tree-outline"),name:w.area_id&&o.areas?.[w.area_id]?.name||$(o,`out_${w.type}`),text:[rt,vt?$(o,"pool_pump_on"):""].filter(Boolean).join(" \xB7 "),active:vt,unavailable:!1,glow:null,show:"always"})}let h=new Map;for(let y of n.floors){for(let w of y.placements)w.pin_offset&&h.set(`${y.id}:${w.entity_id}`,w.pin_offset);for(let w of y.furniture)w.pin_offset&&h.set(`f:${w.id}`,w.pin_offset)}let g=y=>{let w=y.lamp?void 0:(y.furnitureId?h.get(`f:${y.furnitureId}`):void 0)??h.get(`${y.floorId}:${y.id}`);return w?{...y,x:y.x+(w.x??0),z:y.z+(w.z??0),y:y.y+(w.y??0)}:y};t.setDevices([...[...l,...c.markers].map(g).map(y=>{let w=y.show==="no_power"||"energyDevice"in y&&y.energyDevice?null:d.get(y.id)??null,B={...y,power:w,powerText:w===null?void 0:ue(o,w),effect:this.dimmed?void 0:y.effect,text:this.subMeterText(o,n,u,y.furnitureId)??y.text},D=y.ownName&&(y.showName||this.markerNames)?y.ownName:"",O=m.has(y.id)||!!y.furnitureId&&m.has(y.furnitureId);return{...B,pin:this.showPin(B)&&!O,full:y.show==="always",caption:D}})]),t.setPickTargets(c.targets,this.openingTargets(),this.secondBlinds()),t.setScreens(c.screens),t.setFridgeDoors(_a(o,n.floors)),t.setCovers(Ea(o,n)),t.setRobots(this.robotInfos(o,n));let _=new Map;for(let y of n.floors)for(let w of y.furniture)!J(w.type)?.pet||!w.room_sensor||w.room_sensor==="none"||_.set(w.id,Pi(o,y.rooms.filter(B=>B.points.length>=3),null,w.room_sensor)?.id??null);_.size&&t.setPetRooms(_),t.setRoofWindows(tc(o,n)),t.setParked(go(o,n)),t.setGateStates(vc(o,n));let b=new Map(n.floors.flatMap(y=>y.openings.map(w=>[w.id,w.type]))),v=new Map([...this.openingLinks].map(([y,w])=>[y,Pe(o,w,b.get(y))]));t.setOpeningStates(v),this.setAlerts(this.alertSrc?mo(o,n,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(o);let S=[...l,...c.markers].map(y=>`${y.id}:${y.glow?`${y.glow.level.toFixed(1)}/${y.glow.color.map(w=>w.toFixed(1)).join("/")}`:0}`).join(";")+"|"+[...v].map(([y,w])=>`${y}:${w.open}:${w.cover===null?"-":w.cover.toFixed(1)}`).join(";");if(S!==this.thumbSig){let y=this.thumbSig==="";this.thumbSig=S,y||this.scheduleThumbs(1500)}let k=Fc(o,n,a,n.energy.advanced?y=>this.furnitureLinks?.get(y.id)?.power??null:void 0),M=this.liveCars(o,n);for(let y of M){if(!y.car.home||!y.car.charging&&!y.car.plugged)continue;let w=n.floors.flatMap(O=>O.furniture.filter(pe=>pe.type==="wallbox").map(pe=>({floorId:O.id,x:pe.x,z:pe.z,y:1}))).sort((O,pe)=>Math.hypot(O.x-y.at.x,O.z-y.at.z)-Math.hypot(pe.x-y.at.x,pe.z-y.at.z))[0],B=w&&w.floorId===y.at.floorId&&Math.hypot(w.x-y.at.x,w.z-y.at.z)<9,D=w??En(n);!D||!y.car.charging&&!B||k.arcs.push({key:`car:${y.spot}`,from:D,to:{...y.at,y:.8},power:y.car.charging?y.car.chargingW??7e3:0,color:[80,175,255],...B?{via:[{...D,y:.35},{floorId:y.at.floorId,x:(D.x+y.at.x)/2,z:(D.z+y.at.z)/2,y:.08},{...y.at,y:.5}],cable:!0}:{}})}let z=En(n);for(let y of this.liveHeatPumps(n)){let w=y.pump.heat??(y.pump.mode==="heating"||y.pLine truncated
|
||||
</div>`}syncDevices(e){let t=this.viewer,n=this.building;if(!t||!n||!this.hass)return;let i=this._travel,o=i&&!i.loading?Wt(this.hass,i.history,i.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==o.entities)&&(this.openingLinks=Ne(o,n.floors),this.furnitureLinks=gt(o,n.floors),this.linkedRegistry=o.entities,this.findIndex=null,this.alertSrc=this.alerts?lc(o,n,this.weatherEntityId,this.openingLinks):null,this.watched=fc({hass:o,building:n,openingLinks:this.openingLinks,furnitureLinks:this.furnitureLinks,needsRoomSensors:this.heatMode!=="none"||this.roomLabels,alertSources:this.alertSrc,weatherEntityId:this.weatherEntityId}),e=!0),!(e||this.watched.some(y=>this.shownStates.get(y)!==o.states[y])))return;Lo(o,n).join(",")!==this.shownFor?.key&&t.setBuilding(this.shownBuilding(o)),this.shownStates=new Map(this.watched.map(y=>[y,o.states[y]])),this.refreshToday(n),this.refreshForecast(n);let a=vn(o,n),l=La(o,n.floors.some(y=>y.layer&&this.hiddenLayers.has(y.id))?this.shownBuilding(o):n);this.placementInfo=new Map(l.map(y=>[y.id,{floorId:y.floorId,roomId:y.roomId,x:y.x,z:y.z,y:y.y,rotation:y.rotation??0}]));let c=this.furnitureMarkers(o,n,new Set(l.map(y=>y.id)),new Set(a.map(y=>y.powerEntity)));a.push(...c.consumers);let u=yn(o,n,a,Ve(n,y=>this.furnitureLinks?.get(y.id)?.power??null)),d=new Map(a.filter(y=>y.id!==y.powerEntity).map(y=>[y.id,y.power]));this.confirmSet=_t(o,n.floors);let m=new Set(this.liveCardsOn?this._liveCards.flatMap(y=>y.kind==="media"?[y.media.entity]:y.kind==="car"?[y.spot]:[]):[]);for(let y of n.floors)for(let w of y.outdoor??[]){if(!w.area_id&&!w.temp_entity&&!w.pump_entity)continue;let B=w.temp_entity?o.states[w.temp_entity]:void 0,D=w.pump_entity?o.states[w.pump_entity]:void 0,[W,pe]=Ae(w.points),at=B&&Number.isFinite(Number(B.state))?`${L(o,ae(o,lr(Number(B.state),B.attributes.unit_of_measurement)),1)} ${re(o)}`:"",kt=!!D&&te(D);l.push({id:w.area_id?`outdoor:${w.id}`:w.pump_entity??w.temp_entity,floorId:y.id,roomId:null,x:W,z:pe,y:nr(y,w,W,pe)+.7,icon:Ee(w.type==="pool"?"pool":w.type==="terrace"?"table-chair":"tree-outline"),name:w.area_id&&o.areas?.[w.area_id]?.name||$(o,`out_${w.type}`),text:[at,kt?$(o,"pool_pump_on"):""].filter(Boolean).join(" \xB7 "),active:kt,unavailable:!1,glow:null,show:"always"})}let h=new Map;for(let y of n.floors){for(let w of y.placements)w.pin_offset&&h.set(`${y.id}:${w.entity_id}`,w.pin_offset);for(let w of y.furniture)w.pin_offset&&h.set(`f:${w.id}`,w.pin_offset)}let g=y=>{let w=y.lamp?void 0:(y.furnitureId?h.get(`f:${y.furnitureId}`):void 0)??h.get(`${y.floorId}:${y.id}`);return w?{...y,x:y.x+(w.x??0),z:y.z+(w.z??0),y:y.y+(w.y??0)}:y};t.setDevices([...[...l,...c.markers].map(g).map(y=>{let w=y.show==="no_power"||"energyDevice"in y&&y.energyDevice?null:d.get(y.id)??null,B={...y,power:w,powerText:w===null?void 0:ue(o,w),effect:this.dimmed?void 0:y.effect,text:this.subMeterText(o,n,u,y.furnitureId)??y.text},D=y.ownName&&(y.showName||this.markerNames)?y.ownName:"",W=m.has(y.id)||!!y.furnitureId&&m.has(y.furnitureId);return{...B,pin:this.showPin(B)&&!W,full:y.show==="always",caption:D}})]),t.setPickTargets(c.targets,this.openingTargets(),this.secondBlinds()),t.setScreens(c.screens),t.setFridgeDoors(ya(o,n.floors)),t.setCovers(Ta(o,n)),t.setRobots(this.robotInfos(o,n));let _=new Map;for(let y of n.floors)for(let w of y.furniture)!X(w.type)?.pet||!w.room_sensor||w.room_sensor==="none"||_.set(w.id,Ni(o,y.rooms.filter(B=>B.points.length>=3),null,w.room_sensor)?.id??null);_.size&&t.setPetRooms(_),t.setRoofWindows(rc(o,n)),t.setParked(bo(o,n)),t.setGateStates(wc(o,n));let b=new Map(n.floors.flatMap(y=>y.openings.map(w=>[w.id,w.type]))),v=new Map([...this.openingLinks].map(([y,w])=>[y,Ce(o,w,b.get(y))]));t.setOpeningStates(v),this.setAlerts(this.alertSrc?fo(o,n,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(o);let S=[...l,...c.markers].map(y=>`${y.id}:${y.glow?`${y.glow.level.toFixed(1)}/${y.glow.color.map(w=>w.toFixed(1)).join("/")}`:0}`).join(";")+"|"+[...v].map(([y,w])=>`${y}:${w.open}:${w.cover===null?"-":w.cover.toFixed(1)}`).join(";");if(S!==this.thumbSig){let y=this.thumbSig==="";this.thumbSig=S,y||this.scheduleThumbs(1500)}let k=Pc(o,n,a,n.energy.advanced?y=>this.furnitureLinks?.get(y.id)?.power??null:void 0),M=this.liveCars(o,n);for(let y of M){if(!y.car.home||!y.car.charging&&!y.car.plugged)continue;let w=n.floors.flatMap(W=>W.furniture.filter(pe=>pe.type==="wallbox").map(pe=>({floorId:W.id,x:pe.x,z:pe.z,y:1}))).sort((W,pe)=>Math.hypot(W.x-y.at.x,W.z-y.at.z)-Math.hypot(pe.x-y.at.x,pe.z-y.at.z))[0],B=w&&w.floorId===y.at.floorId&&Math.hypot(w.x-y.at.x,w.z-y.at.z)<9,D=w??Tn(n);!D||!y.car.charging&&!B||k.arcs.push({key:`car:${y.spot}`,from:D,to:{...y.at,y:.8},power:y.car.charging?y.car.chargingW??7e3:0,color:[80,175,255],...B?{via:[{...D,y:.35},{floorId:y.at.floorId,x:(D.x+y.at.x)/2,z:(D.z+y.at.z)/2,y:.08},{...y.at,y:.5}],cable:!0}:{}})}let z=Tn(n);for(let y of this.liveHeatPumps(n)){let w=y.pump.heat??(y.pump.mode==="heating"||y.pLine truncated
|
||||
<button class="nf-thumbs-fold" title=${$(this.hass,n?"thumbs_show":"thumbs_fold")} aria-label=${$(this.hass,n?"thumbs_show":"thumbs_fold")} @click=${i}>${n?"\u25B8":"\u25C2"}</button>
|
||||
<button class="nf-thumb nf-thumb-house" aria-pressed=${this.floorId===null} @click=${()=>this.fire("floor-tap",{floorId:null})}>
|
||||
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"><path d="M3 11l9-7 9 7M5 10v10h14V10" /></svg>
|
||||
@@ -1615,16 +1649,16 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${n?f:p`<img src=${o.url} alt="" />`}
|
||||
<span>${e.get(o.floorId)??""}</span>
|
||||
</button>`)}
|
||||
</nav>`}onDeviceHold(e,t,n){let i=H(e);i==="light"||i==="cover"||i==="switch"||i==="fan"||i==="lock"?this._menu={entity:e,x:t,y:n}:ye(this,e)}onDeviceSwipe(e,t,n,i,o){let s=this.hass?.states[e];if(t==="start"){if(!s||N(s)||this.confirmSet.has(e))return!1;let l=H(e);if(l==="light"&&Ho(s).dim){let c=s.state==="on"?typeof s.attributes.brightness=="number"?Math.round(s.attributes.brightness/2.55):100:0;return this._swipe={entity:e,kind:"light",start:c,value:c,x:i,y:o},!0}if(l==="fan"&&typeof s.attributes.percentage_step=="number"){let c=s.state==="on"&&typeof s.attributes.percentage=="number"?s.attributes.percentage:0;return this._swipe={entity:e,kind:"fan",start:c,value:c,x:i,y:o},!0}if(l==="cover"&&Po(s)){let c=s.attributes.current_position;return this._swipe={entity:e,kind:"cover",start:c,value:c,x:i,y:o},!0}return!1}let a=this._swipe;if(!a||a.entity!==e)return!1;if(t==="move"){let l=Math.round(Math.min(100,Math.max(0,a.start-n/220*100)));l!==a.value&&(this._swipe={...a,value:l});let c=performance.now();c-this.swipeSent>350&&(this.swipeSent=c,this.applySwipe())}else this.applySwipe(),clearTimeout(this.swipeTimer),this.swipeTimer=setTimeout(()=>this._swipe=null,700);return!0}applySwipe(){let e=this._swipe;!e||!this.hass||(e.kind==="light"?e.value<=0?this.hass.callService("light","turn_off",{entity_id:e.entity}):this.hass.callService("light","turn_on",{entity_id:e.entity,brightness_pct:e.value}):e.kind==="fan"?e.value<=0?this.hass.callService("fan","turn_off",{entity_id:e.entity}):this.hass.callService("fan","set_percentage",{entity_id:e.entity,percentage:e.value}):this.hass.callService("cover","set_cover_position",{entity_id:e.entity,position:e.value}))}openRoom(e,t){this.floorId===e&&this.roomId===t||(this.floorId!==e?(this.fire("floor-tap",{floorId:e}),setTimeout(()=>this.fire("room-tap",{floorId:e,roomId:t}),60)):this.fire("room-tap",{floorId:e,roomId:t}))}goTo(e){if(this._find=null,e.kind==="room"||e.kind==="circuit"){e.roomId&&this.openRoom(e.floorId,e.roomId);return}this.floorId!==e.floorId&&this.fire("floor-tap",{floorId:e.floorId}),setTimeout(()=>this.viewer?.focus(e.floorId,e.x,e.z,e.y,e.entity),120)}listenToAnnouncements(e){if(!e){this.stopAnnouncements?.(),this.stopAnnouncements=null,clearTimeout(this.announceTimer);return}if(this.stopAnnouncements)return;let t=!1;this.stopAnnouncements=()=>t=!0,Ga(this.hass,n=>this.announce(n)).then(n=>{t?n():this.stopAnnouncements=n})}announce(e){let t=e;if(t?.reload===!0){(!t.template||t.template===this.templateName)&&setTimeout(()=>location.reload(),500+Math.random()*6e3);return}if(typeof e?.message!="string"||!e.message.trim()||!Oa(e,this.screenName)||!Ba(e))return;let n=Va(e.message);this._announcement={message:e.message,until:Date.now()+n},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,n),Ka(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?p`<button class="nf-announcement" role="alert" title=${$(this.hass,"close")} @click=${()=>this._announcement=null}>
|
||||
</nav>`}onDeviceHold(e,t,n){let i=H(e);i==="light"||i==="cover"||i==="switch"||i==="fan"||i==="lock"?this._menu={entity:e,x:t,y:n}:ye(this,e)}onDeviceSwipe(e,t,n,i,o){let s=this.hass?.states[e];if(t==="start"){if(!s||N(s)||this.confirmSet.has(e))return!1;let l=H(e);if(l==="light"&&Io(s).dim){let c=s.state==="on"?typeof s.attributes.brightness=="number"?Math.round(s.attributes.brightness/2.55):100:0;return this._swipe={entity:e,kind:"light",start:c,value:c,x:i,y:o},!0}if(l==="fan"&&typeof s.attributes.percentage_step=="number"){let c=s.state==="on"&&typeof s.attributes.percentage=="number"?s.attributes.percentage:0;return this._swipe={entity:e,kind:"fan",start:c,value:c,x:i,y:o},!0}if(l==="cover"&&No(s)){let c=s.attributes.current_position;return this._swipe={entity:e,kind:"cover",start:c,value:c,x:i,y:o},!0}return!1}let a=this._swipe;if(!a||a.entity!==e)return!1;if(t==="move"){let l=Math.round(Math.min(100,Math.max(0,a.start-n/220*100)));l!==a.value&&(this._swipe={...a,value:l});let c=performance.now();c-this.swipeSent>350&&(this.swipeSent=c,this.applySwipe())}else this.applySwipe(),clearTimeout(this.swipeTimer),this.swipeTimer=setTimeout(()=>this._swipe=null,700);return!0}applySwipe(){let e=this._swipe;!e||!this.hass||(e.kind==="light"?e.value<=0?this.hass.callService("light","turn_off",{entity_id:e.entity}):this.hass.callService("light","turn_on",{entity_id:e.entity,brightness_pct:e.value}):e.kind==="fan"?e.value<=0?this.hass.callService("fan","turn_off",{entity_id:e.entity}):this.hass.callService("fan","set_percentage",{entity_id:e.entity,percentage:e.value}):this.hass.callService("cover","set_cover_position",{entity_id:e.entity,position:e.value}))}openRoom(e,t){this.floorId===e&&this.roomId===t||(this.floorId!==e?(this.fire("floor-tap",{floorId:e}),setTimeout(()=>this.fire("room-tap",{floorId:e,roomId:t}),60)):this.fire("room-tap",{floorId:e,roomId:t}))}goTo(e){if(this._find=null,e.kind==="room"||e.kind==="circuit"){e.roomId&&this.openRoom(e.floorId,e.roomId);return}this.floorId!==e.floorId&&this.fire("floor-tap",{floorId:e.floorId}),setTimeout(()=>this.viewer?.focus(e.floorId,e.x,e.z,e.y,e.entity),120)}listenToAnnouncements(e){if(!e){this.stopAnnouncements?.(),this.stopAnnouncements=null,clearTimeout(this.announceTimer);return}if(this.stopAnnouncements)return;let t=!1;this.stopAnnouncements=()=>t=!0,qa(this.hass,n=>this.announce(n)).then(n=>{t?n():this.stopAnnouncements=n})}announce(e){let t=e;if(t?.reload===!0){(!t.template||t.template===this.templateName)&&setTimeout(()=>location.reload(),500+Math.random()*6e3);return}if(typeof e?.message!="string"||!e.message.trim()||!Ka(e,this.screenName)||!Ga(e))return;let n=Ua(e.message);this._announcement={message:e.message,until:Date.now()+n},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,n),ja(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?p`<button class="nf-announcement" role="alert" title=${$(this.hass,"close")} @click=${()=>this._announcement=null}>
|
||||
<span class="nf-announcement-icon" aria-hidden="true">📢</span><span class="nf-announcement-text">${e.message}</span>
|
||||
</button>`:f}renderAlerts(){let e=this.building;if(!this._alerts.length||!e)return f;let t=this._alerts.slice(0,3);return p`<div class="nf-alert-banner" role="alert">
|
||||
${t.map(n=>p`<button class="nf-alert nf-alert-${n.kind}" style=${n.color?`border-left-color:${n.color}`:""} title=${po(this.hass,e,n)} @click=${()=>this.jumpTo(n)}>${po(this.hass,e,n)}</button>`)}
|
||||
${t.map(n=>p`<button class="nf-alert nf-alert-${n.kind}" style=${n.color?`border-left-color:${n.color}`:""} title=${go(this.hass,e,n)} @click=${()=>this.jumpTo(n)}>${go(this.hass,e,n)}</button>`)}
|
||||
${this._alerts.length>3?p`<span class="nf-alert-more">+${this._alerts.length-3}</span>`:f}
|
||||
</div>`}renderScenes(){let e=this.building;if(!this.scenes||!this.roomId||this.panelOpen||!e||!this.hass)return f;let t=e.floors.flatMap(o=>o.rooms).find(o=>o.id===this.roomId),n=t?K(this.hass,t).filter(o=>H(o)==="scene"||H(o)==="script").slice(0,6):[];if(!n.length)return f;let i=t?.area_id?this.hass.areas?.[t.area_id]?.name:void 0;return p`<div class="nf-scenes">
|
||||
${n.map(o=>p`<button class="nf-chip" aria-pressed=${this._sceneFired===o} @click=${()=>this.runScene(o)}>${L(this.hass,o,i)}</button>`)}
|
||||
</div>`}renderScenes(){let e=this.building;if(!this.scenes||!this.roomId||this.panelOpen||!e||!this.hass)return f;let t=e.floors.flatMap(o=>o.rooms).find(o=>o.id===this.roomId),n=t?G(this.hass,t).filter(o=>H(o)==="scene"||H(o)==="script").slice(0,6):[];if(!n.length)return f;let i=t?.area_id?this.hass.areas?.[t.area_id]?.name:void 0;return p`<div class="nf-scenes">
|
||||
${n.map(o=>p`<button class="nf-chip" aria-pressed=${this._sceneFired===o} @click=${()=>this.runScene(o)}>${O(this.hass,o,i)}</button>`)}
|
||||
</div>`}renderFind(){let e=this.building;if(!e||!this.hass)return f;if(this._find===null)return p`<button class="nf-find-btn" title=${$(this.hass,"find")} aria-label=${$(this.hass,"find")} @click=${()=>this._find=""}>
|
||||
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="6.5" /><path d="M16 16l4.5 4.5" /></svg>
|
||||
</button>`;let t=iu(this.findIndex??=ru(this.hass,e),this._find);return p`<div class="nf-find">
|
||||
</button>`;let t=su(this.findIndex??=ou(this.hass,e),this._find);return p`<div class="nf-find">
|
||||
<input
|
||||
type="search"
|
||||
placeholder=${$(this.hass,"find_placeholder")}
|
||||
@@ -1635,7 +1669,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
<button class="nf-find-close" aria-label=${$(this.hass,"close")} @click=${()=>this._find=null}>✕</button>
|
||||
${this._find.trim()?p`<div class="nf-find-list">
|
||||
${t.length?t.map(n=>p`<button @click=${()=>this.goTo(n)}>
|
||||
<span class="nf-find-icon"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d=${n.icon?_r(n.icon):"M4 10l8-6 8 6v10H4z"} /></svg></span>
|
||||
<span class="nf-find-icon"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d=${n.icon?yr(n.icon):"M4 10l8-6 8 6v10H4z"} /></svg></span>
|
||||
<span><b>${n.name}</b>${n.where?p`<small>${n.where}</small>`:f}</span>
|
||||
</button>`):p`<p>${$(this.hass,"find_none")}</p>`}
|
||||
</div>`:f}
|
||||
@@ -1647,7 +1681,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
@click=${()=>{this._central=!this._central,this._armed=null}}
|
||||
>
|
||||
<svg viewBox="0 0 24 24" width="19" height="19" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linejoin="round"><path d="M12 3.5l2.6 5.3 5.9.9-4.3 4.1 1 5.8L12 16.9l-5.2 2.7 1-5.8-4.3-4.1 5.9-.9z" /></svg>
|
||||
</button>`;if(!this._central)return i;let o=this.floorId?e.floors.find(b=>b.id===this.floorId):void 0,s=o?[o]:e.floors,a=s.flatMap(b=>Ii(t,b).lights),l=s.flatMap(b=>Ii(t,b).covers),c=a.filter(b=>t.states[b]?.state==="on").length,u=!o,d=(b,v,S,k)=>{if(k.length){if(u&&this._armed!==b){this._armed=b,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(v,S,{entity_id:k})}},m=(b,v,S,k,M)=>p`<button class="nf-btn ${this._armed===b?"nf-central-armed":""}" ?disabled=${!M.length} @click=${()=>d(b,S,k,M)}>
|
||||
</button>`;if(!this._central)return i;let o=this.floorId?e.floors.find(b=>b.id===this.floorId):void 0,s=o?[o]:e.floors,a=s.flatMap(b=>Ci(t,b).lights),l=s.flatMap(b=>Ci(t,b).covers),c=a.filter(b=>t.states[b]?.state==="on").length,u=!o,d=(b,v,S,k)=>{if(k.length){if(u&&this._armed!==b){this._armed=b,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(v,S,{entity_id:k})}},m=(b,v,S,k,M)=>p`<button class="nf-btn ${this._armed===b?"nf-central-armed":""}" ?disabled=${!M.length} @click=${()=>d(b,S,k,M)}>
|
||||
${this._armed===b?n("central_sure"):n(v)}
|
||||
</button>`,h=e.settings.favorite_floors??{},g=(e.settings.favorites??[]).filter(b=>t.states[b]&&(!h[b]||!o||h[b]===o.id)),_=this.buttons??e.settings.buttons??[];return p`${i}
|
||||
<div class="nf-central ${this.centralOpen?"nf-central-big":""}" role="dialog" aria-label=${n("central")}>
|
||||
@@ -1664,25 +1698,25 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
</div>`:f}
|
||||
<b>${n("central_favorites")}</b>
|
||||
${g.length?p`<div class="nf-central-favs">
|
||||
${g.map(b=>{let[v,S]=xa(b),k=t.states[b],M=v==="homeassistant"&&k?.state==="on";return p`<button
|
||||
${g.map(b=>{let[v,S]=$a(b),k=t.states[b],M=v==="homeassistant"&&k?.state==="on";return p`<button
|
||||
class="nf-chip"
|
||||
aria-pressed=${M||this._sceneFired===b}
|
||||
?disabled=${N(k)}
|
||||
@click=${()=>{t.callService(v,S,{entity_id:b}),this._sceneFired=b,setTimeout(()=>this._sceneFired=null,600)}}
|
||||
>
|
||||
${L(t,b)}
|
||||
${O(t,b)}
|
||||
</button>`})}
|
||||
</div>`:_.length?f:p`<p class="nf-central-hint">${n("central_no_favorites")}</p>`}
|
||||
${_.length?p`<div class="nf-central-favs">
|
||||
${_.map(b=>p`<button
|
||||
class="nf-chip nf-own-btn"
|
||||
aria-pressed=${ka(t,b)}
|
||||
@click=${v=>{Ni(t,v.currentTarget,b),b.action!=="service"&&(this._central=!1)}}
|
||||
aria-pressed=${Ma(t,b)}
|
||||
@click=${v=>{Li(t,v.currentTarget,b),b.action!=="service"&&(this._central=!1)}}
|
||||
>
|
||||
${b.icon?p`<ha-icon .icon=${b.icon.startsWith("mdi:")?b.icon:`mdi:${b.icon}`}></ha-icon>`:f}${b.label}
|
||||
</button>`)}
|
||||
</div>`:f}
|
||||
</div>`}toggleLock(){this._locked=!this._locked;try{localStorage.setItem(bu,this._locked?"1":"0")}catch{}}async openTravel(e){if(clearInterval(this.travelTimer),this.travelTimer=void 0,e===null||!this.hass){this._travel=null,this.syncDevices(!0);return}let t=Date.now(),n=t-e*36e5;this._travel={history:new Map,from:n,to:t,t:n,playing:!1,speed:e>24?3600:600,hours:e,moments:[],loading:!0};try{let i=await yn(this.hass,Gl(this.watched),n,t);if(!this._travel||this._travel.from!==n)return;this._travel={...this._travel,history:i,moments:Ul(i,n,t),loading:!1}}catch{this._travel=null,this._error=$(this.hass,"travel_failed");return}this.syncDevices(!0)}travelTo(e){let t=this._travel;t&&(this._travel={...t,t:Math.min(t.to,Math.max(t.from,e))},this.syncDevices(!0))}playTravel(e){let t=this._travel;t&&(clearInterval(this.travelTimer),this.travelTimer=void 0,this._travel={...t,playing:e,t:e&&t.t>=t.to?t.from:t.t},e&&(this.travelTimer=setInterval(()=>{let n=this._travel;if(!n)return;let i=n.t+250*n.speed;i>=n.to&&this.playTravel(!1),this.travelTo(i)},250)))}renderTravel(){if(!this.hass||this.clean)return f;let e=a=>$(this.hass,a),t=this._travel;if(!t)return this.travelButton?p`<button class="nf-travel-btn" title=${e("travel")} aria-label=${e("travel")} @click=${()=>{this.openTravel(24)}}>⏪</button>`:f;let n=this.hass.language??navigator.language,i=new Intl.DateTimeFormat(n,{weekday:"short",hour:"2-digit",minute:"2-digit"}).format(new Date(t.t)),o=t.to-t.from||1,s=[[60,"travel_speed_min"],[600,"travel_speed_10min"],[3600,"travel_speed_hour"]];return p`<div class="nf-travel" role="group" aria-label=${e("travel")}>
|
||||
</div>`}toggleLock(){this._locked=!this._locked;try{localStorage.setItem(yu,this._locked?"1":"0")}catch{}}async openTravel(e){if(clearInterval(this.travelTimer),this.travelTimer=void 0,e===null||!this.hass){this._travel=null,this.syncDevices(!0);return}let t=Date.now(),n=t-e*36e5;this._travel={history:new Map,from:n,to:t,t:n,playing:!1,speed:e>24?3600:600,hours:e,moments:[],loading:!0};try{let i=await kn(this.hass,jl(this.watched),n,t);if(!this._travel||this._travel.from!==n)return;this._travel={...this._travel,history:i,moments:ql(i,n,t),loading:!1}}catch{this._travel=null,this._error=$(this.hass,"travel_failed");return}this.syncDevices(!0)}travelTo(e){let t=this._travel;t&&(this._travel={...t,t:Math.min(t.to,Math.max(t.from,e))},this.syncDevices(!0))}playTravel(e){let t=this._travel;t&&(clearInterval(this.travelTimer),this.travelTimer=void 0,this._travel={...t,playing:e,t:e&&t.t>=t.to?t.from:t.t},e&&(this.travelTimer=setInterval(()=>{let n=this._travel;if(!n)return;let i=n.t+250*n.speed;i>=n.to&&this.playTravel(!1),this.travelTo(i)},250)))}renderTravel(){if(!this.hass||this.clean)return f;let e=a=>$(this.hass,a),t=this._travel;if(!t)return this.travelButton?p`<button class="nf-travel-btn" title=${e("travel")} aria-label=${e("travel")} @click=${()=>{this.openTravel(24)}}>⏪</button>`:f;let n=this.hass.language??navigator.language,i=new Intl.DateTimeFormat(n,{weekday:"short",hour:"2-digit",minute:"2-digit"}).format(new Date(t.t)),o=t.to-t.from||1,s=[[60,"travel_speed_min"],[600,"travel_speed_10min"],[3600,"travel_speed_hour"]];return p`<div class="nf-travel" role="group" aria-label=${e("travel")}>
|
||||
<button class="nf-travel-play" aria-label=${e(t.playing?"travel_pause":"travel_play")} ?disabled=${t.loading} @click=${()=>this.playTravel(!t.playing)}>${t.playing?"\u23F8":"\u25B6"}</button>
|
||||
<b class="nf-travel-when">${t.loading?e("travel_loading"):i}</b>
|
||||
<div class="nf-travel-track">
|
||||
@@ -1715,12 +1749,12 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
>
|
||||
${this.clean?ne`<svg viewBox="0 0 24 24" width="20" height="20"><path fill="currentColor" d="M12 6a9.8 9.8 0 0 1 9 6 9.8 9.8 0 0 1-9 6 9.8 9.8 0 0 1-9-6 9.8 9.8 0 0 1 9-6m0 2a4 4 0 1 0 0 8 4 4 0 0 0 0-8m0 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4" /></svg>`:ne`<svg viewBox="0 0 24 24" width="20" height="20"><path fill="currentColor" d="M2.4 3.8 3.8 2.4l17.8 17.8-1.4 1.4-3.3-3.3A10.5 10.5 0 0 1 12 19a9.8 9.8 0 0 1-9-6 10.3 10.3 0 0 1 3.6-4.3L2.4 3.8M12 7a4 4 0 0 1 4 4c0 .5-.1 1-.3 1.5l-5.2-5.2c.5-.2 1-.3 1.5-.3m-4 4a4 4 0 0 0 5.5 3.7l-5.2-5.2c-.2.5-.3 1-.3 1.5m4-7a9.8 9.8 0 0 1 9 6 10 10 0 0 1-2.6 3.6l-1.4-1.4A8 8 0 0 0 18.8 12 8 8 0 0 0 9.6 7.2L8 5.6A10.3 10.3 0 0 1 12 4" /></svg>`}
|
||||
</button>`}renderSwipe(){let e=this._swipe;if(!e||!this.hass)return f;let t=e.kind==="light"&&e.value<=0;return p`<div class="nf-swipe" style="left:${e.x}px;top:${e.y}px">
|
||||
<span>${L(this.hass,e.entity)}</span>
|
||||
<span>${O(this.hass,e.entity)}</span>
|
||||
<b>${t?$(this.hass,"swipe_off"):`${e.value} %`}</b>
|
||||
<i><em style="height:${e.value}%"></em></i>
|
||||
</div>`}tapPlate(e,t,n){let i=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),o=i?Ci(i.gang_entities,J(i.type)?.gangs??0):[];if(o.length===1)return this.onDeviceTap(o[0],t,n);o.length>1&&(this._plate={ids:o,x:t,y:n})}renderPlate(){let e=this._plate;if(!e||!this.hass)return f;let t=this.hass,n=()=>this._plate=null;return p`<div class="nf-menu-backdrop" @click=${n}></div>
|
||||
</div>`}tapPlate(e,t,n){let i=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),o=i?Oi(i.gang_entities,X(i.type)?.gangs??0):[];if(o.length===1)return this.onDeviceTap(o[0],t,n);o.length>1&&(this._plate={ids:o,x:t,y:n})}renderPlate(){let e=this._plate;if(!e||!this.hass)return f;let t=this.hass,n=()=>this._plate=null;return p`<div class="nf-menu-backdrop" @click=${n}></div>
|
||||
<div class="nf-plate-menu" style="left:${Math.max(8,e.x-110)}px;top:${Math.max(8,e.y-20-e.ids.length*46)}px" role="menu">
|
||||
${e.ids.map((i,o)=>{let s=t.states[i],a=te(s)||s?.state==="on";return p`<button role="menuitem" class=${a?"on":""} @click=${()=>{n(),this.onDeviceTap(i,e.x,e.y)}}><b>${o+1}</b><span>${L(t,i)}</span><i>${s?oe(t,s):"\u2013"}</i></button>`})}
|
||||
${e.ids.map((i,o)=>{let s=t.states[i],a=te(s)||s?.state==="on";return p`<button role="menuitem" class=${a?"on":""} @click=${()=>{n(),this.onDeviceTap(i,e.x,e.y)}}><b>${o+1}</b><span>${O(t,i)}</span><i>${s?oe(t,s):"\u2013"}</i></button>`})}
|
||||
</div>`}renderMenu(){let e=this._menu;if(!e||!this.hass)return f;let t=this.renderRoot.querySelector(".nf-stage"),n=t?.clientWidth??800,i=t?.clientHeight??600,o=Math.max(8,Math.min(n-240,e.x-116)),s=Math.max(8,Math.min(i-360,e.y-170));return p`<div class="nf-menu-backdrop" @click=${()=>this._menu=null}></div>
|
||||
<nf-quick-menu
|
||||
style="left:${o}px;top:${s}px"
|
||||
@@ -1731,12 +1765,12 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.presets=${(this.building?.settings.media_presets??[]).filter(a=>!a.speakers?.length||a.speakers.includes(e.entity))}
|
||||
?confirmSwitch=${this.confirmSet.has(e.entity)}
|
||||
.myPosition=${this.myPositionOf(e.entity)}
|
||||
.tiltEntity=${mr(this.hass,this.building?.floors??[],e.entity)}
|
||||
.tiltEntity=${gr(this.hass,this.building?.floors??[],e.entity)}
|
||||
@close=${()=>this._menu=null}
|
||||
></nf-quick-menu>`}myPositionOf(e){for(let t of this.building?.floors??[])for(let n of t.openings){let i=this.openingLinks?.get(n.id);if(n.my_position!=null&&(i?.cover===e||i?.cover2===e))return n.my_position}return null}onDeviceTap(e,t=0,n=0){if(e.startsWith("lamp:")||this._travel)return;let i=e.startsWith("tap:")?e.slice(4):this.tapPins.get(e);if(i){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===i);s?.tap&&Ni(this.hass,this,s.tap);return}if(this.pluginTapped(e))return;if(e.startsWith("gang:"))return this.tapPlate(e.slice(5),t,n);if(e.startsWith("outdoor:")){this.fire("room-tap",{floorId:null,roomId:"nf-outside"});return}if(e==="grid"){let s=this.building,a=s?s.energy.grid??Le(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&ye(this,a);return}let o=H(e);if(o==="cover"||o==="media"){this._menu={entity:e,x:t,y:n};return}if(o==="lock"){let s=Fi(this.hass,e),a=L(this.hass,e);confirm($(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(o&&Zs.has(o)){if(this.confirmSet.has(e)&&!confirm($(this.hass,"confirm_switch",{name:L(this.hass,e)})))return;Ca(this.hass,e)}else ye(this,e)}pluginTapped(e){let t=this.hass?.states[e],n=this.placementInfo.get(e);if(!t||!n)return!1;let i=this.building?.floors.find(o=>o.id===n.floorId)?.placements.find(o=>o.entity_id===e);return Es({hass:this.hass,entityId:e,state:t},n,i?.plugin??void 0,{showWindow:(o,s)=>{o&&"hass"in o&&(o.hass=this.hass),this._pluginWindow=o?{node:o,title:s?.title??""}:null},moreInfo:o=>ye(this,o??e)})}renderPluginWindow(){let e=this._pluginWindow;return e?p`<div class="nf-plugin-window" @pointerdown=${t=>t.stopPropagation()}>
|
||||
></nf-quick-menu>`}myPositionOf(e){for(let t of this.building?.floors??[])for(let n of t.openings){let i=this.openingLinks?.get(n.id);if(n.my_position!=null&&(i?.cover===e||i?.cover2===e))return n.my_position}return null}onDeviceTap(e,t=0,n=0){if(e.startsWith("lamp:")||this._travel)return;let i=e.startsWith("tap:")?e.slice(4):this.tapPins.get(e);if(i){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===i);s?.tap&&Li(this.hass,this,s.tap);return}if(this.pluginTapped(e))return;if(e.startsWith("gang:"))return this.tapPlate(e.slice(5),t,n);if(e.startsWith("outdoor:")){this.fire("room-tap",{floorId:null,roomId:"nf-outside"});return}if(e==="grid"){let s=this.building,a=s?s.energy.grid??Ve(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&ye(this,a);return}let o=H(e);if(o==="cover"||o==="media"){this._menu={entity:e,x:t,y:n};return}if(o==="lock"){let s=Pi(this.hass,e),a=O(this.hass,e);confirm($(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(o&&Qs.has(o)){if(this.confirmSet.has(e)&&!confirm($(this.hass,"confirm_switch",{name:O(this.hass,e)})))return;Wa(this.hass,e)}else ye(this,e)}pluginTapped(e){let t=this.hass?.states[e],n=this.placementInfo.get(e);if(!t||!n)return!1;let i=this.building?.floors.find(o=>o.id===n.floorId)?.placements.find(o=>o.entity_id===e);return Ts({hass:this.hass,entityId:e,state:t},n,i?.plugin??void 0,{showWindow:(o,s)=>{o&&"hass"in o&&(o.hass=this.hass),this._pluginWindow=o?{node:o,title:s?.title??""}:null},moreInfo:o=>ye(this,o??e)})}renderPluginWindow(){let e=this._pluginWindow;return e?p`<div class="nf-plugin-window" @pointerdown=${t=>t.stopPropagation()}>
|
||||
<div class="nf-pw-head"><span>${e.title}</span><button class="nf-pw-close" aria-label=${$(this.hass,"close")} @click=${()=>this._pluginWindow=null}>✕</button></div>
|
||||
<div class="nf-pw-body">${e.node}</div>
|
||||
</div>`:f}startViewOf(){return this.startView??this.building?.settings.start_view??null}currentView(){return this.viewer?.currentView()??null}resetView(){this.viewer?.resetView()}fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}toggleFlows(){this._flows=!this._flows;try{localStorage.setItem("nextfloor.flows",this._flows?"1":"0")}catch{}this.syncDevices(!0)}liveHeatPumps(e){let t=this.hass;if(!t)return[];let n=[];for(let i of e.floors)for(let o of i.furniture){if(!Uc(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=Gc(t,s?.entity??s?.power??null);a&&n.push({id:o.id,name:o.name||_e(t,o.type),floorId:i.id,x:o.x,z:o.z,at:{floorId:i.id,x:o.x,z:o.z,y:he(i,o)+o.h+.5},pump:a})}return n}livePrinters(e){let t=this.hass,n=[];if(!t)return n;for(let i of e.floors)for(let o of i.furniture){if(!Ro(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=Eo(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||n.push({id:o.id,name:o.name||_e(t,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:he(i,o)+o.h+.5},printer:a})}return n}liveCars(e,t){let n=[];for(let i of t.floors)for(let o of i.furniture){if(o.type!=="parking")continue;let s=Jc(e,o);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=fo(e,o),l=a?hc(o,a):null,c=o.name||(a?_e(e,a):_e(e,o.type));n.push({spot:o.id,name:c,at:{floorId:i.id,x:o.x,z:o.z,y:he(i,o)+(l?.h??.2)+.6},car:s})}return n}liveMedia(e,t){let n=[];for(let i of t.floors){for(let o of i.furniture){let s=this.furnitureLinks?.get(o.id)?.entity;s?.startsWith("media_player.")&&n.push({entity:s,name:o.name||_e(e,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:he(i,o)+o.h+.15},rings:o.sound_rings})}for(let o of i.placements)o.entity_id.startsWith("media_player.")&&n.push({entity:o.entity_id,name:o.name||L(e,o.entity_id),at:{floorId:i.id,x:o.x,z:o.z,y:(o.y??1.1)+.15},rings:o.sound_rings})}return Jl(e,n)}refreshToday(e){let t=this.hass,n=e.settings.calendars??[],i=Math.max(1,Math.min(7,e.settings.today_days??1)),o=`${new Date().toDateString()}|${i}`;!t||!n.length||Date.now()-this.todayAt<9e5&&o===this.todayDay||(this.todayAt=Date.now(),this.todayDay=o,Lc(t,n,i).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,n=e.settings.forecast&&t?tt(t,this.weatherEntityId??e.settings.weather_entity):null;if(!t||!n)return;let i=`${n}|${new Date().toDateString()}`;Date.now()-this.forecastAt<18e5&&i===this.forecastKey||(this.forecastAt=Date.now(),this.forecastKey=i,Vc(t,n).then(o=>this._forecast=o))}renderForecast(e){let t=this.building,n=this.hass,i=t?.settings.forecast;if(!t||!n||!i||i.corner!==e||this.clean)return f;if(e==="top_right"&&(this.roomId||this.panelOpen))return f;let o=Bc(this._forecast,Math.max(1,Math.min(7,i.days)));if(!o.length)return f;let s=tt(n,this.weatherEntityId??t.settings.weather_entity),a=s?n.states[s]?.attributes:void 0,l=String(a?.temperature_unit??"\xB0"),c=String(a?.precipitation_unit??"mm"),u=n.language??navigator.language,d=new Intl.DateTimeFormat(u,{weekday:"short"}),m=h=>h===null?"\u2013":`${Math.round(h)}\xB0`;return p`<section class="nf-forecast" aria-label=${$(n,"forecast")}>
|
||||
</div>`:f}startViewOf(){return this.startView??this.building?.settings.start_view??null}currentView(){return this.viewer?.currentView()??null}resetView(){this.viewer?.resetView()}fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}toggleFlows(){this._flows=!this._flows;try{localStorage.setItem("nextfloor.flows",this._flows?"1":"0")}catch{}this.syncDevices(!0)}liveHeatPumps(e){let t=this.hass;if(!t)return[];let n=[];for(let i of e.floors)for(let o of i.furniture){if(!qc(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=jc(t,s?.entity??s?.power??null);a&&n.push({id:o.id,name:o.name||_e(t,o.type),floorId:i.id,x:o.x,z:o.z,at:{floorId:i.id,x:o.x,z:o.z,y:he(i,o)+o.h+.5},pump:a})}return n}livePrinters(e){let t=this.hass,n=[];if(!t)return n;for(let i of e.floors)for(let o of i.furniture){if(!To(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=zo(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||n.push({id:o.id,name:o.name||_e(t,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:he(i,o)+o.h+.5},printer:a})}return n}liveCars(e,t){let n=[];for(let i of t.floors)for(let o of i.furniture){if(o.type!=="parking")continue;let s=Xc(e,o);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=_o(e,o),l=a?pc(o,a):null,c=o.name||(a?_e(e,a):_e(e,o.type));n.push({spot:o.id,name:c,at:{floorId:i.id,x:o.x,z:o.z,y:he(i,o)+(l?.h??.2)+.6},car:s})}return n}liveMedia(e,t){let n=[];for(let i of t.floors){for(let o of i.furniture){let s=this.furnitureLinks?.get(o.id)?.entity;s?.startsWith("media_player.")&&n.push({entity:s,name:o.name||_e(e,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:he(i,o)+o.h+.15},rings:o.sound_rings})}for(let o of i.placements)o.entity_id.startsWith("media_player.")&&n.push({entity:o.entity_id,name:o.name||O(e,o.entity_id),at:{floorId:i.id,x:o.x,z:o.z,y:(o.y??1.1)+.15},rings:o.sound_rings})}return Xl(e,n)}refreshToday(e){let t=this.hass,n=e.settings.calendars??[],i=Math.max(1,Math.min(7,e.settings.today_days??1)),o=`${new Date().toDateString()}|${i}`;!t||!n.length||Date.now()-this.todayAt<9e5&&o===this.todayDay||(this.todayAt=Date.now(),this.todayDay=o,Bc(t,n,i).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,n=e.settings.forecast&&t?ot(t,this.weatherEntityId??e.settings.weather_entity):null;if(!t||!n)return;let i=`${n}|${new Date().toDateString()}`;Date.now()-this.forecastAt<18e5&&i===this.forecastKey||(this.forecastAt=Date.now(),this.forecastKey=i,Gc(t,n).then(o=>this._forecast=o))}renderForecast(e){let t=this.building,n=this.hass,i=t?.settings.forecast;if(!t||!n||!i||i.corner!==e||this.clean)return f;if(e==="top_right"&&(this.roomId||this.panelOpen))return f;let o=Kc(this._forecast,Math.max(1,Math.min(7,i.days)));if(!o.length)return f;let s=ot(n,this.weatherEntityId??t.settings.weather_entity),a=s?n.states[s]?.attributes:void 0,l=String(a?.temperature_unit??"\xB0"),c=String(a?.precipitation_unit??"mm"),u=n.language??navigator.language,d=new Intl.DateTimeFormat(u,{weekday:"short"}),m=h=>h===null?"\u2013":`${Math.round(h)}\xB0`;return p`<section class="nf-forecast" aria-label=${$(n,"forecast")}>
|
||||
<ul>
|
||||
${o.map((h,g)=>p`<li>
|
||||
<span class="nf-fc-day">${g===0?$(n,"today"):d.format(new Date(h.day))}</span>
|
||||
@@ -1745,14 +1779,14 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
<span class="nf-fc-rain">${h.rain!==null&&h.rain>0?`\u{1F4A7}${h.rain.toLocaleString(u,{maximumFractionDigits:1})} ${c}`:h.chance!==null&&h.chance>0?`\u{1F4A7}${Math.round(h.chance)} %`:""}</span>
|
||||
</li>`)}
|
||||
</ul>
|
||||
</section>`}renderToday(){let e=this.building,t=this.hass;if(!e||!t||this.clean||this.roomId||this.panelOpen)return f;let n=this.renderForecast("top_right"),i=this.today===!1?f:this.renderTodayCard(e,t);return i===f&&n===f?f:p`<div class="nf-right-col" style=${this.clock==="top_right"?"top: 78px":""}>${i}${n}</div>`}renderTodayCard(e,t){let n=Cc(t,e,Date.now(),{today:$(t,"care_bin_today"),tomorrow:$(t,"care_bin_tomorrow")}),i=Wc([...n,...this._todayItems??[]]);if(!i.length&&!(e.settings.calendars??[]).length)return f;let o=this._todayOpen!==!1,s=new Intl.DateTimeFormat(t.language??navigator.language,{weekday:"long",day:"numeric",month:"long"}).format(new Date),a=t.language??navigator.language,l=u=>{if(u===1)return $(t,"tomorrow");let d=new Date;return d.setDate(d.getDate()+u),new Intl.DateTimeFormat(a,{weekday:"long",day:"numeric",month:"numeric"}).format(d)},c=i.flatMap((u,d)=>[(u.day??0)>0&&(i[d-1]?.day??0)!==u.day?p`<li class="nf-today-day">${l(u.day??0)}</li>`:f,p`<li class=${u.past?"nf-today-past":""}><time>${u.kind==="bin"?"\u{1F5D1}":u.time||"\u25CF"}</time><span>${u.title}<small>${u.source}</small></span></li>`]);return p`<section class="nf-today ${o?"":"nf-today-folded"}" aria-label=${$(t,"today")}>
|
||||
</section>`}renderToday(e){let t=this.building,n=this.hass;if(!t||!n||this.clean||this.roomId||this.panelOpen)return f;let i=this.renderForecast("top_right"),o=this.today===!1?f:this.renderTodayCard(t,n);return o===f&&i===f&&e===f?f:p`<div class="nf-right-col ${e!==f?"nf-utility-right":""}" style=${this.clock==="top_right"?"top: 78px":""}>${e}${o}${i}</div>`}renderTodayCard(e,t){let n=Oc(t,e,Date.now(),{today:$(t,"care_bin_today"),tomorrow:$(t,"care_bin_tomorrow")}),i=Wc([...n,...this._todayItems??[]]);if(!i.length&&!(e.settings.calendars??[]).length)return f;let o=this._todayOpen!==!1,s=new Intl.DateTimeFormat(t.language??navigator.language,{weekday:"long",day:"numeric",month:"long"}).format(new Date),a=t.language??navigator.language,l=u=>{if(u===1)return $(t,"tomorrow");let d=new Date;return d.setDate(d.getDate()+u),new Intl.DateTimeFormat(a,{weekday:"long",day:"numeric",month:"numeric"}).format(d)},c=i.flatMap((u,d)=>[(u.day??0)>0&&(i[d-1]?.day??0)!==u.day?p`<li class="nf-today-day">${l(u.day??0)}</li>`:f,p`<li class=${u.past?"nf-today-past":""}><time>${u.kind==="bin"?"\u{1F5D1}":u.time||"\u25CF"}</time><span>${u.title}<small>${u.source}</small></span></li>`]);return p`<section class="nf-today ${o?"":"nf-today-folded"}" aria-label=${$(t,"today")}>
|
||||
<button class="nf-today-head" aria-expanded=${o} @click=${()=>this._todayOpen=!o}>
|
||||
<b>📅 ${$(t,"today")}</b><span>${s}</span>
|
||||
</button>
|
||||
${o?i.length?p`<ul>
|
||||
${c}
|
||||
</ul>`:p`<p class="nf-today-none">${$(t,"today_none")}</p>`:f}
|
||||
</section>`}week=null;weekAt=0;refreshWeek(e){let t=this.hass;if(!t||this._travel||Date.now()-this.weekAt<36e5)return;this.weekAt=Date.now();let n=Le(e,s=>this.furnitureLinks?.get(s.id)?.power??null),i=e.energy,o={solar:i.solar?[i.solar]:n.solar,grid:i.grid??n.grid,gridInvert:!!i.grid_invert,battery:i.battery?[i.battery]:n.battery,batteryInvert:!!i.battery_invert,consumption:i.consumption};Dl(t,o).then(s=>{this.week=s,this.syncDevices(!0)}).catch(()=>this.week=null)}meterRows(e,t=null){let n=this.hass,i=[],o=this.floorId?e.floors.find(l=>l.id===this.floorId):void 0,s=o&&G(n)?hn(n,o,e.floors.flatMap(l=>l.rooms)).find(l=>l.kind==="electricity"&&l.metric==="power"&&l.unit==="W"):void 0,a=G(n)?s?.value??null:o?.power_entity?Y(n?.states[o.power_entity]):null;if(o&&(s||a!==null)){let l=!s?.incomplete&&a!==null&&t&&t>0?` \xB7 ${$(n,"floor_power_share",{n:Math.round(Math.max(0,a)/t*100)})}`:"";i.push({icon:"\u26A1",label:o.name,value:`${s?Xe(n,s):ft(n,a)}${l}`})}for(let[l,c,u]of[["gas","\u{1F525}","energy_gas_short"],["water","\u{1F4A7}","energy_water_short"]]){let d=e.energy[l],m=d?n?.states[d]:void 0;m&&!N(m)&&i.push({icon:c,label:$(n,u),value:oe(n,m)})}return i}refreshDayCurves(e){let t=this.hass;if(!t||this._travel||Date.now()-this.curvesAt<6e5)return;this.curvesAt=Date.now();let n=a=>_n(a,e,gn(a,e),Le(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),i=jl(t,n),o=Date.now(),s=o-24*36e5;yn(t,i,s,o,!0).then(a=>{this.dayCurves=ql(t,a,s,o,n),this.syncDevices(!0)}).catch(()=>this.dayCurves=null)}syncLhCards(e,t,n,i,o,s){let a=[],l=n.summary,c=l.solar!==null||l.grid!==null||l.battery!==null||l.consumption!==null,u=En(t),d=(this.floorId?t.floors.find(m=>m.id===this.floorId):void 0)??[...t.floors].sort((m,h)=>h.elevation-m.elevation)[0];if(this.liveCardsOn&&!this.dimmed&&!this.roomId&&c&&u&&d){let m=0,h=0,g=0;for(let _ of d.rooms)for(let[b,v]of _.points)m+=b,h+=v,g++;a.push({kind:"house",at:{floorId:d.id,x:g?m/g:u.x,z:g?h/g:u.z,y:d.height+(this.floorId?1.2:3.2)},summary:l,autarky:n.autarky,curves:this.dayCurves??void 0,week:this.week??void 0,meters:this.meterRows(t,l.consumption)}),this.refreshDayCurves(t),this.refreshWeek(t)}if(this.liveCardsOn&&!this.dimmed&&!this.roomId){for(let m of i)a.push({kind:"car",at:m.at,spot:m.spot,name:m.name,car:m.car});for(let m of this.livePrinters(t))a.push({kind:"printer",at:m.at,name:m.name,printer:m.printer});for(let m of this.liveHeatPumps(t))a.push({kind:"heatpump",at:m.at,name:m.name,pump:m.pump});for(let m of o)a.push({kind:"media",at:{...m.at,y:m.at.y+.5},media:m})}this.liveCardsOn&&!this.dimmed&&a.push(...Hc(s,t,this.floorId,this.roomId)),JSON.stringify(a)!==JSON.stringify(this._liveCards)&&(this._liveCards=a),e.setLiveAnchors(a.map(m=>m.at),a.length?(m,h,g,_)=>this.placeLhCard(m,h,g,_):null)}placeLhCard(e,t,n,i){let o=this.renderRoot.querySelector(`.live-card[data-i="${e}"]`);o&&(o.dataset.x=String(t),o.dataset.y=String(n),o.style.visibility=i?"visible":"hidden",e===this._liveCards.length-1&&Xc(this.renderRoot))}toggleHouseFold(){this._houseFolded=!this._houseFolded;try{localStorage.setItem("nextfloor.house_card_folded",this._houseFolded?"1":"0")}catch{}}toggleLhCards(){this._liveCardOn=!this._liveCardOn;try{localStorage.setItem("nextfloor.cards",this._liveCardOn?"1":"0")}catch{}this.syncDevices(!0)}renderTopLeft(){let e=this.clean?f:this.renderLhEnergy(),t=this.renderForecast("top_left");return this.clock!=="top_left"&&t===f||!this.hass?e:p`<div class="nf-topleft">${this.clock==="top_left"?this.renderClock(!0):f}${e}${t}</div>`}renderLhEnergy(){let e=this.ownSensors(),t=this._liveEnergy?.summary,n=!!t&&!this.roomId&&this.showEnergy&&!!this.hass&&!(t.consumption===null&&t.grid===null&&t.solar===null&&t.battery===null),o=this.building?.floors.some(c=>c.rooms.some(u=>u.climate_card))?this.renderCardToggle():f,s=this.roomNamesButton?p`<button class="nf-energy-item nf-flow-toggle nf-room-names-toggle" aria-pressed=${this.roomLabels} title=${$(this.hass,"room_names_toggle_hint")} @click=${()=>{this.roomLabels=!this.roomLabels,this.dispatchEvent(new CustomEvent("room-names-change",{detail:{value:this.roomLabels},bubbles:!0,composed:!0}))}}><span>${$(this.hass,"room_names_short")}</span><b aria-hidden="true">Aa</b></button>`:f;if(!n)return e.length||o!==f||s!==f?p`<div class="nf-energy" aria-live="off">${s}${e}${o}</div>`:f;let a=c=>$(this.hass,c),l=[];if(t.solar!==null&&l.push({cls:"solar",label:a("energy_solar"),value:ue(this.hass,t.solar)}),t.consumption!==null&&l.push({cls:"total",label:a("energy_consumption"),value:ue(this.hass,t.consumption)}),t.rest!==void 0&&t.rest!==null&&l.push({cls:"total",label:a("energy_rest"),value:ue(this.hass,t.rest)}),t.battery!==null||t.soc!==null){let c=[t.battery!==null?ue(this.hass,Math.abs(t.battery)):null,t.soc!==null?`${Math.round(t.soc)} %`:null].filter(Boolean);l.push({cls:"battery",label:a("energy_battery"),value:c.join(" \xB7 ")})}if(t.grid!==null){let c=t.grid<0;l.push({cls:c?"export":"grid",label:a(c?"energy_grid_export":"energy_gLine truncated
|
||||
</section>`}week=null;weekAt=0;refreshWeek(e){let t=this.hass;if(!t||this._travel||Date.now()-this.weekAt<36e5)return;this.weekAt=Date.now();let n=Ve(e,s=>this.furnitureLinks?.get(s.id)?.power??null),i=e.energy,o={solar:i.solar?[i.solar]:n.solar,grid:i.grid??n.grid,gridInvert:!!i.grid_invert,battery:i.battery?[i.battery]:n.battery,batteryInvert:!!i.battery_invert,consumption:i.consumption};Hl(t,o).then(s=>{this.week=s,this.syncDevices(!0)}).catch(()=>this.week=null)}meterRows(e,t=null){let n=this.hass,i=[],o=this.floorId?e.floors.find(l=>l.id===this.floorId):void 0,s=o&&K(n)?Te(n,o,e.floors.flatMap(l=>l.rooms)).find(l=>l.kind==="electricity"&&l.metric==="power"&&l.unit==="W"):void 0,a=K(n)?s?.value??null:o?.power_entity?J(n?.states[o.power_entity]):null;if(o&&(s||a!==null)){let l=!s?.incomplete&&a!==null&&t&&t>0?` \xB7 ${$(n,"floor_power_share",{n:Math.round(Math.max(0,a)/t*100)})}`:"";i.push({icon:"\u26A1",label:o.name,value:`${s?De(n,s):vt(n,a)}${l}`})}for(let[l,c,u]of[["gas","\u{1F525}","energy_gas_short"],["water","\u{1F4A7}","energy_water_short"]]){let d=e.energy[l],m=d?n?.states[d]:void 0;m&&!N(m)&&i.push({icon:c,label:$(n,u),value:oe(n,m)})}return i}refreshDayCurves(e){let t=this.hass;if(!t||this._travel||Date.now()-this.curvesAt<6e5)return;this.curvesAt=Date.now();let n=a=>yn(a,e,vn(a,e),Ve(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),i=Zl(t,n),o=Date.now(),s=o-24*36e5;kn(t,i,s,o,!0).then(a=>{this.dayCurves=Yl(t,a,s,o,n),this.syncDevices(!0)}).catch(()=>this.dayCurves=null)}syncLhCards(e,t,n,i,o,s){let a=[],l=n.summary,c=l.solar!==null||l.grid!==null||l.battery!==null||l.consumption!==null,u=Tn(t),d=(this.floorId?t.floors.find(m=>m.id===this.floorId):void 0)??[...t.floors].sort((m,h)=>h.elevation-m.elevation)[0];if(this.liveCardsOn&&!this.dimmed&&!this.roomId&&c&&u&&d){let m=0,h=0,g=0;for(let _ of d.rooms)for(let[b,v]of _.points)m+=b,h+=v,g++;a.push({kind:"house",at:{floorId:d.id,x:g?m/g:u.x,z:g?h/g:u.z,y:d.height+(this.floorId?1.2:3.2)},summary:l,autarky:n.autarky,curves:this.dayCurves??void 0,week:this.week??void 0,meters:this.meterRows(t,l.consumption)}),this.refreshDayCurves(t),this.refreshWeek(t)}if(this.liveCardsOn&&!this.dimmed&&!this.roomId){for(let m of i)a.push({kind:"car",at:m.at,spot:m.spot,name:m.name,car:m.car});for(let m of this.livePrinters(t))a.push({kind:"printer",at:m.at,name:m.name,printer:m.printer});for(let m of this.liveHeatPumps(t))a.push({kind:"heatpump",at:m.at,name:m.name,pump:m.pump});for(let m of o)a.push({kind:"media",at:{...m.at,y:m.at.y+.5},media:m})}this.liveCardsOn&&!this.dimmed&&a.push(...Ic(s,t,this.floorId,this.roomId)),JSON.stringify(a)!==JSON.stringify(this._liveCards)&&(this._liveCards=a),e.setLiveAnchors(a.map(m=>m.at),a.length?(m,h,g,_)=>this.placeLhCard(m,h,g,_):null)}placeLhCard(e,t,n,i){let o=this.renderRoot.querySelector(`.live-card[data-i="${e}"]`);o&&(o.dataset.x=String(t),o.dataset.y=String(n),o.style.visibility=i?"visible":"hidden",e===this._liveCards.length-1&&tu(this.renderRoot))}toggleHouseFold(){this._houseFolded=!this._houseFolded;try{localStorage.setItem("nextfloor.house_card_folded",this._houseFolded?"1":"0")}catch{}}toggleLhCards(){this._liveCardOn=!this._liveCardOn;try{localStorage.setItem("nextfloor.cards",this._liveCardOn?"1":"0")}catch{}this.syncDevices(!0)}renderTopLeft(){let e=this.clean?f:this.renderLhEnergy(),t=this.renderForecast("top_left");return this.clock!=="top_left"&&t===f||!this.hass?e:p`<div class="nf-topleft">${this.clock==="top_left"?this.renderClock(!0):f}${e}${t}</div>`}renderLhEnergy(){let e=this.ownSensors(),t=this._liveEnergy?.summary,n=!!t&&!this.roomId&&this.showEnergy&&!!this.hass&&!(t.consumption===null&&t.grid===null&&t.solar===null&&t.battery===null),o=this.building?.floors.some(c=>c.rooms.some(u=>u.climate_card))?this.renderCardToggle():f,s=this.roomNamesButton?p`<button class="nf-energy-item nf-flow-toggle nf-room-names-toggle" aria-pressed=${this.roomLabels} title=${$(this.hass,"room_names_toggle_hint")} @click=${()=>{this.roomLabels=!this.roomLabels,this.dispatchEvent(new CustomEvent("room-names-change",{detail:{value:this.roomLabels},bubbles:!0,composed:!0}))}}><span>${$(this.hass,"room_names_short")}</span><b aria-hidden="true">Aa</b></button>`:f;if(!n)return e.length||o!==f||s!==f?p`<div class="nf-energy" aria-live="off">${s}${e}${o}</div>`:f;let a=c=>$(this.hass,c),l=[];if(t.solar!==null&&l.push({cls:"solar",label:a("energy_solar"),value:ue(this.hass,t.solar)}),t.consumption!==null&&l.push({cls:"total",label:a("energy_consumption"),value:ue(this.hass,t.consumption)}),t.rest!==void 0&&t.rest!==null&&l.push({cls:"total",label:a("energy_rest"),value:ue(this.hass,t.rest)}),t.battery!==null||t.soc!==null){let c=[t.battery!==null?ue(this.hass,Math.abs(t.battery)):null,t.soc!==null?`${Math.round(t.soc)} %`:null].filter(Boolean);l.push({cls:"battery",label:a("energy_battery"),value:c.join(" \xB7 ")})}if(t.grid!==null){let c=t.grid<0;l.push({cls:c?"export":"grid",label:a(c?"energy_grid_export":"energy_gLine truncated
|
||||
${s}
|
||||
${this.liveCardsOn&&this._liveCards.some(c=>c.kind==="house")?f:l.map(c=>p`<div class="nf-energy-item nf-energy-${c.cls}"><span>${c.label}</span><b>${c.value}</b></div>`)}
|
||||
${this.flows!==null?f:p`<button class="nf-energy-item nf-flow-toggle" aria-pressed=${this._flows} title=${a("flows_hint")} aria-label=${a("flows")} @click=${()=>this.toggleFlows()}>
|
||||
@@ -1762,35 +1796,36 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${e}
|
||||
</div>`}renderCardToggle(){return this.holograms!==null?f:p`<button class="nf-energy-item nf-flow-toggle nf-card-toggle" aria-pressed=${this._liveCardOn} title=${$(this.hass,"holos_hint")} aria-label=${$(this.hass,"holos")} @click=${()=>this.toggleLhCards()}>
|
||||
<span>${$(this.hass,"holos")}</span><b>◫</b>
|
||||
</button>`}ownSensors(){let e=this.sensorBar&&this.hass?this.building?.settings.status_entities??[]:[],t=G(this.hass)?(this.building?.presence??[]).filter(a=>qa(this.hass,a.person,[0])).map(a=>p`<div class="nf-energy-item nf-presence-state"><span>${a.name||L(this.hass,a.person)}</span><b>${se(this.hass.states[a.person])===null?"\u2013":se(this.hass.states[a.person])?"Anwesend":"Abwesend"}${j(this.hass,[a.person],a.name||"Anwesenheit")}</b></div>`):[],n=G(this.hass)?Object.entries(this.building?.settings.weather_variables??{}).filter(a=>!!a[1]&&a[1]!=="none").map(([a,l])=>[hu[a]||a,l]):[];G(this.hass)&&this.building?.settings.rain_sensor&&this.building.settings.rain_sensor!=="none"&&n.push(["Regensensor",this.building.settings.rain_sensor]);let i=n.length?p`<button class="nf-energy-item nf-flow-toggle nf-weather-values" aria-label="Wetterwerte anzeigen" title="Wetterwerte anzeigen" aria-haspopup="dialog" @click=${()=>this.renderRoot.querySelector(".nf-weather-dialog")?.showModal()}><span>Wetter</span><b aria-hidden="true">⛅</b></button>
|
||||
<dialog class="nf-weather-dialog" aria-label="Wetterwerte" @keydown=${a=>a.stopPropagation()}><header><b>Wetter</b><button type="button" class="nf-chip" aria-label="Schließen" @click=${()=>this.renderRoot.querySelector(".nf-weather-dialog")?.close()}>×</button></header>${n.map(([a,l])=>p`<p><span>${a}</span><b>${Qe(this.hass.states[l])}${j(this.hass,[l],a)}</b></p>`)}</dialog>`:f,o=G(this.hass)?(this.building?.floors??[]).filter(a=>!this.floorId||a.id===this.floorId).map(a=>({floor:a,readings:hn(this.hass,a,this.building?.floors.flatMap(l=>l.rooms))})).filter(a=>a.readings.length):[],s=o.length?p`<button class="nf-energy-item nf-flow-toggle nf-utility-toggle" aria-label="Stockwerkszähler anzeigen" title="Stockwerkszähler anzeigen" aria-haspopup="dialog" @click=${()=>this.renderRoot.querySelector(".nf-utility-dialog")?.showModal()}><span>Stockwerkszähler</span><b aria-hidden="true">⚡ 💧</b></button>
|
||||
<dialog class="nf-weather-dialog nf-utility-dialog" aria-label="Stockwerkszähler" @keydown=${a=>a.stopPropagation()}><header><b>Stockwerkszähler</b><button type="button" class="nf-chip" aria-label="Schließen" @click=${()=>this.renderRoot.querySelector(".nf-utility-dialog")?.close()}>×</button></header>${o.map(({floor:a,readings:l})=>p`<h3>${a.name}</h3><nf-utility-report .hass=${this.hass} .readings=${l}></nf-utility-report>`)}</dialog>`:f;return[...t,i,s,...e.filter(a=>this.hass.states[a]).map(a=>p`<button class="nf-energy-item nf-own-sensor" title=${L(this.hass,a)} @click=${()=>ye(this,a)}>
|
||||
<span>${L(this.hass,a)}</span><b>${oe(this.hass,this.hass.states[a])}</b>
|
||||
</button>${j(this.hass,[a],L(this.hass,a))}`)]}renderMapCredit(){let e=this.building?.settings.map;return bc(e)?p`<a class="nf-map-credit" href=${bo(e).href} target="_blank" rel="noopener">${bo(e).text}</a>`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=pt(new Date,this.hass?.config?.latitude??50),t=Er(this.heatMode,e),n=this.heatMode==="temperature",i=n?ae(this.hass,t.stops[0][0]):t.stops[0][0],o=n?ae(this.hass,t.stops[t.stops.length-1][0]):t.stops[t.stops.length-1][0],s=n?re(this.hass):t.unit,a=l=>$(this.hass,l);return p`<div class="nf-legend">
|
||||
</button>`}utilityOverview(e){let t=this.building;if(!t||!K(this.hass)||!this.showEnergy||this.clean||this.roomId||this.panelOpen)return f;let n=t.floors.flatMap(o=>o.rooms);return(this.floorId?t.floors.filter(o=>o.id===this.floorId):t.floors).some(o=>Te(this.hass,o,n).length)?p`<nf-utility-overview ?inline=${e} .hass=${this.hass} .floors=${t.floors} .floorId=${this.floorId} .compact=${this._narrowStage}
|
||||
@utility-open=${o=>{o.stopPropagation(),o.detail.roomId?this.openRoom(o.detail.floorId,o.detail.roomId):this.fire("floor-tap",{floorId:o.detail.floorId})}}></nf-utility-overview>`:f}ownSensors(){let e=this.sensorBar&&this.hass?this.building?.settings.status_entities??[]:[],t=K(this.hass)?(this.building?.presence??[]).filter(a=>Ja(this.hass,a.person,[0])).map(a=>p`<div class="nf-energy-item nf-presence-state"><span>${a.name||O(this.hass,a.person)}</span><b>${se(this.hass.states[a.person])===null?"\u2013":se(this.hass.states[a.person])?"Anwesend":"Abwesend"}${U(this.hass,[a.person],a.name||"Anwesenheit")}</b></div>`):[],n=K(this.hass)?Object.entries(this.building?.settings.weather_variables??{}).filter(a=>!!a[1]&&a[1]!=="none").map(([a,l])=>[pu[a]||a,l]):[];K(this.hass)&&this.building?.settings.rain_sensor&&this.building.settings.rain_sensor!=="none"&&n.push(["Regensensor",this.building.settings.rain_sensor]);let i=n.length?p`<button class="nf-energy-item nf-flow-toggle nf-weather-values" aria-label="Wetterwerte anzeigen" title="Wetterwerte anzeigen" aria-haspopup="dialog" @click=${()=>this.renderRoot.querySelector(".nf-weather-dialog")?.showModal()}><span>Wetter</span><b aria-hidden="true">⛅</b></button>
|
||||
<dialog class="nf-weather-dialog" aria-label="Wetterwerte" @keydown=${a=>a.stopPropagation()}><header><b>Wetter</b><button type="button" class="nf-chip" aria-label="Schließen" @click=${()=>this.renderRoot.querySelector(".nf-weather-dialog")?.close()}>×</button></header>${n.map(([a,l])=>p`<p><span>${a}</span><b>${nt(this.hass.states[l])}${U(this.hass,[l],a)}</b></p>`)}</dialog>`:f,o=K(this.hass)?(this.building?.floors??[]).filter(a=>!this.floorId||a.id===this.floorId).map(a=>({floor:a,readings:Te(this.hass,a,this.building?.floors.flatMap(l=>l.rooms))})).filter(a=>a.readings.length):[],s=o.length?p`<button class="nf-energy-item nf-flow-toggle nf-utility-toggle" aria-label="Stockwerkszähler anzeigen" title="Stockwerkszähler anzeigen" aria-haspopup="dialog" @click=${()=>this.renderRoot.querySelector(".nf-utility-dialog")?.showModal()}><span>Stockwerkszähler</span><b aria-hidden="true">⚡ 💧</b></button>
|
||||
<dialog class="nf-weather-dialog nf-utility-dialog" aria-label="Stockwerkszähler" @keydown=${a=>a.stopPropagation()}><header><b>Stockwerkszähler</b><button type="button" class="nf-chip" aria-label="Schließen" @click=${()=>this.renderRoot.querySelector(".nf-utility-dialog")?.close()}>×</button></header>${o.map(({floor:a,readings:l})=>p`<h3>${a.name}</h3><nf-utility-report .hass=${this.hass} .readings=${l}></nf-utility-report>`)}</dialog>`:f;return[this.utilityOverview(!0),...t,i,s,...e.filter(a=>this.hass.states[a]).map(a=>p`<button class="nf-energy-item nf-own-sensor" title=${O(this.hass,a)} @click=${()=>ye(this,a)}>
|
||||
<span>${O(this.hass,a)}</span><b>${oe(this.hass,this.hass.states[a])}</b>
|
||||
</button>${U(this.hass,[a],O(this.hass,a))}`)]}renderMapCredit(){let e=this.building?.settings.map;return yc(e)?p`<a class="nf-map-credit" href=${yo(e).href} target="_blank" rel="noopener">${yo(e).text}</a>`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=bt(new Date,this.hass?.config?.latitude??50),t=zr(this.heatMode,e),n=this.heatMode==="temperature",i=n?ae(this.hass,t.stops[0][0]):t.stops[0][0],o=n?ae(this.hass,t.stops[t.stops.length-1][0]):t.stops[t.stops.length-1][0],s=n?re(this.hass):t.unit,a=l=>$(this.hass,l);return p`<div class="nf-legend">
|
||||
<b>${a(`heat_${this.heatMode}`)}${this.heatMode==="temperature"?p` <small>${a(e?"heat_summer":"heat_winter")}</small>`:f}</b>
|
||||
<span class="nf-legend-bar" style="background:${Tl(this.heatMode,e)}"></span>
|
||||
<span class="nf-legend-range"><span>${W(this.hass,i,0)} ${s}</span><span>${W(this.hass,o,0)} ${s}</span></span>
|
||||
<span class="nf-legend-bar" style="background:${Fl(this.heatMode,e)}"></span>
|
||||
<span class="nf-legend-range"><span>${L(this.hass,i,0)} ${s}</span><span>${L(this.hass,o,0)} ${s}</span></span>
|
||||
${this.heatValues.size?f:p`<span class="nf-legend-none">${a("heat_none_found")}</span>`}
|
||||
</div>`}renderWifiLegend(){let e=this.hass,t=this.building;if(!e||!t)return f;let n=(c,u)=>$(e,c,u),i=t.floors.flatMap(c=>c.furniture.filter(u=>zo(u.type)).map(u=>To(e,this.furnitureLinks?.get(u.id)?.entity??this.furnitureLinks?.get(u.id)?.power??null))),s=i.filter(c=>!!c).reduce((c,u)=>c+(u.clients??0),0),a=t.floors.flatMap(c=>c.placements.map(u=>e.states[u.entity_id])),l=Zc(a);return p`<div class="nf-legend">
|
||||
</div>`}renderWifiLegend(){let e=this.hass,t=this.building;if(!e||!t)return f;let n=(c,u)=>$(e,c,u),i=t.floors.flatMap(c=>c.furniture.filter(u=>Do(u.type)).map(u=>Fo(e,this.furnitureLinks?.get(u.id)?.entity??this.furnitureLinks?.get(u.id)?.power??null))),s=i.filter(c=>!!c).reduce((c,u)=>c+(u.clients??0),0),a=t.floors.flatMap(c=>c.placements.map(u=>e.states[u.entity_id])),l=Jc(a);return p`<div class="nf-legend">
|
||||
<b>📶 ${n("heat_wifi")}</b>
|
||||
<span>${n("wifi_aps",{n:i.length,clients:s})}</span>
|
||||
${l.online+l.offline.length?p`<span>${n("wifi_network",{online:l.online,offline:l.offline.length})}</span>`:f}
|
||||
${l.offline.length?p`<span class="nf-legend-none">${l.offline.slice(0,4).join(", ")}</span>`:f}
|
||||
${i.length?f:p`<span class="nf-legend-none">${n("wifi_none")}</span>`}
|
||||
</div>`}skyColor(){let e=xn[this.theme]??xn.neon,t=this._sky;return e.night[0].map((n,i)=>Math.round(n+(e.day[0][i]-n)*t))}render(){let e=this._sky,t=(o,s)=>`rgb(${o.map((a,l)=>Math.round(a+(s[l]-a)*e)).join(",")})`,n=xn[this.theme]??xn.neon,i=`--nf-sky:${t(n.night[0],n.day[0])};--nf-ground:${t(n.night[1],n.day[1])}`+Zl(this.building?.settings.backdrop);return p`<div
|
||||
class="nf-stage ${this.roomLabels?"":"nf-no-room-names"} ${this._low?"nf-low":""} ${this.panelOpen?"nf-panel-open":""} ${this._alerts.length?"nf-has-alerts":""} ${this._narrowStage?"nf-narrow":""}"
|
||||
style=${i}
|
||||
</div>`}skyColor(){let e=$n[this.theme]??$n.neon,t=this._sky;return e.night[0].map((n,i)=>Math.round(n+(e.day[0][i]-n)*t))}render(){let e=this.utilityOverview(!1),t=this._sky,n=(s,a)=>`rgb(${s.map((l,c)=>Math.round(l+(a[c]-l)*t)).join(",")})`,i=$n[this.theme]??$n.neon,o=`--nf-sky:${n(i.night[0],i.day[0])};--nf-ground:${n(i.night[1],i.day[1])}`+Jl(this.building?.settings.backdrop);return p`<div
|
||||
class="nf-stage ${this.roomLabels?"":"nf-no-room-names"} ${this._low?"nf-low":""} ${this.panelOpen?"nf-panel-open":""} ${this._alerts.length?"nf-has-alerts":""} ${this._narrowStage?"nf-narrow":""} ${e!==f?"nf-has-utility-overview":""}"
|
||||
style=${o}
|
||||
>
|
||||
${this._error?p`<p class="nf-error">${this._error}</p>`:f} ${this.renderTopLeft()} ${eu(this.hass,this._liveCards,(o,s,a,l)=>this.hass?.callService(o,s,{entity_id:a,...l}),{folded:this._houseFolded,toggle:()=>this.toggleHouseFold()},!!this.roomId||this.panelOpen)} ${this.clean?f:this.renderLegend()} ${this.renderMapCredit()}
|
||||
${this._error?p`<p class="nf-error">${this._error}</p>`:f} ${this.renderTopLeft()} ${nu(this.hass,this._liveCards,(s,a,l,c)=>this.hass?.callService(s,a,{entity_id:l,...c}),{folded:this._houseFolded,toggle:()=>this.toggleHouseFold()},!!this.roomId||this.panelOpen)} ${this.clean?f:this.renderLegend()} ${this.renderMapCredit()}
|
||||
${this.renderAlerts()} ${this.renderAnnouncement()} ${this.clean?f:p`${this.renderThumbs()} ${this.renderScenes()} ${this.renderFind()} ${this.renderCentral()}`} ${this.renderSwipe()}
|
||||
${this.renderMenu()} ${this.renderPlate()} ${this.renderEye()} ${this.renderLock()} ${this.renderWalk()} ${this.renderTravel()} ${this.renderClock()} ${this.renderToday()} ${this.renderLayers()} ${this.renderPluginWindow()}
|
||||
${this.renderMenu()} ${this.renderPlate()} ${this.renderEye()} ${this.renderLock()} ${this.renderWalk()} ${this.renderTravel()} ${this.renderClock()} ${this.renderToday(e)} ${this.renderLayers()} ${this.renderPluginWindow()}
|
||||
${this.showStats&&this._stats?p`<span class="nf-stats"
|
||||
><b>${this._stats.fps?$(this.hass,"stats_fps",{fps:this._stats.fps,ms:this._stats.worstMs}):$(this.hass,"stats_idle")}</b>
|
||||
${this._stats.busy.length?p`(${this._stats.busy.map(o=>$(this.hass,`stats_busy_${o}`)).join(", ")})`:f} ·
|
||||
${this._stats.busy.length?p`(${this._stats.busy.map(s=>$(this.hass,`stats_busy_${s}`)).join(", ")})`:f} ·
|
||||
${$(this.hass,"stats",{calls:this._stats.calls,tris:this._stats.triangles.toLocaleString()})} ·
|
||||
${$(this.hass,this._stats.low?"stats_low":"stats_full",{r:W(this.hass,this._stats.pixelRatio,2)})}</span
|
||||
${$(this.hass,this._stats.low?"stats_low":"stats_full",{r:L(this.hass,this._stats.pixelRatio,2)})}</span
|
||||
>`:f}
|
||||
</div>`}static styles=[ge,Re,tu,X`
|
||||
</div>`}static styles=[ge,Re,ru,Y`
|
||||
:host {
|
||||
display: block;
|
||||
position: relative;
|
||||
@@ -2356,6 +2391,24 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.nf-right-col > * {
|
||||
pointer-events: auto;
|
||||
}
|
||||
.nf-utility-right {
|
||||
height: calc(100% - 140px);
|
||||
}
|
||||
.nf-has-utility-overview:not(.nf-narrow) > .nf-energy,
|
||||
.nf-has-utility-overview:not(.nf-narrow) > .nf-topleft {
|
||||
max-width: calc(100% - 316px);
|
||||
}
|
||||
.nf-has-utility-overview .nf-energy {
|
||||
align-items: flex-start;
|
||||
}
|
||||
.nf-narrow .nf-utility-right {
|
||||
top: auto !important;
|
||||
bottom: 64px;
|
||||
height: 42%;
|
||||
max-height: 42%;
|
||||
justify-content: flex-end;
|
||||
width: min(280px, calc(100% - 24px));
|
||||
}
|
||||
.nf-has-alerts .nf-right-col {
|
||||
top: 58px;
|
||||
}
|
||||
@@ -3373,26 +3426,26 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
inset: auto 16px 16px;
|
||||
color: var(--nf-danger);
|
||||
}
|
||||
`]};customElements.get("nf-view3d")||customElements.define("nf-view3d",Wo);function ue(r,e){return Math.abs(e)>=1e3?`${W(r,e/1e3,1)} kW`:`${Math.round(e)} W`}function Co(r){return r.type==="tv_board"?r.h+.9:r.type==="tv_wall"||r.type==="kitchen_wall"?r.h+.25:r.h+.35}function xf(r,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:oe(r,e)}var yu;function wu(){let r=new URL("./nextfloor-editor.js?v=a5e498ee85e7",new URL(import.meta.url)).href;return yu??=import(r),yu}var kf=.25,xu=r=>Math.round(r*1e3)/1e3,ku=(r,e,t)=>r.rooms.find(n=>n.points.length>=3&&I([e,t],n.points));function Oo(r,e,t,n,i){let o=ku(r,e,t);if(!o)return[n,i];let s=(a,l)=>I([a,l],o.points);return s(n,i)?[n,i]:s(n,t)?[n,t]:s(e,i)?[e,i]:[e,t]}function Sf(r,e,t,n){return r.rooms.some(i=>i.id!==e.id&&i.points.some((o,s)=>{let a=i.points[(s+1)%i.points.length];return Math.abs(le(Q(o,t),n))<.02&&Math.abs(le(Q(a,t),n))<.02}))}var Lo=(r,e)=>Math.abs((r-e+540)%360-180);function Su(r,e,t,n=kf){let i=ku(r,e.x,e.z);if(!i)return null;let o=i.points,s=ut(o)>=0?1:-1,a=null;return o.forEach((l,c)=>{let u=o[(c+1)%o.length],d=We(Q(u,l));if(d<.3)return;let m=[(u[0]-l[0])/d,(u[1]-l[1])/d],h=[-m[1]*s,m[0]*s],g=le(Q([e.x,e.z],l),m);if(g<0||g>d)return;let _=Sf(r,i,l,h)?t/2:0,b=le(Q([e.x,e.z],l),h)-_,v=Math.atan2(-h[0],h[1])*180/Math.PI,k=[{rotation:v,extent:e.d/2},{rotation:v+90,extent:e.w/2},{rotation:v-90,extent:e.w/2}].reduce((z,R)=>Lo(e.rotation,R.rotation)<Lo(e.rotation,z.rotation)?R:z);if(Lo(e.rotation,k.rotation)>50)return;let M=b-k.extent;Math.abs(M)>n||a&&Math.abs(M)>=Math.abs(a.gap)||(a={x:xu(e.x-h[0]*M),z:xu(e.z-h[1]*M),rotation:(Math.round(k.rotation)%360+360)%360,gap:M})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function Zr(r,e,t){let n=structuredClone(r);for(let i of n.floors){let o=i.furniture.find(s=>s.id===e);o&&t(o,i)}return n}function Yr(r,e,t){let n=structuredClone(r);for(let i of n.floors){let o=i.placements.find(s=>s.entity_id===e);o&&t(o,i)}return n}function $u(r,e){let t=structuredClone(r);for(let n of t.floors)n.furniture=n.furniture.filter(i=>i.id!==e);return t}function Mu(r,e){let t=structuredClone(r);for(let n of t.floors)n.placements=n.placements.filter(i=>i.entity_id!==e);return t}function Au(r,e,t,n){return Yr(r,e,(i,o)=>{[i.x,i.z]=Oo(o,i.x,i.z,t,n)})}function Eu(r,e,t,n){let i=r.settings.wall_interior??.12;return Zr(r,e,(o,s)=>{[o.x,o.z]=Oo(s,o.x,o.z,t,n);let a=Su(s,o,i);a&&Object.assign(o,a)})}var Bo=(r,e)=>((r+e)%360+360)%360,Ru=r=>Number.parseFloat(r.replace(",",".")),Pn=(r,e)=>Math.round(r*10**e)/10**e;function Vo(r){let{min:e,max:t,accepts:n=()=>!0}=r,i=o=>{let s=Ru(o.target.value);!Number.isFinite(s)||!n(s)||r.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return p`<label class="nf-size" title=${r.title}
|
||||
`]};customElements.get("nf-view3d")||customElements.define("nf-view3d",Bo);function ue(r,e){return Math.abs(e)>=1e3?`${L(r,e/1e3,1)} kW`:`${Math.round(e)} W`}function Wo(r){return r.type==="tv_board"?r.h+.9:r.type==="tv_wall"||r.type==="kitchen_wall"?r.h+.25:r.h+.35}function Sf(r,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:oe(r,e)}var xu;function ku(){let r=new URL("./nextfloor-editor.js?v=178935170cc1",new URL(import.meta.url)).href;return xu??=import(r),xu}var $f=.25,Su=r=>Math.round(r*1e3)/1e3,$u=(r,e,t)=>r.rooms.find(n=>n.points.length>=3&&I([e,t],n.points));function Ko(r,e,t,n,i){let o=$u(r,e,t);if(!o)return[n,i];let s=(a,l)=>I([a,l],o.points);return s(n,i)?[n,i]:s(n,t)?[n,t]:s(e,i)?[e,i]:[e,t]}function Mf(r,e,t,n){return r.rooms.some(i=>i.id!==e.id&&i.points.some((o,s)=>{let a=i.points[(s+1)%i.points.length];return Math.abs(le(ee(o,t),n))<.02&&Math.abs(le(ee(a,t),n))<.02}))}var Vo=(r,e)=>Math.abs((r-e+540)%360-180);function Mu(r,e,t,n=$f){let i=$u(r,e.x,e.z);if(!i)return null;let o=i.points,s=pt(o)>=0?1:-1,a=null;return o.forEach((l,c)=>{let u=o[(c+1)%o.length],d=Be(ee(u,l));if(d<.3)return;let m=[(u[0]-l[0])/d,(u[1]-l[1])/d],h=[-m[1]*s,m[0]*s],g=le(ee([e.x,e.z],l),m);if(g<0||g>d)return;let _=Mf(r,i,l,h)?t/2:0,b=le(ee([e.x,e.z],l),h)-_,v=Math.atan2(-h[0],h[1])*180/Math.PI,k=[{rotation:v,extent:e.d/2},{rotation:v+90,extent:e.w/2},{rotation:v-90,extent:e.w/2}].reduce((z,R)=>Vo(e.rotation,R.rotation)<Vo(e.rotation,z.rotation)?R:z);if(Vo(e.rotation,k.rotation)>50)return;let M=b-k.extent;Math.abs(M)>n||a&&Math.abs(M)>=Math.abs(a.gap)||(a={x:Su(e.x-h[0]*M),z:Su(e.z-h[1]*M),rotation:(Math.round(k.rotation)%360+360)%360,gap:M})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function Jr(r,e,t){let n=structuredClone(r);for(let i of n.floors){let o=i.furniture.find(s=>s.id===e);o&&t(o,i)}return n}function Qr(r,e,t){let n=structuredClone(r);for(let i of n.floors){let o=i.placements.find(s=>s.entity_id===e);o&&t(o,i)}return n}function Au(r,e){let t=structuredClone(r);for(let n of t.floors)n.furniture=n.furniture.filter(i=>i.id!==e);return t}function Eu(r,e){let t=structuredClone(r);for(let n of t.floors)n.placements=n.placements.filter(i=>i.entity_id!==e);return t}function Ru(r,e,t,n){return Qr(r,e,(i,o)=>{[i.x,i.z]=Ko(o,i.x,i.z,t,n)})}function zu(r,e,t,n){let i=r.settings.wall_interior??.12;return Jr(r,e,(o,s)=>{[o.x,o.z]=Ko(s,o.x,o.z,t,n);let a=Mu(s,o,i);a&&Object.assign(o,a)})}var Go=(r,e)=>((r+e)%360+360)%360,Tu=r=>Number.parseFloat(r.replace(",",".")),Cn=(r,e)=>Math.round(r*10**e)/10**e;function Uo(r){let{min:e,max:t,accepts:n=()=>!0}=r,i=o=>{let s=Tu(o.target.value);!Number.isFinite(s)||!n(s)||r.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return p`<label class="nf-size" title=${r.title}
|
||||
>${r.label}
|
||||
<input type="number" inputmode="decimal" step=${r.step} min=${e} max=${t??f} .value=${String(Pn(r.value,2))} @change=${i} />
|
||||
</label>`}var Tu=(r,e)=>p`<button class="nf-chip" @click=${e}>${r.t("height_auto")}</button>`,zu=(r,e)=>p`<button class="nf-chip" @click=${()=>e(-r)}>↺ ${r}°</button><button class="nf-chip" @click=${()=>e(r)}>↻ ${r}°</button>`;function $f(r,e){let t=r.building.floors.find(s=>s.furniture.some(a=>a.id===e)),n=t?.furniture.find(s=>s.id===e);if(!t||!n)return f;let i=(s,a)=>Vo({label:r.t(a),title:r.t(`size_${s}`),value:n[s],step:.05,min:.05,accepts:l=>l>0,apply:l=>r.editFurniture(e,c=>c[s]=Pn(l,3))}),o=Ks(n)?p`${Vo({label:"\u2195",title:r.t("mount_height"),value:n.mount_y??he(t,n),step:.05,min:0,accepts:s=>s>=0,apply:s=>r.editFurniture(e,a=>a.mount_y=Pn(s,3))})}
|
||||
${n.mount_y!=null?Tu(r,()=>r.editFurniture(e,s=>s.mount_y=null)):f}`:f;return p`${i("w","size_short_w")}${i("d","size_short_d")}${i("h","size_short_h")} ${o}`}function Mf(r,e){let t=r.building.floors.find(l=>l.placements.some(c=>c.entity_id===e)),n=t?.placements.find(l=>l.entity_id===e);if(!t||!n)return f;let i=H(e),o=(l,c,u)=>p`<select class="nf-size-select" title=${r.t(l)} @change=${d=>r.editDevice(e,m=>Object.assign(m,{mount:d.target.value,y:null}))}>
|
||||
<input type="number" inputmode="decimal" step=${r.step} min=${e} max=${t??f} .value=${String(Cn(r.value,2))} @change=${i} />
|
||||
</label>`}var Fu=(r,e)=>p`<button class="nf-chip" @click=${e}>${r.t("height_auto")}</button>`,Du=(r,e)=>p`<button class="nf-chip" @click=${()=>e(-r)}>↺ ${r}°</button><button class="nf-chip" @click=${()=>e(r)}>↻ ${r}°</button>`;function Af(r,e){let t=r.building.floors.find(s=>s.furniture.some(a=>a.id===e)),n=t?.furniture.find(s=>s.id===e);if(!t||!n)return f;let i=(s,a)=>Uo({label:r.t(a),title:r.t(`size_${s}`),value:n[s],step:.05,min:.05,accepts:l=>l>0,apply:l=>r.editFurniture(e,c=>c[s]=Cn(l,3))}),o=js(n)?p`${Uo({label:"\u2195",title:r.t("mount_height"),value:n.mount_y??he(t,n),step:.05,min:0,accepts:s=>s>=0,apply:s=>r.editFurniture(e,a=>a.mount_y=Cn(s,3))})}
|
||||
${n.mount_y!=null?Fu(r,()=>r.editFurniture(e,s=>s.mount_y=null)):f}`:f;return p`${i("w","size_short_w")}${i("d","size_short_d")}${i("h","size_short_h")} ${o}`}function Ef(r,e){let t=r.building.floors.find(l=>l.placements.some(c=>c.entity_id===e)),n=t?.placements.find(l=>l.entity_id===e);if(!t||!n)return f;let i=H(e),o=(l,c,u)=>p`<select class="nf-size-select" title=${r.t(l)} @change=${d=>r.editDevice(e,m=>Object.assign(m,{mount:d.target.value,y:null}))}>
|
||||
${c.map(([d,m])=>p`<option value=${d} ?selected=${d===u}>${m}</option>`)}
|
||||
</select>`,s=["ceiling","floor","table","wall"].map(l=>[l,r.t(`lamp_${l}`)]),a=i?Et(i,ve(t,n.x,n.z),i==="light"?n.mount??"ceiling":null):1;return p`${i==="light"?o("lamp_mount",s,n.mount??"ceiling"):f}
|
||||
${Vo({label:r.t("size_short_h"),title:r.t("marker_height"),value:n.y??a,step:.05,min:0,accepts:l=>l>=0,apply:l=>r.editDevice(e,c=>c.y=Pn(l,3))})}
|
||||
${n.y!==null?Tu(r,()=>r.editDevice(e,l=>l.y=null)):f}`}function Du(r,e,t){let n=r.t,i;if(e){let o=r.building.floors.flatMap(s=>s.furniture).find(s=>s.id===e)?.type;i=p`<span>${o?_e(r.hass,o):""}</span>
|
||||
${$f(r,e)} ${zu(45,s=>r.turnFurniture(e,s))}
|
||||
</select>`,s=["ceiling","floor","table","wall"].map(l=>[l,r.t(`lamp_${l}`)]),a=i?Dt(i,ve(t,n.x,n.z),i==="light"?n.mount??"ceiling":null):1;return p`${i==="light"?o("lamp_mount",s,n.mount??"ceiling"):f}
|
||||
${Uo({label:r.t("size_short_h"),title:r.t("marker_height"),value:n.y??a,step:.05,min:0,accepts:l=>l>=0,apply:l=>r.editDevice(e,c=>c.y=Cn(l,3))})}
|
||||
${n.y!==null?Fu(r,()=>r.editDevice(e,l=>l.y=null)):f}`}function Hu(r,e,t){let n=r.t,i;if(e){let o=r.building.floors.flatMap(s=>s.furniture).find(s=>s.id===e)?.type;i=p`<span>${o?_e(r.hass,o):""}</span>
|
||||
${Af(r,e)} ${Du(45,s=>r.turnFurniture(e,s))}
|
||||
<button class="nf-chip" title=${n("furn_mirror_hint")} @click=${()=>r.editFurniture(e,s=>s.mirror=!s.mirror)}>⇋ ${n("furn_mirror")}</button>
|
||||
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeFurniture(e)}>${n("delete")}</button>`}else t?i=p`<span>${L(r.hass,t)}</span>
|
||||
${Mf(r,t)} ${zu(45,o=>r.turnDevice(t,o))}
|
||||
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeDevice(t)}>${n("delete")}</button>`:i=p`<span>${n("furnish_hint")}</span>`;return p`<div class="nf-furnish-bar">${i}<button class="nf-chip nf-chip-on" @click=${()=>r.finish()}>${n("done")}</button></div>`}var Fu=ne`<svg class="nf-mark" viewBox="60 40 392 420" aria-hidden="true">
|
||||
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeFurniture(e)}>${n("delete")}</button>`}else t?i=p`<span>${O(r.hass,t)}</span>
|
||||
${Ef(r,t)} ${Du(45,o=>r.turnDevice(t,o))}
|
||||
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeDevice(t)}>${n("delete")}</button>`:i=p`<span>${n("furnish_hint")}</span>`;return p`<div class="nf-furnish-bar">${i}<button class="nf-chip nf-chip-on" @click=${()=>r.finish()}>${n("done")}</button></div>`}var Pu=ne`<svg class="nf-mark" viewBox="60 40 392 420" aria-hidden="true">
|
||||
<polygon points="106,150 256,66 406,150 256,234" fill="none" stroke="currentColor" stroke-opacity=".55" stroke-width="12" stroke-dasharray="6 22" stroke-linecap="round"/>
|
||||
<polygon points="106,382 256,466 256,488 106,404" fill="#34507d"/><polygon points="406,382 256,466 256,488 406,404" fill="#2a4068"/><polygon points="106,382 256,298 406,382 256,466" fill="#5f7fb6"/>
|
||||
<polygon points="106,310 256,394 256,416 106,332" fill="#4a72b8"/><polygon points="406,310 256,394 256,416 406,332" fill="#3b5c98"/><polygon points="106,310 256,226 406,310 256,394" fill="#8ab6f5"/>
|
||||
<polygon points="106,238 256,322 256,344 106,260" fill="#2a74d8"/><polygon points="406,238 256,322 256,344 406,260" fill="#2161b8"/><polygon points="106,238 256,154 406,238 256,322" fill="#4fb6ff"/>
|
||||
<circle cx="256" cy="236" r="16" fill="#ffe08a"/>
|
||||
</svg>`;var de=(r,e)=>({name:r,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),Kt=(r,e,t)=>({name:r,fallback:t,read:n=>e.find(i=>i===n)??t,write:n=>n}),Ko={explode:de("explode",!0),keepRoof:de("roof",!1),solidWalls:de("solid_walls",!1),quality:Kt("quality",["auto","low","high"],"auto"),stats:de("stats",!1),markers:Kt("markers",["none","important","all"],"important"),heat:Kt("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:Kt("theme",Pr,"neon"),clock:Kt("clock",["none","top_left","top_right","bottom_left","bottom_right"],"none"),accent:{name:"accent",fallback:null,read:r=>/^#[0-9a-f]{6}$/i.test(r)?r:null,write:r=>r??""},floorStack:Kt("floor_stack",["dim","stacked","single"],"dim"),roomNames:de("room_names",!0),clean:de("clean",!1),navWrap:de("nav_wrap",!1),weather:de("weather",!0),timeSlider:de("time_slider",!1),menuOpen:de("menu_open",!1),keepCamera:de("keep_camera",!1),readable:de("readable",!1),plain:de("plain",!1),rightBack:de("right_back",!1),zoom:{name:"zoom",fallback:100,read:r=>/^\d{2,3}$/.test(r)?Math.min(250,Math.max(60,Number(r))):100,write:r=>String(Math.round(Math.min(250,Math.max(60,r))))},screenName:{name:"screen_name",fallback:"",read:r=>r.slice(0,60),write:r=>r.trim().slice(0,60)},announceMuted:de("announce_muted",!1),glassWalls:{name:"glass_walls",fallback:20,read:r=>/^\d{1,3}$/.test(r)?Math.min(100,Number(r)):20,write:r=>String(Math.round(Math.min(100,Math.max(0,r))))}};function Hu(r=Qr()){try{return r?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function Pu(r=Qr()){try{return r?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function Qr(){try{return localStorage}catch{return null}}var Jr=class{storage;constructor(e){this.storage=e}raw(e){try{return this.storage?.getItem(`nextfloor.${e}`)??null}catch{return null}}load(e=""){let t={};for(let n of Object.keys(Ko)){let i=Ko[n],o=this.raw(i.name);t[n]=o===null?i.fallback:i.read(o)}return new URLSearchParams(e).has("nf_stats")&&(t.stats=!0),t}save(e,t){let n=Ko[e];try{this.storage?.setItem(`nextfloor.${n.name}`,n.write(t))}catch{}}};var Iu=X`
|
||||
</svg>`;var de=(r,e)=>({name:r,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),qt=(r,e,t)=>({name:r,fallback:t,read:n=>e.find(i=>i===n)??t,write:n=>n}),jo={explode:de("explode",!0),keepRoof:de("roof",!1),solidWalls:de("solid_walls",!1),quality:qt("quality",["auto","low","high"],"auto"),stats:de("stats",!1),markers:qt("markers",["none","important","all"],"important"),heat:qt("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:qt("theme",Nr,"neon"),clock:qt("clock",["none","top_left","top_right","bottom_left","bottom_right"],"none"),accent:{name:"accent",fallback:null,read:r=>/^#[0-9a-f]{6}$/i.test(r)?r:null,write:r=>r??""},floorStack:qt("floor_stack",["dim","stacked","single"],"dim"),roomNames:de("room_names",!0),clean:de("clean",!1),navWrap:de("nav_wrap",!1),weather:de("weather",!0),timeSlider:de("time_slider",!1),menuOpen:de("menu_open",!1),keepCamera:de("keep_camera",!1),readable:de("readable",!1),plain:de("plain",!1),rightBack:de("right_back",!1),zoom:{name:"zoom",fallback:100,read:r=>/^\d{2,3}$/.test(r)?Math.min(250,Math.max(60,Number(r))):100,write:r=>String(Math.round(Math.min(250,Math.max(60,r))))},screenName:{name:"screen_name",fallback:"",read:r=>r.slice(0,60),write:r=>r.trim().slice(0,60)},announceMuted:de("announce_muted",!1),glassWalls:{name:"glass_walls",fallback:20,read:r=>/^\d{1,3}$/.test(r)?Math.min(100,Number(r)):20,write:r=>String(Math.round(Math.min(100,Math.max(0,r))))}};function Iu(r=ei()){try{return r?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function Nu(r=ei()){try{return r?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function ei(){try{return localStorage}catch{return null}}var Xr=class{storage;constructor(e){this.storage=e}raw(e){try{return this.storage?.getItem(`nextfloor.${e}`)??null}catch{return null}}load(e=""){let t={};for(let n of Object.keys(jo)){let i=jo[n],o=this.raw(i.name);t[n]=o===null?i.fallback:i.read(o)}return new URLSearchParams(e).has("nf_stats")&&(t.stats=!0),t}save(e,t){let n=jo[e];try{this.storage?.setItem(`nextfloor.${n.name}`,n.write(t))}catch{}}};var Cu=Y`
|
||||
.nf-dot {
|
||||
display: inline-block;
|
||||
width: 8px;
|
||||
@@ -3884,11 +3937,11 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
gap: 12px;
|
||||
margin: auto;
|
||||
}
|
||||
`;var Nu=new WeakMap,Cu=new WeakMap;function bt(r,e){let t=Cu.get(r)??r,n=Nu.get(t)??new WeakMap;Nu.set(t,n);let i=n.get(e);if(i)return i;let o=new Map;for(let l of e)for(let c of l.placements)c.entity_id.startsWith("cover.")&&o.set(c.entity_id,{tilt:c.cover_tilt==="none"?null:c.cover_tilt,position:c.position});for(let l of He(t,e).values())l.cover&&!o.has(l.cover)&&o.set(l.cover,{tilt:l.coverTilt,position:l.position}),l.cover2&&!o.has(l.cover2)&&o.set(l.cover2,{tilt:l.cover2Tilt});let s={...t.states};for(let[l,c]of o){let u=t.states[l];if(!u)continue;let d={...u.attributes,nf_cover_control:!0},m=Rt(t,c.position);m===null&&(m=typeof u.attributes.current_position=="number"?u.attributes.current_position:null),m!==null&&(d.current_position=m);let h=c.tilt?t.states[c.tilt]:u,g=typeof h?.attributes.current_tilt_position=="number"?h.attributes.current_tilt_position:c.tilt?Rt(t,c.tilt):null;g!==null&&(d.current_tilt_position=g,d.supported_features=Number(d.supported_features??0)|128);let _=u.state;typeof d.current_position=="number"&&_!=="unavailable"&&_!=="unknown"&&_!=="opening"&&_!=="closing"&&(_=d.current_position>0?"open":"closed"),s[l]={...u,state:_,attributes:d}}let a={...t,states:s,callService:async(l,c,u={})=>{if(l!=="cover")return t.callService(l,c,u);let d=Array.isArray(u.entity_id)?u.entity_id:[u.entity_id],m=async h=>{let g=typeof h=="string"?o.get(h):void 0;if(!g)return t.callService(l,c,{...u,entity_id:h});let _={...u,entity_id:h},b=c;(b==="toggle"||b==="toggle_cover")&&(b=s[String(h)]?.state==="closed"?"open_cover":"close_cover");let v=b.includes("tilt");v&&g.tilt&&(_.entity_id=g.tilt);let S=g.tilt?t.states[g.tilt]:void 0;return v&&g.tilt&&!S?.attributes.symcon_id&&typeof S?.attributes.current_tilt_position!="number"&&(b==="set_cover_tilt_position"?(b="set_cover_position",_.position=_.tilt_position,delete _.tilt_position):b==="open_cover_tilt"?b="open_cover":b==="close_cover_tilt"&&(b="close_cover")),t.callService(l,b,_)};return Array.isArray(u.entity_id)?Promise.all(d.map(m)):m(d[0])}};return Cu.set(a,t),n.set(e,a),a}var Go=class extends ee{static properties={hass:{attribute:!1},narrow:{type:Boolean},route:{attribute:!1},panel:{attribute:!1},_mode:{state:!0},_editorReady:{state:!0},_floorId:{state:!0},_roomId:{state:!0},_wallMode:{state:!0},_prefs:{state:!0},_furnish:{state:!0},_selFurniture:{state:!0},_selDevice:{state:!0},_optsOpen:{state:!0},_switchesOpen:{state:!0},_timeOfDay:{state:!0},_outside:{state:!0},_timeDrag:{state:!0},_floorUndo:{state:!0},_variablesLoading:{state:!0},_variablesNotice:{state:!0},_variablesError:{state:!0}};outsideMemo=null;floorUndoTimer;data=new At(this);store=new Jr(Qr());constructor(){super(),this.narrow=!1,this._mode="view",this._editorReady=!!customElements.get("nf-editor"),this._floorId=null,this._roomId=null,this._wallMode="auto",this._prefs=this.store.load(location.search),this._furnish=!1,this._selFurniture=null,this._selDevice=null,this._optsOpen=!1,this._switchesOpen=!1,this._timeOfDay=null,this._outside=!1,this._timeDrag=null,this._floorUndo=null,this._variablesLoading=!1,this._variablesNotice="",this._variablesError=!1}toggleTimeSlider(e){this.setPref("timeSlider",e),e||([this._timeOfDay,this._timeDrag]=[null,null])}sunState(){let e=this.hass?.config;return this._timeOfDay===null||e?.latitude===void 0||e.longitude===void 0?this.hass?.states["sun.sun"]?.state:ct(xt(this._timeOfDay,e.time_zone),e.latitude,e.longitude).elevation>0?"above_horizon":"below_horizon"}renderTimeOfDay(){let e=this.t;if(this.hass?.config?.latitude===void 0)return f;let t=this._timeDrag??this._timeOfDay,n=o=>`${String(Math.floor(o)).padStart(2,"0")}:${String(Math.round(o%1*60)).padStart(2,"0")}`,i=()=>{let o=new Date;return Math.round((o.getHours()+o.getMinutes()/60)*4)/4};return p`<button class="nf-chip" aria-pressed=${t!==null} title=${e("time_of_day_hint")} @click=${()=>(this._timeDrag=null,this._timeOfDay=t===null?i():null)}>☀ ${t===null?e("time_of_day"):n(t)}</button>
|
||||
`;var Lu=new WeakMap,Ou=new WeakMap;function xt(r,e){let t=Ou.get(r)??r,n=Lu.get(t)??new WeakMap;Lu.set(t,n);let i=n.get(e);if(i)return i;let o=new Map;for(let l of e)for(let c of l.placements)c.entity_id.startsWith("cover.")&&o.set(c.entity_id,{tilt:c.cover_tilt==="none"?null:c.cover_tilt,position:c.position});for(let l of Ne(t,e).values())l.cover&&!o.has(l.cover)&&o.set(l.cover,{tilt:l.coverTilt,position:l.position}),l.cover2&&!o.has(l.cover2)&&o.set(l.cover2,{tilt:l.cover2Tilt});let s={...t.states};for(let[l,c]of o){let u=t.states[l];if(!u)continue;let d={...u.attributes,nf_cover_control:!0},m=Ft(t,c.position);m===null&&(m=typeof u.attributes.current_position=="number"?u.attributes.current_position:null),m!==null&&(d.current_position=m);let h=c.tilt?t.states[c.tilt]:u,g=typeof h?.attributes.current_tilt_position=="number"?h.attributes.current_tilt_position:c.tilt?Ft(t,c.tilt):null;g!==null&&(d.current_tilt_position=g,d.supported_features=Number(d.supported_features??0)|128);let _=u.state;typeof d.current_position=="number"&&_!=="unavailable"&&_!=="unknown"&&_!=="opening"&&_!=="closing"&&(_=d.current_position>0?"open":"closed"),s[l]={...u,state:_,attributes:d}}let a={...t,states:s,callService:async(l,c,u={})=>{if(l!=="cover")return t.callService(l,c,u);let d=Array.isArray(u.entity_id)?u.entity_id:[u.entity_id],m=async h=>{let g=typeof h=="string"?o.get(h):void 0;if(!g)return t.callService(l,c,{...u,entity_id:h});let _={...u,entity_id:h},b=c;(b==="toggle"||b==="toggle_cover")&&(b=s[String(h)]?.state==="closed"?"open_cover":"close_cover");let v=b.includes("tilt");v&&g.tilt&&(_.entity_id=g.tilt);let S=g.tilt?t.states[g.tilt]:void 0;return v&&g.tilt&&!S?.attributes.symcon_id&&typeof S?.attributes.current_tilt_position!="number"&&(b==="set_cover_tilt_position"?(b="set_cover_position",_.position=_.tilt_position,delete _.tilt_position):b==="open_cover_tilt"?b="open_cover":b==="close_cover_tilt"&&(b="close_cover")),t.callService(l,b,_)};return Array.isArray(u.entity_id)?Promise.all(d.map(m)):m(d[0])}};return Ou.set(a,t),n.set(e,a),a}var qo=class extends Q{static properties={hass:{attribute:!1},narrow:{type:Boolean},route:{attribute:!1},panel:{attribute:!1},_mode:{state:!0},_editorReady:{state:!0},_floorId:{state:!0},_roomId:{state:!0},_wallMode:{state:!0},_prefs:{state:!0},_furnish:{state:!0},_selFurniture:{state:!0},_selDevice:{state:!0},_optsOpen:{state:!0},_switchesOpen:{state:!0},_timeOfDay:{state:!0},_outside:{state:!0},_timeDrag:{state:!0},_floorUndo:{state:!0},_variablesLoading:{state:!0},_variablesNotice:{state:!0},_variablesError:{state:!0}};outsideMemo=null;floorUndoTimer;data=new Tt(this);store=new Xr(ei());constructor(){super(),this.narrow=!1,this._mode="view",this._editorReady=!!customElements.get("nf-editor"),this._floorId=null,this._roomId=null,this._wallMode="auto",this._prefs=this.store.load(location.search),this._furnish=!1,this._selFurniture=null,this._selDevice=null,this._optsOpen=!1,this._switchesOpen=!1,this._timeOfDay=null,this._outside=!1,this._timeDrag=null,this._floorUndo=null,this._variablesLoading=!1,this._variablesNotice="",this._variablesError=!1}toggleTimeSlider(e){this.setPref("timeSlider",e),e||([this._timeOfDay,this._timeDrag]=[null,null])}sunState(){let e=this.hass?.config;return this._timeOfDay===null||e?.latitude===void 0||e.longitude===void 0?this.hass?.states["sun.sun"]?.state:mt(Mt(this._timeOfDay,e.time_zone),e.latitude,e.longitude).elevation>0?"above_horizon":"below_horizon"}renderTimeOfDay(){let e=this.t;if(this.hass?.config?.latitude===void 0)return f;let t=this._timeDrag??this._timeOfDay,n=o=>`${String(Math.floor(o)).padStart(2,"0")}:${String(Math.round(o%1*60)).padStart(2,"0")}`,i=()=>{let o=new Date;return Math.round((o.getHours()+o.getMinutes()/60)*4)/4};return p`<button class="nf-chip" aria-pressed=${t!==null} title=${e("time_of_day_hint")} @click=${()=>(this._timeDrag=null,this._timeOfDay=t===null?i():null)}>☀ ${t===null?e("time_of_day"):n(t)}</button>
|
||||
${t!==null?p`<label class="nf-chip nf-time-slider"
|
||||
><input type="range" min="0" max="23.75" step="0.25" .value=${String(t)} aria-label=${e("time_of_day")} @input=${o=>this._timeDrag=Number(o.target.value)}
|
||||
@change=${o=>(this._timeDrag=null,this._timeOfDay=Number(o.target.value))}
|
||||
/></label>`:f}`}t=(e,t)=>$(this.hass,e,t);setPref(e,t){this._prefs={...this._prefs,[e]:t},this.store.save(e,t)}willUpdate(e){this.toggleAttribute("readable",!!this._prefs?.readable),e.has("hass")&&this.hass&&(this.style.colorScheme=xr(this.hass),this.data.setHass(this.hass));let t=this.data.building;t&&this._floorId&&!t.floors.some(n=>n.id===this._floorId)&&(this._floorId=null,this._roomId=null)}get isAdmin(){return this.hass?.user?.is_admin??!1}setMode(e){e!==this._mode&&(e==="view"&&this.data.flush(),this._mode=e)}openFloor(e){this._floorId=e,this._roomId=null,this._outside=!1}outsideIds(e){let t=this.outsideMemo;if(t&&t.building===e&&t.entities===this.hass.entities)return t.ids;let n=ln(this.hass,e.floors,e.settings.outside_hidden);return this.outsideMemo={building:e,entities:this.hass.entities,ids:n},n}openOutside(){let e=!this._outside;this.openFloor(null),this._outside=e}onRoomTap(e){let{floorId:t,roomId:n}=e.detail;if(n==="nf-outside")return this.openOutside();if((this.data.building?.floors.length??0)>1&&t&&this._floorId!==t)return this.openFloor(t);n&&(this._roomId=n===this._roomId?null:n,this._outside=!1)}furnishHost={hass:void 0,building:void 0,t:this.t,editFurniture:(e,t)=>this.applyEdit(n=>Zr(n,e,t)),editDevice:(e,t)=>this.applyEdit(n=>Yr(n,e,t)),turnFurniture:(e,t)=>this.applyEdit(n=>Zr(n,e,i=>i.rotation=Bo(i.rotation,t))),turnDevice:(e,t)=>this.applyEdit(n=>Yr(n,e,i=>i.rotation=Bo(i.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>$u(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>Mu(t,e)),this._selDevice=null},finish:()=>{this._furnish=!1,this._selFurniture=null,this._selDevice=null}};saveMoods(e,t){this.applyEdit(n=>({...n,floors:n.floors.map(i=>({...i,rooms:i.rooms.map(o=>o.id===e?{...o,moods:t.length?t:void 0}:o)}))}))}applyEdit(e){let t=this.data.building;t&&this.data.edit(e(t))}view3d(){return this.renderRoot.querySelector("nf-view3d")}back(){this._outside?this._outside=!1:this._roomId?this._roomId=null:this._floorId&&(this.data.building?.floors.length??0)>1?this._floorId=null:this.view3d()?.resetView()}onKey=e=>{e.key!=="Escape"||this._mode!=="view"||(this._prefs.clean?this.setPref("clean",!1):this.back())};connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this.onKey)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.onKey)}render(){if(this.hass&&gr(this.hass,this))return f;let e=this.data.building,t=this._prefs.clean&&this._mode==="view",n=f;return e&&(this._mode==="editor"&&this.isAdmin?n=this.renderEditor(e):this._mode==="extensions"&&this.isAdmin?n=this.renderExtensions():n=this.renderView(e)),p`<div class="nf-app ${t?"nf-clean":""}" style=${this._prefs.accent?`--nf-accent:${this._prefs.accent}`:""}>
|
||||
/></label>`:f}`}t=(e,t)=>$(this.hass,e,t);setPref(e,t){this._prefs={...this._prefs,[e]:t},this.store.save(e,t)}willUpdate(e){this.toggleAttribute("readable",!!this._prefs?.readable),e.has("hass")&&this.hass&&(this.style.colorScheme=$r(this.hass),this.data.setHass(this.hass));let t=this.data.building;t&&this._floorId&&!t.floors.some(n=>n.id===this._floorId)&&(this._floorId=null,this._roomId=null)}get isAdmin(){return this.hass?.user?.is_admin??!1}setMode(e){e!==this._mode&&(e==="view"&&this.data.flush(),this._mode=e)}openFloor(e){this._floorId=e,this._roomId=null,this._outside=!1}outsideIds(e){let t=this.outsideMemo;if(t&&t.building===e&&t.entities===this.hass.entities)return t.ids;let n=dn(this.hass,e.floors,e.settings.outside_hidden);return this.outsideMemo={building:e,entities:this.hass.entities,ids:n},n}openOutside(){let e=!this._outside;this.openFloor(null),this._outside=e}onRoomTap(e){let{floorId:t,roomId:n}=e.detail;if(n==="nf-outside")return this.openOutside();if((this.data.building?.floors.length??0)>1&&t&&this._floorId!==t)return this.openFloor(t);n&&(this._roomId=n===this._roomId?null:n,this._outside=!1)}furnishHost={hass:void 0,building:void 0,t:this.t,editFurniture:(e,t)=>this.applyEdit(n=>Jr(n,e,t)),editDevice:(e,t)=>this.applyEdit(n=>Qr(n,e,t)),turnFurniture:(e,t)=>this.applyEdit(n=>Jr(n,e,i=>i.rotation=Go(i.rotation,t))),turnDevice:(e,t)=>this.applyEdit(n=>Qr(n,e,i=>i.rotation=Go(i.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>Au(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>Eu(t,e)),this._selDevice=null},finish:()=>{this._furnish=!1,this._selFurniture=null,this._selDevice=null}};saveMoods(e,t){this.applyEdit(n=>({...n,floors:n.floors.map(i=>({...i,rooms:i.rooms.map(o=>o.id===e?{...o,moods:t.length?t:void 0}:o)}))}))}applyEdit(e){let t=this.data.building;t&&this.data.edit(e(t))}view3d(){return this.renderRoot.querySelector("nf-view3d")}back(){this._outside?this._outside=!1:this._roomId?this._roomId=null:this._floorId&&(this.data.building?.floors.length??0)>1?this._floorId=null:this.view3d()?.resetView()}onKey=e=>{e.key!=="Escape"||this._mode!=="view"||(this._prefs.clean?this.setPref("clean",!1):this.back())};connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this.onKey)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.onKey)}render(){if(this.hass&&vr(this.hass,this))return f;let e=this.data.building,t=this._prefs.clean&&this._mode==="view",n=f;return e&&(this._mode==="editor"&&this.isAdmin?n=this.renderEditor(e):this._mode==="extensions"&&this.isAdmin?n=this.renderExtensions():n=this.renderView(e)),p`<div class="nf-app ${t?"nf-clean":""}" style=${this._prefs.accent?`--nf-accent:${this._prefs.accent}`:""}>
|
||||
${t?f:p`${this.renderHeader(e)}${this.renderNotices()}`}
|
||||
${this.data.error&&!e?p`<p class="nf-message">${this.t("load_error")}: ${this.data.error}</p>`:f}
|
||||
${!e&&!this.data.error?p`<p class="nf-message">${this.t("loading")}</p>`:f}
|
||||
@@ -3901,7 +3954,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
</label>`}renderViewOptions(){let e=this._prefs;return p`<button class="nf-opts-btn" aria-expanded=${this._optsOpen} title=${this.t("view_options")} aria-label=${this.t("view_options")} @click=${()=>this._optsOpen=!this._optsOpen}>⚙</button>
|
||||
<div class="nf-view-opts ${this._optsOpen?"nf-opts-open":""}">
|
||||
${this.choiceRow("quality",["auto","low","high"],e.quality,t=>this.t(`quality_${t}`),t=>this.setPref("quality",t))}
|
||||
${this.choiceRow("theme",Pr,e.theme,t=>this.t(`theme_${t}`),t=>this.setPref("theme",t),this.accentPicker())}
|
||||
${this.choiceRow("theme",Nr,e.theme,t=>this.t(`theme_${t}`),t=>this.setPref("theme",t),this.accentPicker())}
|
||||
${this.choiceRow("markers",["none","important","all"],e.markers,t=>this.t(`markers_${t}`),t=>this.setPref("markers",t))}
|
||||
<label class="nf-seg nf-clock-pick" title=${this.t("clock")}
|
||||
>🕒
|
||||
@@ -3917,7 +3970,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
>${this.t("glass_walls")}
|
||||
<input type="range" min="0" max="100" step="5" .value=${String(e.glassWalls)} aria-label=${this.t("glass_walls")} @input=${t=>this.setPref("glassWalls",Number(t.target.value))} />
|
||||
</label>
|
||||
${G(this.hass)?f:p`<details class="nf-seg nf-screen-pick">
|
||||
${K(this.hass)?f:p`<details class="nf-seg nf-screen-pick">
|
||||
<summary title=${this.t(e.announceMuted?"announce_muted":"announce_on")} aria-label=${this.t(e.announceMuted?"announce_muted":"announce_on")}>${e.announceMuted?"\u{1F507}":"\u{1F4E2}"}</summary>
|
||||
<div class="nf-screen-menu">
|
||||
<label class="nf-check"><input type="checkbox" .checked=${!e.announceMuted} @change=${t=>this.setPref("announceMuted",!t.target.checked)} /> ${this.t("announce_on")}</label>
|
||||
@@ -3940,7 +3993,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
</div>
|
||||
</div>`}async reloadVariables(){if(!(this._variablesLoading||!this.hass.symconRefresh)){this._variablesLoading=!0,this._variablesNotice="",this._variablesError=!1;try{await this.hass.symconRefresh(),this._variablesNotice=this.t("symcon_variables_loaded")}catch(e){this._variablesError=!0,this._variablesNotice=this.t("symcon_variables_error",{error:e instanceof Error?e.message:String(e)})}finally{this._variablesLoading=!1}}}renderHeader(e){let t=this.hass?.symconTitle?.trim()||"NextFloor",n=this.data.saveState,i=(s,a,l="")=>p`<button role="tab" class=${l} aria-pressed=${this._mode===s} @click=${()=>this.setMode(s)}>${a}</button>`,o=n==="saving"?"saving":n==="saved"?"saved":"save_error";return p`<header class="nf-header">
|
||||
<ha-menu-button .hass=${this.hass} .narrow=${this.narrow}></ha-menu-button>
|
||||
<h1 title=${t}>${Fu}<span class="nf-view-title">${t}</span></h1>
|
||||
<h1 title=${t}>${Pu}<span class="nf-view-title">${t}</span></h1>
|
||||
${this.isAdmin?p`<div class="nf-seg" role="tablist">${i("view",this.t("view"))}${i("editor",this.t("editor"))}${i("extensions",`\u2726 ${this.t("ext_tab")}`,"nf-tab-ext")}</div>`:f}
|
||||
<span class="nf-grow"></span>
|
||||
${this._mode==="view"&&e?.floors.some(s=>s.rooms.length)?p`<button class="nf-chip nf-room-names-toggle" aria-pressed=${this._prefs.roomNames} title=${this.t("room_names_toggle_hint")} @click=${()=>this.setPref("roomNames",!this._prefs.roomNames)}>${this.t("room_names_short")}</button>`:f}
|
||||
@@ -3955,7 +4008,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
<span>${this.t("draft_found",{time:n})}</span>
|
||||
<button class="nf-btn nf-primary" @click=${()=>e.restoreDraft()}>${this.t("draft_restore")}</button>
|
||||
<button class="nf-btn" @click=${()=>e.discardDraft()}>${this.t("draft_discard")}</button>
|
||||
</div>`)}return t.length>0?p`<div class="nf-notices">${t}</div>`:f}whenEditorLoaded(e){return this._editorReady?e():(wu().then(()=>this._editorReady=!0,t=>this.data.error=String(t)),p`<div class="nf-empty"><p>${this.t("loading")}</p></div>`)}renderExtensions(){return this.whenEditorLoaded(()=>p`<nf-extensions class="nf-body" .hass=${this.hass} .packs=${this.data.packs} .plugins=${this.data.building?.settings.plugins??[]}
|
||||
</div>`)}return t.length>0?p`<div class="nf-notices">${t}</div>`:f}whenEditorLoaded(e){return this._editorReady?e():(ku().then(()=>this._editorReady=!0,t=>this.data.error=String(t)),p`<div class="nf-empty"><p>${this.t("loading")}</p></div>`)}renderExtensions(){return this.whenEditorLoaded(()=>p`<nf-extensions class="nf-body" .hass=${this.hass} .packs=${this.data.packs} .plugins=${this.data.building?.settings.plugins??[]}
|
||||
@packs-changed=${()=>{this.data.reloadPacks()}}
|
||||
@plugins-changed=${e=>this.applyEdit(t=>({...t,settings:{...t.settings,plugins:e.detail}}))}></nf-extensions>`)}renderEditor(e){return this.whenEditorLoaded(()=>p`<nf-editor
|
||||
class="nf-body"
|
||||
@@ -3965,10 +4018,10 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.roomLabels=${this._prefs.roomNames}
|
||||
@room-names-change=${t=>this.setPref("roomNames",t.detail.value)}
|
||||
.packs=${this.data.packs}
|
||||
.loadCardEditor=${On}
|
||||
.loadCardEditor=${Kn}
|
||||
@packs-changed=${()=>{this.data.reloadPacks()}}
|
||||
@building-changed=${t=>this.data.edit(t.detail.building)}
|
||||
></nf-editor>`)}onNavWheel=e=>{if(this._prefs.navWrap||!e.deltaY||e.deltaX)return;let t=e.currentTarget;t.scrollWidth<=t.clientWidth||(t.scrollLeft+=e.deltaY,e.preventDefault())};allOffChip(e){let t=this._floorId?e.floors.find(i=>i.id===this._floorId):e.floors.length===1?e.floors[0]:void 0;if(!t||!this.hass)return f;if(this._floorUndo){let i=this._floorUndo;return p`<button class="nf-chip" aria-pressed="true" @click=${()=>{for(let o of i)this.hass.callService(o.domain,o.service,o.data);this._floorUndo=null,clearTimeout(this.floorUndoTimer)}}>↶ ${this.t("all_off_undo")}</button>`}let n=vn(Kl(t).map(i=>this.hass.states[i]));return n.count<2?f:p`<button class="nf-chip" title=${this.t("all_off_floor",{floor:t.name,n:n.count})} @click=${()=>{for(let i of n.off)this.hass.callService(i.domain,i.service,i.data);this._floorUndo=n.undo,clearTimeout(this.floorUndoTimer),this.floorUndoTimer=setTimeout(()=>this._floorUndo=null,1e4)}}>⏻ ${n.count}</button>`}renderNav(e){let t=e.floors.filter(c=>!this._floorId||c.id===this._floorId),n=e.floors.length>1,i=this._prefs.navWrap,o=this.outsideIds(e).length?p`<button class="nf-chip" aria-pressed=${this._outside} title=${this.t("outside_area_hint")} @click=${()=>this.openOutside()}>🌳 ${this.t("outside_area")}</button>`:f,s=n?p`<button class="nf-chip" aria-pressed=${this._floorId===null} @click=${()=>this.openFloor(null)}>${this.t("all_floors")}</button>
|
||||
></nf-editor>`)}onNavWheel=e=>{if(this._prefs.navWrap||!e.deltaY||e.deltaX)return;let t=e.currentTarget;t.scrollWidth<=t.clientWidth||(t.scrollLeft+=e.deltaY,e.preventDefault())};allOffChip(e){let t=this._floorId?e.floors.find(i=>i.id===this._floorId):e.floors.length===1?e.floors[0]:void 0;if(!t||!this.hass)return f;if(this._floorUndo){let i=this._floorUndo;return p`<button class="nf-chip" aria-pressed="true" @click=${()=>{for(let o of i)this.hass.callService(o.domain,o.service,o.data);this._floorUndo=null,clearTimeout(this.floorUndoTimer)}}>↶ ${this.t("all_off_undo")}</button>`}let n=xn(Ul(t).map(i=>this.hass.states[i]));return n.count<2?f:p`<button class="nf-chip" title=${this.t("all_off_floor",{floor:t.name,n:n.count})} @click=${()=>{for(let i of n.off)this.hass.callService(i.domain,i.service,i.data);this._floorUndo=n.undo,clearTimeout(this.floorUndoTimer),this.floorUndoTimer=setTimeout(()=>this._floorUndo=null,1e4)}}>⏻ ${n.count}</button>`}renderNav(e){let t=e.floors.filter(c=>!this._floorId||c.id===this._floorId),n=e.floors.length>1,i=this._prefs.navWrap,o=this.outsideIds(e).length?p`<button class="nf-chip" aria-pressed=${this._outside} title=${this.t("outside_area_hint")} @click=${()=>this.openOutside()}>🌳 ${this.t("outside_area")}</button>`:f,s=n?p`<button class="nf-chip" aria-pressed=${this._floorId===null} @click=${()=>this.openFloor(null)}>${this.t("all_floors")}</button>
|
||||
${[...e.floors].reverse().map(c=>p`<button class="nf-chip" aria-pressed=${c.id===this._floorId} @click=${()=>this.openFloor(c.id)}>${c.name}</button>`)}
|
||||
${o} ${this.allOffChip(e)}
|
||||
<span class="nf-sep"></span>`:p`${o} ${this.allOffChip(e)}`,a=t.flatMap(c=>[t.length>1&&c.rooms.length?p`<span class="nf-nav-floor">${c.name}</span>`:f,...c.rooms.map(u=>p`<button
|
||||
@@ -4009,7 +4062,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
<div class="nf-stage-wrap ${this._roomId?"nf-room-open":""}">
|
||||
<nf-view3d
|
||||
class="nf-body"
|
||||
.hass=${jr(bt(this.hass,e.floors),e.settings)}
|
||||
.hass=${Zr(xt(this.hass,e.floors),e.settings)}
|
||||
.building=${e}
|
||||
.packs=${this.data.packs}
|
||||
.floorStack=${t.floorStack}
|
||||
@@ -4028,10 +4081,10 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.keepRoof=${t.keepRoof}
|
||||
.markerMode=${t.markers}
|
||||
.heatMode=${t.heat}
|
||||
.theme=${Ir(t.theme,this.sunState())}
|
||||
.theme=${Cr(t.theme,this.sunState())}
|
||||
.timeOfDay=${this._timeOfDay}
|
||||
.clock=${t.clock==="none"?null:t.clock}
|
||||
.announcements=${!G(this.hass)&&!t.announceMuted}
|
||||
.announcements=${!K(this.hass)&&!t.announceMuted}
|
||||
.glassWalls=${t.glassWalls}
|
||||
.screenName=${t.screenName||null}
|
||||
.lockButton=${!0}
|
||||
@@ -4047,9 +4100,9 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
?furnish=${this._furnish}
|
||||
.selectedFurniture=${this._selFurniture}
|
||||
@furniture-select=${i=>this._selFurniture=i.detail.id}
|
||||
@furniture-move=${i=>this.applyEdit(o=>Eu(o,i.detail.id,i.detail.x,i.detail.z))}
|
||||
@furniture-move=${i=>this.applyEdit(o=>zu(o,i.detail.id,i.detail.x,i.detail.z))}
|
||||
@device-select=${i=>this._selDevice=i.detail.id}
|
||||
@device-move=${i=>this.applyEdit(o=>Au(o,i.detail.id,i.detail.x,i.detail.z))}
|
||||
@device-move=${i=>this.applyEdit(o=>Ru(o,i.detail.id,i.detail.x,i.detail.z))}
|
||||
.quality=${t.quality}
|
||||
?showStats=${t.stats}
|
||||
@room-tap=${this.onRoomTap}
|
||||
@@ -4059,10 +4112,10 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${n?p`<nf-room-panel
|
||||
.building=${this.data.building??null}
|
||||
class="nf-room-panel"
|
||||
.hass=${bt(this.hass,e.floors)}
|
||||
.hass=${xt(this.hass,e.floors)}
|
||||
.room=${n}
|
||||
.floor=${e.floors.find(i=>i.rooms.some(o=>o.id===this._roomId))??null}
|
||||
.confirmEntities=${mt(this.hass,e.floors)}
|
||||
.confirmEntities=${_t(this.hass,e.floors)}
|
||||
.phrases=${e.settings.announce_phrases??null}
|
||||
.rooms=${e.floors.flatMap(i=>i.rooms)}
|
||||
@mood-change=${i=>this.saveMoods(i.detail.roomId,i.detail.moods)}
|
||||
@@ -4070,17 +4123,17 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
></nf-room-panel>`:this._outside?p`<nf-room-panel
|
||||
.building=${this.data.building??null}
|
||||
class="nf-room-panel"
|
||||
.hass=${bt(this.hass,e.floors)}
|
||||
.hass=${xt(this.hass,e.floors)}
|
||||
.room=${null}
|
||||
.outside=${this.outsideIds(e)}
|
||||
.confirmEntities=${mt(this.hass,e.floors)}
|
||||
.confirmEntities=${_t(this.hass,e.floors)}
|
||||
.phrases=${e.settings.announce_phrases??null}
|
||||
@close=${()=>this._outside=!1}
|
||||
></nf-room-panel>`:f}
|
||||
${t.clean?f:this.renderOverlay(e)}
|
||||
${this._furnish?Du(this.furnishHost,this._selFurniture,this._selDevice):f}
|
||||
${this._furnish?Hu(this.furnishHost,this._selFurniture,this._selDevice):f}
|
||||
</div>
|
||||
`}static styles=[ge,Re,Iu,wr]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",Go);var Af=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,Wu=(r,e)=>Number(r)*60+Number(e);function In(r,e,t=new Date){if(!r||r==="off")return!1;if(r==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let n=Af.exec(r.trim());if(!n)return!1;let i=Wu(n[1],n[2]),o=Wu(n[3],n[4]),s=t.getHours()*60+t.getMinutes();return i>o?s>=i||s<o:s>=i&&s<o}var Xr=class{host;cleanTimer;idleTimer;nightTimer;constructor(e){this.host=e}armClean(e=!1){clearTimeout(this.cleanTimer);let t=this.host.config()?.controls_hide_after??0;t>0&&(e&&this.host.isClean()&&this.host.setClean(!1),this.cleanTimer=setTimeout(()=>this.host.setClean(!0),t*1e3))}stopClean(){clearTimeout(this.cleanTimer)}armIdle(){clearTimeout(this.idleTimer);let e=this.host.config()?.idle_return??0;e>0&&(this.idleTimer=setTimeout(()=>this.host.goHome(),e*1e3))}touched(){this.host.isOrbit()&&this.host.setOrbit(!1),this.armIdle(),this.armClean(!0)}start(){this.armIdle(),this.nightTimer=setInterval(()=>this.host.setNight(In(this.host.config()?.night,this.host.hass())),6e4)}stop(){clearTimeout(this.cleanTimer),clearTimeout(this.idleTimer),clearInterval(this.nightTimer)}};function Lu(r,e){return r?r.floors.filter(t=>(e===null||t.id===e)&&t.rooms.length>0).map(t=>({floorId:t.id,floorName:t.name,rooms:t.rooms.map(n=>({id:n.id,name:n.name||"\u2013",floorId:t.id}))})):[]}var Ou=X`
|
||||
`}static styles=[ge,Re,Cu,Sr]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",qo);var Rf=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,Wu=(r,e)=>Number(r)*60+Number(e);function Ln(r,e,t=new Date){if(!r||r==="off")return!1;if(r==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let n=Rf.exec(r.trim());if(!n)return!1;let i=Wu(n[1],n[2]),o=Wu(n[3],n[4]),s=t.getHours()*60+t.getMinutes();return i>o?s>=i||s<o:s>=i&&s<o}var ti=class{host;cleanTimer;idleTimer;nightTimer;constructor(e){this.host=e}armClean(e=!1){clearTimeout(this.cleanTimer);let t=this.host.config()?.controls_hide_after??0;t>0&&(e&&this.host.isClean()&&this.host.setClean(!1),this.cleanTimer=setTimeout(()=>this.host.setClean(!0),t*1e3))}stopClean(){clearTimeout(this.cleanTimer)}armIdle(){clearTimeout(this.idleTimer);let e=this.host.config()?.idle_return??0;e>0&&(this.idleTimer=setTimeout(()=>this.host.goHome(),e*1e3))}touched(){this.host.isOrbit()&&this.host.setOrbit(!1),this.armIdle(),this.armClean(!0)}start(){this.armIdle(),this.nightTimer=setInterval(()=>this.host.setNight(Ln(this.host.config()?.night,this.host.hass())),6e4)}stop(){clearTimeout(this.cleanTimer),clearTimeout(this.idleTimer),clearInterval(this.nightTimer)}};function Bu(r,e){return r?r.floors.filter(t=>(e===null||t.id===e)&&t.rooms.length>0).map(t=>({floorId:t.id,floorName:t.name,rooms:t.rooms.map(n=>({id:n.id,name:n.name||"\u2013",floorId:t.id}))})):[]}var Vu=Y`
|
||||
ha-card {
|
||||
overflow: hidden;
|
||||
background: var(--nf-bg);
|
||||
@@ -4204,26 +4257,26 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
`;function Uo(r,e){let t=r.template,n=t?e?.[t]:void 0;if(!n)return r;let{type:i,template:o,...s}=n;return{...s,...r}}function Bu(r,e){let t=new Set(e),n=[];for(let o of r.floors){let s=o.rooms.filter(c=>t.has(c.id));if(!s.length)continue;let a=(c,u)=>s.some(d=>d.points.length>=3&&I([c,u],d.points)),l=new Set(s.map(c=>c.id));n.push({...o,rooms:s,openings:o.openings.filter(c=>l.has(c.room_id)),furniture:o.furniture.filter(c=>a(c.x,c.z)),placements:o.placements.filter(c=>a(c.x,c.z)),walls:(o.walls??[]).filter(c=>a((c.a[0]+c.b[0])/2,(c.a[1]+c.b[1])/2)),outdoor:[]})}let i={...r.settings.roof,type:"none",sections:[],solar:[]};return{...r,floors:n,settings:{...r.settings,roof:i}}}var Gt="nf-outside",jo=class extends ee{static properties={hass:{attribute:!1},_config:{state:!0},_roomId:{state:!0},_floorId:{state:!0},_walls:{state:!0},_heat:{state:!0},_explode:{state:!0},_fullscreen:{state:!0},_clean:{state:!0},_night:{state:!0},_orbit:{state:!0},_roomNames:{state:!0}};_own=null;templatesSeen;roomApplied=!1;data=new At(this);kiosk=new Xr({config:()=>this._config,hass:()=>this.hass,setClean:e=>this._clean=e,isClean:()=>this._clean,setOrbit:e=>this._orbit=e,isOrbit:()=>this._orbit,setNight:e=>this._night=e,goHome:()=>this.returnHome()});constructor(){super(),this._roomId=null,this._floorId=void 0,this._walls=null,this._heat=null,this._explode=null,this._fullscreen=!1,this._clean=!1,this._night=!1,this._orbit=!1,this._roomNames=null}view3d(){return this.shadowRoot?.querySelector("nf-view3d")}returnHome(){this._roomId=this._config?.room??null,this._floorId=void 0,this.view3d()?.resetView(),this._config?.idle_orbit&&(this._orbit=!0)}openDashboard(e){history.pushState(null,"",e),window.dispatchEvent(new CustomEvent("location-changed",{bubbles:!0,composed:!0,detail:{replace:!1}}))}onFullscreen=()=>this._fullscreen=!!document.fullscreenElement&&this.shadowRoot?.contains(document.fullscreenElement)===!0;connectedCallback(){super.connectedCallback(),document.addEventListener("fullscreenchange",this.onFullscreen),this.kiosk.start()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("fullscreenchange",this.onFullscreen),this.kiosk.stop()}toggleFullscreen(){document.fullscreenElement?document.exitFullscreen():this.shadowRoot?.querySelector("ha-card")?.requestFullscreen?.()}static async getConfigElement(){return await On(),document.createElement("nextfloor-card-editor")}static getStubConfig(){return{type:"custom:nextfloor-card"}}setConfig(e){if(e.height!==void 0&&!(e.height>100))throw new Error("height must be a number of pixels above 100");this._roomNames=null,this._own=e,this._config=Uo(e,this.data.building?.settings.card_templates),this._floorId=void 0,this._walls=null,this._heat=null,this._explode=null,this._orbit=!1,this._night=In(e.night,this.hass),this._clean=e.controls_hidden===!0,this.kiosk.armClean(),this.kiosk.armIdle()}getCardSize(){return Math.ceil((this._config?.height??420)/50)}getGridOptions(){return{columns:"full",rows:this._config?.fill?12:Math.ceil((this._config?.height??420)/56),min_rows:4}}willUpdate(e){let t=this.data.building?.settings.card_templates;if(this._own?.template&&t!==this.templatesSeen&&(this.templatesSeen=t,this._config=Uo(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=xr(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let n=In(this._config?.night,this.hass);n!==this._night&&(this._night=n)}get canSwitch(){return!this._config?.floor||this.thumbs}get thumbs(){return this._config?.floor_thumbs??!this._config?.floor}back(){this._roomId?this._roomId=null:this.canSwitch&&(this._floorId=null)}roomsMemo=null;plan(){let e=this.data.building??null,t=this._config?.rooms;if(!e||!t?.length)return e;let n=t.join(",");return(!this.roomsMemo||this.roomsMemo.source!==e||this.roomsMemo.ids!==n)&&(this.roomsMemo={source:e,ids:n,result:Bu(e,t)}),this.roomsMemo.result}t=e=>$(this.hass,e);stage(){let e=this.plan(),t=this._config,n=this._floorId===void 0?t?.floor??null:this._floorId,i=e&&e.floors.length===1?e.floors[0].id:e?.floors.some(a=>a.id===n)?n:null,o=!!this._roomId&&t?.room_panel!==!1,s=!!this._roomId&&t?.room_panel===!1||!this.thumbs&&this.canSwitch&&!this._roomId&&!!i&&(e?.floors.length??0)>1;return{floorId:i,walls:this._walls??t?.walls??"auto",heat:this._heat??t?.heatmap??"none",explode:this._explode??t?.explode??!0,canGoBack:s,showBar:!!e&&!this._clean&&(s||!!t?.controls&&!o)}}shows(e){let t=this._config?.controls;return t===!0||Array.isArray(t)&&t.includes(e)}renderBar(e){let t=this.plan(),n=this.t,i=["temperature","humidity","co2"].filter(s=>this.shows(s)),o=(s,a)=>p`<div class="nf-seg" role=${s?"group":f} aria-label=${s??f}>${a.map(([l,c,u])=>p`<button aria-pressed=${l} @click=${c}>${u}</button>`)}</div>`;return p`<div class="nf-card-controls">
|
||||
`;function Zo(r,e){let t=r.template,n=t?e?.[t]:void 0;if(!n)return r;let{type:i,template:o,...s}=n;return{...s,...r}}function Ku(r,e){let t=new Set(e),n=[];for(let o of r.floors){let s=o.rooms.filter(c=>t.has(c.id));if(!s.length)continue;let a=(c,u)=>s.some(d=>d.points.length>=3&&I([c,u],d.points)),l=new Set(s.map(c=>c.id));n.push({...o,rooms:s,openings:o.openings.filter(c=>l.has(c.room_id)),furniture:o.furniture.filter(c=>a(c.x,c.z)),placements:o.placements.filter(c=>a(c.x,c.z)),walls:(o.walls??[]).filter(c=>a((c.a[0]+c.b[0])/2,(c.a[1]+c.b[1])/2)),outdoor:[]})}let i={...r.settings.roof,type:"none",sections:[],solar:[]};return{...r,floors:n,settings:{...r.settings,roof:i}}}var Zt="nf-outside",Yo=class extends Q{static properties={hass:{attribute:!1},_config:{state:!0},_roomId:{state:!0},_floorId:{state:!0},_walls:{state:!0},_heat:{state:!0},_explode:{state:!0},_fullscreen:{state:!0},_clean:{state:!0},_night:{state:!0},_orbit:{state:!0},_roomNames:{state:!0}};_own=null;templatesSeen;roomApplied=!1;data=new Tt(this);kiosk=new ti({config:()=>this._config,hass:()=>this.hass,setClean:e=>this._clean=e,isClean:()=>this._clean,setOrbit:e=>this._orbit=e,isOrbit:()=>this._orbit,setNight:e=>this._night=e,goHome:()=>this.returnHome()});constructor(){super(),this._roomId=null,this._floorId=void 0,this._walls=null,this._heat=null,this._explode=null,this._fullscreen=!1,this._clean=!1,this._night=!1,this._orbit=!1,this._roomNames=null}view3d(){return this.shadowRoot?.querySelector("nf-view3d")}returnHome(){this._roomId=this._config?.room??null,this._floorId=void 0,this.view3d()?.resetView(),this._config?.idle_orbit&&(this._orbit=!0)}openDashboard(e){history.pushState(null,"",e),window.dispatchEvent(new CustomEvent("location-changed",{bubbles:!0,composed:!0,detail:{replace:!1}}))}onFullscreen=()=>this._fullscreen=!!document.fullscreenElement&&this.shadowRoot?.contains(document.fullscreenElement)===!0;connectedCallback(){super.connectedCallback(),document.addEventListener("fullscreenchange",this.onFullscreen),this.kiosk.start()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("fullscreenchange",this.onFullscreen),this.kiosk.stop()}toggleFullscreen(){document.fullscreenElement?document.exitFullscreen():this.shadowRoot?.querySelector("ha-card")?.requestFullscreen?.()}static async getConfigElement(){return await Kn(),document.createElement("nextfloor-card-editor")}static getStubConfig(){return{type:"custom:nextfloor-card"}}setConfig(e){if(e.height!==void 0&&!(e.height>100))throw new Error("height must be a number of pixels above 100");this._roomNames=null,this._own=e,this._config=Zo(e,this.data.building?.settings.card_templates),this._floorId=void 0,this._walls=null,this._heat=null,this._explode=null,this._orbit=!1,this._night=Ln(e.night,this.hass),this._clean=e.controls_hidden===!0,this.kiosk.armClean(),this.kiosk.armIdle()}getCardSize(){return Math.ceil((this._config?.height??420)/50)}getGridOptions(){return{columns:"full",rows:this._config?.fill?12:Math.ceil((this._config?.height??420)/56),min_rows:4}}willUpdate(e){let t=this.data.building?.settings.card_templates;if(this._own?.template&&t!==this.templatesSeen&&(this.templatesSeen=t,this._config=Zo(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=$r(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let n=Ln(this._config?.night,this.hass);n!==this._night&&(this._night=n)}get canSwitch(){return!this._config?.floor||this.thumbs}get thumbs(){return this._config?.floor_thumbs??!this._config?.floor}back(){this._roomId?this._roomId=null:this.canSwitch&&(this._floorId=null)}roomsMemo=null;plan(){let e=this.data.building??null,t=this._config?.rooms;if(!e||!t?.length)return e;let n=t.join(",");return(!this.roomsMemo||this.roomsMemo.source!==e||this.roomsMemo.ids!==n)&&(this.roomsMemo={source:e,ids:n,result:Ku(e,t)}),this.roomsMemo.result}t=e=>$(this.hass,e);stage(){let e=this.plan(),t=this._config,n=this._floorId===void 0?t?.floor??null:this._floorId,i=e&&e.floors.length===1?e.floors[0].id:e?.floors.some(a=>a.id===n)?n:null,o=!!this._roomId&&t?.room_panel!==!1,s=!!this._roomId&&t?.room_panel===!1||!this.thumbs&&this.canSwitch&&!this._roomId&&!!i&&(e?.floors.length??0)>1;return{floorId:i,walls:this._walls??t?.walls??"auto",heat:this._heat??t?.heatmap??"none",explode:this._explode??t?.explode??!0,canGoBack:s,showBar:!!e&&!this._clean&&(s||!!t?.controls&&!o)}}shows(e){let t=this._config?.controls;return t===!0||Array.isArray(t)&&t.includes(e)}renderBar(e){let t=this.plan(),n=this.t,i=["temperature","humidity","co2"].filter(s=>this.shows(s)),o=(s,a)=>p`<div class="nf-seg" role=${s?"group":f} aria-label=${s??f}>${a.map(([l,c,u])=>p`<button aria-pressed=${l} @click=${c}>${u}</button>`)}</div>`;return p`<div class="nf-card-controls">
|
||||
${e.canGoBack?p`<button class="nf-chip" @click=${()=>this.back()}>${n("back")}</button>`:f}
|
||||
${this.shows("walls")?o(void 0,[[e.walls==="auto",()=>this._walls="auto",n("walls_auto")],[e.walls==="cut",()=>this._walls="cut",n("walls_cut")],[e.walls==="slope",()=>this._walls="slope",n("walls_slope")]]):f}
|
||||
${this.shows("floors")&&t.floors.length>1&&!e.floorId?o(void 0,[[e.explode,()=>this._explode=!0,n("floors_apart")],[!e.explode,()=>this._explode=!1,n("floors_stacked")]]):f}
|
||||
${i.length>0?o(n("heatmap"),["none",...i].map(s=>[e.heat===s,()=>this._heat=s,n(s==="none"?"heat_off":`heat_short_${s}`)])):f}
|
||||
</div>`}renderRoomButtons(e){let t=this.plan();if(!this._config?.room_buttons||!t||this._clean)return f;let n=Lu(t,e.floorId);if(!n.length)return f;let i=n.length>1,o=(l,c)=>{this.canSwitch&&l!==e.floorId&&(this._floorId=l),this._roomId=c===this._roomId?null:c},s=ln(this.hass,t.floors).length>0,a=()=>{this.canSwitch&&(this._floorId=null),this._roomId=this._roomId===Gt?null:Gt};return p`<div class="nf-card-rooms ${this._roomId&&this._config?.room_panel!==!1?"nf-card-rooms-beside":""}" role="group" aria-label=${this.t("card_room_buttons")}>
|
||||
</div>`}renderRoomButtons(e){let t=this.plan();if(!this._config?.room_buttons||!t||this._clean)return f;let n=Bu(t,e.floorId);if(!n.length)return f;let i=n.length>1,o=(l,c)=>{this.canSwitch&&l!==e.floorId&&(this._floorId=l),this._roomId=c===this._roomId?null:c},s=dn(this.hass,t.floors).length>0,a=()=>{this.canSwitch&&(this._floorId=null),this._roomId=this._roomId===Zt?null:Zt};return p`<div class="nf-card-rooms ${this._roomId&&this._config?.room_panel!==!1?"nf-card-rooms-beside":""}" role="group" aria-label=${this.t("card_room_buttons")}>
|
||||
${n.map(l=>p`${i?p`<span class="nf-card-rooms-floor">${l.floorName}</span>`:f}${l.rooms.map(c=>p`<button class="nf-chip" aria-pressed=${c.id===this._roomId} @click=${()=>o(l.floorId,c.id)}>${c.name}</button>`)}`)}
|
||||
${s?p`<button class="nf-chip" aria-pressed=${this._roomId===Gt} title=${this.t("outside_area_hint")} @click=${a}>🌳 ${this.t("outside_area")}</button>`:f}
|
||||
${s?p`<button class="nf-chip" aria-pressed=${this._roomId===Zt} title=${this.t("outside_area_hint")} @click=${a}>🌳 ${this.t("outside_area")}</button>`:f}
|
||||
</div>`}renderCorners(){let e=this._config,t=this.t,n=this._clean||!!this._roomId&&e?.room_panel!==!1;return p`${e?.fullscreen_button&&!n?p`<button class="nf-card-full" title=${t(this._fullscreen?"fullscreen_exit":"fullscreen")} aria-label=${t(this._fullscreen?"fullscreen_exit":"fullscreen")} @click=${()=>this.toggleFullscreen()}>
|
||||
${this._fullscreen?"\u2715":"\u26F6"}
|
||||
</button>`:f}
|
||||
${e?.dashboard&&!n?p`<button class="nf-card-full nf-card-dash ${e.fullscreen_button?"nf-card-dash-2":""}" title=${e.dashboard_label||e.dashboard} aria-label=${e.dashboard_label||e.dashboard} @click=${()=>this.openDashboard(e.dashboard)}>
|
||||
${e.dashboard_label?p`<span>${e.dashboard_label}</span>`:"\u2302"}
|
||||
</button>`:f}`}renderStage(e){let t=this.plan(),n=this._config,i=()=>{this._clean=!this._clean,this._clean?this.kiosk.stopClean():this.kiosk.armClean()},o=n?.controls_hidden!==void 0||(n?.controls_hide_after??0)>0;return p`<nf-view3d
|
||||
.hass=${jr(bt(this.hass,t.floors),t.settings)}
|
||||
.hass=${Zr(xt(this.hass,t.floors),t.settings)}
|
||||
.building=${t}
|
||||
.packs=${this.data.packs}
|
||||
.floorId=${e.floorId}
|
||||
.roomId=${this._roomId===Gt?null:this._roomId}
|
||||
.outsideOpen=${this._roomId===Gt}
|
||||
.roomId=${this._roomId===Zt?null:this._roomId}
|
||||
.outsideOpen=${this._roomId===Zt}
|
||||
.wallMode=${e.walls}
|
||||
.solidWalls=${n?.solid_walls===!0}
|
||||
.explode=${e.explode}
|
||||
@@ -4246,7 +4299,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.zoom=${typeof n?.zoom=="number"?n.zoom:1}
|
||||
.buttons=${n?.buttons?.map((s,a)=>({id:`card_${a}`,...s}))??null}
|
||||
.heatMode=${e.heat}
|
||||
.theme=${Ir(n?.theme,this.hass?.states["sun.sun"]?.state)}
|
||||
.theme=${Cr(n?.theme,this.hass?.states["sun.sun"]?.state)}
|
||||
.clock=${n?.clock&&n.clock!=="none"?n.clock:null}
|
||||
.lockButton=${n?.lock_button!==!1}
|
||||
.walkButton=${n?.walk_button!==!1}
|
||||
@@ -4264,10 +4317,10 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.panelOpen=${!!this._roomId&&n?.room_panel!==!1}
|
||||
.alerts=${n?.alerts!==!1}
|
||||
.alertJump=${!!n?.alert_jump}
|
||||
.announcements=${!G(this.hass)&&n?.announcements!==!1&&!Pu()}
|
||||
.announcements=${!K(this.hass)&&n?.announcements!==!1&&!Nu()}
|
||||
.sensorBar=${n?.sensor_bar!==!1}
|
||||
.glassWalls=${typeof n?.glass_walls=="number"?Math.min(100,Math.max(0,n.glass_walls)):null}
|
||||
.screenName=${n?.screen_name??Hu()}
|
||||
.screenName=${n?.screen_name??Iu()}
|
||||
.scenes=${n?.scenes!==!1}
|
||||
.clean=${this._clean}
|
||||
.cleanButton=${o}
|
||||
@@ -4285,14 +4338,14 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
></nf-view3d>`}renderRoomPanel(){let e=this.plan();return p`<nf-room-panel
|
||||
.building=${this.plan()??null}
|
||||
class="nf-card-panel"
|
||||
.hass=${bt(this.hass,e.floors)}
|
||||
.hass=${xt(this.hass,e.floors)}
|
||||
.room=${e.floors.flatMap(t=>t.rooms).find(t=>t.id===this._roomId)??null}
|
||||
.floor=${e.floors.find(t=>t.rooms.some(n=>n.id===this._roomId))??null}
|
||||
.outside=${this._roomId===Gt?ln(this.hass,e.floors):null}
|
||||
.confirmEntities=${mt(this.hass,e.floors)}
|
||||
.outside=${this._roomId===Zt?dn(this.hass,e.floors):null}
|
||||
.confirmEntities=${_t(this.hass,e.floors)}
|
||||
.phrases=${e.settings.announce_phrases??null}
|
||||
@close=${()=>this._roomId=null}
|
||||
></nf-room-panel>`}render(){if(this.hass&&gr(this.hass,this))return f;let e=this.plan(),t=this._config;!this.roomApplied&&e&&t?.room&&(this.roomApplied=!0,e.floors.some(a=>a.rooms.some(l=>l.id===t.room))&&(this._roomId=t.room));let n=this.stage(),i=this._fullscreen?"100vh":t?.fill?"calc(100vh - var(--header-height, 56px) - 16px)":`${t?.height??420}px`,o=/^#[0-9a-f]{6}$/i.test(t?.accent??"")?t.accent:null,s=()=>this.kiosk.touched();return p`<ha-card class=${this._night?"nf-night":""} style=${o?`--nf-accent:${o}`:""} @pointerdown=${s} @keydown=${s} @wheel=${s}>
|
||||
></nf-room-panel>`}render(){if(this.hass&&vr(this.hass,this))return f;let e=this.plan(),t=this._config;!this.roomApplied&&e&&t?.room&&(this.roomApplied=!0,e.floors.some(a=>a.rooms.some(l=>l.id===t.room))&&(this._roomId=t.room));let n=this.stage(),i=this._fullscreen?"100vh":t?.fill?"calc(100vh - var(--header-height, 56px) - 16px)":`${t?.height??420}px`,o=/^#[0-9a-f]{6}$/i.test(t?.accent??"")?t.accent:null,s=()=>this.kiosk.touched();return p`<ha-card class=${this._night?"nf-night":""} style=${o?`--nf-accent:${o}`:""} @pointerdown=${s} @keydown=${s} @wheel=${s}>
|
||||
<div class="nf-card-body" style="height:${i}">
|
||||
${e&&e.floors.some(a=>a.rooms.length)?this.renderStage(n):p`<p class="nf-card-msg">${this.data.error??(e?$(this.hass,"no_building"):$(this.hass,"loading"))}</p>`}
|
||||
${this._roomId&&e&&t?.room_panel!==!1?this.renderRoomPanel():f}
|
||||
@@ -4300,7 +4353,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${n.showBar&&e?this.renderBar(n):f}
|
||||
${this.renderCorners()}
|
||||
</div>
|
||||
</ha-card>`}static styles=[ge,Re,Ou,wr]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",jo);let r=window;r.customCards=r.customCards??[],r.customCards.push({type:"nextfloor-card",name:$(void 0,"card_name"),description:$(void 0,"card_description"),preview:!1})}vi();var Ef="nextfloor-chunks-v1";async function qo(r,e,t){let n=await fetch(`${r.endpoint}/api?token=${encodeURIComponent(r.token)}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},credentials:"same-origin",body:JSON.stringify({...t,action:e,transport:Ef})}),i=await n.text(),o;try{o=JSON.parse(i)}catch{throw/Output-Buffer exceeds Limit/i.test(i)?new Error("Symcon hat die Antwort wegen seiner Ausgabebegrenzung abgebrochen. Bitte das NextFloor-Modul aktualisieren und den Designer neu laden."):new Error(`Symcon liefert ${i.trim()?"kein g\xFCltiges JSON":"eine leere Antwort"} f\xFCr \u201E${e}\u201C (HTTP ${n.status}).`)}if(!n.ok||!o||typeof o!="object"||"error"in o){let s=o&&typeof o=="object"&&"error"in o?o.error:`HTTP ${n.status}`;throw new Error(String(s))}return o}async function Ut(r,e,t={}){let n=await qo(r,e,t);if(!("_nextfloor_transfer"in n))return n;let i=n._nextfloor_transfer;if(!i||!/^[a-f0-9]{32}$/.test(i.id)||!Number.isSafeInteger(i.bytes)||i.bytes<=0||i.bytes>67108864||!Number.isSafeInteger(i.chunk_bytes)||i.chunk_bytes<=0||i.chunk_bytes>128*1024||i.chunks!==Math.ceil(i.bytes/i.chunk_bytes)||i.chunks>512)throw new Error("Symcon hat eine ung\xFCltige Daten\xFCbertragung angek\xFCndigt.");try{let o=new TextDecoder("utf-8",{fatal:!0}),s=[];for(let a=0;a<i.chunks;a++){let l=await qo(r,"transport/read",{transfer_id:i.id,index:a});if(l.index!==a||typeof l.data!="string")throw new Error("Ein Symcon-Datenpaket fehlt oder ist ung\xFCltig.");let c=Uint8Array.from(atob(l.data),u=>u.charCodeAt(0));if(c.length!==Math.min(i.chunk_bytes,i.bytes-a*i.chunk_bytes))throw new Error("Ein Symcon-Datenpaket wurde unvollst\xE4ndig \xFCbertragen.");s.push(o.decode(c,{stream:!0}))}return s.push(o.decode()),JSON.parse(s.join(""))}finally{await qo(r,"transport/release",{transfer_id:i.id}).catch(()=>{})}}function Rf(){let r=window.__NEXTFLOOR_SYMCON__;if(!r?.endpoint||!r.token)throw new Error("NextFloor Symcon host configuration is missing");return r}var ei=class{settings=Rf();changeListeners=new Set;buildingListeners=new Set;timer;stateRevision=-1;buildingRevision=-1;objectsSignature="";refreshTask;states={};entities={};areas={};facade={language:this.settings.language||navigator.language||"de",user:{is_admin:!0,name:this.settings.title||"IP-Symcon"},states:this.states,entities:this.entities,areas:this.areas,symconObjects:[],symconTitle:this.settings.title?.trim()||"NextFloor",symconRefresh:()=>this.refresh(!0),config:{unit_system:{temperature:"\xB0C"}},themes:{darkMode:window.matchMedia?.("(prefers-color-scheme: dark)").matches??!0},services:{},connection:{subscribeMessage:async(e,t)=>{if(t.type==="nextfloor/building/subscribe"){let n=i=>e({revision:i});return this.buildingListeners.add(n),async()=>{this.buildingListeners.delete(n)}}return async()=>{}}},callWS:e=>this.callWS(e),callService:(e,t,n)=>this.callService(e,t,n),fetchWithAuth:(e,t)=>this.fetchWithToken(e,t),hassUrl:(e="")=>new URL(e,window.location.origin).href};async start(){let e=await Ut(this.settings,"bootstrap");return this.apply(e),this.stateRevision=e.state_revision,this.buildingRevision=e.building_revision,this.timer=setInterval(()=>{this.refresh().catch(()=>{})},800),this.snapshot()}stop(){this.timer&&clearInterval(this.timer),this.timer=void 0}onChange(e){return this.changeListeners.add(e),()=>this.changeListeners.delete(e)}snapshot(){return{...this.facade,states:{...this.states},entities:{...this.entities},areas:{...this.areas}}}refresh(e=!1){if(this.refreshTask)return e?this.refreshTask.catch(()=>{}).then(()=>this.refresh(!0)):this.refreshTask;let t=this.loadSnapshot(e).finally(()=>{this.refreshTask===t&&(this.refreshTask=void 0)});return this.refreshTask=t,t}async loadSnapshot(e){let t=e?await Ut(this.settings,"bootstrap"):await Ut(this.settings,"variables/snapshot",{revision:this.stateRevision});if((e||t.state_revision!==this.stateRevision)&&t.variables){this.stateRevision=t.state_revision,this.apply({variables:t.variables,areas:t.areas,objects:t.objects});for(let n of this.changeListeners)n()}if(t.building_revision!==this.buildingRevision){this.buildingRevision=t.building_revision;for(let n of this.buildingListeners)n(t.building_revision)}}apply(e){this.states=Object.fromEntries(e.variables.map(t=>[t.entity_id,{entity_id:t.entity_id,state:t.state,attributes:{...t.attributes,friendly_name:t.name,symcon_path:t.path}}])),this.entities=Object.fromEntries(e.variables.map(t=>[t.entity_id,{entity_id:t.entity_id,name:t.name,area_id:t.area_id??null,device_id:t.device_id??null}]));for(let t of Object.values(this.states))for(let n of["light","cover"]){let i=na(t,n);!i||i.entity_id===t.entity_id||this.states[i.entity_id]||(this.staLine truncated
|
||||
</ha-card>`}static styles=[ge,Re,Vu,Sr]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",Yo);let r=window;r.customCards=r.customCards??[],r.customCards.push({type:"nextfloor-card",name:$(void 0,"card_name"),description:$(void 0,"card_description"),preview:!1})}wi();var zf="nextfloor-chunks-v1";async function Jo(r,e,t){let n=await fetch(`${r.endpoint}/api?token=${encodeURIComponent(r.token)}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},credentials:"same-origin",body:JSON.stringify({...t,action:e,transport:zf})}),i=await n.text(),o;try{o=JSON.parse(i)}catch{throw/Output-Buffer exceeds Limit/i.test(i)?new Error("Symcon hat die Antwort wegen seiner Ausgabebegrenzung abgebrochen. Bitte das NextFloor-Modul aktualisieren und den Designer neu laden."):new Error(`Symcon liefert ${i.trim()?"kein g\xFCltiges JSON":"eine leere Antwort"} f\xFCr \u201E${e}\u201C (HTTP ${n.status}).`)}if(!n.ok||!o||typeof o!="object"||"error"in o){let s=o&&typeof o=="object"&&"error"in o?o.error:`HTTP ${n.status}`;throw new Error(String(s))}return o}async function Yt(r,e,t={}){let n=await Jo(r,e,t);if(!("_nextfloor_transfer"in n))return n;let i=n._nextfloor_transfer;if(!i||!/^[a-f0-9]{32}$/.test(i.id)||!Number.isSafeInteger(i.bytes)||i.bytes<=0||i.bytes>67108864||!Number.isSafeInteger(i.chunk_bytes)||i.chunk_bytes<=0||i.chunk_bytes>128*1024||i.chunks!==Math.ceil(i.bytes/i.chunk_bytes)||i.chunks>512)throw new Error("Symcon hat eine ung\xFCltige Daten\xFCbertragung angek\xFCndigt.");try{let o=new TextDecoder("utf-8",{fatal:!0}),s=[];for(let a=0;a<i.chunks;a++){let l=await Jo(r,"transport/read",{transfer_id:i.id,index:a});if(l.index!==a||typeof l.data!="string")throw new Error("Ein Symcon-Datenpaket fehlt oder ist ung\xFCltig.");let c=Uint8Array.from(atob(l.data),u=>u.charCodeAt(0));if(c.length!==Math.min(i.chunk_bytes,i.bytes-a*i.chunk_bytes))throw new Error("Ein Symcon-Datenpaket wurde unvollst\xE4ndig \xFCbertragen.");s.push(o.decode(c,{stream:!0}))}return s.push(o.decode()),JSON.parse(s.join(""))}finally{await Jo(r,"transport/release",{transfer_id:i.id}).catch(()=>{})}}function Tf(){let r=window.__NEXTFLOOR_SYMCON__;if(!r?.endpoint||!r.token)throw new Error("NextFloor Symcon host configuration is missing");return r}var ni=class{settings=Tf();changeListeners=new Set;buildingListeners=new Set;timer;stateRevision=-1;buildingRevision=-1;objectsSignature="";refreshTask;states={};entities={};areas={};facade={language:this.settings.language||navigator.language||"de",user:{is_admin:!0,name:this.settings.title||"IP-Symcon"},states:this.states,entities:this.entities,areas:this.areas,symconObjects:[],symconTitle:this.settings.title?.trim()||"NextFloor",symconRefresh:()=>this.refresh(!0),config:{unit_system:{temperature:"\xB0C"}},themes:{darkMode:window.matchMedia?.("(prefers-color-scheme: dark)").matches??!0},services:{},connection:{subscribeMessage:async(e,t)=>{if(t.type==="nextfloor/building/subscribe"){let n=i=>e({revision:i});return this.buildingListeners.add(n),async()=>{this.buildingListeners.delete(n)}}return async()=>{}}},callWS:e=>this.callWS(e),callService:(e,t,n)=>this.callService(e,t,n),fetchWithAuth:(e,t)=>this.fetchWithToken(e,t),hassUrl:(e="")=>new URL(e,window.location.origin).href};async start(){let e=await Yt(this.settings,"bootstrap");return this.apply(e),this.stateRevision=e.state_revision,this.buildingRevision=e.building_revision,this.timer=setInterval(()=>{this.refresh().catch(()=>{})},800),this.snapshot()}stop(){this.timer&&clearInterval(this.timer),this.timer=void 0}onChange(e){return this.changeListeners.add(e),()=>this.changeListeners.delete(e)}snapshot(){return{...this.facade,states:{...this.states},entities:{...this.entities},areas:{...this.areas}}}refresh(e=!1){if(this.refreshTask)return e?this.refreshTask.catch(()=>{}).then(()=>this.refresh(!0)):this.refreshTask;let t=this.loadSnapshot(e).finally(()=>{this.refreshTask===t&&(this.refreshTask=void 0)});return this.refreshTask=t,t}async loadSnapshot(e){let t=e?await Yt(this.settings,"bootstrap"):await Yt(this.settings,"variables/snapshot",{revision:this.stateRevision});if((e||t.state_revision!==this.stateRevision)&&t.variables){this.stateRevision=t.state_revision,this.apply({variables:t.variables,areas:t.areas,objects:t.objects});for(let n of this.changeListeners)n()}if(t.building_revision!==this.buildingRevision){this.buildingRevision=t.building_revision;for(let n of this.buildingListeners)n(t.building_revision)}}apply(e){this.states=Object.fromEntries(e.variables.map(t=>[t.entity_id,{entity_id:t.entity_id,state:t.state,attributes:{...t.attributes,friendly_name:t.name,symcon_path:t.path}}])),this.entities=Object.fromEntries(e.variables.map(t=>[t.entity_id,{entity_id:t.entity_id,name:t.name,area_id:t.area_id??null,device_id:t.device_id??null}]));for(let t of Object.values(this.states))for(let n of["light","cover"]){let i=oa(t,n);!i||i.entity_id===t.entity_id||this.states[i.entity_id]||(this.staLine truncated
|
||||
/*! Bundled license information:
|
||||
|
||||
@lit/reactive-element/css-tag.js:
|
||||
|
||||
@@ -1816,7 +1816,7 @@ ${i}`}else o=Rh(s)}}catch(s){let l=s.message,a={not_json:"import_error_not_json"
|
||||
<div class="nf-form">${lk(t,e)}</div>
|
||||
${M(o("solar_string_hint"))} ${M(o("solar_form_hint"))}
|
||||
${n.admin?X(m`<button class="nf-btn" ?disabled=${!l} @click=${()=>l&&i({...Vn(l,e.id),portrait:e.portrait})}>${o("solar_fit")}</button>`,m`<button class="nf-btn nf-danger" @click=${()=>r.removeField()}>${o("delete")}</button>`):_}
|
||||
</section>`}var wg=t=>Math.round(t*1e3)/1e3,qi=class{ctx;sectionSel=null;windowSel=null;chimneySel=null;fieldSel=null;pickMode=!1;constructor(e){this.ctx=e}get sectionId(){return this.sectionSel}set sectionId(e){this.sectionSel=e,this.ctx.refresh()}get windowId(){return this.windowSel}set windowId(e){this.windowSel=e,this.ctx.refresh()}get chimneyId(){return this.chimneySel}set chimneyId(e){this.chimneySel=e,e&&(this.windowSel=null),this.ctx.refresh()}get solarId(){return this.fieldSel}set solarId(e){this.fieldSel=e,this.ctx.refresh()}get picking(){return this.pickMode}set picking(e){this.pickMode=e,this.ctx.refresh()}get doc(){return this.ctx.host.doc}get settings(){return this.doc.settings.roof}get admin(){return this.ctx.host.admin}get section(){return this.sectionSel?this.settings.sections?.find(e=>e.id===this.sectionSel):void 0}get window(){return this.windowSel?this.settings.windows?.find(e=>e.id===this.windowSel):void 0}get chimney(){return this.chimneySel?this.settings.chimneys?.find(e=>e.id===this.chimneySel):void 0}get field(){return this.fieldSel?this.settings.solar?.find(e=>e.id===this.fieldSel):void 0}isFixed(e){return!!e&&(!!e.locked||!!this.doc.settings.lock_plan)}useSections(e=!1){if(!this.admin)return;let n=(this.settings.sections??[]).length>0;e&&n&&!this.ctx.confirm(this.ctx.host.t("roof_regen_confirm"))||(this.ctx.host.change(r=>{r.settings.roof.type="custom",(e||!n)&&(r.settings.roof.sections=la(r,()=>I("roof")))}),this.sectionId=null)}addSection(e,n){if(!this.admin)return;let r=of(this.doc,e,n);this.ctx.host.change(o=>{o.settings.roof.type="custom",o.settings.roof.sections=[...o.settings.roof.sections??[],r]}),this.sectionId=r.id}takeOutline(){let e=this.ctx.host.floor;if(!e||!this.sectionSel||!this.admin)return;let{wall_exterior:n,wall_interior:r}=this.doc.settings,o=ea(e.rooms,e.walls??[],n,r);if(!o)return;let i=o.map(([s,l])=>[wg(s),wg(l)]);this.patchSection({shape:"flat",points:i,...Nt(i)})}addDormer(e){let n=this.section;if(!n||!this.admin)return;let r=ta(n,e,I("roof"));this.ctx.host.change(o=>{o.settings.roof.sections=[...o.settings.roof.sections??[],r]}),this.sectionId=r.id}patchSection(e){let n=this.sectionSel;!n||!this.admin||this.ctx.host.change(r=>{let o=r.settings.roof.sections?.find(i=>i.id===n);o&&Object.assign(o,e)})}removeCorner(e){let n=this.sectionSel;!n||!this.admin||this.ctx.host.change(r=>{let o=r.settings.roof.sections?.find(i=>i.id===n);o&&cf(o,e)})}removeSection(){let e=this.sectionSel;!e||!this.admin||(this.ctx.host.change(n=>n.settings.roof.sections=(n.settings.roof.sections??[]).filter(r=>r.id!==e)),this.sectionId=null)}duplicateSection(){let e=this.section;if(!e||!this.admin)return;let n=sf(e);this.ctx.host.change(r=>r.settings.roof.sections=[...r.settings.roof.sections??[],n]),this.sectionId=n.id}addWindow(){if(!this.admin)return;let e=this.doc.settings.north??0,n=Yr(Z(this.doc).filter(o=>!o.flat),e)??Z(this.doc)[0];if(!n)return;let r=Zr(n,I("rwin"));this.ctx.host.change(o=>o.settings.roof.windows=[...o.settings.roof.windows??[],r]),this.windowSel=r.id,this.sectionId=null}patchWindow(e){let n=this.windowSel;!n||!this.admin||this.ctx.host.change(r=>{let o=r.settings.roof.windows?.find(s=>s.id===n);if(!o)return;Object.assign(o,e);let i=Z(r).find(s=>s.key===o.face);i&&Object.assign(o,ft(i,dn(o)))})}removeWindow(){let e=this.windowSel;!e||!this.admin||(this.ctx.host.change(n=>n.settings.roof.windows=(n.settings.roof.windows??[]).filter(r=>r.id!==e)),this.windowId=null)}addChimney(){if(!this.admin)return;let e=Z(this.doc),n=e.find(o=>!o.flat)??e[0];if(!n)return;let r=qr(n,I("chim"));this.ctx.host.change(o=>o.settings.roof.chimneys=[...o.settings.roof.chimneys??[],r]),this.chimneySel=r.id,this.windowSel=null,this.sectionId=null}patchChimney(e){let n=this.chimneySel;!n||!this.admin||this.ctx.host.change(r=>{let o=r.settings.roof.chimneys?.find(s=>s.id===n);if(!o)return;Object.assign(o,e);let i=Z(r).find(s=>s.key===o.face);i&&Object.assign(o,ft(i,kt(o,i)))})}removeChimney(){let e=this.chimneySel;!e||!this.admin||(this.ctx.host.change(n=>n.settings.roof.chimneys=(n.settings.roof.chimneys??[]).filter(r=>r.id!==e)),this.chimneyId=null)}addField(){if(!this.admin)return;let e=Z(this.doc),n=new Set((this.settings.solar??[]).map(i=>i.face)),r=this.doc.settings.north??0,o=Yr(e.filter(i=>!n.has(i.key)),r)??Yr(e,r);o&&(this.appendField(Vn(o,I("pv"))),this.sectionSel=null)}addWallField(){let e=this.ctx.floorId()??this.doc.floors[0]?.id,n=this.admin&&e?fa(this.doc,I("pv"),e):null;n&&this.appendField(n)}addGroundField(){this.admin&&this.appendField(Gr(this.doc,I("pv")))}appendField(e){this.ctx.host.change(n=>n.settings.roof.solar=[...n.settings.roof.solar??[],e]),this.solarId=e.id}selectField(e){this.fieldSel=e,this.sectionSel=null;let n=this.settings.solar?.find(r=>r.id===e);n?.face.startsWith("wall:")&&this.ctx.setFloorId(n.face.split(":")[1]),this.ctx.refresh()}patchField(e){this.editField((n,r)=>{Object.assign(n,e);let o=$e(r,n);o&&Object.assign(n,ft(o,n))})}toggleCellLine truncated
|
||||
</section>`}var wg=t=>Math.round(t*1e3)/1e3,qi=class{ctx;sectionSel=null;windowSel=null;chimneySel=null;fieldSel=null;pickMode=!1;constructor(e){this.ctx=e}get sectionId(){return this.sectionSel}set sectionId(e){this.sectionSel=e,this.ctx.refresh()}get windowId(){return this.windowSel}set windowId(e){this.windowSel=e,this.ctx.refresh()}get chimneyId(){return this.chimneySel}set chimneyId(e){this.chimneySel=e,e&&(this.windowSel=null),this.ctx.refresh()}get solarId(){return this.fieldSel}set solarId(e){this.fieldSel=e,this.ctx.refresh()}get picking(){return this.pickMode}set picking(e){this.pickMode=e,this.ctx.refresh()}get doc(){return this.ctx.host.doc}get settings(){return this.doc.settings.roof}get admin(){return this.ctx.host.admin}get section(){return this.sectionSel?this.settings.sections?.find(e=>e.id===this.sectionSel):void 0}get window(){return this.windowSel?this.settings.windows?.find(e=>e.id===this.windowSel):void 0}get chimney(){return this.chimneySel?this.settings.chimneys?.find(e=>e.id===this.chimneySel):void 0}get field(){return this.fieldSel?this.settings.solar?.find(e=>e.id===this.fieldSel):void 0}isFixed(e){return!!e&&(!!e.locked||!!this.doc.settings.lock_plan)}useSections(e=!1){if(!this.admin)return;let n=(this.settings.sections??[]).length>0;e&&n&&!this.ctx.confirm(this.ctx.host.t("roof_regen_confirm"))||(this.ctx.host.change(r=>{r.settings.roof.type="custom",(e||!n)&&(r.settings.roof.sections=la(r,()=>I("roof")))}),this.sectionId=null)}addSection(e,n){if(!this.admin)return;let r=of(this.doc,e,n);this.ctx.host.change(o=>{o.settings.roof.type="custom",o.settings.roof.sections=[...o.settings.roof.sections??[],r]}),this.sectionId=r.id}takeOutline(){let e=this.ctx.host.floor;if(!e||!this.sectionSel||!this.admin)return;let{wall_exterior:n,wall_interior:r}=this.doc.settings,o=ea(e.rooms,e.walls??[],n,r);if(!o)return;let i=o.map(([s,l])=>[wg(s),wg(l)]);this.patchSection({shape:"flat",points:i,...Nt(i)})}addDormer(e){let n=this.section;if(!n||!this.admin)return;let r=ta(n,e,I("roof"));this.ctx.host.change(o=>{o.settings.roof.sections=[...o.settings.roof.sections??[],r]}),this.sectionId=r.id}patchSection(e){let n=this.sectionSel;!n||!this.admin||this.ctx.host.change(r=>{let o=r.settings.roof.sections?.find(i=>i.id===n);o&&Object.assign(o,e)})}removeCorner(e){let n=this.sectionSel;!n||!this.admin||this.ctx.host.change(r=>{let o=r.settings.roof.sections?.find(i=>i.id===n);o&&cf(o,e)})}removeSection(){let e=this.sectionSel;!e||!this.admin||(this.ctx.host.change(n=>n.settings.roof.sections=(n.settings.roof.sections??[]).filter(r=>r.id!==e)),this.sectionId=null)}duplicateSection(){let e=this.section;if(!e||!this.admin)return;let n=sf(e);this.ctx.host.change(r=>r.settings.roof.sections=[...r.settings.roof.sections??[],n]),this.sectionId=n.id}addWindow(){if(!this.admin)return;let e=this.doc.settings.north??0,n=Yr(Z(this.doc).filter(o=>!o.flat),e)??Z(this.doc)[0];if(!n)return;let r=Zr(n,I("rwin"));this.ctx.host.change(o=>o.settings.roof.windows=[...o.settings.roof.windows??[],r]),this.windowSel=r.id,this.sectionId=null}patchWindow(e){let n=this.windowSel;!n||!this.admin||this.ctx.host.change(r=>{let o=r.settings.roof.windows?.find(s=>s.id===n);if(!o)return;Object.assign(o,e);let i=Z(r).find(s=>s.key===o.face);i&&Object.assign(o,ft(i,dn(o)))})}removeWindow(){let e=this.windowSel;!e||!this.admin||(this.ctx.host.change(n=>n.settings.roof.windows=(n.settings.roof.windows??[]).filter(r=>r.id!==e)),this.windowId=null)}addChimney(){if(!this.admin)return;let e=Z(this.doc),n=e.find(o=>!o.flat)??e[0];if(!n)return;let r=qr(n,I("chim"));this.ctx.host.change(o=>o.settings.roof.chimneys=[...o.settings.roof.chimneys??[],r]),this.chimneySel=r.id,this.windowSel=null,this.sectionId=null}patchChimney(e){let n=this.chimneySel;!n||!this.admin||this.ctx.host.change(r=>{let o=r.settings.roof.chimneys?.find(s=>s.id===n);if(!o)return;Object.assign(o,e);let i=Z(r).find(s=>s.key===o.face);i&&Object.assign(o,ft(i,kt(o,i)))})}removeChimney(){let e=this.chimneySel;!e||!this.admin||(this.ctx.host.change(n=>n.settings.roof.chimneys=(n.settings.roof.chimneys??[]).filter(r=>r.id!==e)),this.chimneyId=null)}addField(){if(!this.admin)return;let e=Z(this.doc),n=new Set((this.settings.solar??[]).map(i=>i.face)),r=this.doc.settings.north??0,o=Yr(e.filter(i=>!n.has(i.key)),r)??Yr(e,r);o&&(this.appendField(Vn(o,I("pv"))),this.sectionSel=null)}addWallField(){let e=this.ctx.floorId()??this.doc.floors[0]?.id,n=this.admin&&e?fa(this.doc,I("pv"),e):null;n&&this.appendField(n)}addGroundField(){this.admin&&this.appendField(Gr(this.doc,I("pv")))}appendField(e){this.ctx.host.change(n=>n.settings.roof.solar=[...n.settings.roof.solar??[],e]),this.solarId=e.id}selectField(e){this.fieldSel=e,this.sectionSel=null;let n=this.settings.solar?.find(r=>r.id===e);n?.face.startsWith("wall:")&&this.ctx.setFloorId(n.face.split(":")[1]),this.ctx.refresh()}patchField(e){this.editField((n,r)=>{Object.assign(n,e);let o=$e(r,n);o&&Object.assign(n,ft(o,n))})}toggleCellLine truncated
|
||||
<svg width="12" height="12" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M3 2v15h15M5 13l4-5 4 2 4-6"/></svg>
|
||||
</button>${this.error?m`<span role="alert">${this.error}</span>`:_}`}static styles=J`:host{position:relative;display:inline-flex;flex:0 0 18px;width:18px;height:18px;vertical-align:middle;margin-left:3px;font-weight:normal;line-height:0}button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:18px;height:18px;padding:2px;border:0;border-radius:3px;background:transparent;color:var(--nf-accent,#40c8ff);opacity:.8;cursor:pointer}svg{display:block;flex-shrink:0}button:hover,button:focus-visible{opacity:1;background:#40c8ff18}button:focus-visible{outline:1px solid currentColor;outline-offset:1px}button:disabled{opacity:.4}span{position:absolute;right:0;top:22px;z-index:10;box-sizing:border-box;width:200px;padding:8px;border:1px solid #ff9b9b50;border-radius:6px;background:var(--nf-chrome-solid,#1c1c1c);font:12px/1.4 system-ui;color:#ff9b9b;white-space:normal}`};customElements.get("nf-trend-button")||customElements.define("nf-trend-button",Vl);function Cg(t,e,n=""){let r=Wl(t,e);return r.length?m`<nf-trend-button .hass=${t} .ids=${r} .label=${n}></nf-trend-button>`:_}var Kl=class extends Y{static properties={hass:{attribute:!1},readings:{attribute:!1}};constructor(){super(),this.readings=[]}render(){return m`${Sn.filter(e=>this.readings.some(n=>n.kind===e)).map(e=>m`<section aria-label=${sr[e]}>
|
||||
<h4>${ts[e]} ${sr[e]}</h4>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
|
||||
var B=globalThis,j=B.ShadowRoot&&(B.ShadyCSS===void 0||B.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Z=Symbol(),ht=new WeakMap,H=class{constructor(t,i,r){if(this._$cssResult$=!0,r!==Z)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=i}get styleSheet(){let t=this.o,i=this.t;if(j&&t===void 0){let r=i!==void 0&&i.length===1;r&&(t=ht.get(i)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&ht.set(i,t))}return t}toString(){return this.cssText}},ct=s=>new H(typeof s=="string"?s:s+"",void 0,Z),y=(s,...t)=>{let i=s.length===1?s[0]:t.reduce((r,e,n)=>r+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(e)+s[n+1],s[0]);return new H(i,s,Z)},dt=(s,t)=>{if(j)s.adoptedStyleSheets=t.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet);else for(let i of t){let r=document.createElement("style"),e=B.litNonce;e!==void 0&&r.setAttribute("nonce",e),r.textContent=i.cssText,s.appendChild(r)}},F=j?s=>s:s=>s instanceof CSSStyleSheet?(t=>{let i="";for(let r of t.cssRules)i+=r.cssText;return ct(i)})(s):s;var{is:Rt,defineProperty:Ht,getOwnPropertyDescriptor:Ot,getOwnPropertyNames:Lt,getOwnPropertySymbols:Nt,getPrototypeOf:Ut}=Object,V=globalThis,pt=V.trustedTypes,Dt=pt?pt.emptyScript:"",It=V.reactiveElementPolyfillSupport,O=(s,t)=>s,K={toAttribute(s,t){switch(t){case Boolean:s=s?Dt:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,t){let i=s;switch(t){case Boolean:i=s!==null;break;case Number:i=s===null?null:Number(s);break;case Object:case Array:try{i=JSON.parse(s)}catch{i=null}}return i}},ft=(s,t)=>!Rt(s,t),ut={attribute:!0,type:String,converter:K,reflect:!1,useDefault:!1,hasChanged:ft};Symbol.metadata??=Symbol("metadata"),V.litPropertyMetadata??=new WeakMap;var _=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,i=ut){if(i.state&&(i.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((i=Object.create(i)).wrapped=!0),this.elementProperties.set(t,i),!i.noAccessor){let r=Symbol(),e=this.getPropertyDescriptor(t,r,i);e!==void 0&&Ht(this.prototype,t,e)}}static getPropertyDescriptor(t,i,r){let{get:e,set:n}=Ot(this.prototype,t)??{get(){return this[i]},set(o){this[i]=o}};return{get:e,set(o){let h=e?.call(this);n?.call(this,o),this.requestUpdate(t,h,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??ut}static _$Ei(){if(this.hasOwnProperty(O("elementProperties")))return;let t=Ut(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(O("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(O("properties"))){let i=this.properties,r=[...Lt(i),...Nt(i)];for(let e of r)this.createProperty(e,i[e])}let t=this[Symbol.metadata];if(t!==null){let i=litPropertyMetadata.get(t);if(i!==void 0)for(let[r,e]of i)this.elementProperties.set(r,e)}this._$Eh=new Map;for(let[i,r]of this.elementProperties){let e=this._$Eu(i,r);e!==void 0&&this._$Eh.set(e,i)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let i=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let e of r)i.unshift(F(e))}else t!==void 0&&i.push(F(t));return i}static _$Eu(t,i){let r=i.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,i=this.constructor.elementProperties;for(let r of i.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return dt(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,i,r){this._$AK(t,r)}_$ET(t,i){let r=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,r);if(e!==void 0&&r.reflect===!0){let n=(r.converter?.toAttribute!==void 0?r.converter:K).toAttribute(i,r.type);this._$Em=t,n==null?this.removeAttribute(e):this.setAttribute(e,n),Line truncated
|
||||
\f\r]`,L=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,bt=/-->/g,vt=/>/g,E=RegExp(`>|${Y}(?:([^\\s"'>=/]+)(${Y}*=${Y}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),$t=/'/g,xt=/"/g,St=/^(?:script|style|textarea|title)$/i,rt=s=>(t,...i)=>({_$litType$:s,strings:t,values:i}),g=rt(1),A=rt(2),Jt=rt(3),T=Symbol.for("lit-noChange"),u=Symbol.for("lit-nothing"),yt=new WeakMap,k=M.createTreeWalker(M,129);function At(s,t){if(!it(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return gt!==void 0?gt.createHTML(t):t}var Vt=(s,t)=>{let i=s.length-1,r=[],e,n=t===2?"<svg>":t===3?"<math>":"",o=L;for(let h=0;h<i;h++){let a=s[h],c,p,d=-1,v=0;for(;v<a.length&&(o.lastIndex=v,p=o.exec(a),p!==null);)v=o.lastIndex,o===L?p[1]==="!--"?o=bt:p[1]!==void 0?o=vt:p[2]!==void 0?(St.test(p[2])&&(e=RegExp("</"+p[2],"g")),o=E):p[3]!==void 0&&(o=E):o===E?p[0]===">"?(o=e??L,d=-1):p[1]===void 0?d=-2:(d=o.lastIndex-p[2].length,c=p[1],o=p[3]===void 0?E:p[3]==='"'?xt:$t):o===xt||o===$t?o=E:o===bt||o===vt?o=L:(o=E,e=void 0);let $=o===E&&s[h+1].startsWith("/>")?" ":"";n+=o===L?a+Bt:d>=0?(r.push(c),a.slice(0,d)+_t+a.slice(d)+S+$):a+S+(d===-2?h:$)}return[At(s,n+(s[i]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},D=class s{constructor({strings:t,_$litType$:i},r){let e;this.parts=[];let n=0,o=0,h=t.length-1,a=this.parts,[c,p]=Vt(t,i);if(this.el=s.createElement(c,r),k.currentNode=this.el.content,i===2||i===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(e=k.nextNode())!==null&&a.length<h;){if(e.nodeType===1){if(e.hasAttributes())for(let d of e.getAttributeNames())if(d.endsWith(_t)){let v=p[o++],$=e.getAttribute(d).split(S),w=/([.?@])?(.*)/.exec(v);a.push({type:1,index:n,name:w[2],strings:$,ctor:w[1]==="."?G:w[1]==="?"?X:w[1]==="@"?Q:R}),e.removeAttribute(d)}else d.startsWith(S)&&(a.push({type:6,index:n}),e.removeAttribute(d));if(St.test(e.tagName)){let d=e.textContent.split(S),v=d.length-1;if(v>0){e.textContent=W?W.emptyScript:"";for(let $=0;$<v;$++)e.append(d[$],N()),k.nextNode(),a.push({type:2,index:++n});e.append(d[v],N())}}}else if(e.nodeType===8)if(e.data===wt)a.push({type:2,index:n});else{let d=-1;for(;(d=e.data.indexOf(S,d+1))!==-1;)a.push({type:7,index:n}),d+=S.length-1}n++}}static createElement(t,i){let r=M.createElement("template");return r.innerHTML=t,r}};function P(s,t,i=s,r){if(t===T)return t;let e=r!==void 0?i._$Co?.[r]:i._$Cl,n=U(t)?void 0:t._$litDirective$;return e?.constructor!==n&&(e?._$AO?.(!1),n===void 0?e=void 0:(e=new n(s),e._$AT(s,i,r)),r!==void 0?(i._$Co??=[])[r]=e:i._$Cl=e),e!==void 0&&(t=P(s,e._$AS(s,t.values),e,r)),t}var J=class{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:i},parts:r}=this._$AD,e=(t?.creationScope??M).importNode(i,!0);k.currentNode=e;let n=k.nextNode(),o=0,h=0,a=r[0];for(;a!==void 0;){if(o===a.index){let c;a.type===2?c=new I(n,n.nextSibling,this,t):a.type===1?c=new a.ctor(n,a.name,a.strings,this,t):a.type===6&&(c=new tt(n,this,t)),this._$AV.push(c),a=r[++h]}o!==a?.index&&(n=k.nextNode(),o++)}return k.currentNode=M,e}p(t){let i=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,i),i+=r.strings.length-2):r._$AI(t[i])),i++}},I=class s{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,r,e){this.type=2,this._$AH=u,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=r,this.options=e,this._$Cv=e?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,i=this._$AM;return i!==void 0&&t?.nodeType===11&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=P(this,t,i),U(t)?t===u||t==null||t===""?(this._$AH!==u&&this._$AR(),this._$AH=u):t!==this._$AH&&t!==T&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):jt(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==u&&U(this._$AH)?this._$AA.nextSibling.data=t:this.T(M.createTextNode(t)),this._$AH=t}$(t){let{values:i,_$litType$:r}=t,e=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=D.createElement(At(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===e)this._$AH.p(i);else{let n=new J(e,this),o=n.u(this.options);n.p(i),this.T(o),this._$AH=n}}_$AC(t){let i=yt.get(t.strings);return i===void 0&&yt.set(t.strings,i=new D(t)),i}k(t){it(this._$AH)||(this._$AH=[],this._$AR());let i=this._$AH,r,e=0;for(let n of t)e===i.length?i.push(r=new s(this.O(N()),this.O(N()),this,this.options)):r=i[e],r._$AI(n),e++;e<i.length&&(this._$AR(r&&r._$AB.nextSibling,e),i.length=e)}_$AR(t=this._$AA.nextSibling,i){for(this._$AP?.(!1,!0,i);t!==this._$AB;){let r=mt(t).nextSibling;mt(t).remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},R=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,r,e,n){this.type=1,this._$AH=u,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this.Line truncated
|
||||
var j=globalThis,B=j.ShadowRoot&&(j.ShadyCSS===void 0||j.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,K=Symbol(),ct=new WeakMap,P=class{constructor(t,i,r){if(this._$cssResult$=!0,r!==K)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=i}get styleSheet(){let t=this.o,i=this.t;if(B&&t===void 0){let r=i!==void 0&&i.length===1;r&&(t=ct.get(i)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&ct.set(i,t))}return t}toString(){return this.cssText}},pt=s=>new P(typeof s=="string"?s:s+"",void 0,K),w=(s,...t)=>{let i=s.length===1?s[0]:t.reduce((r,e,n)=>r+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(e)+s[n+1],s[0]);return new P(i,s,K)},ut=(s,t)=>{if(B)s.adoptedStyleSheets=t.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet);else for(let i of t){let r=document.createElement("style"),e=j.litNonce;e!==void 0&&r.setAttribute("nonce",e),r.textContent=i.cssText,s.appendChild(r)}},Y=B?s=>s:s=>s instanceof CSSStyleSheet?(t=>{let i="";for(let r of t.cssRules)i+=r.cssText;return pt(i)})(s):s;var{is:Lt,defineProperty:Ot,getOwnPropertyDescriptor:Dt,getOwnPropertyNames:Nt,getOwnPropertySymbols:Ut,getPrototypeOf:It}=Object,V=globalThis,ft=V.trustedTypes,jt=ft?ft.emptyScript:"",Bt=V.reactiveElementPolyfillSupport,L=(s,t)=>s,J={toAttribute(s,t){switch(t){case Boolean:s=s?jt:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,t){let i=s;switch(t){case Boolean:i=s!==null;break;case Number:i=s===null?null:Number(s);break;case Object:case Array:try{i=JSON.parse(s)}catch{i=null}}return i}},mt=(s,t)=>!Lt(s,t),gt={attribute:!0,type:String,converter:J,reflect:!1,useDefault:!1,hasChanged:mt};Symbol.metadata??=Symbol("metadata"),V.litPropertyMetadata??=new WeakMap;var _=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,i=gt){if(i.state&&(i.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((i=Object.create(i)).wrapped=!0),this.elementProperties.set(t,i),!i.noAccessor){let r=Symbol(),e=this.getPropertyDescriptor(t,r,i);e!==void 0&&Ot(this.prototype,t,e)}}static getPropertyDescriptor(t,i,r){let{get:e,set:n}=Dt(this.prototype,t)??{get(){return this[i]},set(o){this[i]=o}};return{get:e,set(o){let d=e?.call(this);n?.call(this,o),this.requestUpdate(t,d,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??gt}static _$Ei(){if(this.hasOwnProperty(L("elementProperties")))return;let t=It(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(L("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(L("properties"))){let i=this.properties,r=[...Nt(i),...Ut(i)];for(let e of r)this.createProperty(e,i[e])}let t=this[Symbol.metadata];if(t!==null){let i=litPropertyMetadata.get(t);if(i!==void 0)for(let[r,e]of i)this.elementProperties.set(r,e)}this._$Eh=new Map;for(let[i,r]of this.elementProperties){let e=this._$Eu(i,r);e!==void 0&&this._$Eh.set(e,i)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let i=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let e of r)i.unshift(Y(e))}else t!==void 0&&i.push(Y(t));return i}static _$Eu(t,i){let r=i.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,i=this.constructor.elementProperties;for(let r of i.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ut(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,i,r){this._$AK(t,r)}_$ET(t,i){let r=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,r);if(e!==void 0&&r.reflect===!0){let n=(r.converter?.toAttribute!==void 0?r.converter:J).toAttribute(i,r.type);this._$Em=t,n==null?this.removeAttribute(e):this.setAttribute(e,n),Line truncated
|
||||
\f\r]`,O=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,xt=/-->/g,$t=/>/g,E=RegExp(`>|${G}(?:([^\\s"'>=/]+)(${G}*=${G}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),yt=/'/g,wt=/"/g,Et=/^(?:script|style|textarea|title)$/i,st=s=>(t,...i)=>({_$litType$:s,strings:t,values:i}),v=st(1),A=st(2),Xt=st(3),T=Symbol.for("lit-noChange"),u=Symbol.for("lit-nothing"),_t=new WeakMap,k=M.createTreeWalker(M,129);function kt(s,t){if(!nt(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return vt!==void 0?vt.createHTML(t):t}var qt=(s,t)=>{let i=s.length-1,r=[],e,n=t===2?"<svg>":t===3?"<math>":"",o=O;for(let d=0;d<i;d++){let l=s[d],h,p,c=-1,b=0;for(;b<l.length&&(o.lastIndex=b,p=o.exec(l),p!==null);)b=o.lastIndex,o===O?p[1]==="!--"?o=xt:p[1]!==void 0?o=$t:p[2]!==void 0?(Et.test(p[2])&&(e=RegExp("</"+p[2],"g")),o=E):p[3]!==void 0&&(o=E):o===E?p[0]===">"?(o=e??O,c=-1):p[1]===void 0?c=-2:(c=o.lastIndex-p[2].length,h=p[1],o=p[3]===void 0?E:p[3]==='"'?wt:yt):o===wt||o===yt?o=E:o===xt||o===$t?o=O:(o=E,e=void 0);let m=o===E&&s[d+1].startsWith("/>")?" ":"";n+=o===O?l+Vt:c>=0?(r.push(h),l.slice(0,c)+St+l.slice(c)+S+m):l+S+(c===-2?d:m)}return[kt(s,n+(s[i]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},U=class s{constructor({strings:t,_$litType$:i},r){let e;this.parts=[];let n=0,o=0,d=t.length-1,l=this.parts,[h,p]=qt(t,i);if(this.el=s.createElement(h,r),k.currentNode=this.el.content,i===2||i===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(e=k.nextNode())!==null&&l.length<d;){if(e.nodeType===1){if(e.hasAttributes())for(let c of e.getAttributeNames())if(c.endsWith(St)){let b=p[o++],m=e.getAttribute(c).split(S),y=/([.?@])?(.*)/.exec(b);l.push({type:1,index:n,name:y[2],strings:m,ctor:y[1]==="."?Q:y[1]==="?"?tt:y[1]==="@"?et:R}),e.removeAttribute(c)}else c.startsWith(S)&&(l.push({type:6,index:n}),e.removeAttribute(c));if(Et.test(e.tagName)){let c=e.textContent.split(S),b=c.length-1;if(b>0){e.textContent=W?W.emptyScript:"";for(let m=0;m<b;m++)e.append(c[m],D()),k.nextNode(),l.push({type:2,index:++n});e.append(c[b],D())}}}else if(e.nodeType===8)if(e.data===At)l.push({type:2,index:n});else{let c=-1;for(;(c=e.data.indexOf(S,c+1))!==-1;)l.push({type:7,index:n}),c+=S.length-1}n++}}static createElement(t,i){let r=M.createElement("template");return r.innerHTML=t,r}};function H(s,t,i=s,r){if(t===T)return t;let e=r!==void 0?i._$Co?.[r]:i._$Cl,n=N(t)?void 0:t._$litDirective$;return e?.constructor!==n&&(e?._$AO?.(!1),n===void 0?e=void 0:(e=new n(s),e._$AT(s,i,r)),r!==void 0?(i._$Co??=[])[r]=e:i._$Cl=e),e!==void 0&&(t=H(s,e._$AS(s,t.values),e,r)),t}var X=class{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:i},parts:r}=this._$AD,e=(t?.creationScope??M).importNode(i,!0);k.currentNode=e;let n=k.nextNode(),o=0,d=0,l=r[0];for(;l!==void 0;){if(o===l.index){let h;l.type===2?h=new I(n,n.nextSibling,this,t):l.type===1?h=new l.ctor(n,l.name,l.strings,this,t):l.type===6&&(h=new it(n,this,t)),this._$AV.push(h),l=r[++d]}o!==l?.index&&(n=k.nextNode(),o++)}return k.currentNode=M,e}p(t){let i=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,i),i+=r.strings.length-2):r._$AI(t[i])),i++}},I=class s{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,r,e){this.type=2,this._$AH=u,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=r,this.options=e,this._$Cv=e?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,i=this._$AM;return i!==void 0&&t?.nodeType===11&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=H(this,t,i),N(t)?t===u||t==null||t===""?(this._$AH!==u&&this._$AR(),this._$AH=u):t!==this._$AH&&t!==T&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Wt(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==u&&N(this._$AH)?this._$AA.nextSibling.data=t:this.T(M.createTextNode(t)),this._$AH=t}$(t){let{values:i,_$litType$:r}=t,e=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=U.createElement(kt(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===e)this._$AH.p(i);else{let n=new X(e,this),o=n.u(this.options);n.p(i),this.T(o),this._$AH=n}}_$AC(t){let i=_t.get(t.strings);return i===void 0&&_t.set(t.strings,i=new U(t)),i}k(t){nt(this._$AH)||(this._$AH=[],this._$AR());let i=this._$AH,r,e=0;for(let n of t)e===i.length?i.push(r=new s(this.O(D()),this.O(D()),this,this.options)):r=i[e],r._$AI(n),e++;e<i.length&&(this._$AR(r&&r._$AB.nextSibling,e),i.length=e)}_$AR(t=this._$AA.nextSibling,i){for(this._$AP?.(!1,!0,i);t!==this._$AB;){let r=bt(t).nextSibling;bt(t).remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},R=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,r,e,n){this.type=1,this._$AH=u,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):thiLine truncated
|
||||
:host {
|
||||
--nf-text: var(--primary-text-color, #e1e1e1);
|
||||
--nf-muted: var(--secondary-text-color, #9b9b9b);
|
||||
@@ -29,7 +29,7 @@ var B=globalThis,j=B.ShadowRoot&&(B.ShadyCSS===void 0||B.ShadyCSS.nativeShadow)&
|
||||
font-family: var(--nf-font);
|
||||
color: var(--nf-text);
|
||||
}
|
||||
`,ce=y`
|
||||
`,pe=w`
|
||||
:host([readable]) {
|
||||
--secondary-text-color: var(--primary-text-color, #e1e1e1);
|
||||
--divider-color: color-mix(in srgb, var(--primary-text-color, #e1e1e1) 40%, transparent);
|
||||
@@ -40,7 +40,7 @@ var B=globalThis,j=B.ShadowRoot&&(B.ShadyCSS===void 0||B.ShadyCSS.nativeShadow)&
|
||||
:host([readable]) .nf-overlay {
|
||||
zoom: 1.2;
|
||||
}
|
||||
`,de=y`
|
||||
`,ue=w`
|
||||
/* a group of switches: one rounded pill, the active one tinted with the accent */
|
||||
.nf-seg {
|
||||
display: inline-flex;
|
||||
@@ -203,12 +203,12 @@ var B=globalThis,j=B.ShadowRoot&&(B.ShadyCSS===void 0||B.ShadyCSS.nativeShadow)&
|
||||
min-height: 40px;
|
||||
}
|
||||
}
|
||||
`;var kt={auto:"Automatisch",raw:"Rohdaten",minute:"1 Minute","5minutes":"5 Minuten","15minutes":"15 Minuten",hour:"Stunde",day:"Tag",week:"Woche",month:"Monat",year:"Jahr"};function Mt(s,t){let i=new Set;return t.flatMap(r=>{let e=String(s?.states[r]?.attributes.symcon_source_entity||r),n=s?.states[e]?.attributes,o=Number(n?.symcon_id);return!o||!n?.symcon_archive||i.has(o)?[]:(i.add(o),[e])})}function st(s){if(!Number.isFinite(s))return"";let t=new Date(s*1e3);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}T${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function Tt(s,t,i,r){let e=c=>c.trim()&&Number.isFinite(Number(c.replace(",",".")))?Number(c.replace(",",".")):null,n=e(t),o=e(i),h=n??s.reduce((c,p)=>Math.min(c,p),r||!s.length?0:1/0),a=o??s.reduce((c,p)=>Math.max(c,p),r?0:s.length?-1/0:1);if(h===a&&(n===null&&!r&&(h-=Math.max(1,Math.abs(h)*.05)),o===null&&(a+=Math.max(1,Math.abs(a)*.05))),h>=a)throw new Error("Der untere Wertebereich muss kleiner als der obere sein.");return[h,a]}function Ct(s,t){let i=r=>{let e=String(r??"");return`"${/^[=+@\-\t\r]/.test(e)?"'":""}${e.replaceAll('"','""')}"`};return"\uFEFF"+[["Variable","Zeit","Wert","Minimum","Maximum"].join(";"),...s.flatMap(r=>r.points.map(e=>[t[r.entity_id]||r.entity_id,new Date(e.t*1e3).toISOString(),e.v,e.min??"",e.max??""].map(i).join(";")))].join(`\r
|
||||
`)}var ot=class extends x{static properties={text:{attribute:!1}};constructor(){super(),this.text=""}get dialog(){return this.renderRoot.querySelector("dialog")}render(){return g`<button class="info" type="button" aria-label="Information anzeigen" aria-haspopup="dialog" title="Information" @click=${()=>this.dialog?.showModal()}>ⓘ</button>
|
||||
`;var Tt={auto:"Automatisch",raw:"Rohdaten",minute:"1 Minute","5minutes":"5 Minuten","15minutes":"15 Minuten",hour:"Stunde",day:"Tag",week:"Woche",month:"Monat",year:"Jahr"};function zt(s,t){let i=new Set;return t.flatMap(r=>{let e=String(s?.states[r]?.attributes.symcon_source_entity||r),n=s?.states[e]?.attributes,o=Number(n?.symcon_id);return!o||!n?.symcon_archive||i.has(o)?[]:(i.add(o),[e])})}function at(s){if(!Number.isFinite(s))return"";let t=new Date(s*1e3);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}T${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function Ct(s,t,i,r){let e=h=>h.trim()&&Number.isFinite(Number(h.replace(",",".")))?Number(h.replace(",",".")):null,n=e(t),o=e(i),d=n??s.reduce((h,p)=>Math.min(h,p),r||!s.length?0:1/0),l=o??s.reduce((h,p)=>Math.max(h,p),r?0:s.length?-1/0:1);if(d===l&&(n===null&&!r&&(d-=Math.max(1,Math.abs(d)*.05)),o===null&&(l+=Math.max(1,Math.abs(l)*.05))),d>=l)throw new Error("Der untere Wertebereich muss kleiner als der obere sein.");return[d,l]}function Ht(s,t){let i=r=>{let e=String(r??"");return`"${/^[=+@\-\t\r]/.test(e)?"'":""}${e.replaceAll('"','""')}"`};return"\uFEFF"+[["Variable","Zeit","Wert","Minimum","Maximum"].join(";"),...s.flatMap(r=>r.points.map(e=>[t[r.entity_id]||r.entity_id,new Date(e.t*1e3).toISOString(),e.v,e.min??"",e.max??""].map(i).join(";")))].join(`\r
|
||||
`)}var lt=class extends ${static properties={text:{attribute:!1}};constructor(){super(),this.text=""}get dialog(){return this.renderRoot.querySelector("dialog")}render(){return v`<button class="info" type="button" aria-label="Information anzeigen" aria-haspopup="dialog" title="Information" @click=${()=>this.dialog?.showModal()}>ⓘ</button>
|
||||
<dialog aria-label="Information" @keydown=${t=>t.stopPropagation()} @click=${t=>{if(t.target!==t.currentTarget)return;let i=this.dialog.getBoundingClientRect();(t.clientX<i.left||t.clientX>i.right||t.clientY<i.top||t.clientY>i.bottom)&&this.dialog?.close()}}>
|
||||
<header><b>Information</b><button class="close" type="button" aria-label="Schließen" @click=${()=>this.dialog?.close()}>×</button></header>
|
||||
<p>${this.text}</p>
|
||||
</dialog>`}static styles=[q,y`
|
||||
</dialog>`}static styles=[q,w`
|
||||
:host { display:inline-block; margin:4px 0; vertical-align:middle; }
|
||||
button { font:inherit; cursor:pointer; color:var(--nf-muted); background:transparent; border:1px solid var(--nf-line); border-radius:50%; pointer-events:auto; }
|
||||
.info { width:26px; height:26px; padding:0; font-size:18px; line-height:24px; }
|
||||
@@ -219,45 +219,114 @@ var B=globalThis,j=B.ShadowRoot&&(B.ShadyCSS===void 0||B.ShadyCSS.nativeShadow)&
|
||||
header { display:flex; align-items:center; justify-content:space-between; gap:20px; font-size:16px; }
|
||||
.close { width:30px; height:30px; padding:0; font-size:23px; }
|
||||
p { white-space:pre-wrap; overflow-wrap:anywhere; margin:16px 0 4px; }
|
||||
`]};customElements.get("nf-help-popup")||customElements.define("nf-help-popup",ot);var zt=["#4ec9ff","#ffbe69","#ae9bff","#72deb0","#ff87aa","#ebde72"],C=(s,t)=>String(s.states[t]?.attributes.friendly_name||t),Pt=s=>({variable_not_logged:"Die Variable wird nicht mehr geloggt.",trend_range_too_large_for_resolution:"Bitte f\xFCr diesen Zeitraum eine gr\xF6bere Aufl\xF6sung w\xE4hlen.",invalid_trend_range:"Bitte einen g\xFCltigen Zeitraum w\xE4hlen."})[String(s instanceof Error?s.message:s)]||String(s instanceof Error?s.message:s),at=class extends x{static properties={hass:{attribute:!1},ids:{attribute:!1},label:{attribute:!1},from:{state:!0},to:{state:!0},resolution:{state:!0},chartStyle:{state:!0},field:{state:!0},min:{state:!0},max:{state:!0},zero:{state:!0},band:{state:!0},live:{state:!0},series:{state:!0},hiddenSeries:{state:!0},loading:{state:!0},errors:{state:!0},hover:{state:!0},width:{state:!0},page:{state:!0}};request=0;drag=null;timer;observer;constructor(){super(),this.ids=[],this.label="",this.to=Math.floor(Date.now()/1e3),this.from=this.to-86400,this.resolution="auto",this.chartStyle="auto",this.field="v",this.min="",this.max="",this.zero=!1,this.band=!0,this.live=!1,this.series=[],this.hiddenSeries=new Set,this.loading=!1,this.errors=[],this.hover=null,this.width=900,this.page=0}async open(){await this.updateComplete,this.renderRoot.querySelector("dialog").showModal(),this.observer=new ResizeObserver(([t])=>{this.width=Math.max(280,Math.floor(t.contentRect.width))}),this.observer.observe(this.renderRoot.querySelector(".body")),this.timer=setInterval(()=>{if(this.live&&!this.loading){let t=this.to-this.from;this.to=Math.floor(Date.now()/1e3),this.from=this.to-t,this.load()}},3e4),await this.load()}disconnectedCallback(){super.disconnectedCallback(),++this.request,clearInterval(this.timer),this.observer?.disconnect()}async load(){let t=++this.request,i=this.from,r=this.to;if(this.errors=[],this.series=[],this.hover=null,this.page=0,!Number.isSafeInteger(i)||!Number.isSafeInteger(r)||i<1||r<=i){this.errors=["Das Ende muss nach dem Beginn des Zeitraums liegen."],this.loading=!1;return}this.loading=!0;let e=[],n=[];for(let o=0;o<this.ids.length&&t===this.request;o+=3){let h=this.ids.slice(o,o+3);(await Promise.allSettled(h.map(c=>this.hass.callWS({type:"nextfloor/archive/trend",entity_id:c,start:i,end:r,aggregation:this.resolution})))).forEach((c,p)=>c.status==="fulfilled"?e.push(c.value):n.push(`${C(this.hass,h[p])}: ${Pt(c.reason)}`))}t!==this.request||!this.isConnected||(this.series=e,this.errors=n,this.loading=!1)}range(t,i){this.from=Math.max(1,Math.floor(t)),this.to=Math.max(this.from+1,Math.floor(i)),this.live=!1,this.load()}zoom(t,i=.5){let r=Math.max(60,Math.min(315576e3,(this.to-this.from)*t)),e=this.from+(this.to-this.from)*i;this.range(e-r*i,e+r*(1-i))}stamp(t){return new Date(t*1e3).toLocaleString(this.hass.language,{dateStyle:"short",timeStyle:"medium"})}number(t){return t.toLocaleString(this.hass.language,{maximumFractionDigits:Math.abs(t)<.01&&t!==0?5:2})}unit(t){return String(this.hass.states[t]?.attributes.unit_of_measurement??"")}selected(){return this.series.filter(t=>!this.hiddenSeries.has(t.entity_id))}value(t){let i=this.field==="v"?t.v:t[this.field]??t.v;return typeof i=="number"&&Number.isFinite(i)?i:null}color(t){return zt[this.ids.indexOf(t)%zt.length]}ratio(t){let i=t.currentTarget.getBoundingClientRect();return Math.max(0,Math.min(1,((t.clientX-i.left)/i.width*this.width-64)/(this.width-80)))}exportCsv(){let t=Object.fromEntries(this.ids.map(e=>[e,String(this.hass.states[e]?.attributes.symcon_path||C(this.hass,e))])),i=URL.createObjectURL(new Blob([Ct(this.selected(),t)],{type:"text/csv;charset=utf-8"})),r=document.createElement("a");r.href=i,r.download="Symcon-Trend.csv",r.click(),setTimeout(()=>URL.revokeObjectURL(i),1e3)}plot(t,i){let r=t.flatMap(l=>l.points.flatMap(f=>{let m=this.value(f);return m===null?[]:this.band&&!l.counter?[m,f.min??m,f.max??m]:[m]}));if(!r.length)return g`<p class="note">Keine numerischen Archivwerte in diesem Zeitraum.</p>`;let e,n;try{[e,n]=Tt(r,this.min,this.max,this.zero||this.chartStyle==="bar"||t.some(l=>l.type===0)||this.chartStyle==="auto"&&t.some(l=>l.counter&&l.aggregation!=="raw"))}catch(l){return g`<p role="alert">${Pt(l)}</p>`}let o=64,h=this.width-16,a=14,c=220,p=l=>o+(l-this.from)/(this.to-this.from)*(h-o),d=l=>c-(l-e)/(n-e)*(c-a),v=(l,f=this.field)=>Number(f==="v"?l.v:l[f]??l.v),$=(l,f=this.field)=>{let m=l.points.filter(z=>typeof z.v=="number"),b=this.chartStyle==="step"||this.chartStyle==="auto"&&l.type===0;return m.map((z,lt)=>`${lt?b?`H${p(z.t).toFixed(1)}V`:"L":"M"}${b&<?d(v(z,f)).toFixed(1):`${p(z.t).toFixed(1)},${d(v(z,f)).toFixed(1)}`}`).join("")+(m.length?b?`H${h}`:l.aggregation==="raw"?`L${h},${d(v(m[m.length-1],f)).toFixed(1)}`:"":"")},w=this.width<480?2:5;return g`<section class="chart-group"><h3>${i||"Wert"}</h3><svg class="plot" viewBox=${`0 0 ${this.width} 256`} role="img" aria-label=${`Trend ${i}`} @wheel=${Line truncated
|
||||
@pointerdown=${l=>{this.drag=this.ratio(l),l.currentTarget.setPointerCapture(l.pointerId)}}
|
||||
@pointerup=${l=>{if(this.drag===null)return;let f=this.drag,m=this.ratio(l);if(this.drag=null,Math.abs(f-m)>.02){let b=this.to-this.from;this.range(this.from+b*Math.min(f,m),this.from+b*Math.max(f,m))}}}
|
||||
@pointercancel=${()=>{this.drag=null}} @pointermove=${l=>{this.hover=this.from+(this.to-this.from)*this.ratio(l)}}>
|
||||
<defs><clipPath id="plot-clip"><rect x=${o} y=${a} width=${h-o} height=${c-a}/></clipPath></defs>
|
||||
${[0,1,2,3,4].map(l=>{let f=e+(n-e)*l/4;return A`<line class="grid" x1=${o} x2=${h} y1=${d(f)} y2=${d(f)}/><text x=${o-7} y=${d(f)+4} text-anchor="end">${this.number(f)}</text>`})}
|
||||
${Array.from({length:w},(l,f)=>{let m=this.from+(this.to-this.from)*f/(w-1);return A`<text x=${p(m)} y="244" text-anchor=${f===0?"start":f===w-1?"end":"middle"}>${new Date(m*1e3).toLocaleString(this.hass.language,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}</text>`})}
|
||||
<g clip-path="url(#plot-clip)">${t.map(l=>{let f=this.chartStyle==="bar"||this.chartStyle==="auto"&&l.counter&&l.aggregation!=="raw",m=this.color(l.entity_id);return f?l.points.filter(b=>this.value(b)!==null).map(b=>A`<rect fill=${m} opacity=".65" x=${p(b.t)} y=${Math.min(d(this.value(b)),d(0))} width=${Math.max(1,Math.min(h,p(b.t+Math.max(1,b.d)))-p(b.t)-1)} height=${Math.max(1,Math.abs(d(this.value(b))-d(0)))}/>`):A`${this.band&&l.aggregation!=="raw"&&!l.counter?A`<path d=${$(l,"min")} fill="none" stroke=${m} opacity=".3"/><path d=${$(l,"max")} fill="none" stroke=${m} opacity=".3"/>`:u}<path d=${$(l)} fill="none" stroke=${m} stroke-width="2" vector-effect="non-scaling-stroke"/>${l.points.length===1?A`<circle cx=${p(l.points[0].t)} cy=${d(v(l.points[0]))} r="3" fill=${m}/>`:u}`})}${this.hover!==null?A`<line x1=${p(this.hover)} x2=${p(this.hover)} y1=${a} y2=${c} stroke="currentColor" stroke-dasharray="3 4" opacity=".5"/>`:u}</g>
|
||||
</svg></section>`}table(t){let i=t.flatMap(n=>n.points.map(o=>({id:n.entity_id,...o}))).sort((n,o)=>o.t-n.t),r=Math.max(1,Math.ceil(i.length/100)),e=Math.min(this.page,r-1);return g`<div class="table"><table><thead><tr><th>Zeit</th><th>Variable</th><th>Wert</th></tr></thead><tbody>${i.slice(e*100,(e+1)*100).map(n=>g`<tr><td>${this.stamp(n.t)}</td><td>${C(this.hass,n.id)}</td><td>${typeof n.v=="number"?this.number(n.v):n.v} ${this.unit(n.id)}</td></tr>`)}</tbody></table></div><div class="actions"><button ?disabled=${!e} @click=${()=>{this.page=e-1}}>Zurück</button><span>${e+1} / ${r}</span><button ?disabled=${e>=r-1} @click=${()=>{this.page=e+1}}>Weiter</button></div>`}render(){let t=this.selected(),i=t.length>0&&t.every(e=>e.type===3),r=this.hover===null?"Letzter Wert":this.stamp(this.hover);return g`<dialog aria-label="Variablentrend" @close=${()=>this.remove()} @keydown=${e=>e.stopPropagation()}>
|
||||
<header><div><h2>${this.label||"Variablentrend"}</h2><span>Symcon Archiv</span></div><button aria-label="Schließen" @click=${()=>this.renderRoot.querySelector("dialog")?.close()}>×</button></header>
|
||||
<div class="body"><div class="presets">${[["1 h",3600],["6 h",21600],["24 h",86400],["7 Tage",604800],["30 Tage",2592e3],["1 Jahr",31536e3]].map(([e,n])=>g`<button @click=${()=>{let o=Math.floor(Date.now()/1e3);this.range(o-Number(n),o)}}>${e}</button>`)}</div>
|
||||
<form @submit=${e=>{e.preventDefault(),this.load()}}><div class="fields">
|
||||
<label>Von<input type="datetime-local" .value=${st(this.from)} @change=${e=>{this.from=Math.floor(new Date(e.target.value).getTime()/1e3),this.live=!1,this.load()}}/></label>
|
||||
<label>Bis<input type="datetime-local" .value=${st(this.to)} @change=${e=>{this.to=Math.floor(new Date(e.target.value).getTime()/1e3),this.live=!1,this.load()}}/></label>
|
||||
<label>Auflösung<select .value=${this.resolution} @change=${e=>{this.resolution=e.target.value,this.load()}}>${Object.entries(kt).map(([e,n])=>g`<option value=${e}>${n}</option>`)}</select></label>
|
||||
`]};customElements.get("nf-help-popup")||customElements.define("nf-help-popup",lt);var Rt=["#4ec9ff","#ffbe69","#ae9bff","#72deb0","#ff87aa","#ebde72"],z=(s,t)=>String(s.states[t]?.attributes.friendly_name||t),Pt=s=>({variable_not_logged:"Die Variable wird nicht mehr geloggt.",trend_range_too_large_for_resolution:"Bitte f\xFCr diesen Zeitraum eine gr\xF6bere Aufl\xF6sung w\xE4hlen.",invalid_trend_range:"Bitte einen g\xFCltigen Zeitraum w\xE4hlen."})[String(s instanceof Error?s.message:s)]||String(s instanceof Error?s.message:s),ht=class extends ${static properties={hass:{attribute:!1},ids:{attribute:!1},label:{attribute:!1},from:{state:!0},to:{state:!0},resolution:{state:!0},chartStyle:{state:!0},field:{state:!0},min:{state:!0},max:{state:!0},zero:{state:!0},band:{state:!0},live:{state:!0},series:{state:!0},hiddenSeries:{state:!0},loading:{state:!0},errors:{state:!0},hover:{state:!0},width:{state:!0},plotHeight:{state:!0},page:{state:!0}};request=0;drag=null;timer;observer;resize=()=>{this.plotHeight=Math.round(Math.min(600,Math.max(220,window.innerHeight*(window.innerWidth<600?.52:.65))))};constructor(){super(),this.ids=[],this.label="",this.to=Math.floor(Date.now()/1e3),this.from=this.to-86400,this.resolution="auto",this.chartStyle="auto",this.field="v",this.min="",this.max="",this.zero=!1,this.band=!0,this.live=!1,this.series=[],this.hiddenSeries=new Set,this.loading=!1,this.errors=[],this.hover=null,this.width=900,this.plotHeight=400,this.page=0}async open(){await this.updateComplete,this.renderRoot.querySelector("dialog").showModal(),this.observer=new ResizeObserver(([t])=>{this.width=Math.max(280,Math.floor(t.contentRect.width))}),this.observer.observe(this.renderRoot.querySelector(".body")),this.resize(),window.addEventListener("resize",this.resize),this.timer=setInterval(()=>{if(this.live&&!this.loading){let t=this.to-this.from;this.to=Math.floor(Date.now()/1e3),this.from=this.to-t,this.load()}},3e4),await this.load()}disconnectedCallback(){super.disconnectedCallback(),++this.request,clearInterval(this.timer),this.observer?.disconnect(),window.removeEventListener("resize",this.resize)}async load(){let t=++this.request,i=this.from,r=this.to;if(this.errors=[],this.series=[],this.hover=null,this.page=0,!Number.isSafeInteger(i)||!Number.isSafeInteger(r)||i<1||r<=i){this.errors=["Das Ende muss nach dem Beginn des Zeitraums liegen."],this.loading=!1;return}this.loading=!0;let e=[],n=[];for(let o=0;o<this.ids.length&&t===this.request;o+=3){let d=this.ids.slice(o,o+3);(await Promise.allSettled(d.map(h=>this.hass.callWS({type:"nextfloor/archive/trend",entity_id:h,start:i,end:r,aggregation:this.resolution})))).forEach((h,p)=>h.status==="fulfilled"?e.push(h.value):n.push(`${z(this.hass,d[p])}: ${Pt(h.reason)}`))}t!==this.request||!this.isConnected||(this.series=e,this.errors=n,this.loading=!1)}range(t,i){this.from=Math.max(1,Math.floor(t)),this.to=Math.max(this.from+1,Math.floor(i)),this.live=!1,this.load()}zoom(t,i=.5){let r=Math.max(60,Math.min(315576e3,(this.to-this.from)*t)),e=this.from+(this.to-this.from)*i;this.range(e-r*i,e+r*(1-i))}stamp(t){return new Date(t*1e3).toLocaleString(this.hass.language,{dateStyle:"short",timeStyle:"medium"})}number(t){return t.toLocaleString(this.hass.language,{maximumFractionDigits:Math.abs(t)<.01&&t!==0?5:2})}unit(t){return String(this.hass.states[t]?.attributes.unit_of_measurement??"")}selected(){return this.series.filter(t=>!this.hiddenSeries.has(t.entity_id))}value(t){let i=this.field==="v"?t.v:t[this.field]??t.v;return typeof i=="number"&&Number.isFinite(i)?i:null}color(t){return Rt[this.ids.indexOf(t)%Rt.length]}ratio(t){let i=t.currentTarget.getBoundingClientRect();return Math.max(0,Math.min(1,((t.clientX-i.left)/i.width*this.width-64)/(this.width-80)))}exportCsv(){let t=Object.fromEntries(this.ids.map(e=>[e,String(this.hass.states[e]?.attributes.symcon_path||z(this.hass,e))])),i=URL.createObjectURL(new Blob([Ht(this.selected(),t)],{type:"text/csv;charset=utf-8"})),r=document.createElement("a");r.href=i,r.download="Symcon-Trend.csv",r.click(),setTimeout(()=>URL.revokeObjectURL(i),1e3)}plot(t,i){let r=t.flatMap(a=>a.points.flatMap(f=>{let g=this.value(f);return g===null?[]:this.band&&!a.counter?[g,f.min??g,f.max??g]:[g]}));if(!r.length)return v`<p class="note">Keine numerischen Archivwerte in diesem Zeitraum.</p>`;let e,n;try{[e,n]=Ct(r,this.min,this.max,this.zero||this.chartStyle==="bar"||t.some(a=>a.type===0)||this.chartStyle==="auto"&&t.some(a=>a.counter&&a.aggregation!=="raw"))}catch(a){return v`<p role="alert">${Pt(a)}</p>`}let o=new Set(this.selected().filter(a=>a.type!==3).map(a=>this.unit(a.entity_id))).size,d=Math.max(200,Math.round(this.plotHeight/Math.max(1,Math.min(o,2)))),l=64,h=this.width-16,p=14,c=d-32,b=a=>l+(a-this.from)/(this.to-this.from)*(h-l),m=a=>c-(a-e)/(n-e)*(c-p),y=(a,f=this.field)=>Number(f==="v"?a.v:a[f]??a.v),Z=(a,f=this.field)=>{let g=a.points.filter(C=>typeof C.v=="number"),x=this.chartStyle==="step"||this.chartStyle==="auto"&&a.type==Line truncated
|
||||
@pointerdown=${a=>{this.drag=this.ratio(a),a.currentTarget.setPointerCapture(a.pointerId)}}
|
||||
@pointerup=${a=>{if(this.drag===null)return;let f=this.drag,g=this.ratio(a);if(this.drag=null,Math.abs(f-g)>.02){let x=this.to-this.from;this.range(this.from+x*Math.min(f,g),this.from+x*Math.max(f,g))}}}
|
||||
@pointercancel=${()=>{this.drag=null}} @pointermove=${a=>{this.hover=this.from+(this.to-this.from)*this.ratio(a)}}>
|
||||
<defs><clipPath id="plot-clip"><rect x=${l} y=${p} width=${h-l} height=${c-p}/></clipPath></defs>
|
||||
${[0,1,2,3,4].map(a=>{let f=e+(n-e)*a/4;return A`<line class="grid" x1=${l} x2=${h} y1=${m(f)} y2=${m(f)}/><text x=${l-7} y=${m(f)+4} text-anchor="end">${this.number(f)}</text>`})}
|
||||
${Array.from({length:F},(a,f)=>{let g=this.from+(this.to-this.from)*f/(F-1);return A`<text x=${b(g)} y=${d-8} text-anchor=${f===0?"start":f===F-1?"end":"middle"}>${new Date(g*1e3).toLocaleString(this.hass.language,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}</text>`})}
|
||||
<g clip-path="url(#plot-clip)">${t.map(a=>{let f=this.chartStyle==="bar"||this.chartStyle==="auto"&&a.counter&&a.aggregation!=="raw",g=this.color(a.entity_id);return f?a.points.filter(x=>this.value(x)!==null).map(x=>A`<rect fill=${g} opacity=".65" x=${b(x.t)} y=${Math.min(m(this.value(x)),m(0))} width=${Math.max(1,Math.min(h,b(x.t+Math.max(1,x.d)))-b(x.t)-1)} height=${Math.max(1,Math.abs(m(this.value(x))-m(0)))}/>`):A`${this.band&&a.aggregation!=="raw"&&!a.counter?A`<path d=${Z(a,"min")} fill="none" stroke=${g} opacity=".3"/><path d=${Z(a,"max")} fill="none" stroke=${g} opacity=".3"/>`:u}<path d=${Z(a)} fill="none" stroke=${g} stroke-width="2" vector-effect="non-scaling-stroke"/>${a.points.length===1?A`<circle cx=${b(a.points[0].t)} cy=${m(y(a.points[0]))} r="3" fill=${g}/>`:u}`})}${this.hover!==null?A`<line x1=${b(this.hover)} x2=${b(this.hover)} y1=${p} y2=${c} stroke="currentColor" stroke-dasharray="3 4" opacity=".5"/>`:u}</g>
|
||||
</svg></section>`}table(t){let i=t.flatMap(n=>n.points.map(o=>({id:n.entity_id,...o}))).sort((n,o)=>o.t-n.t),r=Math.max(1,Math.ceil(i.length/100)),e=Math.min(this.page,r-1);return v`<div class="table"><table><thead><tr><th>Zeit</th><th>Variable</th><th>Wert</th></tr></thead><tbody>${i.slice(e*100,(e+1)*100).map(n=>v`<tr><td>${this.stamp(n.t)}</td><td>${z(this.hass,n.id)}</td><td>${typeof n.v=="number"?this.number(n.v):n.v} ${this.unit(n.id)}</td></tr>`)}</tbody></table></div><div class="actions"><button ?disabled=${!e} @click=${()=>{this.page=e-1}}>Zurück</button><span>${e+1} / ${r}</span><button ?disabled=${e>=r-1} @click=${()=>{this.page=e+1}}>Weiter</button></div>`}render(){let t=this.selected(),i=t.length>0&&t.every(e=>e.type===3),r=this.hover===null?"Letzter Wert":this.stamp(this.hover);return v`<dialog aria-label="Variablentrend" @close=${()=>this.remove()} @keydown=${e=>{e.stopPropagation();let n=this.renderRoot.querySelector(".settings");e.key==="Escape"&&n?.open&&(e.preventDefault(),n.open=!1)}} @click=${e=>{let n=this.renderRoot.querySelector(".settings");n?.open&&!e.composedPath().includes(n)&&(n.open=!1)}}>
|
||||
<header><div><h2>${this.label||"Variablentrend"}</h2><span class="range">${new Date(this.from*1e3).toLocaleString(this.hass.language,{dateStyle:"short",timeStyle:"short"})} – ${new Date(this.to*1e3).toLocaleString(this.hass.language,{dateStyle:"short",timeStyle:"short"})}</span></div><button aria-label="Schließen" @click=${()=>this.renderRoot.querySelector("dialog")?.close()}>×</button></header>
|
||||
<div class="body"><div class="toolbar"><div class="presets">${[["1 h",3600],["6 h",21600],["24 h",86400],["7 Tage",604800],["30 Tage",2592e3],["1 Jahr",31536e3]].map(([e,n])=>v`<button aria-pressed=${this.to-this.from===n} @click=${()=>{let o=Math.floor(Date.now()/1e3);this.range(o-Number(n),o)}}>${e}</button>`)}</div>
|
||||
<div class="navigation"><button aria-label="Vorheriger Zeitraum" title="Vorheriger Zeitraum" @click=${()=>this.range(this.from-(this.to-this.from),this.from)}>←</button><button aria-label="Nächster Zeitraum" title="Nächster Zeitraum" @click=${()=>this.range(this.to,this.to+(this.to-this.from))}>→</button><button aria-label="Hineinzoomen" title="Hineinzoomen" @click=${()=>this.zoom(.5)}>+</button><button aria-label="Herauszoomen" title="Herauszoomen" @click=${()=>this.zoom(2)}>−</button><button aria-label="Aktualisieren" title="Aktualisieren" aria-busy=${this.loading} @click=${()=>{this.load()}} ?disabled=${this.loading}>↻</button></div>
|
||||
<label class="live-toggle" title="Alle 30 Sekunden aktualisieren"><input type="checkbox" .checked=${this.live} @change=${e=>{this.live=e.target.checked}}/> Live</label>
|
||||
<details class="settings"><summary aria-label="Trend-Einstellungen" title="Zeitraum, Auflösung und Darstellung">⚙︎</summary><div class="settings-panel">
|
||||
<form @submit=${e=>{e.preventDefault(),this.load()}}><div class="fields time-fields">
|
||||
<label>Von<input type="datetime-local" .value=${at(this.from)} @change=${e=>{this.from=Math.floor(new Date(e.target.value).getTime()/1e3),this.live=!1,this.load()}}/></label>
|
||||
<label>Bis<input type="datetime-local" .value=${at(this.to)} @change=${e=>{this.to=Math.floor(new Date(e.target.value).getTime()/1e3),this.live=!1,this.load()}}/></label>
|
||||
<label>Auflösung<select .value=${this.resolution} @change=${e=>{this.resolution=e.target.value,this.load()}}>${Object.entries(Tt).map(([e,n])=>v`<option value=${e}>${n}</option>`)}</select></label>
|
||||
<button type="submit" ?disabled=${this.loading}>${this.loading?"L\xE4dt \u2026":"Anzeigen"}</button>
|
||||
</div></form>
|
||||
<details class="settings"><summary>Darstellung und Wertebereich</summary><div class="fields">
|
||||
<label>Darstellung<select .value=${this.chartStyle} @change=${e=>{this.chartStyle=e.target.value}}>${Object.entries({auto:"Automatisch",line:"Linie",step:"Stufen",bar:"Balken",table:"Tabelle"}).map(([e,n])=>g`<option value=${e}>${n}</option>`)}</select></label>
|
||||
<div class="display-settings"><b class="group-title">Darstellung und Wertebereich</b><div class="fields display-fields">
|
||||
<label>Darstellung<select .value=${this.chartStyle} @change=${e=>{this.chartStyle=e.target.value}}>${Object.entries({auto:"Automatisch",line:"Linie",step:"Stufen",bar:"Balken",table:"Tabelle"}).map(([e,n])=>v`<option value=${e}>${n}</option>`)}</select></label>
|
||||
<label>Aggregierter Wert<select .value=${this.field} @change=${e=>{this.field=e.target.value}}><option value="v">Mittelwert / Verbrauch</option><option value="min">Minimum</option><option value="max">Maximum</option></select></label>
|
||||
<label>Y-Minimum<input type="number" step="any" placeholder="Automatisch" .value=${this.min} @input=${e=>{this.min=e.target.value}}/></label>
|
||||
<label>Y-Maximum<input type="number" step="any" placeholder="Automatisch" .value=${this.max} @input=${e=>{this.max=e.target.value}}/></label>
|
||||
</div><div class="checks"><label><input type="checkbox" .checked=${this.zero} @change=${e=>{this.zero=e.target.checked}}/> Nullpunkt einbeziehen</label><label><input type="checkbox" .checked=${this.band} @change=${e=>{this.band=e.target.checked}}/> Min/Max anzeigen</label></div></details>
|
||||
<div class="actions"><button aria-label="Vorheriger Zeitraum" @click=${()=>this.range(this.from-(this.to-this.from),this.from)}>←</button><button aria-label="Nächster Zeitraum" @click=${()=>this.range(this.to,this.to+(this.to-this.from))}>→</button><button aria-label="Hineinzoomen" @click=${()=>this.zoom(.5)}>+</button><button aria-label="Herauszoomen" @click=${()=>this.zoom(2)}>−</button><button @click=${()=>{this.load()}} ?disabled=${this.loading}>Aktualisieren</button><label><input type="checkbox" .checked=${this.live} @change=${e=>{this.live=e.target.checked}}/> Live (30 s)</label><button @click=${()=>this.exportCsv()} ?disabled=${!t.length}>CSV</button>
|
||||
</div><div class="checks"><label><input type="checkbox" .checked=${this.zero} @change=${e=>{this.zero=e.target.checked}}/> Nullpunkt einbeziehen</label><label><input type="checkbox" .checked=${this.band} @change=${e=>{this.band=e.target.checked}}/> Min/Max anzeigen</label></div></div>
|
||||
<div class="actions"><button @click=${()=>this.exportCsv()} ?disabled=${!t.length}>CSV</button>
|
||||
<nf-help-popup .text=${"Zeitraum und Aufl\xF6sung lesen die originalen Symcon-Archivdaten. Rohdaten zeigen gespeicherte \xC4nderungen; ein zuvor bekannter Wert wird zum Beginn fortgef\xFChrt. Bei Z\xE4hlern sind aggregierte Werte der Verbrauch pro Intervall, bei Messwerten der Mittelwert. Mehrere Variablen werden einzeln dargestellt; unterschiedliche Einheiten erhalten eigene Diagramme. Zoomen: +/\u2212, Mausrad oder im Diagramm einen Zeitraum ziehen. Eigene Y-Grenzen gelten f\xFCr alle Diagramme. Begrenzte Rohdatenabfragen werden gekennzeichnet; w\xE4hle dann einen k\xFCrzeren Zeitraum oder eine Aggregation."}></nf-help-popup>
|
||||
</div>
|
||||
<div class="legend">${this.ids.map(e=>g`<label title=${String(this.hass.states[e]?.attributes.symcon_path||C(this.hass,e))}><input type="checkbox" .checked=${!this.hiddenSeries.has(e)} @change=${n=>{let o=new Set(this.hiddenSeries);n.target.checked?o.delete(e):o.add(e),this.hiddenSeries=o,this.requestUpdate()}}/><i style=${`background:${this.color(e)}`}></i>${C(this.hass,e)}</label>`)}</div>
|
||||
${this.errors.map(e=>g`<p class="error" role="alert">${e}</p>`)}${this.loading?g`<p class="note" role="status">Archivwerte werden geladen …</p>`:u}
|
||||
${t.filter(e=>e.truncated).map(e=>g`<p class="error" role="status">${C(this.hass,e.entity_id)}: Die Abfrage ist auf ${(e.limit??1e4).toLocaleString(this.hass.language)} Einträge begrenzt. Bitte Zeitraum verkürzen oder Auflösung ändern.</p>`)}
|
||||
${t.some(e=>e.counter&&e.aggregation!=="raw")?g`<p class="note">Zähler: Verbrauch pro Intervall</p>`:u}
|
||||
</div></div></details></div>
|
||||
<div class="legend">${this.ids.map(e=>v`<label title=${String(this.hass.states[e]?.attributes.symcon_path||z(this.hass,e))}><input type="checkbox" .checked=${!this.hiddenSeries.has(e)} @change=${n=>{let o=new Set(this.hiddenSeries);n.target.checked?o.delete(e):o.add(e),this.hiddenSeries=o,this.requestUpdate()}}/><i style=${`background:${this.color(e)}`}></i>${z(this.hass,e)}</label>`)}</div>
|
||||
${this.errors.map(e=>v`<p class="error" role="alert">${e}</p>`)}${this.loading?v`<p class="note" role="status">Archivwerte werden geladen …</p>`:u}
|
||||
${t.filter(e=>e.truncated).map(e=>v`<p class="error" role="status">${z(this.hass,e.entity_id)}: Die Abfrage ist auf ${(e.limit??1e4).toLocaleString(this.hass.language)} Einträge begrenzt. Bitte Zeitraum verkürzen oder Auflösung ändern.</p>`)}
|
||||
${t.some(e=>e.counter&&e.aggregation!=="raw")?v`<p class="note">Zähler: Verbrauch pro Intervall</p>`:u}
|
||||
<div class="charts" style=${`min-height:${this.plotHeight}px`}>
|
||||
${this.chartStyle==="table"||i?this.table(t):[...new Set(t.filter(e=>e.type!==3).map(e=>this.unit(e.entity_id)))].map(e=>this.plot(t.filter(n=>n.type!==3&&this.unit(n.entity_id)===e),e))}
|
||||
${t.some(e=>e.type===3)&&!i&&this.chartStyle!=="table"?this.table(t.filter(e=>e.type===3)):u}
|
||||
${!this.loading&&t.length&&t.every(e=>!e.points.length)?g`<p class="note">Keine Archivwerte in diesem Zeitraum.</p>`:u}
|
||||
<div class="cursor"><b>${r}</b>${t.map(e=>{let n=e.points.at(-1);if(this.hover!==null){let o=0,h=e.points.length;for(;o<h;){let a=o+h>>>1;e.points[a].t<=this.hover?o=a+1:h=a}n=e.points[o-1]}return g`<span style=${`color:${this.color(e.entity_id)}`}>${C(this.hass,e.entity_id)}: ${n?typeof n.v=="number"?`${this.number(this.value(n))} ${this.unit(e.entity_id)}`:n.v:"\u2013"}</span>`})}</div>
|
||||
${!this.loading&&t.length&&t.every(e=>!e.points.length)?v`<p class="note">Keine Archivwerte in diesem Zeitraum.</p>`:u}
|
||||
</div>
|
||||
</dialog>`}static styles=[q,y`
|
||||
:host{font:14px/1.45 system-ui,sans-serif;color:var(--nf-text)}dialog{box-sizing:border-box;width:min(1080px,calc(100vw - 24px));max-height:92vh;max-height:92dvh;padding:0;border:1px solid var(--nf-line);border-radius:14px;background:var(--nf-chrome-solid,#1c1c1c);color:inherit;box-shadow:var(--nf-shadow);overflow:auto}dialog::backdrop{background:#050b16a8}header{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:16px 20px;border-bottom:1px solid var(--nf-line)}h2{font-size:18px;margin:0}header span,.note{font-size:12px;color:var(--nf-muted)}header button{font-size:23px;width:36px;height:36px;padding:0}.body{padding:16px 20px}.presets,.actions,.checks,.legend,.cursor{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin:0 0 14px}.fields{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px;align-items:end;margin:12px 0}.fields label{display:grid;gap:5px;color:var(--nf-muted);font-size:12px}button,input,select{font:inherit;box-sizing:border-box;color:var(--nf-text)}button,select,input:not([type=checkbox]){border:1px solid var(--nf-line);border-radius:7px;padding:8px;background:var(--nf-fill,#292929);min-width:0}button{cursor:pointer}button:disabled{opacity:.45}button:focus-visible,input:focus-visible,select:focus-visible{outline:2px solid var(--nf-accent);outline-offset:2px}.settings{border:1px solid var(--nf-line);padding:10px 12px;border-radius:9px;margin:12px 0}summary{cursor:pointer}.checks label,.actions label,.legend label{display:flex;align-items:center;gap:6px;font-size:12px}.legend i{display:inline-block;width:10px;height:10px;border-radius:50%;flex-shrink:0}.legend label{max-width:100%;overflow-wrap:anywhere}.plot{display:block;width:100%;touch-action:none;user-select:none}.plot text{fill:var(--nf-muted);font:11px system-ui}.grid{stroke:var(--nf-line)}h3{font-size:12px;color:var(--nf-muted);margin:12px 0 0}.chart-group{margin-bottom:10px}.cursor{font-size:12px;align-items:flex-start}.cursor>b{width:100%;color:var(--nf-muted)}.cursor span{overflow-wrap:anywhere}.error{color:#ffa5a5}.table{overflow:auto;max-height:380px;margin:12px 0}table{width:100%;border-collapse:collapse;font-size:12px}td,th{text-align:left;padding:7px;border-bottom:1px solid var(--nf-line);overflow-wrap:anywhere}td:first-child{white-space:nowrap}th{position:sticky;top:0;background:var(--nf-chrome-solid,#1c1c1c)}@media(max-width:500px){header{padding:12px}.body{padding:10px}.fields{grid-template-columns:repeat(2,minmax(0,1fr))}input[type=datetime-local]{font-size:12px;padding:7px 3px}.actions{gap:6px}.actions button{padding:7px}header h2{font-size:16px}}
|
||||
header{position:sticky;top:0;z-index:2;background:var(--nf-chrome-solid,#1c1c1c)}
|
||||
`]};customElements.get("nf-trend-dialog")||customElements.define("nf-trend-dialog",at);async function ye(s,t,i){let r=Mt(s,t);if(!r.length)return;let e=document.createElement("nf-trend-dialog");Object.assign(e,{hass:s,ids:r,label:i}),document.body.append(e);try{await e.open()}catch(n){throw e.remove(),n}}export{at as NfTrendDialog,ye as openTrend};
|
||||
<div class="cursor"><b>${r}</b>${t.map(e=>{let n=e.points.at(-1);if(this.hover!==null){let o=0,d=e.points.length;for(;o<d;){let l=o+d>>>1;e.points[l].t<=this.hover?o=l+1:d=l}n=e.points[o-1]}return v`<span style=${`color:${this.color(e.entity_id)}`}>${z(this.hass,e.entity_id)}: ${n?typeof n.v=="number"?`${this.number(this.value(n))} ${this.unit(e.entity_id)}`:n.v:"\u2013"}</span>`})}</div>
|
||||
</div>
|
||||
</dialog>`}static styles=[q,w`
|
||||
:host { font:13px/1.4 system-ui,sans-serif; color:var(--nf-text); }
|
||||
dialog { box-sizing:border-box; width:min(1080px,calc(100vw - 24px)); max-height:92vh; max-height:92dvh; padding:0; border:1px solid var(--nf-line); border-radius:12px; background:var(--nf-chrome-solid,#1c1c1c); color:inherit; box-shadow:var(--nf-shadow); overflow:auto; }
|
||||
dialog::backdrop { background:#050b16a8; }
|
||||
header { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:8px 12px; border-bottom:1px solid var(--nf-line); position:sticky; top:0; z-index:3; background:var(--nf-chrome-solid,#1c1c1c); }
|
||||
header>div { display:flex; align-items:baseline; flex-wrap:wrap; gap:3px 14px; min-width:0; }
|
||||
h2 { font-size:15px; margin:0; }
|
||||
.range { font-size:11px; color:var(--nf-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
|
||||
header button { width:26px; height:26px; font-size:19px; padding:0; flex-shrink:0; }
|
||||
.body { padding:8px 12px; }
|
||||
.toolbar { position:relative; display:flex; align-items:center; flex-wrap:wrap; gap:5px 10px; margin-bottom:6px; }
|
||||
.presets,.navigation { display:flex; align-items:center; gap:3px; }
|
||||
button,input,select { box-sizing:border-box; color:var(--nf-text); font:inherit; }
|
||||
button,select,input:not([type=checkbox]),summary { border:1px solid var(--nf-line); border-radius:5px; padding:4px 7px; background:var(--nf-fill,#292929); min-width:0; }
|
||||
button { cursor:pointer; font-size:12px; }
|
||||
button:disabled { opacity:.45; }
|
||||
button:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible { outline:2px solid var(--nf-accent); outline-offset:2px; }
|
||||
.toolbar button,.toolbar summary { height:26px; }
|
||||
.navigation button { width:26px; padding:0; font-size:16px; }
|
||||
.presets button { padding:3px 6px; font-size:11px; }
|
||||
.presets button[aria-pressed=true],.settings[open]>summary { border-color:var(--nf-accent); background:color-mix(in srgb,var(--nf-accent) 16%,var(--nf-fill)); }
|
||||
.live-toggle { display:flex; align-items:center; gap:3px; font-size:11px; white-space:nowrap; }
|
||||
input[type=checkbox] { margin:0; }
|
||||
.settings { margin-left:auto; }
|
||||
.settings:not([open])>.settings-panel { display:none; }
|
||||
summary { display:flex; align-items:center; justify-content:center; width:28px; padding:0; list-style:none; font-size:17px; cursor:pointer; }
|
||||
summary::-webkit-details-marker { display:none; }
|
||||
.settings-panel { position:absolute; z-index:2; top:calc(100% + 5px); right:0; box-sizing:border-box; width:min(620px,100%); max-height:min(62vh,480px); overflow:auto; padding:10px 12px; border:1px solid var(--nf-line); border-radius:8px; background:var(--nf-chrome-solid,#1c1c1c); box-shadow:var(--nf-shadow); }
|
||||
.fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-items:end; gap:7px 10px; margin:0 0 10px; }
|
||||
.fields label { display:grid; gap:3px; color:var(--nf-muted); font-size:11px; }
|
||||
.fields input,.fields select { height:28px; width:100%; font-size:12px; }
|
||||
.time-fields button { justify-self:start; }
|
||||
.display-settings { padding-top:8px; border-top:1px solid var(--nf-line); }
|
||||
.group-title { display:block; margin-bottom:6px; font-size:12px; }
|
||||
.actions,.checks,.legend,.cursor { display:flex; align-items:center; flex-wrap:wrap; gap:6px 10px; }
|
||||
.checks { margin:0 0 6px; }
|
||||
.checks label,.legend label { display:flex; align-items:center; gap:4px; font-size:11px; }
|
||||
.legend { margin:4px 0 0; }
|
||||
.legend i { display:inline-block; width:8px; height:8px; border-radius:50%; flex-shrink:0; }
|
||||
.legend label { max-width:100%; overflow-wrap:anywhere; }
|
||||
.plot { display:block; width:100%; touch-action:none; user-select:none; }
|
||||
.plot text { fill:var(--nf-muted); font:11px system-ui; }
|
||||
.grid { stroke:var(--nf-line); }
|
||||
h3 { font-size:11px; color:var(--nf-muted); margin:3px 0 0; }
|
||||
.chart-group { margin-bottom:4px; }
|
||||
.cursor { font-size:11px; align-items:baseline; border-top:1px solid var(--nf-line); padding-top:6px; }
|
||||
.cursor>b { color:var(--nf-muted); font-weight:normal; }
|
||||
.cursor span { overflow-wrap:anywhere; }
|
||||
.note,.error { font-size:12px; margin:6px 0; }
|
||||
.note { color:var(--nf-muted); }
|
||||
.error { color:#ffa5a5; }
|
||||
.table { overflow:auto; max-height:60vh; margin:8px 0; }
|
||||
table { width:100%; border-collapse:collapse; font-size:12px; }
|
||||
td,th { text-align:left; padding:5px; border-bottom:1px solid var(--nf-line); overflow-wrap:anywhere; }
|
||||
td:first-child { white-space:nowrap; }
|
||||
th { position:sticky; top:0; background:var(--nf-chrome-solid,#1c1c1c); }
|
||||
@media(max-width:500px) {
|
||||
header { padding:7px 9px; }
|
||||
header>div { display:grid; gap:1px; }
|
||||
h2 { font-size:14px; }
|
||||
.body { padding:7px 9px; }
|
||||
.toolbar { gap:4px 6px; }
|
||||
.presets { gap:2px; }
|
||||
.presets button { padding:3px 5px; }
|
||||
.settings-panel { padding:9px; }
|
||||
input[type=datetime-local] { font-size:11px; padding:3px; }
|
||||
}
|
||||
`]};customElements.get("nf-trend-dialog")||customElements.define("nf-trend-dialog",ht);async function _e(s,t,i){let r=zt(s,t);if(!r.length)return;let e=document.createElement("nf-trend-dialog");Object.assign(e,{hass:s,ids:r,label:i}),document.body.append(e);try{await e.open()}catch(n){throw e.remove(),n}}export{ht as NfTrendDialog,_e as openTrend};
|
||||
/*! Bundled license information:
|
||||
|
||||
@lit/reactive-element/css-tag.js:
|
||||
|
||||
+17
-1
@@ -16,7 +16,7 @@ In **Kerninstanzen → Modules** wird dieses Repository verwendet:
|
||||
|
||||
Im Zahnrad des Eintrags den Branch **`symcon`** wählen und auf Aktualisierungen prüfen.
|
||||
`main` enthält die Quellen für die Entwicklung, `symcon` die installierbare Bibliothek.
|
||||
Nach der Aktualisierung auf **0.2.17 / Build 20** die Konsole neu laden. Unter
|
||||
Nach der Aktualisierung auf **0.2.18 / Build 21** die Konsole neu laden. Unter
|
||||
**Instanz hinzufügen → Hersteller NextFloor** erscheint **„NextFloor Designer und 3D-Kachel“**.
|
||||
|
||||
### Für die Entwicklung
|
||||
@@ -46,6 +46,22 @@ Die Dateien unter `NextFloor/assets/` und `NextFloor/packs/` werden durch
|
||||
Der Build prüft anschließend die Modulmetadaten und die installierbare Verzeichnisstruktur.
|
||||
Dieselbe Prüfung lässt sich separat mit `node symcon/tests/validate-package.mjs` ausführen.
|
||||
|
||||
## Änderungen in 0.2.18
|
||||
|
||||
- **Kompakteres Trend-Popup:** Kleine Zeitraum-, Zoom- und Aktualisierungsknöpfe
|
||||
bilden eine schmale Leiste. Eigene Zeiten, Auflösung, Darstellung, Wertebereich
|
||||
und CSV liegen hinter dem Zahnrad. Der Graph passt seine Höhe an das Fenster an
|
||||
und erhält den größten Teil des Popups. Die Einstellungen überlagern ihn bei
|
||||
Bedarf; sie verkleinern das Diagramm nicht.
|
||||
- **Gebäude- und Stockwerksübersicht:** Bei „Alle Etagen“ stehen oben die
|
||||
Leistungen und Verbräuche des Gesamtgebäudes, rechts eine dezente Kachel mit den
|
||||
Stockwerken. Im geöffneten Stockwerk zeigt die Leiste dessen Summen und die
|
||||
rechte Kachel die einzelnen Räume/Bereiche. Namen öffnen das jeweilige Stockwerk
|
||||
oder den Raum. Die Kachel ist einklappbar und startet auf schmalen Ansichten
|
||||
eingeklappt. Medien, Einheiten, Zeiträume, eigene Stockwerkszähler, Trends und
|
||||
die Kennzeichnung unvollständiger Summen bleiben erhalten. Gemeinsam verknüpfte
|
||||
Variablen werden im Gebäude nur einmal gezählt.
|
||||
|
||||
## Änderungen in 0.2.17
|
||||
|
||||
- Das Trendsymbol ist kleiner und ohne Rahmen. In Raumklimakacheln sitzt es in
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@
|
||||
"compatibility": {
|
||||
"version": "9.0"
|
||||
},
|
||||
"version": "0.2.17",
|
||||
"build": 20,
|
||||
"version": "0.2.18",
|
||||
"build": 21,
|
||||
"date": 1794384000
|
||||
}
|
||||
Reference in new issue
Block a user