feat: add room name switches to 3D view and editor toolbars
This commit is contained in:
1 parent
7a9b2c0a38
commit
3f6cca056c
13 files changed
+695
-585
No files matched your search
@@ -4393,7 +4393,7 @@ ${i}`}else o=eh(s)}}catch(s){let l=s.message,a={not_json:"import_error_not_json"
|
||||
color: var(--nf-soft);
|
||||
font-size: 13px;
|
||||
}
|
||||
`]};customElements.get("nf-extensions")||customElements.define("nf-extensions",Nl);var go="handled",t_=["select","rect","polygon","wall","opening","furniture","stairs","outdoor","hole","roof","energy"],n_=new Set(["vertex","room","device","opening","furniture","rotate","resize","outdoor","roofmove","roofcorner","roofvertex","outvertex","solarmove","solarturn","bgmove","bgscale","bgrotate"]),Xi=10,He=t=>Math.round(t*1e3)/1e3,r_={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]},Bl=class extends Q{static properties={hass:{attribute:!1},building:{attribute:!1},narrow:{type:Boolean},packs:{attribute:!1},loadCardEditor:{attribute:!1},_doc:{state:!0},_doc3d:{state:!0},_split:{state:!0},_splitRatio:{state:!0},_wall3d:{state:!0},_solid3d:{state:!0},_sidePinned:{state:!0},_studio:{state:!0},_check:{state:!0},_keys:{state:!0},_note:{state:!0},_dims:{state:!0},_tour:{state:!0},_sideOpen:{state:!0},_floorId:{state:!0},_energyNote:{state:!0},_ctx:{state:!0},_fixedHint:{state:!0},_openingPreset:{state:!0},_measureLen:{state:!0},_rectSize:{state:!0},_tool:{state:!0},_wallView:{state:!0},_draft:{state:!0},_cursor:{state:!0},_guides:{state:!0},_view:{state:!0},_size:{state:!0},_canUndo:{state:!0},_canRedo:{state:!0},_arcEdit:{state:!0},_routeDraft:{state:!0}};doc3dTimer;tourChecked=!1;_pick=null;_pickTimer;fixedPan=!1;reframe3d=!1;pressTimer=0;pressStart=null;history=new Wi(100);lib=new Fi(()=>this.requestUpdate());side=new Ui(()=>this.requestUpdate());sel=new ji(()=>this.requestUpdate());host=this.makeHost();backup=this.makeBackup();roof=this.makeRoof();bg=this.makeBackground();settingsActions={useRoofSections:()=>{this.roof.useSections(),this._tool="roof"}};drag=null;pointers=new Map;pinch=null;fitted=!1;resizeObserver;constructor(){super(),this.narrow=!1,this._floorId=null,this._arcEdit=null,this._routeDraft=null,this.roof.sectionId=null,this.roof.solarId=null,this.roof.picking=!1,this.roof.windowId=null,this.roof.chimneyId=null,this._energyNote=null,this._openingPreset="door";let e=!1;try{e=localStorage.getItem("nextfloor.editor3d")==="1"}catch{}this._split=e,this._splitRatio=.55;try{let r=Number(localStorage.getItem("nextfloor.editorSplit"));r>=20&&r<=80&&(this._splitRatio=r/100)}catch{}this._wall3d="cut",this._solid3d=!1,this._doc3d=this._doc,this._sideOpen=!1;let n=!0;try{n=localStorage.getItem("nextfloor.sidePinned")!=="0"}catch{}this._sidePinned=n,this._studio=null,this._check=!1,this._keys=!1,this._note=null,this._dims=(()=>{try{return localStorage.getItem("nextfloor.plan_dims")==="1"}catch{return!1}})(),this._tour=null,this._measureLen=3,this._rectSize=[4,3],this._tool="select",this._wallView=null,this._draft=[],this._cursor=null,this._guides={},this._view={scale:50,ox:40,oy:40},this._size={w:800,h:600},this._canUndo=!1,this._canRedo=!1}t(e,n){return $e(this.hass,e,n)}measureState(){return{draft:this._draft,length:this._measureLen,rectSize:this._rectSize}}measureActions(){return{setLength:e=>this._measureLen=e,step:e=>this.measureStep(e),close:()=>this.closeDraft(),undo:()=>this._draft=this._draft.slice(0,-1),setRectSize:e=>this._rectSize=e,addRectangle:()=>this.rectBySize()}}arcActions(){return{edit:this._arcEdit,setEdit:e=>this._arcEdit=e,apply:e=>{if(!this.isAdmin||Math.abs(e.bulge)<.01)return;let n=this._doc,r=structuredClone(n),o=r.floors.find(c=>c.id===this._floorId);if(!o)return;let[i,s,l]=e.key.split(":");if(!(i==="wall"?Rf(o,s,e.bulge).length>0:Mf(o,s,Number(l),e.bulge))){this._arcEdit={...e,error:this.t("arc_too_wide")};return}this._arcEdit=null,this.setDoc(r,n)}}}freeWallActions(){return{update:e=>this.updateFreeWall(e),remove:()=>this.deleteFreeWall(),arc:this.arcActions(),lockButton:this.fixButton("wall",this.sel.wall??"")}}outdoorActions(){return{update:e=>this.updateOutdoor(e),setRectangle:(e,n)=>{let r=this.outdoorArea;r&&this.updateOutdoor({points:Ep(r,e,n)})},duplicate:()=>this.duplicateOutdoor(),remove:()=>this.deleteOutdoor(),removeCorner:e=>{let n=this.sel.outdoor;n&&this.change((r,o)=>{_p(o.outdoor.find(i=>i.id===n),e)})},lockButton:this.fixButton("outdoor",this.sel.outdoor??"")}}libraryActions(){return{add:e=>this.addFurniture(e),studio:()=>this.openStudio(null),packs:this.packs??[]}}openStudio(e){let n=e?G(e):void 0,r=n?.recipe&&e?.startsWith(`pack:${bn}:`)?n.id:null;this._studio={recipe:r&&n?.recipe?{...n.recipe}:Pl("cabinet",""),itemId:r,busy:!1,error:null},this._tool="furniture"}async saveStudio(){let e=this._studio;if(!e||!this.hass||!this.isAdmin)return;let n=this.hass.language??"en",r=gr().find(d=>d.id===bn),o=r?.items??[],i={...e.recipe,name:e.recipe.name||this.t(`studio_kind_${e.recipe.kind}`)},s=e.itemId??xg(i.name,o.map(d=>d.id)),l=qi(i,s,n),a={id:bn,name:r?.name??this.t("studio_pack_name"),publisher:r?.publisher??this.t("studio_pack_publisher"),release:(r?.release??0)+1,items:e.itemId?o.map(d=>d.id===s?l:d):[...o,l]};this._studio={...e,busy:!0,error:null};try{let{builtin:d,imported_at:u,...p}=a;await wr(this.hass,JSON.stringify({format:"nfpack",version:1,...
Line truncated
|
||||
`]};customElements.get("nf-extensions")||customElements.define("nf-extensions",Nl);var go="handled",t_=["select","rect","polygon","wall","opening","furniture","stairs","outdoor","hole","roof","energy"],n_=new Set(["vertex","room","device","opening","furniture","rotate","resize","outdoor","roofmove","roofcorner","roofvertex","outvertex","solarmove","solarturn","bgmove","bgscale","bgrotate"]),Xi=10,He=t=>Math.round(t*1e3)/1e3,r_={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]},Bl=class extends Q{static properties={hass:{attribute:!1},building:{attribute:!1},narrow:{type:Boolean},roomLabels:{attribute:!1},packs:{attribute:!1},loadCardEditor:{attribute:!1},_doc:{state:!0},_doc3d:{state:!0},_split:{state:!0},_splitRatio:{state:!0},_wall3d:{state:!0},_solid3d:{state:!0},_sidePinned:{state:!0},_studio:{state:!0},_check:{state:!0},_keys:{state:!0},_note:{state:!0},_dims:{state:!0},_tour:{state:!0},_sideOpen:{state:!0},_floorId:{state:!0},_energyNote:{state:!0},_ctx:{state:!0},_fixedHint:{state:!0},_openingPreset:{state:!0},_measureLen:{state:!0},_rectSize:{state:!0},_tool:{state:!0},_wallView:{state:!0},_draft:{state:!0},_cursor:{state:!0},_guides:{state:!0},_view:{state:!0},_size:{state:!0},_canUndo:{state:!0},_canRedo:{state:!0},_arcEdit:{state:!0},_routeDraft:{state:!0}};doc3dTimer;tourChecked=!1;_pick=null;_pickTimer;fixedPan=!1;reframe3d=!1;pressTimer=0;pressStart=null;history=new Wi(100);lib=new Fi(()=>this.requestUpdate());side=new Ui(()=>this.requestUpdate());sel=new ji(()=>this.requestUpdate());host=this.makeHost();backup=this.makeBackup();roof=this.makeRoof();bg=this.makeBackground();settingsActions={useRoofSections:()=>{this.roof.useSections(),this._tool="roof"}};drag=null;pointers=new Map;pinch=null;fitted=!1;resizeObserver;constructor(){super(),this.narrow=!1,this.roomLabels=!0,this._floorId=null,this._arcEdit=null,this._routeDraft=null,this.roof.sectionId=null,this.roof.solarId=null,this.roof.picking=!1,this.roof.windowId=null,this.roof.chimneyId=null,this._energyNote=null,this._openingPreset="door";let e=!1;try{e=localStorage.getItem("nextfloor.editor3d")==="1"}catch{}this._split=e,this._splitRatio=.55;try{let r=Number(localStorage.getItem("nextfloor.editorSplit"));r>=20&&r<=80&&(this._splitRatio=r/100)}catch{}this._wall3d="cut",this._solid3d=!1,this._doc3d=this._doc,this._sideOpen=!1;let n=!0;try{n=localStorage.getItem("nextfloor.sidePinned")!=="0"}catch{}this._sidePinned=n,this._studio=null,this._check=!1,this._keys=!1,this._note=null,this._dims=(()=>{try{return localStorage.getItem("nextfloor.plan_dims")==="1"}catch{return!1}})(),this._tour=null,this._measureLen=3,this._rectSize=[4,3],this._tool="select",this._wallView=null,this._draft=[],this._cursor=null,this._guides={},this._view={scale:50,ox:40,oy:40},this._size={w:800,h:600},this._canUndo=!1,this._canRedo=!1}t(e,n){return $e(this.hass,e,n)}measureState(){return{draft:this._draft,length:this._measureLen,rectSize:this._rectSize}}measureActions(){return{setLength:e=>this._measureLen=e,step:e=>this.measureStep(e),close:()=>this.closeDraft(),undo:()=>this._draft=this._draft.slice(0,-1),setRectSize:e=>this._rectSize=e,addRectangle:()=>this.rectBySize()}}arcActions(){return{edit:this._arcEdit,setEdit:e=>this._arcEdit=e,apply:e=>{if(!this.isAdmin||Math.abs(e.bulge)<.01)return;let n=this._doc,r=structuredClone(n),o=r.floors.find(c=>c.id===this._floorId);if(!o)return;let[i,s,l]=e.key.split(":");if(!(i==="wall"?Rf(o,s,e.bulge).length>0:Mf(o,s,Number(l),e.bulge))){this._arcEdit={...e,error:this.t("arc_too_wide")};return}this._arcEdit=null,this.setDoc(r,n)}}}freeWallActions(){return{update:e=>this.updateFreeWall(e),remove:()=>this.deleteFreeWall(),arc:this.arcActions(),lockButton:this.fixButton("wall",this.sel.wall??"")}}outdoorActions(){return{update:e=>this.updateOutdoor(e),setRectangle:(e,n)=>{let r=this.outdoorArea;r&&this.updateOutdoor({points:Ep(r,e,n)})},duplicate:()=>this.duplicateOutdoor(),remove:()=>this.deleteOutdoor(),removeCorner:e=>{let n=this.sel.outdoor;n&&this.change((r,o)=>{_p(o.outdoor.find(i=>i.id===n),e)})},lockButton:this.fixButton("outdoor",this.sel.outdoor??"")}}libraryActions(){return{add:e=>this.addFurniture(e),studio:()=>this.openStudio(null),packs:this.packs??[]}}openStudio(e){let n=e?G(e):void 0,r=n?.recipe&&e?.startsWith(`pack:${bn}:`)?n.id:null;this._studio={recipe:r&&n?.recipe?{...n.recipe}:Pl("cabinet",""),itemId:r,busy:!1,error:null},this._tool="furniture"}async saveStudio(){let e=this._studio;if(!e||!this.hass||!this.isAdmin)return;let n=this.hass.language??"en",r=gr().find(d=>d.id===bn),o=r?.items??[],i={...e.recipe,name:e.recipe.name||this.t(`studio_kind_${e.recipe.kind}`)},s=e.itemId??xg(i.name,o.map(d=>d.id)),l=qi(i,s,n),a={id:bn,name:r?.name??this.t("studio_pack_name"),publisher:r?.publisher??this.t("studio_pack_publisher"),release:(r?.release??0)+1,items:e.itemId?o.map(d=>d.id===s?l:d):[...o,l]};this._studio={...e,busy:!0,error:null};try{let{builtin:d,imported_at:u,...p}=a;await wr(this.hass,
Line truncated
|
||||
>${s}
|
||||
<input
|
||||
type="number"
|
||||
@@ -4472,7 +4472,7 @@ ${i}`}else o=eh(s)}}catch(s){let l=s.message,a={not_json:"import_error_not_json"
|
||||
.selectedDevice=${this.sel.device}
|
||||
.quality=${"auto"}
|
||||
.floorThumbs=${!1}
|
||||
.roomLabels=${!0}
|
||||
.roomLabels=${this.roomLabels}
|
||||
.floorStack=${this.houseTool?"stacked":"single"}
|
||||
.panelOpen=${!1}
|
||||
.alerts=${!1}
|
||||
@@ -4526,6 +4526,7 @@ ${i}`}else o=eh(s)}}catch(s){let l=s.message,a={not_json:"import_error_not_json"
|
||||
${this.t(`tool_${r}`)}
|
||||
</button>`)}
|
||||
</div>
|
||||
<button class="nf-chip nf-room-names-toggle" aria-pressed=${this.roomLabels} title=${this.t("room_names_toggle_hint")} @click=${()=>{this.roomLabels=!this.roomLabels,this.dispatchEvent(new CustomEvent("room-names-change",{detail:{value:this.roomLabels},bubbles:!0,composed:!0}))}}>${this.t("room_names_short")}</button>
|
||||
<div class="nf-seg">
|
||||
<button ?disabled=${!this._canUndo} @click=${()=>this.undo()} title="Ctrl+Z">${this.t("undo")}</button>
|
||||
<button ?disabled=${!this._canRedo} @click=${()=>this.redo()} title="Ctrl+Y">${this.t("redo")}</button>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
|
||||
var $={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 $n=globalThis,Mn=$n.ShadowRoot&&($n.ShadyCSS===void 0||$n.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Wr=Symbol(),xi=new WeakMap,Nt=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Wr)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(Mn&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=xi.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&xi.set(t,e))}return e}toString(){return this.cssText}},ki=r=>new Nt(typeof r=="string"?r:r+"",void 0,Wr),ne=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((n,o,i)=>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.")})(o)+r[i+1],r[0]);return new Nt(t,r,Wr)},Si=(r,e)=>{if(Mn)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),o=$n.litNonce;o!==void 0&&n.setAttribute("nonce",o),n.textContent=t.cssText,r.appendChild(n)}},Or=Mn?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return ki(t)})(r):r;var{is:iu,defineProperty:su,getOwnPropertyDescriptor:au,getOwnPropertyNames:lu,getOwnPropertySymbols:cu,getPrototypeOf:uu}=Object,An=globalThis,$i=An.trustedTypes,du=$i?$i.emptyScript:"",hu=An.reactiveElementPolyfillSupport,Wt=(r,e)=>r,Lr={toAttribute(r,e){switch(e){case Boolean:r=r?du: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}},Ai=(r,e)=>!iu(r,e),Mi={attribute:!0,type:String,converter:Lr,reflect:!1,useDefault:!1,hasChanged:Ai};Symbol.metadata??=Symbol("metadata"),An.litPropertyMetadata??=new WeakMap;var Ae=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=Mi){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(),o=this.getPropertyDescriptor(e,n,t);o!==void 0&&su(this.prototype,e,o)}}static getPropertyDescriptor(e,t,n){let{get:o,set:i}=au(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:o,set(s){let a=o?.call(this);i?.call(this,s),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Mi}static _$Ei(){if(this.hasOwnProperty(Wt("elementProperties")))return;let e=uu(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Wt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Wt("properties"))){let t=this.properties,n=[...lu(t),...cu(t)];for(let o of n)this.createProperty(o,t[o])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,o]of t)this.elementProperties.set(n,o)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let o=this._$Eu(t,n);o!==void 0&&this._$Eh.set(o,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 o of n)t.unshift(Or(o))}else e!==void 0&&t.push(Or(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.shaLine truncated
|
||||
var $={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 $n=globalThis,Mn=$n.ShadowRoot&&($n.ShadyCSS===void 0||$n.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Wr=Symbol(),xi=new WeakMap,Nt=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Wr)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(Mn&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=xi.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&xi.set(t,e))}return e}toString(){return this.cssText}},ki=r=>new Nt(typeof r=="string"?r:r+"",void 0,Wr),ne=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((n,o,i)=>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.")})(o)+r[i+1],r[0]);return new Nt(t,r,Wr)},Si=(r,e)=>{if(Mn)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),o=$n.litNonce;o!==void 0&&n.setAttribute("nonce",o),n.textContent=t.cssText,r.appendChild(n)}},Or=Mn?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return ki(t)})(r):r;var{is:iu,defineProperty:su,getOwnPropertyDescriptor:au,getOwnPropertyNames:lu,getOwnPropertySymbols:cu,getPrototypeOf:uu}=Object,An=globalThis,$i=An.trustedTypes,du=$i?$i.emptyScript:"",hu=An.reactiveElementPolyfillSupport,Wt=(r,e)=>r,Lr={toAttribute(r,e){switch(e){case Boolean:r=r?du: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}},Ai=(r,e)=>!iu(r,e),Mi={attribute:!0,type:String,converter:Lr,reflect:!1,useDefault:!1,hasChanged:Ai};Symbol.metadata??=Symbol("metadata"),An.litPropertyMetadata??=new WeakMap;var Ae=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=Mi){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(),o=this.getPropertyDescriptor(e,n,t);o!==void 0&&su(this.prototype,e,o)}}static getPropertyDescriptor(e,t,n){let{get:o,set:i}=au(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:o,set(s){let a=o?.call(this);i?.call(this,s),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Mi}static _$Ei(){if(this.hasOwnProperty(Wt("elementProperties")))return;let e=uu(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Wt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Wt("properties"))){let t=this.properties,n=[...lu(t),...cu(t)];for(let o of n)this.createProperty(o,t[o])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,o]of t)this.elementProperties.set(n,o)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let o=this._$Eu(t,n);o!==void 0&&this._$Eh.set(o,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 o of n)t.unshift(Or(o))}else e!==void 0&&t.push(Or(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.shaLine truncated
|
||||
\f\r]`,Ot=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,zi=/-->/g,Ti=/>/g,Je=RegExp(`>|${Br}(?:([^\\s"'>=/]+)(${Br}*=${Br}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),Di=/'/g,Fi=/"/g,Ci=/^(?:script|style|textarea|title)$/i,Yr=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),m=Yr(1),Q=Yr(2),Gm=Yr(3),et=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),Pi=new WeakMap,Qe=Xe.createTreeWalker(Xe,129);function Ni(r,e){if(!Zr(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ri!==void 0?Ri.createHTML(e):e}var fu=(r,e)=>{let t=r.length-1,n=[],o,i=e===2?"<svg>":e===3?"<math>":"",s=Ot;for(let a=0;a<t;a++){let l=r[a],c,u,h=-1,p=0;for(;p<l.length&&(s.lastIndex=p,u=s.exec(l),u!==null);)p=s.lastIndex,s===Ot?u[1]==="!--"?s=zi:u[1]!==void 0?s=Ti:u[2]!==void 0?(Ci.test(u[2])&&(o=RegExp("</"+u[2],"g")),s=Je):u[3]!==void 0&&(s=Je):s===Je?u[0]===">"?(s=o??Ot,h=-1):u[1]===void 0?h=-2:(h=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?Je:u[3]==='"'?Fi:Di):s===Fi||s===Di?s=Je:s===zi||s===Ti?s=Ot:(s=Je,o=void 0);let d=s===Je&&r[a+1].startsWith("/>")?" ":"";i+=s===Ot?l+pu:h>=0?(n.push(c),l.slice(0,h)+Hi+l.slice(h)+Le+d):l+Le+(h===-2?a:d)}return[Ni(r,i+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},Vt=class r{constructor({strings:e,_$litType$:t},n){let o;this.parts=[];let i=0,s=0,a=e.length-1,l=this.parts,[c,u]=fu(e,t);if(this.el=r.createElement(c,n),Qe.currentNode=this.el.content,t===2||t===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(o=Qe.nextNode())!==null&&l.length<a;){if(o.nodeType===1){if(o.hasAttributes())for(let h of o.getAttributeNames())if(h.endsWith(Hi)){let p=u[s++],d=o.getAttribute(h).split(Le),_=/([.?@])?(.*)/.exec(p);l.push({type:1,index:i,name:_[2],strings:d,ctor:_[1]==="."?Kr:_[1]==="?"?Gr:_[1]==="@"?Ur:mt}),o.removeAttribute(h)}else h.startsWith(Le)&&(l.push({type:6,index:i}),o.removeAttribute(h));if(Ci.test(o.tagName)){let h=o.textContent.split(Le),p=h.length-1;if(p>0){o.textContent=En?En.emptyScript:"";for(let d=0;d<p;d++)o.append(h[d],Lt()),Qe.nextNode(),l.push({type:2,index:++i});o.append(h[p],Lt())}}}else if(o.nodeType===8)if(o.data===Ii)l.push({type:2,index:i});else{let h=-1;for(;(h=o.data.indexOf(Le,h+1))!==-1;)l.push({type:7,index:i}),h+=Le.length-1}i++}}static createElement(e,t){let n=Xe.createElement("template");return n.innerHTML=e,n}};function pt(r,e,t=r,n){if(e===et)return e;let o=n!==void 0?t._$Co?.[n]:t._$Cl,i=Bt(e)?void 0:e._$litDirective$;return o?.constructor!==i&&(o?._$AO?.(!1),i===void 0?o=void 0:(o=new i(r),o._$AT(r,t,n)),n!==void 0?(t._$Co??=[])[n]=o:t._$Cl=o),o!==void 0&&(e=pt(r,o._$AS(r,e.values),o,n)),e}var Vr=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,o=(e?.creationScope??Xe).importNode(t,!0);Qe.currentNode=o;let i=Qe.nextNode(),s=0,a=0,l=n[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new Kt(i,i.nextSibling,this,e):l.type===1?c=new l.ctor(i,l.name,l.strings,this,e):l.type===6&&(c=new jr(i,this,e)),this._$AV.push(c),l=n[++a]}s!==l?.index&&(i=Qe.nextNode(),s++)}return Qe.currentNode=Xe,o}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++}},Kt=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,o){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=o,this._$Cv=o?.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=pt(this,e,t),Bt(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==et&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):mu(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&&Bt(this._$AH)?this._$AA.nextSibling.data=e:this.T(Xe.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,o=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=Vt.createElement(Ni(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===o)this._$AH.p(t);else{let i=new Vr(o,this),s=i.u(this.options);i.p(t),this.T(s),this._$AH=i}}_$AC(e){let t=Pi.get(e.strings);return t===void 0&&Pi.set(e.strings,t=new Vt(e)),t}k(e){Zr(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,o=0;for(let i of e)o===t.length?t.push(n=new r(this.O(Lt()),this.O(Lt()),this,this.options)):n=t[o],n._$AI(i),o++;o<t.length&&(this._$AR(n&&n._$AB.nextSibling,o),t.length=o)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=Ei(e).nextSibling;Ei(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},mt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,o,i){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=o,this.options=i,n.length>2||n[0]!==""||n[1]!==""?(this._Line truncated
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),Di=/'/g,Fi=/"/g,Ci=/^(?:script|style|textarea|title)$/i,Yr=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),p=Yr(1),Q=Yr(2),Gp=Yr(3),et=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),Pi=new WeakMap,Qe=Xe.createTreeWalker(Xe,129);function Ni(r,e){if(!Zr(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ri!==void 0?Ri.createHTML(e):e}var fu=(r,e)=>{let t=r.length-1,n=[],o,i=e===2?"<svg>":e===3?"<math>":"",s=Ot;for(let a=0;a<t;a++){let l=r[a],c,u,h=-1,m=0;for(;m<l.length&&(s.lastIndex=m,u=s.exec(l),u!==null);)m=s.lastIndex,s===Ot?u[1]==="!--"?s=zi:u[1]!==void 0?s=Ti:u[2]!==void 0?(Ci.test(u[2])&&(o=RegExp("</"+u[2],"g")),s=Je):u[3]!==void 0&&(s=Je):s===Je?u[0]===">"?(s=o??Ot,h=-1):u[1]===void 0?h=-2:(h=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?Je:u[3]==='"'?Fi:Di):s===Fi||s===Di?s=Je:s===zi||s===Ti?s=Ot:(s=Je,o=void 0);let d=s===Je&&r[a+1].startsWith("/>")?" ":"";i+=s===Ot?l+mu:h>=0?(n.push(c),l.slice(0,h)+Hi+l.slice(h)+Le+d):l+Le+(h===-2?a:d)}return[Ni(r,i+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},Vt=class r{constructor({strings:e,_$litType$:t},n){let o;this.parts=[];let i=0,s=0,a=e.length-1,l=this.parts,[c,u]=fu(e,t);if(this.el=r.createElement(c,n),Qe.currentNode=this.el.content,t===2||t===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(o=Qe.nextNode())!==null&&l.length<a;){if(o.nodeType===1){if(o.hasAttributes())for(let h of o.getAttributeNames())if(h.endsWith(Hi)){let m=u[s++],d=o.getAttribute(h).split(Le),_=/([.?@])?(.*)/.exec(m);l.push({type:1,index:i,name:_[2],strings:d,ctor:_[1]==="."?Kr:_[1]==="?"?Gr:_[1]==="@"?Ur:pt}),o.removeAttribute(h)}else h.startsWith(Le)&&(l.push({type:6,index:i}),o.removeAttribute(h));if(Ci.test(o.tagName)){let h=o.textContent.split(Le),m=h.length-1;if(m>0){o.textContent=En?En.emptyScript:"";for(let d=0;d<m;d++)o.append(h[d],Lt()),Qe.nextNode(),l.push({type:2,index:++i});o.append(h[m],Lt())}}}else if(o.nodeType===8)if(o.data===Ii)l.push({type:2,index:i});else{let h=-1;for(;(h=o.data.indexOf(Le,h+1))!==-1;)l.push({type:7,index:i}),h+=Le.length-1}i++}}static createElement(e,t){let n=Xe.createElement("template");return n.innerHTML=e,n}};function mt(r,e,t=r,n){if(e===et)return e;let o=n!==void 0?t._$Co?.[n]:t._$Cl,i=Bt(e)?void 0:e._$litDirective$;return o?.constructor!==i&&(o?._$AO?.(!1),i===void 0?o=void 0:(o=new i(r),o._$AT(r,t,n)),n!==void 0?(t._$Co??=[])[n]=o:t._$Cl=o),o!==void 0&&(e=mt(r,o._$AS(r,e.values),o,n)),e}var Vr=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,o=(e?.creationScope??Xe).importNode(t,!0);Qe.currentNode=o;let i=Qe.nextNode(),s=0,a=0,l=n[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new Kt(i,i.nextSibling,this,e):l.type===1?c=new l.ctor(i,l.name,l.strings,this,e):l.type===6&&(c=new jr(i,this,e)),this._$AV.push(c),l=n[++a]}s!==l?.index&&(i=Qe.nextNode(),s++)}return Qe.currentNode=Xe,o}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++}},Kt=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,o){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=o,this._$Cv=o?.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=mt(this,e,t),Bt(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==et&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):pu(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&&Bt(this._$AH)?this._$AA.nextSibling.data=e:this.T(Xe.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,o=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=Vt.createElement(Ni(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===o)this._$AH.p(t);else{let i=new Vr(o,this),s=i.u(this.options);i.p(t),this.T(s),this._$AH=i}}_$AC(e){let t=Pi.get(e.strings);return t===void 0&&Pi.set(e.strings,t=new Vt(e)),t}k(e){Zr(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,o=0;for(let i of e)o===t.length?t.push(n=new r(this.O(Lt()),this.O(Lt()),this,this.options)):n=t[o],n._$AI(i),o++;o<t.length&&(this._$AR(n&&n._$AB.nextSibling,o),t.length=o)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=Ei(e).nextSibling;Ei(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},pt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,o,i){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=o,this.options=i,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);
|
||||
@@ -209,52 +209,52 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
min-height: 40px;
|
||||
}
|
||||
}
|
||||
`;function _r(r){return r?.themes?.darkMode===!1?"light":"dark"}var Oh=4,Lh=8,Bh=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[255,95,210],[120,255,150]],zt=r=>m`<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
`;function _r(r){return r?.themes?.darkMode===!1?"light":"dark"}var Oh=4,Lh=8,Bh=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[255,95,210],[120,255,150]],zt=r=>p`<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<path d=${ir(r)} />
|
||||
</svg>`,br={previous:"M6 6h2v12H6zM20 6v12l-10-6z",play:"M8 5v14l11-7z",pause:"M7 5h4v14H7zM13 5h4v14h-4z",next:"M16 6h2v12h-2zM4 6v12l10-6z"},Co=r=>m`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d=${r} /></svg>`,Vh=24,Kh=10,No=class extends re{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 fr(e))this.call("light",t.service,t.data)}renderMoods(e,t){let n=e.moods??[],o=!!this.rooms&&!!this.hass.user?.is_admin;if(!n.length&&!o)return f;let i=(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(mr)}]),this._moodName=null};return m`<div class="nf-rp-moods">
|
||||
${n.map(l=>m`<span class="nf-rp-mood">
|
||||
</svg>`,br={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>`,Vh=24,Kh=10,No=class extends re{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 fr(e))this.call("light",t.service,t.data)}renderMoods(e,t){let n=e.moods??[],o=!!this.rooms&&!!this.hass.user?.is_admin;if(!n.length&&!o)return f;let i=(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(pr)}]),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>
|
||||
${i.length?m`<select class="nf-rp-mood-to" aria-label=${this.t("mood_carry")} title=${this.t("mood_carry")} @change=${c=>{let u=c.target,h=i.find(p=>p.id===u.value);u.value="",h&&this.runMood(il(l,s(h)))}}>
|
||||
${i.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,h=i.find(m=>m.id===u.value);u.value="",h&&this.runMood(il(l,s(h)))}}>
|
||||
<option value="">→</option>
|
||||
${i.map(c=>m`<option value=${c.id}>${c.name}</option>`)}
|
||||
${i.map(c=>p`<option value=${c.id}>${c.name}</option>`)}
|
||||
</select>`:f}
|
||||
${o?m`<button class="nf-btn nf-rp-small" aria-label=${this.t("delete")} @click=${()=>this.fireMoods(e,n.filter(c=>c.id!==l.id))}>✕</button>`:f}
|
||||
${o?p`<button class="nf-btn nf-rp-small" aria-label=${this.t("delete")} @click=${()=>this.fireMoods(e,n.filter(c=>c.id!==l.id))}>✕</button>`:f}
|
||||
</span>`)}
|
||||
${o?this._moodName===null?m`<button class="nf-btn nf-rp-small" title=${this.t("mood_save_hint")} @click=${()=>this._moodName=""}>+ ${this.t("mood_save")}</button>`:m`<span class="nf-rp-mood"
|
||||
${o?this._moodName===null?p`<button class="nf-btn nf-rp-small" title=${this.t("mood_save_hint")} @click=${()=>this._moodName=""}>+ ${this.t("mood_save")}</button>`:p`<span class="nf-rp-mood"
|
||||
><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=Ve(this.hass,this.floor,e,"temperature"),n=t.length?t:K(this.hass,e).filter(s=>s.startsWith("climate."));if(!n.length)return;let o=Date.now(),i=o-24*36e5;try{let s=await ln(this.hass,n,i,o,!!t.length);if(this.room?.id!==e.id)return;let a=[];for(let l=1;l<=96;l++){let c=Rt(this.hass,s,i+(o-i)*l/96),u=n.map(h=>h.startsWith("climate.")?Number(c.states[h]?.attributes.current_temperature):Number(c.states[h]?.state)).filter(Number.isFinite);a.push(u.length?u.reduce((h,p)=>h+p,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;let t=Ho(this.hass,this.building,this.floor,e);try{let n=await Ya(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 o=Math.max(...n.map(s=>Date.parse(String(s.last_changed??""))||0)),i=Math.floor((Date.now()-o)/6e4);return!o||i<Kh?f:m`<div class="nf-rp-shade">
|
||||
</div>`}async loadCurve(e){let t=Ve(this.hass,this.floor,e,"temperature"),n=t.length?t:K(this.hass,e).filter(s=>s.startsWith("climate."));if(!n.length)return;let o=Date.now(),i=o-24*36e5;try{let s=await ln(this.hass,n,i,o,!!t.length);if(this.room?.id!==e.id)return;let a=[];for(let l=1;l<=96;l++){let c=Rt(this.hass,s,i+(o-i)*l/96),u=n.map(h=>h.startsWith("climate.")?Number(c.states[h]?.attributes.current_temperature):Number(c.states[h]?.state)).filter(Number.isFinite);a.push(u.length?u.reduce((h,m)=>h+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;let t=Ho(this.hass,this.building,this.floor,e);try{let n=await Ya(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 o=Math.max(...n.map(s=>Date.parse(String(s.last_changed??""))||0)),i=Math.floor((Date.now()-o)/6e4);return!o||i<Kh?f:p`<div class="nf-rp-shade">
|
||||
<span>💡 ${this.t("empty_lights_hint",{n:t.length,min:i})}</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 o=a=>!!a&&a!=="none"&&this.hass.states[a]?.state==="on",i=this.floor.openings.filter(a=>a.room_id===t.id&&[a.contact,a.contact2,a.tilt,a.tilt2].some(o));if(!i.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 m`<div class="nf-rp-shade nf-rp-open-heat">
|
||||
</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 o=a=>!!a&&a!=="none"&&this.hass.states[a]?.state==="on",i=this.floor.openings.filter(a=>a.room_id===t.id&&[a.contact,a.contact2,a.tilt,a.tilt2].some(o));if(!i.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:i.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 o=U(this.hass,this.floor,e,"temperature");if(o===null||o<Vh)return f;let i=a=>{let l=a&&a!=="none"?this.hass.states[a]:void 0;if(!l||I(l))return!1;let c=l.attributes.current_position;return typeof c=="number"?c>30:l.state==="open"},s=[...new Set(Va(this.building,this.floor,e,{latitude:t,longitude:n}).flatMap(a=>[a.cover,a.cover2].filter(i)))];return s.length?m`<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 o=U(this.hass,this.floor,e,"temperature");if(o===null||o<Vh)return f;let i=a=>{let l=a&&a!=="none"?this.hass.states[a]:void 0;if(!l||I(l))return!1;let c=l.attributes.current_position;return typeof c=="number"?c>30:l.state==="open"},s=[...new Set(Va(this.building,this.floor,e,{latitude:t,longitude:n}).flatMap(a=>[a.cover,a.cover2].filter(i)))];return s.length?p`<div class="nf-rp-shade">
|
||||
<span>☀ ${this.t("shade_hint",{n:s.length,temp:`${W(this.hass,oe(this.hass,o),1)} ${X(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 o={latitude:t,longitude:n};if(!At(this.building,this.floor,e,{...o,zone:this.hass.config?.time_zone}).facing.length)return f;let s=m`<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 o={latitude:t,longitude:n};if(!At(this.building,this.floor,e,{...o,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=Ba(this.building,this.floor,e,o),l=Math.max(1,...a),c=Array.from({length:12},(u,h)=>new Date(2026,h,15).toLocaleDateString(this.hass.language,{month:"narrow"}));return m`${s}
|
||||
</button>`;if(!this._sunYear)return s;let a=Ba(this.building,this.floor,e,o),l=Math.max(1,...a),c=Array.from({length:12},(u,h)=>new Date(2026,h,15).toLocaleDateString(this.hass.language,{month:"narrow"}));return p`${s}
|
||||
<div class="nf-rp-sun-bars" role="img" aria-label=${a.map((u,h)=>`${c[h]} ${W(this.hass,u,1)} h`).join(", ")}>
|
||||
${a.map((u,h)=>m`<span title=${`${W(this.hass,u,1)} h`}><i style=${`height:${Math.round(u/l*100)}%`}></i><b>${c[h]}</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,o=n?{value:Number(n.state),unit:String(n.attributes.unit_of_measurement??"")}:null,i=Ja(e.month,o),s=a=>`${W(this.hass,a,a<10?2:1)} kWh`;return m`<p class="nf-rp-facts nf-rp-energy" title=${this.t("room_energy_hint")}>
|
||||
${a.map((u,h)=>p`<span title=${`${W(this.hass,u,1)} h`}><i style=${`height:${Math.round(u/l*100)}%`}></i><b>${c[h]}</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,o=n?{value:Number(n.state),unit:String(n.attributes.unit_of_measurement??"")}:null,i=Ja(e.month,o),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)})}${i?` \xB7 ${W(this.hass,i.value,2)} ${i.currency}`:""}
|
||||
</p>`}renderCurve(){let e=this._curve;if(!e)return f;let t=e.filter(c=>c!==null),n=Math.min(...t),o=Math.max(...t),i=Math.max(1,o-n),s=e.map(c=>c===null?null:c-n+i*.1),a=cn(s,220,36,i*1.2),l=c=>`${W(this.hass,oe(this.hass,c),1)}\xB0`;return m`<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(c=>c!==null),n=Math.min(...t),o=Math.max(...t),i=Math.max(1,o-n),s=e.map(c=>c===null?null:c-n+i*.1),a=cn(s,220,36,i*1.2),l=c=>`${W(this.hass,oe(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">${Q`<path d=${a}></path>`}</svg>
|
||||
<span>24 h · ${l(n)} – ${l(o)}</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 A(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 o=t.slice(0,t.indexOf(".")),i=()=>o==="script"?this.call("script","turn_on",{entity_id:t}):this.call(o,"press",{entity_id:t});return m`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" ?disabled=${I(n)} title=${this.t("room_clean_run_hint")} @click=${i}>🧹 ${this.t("room_clean_run")}</button></div>`}allOff(e){let t=an(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 m`<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}=an(e);return t<2?f:m`<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 m`<button class="nf-rp-name" title=${this.t("details")} @click=${()=>fe(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 o=()=>{this.confirmEntities?.has(e.entity_id)&&!confirm(this.t("confirm_switch",{name:this.name(e.entity_id)}))||n()};return m`<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 M(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 o=t.slice(0,t.indexOf(".")),i=()=>o==="script"?this.call("script","turn_on",{entity_id:t}):this.call(o,"press",{entity_id:t});return p`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" ?disabled=${I(n)} title=${this.t("room_clean_run_hint")} @click=${i}>🧹 ${this.t("room_clean_run")}</button></div>`}allOff(e){let t=an(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}=an(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=${()=>fe(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 o=()=>{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=${I(e)}
|
||||
@click=${o}
|
||||
></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),o=this.memo,{shown:i,more:s}=e?{shown:e,more:[]}:o&&o.entities===this.hass.entities&&o.floor===this.floor&&o.room===t?o:this.memo={entities:this.hass.entities,floor:this.floor,room:t,...this.floor?Gs(this.hass,this.floor,t):{shown:n,more:[]}},a=go(this.hass,s).map(y=>y.primary),l=a.length,c=this._showAll?[...i,...a]:i,u=y=>c.filter(z=>y.includes(F(z))).map(z=>this.hass.states[z]),h=u(["light"]),p=u(["cover"]),d=u(["climate"]),_=u(["media"]),b=u(["switch","fan","lock"]),g=u(["sensor","binary"]),v=u(["scene","script"]),S=this.facts(d),k=h.filter(y=>y.state==="on");return m`<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??K(this.hass,t),o=this.memo,{shown:i,more:s}=e?{shown:e,more:[]}:o&&o.entities===this.hass.entities&&o.floor===this.floor&&o.room===t?o:this.memo={entities:this.hass.entities,floor:this.floor,room:t,...this.floor?Gs(this.hass,this.floor,t):{shown:n,more:[]}},a=go(this.hass,s).map(y=>y.primary),l=a.length,c=this._showAll?[...i,...a]:i,u=y=>c.filter(z=>y.includes(F(z))).map(z=>this.hass.states[z]),h=u(["light"]),m=u(["cover"]),d=u(["climate"]),_=u(["media"]),b=u(["switch","fan","lock"]),g=u(["sensor","binary"]),v=u(["scene","script"]),S=this.facts(d),k=h.filter(y=>y.state==="on");return p`<section class="nf-rp" aria-label=${t.name}>
|
||||
<header class="nf-rp-head">
|
||||
<div>
|
||||
<h2>${t.name}</h2>
|
||||
${S.length?m`<p class="nf-rp-facts">${S.join(" \xB7 ")}</p>`:f} ${this.renderEnergy()} ${this.renderSunYear()} ${this.renderShade()}
|
||||
${S.length?p`<p class="nf-rp-facts">${S.join(" \xB7 ")}</p>`:f} ${this.renderEnergy()} ${this.renderSunYear()} ${this.renderShade()}
|
||||
${this.renderOpenWhileHeating(d)} ${this.renderEmptyLights(t,k)}
|
||||
${this.renderCurve()}
|
||||
</div>
|
||||
@@ -268,9 +268,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
<div class="nf-rp-body" ?hidden=${this._folded}>
|
||||
${this.renderAllOff([...h,..._,...b])}
|
||||
${this.renderClean(t)}
|
||||
${!t.area_id&&!e?m`<p class="nf-rp-note">${this.t("panel_no_area")}</p>`:c.length?f:m`<p class="nf-rp-note">${this.t("panel_empty")}</p>`}
|
||||
${v.length?this.section("panel_scenes",[m`<div class="nf-rp-scenes">
|
||||
${v.map(y=>m`<button
|
||||
${!t.area_id&&!e?p`<p class="nf-rp-note">${this.t("panel_no_area")}</p>`:c.length?f:p`<p class="nf-rp-note">${this.t("panel_empty")}</p>`}
|
||||
${v.length?this.section("panel_scenes",[p`<div class="nf-rp-scenes">
|
||||
${v.map(y=>p`<button
|
||||
class="nf-btn"
|
||||
?disabled=${I(y)}
|
||||
@click=${()=>this.call(F(y.entity_id)==="scene"?"scene":"script","turn_on",{entity_id:y.entity_id})}
|
||||
@@ -278,14 +278,14 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
${this.name(y.entity_id)}
|
||||
</button>`)}
|
||||
</div>`]):f}
|
||||
${h.length?this.section("panel_lights",[...h.map(y=>this.lightRow(y)),...t?[this.renderMoods(t,h)]:[]],m`${k.length<h.length?m`<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_on",{entity_id:h.filter(y=>!I(y)).map(y=>y.entity_id)})}>
|
||||
${h.length?this.section("panel_lights",[...h.map(y=>this.lightRow(y)),...t?[this.renderMoods(t,h)]:[]],p`${k.length<h.length?p`<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_on",{entity_id:h.filter(y=>!I(y)).map(y=>y.entity_id)})}>
|
||||
${this.t("panel_all_on")}
|
||||
</button>`:f}${k.length?m`<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_off",{entity_id:k.map(y=>y.entity_id)})}>
|
||||
</button>`:f}${k.length?p`<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_off",{entity_id:k.map(y=>y.entity_id)})}>
|
||||
${this.t("panel_all_off")}
|
||||
</button>`:f}`):f}
|
||||
${p.length?this.section("panel_covers",p.map(y=>this.coverRow(y)),p.length>1&&Gn(p,this.confirmEntities).length?m`<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","open_cover",{entity_id:Gn(p,this.confirmEntities)})}>
|
||||
${m.length?this.section("panel_covers",m.map(y=>this.coverRow(y)),m.length>1&&Gn(m,this.confirmEntities).length?p`<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","open_cover",{entity_id:Gn(m,this.confirmEntities)})}>
|
||||
${this.t("panel_all_open")}</button
|
||||
><button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:Gn(p,this.confirmEntities)})}>
|
||||
><button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:Gn(m,this.confirmEntities)})}>
|
||||
${this.t("panel_all_close")}
|
||||
</button>`:f):f}
|
||||
${d.length?this.section("panel_climate",d.map(y=>this.climateRow(y))):f}
|
||||
@@ -295,27 +295,27 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
${this.extraValues(t)}
|
||||
${wa(this.hass)&&va(this.hass,this.floor,t)?this.announceSection(t):f}
|
||||
${this.pluginSections(t,c)}
|
||||
${l?m`<button class="nf-btn nf-rp-small nf-rp-more" @click=${()=>this._showAll=!this._showAll}>
|
||||
${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&&H([n.x,n.z],e.points)).map(n=>({name:n.name||O(this.hass,n.entity_id),rows:sr(this.hass,n.values)})),...this.floor.furniture.filter(n=>H([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:sr(this.hass,n.values)}))].filter(n=>n.rows.length);return t.length?this.section("device_values",t.map(n=>m`<div class="nf-extra-values"><b>${n.name}</b>${n.rows.map(o=>m`<div class="nf-rp-row"><span class="nf-rp-icon">${o.icon}</span><span class="nf-rp-name">${o.label}</span><b class="nf-rp-state">${o.text}</b></div>`)}</div>`)):f}facts(e){let t=[],n=this.room;if(!n)return t;let o=(E,D)=>{let C=U(this.hass,this.floor,n,E);if(C===null)return null;if(E==="temperature")return`${W(this.hass,oe(this.hass,C),1)} ${X(this.hass)}`;let R=Ve(this.hass,this.floor,n,E)[0],M=this.hass.states[R]?.attributes.unit_of_measurement??D;return`${W(this.hass,C,1)} ${M}`},i=e.find(E=>typeof E.attributes.current_temperature=="number"),s=o("temperature","\xB0C");s?t.push(s):i&&n.climate?.temperature!=="none"&&t.push(`${W(this.hass,i.attributes.current_temperature,1)} ${X(this.hass)}`);let a=o("humidity","%");a&&t.push(a);let l=U(this.hass,this.floor??null,n,"illuminance");l!==null&&t.push(`\u2600 ${W(this.hass,l,0)} lx`);let c=this.floor&&this.building?Po(this.hass,this.building,this.floor,n):null;c!==null&&t.push(`\u26A1 ${lt(this.hass,c)}`);let u=this.floor?this.floor.openings.filter(E=>E.room_id===n.id).flatMap(E=>[E.contact,E.contact2,E.tilt,E.tilt2]).map(E=>E&&E!=="none"?this.hass.states[E]:void 0).filter(E=>E?.state==="on").map(E=>Date.parse(String(E.last_changed??""))).filter(Number.isFinite):[];u.length&&t.push(`\u{1FA9F} ${this.t("open_since",{time:Io(Date.now()-Math.min(...u))})}`);let h=K(this.hass,n).map(E=>this.hass.states[E]).filter(E=>!!E&&E.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(E.attributes.device_class)));if(h.length)if(h.some(E=>E.state==="on"))t.push(`\u{1F6B6} ${this.t("presence_now")}`);else{let E=Math.max(...h.map(D=>Date.parse(String(D.last_changed??""))||0));E>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:Io(Date.now()-E)})}`)}let p=this.building?el(this.hass,this.building).filter(E=>E.roomId===n.id&&E.level<Xa):[];p.length&&t.push(`\u{1FAAB} ${this.t("battery_low_n",{n:p.length,names:p.map(E=>`${this.name(E.entity)} ${Math.round(E.level)} %`).join(", ")})}`);let d=(this.building?.settings.circuits??[]).filter(E=>E.rooms.includes(n.id)).map(E=>E.name),_=this.building?.settings.room_facts_off??[];d.length&&!_.includes("circuits")&&t.push(`\u{1F50C} ${d.join(", ")}`);let{latitude:b,longitude:g,time_zone:v}=this.hass.config??{};if(this.floor&&b!==void 0&&g!==void 0&&this.building&&!_.includes("sun")){let E=At(this.building,this.floor,n,{latitude:b,longitude:g,zone:v});E.facing.length&&t.push(`\u2600 ${this.t("room_sun_hours",{h:W(this.hass,E.hours,1),facing:E.facing.join(", ")})}`)}let S=U(this.hass,this.floor,n,"temperature"),k=U(this.hass,this.floor,n,"humidity"),y=dr(U(this.hass,this.floor,n,"co2"),k,Et(S,k));y&&!_.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${y}`)}`);let z=hr(S,k,U(this.hass,this.floor,n,"co2"),at(new Date,this.hass.config?.latitude));return z!==null&&(S!==null||k!==null)&&!_.includes("comfort")&&t.push(`\u{1F60A} ${this.t("comfort_n",{n:z})}`),t}announceSection(e){let t=this.phrases?.length?this.phrases:[1,2,3,4,5].map(i=>this.t(`announce_phrase_${i}`)),n=i=>{let s=i.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))},o=i=>{i.preventDefault();let s=i.currentTarget.querySelector("input");n(s.value),s.value=""};return this.section("panel_announce",[m`<div class="nf-rp-scenes">${t.map(i=>m`<button class="nf-btn" @click=${()=>n(i)}>${i}</button>`)}</div>
|
||||
</section>`}extraValues(e){if(!this.floor)return f;let t=[...this.floor.placements.filter(n=>!n.outside&&H([n.x,n.z],e.points)).map(n=>({name:n.name||O(this.hass,n.entity_id),rows:sr(this.hass,n.values)})),...this.floor.furniture.filter(n=>H([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:sr(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(o=>p`<div class="nf-rp-row"><span class="nf-rp-icon">${o.icon}</span><span class="nf-rp-name">${o.label}</span><b class="nf-rp-state">${o.text}</b></div>`)}</div>`)):f}facts(e){let t=[],n=this.room;if(!n)return t;let o=(E,D)=>{let C=U(this.hass,this.floor,n,E);if(C===null)return null;if(E==="temperature")return`${W(this.hass,oe(this.hass,C),1)} ${X(this.hass)}`;let R=Ve(this.hass,this.floor,n,E)[0],A=this.hass.states[R]?.attributes.unit_of_measurement??D;return`${W(this.hass,C,1)} ${A}`},i=e.find(E=>typeof E.attributes.current_temperature=="number"),s=o("temperature","\xB0C");s?t.push(s):i&&n.climate?.temperature!=="none"&&t.push(`${W(this.hass,i.attributes.current_temperature,1)} ${X(this.hass)}`);let a=o("humidity","%");a&&t.push(a);let l=U(this.hass,this.floor??null,n,"illuminance");l!==null&&t.push(`\u2600 ${W(this.hass,l,0)} lx`);let c=this.floor&&this.building?Po(this.hass,this.building,this.floor,n):null;c!==null&&t.push(`\u26A1 ${lt(this.hass,c)}`);let u=this.floor?this.floor.openings.filter(E=>E.room_id===n.id).flatMap(E=>[E.contact,E.contact2,E.tilt,E.tilt2]).map(E=>E&&E!=="none"?this.hass.states[E]:void 0).filter(E=>E?.state==="on").map(E=>Date.parse(String(E.last_changed??""))).filter(Number.isFinite):[];u.length&&t.push(`\u{1FA9F} ${this.t("open_since",{time:Io(Date.now()-Math.min(...u))})}`);let h=K(this.hass,n).map(E=>this.hass.states[E]).filter(E=>!!E&&E.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(E.attributes.device_class)));if(h.length)if(h.some(E=>E.state==="on"))t.push(`\u{1F6B6} ${this.t("presence_now")}`);else{let E=Math.max(...h.map(D=>Date.parse(String(D.last_changed??""))||0));E>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:Io(Date.now()-E)})}`)}let m=this.building?el(this.hass,this.building).filter(E=>E.roomId===n.id&&E.level<Xa):[];m.length&&t.push(`\u{1FAAB} ${this.t("battery_low_n",{n:m.length,names:m.map(E=>`${this.name(E.entity)} ${Math.round(E.level)} %`).join(", ")})}`);let d=(this.building?.settings.circuits??[]).filter(E=>E.rooms.includes(n.id)).map(E=>E.name),_=this.building?.settings.room_facts_off??[];d.length&&!_.includes("circuits")&&t.push(`\u{1F50C} ${d.join(", ")}`);let{latitude:b,longitude:g,time_zone:v}=this.hass.config??{};if(this.floor&&b!==void 0&&g!==void 0&&this.building&&!_.includes("sun")){let E=At(this.building,this.floor,n,{latitude:b,longitude:g,zone:v});E.facing.length&&t.push(`\u2600 ${this.t("room_sun_hours",{h:W(this.hass,E.hours,1),facing:E.facing.join(", ")})}`)}let S=U(this.hass,this.floor,n,"temperature"),k=U(this.hass,this.floor,n,"humidity"),y=dr(U(this.hass,this.floor,n,"co2"),k,Et(S,k));y&&!_.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${y}`)}`);let z=hr(S,k,U(this.hass,this.floor,n,"co2"),at(new Date,this.hass.config?.latitude));return z!==null&&(S!==null||k!==null)&&!_.includes("comfort")&&t.push(`\u{1F60A} ${this.t("comfort_n",{n:z})}`),t}announceSection(e){let t=this.phrases?.length?this.phrases:[1,2,3,4,5].map(i=>this.t(`announce_phrase_${i}`)),n=i=>{let s=i.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))},o=i=>{i.preventDefault();let s=i.currentTarget.querySelector("input");n(s.value),s.value=""};return this.section("panel_announce",[p`<div class="nf-rp-scenes">${t.map(i=>p`<button class="nf-btn" @click=${()=>n(i)}>${i}</button>`)}</div>
|
||||
<form class="nf-rp-say" @submit=${o}>
|
||||
<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?m`<p class="nf-rp-note ${this._said.failed?"nf-rp-fail":""}" role="status">${this._said.text}</p>`:f}`])}pluginSections(e,t){return ns({hass:this.hass,room:{id:e.id,name:e.name,area_id:e.area_id??null},entities:t}).map(o=>m`<div class="nf-rp-sec nf-rp-plugin" data-plugin=${o.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 ns({hass:this.hass,room:{id:e.id,name:e.name,area_id:e.area_id??null},entities:t}).map(o=>p`<div class="nf-rp-sec nf-rp-plugin" data-plugin=${o.key}>
|
||||
<div class="nf-rp-sec-head"><h3>${o.title}</h3></div>
|
||||
${typeof o.content=="string"?m`<p class="nf-rp-note">${o.content}</p>`:o.content}
|
||||
</div>`)}section(e,t,n=f){return m`<div class="nf-rp-sec">
|
||||
${typeof o.content=="string"?p`<p class="nf-rp-note">${o.content}</p>`:o.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",o=t.supported_color_modes??[],i=o.some(d=>d!=="onoff"),s=o.includes("color_temp"),a=o.some(d=>["hs","rgb","rgbw","rgbww","xy"].includes(d)),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,h=e.entity_id,p=!!this.placedAs(h)?.simple;return m`<div class="nf-rp-row">
|
||||
</div>`}lightRow(e){let t=e.attributes,n=e.state==="on",o=t.supported_color_modes??[],i=o.some(d=>d!=="onoff"),s=o.includes("color_temp"),a=o.some(d=>["hs","rgb","rgbw","rgbww","xy"].includes(d)),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,h=e.entity_id,m=!!this.placedAs(h)?.simple;return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon ${n?"nf-rp-on":""}">${zt("light")}</span>
|
||||
${this.nameButton(h)}
|
||||
<span class="nf-rp-state">${this.stateOf(e)}</span>
|
||||
${this.toggle(e,n,()=>this.call("light","toggle",{entity_id:h}))}
|
||||
${i&&!p?m`<label class="nf-rp-slider"
|
||||
${i&&!m?p`<label class="nf-rp-slider"
|
||||
><span>${this.t("brightness")}</span>
|
||||
<input
|
||||
type="range"
|
||||
@@ -324,7 +324,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
.value=${String(l)}
|
||||
@change=${d=>this.call("light","turn_on",{entity_id:h,brightness_pct:Number(d.target.value)})}
|
||||
/></label>`:f}
|
||||
${n&&s&&!p?m`<label class="nf-rp-slider nf-rp-ct"
|
||||
${n&&s&&!m?p`<label class="nf-rp-slider nf-rp-ct"
|
||||
><span>${this.t("color_temp")}</span>
|
||||
<input
|
||||
type="range"
|
||||
@@ -334,24 +334,24 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
.value=${String(t.color_temp_kelvin??c)}
|
||||
@change=${d=>this.call("light","turn_on",{entity_id:h,color_temp_kelvin:Number(d.target.value)})}
|
||||
/></label>`:f}
|
||||
${n&&a&&!p?m`<div class="nf-rp-swatches" role="group" aria-label=${this.t("color")}>
|
||||
${Bh.map(d=>m`<button
|
||||
${n&&a&&!m?p`<div class="nf-rp-swatches" role="group" aria-label=${this.t("color")}>
|
||||
${Bh.map(d=>p`<button
|
||||
class="nf-rp-swatch"
|
||||
style="--c: rgb(${d.join(",")})"
|
||||
aria-label="rgb(${d.join(", ")})"
|
||||
@click=${()=>this.call("light","turn_on",{entity_id:h,rgb_color:d})}
|
||||
></button>`)}
|
||||
</div>`:f}
|
||||
</div>`}coverRow(e){let t=tr(this.hass,this.building?.floors??[],e.entity_id);e=nr(this.hass,e,t);let n=e.attributes,o=n.supported_features??0,i=e.entity_id,s=I(e)&&!qt(e);return m`<div class="nf-rp-row">
|
||||
</div>`}coverRow(e){let t=tr(this.hass,this.building?.floors??[],e.entity_id);e=nr(this.hass,e,t);let n=e.attributes,o=n.supported_features??0,i=e.entity_id,s=I(e)&&!qt(e);return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon">${zt("cover")}</span>
|
||||
${this.nameButton(i)}
|
||||
<span class="nf-rp-state">${this.stateOf(e)}</span>
|
||||
<div class="nf-rp-buttons">
|
||||
<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.askFor(i)&&this.call("cover","open_cover",{entity_id:i})}>${this.t("cover_open")}</button>
|
||||
${o&Lh?m`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","stop_cover",{entity_id:i})}>${this.t("cover_stop")}</button>`:f}
|
||||
${o&Lh?p`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","stop_cover",{entity_id:i})}>${this.t("cover_stop")}</button>`:f}
|
||||
<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.askFor(i)&&this.call("cover","close_cover",{entity_id:i})}>${this.t("cover_close")}</button>
|
||||
</div>
|
||||
${o&Oh&&typeof n.current_position=="number"?m`<label class="nf-rp-slider"
|
||||
${o&Oh&&typeof n.current_position=="number"?p`<label class="nf-rp-slider"
|
||||
><span>${this.t("position")}</span>
|
||||
<input
|
||||
type="range"
|
||||
@@ -361,7 +361,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
.value=${String(n.current_position)}
|
||||
@change=${a=>this.call("cover","set_cover_position",{entity_id:i,position:Number(a.target.value)})}
|
||||
/></label>`:f}
|
||||
${o&128&&typeof n.current_tilt_position=="number"?m`<label class="nf-rp-slider"
|
||||
${o&128&&typeof n.current_tilt_position=="number"?p`<label class="nf-rp-slider"
|
||||
><span>${this.t("cover_tilt")}</span>
|
||||
<input
|
||||
type="range"
|
||||
@@ -370,21 +370,21 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
?disabled=${s}
|
||||
.value=${String(n.current_tilt_position)}
|
||||
@change=${a=>this.call("cover","set_cover_tilt_position",{entity_id:n.nf_cover_control?i:t??i,tilt_position:Number(a.target.value)})}
|
||||
/></label>`:o&48?m`<div class="nf-rp-buttons">
|
||||
${o&16?m`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","open_cover_tilt",{entity_id:i})}>${this.t("cover_tilt_open")}</button>`:f}
|
||||
${o&32?m`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","close_cover_tilt",{entity_id:i})}>${this.t("cover_tilt_close")}</button>`:f}
|
||||
/></label>`:o&48?p`<div class="nf-rp-buttons">
|
||||
${o&16?p`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","open_cover_tilt",{entity_id:i})}>${this.t("cover_tilt_open")}</button>`:f}
|
||||
${o&32?p`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","close_cover_tilt",{entity_id:i})}>${this.t("cover_tilt_close")}</button>`:f}
|
||||
</div>`:f}
|
||||
</div>`}climateRow(e){let t=e.attributes,n=e.entity_id,o=typeof t.temperature=="number"?t.temperature:null,i=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/i)*i))});return m`<div class="nf-rp-row">
|
||||
</div>`}climateRow(e){let t=e.attributes,n=e.entity_id,o=typeof t.temperature=="number"?t.temperature:null,i=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/i)*i))});return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon ${t.hvac_action==="heating"?"nf-rp-on":""}">${zt("climate")}</span>
|
||||
${this.nameButton(n)}
|
||||
<span class="nf-rp-state">${this.stateOf(e)}</span>
|
||||
${o!==null?m`<div class="nf-rp-stepper nf-rp-wide">
|
||||
${o!==null?p`<div class="nf-rp-stepper nf-rp-wide">
|
||||
<button class="nf-btn" aria-label=${this.t("temp_down")} @click=${()=>c(o-i)}>−</button>
|
||||
<span><small>${this.t("target_temp")}</small> ${W(this.hass,o,1)} ${X(this.hass)}</span>
|
||||
<button class="nf-btn" aria-label=${this.t("temp_up")} @click=${()=>c(o+i)}>+</button>
|
||||
</div>`:f}
|
||||
${l.length>1?m`<div class="nf-rp-chips">
|
||||
${l.map(u=>m`<button
|
||||
${l.length>1?p`<div class="nf-rp-chips">
|
||||
${l.map(u=>p`<button
|
||||
class="nf-chip"
|
||||
aria-pressed=${e.state===u}
|
||||
@click=${()=>this.call("climate","set_hvac_mode",{entity_id:n,hvac_mode:u})}
|
||||
@@ -392,11 +392,11 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
${this.stateLabel(u)}
|
||||
</button>`)}
|
||||
</div>`:f}
|
||||
</div>`}stateOf(e,t=te(this.hass,e)){if(this.room?.no_state?.includes(e.entity_id))return"";let n=F(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,o=I(e)||e.state==="off",i=[t.media_title,t.media_artist].filter(s=>typeof s=="string"&&s).join(" \xB7 ");return m`<div class="nf-rp-row">
|
||||
</div>`}stateOf(e,t=te(this.hass,e)){if(this.room?.no_state?.includes(e.entity_id))return"";let n=F(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,o=I(e)||e.state==="off",i=[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":""}">${zt("media")}</span>
|
||||
${this.nameButton(n)}
|
||||
<span class="nf-rp-state">${this.stateOf(e,this.stateLabel(e.state))}</span>
|
||||
${i?m`<p class="nf-rp-media nf-rp-wide">${i}</p>`:f}
|
||||
${i?p`<p class="nf-rp-media nf-rp-wide">${i}</p>`:f}
|
||||
<div class="nf-rp-buttons nf-rp-wide">
|
||||
<button class="nf-btn nf-rp-small" aria-label=${this.t("previous")} ?disabled=${o} @click=${()=>this.call("media_player","media_previous_track",{entity_id:n})}>
|
||||
${Co(br.previous)}
|
||||
@@ -408,7 +408,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
${Co(br.next)}
|
||||
</button>
|
||||
</div>
|
||||
${typeof t.volume_level=="number"?m`<label class="nf-rp-slider"
|
||||
${typeof t.volume_level=="number"?p`<label class="nf-rp-slider"
|
||||
><span>${this.t("volume")}</span>
|
||||
<input
|
||||
type="range"
|
||||
@@ -417,12 +417,12 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
.value=${String(Math.round(t.volume_level*100))}
|
||||
@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=F(t),o=t.slice(0,t.indexOf(".")),i=n==="lock"?e.state==="unlocked"||e.state==="open":J(e),s=()=>n==="lock"?this.call("lock",i?"lock":"unlock",{entity_id:t}):this.call(o,"toggle",{entity_id:t});return m`<div class="nf-rp-row">
|
||||
</div>`}switchRow(e){let t=e.entity_id,n=F(t),o=t.slice(0,t.indexOf(".")),i=n==="lock"?e.state==="unlocked"||e.state==="open":J(e),s=()=>n==="lock"?this.call("lock",i?"lock":"unlock",{entity_id:t}):this.call(o,"toggle",{entity_id:t});return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon ${i?"nf-rp-on":""}">${zt(n)}</span>
|
||||
${this.nameButton(t)}
|
||||
<span class="nf-rp-state">${this.stateOf(e)}</span>
|
||||
${this.toggle(e,i,s)}
|
||||
</div>`}sensorRow(e){let t=F(e.entity_id),n=t==="binary"&&e.state==="on";return m`<div class="nf-rp-row">
|
||||
</div>`}sensorRow(e){let t=F(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":""}">${zt(t)}</span>
|
||||
${this.nameButton(e.entity_id)}
|
||||
<span class="nf-rp-state">${this.stateOf(e)}</span>
|
||||
@@ -807,54 +807,54 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
outline: 2px solid var(--nf-accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
`]};customElements.get("nf-room-panel")||customElements.define("nf-room-panel",No);function dl(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 Gh=[[/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]]],hl=[34,211,238];function Wo(r){return r?Gh.find(([e])=>e.test(r))?.[1]??hl:hl}function Oo(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"&&Oo(r);function pl(r,e){let t=[],n=new Set;for(let o of e){if(!o.entity.startsWith("media_player.")||n.has(o.entity))continue;n.add(o.entity);let i=r.states[o.entity];if(!i)continue;let s=i.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:o.entity,name:o.name,at:o.at,playing:Lo(i),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:Wo(l),app:l,group:Array.isArray(s.group_members)?s.group_members.filter(u=>typeof u=="string"&&u!==o.entity):[],rings:o.rings??1})}return t}function ml(r){let e=new Map(r.filter(o=>o.playing).map(o=>[o.entity,o])),t=[],n=new Set;for(let o of e.values())for(let i of o.group){let s=e.get(i),a=[o.entity,i].sort().join("|");s&&!n.has(a)&&(n.add(a),t.push([o,s]))}return t}var Uh=3;function fl(r,e,t){let n=[];for(let o of e.floors)for(let i of o.furniture){if(!i.type.endsWith(":sprinkler"))continue;let s=t?.get(i.id)?.entity??null;!s||!J(r.states[s])||n.push({id:i.id,at:{floorId:o.id,x:i.x,y:ce(o,i)+i.h,z:i.z},reach:Math.min(15,Math.max(.5,i.spray??Uh))})}return n}var vr=r=>r&&r!=="none"?r:null,gl=r=>Math.min(1,Math.max(0,r));function _l(r,e){let t=new Map;for(let n of e.settings.roof?.windows??[]){let o=ze(r,{cover:vr(n.cover),contact:vr(n.contact),tilt:vr(n.tilt)},"window"),i=vr(n.window),s=i?r.states[i]:void 0,a=o.open;if(s&&!I(s)){let l=s.attributes.current_position;a=typeof l=="number"?gl(l/100):s.state==="open"||s.state==="opening"?1:0}t.set(n.id,{open:a,tilt:o.tilt,cover:o.cover??0})}return t}function jh(r,e){let t=o=>Math.hypot(o.x-e.x,o.z-e.z);return r.placements.filter(o=>o.entity_id.startsWith("media_player.")&&t(o)<Math.max(2,e.w)).sort((o,i)=>t(o)-t(i))[0]?.entity_id??null}var je=(r,e)=>typeof r[e]=="string"?r[e]:"";function bl(r,e,t){let n=[];for(let o of e.floors)for(let i of o.furniture){if(!Qn(i.type))continue;let s=t?.get(i.id)?.entity??null,a=s?.startsWith("media_player.")?s:jh(o,i),l=a?r.states[a]:void 0;if(!l||!Oo(l))continue;let c=l.attributes,u=je(c,"app_name")||je(c,"source")||null;n.push({id:i.id,furnitureId:i.id,floorId:o.id,color:Wo(u),title:je(c,"media_title")||je(c,"media_channel")||u||"",subtitle:je(c,"media_artist")||je(c,"media_series_title")||je(c,"media_album_name"),app:u,picture:je(c,"entity_picture")||null,playing:Lo(l),ambilight:i.ambilight??1})}return n}function vl(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 wl(r,e){return(r===null?0:gl((r+4)/16))*(1-.45*e)}function qe(r,e){return e&&r.states[e]?e:Object.keys(r.states).filter(t=>t.startsWith("weather.")).sort()[0]??null}var wr=new Set(["contact_lost","unlocked_night","own"]);function qh(r,e){let t=r.states[e.entity];if(!t||["unavailable","unknown"].includes(t.state))return!1;let n=(e.state??"on").trim(),o=/^([<>])\s*(-?\d+(?:[.,]\d+)?)$/.exec(n);if(o){let i=Number(t.state),s=Number(o[2].replace(",","."));return Number.isFinite(i)&&(o[1]==="<"?i<s:i>s)}return n.split(",").map(i=>i.trim().toLowerCase()).filter(Boolean).includes(String(t.state).toLowerCase())}var Zh=600*1e3,Yh=new Set(["rainy","pouring","lightning-rainy","hail","snowy-rainy"]),Jh=new Map([["smoke","smoke"],["gas","gas"],["carbon_monoxide","co"],["moisture","water"]]),yl=(r,e)=>{if(e.startsWith("binary_sensor."))return Jh.get(String(r.states[e]?.attributes.device_class))};function Qh(r,e){let t=new Set,n=[];for(let o of r.floors)for(let i of o.openings){let s=e.get(i.id);for(let a of s?[s.contact,s.contact2,s.tilt,s.tilt2]:[])!a||t.has(a)||(t.add(a),n.push({floorId:o.id,roomId:i.room_id,entity:a}))}return n}function xl(r,e,t,n){let o=[];for(let a of e.floors)for(let l of a.rooms){let c=K(r,l).filter(u=>yl(r,u));
Line truncated
|
||||
`]};customElements.get("nf-room-panel")||customElements.define("nf-room-panel",No);function dl(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 Gh=[[/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]]],hl=[34,211,238];function Wo(r){return r?Gh.find(([e])=>e.test(r))?.[1]??hl:hl}function Oo(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"&&Oo(r);function ml(r,e){let t=[],n=new Set;for(let o of e){if(!o.entity.startsWith("media_player.")||n.has(o.entity))continue;n.add(o.entity);let i=r.states[o.entity];if(!i)continue;let s=i.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:o.entity,name:o.name,at:o.at,playing:Lo(i),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:Wo(l),app:l,group:Array.isArray(s.group_members)?s.group_members.filter(u=>typeof u=="string"&&u!==o.entity):[],rings:o.rings??1})}return t}function pl(r){let e=new Map(r.filter(o=>o.playing).map(o=>[o.entity,o])),t=[],n=new Set;for(let o of e.values())for(let i of o.group){let s=e.get(i),a=[o.entity,i].sort().join("|");s&&!n.has(a)&&(n.add(a),t.push([o,s]))}return t}var Uh=3;function fl(r,e,t){let n=[];for(let o of e.floors)for(let i of o.furniture){if(!i.type.endsWith(":sprinkler"))continue;let s=t?.get(i.id)?.entity??null;!s||!J(r.states[s])||n.push({id:i.id,at:{floorId:o.id,x:i.x,y:ce(o,i)+i.h,z:i.z},reach:Math.min(15,Math.max(.5,i.spray??Uh))})}return n}var vr=r=>r&&r!=="none"?r:null,gl=r=>Math.min(1,Math.max(0,r));function _l(r,e){let t=new Map;for(let n of e.settings.roof?.windows??[]){let o=ze(r,{cover:vr(n.cover),contact:vr(n.contact),tilt:vr(n.tilt)},"window"),i=vr(n.window),s=i?r.states[i]:void 0,a=o.open;if(s&&!I(s)){let l=s.attributes.current_position;a=typeof l=="number"?gl(l/100):s.state==="open"||s.state==="opening"?1:0}t.set(n.id,{open:a,tilt:o.tilt,cover:o.cover??0})}return t}function jh(r,e){let t=o=>Math.hypot(o.x-e.x,o.z-e.z);return r.placements.filter(o=>o.entity_id.startsWith("media_player.")&&t(o)<Math.max(2,e.w)).sort((o,i)=>t(o)-t(i))[0]?.entity_id??null}var je=(r,e)=>typeof r[e]=="string"?r[e]:"";function bl(r,e,t){let n=[];for(let o of e.floors)for(let i of o.furniture){if(!Qn(i.type))continue;let s=t?.get(i.id)?.entity??null,a=s?.startsWith("media_player.")?s:jh(o,i),l=a?r.states[a]:void 0;if(!l||!Oo(l))continue;let c=l.attributes,u=je(c,"app_name")||je(c,"source")||null;n.push({id:i.id,furnitureId:i.id,floorId:o.id,color:Wo(u),title:je(c,"media_title")||je(c,"media_channel")||u||"",subtitle:je(c,"media_artist")||je(c,"media_series_title")||je(c,"media_album_name"),app:u,picture:je(c,"entity_picture")||null,playing:Lo(l),ambilight:i.ambilight??1})}return n}function vl(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 wl(r,e){return(r===null?0:gl((r+4)/16))*(1-.45*e)}function qe(r,e){return e&&r.states[e]?e:Object.keys(r.states).filter(t=>t.startsWith("weather.")).sort()[0]??null}var wr=new Set(["contact_lost","unlocked_night","own"]);function qh(r,e){let t=r.states[e.entity];if(!t||["unavailable","unknown"].includes(t.state))return!1;let n=(e.state??"on").trim(),o=/^([<>])\s*(-?\d+(?:[.,]\d+)?)$/.exec(n);if(o){let i=Number(t.state),s=Number(o[2].replace(",","."));return Number.isFinite(i)&&(o[1]==="<"?i<s:i>s)}return n.split(",").map(i=>i.trim().toLowerCase()).filter(Boolean).includes(String(t.state).toLowerCase())}var Zh=600*1e3,Yh=new Set(["rainy","pouring","lightning-rainy","hail","snowy-rainy"]),Jh=new Map([["smoke","smoke"],["gas","gas"],["carbon_monoxide","co"],["moisture","water"]]),yl=(r,e)=>{if(e.startsWith("binary_sensor."))return Jh.get(String(r.states[e]?.attributes.device_class))};function Qh(r,e){let t=new Set,n=[];for(let o of r.floors)for(let i of o.openings){let s=e.get(i.id);for(let a of s?[s.contact,s.contact2,s.tilt,s.tilt2]:[])!a||t.has(a)||(t.add(a),n.push({floorId:o.id,roomId:i.room_id,entity:a}))}return n}function xl(r,e,t,n){let o=[];for(let a of e.floors)for(let l of a.rooms){let c=K(r,l).filter(u=>yl(r,u));
Line truncated
|
||||
${Q`<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 lm(r,e,t,n){let o=e.summary,i=c=>A(r,c),s=e.autarky,a=n?m`<button class="live-fold" title=${i(n.folded?"live_unfold":"live_fold")} aria-label=${i(n.folded?"live_unfold":"live_fold")} aria-expanded=${!n.folded} @click=${n.toggle}>${n.folded?"+":"\u2212"}</button>`:f;if(n?.folded){let c=o.solar!==null?`\u2600 ${Me(r,o.solar)}`:o.consumption!==null?`\u2302 ${Me(r,o.consumption)}`:null;return m`<div class="live-card live-card-house live-folded" data-i=${t}>
|
||||
${s!==null?m`<div class="live-own">${vn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)}%</b></div></div>`:f}
|
||||
${c?m`<b>${c}</b>`:s===null?m`<b>⌂</b>`:f}
|
||||
</svg>`}function lp(r,e,t,n){let o=e.summary,i=c=>M(r,c),s=e.autarky,a=n?p`<button class="live-fold" title=${i(n.folded?"live_unfold":"live_fold")} aria-label=${i(n.folded?"live_unfold":"live_fold")} aria-expanded=${!n.folded} @click=${n.toggle}>${n.folded?"+":"\u2212"}</button>`:f;if(n?.folded){let c=o.solar!==null?`\u2600 ${Me(r,o.solar)}`:o.consumption!==null?`\u2302 ${Me(r,o.consumption)}`:null;return p`<div class="live-card live-card-house live-folded" data-i=${t}>
|
||||
${s!==null?p`<div class="live-own">${vn(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(o.solar!==null&&l.push(m`<div class="live-row live-solar"><span>☀ ${i("energy_solar")}</span><b>${Me(r,o.solar)}</b></div>`),o.consumption!==null&&l.push(m`<div class="live-row live-house"><span>⌂ ${i("energy_consumption")}</span><b>${Me(r,o.consumption)}</b></div>`),o.rest!==void 0&&o.rest!==null&&l.push(m`<div class="live-row live-house"><span>⌂ ${i("energy_rest")}</span><b>${Me(r,o.rest)}</b></div>`),o.battery!==null||o.soc!==null){let c=o.battery===null||Math.abs(o.battery)<15?"":o.battery>0?" \u2193":" \u2191";l.push(m`<div class="live-row live-battery"><span>▮ ${i("energy_battery")}${c}</span><b>${o.soc!==null?`${Math.round(o.soc)} %`:""}${o.battery!==null&&Math.abs(o.battery)>=15?` \xB7 ${Me(r,o.battery)}`:""}</b></div>`)}if(o.grid!==null){let c=o.grid<-15;l.push(m`<div class="live-row ${c?"live-export":"live-import"}"><span>⇄ ${i(c?"energy_grid_export":"energy_grid_import")}</span><b>${Me(r,o.grid)}</b></div>`)}for(let c of e.meters??[])l.push(m`<div class="live-row live-meter"><span>${c.icon} ${c.label}</span><b>${c.value}</b></div>`);return m`<div class="live-card live-card-house" data-i=${t}>
|
||||
</div>`}let l=[];if(o.solar!==null&&l.push(p`<div class="live-row live-solar"><span>☀ ${i("energy_solar")}</span><b>${Me(r,o.solar)}</b></div>`),o.consumption!==null&&l.push(p`<div class="live-row live-house"><span>⌂ ${i("energy_consumption")}</span><b>${Me(r,o.consumption)}</b></div>`),o.rest!==void 0&&o.rest!==null&&l.push(p`<div class="live-row live-house"><span>⌂ ${i("energy_rest")}</span><b>${Me(r,o.rest)}</b></div>`),o.battery!==null||o.soc!==null){let c=o.battery===null||Math.abs(o.battery)<15?"":o.battery>0?" \u2193":" \u2191";l.push(p`<div class="live-row live-battery"><span>▮ ${i("energy_battery")}${c}</span><b>${o.soc!==null?`${Math.round(o.soc)} %`:""}${o.battery!==null&&Math.abs(o.battery)>=15?` \xB7 ${Me(r,o.battery)}`:""}</b></div>`)}if(o.grid!==null){let c=o.grid<-15;l.push(p`<div class="live-row ${c?"live-export":"live-import"}"><span>⇄ ${i(c?"energy_grid_export":"energy_grid_import")}</span><b>${Me(r,o.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?m`<div class="live-own">${vn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)} %</b><span>${i("live_autarky")}</span></div></div>`:f}
|
||||
${s!==null?p`<div class="live-own">${vn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)} %</b><span>${i("live_autarky")}</span></div></div>`:f}
|
||||
<div class="live-rows">${l}</div>
|
||||
${um(r,e.curves)} ${cm(r,e.week)}
|
||||
</div>`}function cm(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,[o,i]=[150,30],s=o/7,a=(c,u,h)=>c===null||c<=0?f:Q`<rect x=${u.toFixed(1)} y=${(i-c/n*i).toFixed(1)} width=${(s*.36).toFixed(1)} height=${(c/n*i).toFixed(1)} class=${h}></rect>`,l=c=>c.reduce((u,h)=>u+(h??0),0);return m`<div class="live-day live-week" title=${A(r,"live_week_hint",{solar:W(r,l(e.solar),0),use:W(r,l(e.use),0)})}>
|
||||
${up(r,e.curves)} ${cp(r,e.week)}
|
||||
</div>`}function cp(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,[o,i]=[150,30],s=o/7,a=(c,u,h)=>c===null||c<=0?f:Q`<rect x=${u.toFixed(1)} y=${(i-c/n*i).toFixed(1)} width=${(s*.36).toFixed(1)} height=${(c/n*i).toFixed(1)} class=${h}></rect>`,l=c=>c.reduce((u,h)=>u+(h??0),0);return p`<div class="live-day live-week" title=${M(r,"live_week_hint",{solar:W(r,l(e.solar),0),use:W(r,l(e.use),0)})}>
|
||||
<svg viewBox=${`0 0 ${o} ${i}`} preserveAspectRatio="none" aria-hidden="true">
|
||||
${e.days.map((c,u)=>Q`${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 ${A(r,"live_days")}</span>
|
||||
</div>`}function um(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,[o,i]=[150,34],s=cn(e.solar,o,i,n),a=cn(e.use,o,i,n);return m`<div class="live-day" title=${A(r,"live_day_hint")}>
|
||||
<span>7 ${M(r,"live_days")}</span>
|
||||
</div>`}function up(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,[o,i]=[150,34],s=cn(e.solar,o,i,n),a=cn(e.use,o,i,n);return p`<div class="live-day" title=${M(r,"live_day_hint")}>
|
||||
<svg viewBox=${`0 0 ${o} ${i}`} preserveAspectRatio="none" aria-hidden="true">
|
||||
${s?Q`<path d=${`${s}L${o},${i}L0,${i}Z`} class="live-day-solar"></path>`:f}
|
||||
${a?Q`<path d=${a} class="live-day-use"></path>`:f}
|
||||
</svg>
|
||||
<span>24 h</span>
|
||||
</div>`}function dm(r,e,t,n){let o=e.car,i=(u,h)=>A(r,u,h),s=gc(o.soc),a=o.home?o.charging?`\u26A1 ${i("live_car_charging")}${o.chargingW?` \xB7 ${Me(r,o.chargingW)}`:""}`:o.plugged?`\u{1F50C} ${i("live_car_plugged")}`:"":`${i("live_car_away")}${o.where?` \xB7 ${o.where}`:""}${o.distance!==null?` \xB7 ${W(r,o.distance,o.distance<10?1:0)} km`:""}`,l=o.entities,c=(u,h,p,d)=>m`<button class="live-btn ${u?"live-on":""}" title=${h} aria-label=${h} aria-pressed=${u??!1} @click=${_=>(_.stopPropagation(),d())}>${p}</button>`;return m`<div class="live-card live-card-car ${o.charging?"live-charging":""} ${o.home?"":"live-away"}" data-i=${t} style=${`--live-soc:${s}`}>
|
||||
</div>`}function dp(r,e,t,n){let o=e.car,i=(u,h)=>M(r,u,h),s=gc(o.soc),a=o.home?o.charging?`\u26A1 ${i("live_car_charging")}${o.chargingW?` \xB7 ${Me(r,o.chargingW)}`:""}`:o.plugged?`\u{1F50C} ${i("live_car_plugged")}`:"":`${i("live_car_away")}${o.where?` \xB7 ${o.where}`:""}${o.distance!==null?` \xB7 ${W(r,o.distance,o.distance<10?1:0)} km`:""}`,l=o.entities,c=(u,h,m,d)=>p`<button class="live-btn ${u?"live-on":""}" title=${h} aria-label=${h} aria-pressed=${u??!1} @click=${_=>(_.stopPropagation(),d())}>${m}</button>`;return p`<div class="live-card live-card-car ${o.charging?"live-charging":""} ${o.home?"":"live-away"}" data-i=${t} style=${`--live-soc:${s}`}>
|
||||
<div class="live-own">
|
||||
${vn((o.soc??0)/100,s)}
|
||||
<div class="live-own-text"><b>${o.soc!==null?`${Math.round(o.soc)} %`:"\u2013"}</b><span>${o.range!==null?`${Math.round(o.range)} ${o.rangeUnit}`:""}</span></div>
|
||||
</div>
|
||||
<div class="live-rows">
|
||||
<div class="live-title">${e.name}</div>
|
||||
${a?m`<div class="live-status">${a}</div>`:f}
|
||||
${o.inside!==null?m`<div class="live-status">🌡 ${W(r,o.inside,1)} °C</div>`:f}
|
||||
${o.departure?m`<div class="live-status">⏰ ${i("live_car_departure",{time:o.departure})}</div>`:f}
|
||||
${o.open.length?m`<div class="live-status live-warn">⚠ ${i("live_car_open",{parts:o.open.join(", ")})}</div>`:f}
|
||||
${a?p`<div class="live-status">${a}</div>`:f}
|
||||
${o.inside!==null?p`<div class="live-status">🌡 ${W(r,o.inside,1)} °C</div>`:f}
|
||||
${o.departure?p`<div class="live-status">⏰ ${i("live_car_departure",{time:o.departure})}</div>`:f}
|
||||
${o.open.length?p`<div class="live-status live-warn">⚠ ${i("live_car_open",{parts:o.open.join(", ")})}</div>`:f}
|
||||
<div class="live-actions">
|
||||
${l.lock?c(o.locked,i(o.locked?"live_car_unlock":"live_car_lock"),o.locked?"\u{1F512}":"\u{1F513}",()=>{o.locked&&!confirm(i("live_car_unlock_confirm",{name:e.name}))||n("lock",o.locked?"unlock":"lock",l.lock)}):f}
|
||||
${l.climate?c(o.climateOn,i("live_car_climate"),"\u2744",()=>n(l.climate.split(".")[0],o.climateOn?"turn_off":"turn_on",l.climate)):f}
|
||||
${l.charge&&o.home?c(o.charging,i("live_car_charge"),"\u26A1",()=>n(l.charge.split(".")[0],"toggle",l.charge)):f}
|
||||
</div>
|
||||
</div>
|
||||
</div>`}function hm(r,e,t,n){let o=e.media,i=l=>A(r,l),s=`rgb(${o.color.join(",")})`,a=(l,c,u)=>m`<button class="live-btn" title=${l} aria-label=${l} @click=${h=>(h.stopPropagation(),n("media_player",u,o.entity))}>${c}</button>`;return m`<div class="live-card live-card-media" data-i=${t} style=${`--live-soc:${s}`} @click=${l=>l.currentTarget.classList.toggle("live-open")}>
|
||||
${o.picture?m`<img class="live-cover" src=${o.picture} alt="" loading="lazy" />`:m`<div class="live-cover live-cover-none">♪</div>`}
|
||||
</div>`}function hp(r,e,t,n){let o=e.media,i=l=>M(r,l),s=`rgb(${o.color.join(",")})`,a=(l,c,u)=>p`<button class="live-btn" title=${l} aria-label=${l} @click=${h=>(h.stopPropagation(),n("media_player",u,o.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")}>
|
||||
${o.picture?p`<img class="live-cover" src=${o.picture} alt="" loading="lazy" />`:p`<div class="live-cover live-cover-none">♪</div>`}
|
||||
<div class="live-rows">
|
||||
<div class="live-title" title=${o.title}>${o.title||o.name}</div>
|
||||
<div class="live-status">${o.artist||o.app||o.name}</div>
|
||||
<div class="live-actions">
|
||||
${a(i("live_media_prev"),"\u23EE","media_previous_track")} ${a(i("live_media_playpause"),"\u23EF","media_play_pause")} ${a(i("live_media_next"),"\u23ED","media_next_track")}
|
||||
${o.volume!==null?m`<input
|
||||
${o.volume!==null?p`<input
|
||||
class="live-volume"
|
||||
type="range"
|
||||
min="0"
|
||||
@@ -866,20 +866,20 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
/>`:f}
|
||||
</div>
|
||||
</div>
|
||||
</div>`}function _c(r){let e=[...r.querySelectorAll(".live-card")].filter(i=>i.style.visibility!=="hidden"),t=[],n=e[0]?.parentElement?.clientWidth??0,o=e.map(i=>{let[s,a]=[Number(i.dataset.x),i.offsetWidth],l=n?n>a+16?Math.min(Math.max(s,a/2+8),n-a/2-8):n/2:s;return i.style.setProperty("--live-dx",`${Math.round(s-l)}px`),{el:i,x:l,y:Number(i.dataset.y),w:a,h:i.offsetHeight}}).sort((i,s)=>s.y-i.y);for(let i of o){let s=i.y;for(let l=0;l<12;l++){let c={x0:i.x-i.w/2,x1:i.x+i.w/2,y0:s-i.h,y1:s},u=t.find(h=>c.x0<h.x1+6&&c.x1>h.x0-6&&c.y0<h.y1+6&&c.y1>h.y0-6);if(!u)break;s=u.y0-8}t.push({x0:i.x-i.w/2,x1:i.x+i.w/2,y0:s-i.h,y1:s});let a=i.y-s;i.el.style.transform=`translate(${Math.round(i.x)}px, ${Math.round(s)}px) translate(-50%, -100%)`,i.el.style.setProperty("--live-thread",`${Math.round(18+a)}px`)}}function pm(r,e,t){let n=e.printer,o=(c,u)=>A(r,c,u),i=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?`${o("printer_nozzle")} ${Math.round(n.nozzle)}\xB0`:null,n.bed!==null?`${o("printer_bed")} ${Math.round(n.bed)}\xB0`:null].filter(Boolean).join(" \xB7 ");return m`<div class="live-card live-card-printer ${n.printing?"live-charging":""}" data-i=${t}>
|
||||
</div>`}function _c(r){let e=[...r.querySelectorAll(".live-card")].filter(i=>i.style.visibility!=="hidden"),t=[],n=e[0]?.parentElement?.clientWidth??0,o=e.map(i=>{let[s,a]=[Number(i.dataset.x),i.offsetWidth],l=n?n>a+16?Math.min(Math.max(s,a/2+8),n-a/2-8):n/2:s;return i.style.setProperty("--live-dx",`${Math.round(s-l)}px`),{el:i,x:l,y:Number(i.dataset.y),w:a,h:i.offsetHeight}}).sort((i,s)=>s.y-i.y);for(let i of o){let s=i.y;for(let l=0;l<12;l++){let c={x0:i.x-i.w/2,x1:i.x+i.w/2,y0:s-i.h,y1:s},u=t.find(h=>c.x0<h.x1+6&&c.x1>h.x0-6&&c.y0<h.y1+6&&c.y1>h.y0-6);if(!u)break;s=u.y0-8}t.push({x0:i.x-i.w/2,x1:i.x+i.w/2,y0:s-i.h,y1:s});let a=i.y-s;i.el.style.transform=`translate(${Math.round(i.x)}px, ${Math.round(s)}px) translate(-50%, -100%)`,i.el.style.setProperty("--live-thread",`${Math.round(18+a)}px`)}}function mp(r,e,t){let n=e.printer,o=(c,u)=>M(r,c,u),i=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?`${o("printer_nozzle")} ${Math.round(n.nozzle)}\xB0`:null,n.bed!==null?`${o("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?m`<img class="live-print-pic" src=${n.picture} alt="" />`:vn(i/100,n.printing?"#38bdf8":"#8aa0c8")}
|
||||
${n.picture?p`<img class="live-print-pic" src=${n.picture} alt="" />`:vn(i/100,n.printing?"#38bdf8":"#8aa0c8")}
|
||||
<div class="live-own-text"><b>${n.progress!==null?`${Math.round(i)} %`:"\u2013"}</b><span>${o(`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">
|
||||
<div class="live-title">${e.name}</div>
|
||||
${n.job?m`<div class="live-status">${n.job}</div>`:f}
|
||||
${n.printing&&(n.endsAt||a)?m`<div class="live-status">⏱ ${[a,n.endsAt?o("printer_done_at",{time:s(n.endsAt)}):null].filter(Boolean).join(" \xB7 ")}</div>`:f}
|
||||
${n.layer!==null?m`<div class="live-status">▤ ${o("printer_layer")} ${n.layer}${n.layers?` / ${n.layers}`:""}</div>`:f}
|
||||
${l?m`<div class="live-status">🌡 ${l}</div>`:f}
|
||||
${n.filaments.length?m`<div class="live-filaments">${n.filaments.map(c=>m`<i style=${`background:${c}`}></i>`)}</div>`:f}
|
||||
${n.job?p`<div class="live-status">${n.job}</div>`:f}
|
||||
${n.printing&&(n.endsAt||a)?p`<div class="live-status">⏱ ${[a,n.endsAt?o("printer_done_at",{time:s(n.endsAt)}):null].filter(Boolean).join(" \xB7 ")}</div>`:f}
|
||||
${n.layer!==null?p`<div class="live-status">▤ ${o("printer_layer")} ${n.layer}${n.layers?` / ${n.layers}`:""}</div>`:f}
|
||||
${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 mm(r,e,t){let n=e.pump,o=a=>A(r,a),i=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 m`<div class="live-card live-card-heatpump ${n.mode==="idle"?"":"live-charging"}" data-i=${t}>
|
||||
</div>`}function pp(r,e,t){let n=e.pump,o=a=>M(r,a),i=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">
|
||||
${vn(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>
|
||||
@@ -887,18 +887,18 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
<div class="live-rows">
|
||||
<div class="live-title">${e.name}</div>
|
||||
<div class="live-status">${s} ${o(`heatpump_${n.mode}`)}</div>
|
||||
${n.flow!==null||n.return!==null?m`<div class="live-row live-heat"><span>${o("heatpump_flow_return")}</span><b>${i(n.flow)} → ${i(n.return)}</b></div>`:f}
|
||||
${n.heat!==null?m`<div class="live-row live-heat"><span>${o("heatpump_heat")}</span><b>${Me(r,n.heat)}</b></div>`:f}
|
||||
${n.power!==null?m`<div class="live-row live-house"><span>${o("heatpump_power")}</span><b>${Me(r,n.power)}</b></div>`:f}
|
||||
${n.outside!==null?m`<div class="live-status">🌡 ${o("heatpump_outside")} ${i(n.outside)}</div>`:f}
|
||||
${n.flow!==null||n.return!==null?p`<div class="live-row live-heat"><span>${o("heatpump_flow_return")}</span><b>${i(n.flow)} → ${i(n.return)}</b></div>`:f}
|
||||
${n.heat!==null?p`<div class="live-row live-heat"><span>${o("heatpump_heat")}</span><b>${Me(r,n.heat)}</b></div>`:f}
|
||||
${n.power!==null?p`<div class="live-row live-house"><span>${o("heatpump_power")}</span><b>${Me(r,n.power)}</b></div>`:f}
|
||||
${n.outside!==null?p`<div class="live-status">🌡 ${o("heatpump_outside")} ${i(n.outside)}</div>`:f}
|
||||
</div>
|
||||
</div>`}function fm(r,e,t){let n=(o,i,s)=>o===null?"\u2013":`${W(r,o,i)} ${s}`;return m`<div class="live-card live-card-roomclimate" data-i=${t} data-room=${e.roomId} role="group" aria-label=${`${e.name||A(r,"room")} \xB7 ${A(r,"climate")}`}>
|
||||
${e.showTemperature?m`<div class="live-row live-climate-temperature"><span title=${A(r,"climate_temperature")} aria-label=${A(r,"climate_temperature")}>🌡</span><b>${n(e.temperature===null?null:r?oe(r,e.temperature):e.temperature,1,r?X(r):"\xB0C")}</b></div>`:f}
|
||||
${e.showHumidity?m`<div class="live-row live-climate-humidity"><span title=${A(r,"climate_humidity")} aria-label=${A(r,"climate_humidity")}>💧</span><b>${n(e.humidity,0,"%")}</b></div>`:f}
|
||||
${e.showCo2?m`<div class="live-row live-climate-co2"><span title=${A(r,"climate_co2")} aria-label=${A(r,"climate_co2")}>☁</span><b>${n(e.co2,0,"ppm")}</b></div>`:f}
|
||||
${e.showIlluminance?m`<div class="live-row live-climate-illuminance"><span title=${A(r,"climate_illuminance")} aria-label=${A(r,"climate_illuminance")}>☀</span><b>${n(e.illuminance,0,"lx")}</b></div>`:f}
|
||||
</div>`}function bc(r,e,t,n,o=!1){return e.length?m`<div class="live-cards">
|
||||
${e.map((i,s)=>i.kind==="roomclimate"?fm(r,i,s):o?f:i.kind==="house"?lm(r,i,s,n):i.kind==="car"?dm(r,i,s,t):i.kind==="printer"?pm(r,i,s):i.kind==="heatpump"?mm(r,i,s):hm(r,i,s,t))}
|
||||
</div>`}function fp(r,e,t){let n=(o,i,s)=>o===null?"\u2013":`${W(r,o,i)} ${s}`;return p`<div class="live-card live-card-roomclimate" data-i=${t} data-room=${e.roomId} role="group" aria-label=${`${e.name||M(r,"room")} \xB7 ${M(r,"climate")}`}>
|
||||
${e.showTemperature?p`<div class="live-row live-climate-temperature"><span title=${M(r,"climate_temperature")} aria-label=${M(r,"climate_temperature")}>🌡</span><b>${n(e.temperature===null?null:r?oe(r,e.temperature):e.temperature,1,r?X(r):"\xB0C")}</b></div>`:f}
|
||||
${e.showHumidity?p`<div class="live-row live-climate-humidity"><span title=${M(r,"climate_humidity")} aria-label=${M(r,"climate_humidity")}>💧</span><b>${n(e.humidity,0,"%")}</b></div>`:f}
|
||||
${e.showCo2?p`<div class="live-row live-climate-co2"><span title=${M(r,"climate_co2")} aria-label=${M(r,"climate_co2")}>☁</span><b>${n(e.co2,0,"ppm")}</b></div>`:f}
|
||||
${e.showIlluminance?p`<div class="live-row live-climate-illuminance"><span title=${M(r,"climate_illuminance")} aria-label=${M(r,"climate_illuminance")}>☀</span><b>${n(e.illuminance,0,"lx")}</b></div>`:f}
|
||||
</div>`}function bc(r,e,t,n,o=!1){return e.length?p`<div class="live-cards">
|
||||
${e.map((i,s)=>i.kind==="roomclimate"?fp(r,i,s):o?f:i.kind==="house"?lp(r,i,s,n):i.kind==="car"?dp(r,i,s,t):i.kind==="printer"?mp(r,i,s):i.kind==="heatpump"?pp(r,i,s):hp(r,i,s,t))}
|
||||
</div>`:f}var vc=ne`
|
||||
.live-cards {
|
||||
position: absolute;
|
||||
@@ -1219,14 +1219,14 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
`;function Dr(r){return r.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var si=r=>r.points.length>=3;function wc(r,e,t){return r.rooms.filter(si).find(n=>H([e,t],n.points))}function gm(r,e,t,n){let o=[];for(let a of e.rooms.filter(si)){let[l,c]=xe(a.points);o.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 i=new Set,s=(a,l,c,u)=>{if(i.has(a)||!(a in r.states))return;i.add(a);let h=wc(e,l,c),p=[h?.name,n?e.name:void 0].filter(d=>!!d).join(" \xB7 ");o.push({kind:"device",name:O(r,a),where:p,floorId:e.id,roomId:h?.id??null,entity:a,icon:F(a),x:l,z:c,y:u})};for(let a of e.placements){let l=a.y??yt(F(a.entity_id)??"sensor",me(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=me(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=wc(e,a.x,a.z),c=[l?.name,n?e.name:void 0].filter(u=>!!u).join(" \xB7 ");o.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 o}function yc(r,e){let t=it(r,e.floors),n=e.floors.length>1,o=e.floors.flatMap(i=>gm(r,i,t,n));for(let i of e.settings.circuits??[]){let s=e.floors.flatMap(h=>h.rooms.filter(p=>i.rooms.includes(p.id)&&si(p)).map(p=>({f:h,r:p})));if(!s.length)continue;let[{f:a,r:l}]=s,[c,u]=xe(l.points);o.push({kind:"circuit",name:`\u{1F50C} ${i.name}`,where:s.map(h=>h.r.name).join(", "),floorId:a.id,roomId:l.id,entity:null,icon:null,x:c,z:u,y:0})}return o}function _m(r,e){return(Dr(r.name).startsWith(e)?0:2)+(r.kind==="room"?0:1)}function xc(r,e,t=8){let n=Dr(e).split(/\s+/).filter(Boolean);if(n.length===0)return[];let o=Dr(e.trim());return r.filter(i=>{let s=Dr([i.name,i.where,i.entity].filter(Boolean).join(" "));return n.every(a=>s.includes(a))}).map(i=>({item:i,cost:_m(i,o)})).sort((i,s)=>i.cost-s.cost||i.item.name.localeCompare(s.item.name)).slice(0,t).map(i=>i.item)}var bm=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[190,90,255],[255,95,210],[255,70,70],[120,255,150]],vm=[2200,2700,3200,4e3,5e3,6500],wm=["hs","rgb","rgbw","rgbww","xy"],ym=4,kc=16,Sc=32,xm=128;function li(r){let e=r.attributes.supported_color_modes??[],t=e.some(n=>wm.includes(n));return{dim:e.some(n=>n!=="onoff"),color:t,temp:e.includes("color_temp")}}function ci(r){return((r.attributes.supported_features??0)&ym)!==0&&typeof r.attributes.current_position=="number"}var ai=class extends re{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 A(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(){fe(this,this.entity),this.close()}ring(e){let t=e.length;return e.map((n,o)=>{let i=o/t*Math.PI*2-Math.PI/2;return m`<div class="qm-at" style="left:${50+Math.cos(i)*39}%;top:${50+Math.sin(i)*39}%">${n}</div>`})}renderLight(e){let t=li(e),n=e.state==="on",o=n&&typeof e.attributes.brightness=="number"?Math.round(e.attributes.brightness/2.55):n?100:0,i=t.color?bm.map(s=>m`<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?vm.map(s=>m`<button class="qm-swatch" style="background:${km(s)}" aria-label=${`${s} K`} @click=${()=>this.call("light","turn_on",{color_temp_kelvin:s})}></button>`):[];return m`<div class="qm-ring ${i.length?"":"qm-ring-small"}">
|
||||
`;function Dr(r){return r.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var si=r=>r.points.length>=3;function wc(r,e,t){return r.rooms.filter(si).find(n=>H([e,t],n.points))}function gp(r,e,t,n){let o=[];for(let a of e.rooms.filter(si)){let[l,c]=xe(a.points);o.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 i=new Set,s=(a,l,c,u)=>{if(i.has(a)||!(a in r.states))return;i.add(a);let h=wc(e,l,c),m=[h?.name,n?e.name:void 0].filter(d=>!!d).join(" \xB7 ");o.push({kind:"device",name:O(r,a),where:m,floorId:e.id,roomId:h?.id??null,entity:a,icon:F(a),x:l,z:c,y:u})};for(let a of e.placements){let l=a.y??yt(F(a.entity_id)??"sensor",pe(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=pe(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=wc(e,a.x,a.z),c=[l?.name,n?e.name:void 0].filter(u=>!!u).join(" \xB7 ");o.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 o}function yc(r,e){let t=it(r,e.floors),n=e.floors.length>1,o=e.floors.flatMap(i=>gp(r,i,t,n));for(let i of e.settings.circuits??[]){let s=e.floors.flatMap(h=>h.rooms.filter(m=>i.rooms.includes(m.id)&&si(m)).map(m=>({f:h,r:m})));if(!s.length)continue;let[{f:a,r:l}]=s,[c,u]=xe(l.points);o.push({kind:"circuit",name:`\u{1F50C} ${i.name}`,where:s.map(h=>h.r.name).join(", "),floorId:a.id,roomId:l.id,entity:null,icon:null,x:c,z:u,y:0})}return o}function _p(r,e){return(Dr(r.name).startsWith(e)?0:2)+(r.kind==="room"?0:1)}function xc(r,e,t=8){let n=Dr(e).split(/\s+/).filter(Boolean);if(n.length===0)return[];let o=Dr(e.trim());return r.filter(i=>{let s=Dr([i.name,i.where,i.entity].filter(Boolean).join(" "));return n.every(a=>s.includes(a))}).map(i=>({item:i,cost:_p(i,o)})).sort((i,s)=>i.cost-s.cost||i.item.name.localeCompare(s.item.name)).slice(0,t).map(i=>i.item)}var bp=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[190,90,255],[255,95,210],[255,70,70],[120,255,150]],vp=[2200,2700,3200,4e3,5e3,6500],wp=["hs","rgb","rgbw","rgbww","xy"],yp=4,kc=16,Sc=32,xp=128;function li(r){let e=r.attributes.supported_color_modes??[],t=e.some(n=>wp.includes(n));return{dim:e.some(n=>n!=="onoff"),color:t,temp:e.includes("color_temp")}}function ci(r){return((r.attributes.supported_features??0)&yp)!==0&&typeof r.attributes.current_position=="number"}var ai=class extends re{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 M(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(){fe(this,this.entity),this.close()}ring(e){let t=e.length;return e.map((n,o)=>{let i=o/t*Math.PI*2-Math.PI/2;return p`<div class="qm-at" style="left:${50+Math.cos(i)*39}%;top:${50+Math.sin(i)*39}%">${n}</div>`})}renderLight(e){let t=li(e),n=e.state==="on",o=n&&typeof e.attributes.brightness=="number"?Math.round(e.attributes.brightness/2.55):n?100:0,i=t.color?bp.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?vp.map(s=>p`<button class="qm-swatch" style="background:${kp(s)}" aria-label=${`${s} K`} @click=${()=>this.call("light","turn_on",{color_temp_kelvin:s})}></button>`):[];return p`<div class="qm-ring ${i.length?"":"qm-ring-small"}">
|
||||
${this.ring(i)}
|
||||
<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>
|
||||
<b>${n?`${o} %`:this.t("qm_off")}</b>
|
||||
</button>
|
||||
</div>
|
||||
${t.dim?m`<input
|
||||
${t.dim?p`<input
|
||||
class="qm-slider"
|
||||
type="range"
|
||||
min="1"
|
||||
@@ -1234,7 +1234,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
.value=${String(Math.max(1,o))}
|
||||
aria-label=${this.t("brightness")}
|
||||
@change=${s=>this.call("light","turn_on",{brightness_pct:Number(s.target.value)})}
|
||||
/>`:f}`}renderCover(e){e=nr(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",o=ci(e),i=(u,h,p,d=!1)=>m`<button class="qm-swatch qm-slot ${d?"qm-slot-on":""}" aria-label=${h} @click=${p}>${u}</button>`,s=u=>t!==null&&Math.abs(t-u)<3,a=[i("\u25B2",this.t("cover_open"),()=>this.ask()&&this.call("cover","open_cover"),s(100)),...o?[75,50].map(u=>i(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],i("\u25BC",this.t("cover_close"),()=>this.ask()&&this.call("cover","close_cover"),s(0)),...o?[25].map(u=>i(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],...Number(e.attributes.supported_features??0)&8?[i("\u25A0",this.t("cover_stop"),()=>this.call("cover","stop_cover"),n)]:[],...this.myPosition!=null&&(o||Number(e.attributes.supported_features??0)&8)?[i("My",this.t("cover_my_go",{p:this.myPosition}),()=>this.ask()&&(o?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 m`<div class="qm-ring">
|
||||
/>`:f}`}renderCover(e){e=nr(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",o=ci(e),i=(u,h,m,d=!1)=>p`<button class="qm-swatch qm-slot ${d?"qm-slot-on":""}" aria-label=${h} @click=${m}>${u}</button>`,s=u=>t!==null&&Math.abs(t-u)<3,a=[i("\u25B2",this.t("cover_open"),()=>this.ask()&&this.call("cover","open_cover"),s(100)),...o?[75,50].map(u=>i(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],i("\u25BC",this.t("cover_close"),()=>this.ask()&&this.call("cover","close_cover"),s(0)),...o?[25].map(u=>i(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],...Number(e.attributes.supported_features??0)&8?[i("\u25A0",this.t("cover_stop"),()=>this.call("cover","stop_cover"),n)]:[],...this.myPosition!=null&&(o||Number(e.attributes.supported_features??0)&8)?[i("My",this.t("cover_my_go",{p:this.myPosition}),()=>this.ask()&&(o?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":""}"
|
||||
@@ -1247,7 +1247,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
<b>${t!==null?`${Math.round(t)} %`:te(this.hass,e)}</b>
|
||||
</button>
|
||||
</div>
|
||||
${o?m`<input
|
||||
${o?p`<input
|
||||
class="qm-slider"
|
||||
type="range"
|
||||
min="0"
|
||||
@@ -1256,7 +1256,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
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&xm&&n!==null?m`<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&xp&&n!==null?p`<label class="qm-tilt"
|
||||
><span>${this.t("cover_tilt")} · ${Math.round(n)} %</span>
|
||||
<input
|
||||
class="qm-slider"
|
||||
@@ -1266,10 +1266,10 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
.value=${String(n)}
|
||||
aria-label=${this.t("cover_tilt")}
|
||||
@change=${o=>this.call("cover","set_cover_tilt_position",{entity_id:e.attributes.nf_cover_control?this.entity:this.tiltEntity||this.entity,tilt_position:Number(o.target.value)})}
|
||||
/></label>`:t&(kc|Sc)?m`<div class="qm-tilt-buttons">
|
||||
${t&kc?m`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","open_cover_tilt")}>${this.t("cover_tilt_open")}</button>`:f}
|
||||
${t&Sc?m`<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 m`<div class="qm-ring qm-ring-small">
|
||||
/></label>`:t&(kc|Sc)?p`<div class="qm-tilt-buttons">
|
||||
${t&kc?p`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","open_cover_tilt")}>${this.t("cover_tilt_open")}</button>`:f}
|
||||
${t&Sc?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":""}"
|
||||
aria-pressed=${t}
|
||||
@@ -1278,19 +1278,19 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
<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>
|
||||
<b>${te(this.hass,e)}</b>
|
||||
</button>
|
||||
</div>`}renderMedia(e){let t=!["off","standby","unavailable","unknown"].includes(e.state),n=e.state==="playing",o=e.attributes,i=typeof o.volume_level=="number"?Math.round(o.volume_level*100):null,s=Array.isArray(o.source_list)?o.source_list.slice(0,24):[],a=[o.media_title,o.media_artist].filter(h=>typeof h=="string"&&h).join(" \xB7 "),l=h=>m`<svg viewBox="0 0 24 24" width="18" height="18" fill="currentColor"><path d=${h} /></svg>`,c=(h,p,d,_=!1)=>m`<button class="qm-swatch qm-slot ${_?"qm-slot-on":""}" aria-label=${p} title=${p} @click=${d}>${h}</button>`,u=t?[c(l(n?"M6 5h4v14H6zM14 5h4v14h-4z":"M8 5v14l11-7z"),this.t(n?"media_pause":"media_play"),()=>this.call("media_player","media_play_pause"),n),c(l("M6 6h2v12H6zm3.5 6 8.5 6V6z"),this.t("media_previous"),()=>this.call("media_player","media_previous_track")),c(l("M16 6h2v12h-2zM6 18l8.5-6L6 6z"),this.t("media_next"),()=>this.call("media_player","media_next_track"))]:[];return m`<div class="qm-ring ${u.length?"":"qm-ring-small"}">
|
||||
</div>`}renderMedia(e){let t=!["off","standby","unavailable","unknown"].includes(e.state),n=e.state==="playing",o=e.attributes,i=typeof o.volume_level=="number"?Math.round(o.volume_level*100):null,s=Array.isArray(o.source_list)?o.source_list.slice(0,24):[],a=[o.media_title,o.media_artist].filter(h=>typeof h=="string"&&h).join(" \xB7 "),l=h=>p`<svg viewBox="0 0 24 24" width="18" height="18" fill="currentColor"><path d=${h} /></svg>`,c=(h,m,d,_=!1)=>p`<button class="qm-swatch qm-slot ${_?"qm-slot-on":""}" aria-label=${m} title=${m} @click=${d}>${h}</button>`,u=t?[c(l(n?"M6 5h4v14H6zM14 5h4v14h-4z":"M8 5v14l11-7z"),this.t(n?"media_pause":"media_play"),()=>this.call("media_player","media_play_pause"),n),c(l("M6 6h2v12H6zm3.5 6 8.5 6V6z"),this.t("media_previous"),()=>this.call("media_player","media_previous_track")),c(l("M16 6h2v12h-2zM6 18l8.5-6L6 6z"),this.t("media_next"),()=>this.call("media_player","media_next_track"))]:[];return p`<div class="qm-ring ${u.length?"":"qm-ring-small"}">
|
||||
${this.ring(u)}
|
||||
<button class="qm-power ${t?"qm-on":""}" aria-pressed=${t} @click=${()=>this.ask()&&this.call("media_player",t?"turn_off":"turn_on")}>
|
||||
<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>
|
||||
<b>${i!==null&&t?`${i} %`:te(this.hass,e)}</b>
|
||||
</button>
|
||||
</div>
|
||||
${a?m`<div class="qm-media-title">${a}</div>`:f}
|
||||
${i!==null?m`<input class="qm-slider" type="range" min="0" max="100" .value=${String(i)} aria-label=${this.t("media_volume")} @change=${h=>this.call("media_player","volume_set",{volume_level:Number(h.target.value)/100})} />`:f}
|
||||
${s.length?m`<div class="qm-play-head">${this.t("media_sources")}</div>
|
||||
<div class="qm-play">${s.map(h=>m`<button class="qm-chip ${o.source===h?"qm-chip-on":""}" @click=${()=>this.call("media_player","select_source",{source:h})}>${h}</button>`)}</div>`:f}
|
||||
${this.presets?.length?m`<div class="qm-play-head">${this.t("presets")}</div>
|
||||
<div class="qm-play">${this.presets.map(h=>m`<button class="qm-chip" @click=${()=>this.call("media_player","play_media",{media_content_type:h.type,media_content_id:h.content})}>${h.label}</button>`)}</div>`:f}`}render(){let e=this.hass?.states[this.entity];if(!e)return f;let t=F(this.entity),n=I(e)&&!qt(e)?m`<p class="qm-note">${te(this.hass,e)}</p>`:t==="light"?this.renderLight(e):t==="cover"?this.renderCover(e):t==="media"?this.renderMedia(e):this.renderToggle(e);return m`<div class="qm" role="dialog" aria-label=${O(this.hass,this.entity)}>
|
||||
${a?p`<div class="qm-media-title">${a}</div>`:f}
|
||||
${i!==null?p`<input class="qm-slider" type="range" min="0" max="100" .value=${String(i)} aria-label=${this.t("media_volume")} @change=${h=>this.call("media_player","volume_set",{volume_level:Number(h.target.value)/100})} />`:f}
|
||||
${s.length?p`<div class="qm-play-head">${this.t("media_sources")}</div>
|
||||
<div class="qm-play">${s.map(h=>p`<button class="qm-chip ${o.source===h?"qm-chip-on":""}" @click=${()=>this.call("media_player","select_source",{source:h})}>${h}</button>`)}</div>`:f}
|
||||
${this.presets?.length?p`<div class="qm-play-head">${this.t("presets")}</div>
|
||||
<div class="qm-play">${this.presets.map(h=>p`<button class="qm-chip" @click=${()=>this.call("media_player","play_media",{media_content_type:h.type,media_content_id:h.content})}>${h.label}</button>`)}</div>`:f}`}render(){let e=this.hass?.states[this.entity];if(!e)return f;let t=F(this.entity),n=I(e)&&!qt(e)?p`<p class="qm-note">${te(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>
|
||||
@@ -1537,43 +1537,43 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
.qm-note {
|
||||
color: var(--nf-muted);
|
||||
}
|
||||
`]};function km(r){let e=Math.min(1,Math.max(0,(r-2200)/4300)),t=(n,o)=>Math.round(n+(o-n)*e);return`rgb(${t(255,200)},${t(170,225)},${t(80,255)})`}customElements.get("nf-quick-menu")||customElements.define("nf-quick-menu",ai);var Sm=new URL(import.meta.url),$m=new URL("./nextfloor-3d.js?v=74227cd20cc3",Sm).href,$c;function Mc(){return $c??=import($m),$c}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 Mm=new Set(["on","home","open","true","active","playing","heat","heating"]);function Fr(r,e){let t=e.show_when;if(!t?.entity||!r)return!0;let n=r.states[t.entity];if(!n||I(n))return!0;let o=String(n.state).toLowerCase(),i=(t.state??"").split(",").map(a=>a.trim().toLowerCase()).filter(Boolean),s=i.length?i.includes(o):Mm.has(o)||Number.isFinite(Number(o))&&Number(o)>0;return t.invert?!s:s}function ui(r,e){let t=[];for(let n of e.floors)for(let o of n.furniture)Fr(r,o)||t.push(o.id);return t.sort()}function Ec(r,e){if(!e.length)return r;let t=new Set(e);return{...r,floors:r.floors.map(n=>n.furniture.some(o=>t.has(o.id))?{...n,furniture:n.furniture.filter(o=>!t.has(o.id))}:n)}}var Rc="image:";function di(r,e,t){let n=(e??"").trim();if(!n)return null;if(n.startsWith(Rc))return t(n.slice(Rc.length));if(/^(https?:\/\/|\/)/.test(n))return n;if(/^[a-z_]+\.[a-z0-9_]+$/.test(n)){let o=r?.states[n]?.attributes.entity_picture;return typeof o=="string"&&o?o:null}return null}var wn=r=>Number(r);function xn(r){if(Array.isArray(r)){let[i,s]=[wn(r[0]),wn(r[1])];return Number.isFinite(i)&&Number.isFinite(s)?[i,s]:null}if(!r||typeof r!="object")return null;let{x:e,y:t}=r,[n,o]=[wn(e),wn(t)];return Number.isFinite(n)&&Number.isFinite(o)?[n,o]:null}function zc(r){return r?xn(r.charger)??xn(r.charger_position):null}function Tc(r){for(let[e,t]of Object.entries(r.states))if(e.startsWith("camera.")&&(xn(t.attributes?.vacuum_position)??zc(t.attributes)))return e;return null}var Am=r=>Array.isArray(r)?typeof r[0]=="number":!!r&&typeof r=="object",yn=(r,e)=>e?[r[0],-r[1]]:r;function Em(r){if(!r)return null;let e=r.mirror===!0,[t,n]=yn(r.ga,e),[o,i]=yn(r.gb,e),[s,a]=r.a,[l,c]=r.b,[u,h]=[o-t,i-n],[p,d]=[l-s,c-a],_=Math.hypot(u,h),b=Math.hypot(p,d);if(!(_>1e-6)||!(b>1e-6))return null;let g=b/_,v=Math.atan2(d,p)-Math.atan2(h,u),[S,k]=[Math.cos(v),Math.sin(v)];return y=>{let z=yn(y,e),[E,D]=[z[0]-t,z[1]-n];return[s+g*(E*S-D*k),a+g*(E*k+D*S)]}}function Rm(r){if(!r)return null;let e=r.mirror===!0,[t,n]=yn(r.ga,e),[o,i]=yn(r.gb,e),s=Math.atan2(r.b[1]-r.a[1],r.b[0]-r.a[0])-Math.atan2(i-n,o-t);return Number.isFinite(s)?s:null}function Dc(r,e,t){if(!e)return null;let n=r.states[e]?.attributes;if(!n)return null;let o=Em(t)??(_=>_),i=Rm(t)??0,s=t?.mirror===!0?-1:1,a=n.vacuum_position,l=xn(a),c=l?(()=>{let[_,b]=o(l),g=wn(a?.a)*s;if(!Number.isFinite(g))return{x:_,z:b,heading:0};let v=g*Math.PI/180+i;return{x:_,z:b,heading:Math.atan2(Math.cos(v),Math.sin(v))}})():null,u=zc(n),h=Array.isArray(n.path)?n.path:[],p=h.length>0&&Am(h[0])?[h]:h,d=[];for(let _ of p){let b=[];for(let g of Array.isArray(_)?_:[]){let v=xn(g);v&&b.push(o(v))}b.length>1&&d.push(b)}return!c&&!u&&!d.length?null:{pose:c,charger:u?o(u):null,path:d}}var Fc="nextfloor.lock3d",Pc=520,pi=class extends re{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},walkButto
Line truncated
|
||||
${e.map(t=>m`<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 o=this._travel,i=o&&!o.loading?Rt(this.hass,o.history,o.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==i.entities)&&(this.openingLinks=Re(i,n.floors),this.furnitureLinks=it(i,n.floors),this.linkedRegistry=i.entities,this.findIndex=null,this.alertSrc=this.alerts?xl(i,n,this.weatherEntityId,this.openingLinks):null,this.watched=zl({hass:i,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(w=>this.shownStates.get(w)!==i.states[w])))return;ui(i,n).join(",")!==this.shownFor?.key&&t.setBuilding(this.shownBuilding(i)),this.shownStates=new Map(this.watched.map(w=>[w,i.states[w]])),this.refreshToday(n),this.refreshForecast(n);let a=rn(i,n),l=ca(i,n.floors.some(w=>w.layer&&this.hiddenLayers.has(w.id))?this.shownBuilding(i):n);this.placementInfo=new Map(l.map(w=>[w.id,{floorId:w.floorId,roomId:w.roomId,x:w.x,z:w.z,y:w.y,rotation:w.rotation??0}]));let c=this.furnitureMarkers(i,n,new Set(l.map(w=>w.id)),new Set(a.map(w=>w.powerEntity)));a.push(...c.consumers);let u=on(i,n,a,Pe(n,w=>this.furnitureLinks?.get(w.id)?.power??null)),h=new Map(a.filter(w=>w.id!==w.powerEntity).map(w=>[w.id,w.power]));this.confirmSet=st(i,n.floors);let p=new Set(this.liveCardsOn?this._liveCards.flatMap(w=>w.kind==="media"?[w.media.entity]:w.kind==="car"?[w.spot]:[]):[]);for(let w of n.floors)for(let x of w.outdoor??[]){if(!x.area_id&&!x.temp_entity&&!x.pump_entity)continue;let B=x.temp_entity?i.states[x.temp_entity]:void 0,T=x.pump_entity?i.states[x.pump_entity]:void 0,[L,de]=xe(x.points),Ye=B&&Number.isFinite(Number(B.state))?`${W(i,oe(i,jn(Number(B.state),B.attributes.unit_of_measurement)),1)} ${X(i)}`:"",ht=!!T&&J(T);l.push({id:x.area_id?`outdoor:${x.id}`:x.pump_entity??x.temp_entity,floorId:w.id,roomId:null,x:L,z:de,y:Ln(w,x,L,de)+.7,icon:ke(x.type==="pool"?"pool":x.type==="terrace"?"table-chair":"tree-outline"),name:x.area_id&&i.areas?.[x.area_id]?.name||A(i,`out_${x.type}`),text:[Ye,ht?A(i,"pool_pump_on"):""].filter(Boolean).join(" \xB7 "),active:ht,unavailable:!1,glow:null,show:"always"})}let d=new Map;for(let w of n.floors){for(let x of w.placements)x.pin_offset&&d.set(`${w.id}:${x.entity_id}`,x.pin_offset);for(let x of w.furniture)x.pin_offset&&d.set(`f:${x.id}`,x.pin_offset)}let _=w=>{let x=w.lamp?void 0:(w.furnitureId?d.get(`f:${w.furnitureId}`):void 0)??d.get(`${w.floorId}:${w.id}`);return x?{...w,x:w.x+(x.x??0),z:w.z+(x.z??0),y:w.y+(x.y??0)}:w};t.setDevices([...[...l,...c.markers].map(_).map(w=>{let x=w.show==="no_power"||"energyDevice"in w&&w.energyDevice?null:h.get(w.id)??null,B={...w,power:x,powerText:x===null?void 0:ae(i,x),effect:this.dimmed?void 0:w.effect,text:this.subMeterText(i,n,u,w.furnitureId)??w.text},T=w.ownName&&(w.showName||this.markerNames)?w.ownName:"",L=p.has(w.id)||!!w.furnitureId&&p.has(w.furnitureId);return{...B,pin:this.showPin(B)&&!L,full:w.show==="always",caption:T}})]),t.setPickTargets(c.targets,this.openingTargets(),this.secondBlinds()),t.setScreens(c.screens),t.setFridgeDoors(Ks(i,n.floors)),t.setCovers(ta(i,n)),t.setRobots(this.robotInfos(i,n));let b=new Map;for(let w of n.floors)for(let x of w.furniture)!Z(x.type)?.pet||!x.room_sensor||x.room_sensor==="none"||b.set(x.id,vo(i,w.rooms.filter(B=>B.points.length>=3),null,x.room_sensor)?.id??null);b.size&&t.setPetRooms(b),t.setRoofWindows(_l(i,n)),t.setParked(Go(i,n)),t.setGateStates(Il(i,n));let g=new Map(n.floors.flatMap(w=>w.openings.map(x=>[x.id,x.type]))),v=new Map([...this.openingLinks].map(([w,x])=>[w,ze(i,x,g.get(w))]));t.setOpeningStates(v),this.setAlerts(this.alertSrc?Bo(i,n,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(i);let S=[...l,...c.markers].map(w=>`${w.id}:${w.glow?`${w.glow.level.toFixed(1)}/${w.glow.color.map(x=>x.toFixed(1)).join("/")}`:0}`).join(";")+"|"+[...v].map(([w,x])=>`${w}:${x.open}:${x.cover===null?"-":x.cover.toFixed(1)}`).join(";");if(S!==this.thumbSig){let w=this.thumbSig==="";this.thumbSig=S,w||this.scheduleThumbs(1500)}let k=Jl(i,n,a,n.energy.advanced?w=>this.furnitureLinks?.get(w.id)?.power??null:void 0),y=this.liveCars(i,n);for(let w of y){if(!w.car.home||!w.car.charging&&!w.car.plugged)continue;let x=n.floors.flatMap(L=>L.furniture.filter(de=>de.type==="wallbox").map(de=>({floorId:L.id,x:de.x,z:de.z,y:1}))).sort((L,de)=>Math.hypot(L.x-w.at.x,L.z-w.at.z)-Math.hypot(de.x-w.at.x,de.z-w.at.z))[0],B=x&&x.floorId===w.at.floorId&&Math.hypot(x.x-w.at.x,x.z-w.at.z)<9,T=x??gn(n);!T||!w.car.charging&&!B||k.arcs.push({key:`car:${w.spot}`,from:T,to:{...w.at,y:.8},power:w.car.charging?w.car.chargingW??7e3:0,color:[80,175,255],...B?{via:[{...T,y:.35},{floorId:w.at.floorId,x:(T.x+w.at.x)/2,z:(T.z+w.at.z)/2,y:.08},{...w.at,y:.5}],cable:!0}:{}})}let z=gn(n);for(let w of this.liveHeatPumps(n)){let x=w.pump.heat??(w.pump.mode==="heating"||w.pumLine truncated
|
||||
<button class="nf-thumbs-fold" title=${A(this.hass,n?"thumbs_show":"thumbs_fold")} aria-label=${A(this.hass,n?"thumbs_show":"thumbs_fold")} @click=${o}>${n?"\u25B8":"\u25C2"}</button>
|
||||
`]};function kp(r){let e=Math.min(1,Math.max(0,(r-2200)/4300)),t=(n,o)=>Math.round(n+(o-n)*e);return`rgb(${t(255,200)},${t(170,225)},${t(80,255)})`}customElements.get("nf-quick-menu")||customElements.define("nf-quick-menu",ai);var Sp=new URL(import.meta.url),$p=new URL("./nextfloor-3d.js?v=74227cd20cc3",Sp).href,$c;function Mc(){return $c??=import($p),$c}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 Mp=new Set(["on","home","open","true","active","playing","heat","heating"]);function Fr(r,e){let t=e.show_when;if(!t?.entity||!r)return!0;let n=r.states[t.entity];if(!n||I(n))return!0;let o=String(n.state).toLowerCase(),i=(t.state??"").split(",").map(a=>a.trim().toLowerCase()).filter(Boolean),s=i.length?i.includes(o):Mp.has(o)||Number.isFinite(Number(o))&&Number(o)>0;return t.invert?!s:s}function ui(r,e){let t=[];for(let n of e.floors)for(let o of n.furniture)Fr(r,o)||t.push(o.id);return t.sort()}function Ec(r,e){if(!e.length)return r;let t=new Set(e);return{...r,floors:r.floors.map(n=>n.furniture.some(o=>t.has(o.id))?{...n,furniture:n.furniture.filter(o=>!t.has(o.id))}:n)}}var Rc="image:";function di(r,e,t){let n=(e??"").trim();if(!n)return null;if(n.startsWith(Rc))return t(n.slice(Rc.length));if(/^(https?:\/\/|\/)/.test(n))return n;if(/^[a-z_]+\.[a-z0-9_]+$/.test(n)){let o=r?.states[n]?.attributes.entity_picture;return typeof o=="string"&&o?o:null}return null}var wn=r=>Number(r);function xn(r){if(Array.isArray(r)){let[i,s]=[wn(r[0]),wn(r[1])];return Number.isFinite(i)&&Number.isFinite(s)?[i,s]:null}if(!r||typeof r!="object")return null;let{x:e,y:t}=r,[n,o]=[wn(e),wn(t)];return Number.isFinite(n)&&Number.isFinite(o)?[n,o]:null}function zc(r){return r?xn(r.charger)??xn(r.charger_position):null}function Tc(r){for(let[e,t]of Object.entries(r.states))if(e.startsWith("camera.")&&(xn(t.attributes?.vacuum_position)??zc(t.attributes)))return e;return null}var Ap=r=>Array.isArray(r)?typeof r[0]=="number":!!r&&typeof r=="object",yn=(r,e)=>e?[r[0],-r[1]]:r;function Ep(r){if(!r)return null;let e=r.mirror===!0,[t,n]=yn(r.ga,e),[o,i]=yn(r.gb,e),[s,a]=r.a,[l,c]=r.b,[u,h]=[o-t,i-n],[m,d]=[l-s,c-a],_=Math.hypot(u,h),b=Math.hypot(m,d);if(!(_>1e-6)||!(b>1e-6))return null;let g=b/_,v=Math.atan2(d,m)-Math.atan2(h,u),[S,k]=[Math.cos(v),Math.sin(v)];return y=>{let z=yn(y,e),[E,D]=[z[0]-t,z[1]-n];return[s+g*(E*S-D*k),a+g*(E*k+D*S)]}}function Rp(r){if(!r)return null;let e=r.mirror===!0,[t,n]=yn(r.ga,e),[o,i]=yn(r.gb,e),s=Math.atan2(r.b[1]-r.a[1],r.b[0]-r.a[0])-Math.atan2(i-n,o-t);return Number.isFinite(s)?s:null}function Dc(r,e,t){if(!e)return null;let n=r.states[e]?.attributes;if(!n)return null;let o=Ep(t)??(_=>_),i=Rp(t)??0,s=t?.mirror===!0?-1:1,a=n.vacuum_position,l=xn(a),c=l?(()=>{let[_,b]=o(l),g=wn(a?.a)*s;if(!Number.isFinite(g))return{x:_,z:b,heading:0};let v=g*Math.PI/180+i;return{x:_,z:b,heading:Math.atan2(Math.cos(v),Math.sin(v))}})():null,u=zc(n),h=Array.isArray(n.path)?n.path:[],m=h.length>0&&Ap(h[0])?[h]:h,d=[];for(let _ of m){let b=[];for(let g of Array.isArray(_)?_:[]){let v=xn(g);v&&b.push(o(v))}b.length>1&&d.push(b)}return!c&&!u&&!d.length?null:{pose:c,charger:u?o(u):null,path:d}}var Fc="nextfloor.lock3d",Pc=520,mi=class extends re{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},walkButto
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 o=this._travel,i=o&&!o.loading?Rt(this.hass,o.history,o.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==i.entities)&&(this.openingLinks=Re(i,n.floors),this.furnitureLinks=it(i,n.floors),this.linkedRegistry=i.entities,this.findIndex=null,this.alertSrc=this.alerts?xl(i,n,this.weatherEntityId,this.openingLinks):null,this.watched=zl({hass:i,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(w=>this.shownStates.get(w)!==i.states[w])))return;ui(i,n).join(",")!==this.shownFor?.key&&t.setBuilding(this.shownBuilding(i)),this.shownStates=new Map(this.watched.map(w=>[w,i.states[w]])),this.refreshToday(n),this.refreshForecast(n);let a=rn(i,n),l=ca(i,n.floors.some(w=>w.layer&&this.hiddenLayers.has(w.id))?this.shownBuilding(i):n);this.placementInfo=new Map(l.map(w=>[w.id,{floorId:w.floorId,roomId:w.roomId,x:w.x,z:w.z,y:w.y,rotation:w.rotation??0}]));let c=this.furnitureMarkers(i,n,new Set(l.map(w=>w.id)),new Set(a.map(w=>w.powerEntity)));a.push(...c.consumers);let u=on(i,n,a,Pe(n,w=>this.furnitureLinks?.get(w.id)?.power??null)),h=new Map(a.filter(w=>w.id!==w.powerEntity).map(w=>[w.id,w.power]));this.confirmSet=st(i,n.floors);let m=new Set(this.liveCardsOn?this._liveCards.flatMap(w=>w.kind==="media"?[w.media.entity]:w.kind==="car"?[w.spot]:[]):[]);for(let w of n.floors)for(let x of w.outdoor??[]){if(!x.area_id&&!x.temp_entity&&!x.pump_entity)continue;let B=x.temp_entity?i.states[x.temp_entity]:void 0,T=x.pump_entity?i.states[x.pump_entity]:void 0,[L,de]=xe(x.points),Ye=B&&Number.isFinite(Number(B.state))?`${W(i,oe(i,jn(Number(B.state),B.attributes.unit_of_measurement)),1)} ${X(i)}`:"",ht=!!T&&J(T);l.push({id:x.area_id?`outdoor:${x.id}`:x.pump_entity??x.temp_entity,floorId:w.id,roomId:null,x:L,z:de,y:Ln(w,x,L,de)+.7,icon:ke(x.type==="pool"?"pool":x.type==="terrace"?"table-chair":"tree-outline"),name:x.area_id&&i.areas?.[x.area_id]?.name||M(i,`out_${x.type}`),text:[Ye,ht?M(i,"pool_pump_on"):""].filter(Boolean).join(" \xB7 "),active:ht,unavailable:!1,glow:null,show:"always"})}let d=new Map;for(let w of n.floors){for(let x of w.placements)x.pin_offset&&d.set(`${w.id}:${x.entity_id}`,x.pin_offset);for(let x of w.furniture)x.pin_offset&&d.set(`f:${x.id}`,x.pin_offset)}let _=w=>{let x=w.lamp?void 0:(w.furnitureId?d.get(`f:${w.furnitureId}`):void 0)??d.get(`${w.floorId}:${w.id}`);return x?{...w,x:w.x+(x.x??0),z:w.z+(x.z??0),y:w.y+(x.y??0)}:w};t.setDevices([...[...l,...c.markers].map(_).map(w=>{let x=w.show==="no_power"||"energyDevice"in w&&w.energyDevice?null:h.get(w.id)??null,B={...w,power:x,powerText:x===null?void 0:ae(i,x),effect:this.dimmed?void 0:w.effect,text:this.subMeterText(i,n,u,w.furnitureId)??w.text},T=w.ownName&&(w.showName||this.markerNames)?w.ownName:"",L=m.has(w.id)||!!w.furnitureId&&m.has(w.furnitureId);return{...B,pin:this.showPin(B)&&!L,full:w.show==="always",caption:T}})]),t.setPickTargets(c.targets,this.openingTargets(),this.secondBlinds()),t.setScreens(c.screens),t.setFridgeDoors(Ks(i,n.floors)),t.setCovers(ta(i,n)),t.setRobots(this.robotInfos(i,n));let b=new Map;for(let w of n.floors)for(let x of w.furniture)!Z(x.type)?.pet||!x.room_sensor||x.room_sensor==="none"||b.set(x.id,vo(i,w.rooms.filter(B=>B.points.length>=3),null,x.room_sensor)?.id??null);b.size&&t.setPetRooms(b),t.setRoofWindows(_l(i,n)),t.setParked(Go(i,n)),t.setGateStates(Il(i,n));let g=new Map(n.floors.flatMap(w=>w.openings.map(x=>[x.id,x.type]))),v=new Map([...this.openingLinks].map(([w,x])=>[w,ze(i,x,g.get(w))]));t.setOpeningStates(v),this.setAlerts(this.alertSrc?Bo(i,n,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(i);let S=[...l,...c.markers].map(w=>`${w.id}:${w.glow?`${w.glow.level.toFixed(1)}/${w.glow.color.map(x=>x.toFixed(1)).join("/")}`:0}`).join(";")+"|"+[...v].map(([w,x])=>`${w}:${x.open}:${x.cover===null?"-":x.cover.toFixed(1)}`).join(";");if(S!==this.thumbSig){let w=this.thumbSig==="";this.thumbSig=S,w||this.scheduleThumbs(1500)}let k=Jl(i,n,a,n.energy.advanced?w=>this.furnitureLinks?.get(w.id)?.power??null:void 0),y=this.liveCars(i,n);for(let w of y){if(!w.car.home||!w.car.charging&&!w.car.plugged)continue;let x=n.floors.flatMap(L=>L.furniture.filter(de=>de.type==="wallbox").map(de=>({floorId:L.id,x:de.x,z:de.z,y:1}))).sort((L,de)=>Math.hypot(L.x-w.at.x,L.z-w.at.z)-Math.hypot(de.x-w.at.x,de.z-w.at.z))[0],B=x&&x.floorId===w.at.floorId&&Math.hypot(x.x-w.at.x,x.z-w.at.z)<9,T=x??gn(n);!T||!w.car.charging&&!B||k.arcs.push({key:`car:${w.spot}`,from:T,to:{...w.at,y:.8},power:w.car.charging?w.car.chargingW??7e3:0,color:[80,175,255],...B?{via:[{...T,y:.35},{floorId:w.at.floorId,x:(T.x+w.at.x)/2,z:(T.z+w.at.z)/2,y:.08},{...w.at,y:.5}],cable:!0}:{}})}let z=gn(n);for(let w of this.liveHeatPumps(n)){let x=w.pump.heat??(w.pump.mode==="heating"||w.pumLine truncated
|
||||
<button class="nf-thumbs-fold" title=${M(this.hass,n?"thumbs_show":"thumbs_fold")} aria-label=${M(this.hass,n?"thumbs_show":"thumbs_fold")} @click=${o}>${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>
|
||||
<span>${A(this.hass,"all_floors")}</span>
|
||||
<span>${M(this.hass,"all_floors")}</span>
|
||||
</button>
|
||||
${t.map(i=>m`<button class="nf-thumb" aria-pressed=${this.floorId===i.floorId} @click=${()=>this.fire("floor-tap",{floorId:i.floorId})}>
|
||||
${n?f:m`<img src=${i.url} alt="" />`}
|
||||
${t.map(i=>p`<button class="nf-thumb" aria-pressed=${this.floorId===i.floorId} @click=${()=>this.fire("floor-tap",{floorId:i.floorId})}>
|
||||
${n?f:p`<img src=${i.url} alt="" />`}
|
||||
<span>${e.get(i.floorId)??""}</span>
|
||||
</button>`)}
|
||||
</nav>`}onDeviceHold(e,t,n){let o=F(e);o==="light"||o==="cover"||o==="switch"||o==="fan"||o==="lock"?this._menu={entity:e,x:t,y:n}:fe(this,e)}onDeviceSwipe(e,t,n,o,i){let s=this.hass?.states[e];if(t==="start"){if(!s||I(s)||this.confirmSet.has(e))return!1;let l=F(e);if(l==="light"&&li(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:o,y:i},!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:o,y:i},!0}if(l==="cover"&&ci(s)){let c=s.attributes.current_position;return this._swipe={entity:e,kind:"cover",start:c,value:c,x:o,y:i},!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,ba(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()||!ma(e,this.screenName)||!fa(e))return;let n=ga(e.message);this._announcement={message:e.message,until:Date.now()+n},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,n),_a(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?m`<button class="nf-announcement" role="alert" title=${A(this.hass,"close")} @click=${()=>this._announcement=null}>
|
||||
</nav>`}onDeviceHold(e,t,n){let o=F(e);o==="light"||o==="cover"||o==="switch"||o==="fan"||o==="lock"?this._menu={entity:e,x:t,y:n}:fe(this,e)}onDeviceSwipe(e,t,n,o,i){let s=this.hass?.states[e];if(t==="start"){if(!s||I(s)||this.confirmSet.has(e))return!1;let l=F(e);if(l==="light"&&li(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:o,y:i},!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:o,y:i},!0}if(l==="cover"&&ci(s)){let c=s.attributes.current_position;return this._swipe={entity:e,kind:"cover",start:c,value:c,x:o,y:i},!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,ba(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()||!pa(e,this.screenName)||!fa(e))return;let n=ga(e.message);this._announcement={message:e.message,until:Date.now()+n},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,n),_a(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?p`<button class="nf-announcement" role="alert" title=${M(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 m`<div class="nf-alert-banner" role="alert">
|
||||
${t.map(n=>m`<button class="nf-alert nf-alert-${n.kind}" style=${n.color?`border-left-color:${n.color}`:""} title=${Vo(this.hass,e,n)} @click=${()=>this.jumpTo(n)}>${Vo(this.hass,e,n)}</button>`)}
|
||||
${this._alerts.length>3?m`<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(i=>i.rooms).find(i=>i.id===this.roomId),n=t?K(this.hass,t).filter(i=>F(i)==="scene"||F(i)==="script").slice(0,6):[];if(!n.length)return f;let o=t?.area_id?this.hass.areas?.[t.area_id]?.name:void 0;return m`<div class="nf-scenes">
|
||||
${n.map(i=>m`<button class="nf-chip" aria-pressed=${this._sceneFired===i} @click=${()=>this.runScene(i)}>${O(this.hass,i,o)}</button>`)}
|
||||
</div>`}renderFind(){let e=this.building;if(!e||!this.hass)return f;if(this._find===null)return m`<button class="nf-find-btn" title=${A(this.hass,"find")} aria-label=${A(this.hass,"find")} @click=${()=>this._find=""}>
|
||||
</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=${Vo(this.hass,e,n)} @click=${()=>this.jumpTo(n)}>${Vo(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(i=>i.rooms).find(i=>i.id===this.roomId),n=t?K(this.hass,t).filter(i=>F(i)==="scene"||F(i)==="script").slice(0,6):[];if(!n.length)return f;let o=t?.area_id?this.hass.areas?.[t.area_id]?.name:void 0;return p`<div class="nf-scenes">
|
||||
${n.map(i=>p`<button class="nf-chip" aria-pressed=${this._sceneFired===i} @click=${()=>this.runScene(i)}>${O(this.hass,i,o)}</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=${M(this.hass,"find")} aria-label=${M(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=xc(this.findIndex??=yc(this.hass,e),this._find);return m`<div class="nf-find">
|
||||
</button>`;let t=xc(this.findIndex??=yc(this.hass,e),this._find);return p`<div class="nf-find">
|
||||
<input
|
||||
type="search"
|
||||
placeholder=${A(this.hass,"find_placeholder")}
|
||||
placeholder=${M(this.hass,"find_placeholder")}
|
||||
.value=${this._find}
|
||||
@input=${n=>this._find=n.target.value}
|
||||
@keydown=${n=>{n.key==="Escape"&&(this._find=null),n.key==="Enter"&&t[0]&&this.goTo(t[0])}}
|
||||
/>
|
||||
<button class="nf-find-close" aria-label=${A(this.hass,"close")} @click=${()=>this._find=null}>✕</button>
|
||||
${this._find.trim()?m`<div class="nf-find-list">
|
||||
${t.length?t.map(n=>m`<button @click=${()=>this.goTo(n)}>
|
||||
<button class="nf-find-close" aria-label=${M(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?ir(n.icon):"M4 10l8-6 8 6v10H4z"} /></svg></span>
|
||||
<span><b>${n.name}</b>${n.where?m`<small>${n.where}</small>`:f}</span>
|
||||
</button>`):m`<p>${A(this.hass,"find_none")}</p>`}
|
||||
<span><b>${n.name}</b>${n.where?p`<small>${n.where}</small>`:f}</span>
|
||||
</button>`):p`<p>${M(this.hass,"find_none")}</p>`}
|
||||
</div>`:f}
|
||||
</div>`}renderCentral(){let e=this.building,t=this.hass;if(!e||!t||!this.central||this._find!==null)return f;let n=(g,v)=>A(t,g,v),o=m`<button
|
||||
</div>`}renderCentral(){let e=this.building,t=this.hass;if(!e||!t||!this.central||this._find!==null)return f;let n=(g,v)=>M(t,g,v),o=p`<button
|
||||
class="nf-central-btn ${this._central?"nf-central-on":""}"
|
||||
title=${n("central")}
|
||||
aria-label=${n("central")}
|
||||
@@ -1581,24 +1581,24 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
@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 o;let i=this.floorId?e.floors.find(g=>g.id===this.floorId):void 0,s=i?[i]:e.floors,a=s.flatMap(g=>wo(t,g).lights),l=s.flatMap(g=>wo(t,g).covers),c=a.filter(g=>t.states[g]?.state==="on").length,u=!i,h=(g,v,S,k)=>{if(k.length){if(u&&this._armed!==g){this._armed=g,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(v,S,{entity_id:k})}},p=(g,v,S,k,y)=>m`<button class="nf-btn ${this._armed===g?"nf-central-armed":""}" ?disabled=${!y.length} @click=${()=>h(g,S,k,y)}>
|
||||
</button>`;if(!this._central)return o;let i=this.floorId?e.floors.find(g=>g.id===this.floorId):void 0,s=i?[i]:e.floors,a=s.flatMap(g=>wo(t,g).lights),l=s.flatMap(g=>wo(t,g).covers),c=a.filter(g=>t.states[g]?.state==="on").length,u=!i,h=(g,v,S,k)=>{if(k.length){if(u&&this._armed!==g){this._armed=g,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(v,S,{entity_id:k})}},m=(g,v,S,k,y)=>p`<button class="nf-btn ${this._armed===g?"nf-central-armed":""}" ?disabled=${!y.length} @click=${()=>h(g,S,k,y)}>
|
||||
${this._armed===g?n("central_sure"):n(v)}
|
||||
</button>`,d=e.settings.favorite_floors??{},_=(e.settings.favorites??[]).filter(g=>t.states[g]&&(!d[g]||!i||d[g]===i.id)),b=this.buttons??e.settings.buttons??[];return m`${o}
|
||||
</button>`,d=e.settings.favorite_floors??{},_=(e.settings.favorites??[]).filter(g=>t.states[g]&&(!d[g]||!i||d[g]===i.id)),b=this.buttons??e.settings.buttons??[];return p`${o}
|
||||
<div class="nf-central ${this.centralOpen?"nf-central-big":""}" role="dialog" aria-label=${n("central")}>
|
||||
<b>${i?i.name:n("central_house")}</b>
|
||||
<div class="nf-central-row">
|
||||
<span>${n("central_lights")}${a.length?m` <small>${c}/${a.length}</small>`:f}</span>
|
||||
${p("lights_on","central_on","light","turn_on",a.filter(g=>t.states[g]?.state==="off"))}
|
||||
${p("lights_off","central_off","light","turn_off",a.filter(g=>t.states[g]?.state==="on"))}
|
||||
<span>${n("central_lights")}${a.length?p` <small>${c}/${a.length}</small>`:f}</span>
|
||||
${m("lights_on","central_on","light","turn_on",a.filter(g=>t.states[g]?.state==="off"))}
|
||||
${m("lights_off","central_off","light","turn_off",a.filter(g=>t.states[g]?.state==="on"))}
|
||||
</div>
|
||||
${l.length?m`<div class="nf-central-row">
|
||||
${l.length?p`<div class="nf-central-row">
|
||||
<span>${n("central_covers")} <small>${l.length}</small></span>
|
||||
${p("covers_open","central_open","cover","open_cover",l)}
|
||||
${p("covers_close","central_close","cover","close_cover",l)}
|
||||
${m("covers_open","central_open","cover","open_cover",l)}
|
||||
${m("covers_close","central_close","cover","close_cover",l)}
|
||||
</div>`:f}
|
||||
<b>${n("central_favorites")}</b>
|
||||
${_.length?m`<div class="nf-central-favs">
|
||||
${_.map(g=>{let[v,S]=Zs(g),k=t.states[g],y=v==="homeassistant"&&k?.state==="on";return m`<button
|
||||
${_.length?p`<div class="nf-central-favs">
|
||||
${_.map(g=>{let[v,S]=Zs(g),k=t.states[g],y=v==="homeassistant"&&k?.state==="on";return p`<button
|
||||
class="nf-chip"
|
||||
aria-pressed=${y||this._sceneFired===g}
|
||||
?disabled=${I(k)}
|
||||
@@ -1606,17 +1606,17 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
>
|
||||
${O(t,g)}
|
||||
</button>`})}
|
||||
</div>`:b.length?f:m`<p class="nf-central-hint">${n("central_no_favorites")}</p>`}
|
||||
${b.length?m`<div class="nf-central-favs">
|
||||
${b.map(g=>m`<button
|
||||
</div>`:b.length?f:p`<p class="nf-central-hint">${n("central_no_favorites")}</p>`}
|
||||
${b.length?p`<div class="nf-central-favs">
|
||||
${b.map(g=>p`<button
|
||||
class="nf-chip nf-own-btn"
|
||||
aria-pressed=${Ys(t,g)}
|
||||
@click=${v=>{yo(t,v.currentTarget,g),g.action!=="service"&&(this._central=!1)}}
|
||||
>
|
||||
${g.icon?m`<ha-icon .icon=${g.icon.startsWith("mdi:")?g.icon:`mdi:${g.icon}`}></ha-icon>`:f}${g.label}
|
||||
${g.icon?p`<ha-icon .icon=${g.icon.startsWith("mdi:")?g.icon:`mdi:${g.icon}`}></ha-icon>`:f}${g.label}
|
||||
</button>`)}
|
||||
</div>`:f}
|
||||
</div>`}toggleLock(){this._locked=!this._locked;try{localStorage.setItem(Fc,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 o=await ln(this.hass,al(this.watched),n,t);if(!this._travel||this._travel.from!==n)return;this._travel={...this._travel,history:o,moments:ll(o,n,t),loading:!1}}catch{this._travel=null,this._error=A(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 o=n.t+250*n.speed;o>=n.to&&this.playTravel(!1),this.travelTo(o)},250)))}renderTravel(){if(!this.hass||this.clean)return f;let e=a=>A(this.hass,a),t=this._travel;if(!t)return this.travelButton?m`<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,o=new Intl.DateTimeFormat(n,{weekday:"short",hour:"2-digit",minute:"2-digit"}).format(new Date(t.t)),i=t.to-t.from||1,s=[[60,"travel_speed_min"],[600,"travel_speed_10min"],[3600,"travel_speed_hour"]];return m`<div class="nf-travel" role="group" aria-label=${e("travel")}>
|
||||
</div>`}toggleLock(){this._locked=!this._locked;try{localStorage.setItem(Fc,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 o=await ln(this.hass,al(this.watched),n,t);if(!this._travel||this._travel.from!==n)return;this._travel={...this._travel,history:o,moments:ll(o,n,t),loading:!1}}catch{this._travel=null,this._error=M(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 o=n.t+250*n.speed;o>=n.to&&this.playTravel(!1),this.travelTo(o)},250)))}renderTravel(){if(!this.hass||this.clean)return f;let e=a=>M(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,o=new Intl.DateTimeFormat(n,{weekday:"short",hour:"2-digit",minute:"2-digit"}).format(new Date(t.t)),i=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"):o}</b>
|
||||
<div class="nf-travel-track">
|
||||
@@ -1624,23 +1624,23 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
<input type="range" min=${t.from} max=${t.to} step="60000" .value=${String(t.t)} ?disabled=${t.loading} aria-label=${e("travel")} @input=${a=>this.travelTo(Number(a.target.value))} />
|
||||
</div>
|
||||
<select aria-label=${e("travel_speed")} @change=${a=>this._travel={...t,speed:Number(a.target.value)}}>
|
||||
${s.map(([a,l])=>m`<option value=${a} ?selected=${t.speed===a}>${e(l)}</option>`)}
|
||||
${s.map(([a,l])=>p`<option value=${a} ?selected=${t.speed===a}>${e(l)}</option>`)}
|
||||
</select>
|
||||
<button class="nf-travel-span" aria-pressed=${t.hours===24} @click=${()=>{this.openTravel(24)}}>24 h</button>
|
||||
<button class="nf-travel-span" aria-pressed=${t.hours===168} @click=${()=>{this.openTravel(168)}}>7 ${e("travel_days")}</button>
|
||||
<button class="nf-travel-live" @click=${()=>{this.openTravel(null)}}>● ${e("travel_live")}</button>
|
||||
</div>`}toggleWalk(){let e=this.viewer;e&&(this._walking?(e.stopWalk(),this._walking=!1):this._walking=e.startWalk()!==null,this._stick=null)}stickMove(e,t=!1){let n=e.currentTarget;if(t)n.setPointerCapture(e.pointerId);else if(!this._stick)return;let o=n.getBoundingClientRect(),i=o.width/2,[s,a]=[(e.clientX-o.left-i)/i,(e.clientY-o.top-i)/i],l=Math.hypot(s,a);l>1&&([s,a]=[s/l,a/l]),this._stick=[s,a],this.viewer?.setWalkStick(Math.abs(s)<.12?0:s,Math.abs(a)<.12?0:a)}stickEnd(){this._stick=null,this.viewer?.setWalkStick(0,0)}renderWalk(){if(!this.hass||this.clean||!this.walkButton&&!this._walking)return f;let e=n=>A(this.hass,n),t=this._stick??[0,0];return m`<button class="nf-walk-btn ${this._walking?"nf-walk-on":""}" title=${e(this._walking?"walk_stop":"walk")} aria-label=${e(this._walking?"walk_stop":"walk")} aria-pressed=${this._walking} @click=${()=>this.toggleWalk()}>
|
||||
</div>`}toggleWalk(){let e=this.viewer;e&&(this._walking?(e.stopWalk(),this._walking=!1):this._walking=e.startWalk()!==null,this._stick=null)}stickMove(e,t=!1){let n=e.currentTarget;if(t)n.setPointerCapture(e.pointerId);else if(!this._stick)return;let o=n.getBoundingClientRect(),i=o.width/2,[s,a]=[(e.clientX-o.left-i)/i,(e.clientY-o.top-i)/i],l=Math.hypot(s,a);l>1&&([s,a]=[s/l,a/l]),this._stick=[s,a],this.viewer?.setWalkStick(Math.abs(s)<.12?0:s,Math.abs(a)<.12?0:a)}stickEnd(){this._stick=null,this.viewer?.setWalkStick(0,0)}renderWalk(){if(!this.hass||this.clean||!this.walkButton&&!this._walking)return f;let e=n=>M(this.hass,n),t=this._stick??[0,0];return p`<button class="nf-walk-btn ${this._walking?"nf-walk-on":""}" title=${e(this._walking?"walk_stop":"walk")} aria-label=${e(this._walking?"walk_stop":"walk")} aria-pressed=${this._walking} @click=${()=>this.toggleWalk()}>
|
||||
${this._walking?"\u2715":Q`<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="13" cy="4" r="2" /><path d="M10 21l2-6 3 3v5M9 12l1-4 4 1 3 3M8 9l-2 4" /></svg>`}
|
||||
</button>
|
||||
${this._walking?m`<div class="nf-stick" @pointerdown=${n=>this.stickMove(n,!0)} @pointermove=${n=>this.stickMove(n)} @pointerup=${()=>this.stickEnd()} @pointercancel=${()=>this.stickEnd()}>
|
||||
${this._walking?p`<div class="nf-stick" @pointerdown=${n=>this.stickMove(n,!0)} @pointermove=${n=>this.stickMove(n)} @pointerup=${()=>this.stickEnd()} @pointercancel=${()=>this.stickEnd()}>
|
||||
<span style="transform:translate(${t[0]*34}px, ${t[1]*34}px)"></span>
|
||||
</div>
|
||||
<p class="nf-walk-hint">${e("walk_hint")}</p>`:f}`}renderLock(){if(!this.lockButton||!this.hass||this.clean)return f;let e=A(this.hass,this._locked?"lock3d_off":"lock3d_on");return m`<button class="nf-lock3d ${this._locked?"nf-lock3d-on":""}" title=${e} aria-label=${e} aria-pressed=${this._locked} @click=${()=>this.toggleLock()}>
|
||||
<p class="nf-walk-hint">${e("walk_hint")}</p>`:f}`}renderLock(){if(!this.lockButton||!this.hass||this.clean)return f;let e=M(this.hass,this._locked?"lock3d_off":"lock3d_on");return p`<button class="nf-lock3d ${this._locked?"nf-lock3d-on":""}" title=${e} aria-label=${e} aria-pressed=${this._locked} @click=${()=>this.toggleLock()}>
|
||||
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<rect x="5" y="11" width="14" height="9" rx="2" />
|
||||
${this._locked?Q`<path d="M8 11V8a4 4 0 0 1 8 0v3" />`:Q`<path d="M8 11V8a4 4 0 0 1 7.5-2" />`}
|
||||
</svg>
|
||||
</button>`}renderClock(e=!1){if(!this.clock||!this.hass||this.clock==="top_left"&&!e)return f;let t=this.hass.language??navigator.language,n=new Date(this._now),o=new Intl.DateTimeFormat(t,{hour:"2-digit",minute:"2-digit"}).format(n),i=new Intl.DateTimeFormat(t,{weekday:"long",day:"numeric",month:"long"}).format(n);return m`<div class="nf-clock nf-clock-${this.clock}" aria-hidden="true"><b>${o}</b><span>${i}</span></div>`}renderEye(){if(!this.cleanButton||!this.hass||this._find!==null&&!this.clean)return f;let e=A(this.hass,this.clean?"controls_show":"controls_hide");return m`<button
|
||||
</button>`}renderClock(e=!1){if(!this.clock||!this.hass||this.clock==="top_left"&&!e)return f;let t=this.hass.language??navigator.language,n=new Date(this._now),o=new Intl.DateTimeFormat(t,{hour:"2-digit",minute:"2-digit"}).format(n),i=new Intl.DateTimeFormat(t,{weekday:"long",day:"numeric",month:"long"}).format(n);return p`<div class="nf-clock nf-clock-${this.clock}" aria-hidden="true"><b>${o}</b><span>${i}</span></div>`}renderEye(){if(!this.cleanButton||!this.hass||this._find!==null&&!this.clean)return f;let e=M(this.hass,this.clean?"controls_show":"controls_hide");return p`<button
|
||||
class="nf-eye ${this.clean?"nf-eye-clean":""}"
|
||||
title=${e}
|
||||
aria-label=${e}
|
||||
@@ -1648,14 +1648,14 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
@click=${()=>this.dispatchEvent(new CustomEvent("clean-toggle",{bubbles:!0,composed:!0}))}
|
||||
>
|
||||
${this.clean?Q`<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>`:Q`<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 m`<div class="nf-swipe" style="left:${e.x}px;top:${e.y}px">
|
||||
</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>${O(this.hass,e.entity)}</span>
|
||||
<b>${t?A(this.hass,"swipe_off"):`${e.value} %`}</b>
|
||||
<b>${t?M(this.hass,"swipe_off"):`${e.value} %`}</b>
|
||||
<i><em style="height:${e.value}%"></em></i>
|
||||
</div>`}tapPlate(e,t,n){let o=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),i=o?xo(o.gang_entities,Z(o.type)?.gangs??0):[];if(i.length===1)return this.onDeviceTap(i[0],t,n);i.length>1&&(this._plate={ids:i,x:t,y:n})}renderPlate(){let e=this._plate;if(!e||!this.hass)return f;let t=this.hass,n=()=>this._plate=null;return m`<div class="nf-menu-backdrop" @click=${n}></div>
|
||||
</div>`}tapPlate(e,t,n){let o=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),i=o?xo(o.gang_entities,Z(o.type)?.gangs??0):[];if(i.length===1)return this.onDeviceTap(i[0],t,n);i.length>1&&(this._plate={ids:i,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((o,i)=>{let s=t.states[o],a=J(s)||s?.state==="on";return m`<button role="menuitem" class=${a?"on":""} @click=${()=>{n(),this.onDeviceTap(o,e.x,e.y)}}><b>${i+1}</b><span>${O(t,o)}</span><i>${s?te(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,o=t?.clientHeight??600,i=Math.max(8,Math.min(n-240,e.x-116)),s=Math.max(8,Math.min(o-360,e.y-170));return m`<div class="nf-menu-backdrop" @click=${()=>this._menu=null}></div>
|
||||
${e.ids.map((o,i)=>{let s=t.states[o],a=J(s)||s?.state==="on";return p`<button role="menuitem" class=${a?"on":""} @click=${()=>{n(),this.onDeviceTap(o,e.x,e.y)}}><b>${i+1}</b><span>${O(t,o)}</span><i>${s?te(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,o=t?.clientHeight??600,i=Math.max(8,Math.min(n-240,e.x-116)),s=Math.max(8,Math.min(o-360,e.y-170));return p`<div class="nf-menu-backdrop" @click=${()=>this._menu=null}></div>
|
||||
<nf-quick-menu
|
||||
style="left:${i}px;top:${s}px"
|
||||
?low=${this._low}
|
||||
@@ -1667,59 +1667,60 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
.myPosition=${this.myPositionOf(e.entity)}
|
||||
.tiltEntity=${tr(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 o=this.openingLinks?.get(n.id);if(n.my_position!=null&&(o?.cover===e||o?.cover2===e))return n.my_position}return null}onDeviceTap(e,t=0,n=0){if(e.startsWith("lamp:")||this._travel)return;let o=e.startsWith("tap:")?e.slice(4):this.tapPins.get(e);if(o){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===o);s?.tap&&yo(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??Pe(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&fe(this,a);return}let i=F(e);if(i==="cover"||i==="media"){this._menu={entity:e,x:t,y:n};return}if(i==="lock"){let s=_o(this.hass,e),a=O(this.hass,e);confirm(A(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(i&&xs.has(i)){if(this.confirmSet.has(e)&&!confirm(A(this.hass,"confirm_switch",{name:O(this.hass,e)})))return;da(this.hass,e)}else fe(this,e)}pluginTapped(e){let t=this.hass?.states[e],n=this.placementInfo.get(e);if(!t||!n)return!1;let o=this.building?.floors.find(i=>i.id===n.floorId)?.placements.find(i=>i.entity_id===e);return ts({hass:this.hass,entityId:e,state:t},n,o?.plugin??void 0,{showWindow:(i,s)=>{i&&"hass"in i&&(i.hass=this.hass),this._pluginWindow=i?{node:i,title:s?.title??""}:null},moreInfo:i=>fe(this,i??e)})}renderPluginWindow(){let e=this._pluginWindow;return e?m`<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=${A(this.hass,"close")} @click=${()=>this._pluginWindow=null}>✕</button></div>
|
||||
></nf-quick-menu>`}myPositionOf(e){for(let t of this.building?.floors??[])for(let n of t.openings){let o=this.openingLinks?.get(n.id);if(n.my_position!=null&&(o?.cover===e||o?.cover2===e))return n.my_position}return null}onDeviceTap(e,t=0,n=0){if(e.startsWith("lamp:")||this._travel)return;let o=e.startsWith("tap:")?e.slice(4):this.tapPins.get(e);if(o){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===o);s?.tap&&yo(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??Pe(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&fe(this,a);return}let i=F(e);if(i==="cover"||i==="media"){this._menu={entity:e,x:t,y:n};return}if(i==="lock"){let s=_o(this.hass,e),a=O(this.hass,e);confirm(M(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(i&&xs.has(i)){if(this.confirmSet.has(e)&&!confirm(M(this.hass,"confirm_switch",{name:O(this.hass,e)})))return;da(this.hass,e)}else fe(this,e)}pluginTapped(e){let t=this.hass?.states[e],n=this.placementInfo.get(e);if(!t||!n)return!1;let o=this.building?.floors.find(i=>i.id===n.floorId)?.placements.find(i=>i.entity_id===e);return ts({hass:this.hass,entityId:e,state:t},n,o?.plugin??void 0,{showWindow:(i,s)=>{i&&"hass"in i&&(i.hass=this.hass),this._pluginWindow=i?{node:i,title:s?.title??""}:null},moreInfo:i=>fe(this,i??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=${M(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 o of e.floors)for(let i of o.furniture){if(!uc(i.type))continue;let s=this.furnitureLinks?.get(i.id),a=cc(t,s?.entity??s?.power??null);a&&n.push({id:i.id,name:i.name||he(t,i.type),floorId:o.id,x:i.x,z:i.z,at:{floorId:o.id,x:i.x,z:i.z,y:ce(o,i)+i.h+.5},pump:a})}return n}livePrinters(e){let t=this.hass,n=[];if(!t)return n;for(let o of e.floors)for(let i of o.furniture){if(!ri(i.type))continue;let s=this.furnitureLinks?.get(i.id),a=ni(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||n.push({id:i.id,name:i.name||he(t,i.type),at:{floorId:o.id,x:i.x,z:i.z,y:ce(o,i)+i.h+.5},printer:a})}return n}liveCars(e,t){let n=[];for(let o of t.floors)for(let i of o.furniture){if(i.type!=="parking")continue;let s=fc(e,i);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=Ko(e,i),l=a?El(i,a):null,c=i.name||(a?he(e,a):he(e,i.type));n.push({spot:i.id,name:c,at:{floorId:o.id,x:i.x,z:i.z,y:ce(o,i)+(l?.h??.2)+.6},car:s})}return n}liveMedia(e,t){let n=[];for(let o of t.floors){for(let i of o.furniture){let s=this.furnitureLinks?.get(i.id)?.entity;s?.startsWith("media_player.")&&n.push({entity:s,name:i.name||he(e,i.type),at:{floorId:o.id,x:i.x,z:i.z,y:ce(o,i)+i.h+.15},rings:i.sound_rings})}for(let i of o.placements)i.entity_id.startsWith("media_player.")&&n.push({entity:i.entity_id,name:i.name||O(e,i.entity_id),at:{floorId:o.id,x:i.x,z:i.z,y:(i.y??1.1)+.15},rings:i.sound_rings})}return pl(e,n)}refreshToday(e){let t=this.hass,n=e.settings.calendars??[],o=Math.max(1,Math.min(7,e.settings.today_days??1)),i=`${new Date().toDateString()}|${o}`;!t||!n.length||Date.now()-this.todayAt<9e5&&i===this.todayDay||(this.todayAt=Date.now(),this.todayDay=i,oc(t,n,o).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,n=e.settings.forecast&&t?qe(t,this.weatherEntityId??e.settings.weather_entity):null;if(!t||!n)return;let o=`${n}|${new Date().toDateString()}`;Date.now()-this.forecastAt<18e5&&o===this.forecastKey||(this.forecastAt=Date.now(),this.forecastKey=o,ac(t,n).then(i=>this._forecast=i))}renderForecast(e){let t=this.building,n=this.hass,o=t?.settings.forecast;if(!t||!n||!o||o.corner!==e||this.clean)return f;if(e==="top_right"&&(this.roomId||this.panelOpen))return f;let i=sc(this._forecast,Math.max(1,Math.min(7,o.days)));if(!i.length)return f;let s=qe(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,h=new Intl.DateTimeFormat(u,{weekday:"short"}),p=d=>d===null?"\u2013":`${Math.round(d)}\xB0`;return m`<section class="nf-forecast" aria-label=${A(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 o of e.floors)for(let i of o.furniture){if(!uc(i.type))continue;let s=this.furnitureLinks?.get(i.id),a=cc(t,s?.entity??s?.power??null);a&&n.push({id:i.id,name:i.name||he(t,i.type),floorId:o.id,x:i.x,z:i.z,at:{floorId:o.id,x:i.x,z:i.z,y:ce(o,i)+i.h+.5},pump:a})}return n}livePrinters(e){let t=this.hass,n=[];if(!t)return n;for(let o of e.floors)for(let i of o.furniture){if(!ri(i.type))continue;let s=this.furnitureLinks?.get(i.id),a=ni(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||n.push({id:i.id,name:i.name||he(t,i.type),at:{floorId:o.id,x:i.x,z:i.z,y:ce(o,i)+i.h+.5},printer:a})}return n}liveCars(e,t){let n=[];for(let o of t.floors)for(let i of o.furniture){if(i.type!=="parking")continue;let s=fc(e,i);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=Ko(e,i),l=a?El(i,a):null,c=i.name||(a?he(e,a):he(e,i.type));n.push({spot:i.id,name:c,at:{floorId:o.id,x:i.x,z:i.z,y:ce(o,i)+(l?.h??.2)+.6},car:s})}return n}liveMedia(e,t){let n=[];for(let o of t.floors){for(let i of o.furniture){let s=this.furnitureLinks?.get(i.id)?.entity;s?.startsWith("media_player.")&&n.push({entity:s,name:i.name||he(e,i.type),at:{floorId:o.id,x:i.x,z:i.z,y:ce(o,i)+i.h+.15},rings:i.sound_rings})}for(let i of o.placements)i.entity_id.startsWith("media_player.")&&n.push({entity:i.entity_id,name:i.name||O(e,i.entity_id),at:{floorId:o.id,x:i.x,z:i.z,y:(i.y??1.1)+.15},rings:i.sound_rings})}return ml(e,n)}refreshToday(e){let t=this.hass,n=e.settings.calendars??[],o=Math.max(1,Math.min(7,e.settings.today_days??1)),i=`${new Date().toDateString()}|${o}`;!t||!n.length||Date.now()-this.todayAt<9e5&&i===this.todayDay||(this.todayAt=Date.now(),this.todayDay=i,oc(t,n,o).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,n=e.settings.forecast&&t?qe(t,this.weatherEntityId??e.settings.weather_entity):null;if(!t||!n)return;let o=`${n}|${new Date().toDateString()}`;Date.now()-this.forecastAt<18e5&&o===this.forecastKey||(this.forecastAt=Date.now(),this.forecastKey=o,ac(t,n).then(i=>this._forecast=i))}renderForecast(e){let t=this.building,n=this.hass,o=t?.settings.forecast;if(!t||!n||!o||o.corner!==e||this.clean)return f;if(e==="top_right"&&(this.roomId||this.panelOpen))return f;let i=sc(this._forecast,Math.max(1,Math.min(7,o.days)));if(!i.length)return f;let s=qe(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,h=new Intl.DateTimeFormat(u,{weekday:"short"}),m=d=>d===null?"\u2013":`${Math.round(d)}\xB0`;return p`<section class="nf-forecast" aria-label=${M(n,"forecast")}>
|
||||
<ul>
|
||||
${i.map((d,_)=>m`<li>
|
||||
<span class="nf-fc-day">${_===0?A(n,"today"):h.format(new Date(d.day))}</span>
|
||||
${i.map((d,_)=>p`<li>
|
||||
<span class="nf-fc-day">${_===0?M(n,"today"):h.format(new Date(d.day))}</span>
|
||||
<span class="nf-fc-icon" aria-hidden="true">${d.icon}</span>
|
||||
<span class="nf-fc-temp" title=${l}><b>${p(d.high)}</b> <small>${p(d.low)}</small></span>
|
||||
<span class="nf-fc-temp" title=${l}><b>${m(d.high)}</b> <small>${m(d.low)}</small></span>
|
||||
<span class="nf-fc-rain">${d.rain!==null&&d.rain>0?`\u{1F4A7}${d.rain.toLocaleString(u,{maximumFractionDigits:1})} ${c}`:d.chance!==null&&d.chance>0?`\u{1F4A7}${Math.round(d.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"),o=this.today===!1?f:this.renderTodayCard(e,t);return o===f&&n===f?f:m`<div class="nf-right-col" style=${this.clock==="top_right"?"top: 78px":""}>${o}${n}</div>`}renderTodayCard(e,t){let n=nc(t,e,Date.now(),{today:A(t,"care_bin_today"),tomorrow:A(t,"care_bin_tomorrow")}),o=rc([...n,...this._todayItems??[]]);if(!o.length&&!(e.settings.calendars??[]).length)return f;let i=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 A(t,"tomorrow");let h=new Date;return h.setDate(h.getDate()+u),new Intl.DateTimeFormat(a,{weekday:"long",day:"numeric",month:"numeric"}).format(h)},c=o.flatMap((u,h)=>[(u.day??0)>0&&(o[h-1]?.day??0)!==u.day?m`<li class="nf-today-day">${l(u.day??0)}</li>`:f,m`<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 m`<section class="nf-today ${i?"":"nf-today-folded"}" aria-label=${A(t,"today")}>
|
||||
</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"),o=this.today===!1?f:this.renderTodayCard(e,t);return o===f&&n===f?f:p`<div class="nf-right-col" style=${this.clock==="top_right"?"top: 78px":""}>${o}${n}</div>`}renderTodayCard(e,t){let n=nc(t,e,Date.now(),{today:M(t,"care_bin_today"),tomorrow:M(t,"care_bin_tomorrow")}),o=rc([...n,...this._todayItems??[]]);if(!o.length&&!(e.settings.calendars??[]).length)return f;let i=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 M(t,"tomorrow");let h=new Date;return h.setDate(h.getDate()+u),new Intl.DateTimeFormat(a,{weekday:"long",day:"numeric",month:"numeric"}).format(h)},c=o.flatMap((u,h)=>[(u.day??0)>0&&(o[h-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 ${i?"":"nf-today-folded"}" aria-label=${M(t,"today")}>
|
||||
<button class="nf-today-head" aria-expanded=${i} @click=${()=>this._todayOpen=!i}>
|
||||
<b>📅 ${A(t,"today")}</b><span>${s}</span>
|
||||
<b>📅 ${M(t,"today")}</b><span>${s}</span>
|
||||
</button>
|
||||
${i?o.length?m`<ul>
|
||||
${i?o.length?p`<ul>
|
||||
${c}
|
||||
</ul>`:m`<p class="nf-today-none">${A(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=Pe(e,s=>this.furnitureLinks?.get(s.id)?.power??null),o=e.energy,i={solar:o.solar?[o.solar]:n.solar,grid:o.grid??n.grid,gridInvert:!!o.grid_invert,battery:o.battery?[o.battery]:n.battery,batteryInvert:!!o.battery_invert,consumption:o.consumption};qa(t,i).then(s=>{this.week=s,this.syncDevices(!0)}).catch(()=>this.week=null)}meterRows(e,t=null){let n=this.hass,o=[],i=this.floorId?e.floors.find(a=>a.id===this.floorId):void 0,s=i?.power_entity?q(n?.states[i.power_entity]):null;if(i&&s!==null){let a=t&&t>0?` \xB7 ${A(n,"floor_power_share",{n:Math.round(Math.max(0,s)/t*100)})}`:"";o.push({icon:"\u26A1",label:i.name,value:`${lt(n,s)}${a}`})}for(let[a,l,c]of[["gas","\u{1F525}","energy_gas_short"],["water","\u{1F4A7}","energy_water_short"]]){let u=e.energy[a],h=u?n?.states[u]:void 0;h&&!I(h)&&o.push({icon:l,label:A(n,c),value:te(n,h)})}return o}refreshDayCurves(e){let t=this.hass;if(!t||this._travel||Date.now()-this.curvesAt<6e5)return;this.curvesAt=Date.now();let n=a=>on(a,e,rn(a,e),Pe(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),o=cl(t,n),i=Date.now(),s=i-24*36e5;ln(t,o,s,i,!0).then(a=>{this.dayCurves=ul(t,a,s,i,n),this.syncDevices(!0)}).catch(()=>this.dayCurves=null)}syncLhCards(e,t,n,o,i,s){let a=[],l=n.summary,c=l.solar!==null||l.grid!==null||l.battery!==null||l.consumption!==null,u=gn(t),h=(this.floorId?t.floors.find(p=>p.id===this.floorId):void 0)??[...t.floors].sort((p,d)=>d.elevation-p.elevation)[0];if(this.liveCardsOn&&!this.dimmed&&!this.roomId&&c&&u&&h){let p=0,d=0,_=0;for(let b of h.rooms)for(let[g,v]of b.points)p+=g,d+=v,_++;a.push({kind:"house",at:{floorId:h.id,x:_?p/_:u.x,z:_?d/_:u.z,y:h.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 p of o)a.push({kind:"car",at:p.at,spot:p.spot,name:p.name,car:p.car});for(let p of this.livePrinters(t))a.push({kind:"printer",at:p.at,name:p.name,printer:p.printer});for(let p of this.liveHeatPumps(t))a.push({kind:"heatpump",at:p.at,name:p.name,pump:p.pump});for(let p of i)a.push({kind:"media",at:{...p.at,y:p.at.y+.5},media:p})}this.liveCardsOn&&!this.dimmed&&a.push(...Ql(s,t,this.floorId,this.roomId)),JSON.stringify(a)!==JSON.stringify(this._liveCards)&&(this._liveCards=a),e.setLiveAnchors(a.map(p=>p.at),a.length?(p,d,_,b)=>this.placeLhCard(p,d,_,b):null)}placeLhCard(e,t,n,o){let i=this.renderRoot.querySelector(`.live-card[data-i="${e}"]`);i&&(i.dataset.x=String(t),i.dataset.y=String(n),i.style.visibility=o?"visible":"hidden",e===this._liveCards.length-1&&_c(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:m`<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),i=this.building?.floors.some(l=>l.rooms.some(c=>c.climate_card))?this.renderCardToggle():f;if(!n)return e.length||i!==f?m`<div class="nf-energy" aria-live="off">${e}${i}</div>`:f;let s=l=>A(this.hass,l),a=[];if(t.solar!==null&&a.push({cls:"solar",label:s("energy_solar"),value:ae(this.hass,t.solar)}),t.consumption!==null&&a.push({cls:"total",label:s("energy_consumption"),value:ae(this.hass,t.consumption)}),t.rest!==void 0&&t.rest!==null&&a.push({cls:"total",label:s("energy_rest"),value:ae(this.hass,t.rest)}),t.battery!==null||t.soc!==null){let l=[t.battery!==null?ae(this.hass,Math.abs(t.battery)):null,t.soc!==null?`${Math.round(t.soc)} %`:null].filter(Boolean);a.push({cls:"battery",label:s("energy_battery"),value:l.join(" \xB7 ")})}if(t.grid!==null){let l=t.grid<0;a.push({cls:l?"export":"grid",label:s(l?"energy_grid_export":"energy_grid_import"),value:ae(this.hass,Math.abs(t.grid))})}if(t.tariff&&a.push({cls:"tariff",label:s("energy_tariff"),value:`${W(this.hass,t.tariff.value,3)} ${t.tariff.unit}`.trim()}),this.building)for(let l of this.meterRows(this.building))a.push({cls:"meter",label:`${l.icon} ${l.label}`,value:l.value});return m`<div class="nf-energy" aria-live="off">
|
||||
${this.liveCardsOn&&this._liveCards.some(l=>l.kind==="house")?f:a.map(l=>m`<div class="nf-energy-item nf-energy-${l.cls}"><span>${l.label}</span><b>${l.value}</b></div>`)}
|
||||
${this.flows!==null?f:m`<button class="nf-energy-item nf-flow-toggle" aria-pressed=${this._flows} title=${s("flows_hint")} aria-label=${s("flows")} @click=${()=>this.toggleFlows()}>
|
||||
<span>${s("flows")}</span><b>⚡</b>
|
||||
</ul>`:p`<p class="nf-today-none">${M(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=Pe(e,s=>this.furnitureLinks?.get(s.id)?.power??null),o=e.energy,i={solar:o.solar?[o.solar]:n.solar,grid:o.grid??n.grid,gridInvert:!!o.grid_invert,battery:o.battery?[o.battery]:n.battery,batteryInvert:!!o.battery_invert,consumption:o.consumption};qa(t,i).then(s=>{this.week=s,this.syncDevices(!0)}).catch(()=>this.week=null)}meterRows(e,t=null){let n=this.hass,o=[],i=this.floorId?e.floors.find(a=>a.id===this.floorId):void 0,s=i?.power_entity?q(n?.states[i.power_entity]):null;if(i&&s!==null){let a=t&&t>0?` \xB7 ${M(n,"floor_power_share",{n:Math.round(Math.max(0,s)/t*100)})}`:"";o.push({icon:"\u26A1",label:i.name,value:`${lt(n,s)}${a}`})}for(let[a,l,c]of[["gas","\u{1F525}","energy_gas_short"],["water","\u{1F4A7}","energy_water_short"]]){let u=e.energy[a],h=u?n?.states[u]:void 0;h&&!I(h)&&o.push({icon:l,label:M(n,c),value:te(n,h)})}return o}refreshDayCurves(e){let t=this.hass;if(!t||this._travel||Date.now()-this.curvesAt<6e5)return;this.curvesAt=Date.now();let n=a=>on(a,e,rn(a,e),Pe(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),o=cl(t,n),i=Date.now(),s=i-24*36e5;ln(t,o,s,i,!0).then(a=>{this.dayCurves=ul(t,a,s,i,n),this.syncDevices(!0)}).catch(()=>this.dayCurves=null)}syncLhCards(e,t,n,o,i,s){let a=[],l=n.summary,c=l.solar!==null||l.grid!==null||l.battery!==null||l.consumption!==null,u=gn(t),h=(this.floorId?t.floors.find(m=>m.id===this.floorId):void 0)??[...t.floors].sort((m,d)=>d.elevation-m.elevation)[0];if(this.liveCardsOn&&!this.dimmed&&!this.roomId&&c&&u&&h){let m=0,d=0,_=0;for(let b of h.rooms)for(let[g,v]of b.points)m+=g,d+=v,_++;a.push({kind:"house",at:{floorId:h.id,x:_?m/_:u.x,z:_?d/_:u.z,y:h.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 o)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 i)a.push({kind:"media",at:{...m.at,y:m.at.y+.5},media:m})}this.liveCardsOn&&!this.dimmed&&a.push(...Ql(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,d,_,b)=>this.placeLhCard(m,d,_,b):null)}placeLhCard(e,t,n,o){let i=this.renderRoot.querySelector(`.live-card[data-i="${e}"]`);i&&(i.dataset.x=String(t),i.dataset.y=String(n),i.style.visibility=o?"visible":"hidden",e===this._liveCards.length-1&&_c(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),i=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=${M(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>${M(this.hass,"room_names_short")}</span><b aria-hidden="true">Aa</b></button>`:f;if(!n)return e.length||i!==f||s!==f?p`<div class="nf-energy" aria-live="off">${s}${e}${i}</div>`:f;let a=c=>M(this.hass,c),l=[];if(t.solar!==null&&l.push({cls:"solar",label:a("energy_solar"),value:ae(this.hass,t.solar)}),t.consumption!==null&&l.push({cls:"total",label:a("energy_consumption"),value:ae(this.hass,t.consumption)}),t.rest!==void 0&&t.rest!==null&&l.push({cls:"total",label:a("energy_rest"),value:ae(this.hass,t.rest)}),t.battery!==null||t.soc!==null){let c=[t.battery!==null?ae(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_grid_import"),value:ae(this.hass,Math.abs(t.grid))})}if(t.tariff&&l.push({cls:"tariff",label:a("energy_tariff"),value:`${W(this.hass,t.tariff.value,3)} ${t.tariff.unit}`.trim()}),thiLine 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()}>
|
||||
<span>${a("flows")}</span><b>⚡</b>
|
||||
</button>`}
|
||||
${this.renderCardToggle()}
|
||||
${e}
|
||||
</div>`}renderCardToggle(){return this.holograms!==null?f:m`<button class="nf-energy-item nf-flow-toggle nf-card-toggle" aria-pressed=${this._liveCardOn} title=${A(this.hass,"holos_hint")} aria-label=${A(this.hass,"holos")} @click=${()=>this.toggleLhCards()}>
|
||||
<span>${A(this.hass,"holos")}</span><b>◫</b>
|
||||
</button>`}ownSensors(){return(this.sensorBar&&this.hass?this.building?.settings.status_entities??[]:[]).filter(t=>this.hass.states[t]).map(t=>m`<button class="nf-energy-item nf-own-sensor" title=${O(this.hass,t)} @click=${()=>fe(this,t)}>
|
||||
</div>`}renderCardToggle(){return this.holograms!==null?f:p`<button class="nf-energy-item nf-flow-toggle nf-card-toggle" aria-pressed=${this._liveCardOn} title=${M(this.hass,"holos_hint")} aria-label=${M(this.hass,"holos")} @click=${()=>this.toggleLhCards()}>
|
||||
<span>${M(this.hass,"holos")}</span><b>◫</b>
|
||||
</button>`}ownSensors(){return(this.sensorBar&&this.hass?this.building?.settings.status_entities??[]:[]).filter(t=>this.hass.states[t]).map(t=>p`<button class="nf-energy-item nf-own-sensor" title=${O(this.hass,t)} @click=${()=>fe(this,t)}>
|
||||
<span>${O(this.hass,t)}</span><b>${te(this.hass,this.hass.states[t])}</b>
|
||||
</button>`)}renderMapCredit(){let e=this.building?.settings.map;return Hl(e)?m`<a class="nf-map-credit" href=${Uo(e).href} target="_blank" rel="noopener">${Uo(e).text}</a>`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=at(new Date,this.hass?.config?.latitude??50),t=pr(this.heatMode,e),n=this.heatMode==="temperature",o=n?oe(this.hass,t.stops[0][0]):t.stops[0][0],i=n?oe(this.hass,t.stops[t.stops.length-1][0]):t.stops[t.stops.length-1][0],s=n?X(this.hass):t.unit,a=l=>A(this.hass,l);return m`<div class="nf-legend">
|
||||
<b>${a(`heat_${this.heatMode}`)}${this.heatMode==="temperature"?m` <small>${a(e?"heat_summer":"heat_winter")}</small>`:f}</b>
|
||||
</button>`)}renderMapCredit(){let e=this.building?.settings.map;return Hl(e)?p`<a class="nf-map-credit" href=${Uo(e).href} target="_blank" rel="noopener">${Uo(e).text}</a>`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=at(new Date,this.hass?.config?.latitude??50),t=mr(this.heatMode,e),n=this.heatMode==="temperature",o=n?oe(this.hass,t.stops[0][0]):t.stops[0][0],i=n?oe(this.hass,t.stops[t.stops.length-1][0]):t.stops[t.stops.length-1][0],s=n?X(this.hass):t.unit,a=l=>M(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:${ja(this.heatMode,e)}"></span>
|
||||
<span class="nf-legend-range"><span>${W(this.hass,o,0)} ${s}</span><span>${W(this.hass,i,0)} ${s}</span></span>
|
||||
${this.heatValues.size?f:m`<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)=>A(e,c,u),o=t.floors.flatMap(c=>c.furniture.filter(u=>oi(u.type)).map(u=>ii(e,this.furnitureLinks?.get(u.id)?.entity??this.furnitureLinks?.get(u.id)?.power??null))),s=o.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=pc(a);return m`<div class="nf-legend">
|
||||
${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)=>M(e,c,u),o=t.floors.flatMap(c=>c.furniture.filter(u=>oi(u.type)).map(u=>ii(e,this.furnitureLinks?.get(u.id)?.entity??this.furnitureLinks?.get(u.id)?.power??null))),s=o.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=mc(a);return p`<div class="nf-legend">
|
||||
<b>📶 ${n("heat_wifi")}</b>
|
||||
<span>${n("wifi_aps",{n:o.length,clients:s})}</span>
|
||||
${l.online+l.offline.length?m`<span>${n("wifi_network",{online:l.online,offline:l.offline.length})}</span>`:f}
|
||||
${l.offline.length?m`<span class="nf-legend-none">${l.offline.slice(0,4).join(", ")}</span>`:f}
|
||||
${o.length?f:m`<span class="nf-legend-none">${n("wifi_none")}</span>`}
|
||||
</div>`}skyColor(){let e=un[this.theme]??un.neon,t=this._sky;return e.night[0].map((n,o)=>Math.round(n+(e.day[0][o]-n)*t))}render(){let e=this._sky,t=(i,s)=>`rgb(${i.map((a,l)=>Math.round(a+(s[l]-a)*e)).join(",")})`,n=un[this.theme]??un.neon,o=`--nf-sky:${t(n.night[0],n.day[0])};--nf-ground:${t(n.night[1],n.day[1])}`+dl(this.building?.settings.backdrop);return m`<div
|
||||
${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}
|
||||
${o.length?f:p`<span class="nf-legend-none">${n("wifi_none")}</span>`}
|
||||
</div>`}skyColor(){let e=un[this.theme]??un.neon,t=this._sky;return e.night[0].map((n,o)=>Math.round(n+(e.day[0][o]-n)*t))}render(){let e=this._sky,t=(i,s)=>`rgb(${i.map((a,l)=>Math.round(a+(s[l]-a)*e)).join(",")})`,n=un[this.theme]??un.neon,o=`--nf-sky:${t(n.night[0],n.day[0])};--nf-ground:${t(n.night[1],n.day[1])}`+dl(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=${o}
|
||||
>
|
||||
${this._error?m`<p class="nf-error">${this._error}</p>`:f} ${this.renderTopLeft()} ${bc(this.hass,this._liveCards,(i,s,a,l)=>this.hass?.callService(i,s,{entity_id:a,...l}),{folded:this._houseFolded,toggle:()=>this.toggleHouseFold()},!!this.roomId||this.panelOpen)} ${this.clean?f:this.renderLegend()} ${this.renderMapCredit()}
|
||||
${this.renderAlerts()} ${this.renderAnnouncement()} ${this.clean?f:m`${this.renderThumbs()} ${this.renderScenes()} ${this.renderFind()} ${this.renderCentral()}`} ${this.renderSwipe()}
|
||||
${this._error?p`<p class="nf-error">${this._error}</p>`:f} ${this.renderTopLeft()} ${bc(this.hass,this._liveCards,(i,s,a,l)=>this.hass?.callService(i,s,{entity_id:a,...l}),{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.showStats&&this._stats?m`<span class="nf-stats"
|
||||
><b>${this._stats.fps?A(this.hass,"stats_fps",{fps:this._stats.fps,ms:this._stats.worstMs}):A(this.hass,"stats_idle")}</b>
|
||||
${this._stats.busy.length?m`(${this._stats.busy.map(i=>A(this.hass,`stats_busy_${i}`)).join(", ")})`:f} ·
|
||||
${A(this.hass,"stats",{calls:this._stats.calls,tris:this._stats.triangles.toLocaleString()})} ·
|
||||
${A(this.hass,this._stats.low?"stats_low":"stats_full",{r:W(this.hass,this._stats.pixelRatio,2)})}</span
|
||||
${this.showStats&&this._stats?p`<span class="nf-stats"
|
||||
><b>${this._stats.fps?M(this.hass,"stats_fps",{fps:this._stats.fps,ms:this._stats.worstMs}):M(this.hass,"stats_idle")}</b>
|
||||
${this._stats.busy.length?p`(${this._stats.busy.map(i=>M(this.hass,`stats_busy_${i}`)).join(", ")})`:f} ·
|
||||
${M(this.hass,"stats",{calls:this._stats.calls,tris:this._stats.triangles.toLocaleString()})} ·
|
||||
${M(this.hass,this._stats.low?"stats_low":"stats_full",{r:W(this.hass,this._stats.pixelRatio,2)})}</span
|
||||
>`:f}
|
||||
</div>`}static styles=[$e,Ue,vc,ne`
|
||||
:host {
|
||||
@@ -2047,7 +2048,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
.nf-person[hidden] {
|
||||
display: none;
|
||||
}
|
||||
.nf-no-room-names .nf-pin {
|
||||
.nf-no-room-names .nf-pin[data-room] {
|
||||
display: none !important;
|
||||
}
|
||||
/* tablet level: blur over the canvas and glowing shadows are expensive on weak GPUs */
|
||||
@@ -3299,20 +3300,20 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
inset: auto 16px 16px;
|
||||
color: var(--nf-danger);
|
||||
}
|
||||
`]};customElements.get("nf-view3d")||customElements.define("nf-view3d",pi);function ae(r,e){return Math.abs(e)>=1e3?`${W(r,e/1e3,1)} kW`:`${Math.round(e)} W`}function hi(r){return r.type==="tv_board"?r.h+.9:r.type==="tv_wall"||r.type==="kitchen_wall"?r.h+.25:r.h+.35}function Tm(r,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:te(r,e)}var Hc;function Ic(){let r=new URL("./nextfloor-editor.js?v=dafe94a24af9",new URL(import.meta.url)).href;return Hc??=import(r),Hc}var Dm=.25,Cc=r=>Math.round(r*1e3)/1e3,Nc=(r,e,t)=>r.rooms.find(n=>n.points.length>=3&&H([e,t],n.points));function fi(r,e,t,n,o){let i=Nc(r,e,t);if(!i)return[n,o];let s=(a,l)=>H([a,l],i.points);return s(n,o)?[n,o]:s(n,t)?[n,t]:s(e,o)?[e,o]:[e,t]}function Fm(r,e,t,n){return r.rooms.some(o=>o.id!==e.id&&o.points.some((i,s)=>{let a=o.points[(s+1)%o.points.length];return Math.abs(ie(Y(i,t),n))<.02&&Math.abs(ie(Y(a,t),n))<.02}))}var mi=(r,e)=>Math.abs((r-e+540)%360-180);function Wc(r,e,t,n=Dm){let o=Nc(r,e.x,e.z);if(!o)return null;let i=o.points,s=rt(i)>=0?1:-1,a=null;return i.forEach((l,c)=>{let u=i[(c+1)%i.length],h=Fe(Y(u,l));if(h<.3)return;let p=[(u[0]-l[0])/h,(u[1]-l[1])/h],d=[-p[1]*s,p[0]*s],_=ie(Y([e.x,e.z],l),p);if(_<0||_>h)return;let b=Fm(r,o,l,d)?t/2:0,g=ie(Y([e.x,e.z],l),d)-b,v=Math.atan2(-d[0],d[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,E)=>mi(e.rotation,E.rotation)<mi(e.rotation,z.rotation)?E:z);if(mi(e.rotation,k.rotation)>50)return;let y=g-k.extent;Math.abs(y)>n||a&&Math.abs(y)>=Math.abs(a.gap)||(a={x:Cc(e.x-d[0]*y),z:Cc(e.z-d[1]*y),rotation:(Math.round(k.rotation)%360+360)%360,gap:y})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function Pr(r,e,t){let n=structuredClone(r);for(let o of n.floors){let i=o.furniture.find(s=>s.id===e);i&&t(i,o)}return n}function Hr(r,e,t){let n=structuredClone(r);for(let o of n.floors){let i=o.placements.find(s=>s.entity_id===e);i&&t(i,o)}return n}function Oc(r,e){let t=structuredClone(r);for(let n of t.floors)n.furniture=n.furniture.filter(o=>o.id!==e);return t}function Lc(r,e){let t=structuredClone(r);for(let n of t.floors)n.placements=n.placements.filter(o=>o.entity_id!==e);return t}function Bc(r,e,t,n){return Hr(r,e,(o,i)=>{[o.x,o.z]=fi(i,o.x,o.z,t,n)})}function Vc(r,e,t,n){let o=r.settings.wall_interior??.12;return Pr(r,e,(i,s)=>{[i.x,i.z]=fi(s,i.x,i.z,t,n);let a=Wc(s,i,o);a&&Object.assign(i,a)})}var gi=(r,e)=>((r+e)%360+360)%360,Kc=r=>Number.parseFloat(r.replace(",",".")),kn=(r,e)=>Math.round(r*10**e)/10**e;function _i(r){let{min:e,max:t,accepts:n=()=>!0}=r,o=i=>{let s=Kc(i.target.value);!Number.isFinite(s)||!n(s)||r.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return m`<label class="nf-size" title=${r.title}
|
||||
`]};customElements.get("nf-view3d")||customElements.define("nf-view3d",mi);function ae(r,e){return Math.abs(e)>=1e3?`${W(r,e/1e3,1)} kW`:`${Math.round(e)} W`}function hi(r){return r.type==="tv_board"?r.h+.9:r.type==="tv_wall"||r.type==="kitchen_wall"?r.h+.25:r.h+.35}function Tp(r,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:te(r,e)}var Hc;function Ic(){let r=new URL("./nextfloor-editor.js?v=ce9bb9f1371b",new URL(import.meta.url)).href;return Hc??=import(r),Hc}var Dp=.25,Cc=r=>Math.round(r*1e3)/1e3,Nc=(r,e,t)=>r.rooms.find(n=>n.points.length>=3&&H([e,t],n.points));function fi(r,e,t,n,o){let i=Nc(r,e,t);if(!i)return[n,o];let s=(a,l)=>H([a,l],i.points);return s(n,o)?[n,o]:s(n,t)?[n,t]:s(e,o)?[e,o]:[e,t]}function Fp(r,e,t,n){return r.rooms.some(o=>o.id!==e.id&&o.points.some((i,s)=>{let a=o.points[(s+1)%o.points.length];return Math.abs(ie(Y(i,t),n))<.02&&Math.abs(ie(Y(a,t),n))<.02}))}var pi=(r,e)=>Math.abs((r-e+540)%360-180);function Wc(r,e,t,n=Dp){let o=Nc(r,e.x,e.z);if(!o)return null;let i=o.points,s=rt(i)>=0?1:-1,a=null;return i.forEach((l,c)=>{let u=i[(c+1)%i.length],h=Fe(Y(u,l));if(h<.3)return;let m=[(u[0]-l[0])/h,(u[1]-l[1])/h],d=[-m[1]*s,m[0]*s],_=ie(Y([e.x,e.z],l),m);if(_<0||_>h)return;let b=Fp(r,o,l,d)?t/2:0,g=ie(Y([e.x,e.z],l),d)-b,v=Math.atan2(-d[0],d[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,E)=>pi(e.rotation,E.rotation)<pi(e.rotation,z.rotation)?E:z);if(pi(e.rotation,k.rotation)>50)return;let y=g-k.extent;Math.abs(y)>n||a&&Math.abs(y)>=Math.abs(a.gap)||(a={x:Cc(e.x-d[0]*y),z:Cc(e.z-d[1]*y),rotation:(Math.round(k.rotation)%360+360)%360,gap:y})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function Pr(r,e,t){let n=structuredClone(r);for(let o of n.floors){let i=o.furniture.find(s=>s.id===e);i&&t(i,o)}return n}function Hr(r,e,t){let n=structuredClone(r);for(let o of n.floors){let i=o.placements.find(s=>s.entity_id===e);i&&t(i,o)}return n}function Oc(r,e){let t=structuredClone(r);for(let n of t.floors)n.furniture=n.furniture.filter(o=>o.id!==e);return t}function Lc(r,e){let t=structuredClone(r);for(let n of t.floors)n.placements=n.placements.filter(o=>o.entity_id!==e);return t}function Bc(r,e,t,n){return Hr(r,e,(o,i)=>{[o.x,o.z]=fi(i,o.x,o.z,t,n)})}function Vc(r,e,t,n){let o=r.settings.wall_interior??.12;return Pr(r,e,(i,s)=>{[i.x,i.z]=fi(s,i.x,i.z,t,n);let a=Wc(s,i,o);a&&Object.assign(i,a)})}var gi=(r,e)=>((r+e)%360+360)%360,Kc=r=>Number.parseFloat(r.replace(",",".")),kn=(r,e)=>Math.round(r*10**e)/10**e;function _i(r){let{min:e,max:t,accepts:n=()=>!0}=r,o=i=>{let s=Kc(i.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(kn(r.value,2))} @change=${o} />
|
||||
</label>`}var Uc=(r,e)=>m`<button class="nf-chip" @click=${e}>${r.t("height_auto")}</button>`,Gc=(r,e)=>m`<button class="nf-chip" @click=${()=>e(-r)}>↺ ${r}°</button><button class="nf-chip" @click=${()=>e(r)}>↻ ${r}°</button>`;function Pm(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 o=(s,a)=>_i({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]=kn(l,3))}),i=_s(n)?m`${_i({label:"\u2195",title:r.t("mount_height"),value:n.mount_y??ce(t,n),step:.05,min:0,accepts:s=>s>=0,apply:s=>r.editFurniture(e,a=>a.mount_y=kn(s,3))})}
|
||||
${n.mount_y!=null?Uc(r,()=>r.editFurniture(e,s=>s.mount_y=null)):f}`:f;return m`${o("w","size_short_w")}${o("d","size_short_d")}${o("h","size_short_h")} ${i}`}function Hm(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 o=F(e),i=(l,c,u)=>m`<select class="nf-size-select" title=${r.t(l)} @change=${h=>r.editDevice(e,p=>Object.assign(p,{mount:h.target.value,y:null}))}>
|
||||
${c.map(([h,p])=>m`<option value=${h} ?selected=${h===u}>${p}</option>`)}
|
||||
</select>`,s=["ceiling","floor","table","wall"].map(l=>[l,r.t(`lamp_${l}`)]),a=o?yt(o,me(t,n.x,n.z),o==="light"?n.mount??"ceiling":null):1;return m`${o==="light"?i("lamp_mount",s,n.mount??"ceiling"):f}
|
||||
</label>`}var Uc=(r,e)=>p`<button class="nf-chip" @click=${e}>${r.t("height_auto")}</button>`,Gc=(r,e)=>p`<button class="nf-chip" @click=${()=>e(-r)}>↺ ${r}°</button><button class="nf-chip" @click=${()=>e(r)}>↻ ${r}°</button>`;function Pp(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 o=(s,a)=>_i({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]=kn(l,3))}),i=_s(n)?p`${_i({label:"\u2195",title:r.t("mount_height"),value:n.mount_y??ce(t,n),step:.05,min:0,accepts:s=>s>=0,apply:s=>r.editFurniture(e,a=>a.mount_y=kn(s,3))})}
|
||||
${n.mount_y!=null?Uc(r,()=>r.editFurniture(e,s=>s.mount_y=null)):f}`:f;return p`${o("w","size_short_w")}${o("d","size_short_d")}${o("h","size_short_h")} ${i}`}function Hp(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 o=F(e),i=(l,c,u)=>p`<select class="nf-size-select" title=${r.t(l)} @change=${h=>r.editDevice(e,m=>Object.assign(m,{mount:h.target.value,y:null}))}>
|
||||
${c.map(([h,m])=>p`<option value=${h} ?selected=${h===u}>${m}</option>`)}
|
||||
</select>`,s=["ceiling","floor","table","wall"].map(l=>[l,r.t(`lamp_${l}`)]),a=o?yt(o,pe(t,n.x,n.z),o==="light"?n.mount??"ceiling":null):1;return p`${o==="light"?i("lamp_mount",s,n.mount??"ceiling"):f}
|
||||
${_i({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=kn(l,3))})}
|
||||
${n.y!==null?Uc(r,()=>r.editDevice(e,l=>l.y=null)):f}`}function jc(r,e,t){let n=r.t,o;if(e){let i=r.building.floors.flatMap(s=>s.furniture).find(s=>s.id===e)?.type;o=m`<span>${i?he(r.hass,i):""}</span>
|
||||
${Pm(r,e)} ${Gc(45,s=>r.turnFurniture(e,s))}
|
||||
${n.y!==null?Uc(r,()=>r.editDevice(e,l=>l.y=null)):f}`}function jc(r,e,t){let n=r.t,o;if(e){let i=r.building.floors.flatMap(s=>s.furniture).find(s=>s.id===e)?.type;o=p`<span>${i?he(r.hass,i):""}</span>
|
||||
${Pp(r,e)} ${Gc(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?o=m`<span>${O(r.hass,t)}</span>
|
||||
${Hm(r,t)} ${Gc(45,i=>r.turnDevice(t,i))}
|
||||
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeDevice(t)}>${n("delete")}</button>`:o=m`<span>${n("furnish_hint")}</span>`;return m`<div class="nf-furnish-bar">${o}<button class="nf-chip nf-chip-on" @click=${()=>r.finish()}>${n("done")}</button></div>`}var qc=Q`<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?o=p`<span>${O(r.hass,t)}</span>
|
||||
${Hp(r,t)} ${Gc(45,i=>r.turnDevice(t,i))}
|
||||
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeDevice(t)}>${n("delete")}</button>`:o=p`<span>${n("furnish_hint")}</span>`;return p`<div class="nf-furnish-bar">${o}<button class="nf-chip nf-chip-on" @click=${()=>r.finish()}>${n("done")}</button></div>`}var qc=Q`<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"/>
|
||||
@@ -3803,21 +3804,21 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
gap: 12px;
|
||||
margin: auto;
|
||||
}
|
||||
`;var Qc=new WeakMap,Xc=new WeakMap;function dt(r,e){let t=Xc.get(r)??r,n=Qc.get(t)??new WeakMap;Qc.set(t,n);let o=n.get(e);if(o)return o;let i=new Map;for(let l of e)for(let c of l.placements)c.entity_id.startsWith("cover.")&&i.set(c.entity_id,{tilt:c.cover_tilt==="none"?null:c.cover_tilt,position:c.position});for(let l of Re(t,e).values())l.cover&&!i.has(l.cover)&&i.set(l.cover,{tilt:l.coverTilt,position:l.position}),l.cover2&&!i.has(l.cover2)&&i.set(l.cover2,{tilt:l.cover2Tilt});let s={...t.states};for(let[l,c]of i){let u=t.states[l];if(!u)continue;let h={...u.attributes,nf_cover_control:!0},p=xt(t,c.position);p===null&&(p=typeof u.attributes.current_position=="number"?u.attributes.current_position:null),p!==null&&(h.current_position=p);let d=c.tilt?t.states[c.tilt]:u,_=typeof d?.attributes.current_tilt_position=="number"?d.attributes.current_tilt_position:c.tilt?xt(t,c.tilt):null;_!==null&&(h.current_tilt_position=_,h.supported_features=Number(h.supported_features??0)|128);let b=u.state;typeof h.current_position=="number"&&b!=="unavailable"&&b!=="unknown"&&b!=="opening"&&b!=="closing"&&(b=h.current_position>0?"open":"closed"),s[l]={...u,state:b,attributes:h}}let a={...t,states:s,callService:async(l,c,u={})=>{if(l!=="cover")return t.callService(l,c,u);let h=Array.isArray(u.entity_id)?u.entity_id:[u.entity_id],p=async d=>{let _=typeof d=="string"?i.get(d):void 0;if(!_)return t.callService(l,c,{...u,entity_id:d});let b={...u,entity_id:d},g=c;(g==="toggle"||g==="toggle_cover")&&(g=s[String(d)]?.state==="closed"?"open_cover":"close_cover");let v=g.includes("tilt");v&&_.tilt&&(b.entity_id=_.tilt);let S=_.tilt?t.states[_.tilt]:void 0;return v&&_.tilt&&!S?.attributes.symcon_id&&typeof S?.attributes.current_tilt_position!="number"&&(g==="set_cover_tilt_position"?(g="set_cover_position",b.position=b.tilt_position,delete b.tilt_position):g==="open_cover_tilt"?g="open_cover":g==="close_cover_tilt"&&(g="close_cover")),t.callService(l,g,b)};return Array.isArray(u.entity_id)?Promise.all(h.map(p)):p(h[0])}};return Xc.set(a,t),n.set(e,a),a}var vi=class extends re{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 wt(this);store=new Ir(Cr());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:nt(ft(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=i=>`${String(Math.floor(i)).padStart(2,"0")}:${String(Math.round(i%1*60)).padStart(2,"0")}`,o=()=>{let i=new Date;return Math.round((i.getHours()+i.getMinutes()/60)*4)/4};return m`<button class="nf-chip" aria-pressed=${t!==null} title=${e("time_of_day_hint")} @click=${()=>(this._timeDrag=null,this._timeOfDay=t===null?o():null)}>☀ ${t===null?e("time_of_day"):n(t)}</button>
|
||||
${t!==null?m`<label class="nf-chip nf-time-slider"
|
||||
`;var Qc=new WeakMap,Xc=new WeakMap;function dt(r,e){let t=Xc.get(r)??r,n=Qc.get(t)??new WeakMap;Qc.set(t,n);let o=n.get(e);if(o)return o;let i=new Map;for(let l of e)for(let c of l.placements)c.entity_id.startsWith("cover.")&&i.set(c.entity_id,{tilt:c.cover_tilt==="none"?null:c.cover_tilt,position:c.position});for(let l of Re(t,e).values())l.cover&&!i.has(l.cover)&&i.set(l.cover,{tilt:l.coverTilt,position:l.position}),l.cover2&&!i.has(l.cover2)&&i.set(l.cover2,{tilt:l.cover2Tilt});let s={...t.states};for(let[l,c]of i){let u=t.states[l];if(!u)continue;let h={...u.attributes,nf_cover_control:!0},m=xt(t,c.position);m===null&&(m=typeof u.attributes.current_position=="number"?u.attributes.current_position:null),m!==null&&(h.current_position=m);let d=c.tilt?t.states[c.tilt]:u,_=typeof d?.attributes.current_tilt_position=="number"?d.attributes.current_tilt_position:c.tilt?xt(t,c.tilt):null;_!==null&&(h.current_tilt_position=_,h.supported_features=Number(h.supported_features??0)|128);let b=u.state;typeof h.current_position=="number"&&b!=="unavailable"&&b!=="unknown"&&b!=="opening"&&b!=="closing"&&(b=h.current_position>0?"open":"closed"),s[l]={...u,state:b,attributes:h}}let a={...t,states:s,callService:async(l,c,u={})=>{if(l!=="cover")return t.callService(l,c,u);let h=Array.isArray(u.entity_id)?u.entity_id:[u.entity_id],m=async d=>{let _=typeof d=="string"?i.get(d):void 0;if(!_)return t.callService(l,c,{...u,entity_id:d});let b={...u,entity_id:d},g=c;(g==="toggle"||g==="toggle_cover")&&(g=s[String(d)]?.state==="closed"?"open_cover":"close_cover");let v=g.includes("tilt");v&&_.tilt&&(b.entity_id=_.tilt);let S=_.tilt?t.states[_.tilt]:void 0;return v&&_.tilt&&!S?.attributes.symcon_id&&typeof S?.attributes.current_tilt_position!="number"&&(g==="set_cover_tilt_position"?(g="set_cover_position",b.position=b.tilt_position,delete b.tilt_position):g==="open_cover_tilt"?g="open_cover":g==="close_cover_tilt"&&(g="close_cover")),t.callService(l,g,b)};return Array.isArray(u.entity_id)?Promise.all(h.map(m)):m(h[0])}};return Xc.set(a,t),n.set(e,a),a}var vi=class extends re{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 wt(this);store=new Ir(Cr());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:nt(ft(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=i=>`${String(Math.floor(i)).padStart(2,"0")}:${String(Math.round(i%1*60)).padStart(2,"0")}`,o=()=>{let i=new Date;return Math.round((i.getHours()+i.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?o():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=${i=>this._timeDrag=Number(i.target.value)}
|
||||
@change=${i=>(this._timeDrag=null,this._timeOfDay=Number(i.target.value))}
|
||||
/></label>`:f}`}t=(e,t)=>A(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=Jt(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=>Pr(n,e,t)),editDevice:(e,t)=>this.applyEdit(n=>Hr(n,e,t)),turnFurniture:(e,t)=>this.applyEdit(n=>Pr(n,e,o=>o.rotation=gi(o.rotation,t))),turnDevice:(e,t)=>this.applyEdit(n=>Hr(n,e,o=>o.rotation=gi(o.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>Oc(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>Lc(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(o=>({...o,rooms:o.rooms.map(i=>i.id===e?{...i,moods:t.length?t:void 0}:i)}))}))}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&&or(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)),m`<div class="nf-app ${t?"nf-clean":""}" style=${this._prefs.accent?`--nf-accent:${this._prefs.accent}`:""}>
|
||||
${t?f:m`${this.renderHeader(e)}${this.renderNotices()}`}
|
||||
${this.data.error&&!e?m`<p class="nf-message">${this.t("load_error")}: ${this.data.error}</p>`:f}
|
||||
${!e&&!this.data.error?m`<p class="nf-message">${this.t("loading")}</p>`:f}
|
||||
/></label>`:f}`}t=(e,t)=>M(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=Jt(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=>Pr(n,e,t)),editDevice:(e,t)=>this.applyEdit(n=>Hr(n,e,t)),turnFurniture:(e,t)=>this.applyEdit(n=>Pr(n,e,o=>o.rotation=gi(o.rotation,t))),turnDevice:(e,t)=>this.applyEdit(n=>Hr(n,e,o=>o.rotation=gi(o.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>Oc(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>Lc(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(o=>({...o,rooms:o.rooms.map(i=>i.id===e?{...i,moods:t.length?t:void 0}:i)}))}))}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&&or(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}
|
||||
${n}
|
||||
</div>`}choiceRow(e,t,n,o,i,s=f){return m`<div class="nf-seg nf-quality" role=${e?"group":f} aria-label=${e?this.t(e):f}>
|
||||
${t.map(a=>m`<button aria-pressed=${n===a} title=${e==="markers"?this.t("markers"):f} @click=${()=>i(a)}>${o(a)}</button>`)}${s}
|
||||
</div>`}accentPicker(){let e=this._prefs.accent;return m`<label class="nf-accent-pick" title=${this.t("accent_hint")}>
|
||||
</div>`}choiceRow(e,t,n,o,i,s=f){return p`<div class="nf-seg nf-quality" role=${e?"group":f} aria-label=${e?this.t(e):f}>
|
||||
${t.map(a=>p`<button aria-pressed=${n===a} title=${e==="markers"?this.t("markers"):f} @click=${()=>i(a)}>${o(a)}</button>`)}${s}
|
||||
</div>`}accentPicker(){let e=this._prefs.accent;return p`<label class="nf-accent-pick" title=${this.t("accent_hint")}>
|
||||
<input type="color" .value=${e??"#37e0ff"} aria-label=${this.t("accent")} @input=${t=>this.setPref("accent",t.target.value)} />
|
||||
${e?m`<button class="nf-accent-reset" title=${this.t("accent_reset")} aria-label=${this.t("accent_reset")} @click=${()=>this.setPref("accent",null)}>↺</button>`:f}
|
||||
</label>`}renderViewOptions(){let e=this._prefs;return m`<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>
|
||||
${e?p`<button class="nf-accent-reset" title=${this.t("accent_reset")} aria-label=${this.t("accent_reset")} @click=${()=>this.setPref("accent",null)}>↺</button>`:f}
|
||||
</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",xr,e.theme,t=>this.t(`theme_${t}`),t=>this.setPref("theme",t),this.accentPicker())}
|
||||
@@ -3825,7 +3826,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
<label class="nf-seg nf-clock-pick" title=${this.t("clock")}
|
||||
>🕒
|
||||
<select aria-label=${this.t("clock")} @change=${t=>this.setPref("clock",t.target.value)}>
|
||||
${["none","top_left","top_right","bottom_left","bottom_right"].map(t=>m`<option value=${t} ?selected=${e.clock===t}>${this.t(`clock_${t}`)}</option>`)}
|
||||
${["none","top_left","top_right","bottom_left","bottom_right"].map(t=>p`<option value=${t} ?selected=${e.clock===t}>${this.t(`clock_${t}`)}</option>`)}
|
||||
</select>
|
||||
</label>
|
||||
<label class="nf-seg nf-glass-pick" title=${this.t("view_zoom_hint")}
|
||||
@@ -3857,59 +3858,62 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
<button aria-pressed=${e.readable} title=${this.t("readable_hint")} @click=${()=>this.setPref("readable",!e.readable)}>Aa ${this.t("readable")}</button>
|
||||
<button aria-pressed=${e.stats} title=${this.t("fps_title")} @click=${()=>this.setPref("stats",!e.stats)}>${this.t("fps")}</button>
|
||||
</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.data.saveState,n=(i,s,a="")=>m`<button role="tab" class=${a} aria-pressed=${this._mode===i} @click=${()=>this.setMode(i)}>${s}</button>`,o=t==="saving"?"saving":t==="saved"?"saved":"save_error";return m`<header class="nf-header">
|
||||
</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.data.saveState,n=(i,s,a="")=>p`<button role="tab" class=${a} aria-pressed=${this._mode===i} @click=${()=>this.setMode(i)}>${s}</button>`,o=t==="saving"?"saving":t==="saved"?"saved":"save_error";return p`<header class="nf-header">
|
||||
<ha-menu-button .hass=${this.hass} .narrow=${this.narrow}></ha-menu-button>
|
||||
<h1>${qc}NextFloor</h1>
|
||||
${this.isAdmin?m`<div class="nf-seg" role="tablist">${n("view",this.t("view"))}${n("editor",this.t("editor"))}${n("extensions",`\u2726 ${this.t("ext_tab")}`,"nf-tab-ext")}</div>`:f}
|
||||
${this.isAdmin?p`<div class="nf-seg" role="tablist">${n("view",this.t("view"))}${n("editor",this.t("editor"))}${n("extensions",`\u2726 ${this.t("ext_tab")}`,"nf-tab-ext")}</div>`:f}
|
||||
<span class="nf-grow"></span>
|
||||
${this.isAdmin&&this.hass.symconRefresh?m`<button class="nf-btn nf-reload-variables" ?disabled=${this._variablesLoading} aria-busy=${this._variablesLoading} @click=${()=>{this.reloadVariables()}}>↻ ${this.t(this._variablesLoading?"symcon_variables_loading":"symcon_variables_reload")}</button>`:f}
|
||||
${this._mode==="view"&&e?.floors.some(i=>i.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}
|
||||
${this.isAdmin&&this.hass.symconRefresh?p`<button class="nf-btn nf-reload-variables" ?disabled=${this._variablesLoading} aria-busy=${this._variablesLoading} @click=${()=>{this.reloadVariables()}}>↻ ${this.t(this._variablesLoading?"symcon_variables_loading":"symcon_variables_reload")}</button>`:f}
|
||||
${this._mode==="view"&&e?.floors.some(i=>i.rooms.length)?this.renderViewOptions():f}
|
||||
${this._mode==="editor"&&t!=="idle"?m`<span class="nf-save nf-save-${t}">${this.t(o)}</span>`:f}
|
||||
${this._mode==="editor"&&t!=="idle"?p`<span class="nf-save nf-save-${t}">${this.t(o)}</span>`:f}
|
||||
<span class="nf-version" title=${this.t("version_hint",{backend:this.data.backendVersion??"?"})}>v${this.data.frontendVersion}</span>
|
||||
</header>`}renderNotices(){let e=this.data,t=[];if(this._variablesNotice&&t.push(m`<div class="nf-notice ${this._variablesError?"nf-notice-error":""}" role=${this._variablesError?"alert":"status"}>${this._variablesNotice}</div>`),e.needsRestart&&t.push(e.versionGap==="frontend"?m`<div class="nf-notice nf-notice-warn">
|
||||
</header>`}renderNotices(){let e=this.data,t=[];if(this._variablesNotice&&t.push(p`<div class="nf-notice ${this._variablesError?"nf-notice-error":""}" role=${this._variablesError?"alert":"status"}>${this._variablesNotice}</div>`),e.needsRestart&&t.push(e.versionGap==="frontend"?p`<div class="nf-notice nf-notice-warn">
|
||||
${this.t("needs_reload",{frontend:e.frontendVersion,backend:e.backendVersion??"?"})}
|
||||
<button class="nf-btn" @click=${()=>location.reload()}>${this.t("reload_page")}</button>
|
||||
</div>`:m`<div class="nf-notice nf-notice-warn">${e.backendVersion?this.t("needs_restart",{version:e.backendVersion,frontend:e.frontendVersion}):this.t("needs_restart_old")}</div>`),e.saveState==="error"&&e.saveError&&t.push(m`<div class="nf-notice nf-notice-error">${this.t("save_failed_detail",{error:e.saveError})}</div>`),e.draft&&this.isAdmin){let n=new Date(e.draft.savedAt).toLocaleString(this.hass?.language);t.push(m`<div class="nf-notice">
|
||||
</div>`:p`<div class="nf-notice nf-notice-warn">${e.backendVersion?this.t("needs_restart",{version:e.backendVersion,frontend:e.frontendVersion}):this.t("needs_restart_old")}</div>`),e.saveState==="error"&&e.saveError&&t.push(p`<div class="nf-notice nf-notice-error">${this.t("save_failed_detail",{error:e.saveError})}</div>`),e.draft&&this.isAdmin){let n=new Date(e.draft.savedAt).toLocaleString(this.hass?.language);t.push(p`<div class="nf-notice">
|
||||
<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?m`<div class="nf-notices">${t}</div>`:f}whenEditorLoaded(e){return this._editorReady?e():(Ic().then(()=>this._editorReady=!0,t=>this.data.error=String(t)),m`<div class="nf-empty"><p>${this.t("loading")}</p></div>`)}renderExtensions(){return this.whenEditorLoaded(()=>m`<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():(Ic().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(()=>m`<nf-editor
|
||||
@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"
|
||||
.hass=${this.hass}
|
||||
.building=${e}
|
||||
.narrow=${this.narrow}
|
||||
.roomLabels=${this._prefs.roomNames}
|
||||
@room-names-change=${t=>this.setPref("roomNames",t.detail.value)}
|
||||
.packs=${this.data.packs}
|
||||
.loadCardEditor=${Rn}
|
||||
@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(o=>o.id===this._floorId):e.floors.length===1?e.floors[0]:void 0;if(!t||!this.hass)return f;if(this._floorUndo){let o=this._floorUndo;return m`<button class="nf-chip" aria-pressed="true" @click=${()=>{for(let i of o)this.hass.callService(i.domain,i.service,i.data);this._floorUndo=null,clearTimeout(this.floorUndoTimer)}}>↶ ${this.t("all_off_undo")}</button>`}let n=an(sl(t).map(o=>this.hass.states[o]));return n.count<2?f:m`<button class="nf-chip" title=${this.t("all_off_floor",{floor:t.name,n:n.count})} @click=${()=>{for(let o of n.off)this.hass.callService(o.domain,o.service,o.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,o=this._prefs.navWrap,i=this.outsideIds(e).length?m`<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?m`<button class="nf-chip" aria-pressed=${this._floorId===null} @click=${()=>this.openFloor(null)}>${this.t("all_floors")}</button>
|
||||
${[...e.floors].reverse().map(c=>m`<button class="nf-chip" aria-pressed=${c.id===this._floorId} @click=${()=>this.openFloor(c.id)}>${c.name}</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(o=>o.id===this._floorId):e.floors.length===1?e.floors[0]:void 0;if(!t||!this.hass)return f;if(this._floorUndo){let o=this._floorUndo;return p`<button class="nf-chip" aria-pressed="true" @click=${()=>{for(let i of o)this.hass.callService(i.domain,i.service,i.data);this._floorUndo=null,clearTimeout(this.floorUndoTimer)}}>↶ ${this.t("all_off_undo")}</button>`}let n=an(sl(t).map(o=>this.hass.states[o]));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 o of n.off)this.hass.callService(o.domain,o.service,o.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,o=this._prefs.navWrap,i=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>`)}
|
||||
${i} ${this.allOffChip(e)}
|
||||
<span class="nf-sep"></span>`:m`${i} ${this.allOffChip(e)}`,a=t.flatMap(c=>[t.length>1&&c.rooms.length?m`<span class="nf-nav-floor">${c.name}</span>`:f,...c.rooms.map(u=>m`<button
|
||||
<span class="nf-sep"></span>`:p`${i} ${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
|
||||
class="nf-chip nf-room-chip"
|
||||
aria-pressed=${u.id===this._roomId}
|
||||
@click=${()=>{n&&(this._floorId=c.id),this._roomId=u.id===this._roomId?null:u.id,this._outside=!1}}
|
||||
>
|
||||
${u.name}
|
||||
</button>`)]),l=this.t(o?"nav_row":"nav_wrap");return m`<nav class="nf-nav ${o?"nf-nav-wrap":""}" @wheel=${this.onNavWheel}>
|
||||
</button>`)]),l=this.t(o?"nav_row":"nav_wrap");return p`<nav class="nf-nav ${o?"nf-nav-wrap":""}" @wheel=${this.onNavWheel}>
|
||||
${s}${a}
|
||||
<button class="nf-chip nf-nav-toggle" title=${l} aria-label=${l} aria-pressed=${o} @click=${()=>this.setPref("navWrap",!o)}>${o?"\u2194":"\u2261"}</button>
|
||||
</nav>`}toggleChip(e,t,n){return m`<button class="nf-chip" aria-pressed=${this._prefs[e]} title=${n?this.t(n):f} @click=${()=>this.setPref(e,!this._prefs[e])}>${this.t(t)}</button>`}renderOverlay(e){let t=this._prefs,n=this.t,o=(u,h)=>m`<div class="nf-seg">${[u,h].map(([p,d,_])=>m`<button aria-pressed=${p} @click=${d}>${_}</button>`)}</div>`,i=["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],s=["dim","stacked","single"],a=e.floors.length>1,l=this._roomId||this._floorId&&a?m`<button class="nf-chip" @click=${()=>this.back()}>${n("back")}</button>`:f,c=m`<button class="nf-chip" aria-haspopup="true" aria-expanded=${this._switchesOpen} @click=${()=>this._switchesOpen=!this._switchesOpen}>☰ ${n("bars_unfold")} <span class="nf-caret">${this._switchesOpen?"\u25BE":"\u25B4"}</span></button>`;return this._switchesOpen?m`<div class="nf-overlay">
|
||||
</nav>`}toggleChip(e,t,n){return p`<button class="nf-chip" aria-pressed=${this._prefs[e]} title=${n?this.t(n):f} @click=${()=>this.setPref(e,!this._prefs[e])}>${this.t(t)}</button>`}renderOverlay(e){let t=this._prefs,n=this.t,o=(u,h)=>p`<div class="nf-seg">${[u,h].map(([m,d,_])=>p`<button aria-pressed=${m} @click=${d}>${_}</button>`)}</div>`,i=["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],s=["dim","stacked","single"],a=e.floors.length>1,l=this._roomId||this._floorId&&a?p`<button class="nf-chip" @click=${()=>this.back()}>${n("back")}</button>`:f,c=p`<button class="nf-chip" aria-haspopup="true" aria-expanded=${this._switchesOpen} @click=${()=>this._switchesOpen=!this._switchesOpen}>☰ ${n("bars_unfold")} <span class="nf-caret">${this._switchesOpen?"\u25BE":"\u25B4"}</span></button>`;return this._switchesOpen?p`<div class="nf-overlay">
|
||||
<div class="nf-switches-veil" @click=${()=>this._switchesOpen=!1}></div>
|
||||
<div class="nf-switches" role="group" aria-label=${n("bars_unfold")} @keydown=${u=>u.key==="Escape"&&(this._switchesOpen=!1)}>
|
||||
<div class="nf-seg">
|
||||
${["auto","cut","slope"].map(u=>m`<button aria-pressed=${this._wallMode===u} title=${u==="slope"?n("walls_slope_hint"):f} @click=${()=>this._wallMode=u}>${n(`walls_${u}`)}</button>`)}
|
||||
${["auto","cut","slope"].map(u=>p`<button aria-pressed=${this._wallMode===u} title=${u==="slope"?n("walls_slope_hint"):f} @click=${()=>this._wallMode=u}>${n(`walls_${u}`)}</button>`)}
|
||||
</div>
|
||||
<div class="nf-seg"><button aria-pressed=${t.solidWalls} title=${n("walls_solid_hint")} @click=${()=>this.setPref("solidWalls",!t.solidWalls)}>${n("walls_solid")}</button></div>
|
||||
${a&&!this._floorId?o([t.explode,()=>this.setPref("explode",!0),n("floors_apart")],[!t.explode,()=>this.setPref("explode",!1),n("floors_stacked")]):f}
|
||||
${!this._floorId&&e.settings.roof.type!=="none"?m`<div class="nf-seg"><button aria-pressed=${t.keepRoof} title=${n("roof_keep_hint")} @click=${()=>this.setPref("keepRoof",!t.keepRoof)}>${n("roof_keep")}</button></div>`:f}
|
||||
${a&&this._floorId?m`<div class="nf-seg" role="group" aria-label=${n("card_floor_stack")}>
|
||||
${s.map(u=>m`<button aria-pressed=${t.floorStack===u} @click=${()=>this.setPref("floorStack",u)}>${n(`floor_stack_short_${u}`)}</button>`)}
|
||||
${!this._floorId&&e.settings.roof.type!=="none"?p`<div class="nf-seg"><button aria-pressed=${t.keepRoof} title=${n("roof_keep_hint")} @click=${()=>this.setPref("keepRoof",!t.keepRoof)}>${n("roof_keep")}</button></div>`:f}
|
||||
${a&&this._floorId?p`<div class="nf-seg" role="group" aria-label=${n("card_floor_stack")}>
|
||||
${s.map(u=>p`<button aria-pressed=${t.floorStack===u} @click=${()=>this.setPref("floorStack",u)}>${n(`floor_stack_short_${u}`)}</button>`)}
|
||||
</div>`:f}
|
||||
<div class="nf-seg" role="group" aria-label=${n("heatmap")}>
|
||||
${i.map(u=>m`<button aria-pressed=${t.heat===u} @click=${()=>this.setPref("heat",u)}>${n(u==="none"?"heat_off":`heat_short_${u}`)}</button>`)}
|
||||
${i.map(u=>p`<button aria-pressed=${t.heat===u} @click=${()=>this.setPref("heat",u)}>${n(u==="none"?"heat_off":`heat_short_${u}`)}</button>`)}
|
||||
</div>
|
||||
${this.toggleChip("roomNames","room_names_short")}
|
||||
|
||||
@@ -3917,10 +3921,10 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
${t.timeSlider?this.renderTimeOfDay():f}
|
||||
</div>
|
||||
${c}${l}
|
||||
</div>`:m`<div class="nf-overlay">${c}${l}</div>`}renderView(e){if(!e.floors.some(o=>o.rooms.length))return m`<div class="nf-empty">
|
||||
</div>`:p`<div class="nf-overlay">${c}${l}</div>`}renderView(e){if(!e.floors.some(o=>o.rooms.length))return p`<div class="nf-empty">
|
||||
<p>${this.t(this.isAdmin?e.floors.length?"no_rooms_admin":"no_building_admin":"no_building")}</p>
|
||||
${this.isAdmin?m`<button class="nf-btn nf-primary" @click=${()=>this.setMode("editor")}>${this.t("open_editor")}</button>`:f}
|
||||
</div>`;let t=this._prefs,n=e.floors.flatMap(o=>o.rooms).find(o=>o.id===this._roomId)??null;return this.furnishHost.hass=this.hass,this.furnishHost.building=e,m`
|
||||
${this.isAdmin?p`<button class="nf-btn nf-primary" @click=${()=>this.setMode("editor")}>${this.t("open_editor")}</button>`:f}
|
||||
</div>`;let t=this._prefs,n=e.floors.flatMap(o=>o.rooms).find(o=>o.id===this._roomId)??null;return this.furnishHost.hass=this.hass,this.furnishHost.building=e,p`
|
||||
${t.clean?f:this.renderNav(e)}
|
||||
<div class="nf-stage-wrap ${this._roomId?"nf-room-open":""}">
|
||||
<nf-view3d
|
||||
@@ -3972,7 +3976,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
@floor-tap=${o=>this.openFloor(o.detail.floorId)}
|
||||
@back=${()=>this.back()}
|
||||
></nf-view3d>
|
||||
${n?m`<nf-room-panel
|
||||
${n?p`<nf-room-panel
|
||||
.building=${this.data.building??null}
|
||||
class="nf-room-panel"
|
||||
.hass=${dt(this.hass,e.floors)}
|
||||
@@ -3983,7 +3987,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
.rooms=${e.floors.flatMap(o=>o.rooms)}
|
||||
@mood-change=${o=>this.saveMoods(o.detail.roomId,o.detail.moods)}
|
||||
@close=${()=>this._roomId=null}
|
||||
></nf-room-panel>`:this._outside?m`<nf-room-panel
|
||||
></nf-room-panel>`:this._outside?p`<nf-room-panel
|
||||
.building=${this.data.building??null}
|
||||
class="nf-room-panel"
|
||||
.hass=${dt(this.hass,e.floors)}
|
||||
@@ -3996,7 +4000,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
${t.clean?f:this.renderOverlay(e)}
|
||||
${this._furnish?jc(this.furnishHost,this._selFurniture,this._selDevice):f}
|
||||
</div>
|
||||
`}static styles=[$e,Ue,Jc,gr]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",vi);var Im=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,eu=(r,e)=>Number(r)*60+Number(e);function Sn(r,e,t=new Date){if(!r||r==="off")return!1;if(r==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let n=Im.exec(r.trim());if(!n)return!1;let o=eu(n[1],n[2]),i=eu(n[3],n[4]),s=t.getHours()*60+t.getMinutes();return o>i?s>=o||s<i:s>=o&&s<i}var Nr=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(Sn(this.host.config()?.night,this.host.hass())),6e4)}stop(){clearTimeout(this.cleanTimer),clearTimeout(this.idleTimer),clearInterval(this.nightTimer)}};function tu(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 nu=ne`
|
||||
`}static styles=[$e,Ue,Jc,gr]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",vi);var Ip=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,eu=(r,e)=>Number(r)*60+Number(e);function Sn(r,e,t=new Date){if(!r||r==="off")return!1;if(r==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let n=Ip.exec(r.trim());if(!n)return!1;let o=eu(n[1],n[2]),i=eu(n[3],n[4]),s=t.getHours()*60+t.getMinutes();return o>i?s>=o||s<i:s>=o&&s<i}var Nr=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(Sn(this.host.config()?.night,this.host.hass())),6e4)}stop(){clearTimeout(this.cleanTimer),clearTimeout(this.idleTimer),clearInterval(this.nightTimer)}};function tu(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 nu=ne`
|
||||
ha-card {
|
||||
overflow: hidden;
|
||||
background: var(--nf-bg);
|
||||
@@ -4120,20 +4124,20 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
`;function wi(r,e){let t=r.template,n=t?e?.[t]:void 0;if(!n)return r;let{type:o,template:i,...s}=n;return{...s,...r}}function ru(r,e){let t=new Set(e),n=[];for(let i of r.floors){let s=i.rooms.filter(c=>t.has(c.id));if(!s.length)continue;let a=(c,u)=>s.some(h=>h.points.length>=3&&H([c,u],h.points)),l=new Set(s.map(c=>c.id));n.push({...i,rooms:s,openings:i.openings.filter(c=>l.has(c.room_id)),furniture:i.furniture.filter(c=>a(c.x,c.z)),placements:i.placements.filter(c=>a(c.x,c.z)),walls:(i.walls??[]).filter(c=>a((c.a[0]+c.b[0])/2,(c.a[1]+c.b[1])/2)),outdoor:[]})}let o={...r.settings.roof,type:"none",sections:[],solar:[]};return{...r,floors:n,settings:{...r.settings,roof:o}}}var Ct="nf-outside",yi=class extends re{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}};_own=null;templatesSeen;roomApplied=!1;data=new wt(this);kiosk=new Nr({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}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 Rn(),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._own=e,this._config=wi(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=Sn(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=wi(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=Sn(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:ru(e,t)}),this.roomsMemo.result}t=e=>A(this.hass,e);stage(){let e=this.plan(),t=this._config,n=this._floorId===void 0?t?.floor??null:this._floorId,o=e&&e.floors.length===1?e.floors[0].id:e?.floors.some(a=>a.id===n)?n:null,i=!!this._roomId&&t?.room_panel!==!1,s=!!this._roomId&&t?.room_panel===!1||!this.thumbs&&this.canSwitch&&!this._roomId&&!!o&&(e?.floors.length??0)>1;return{floorId:o,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&&!i)}}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,o=["temperature","humidity","co2"].filter(s=>this.shows(s)),i=(s,a)=>m`<div class="nf-seg" role=${s?"group":f} aria-label=${s??f}>${a.map(([l,c,u])=>m`<button aria-pressed=${l} @click=${c}>${u}</button>`)}</div>`;return m`<div class="nf-card-controls">
|
||||
${e.canGoBack?m`<button class="nf-chip" @click=${()=>this.back()}>${n("back")}</button>`:f}
|
||||
`;function wi(r,e){let t=r.template,n=t?e?.[t]:void 0;if(!n)return r;let{type:o,template:i,...s}=n;return{...s,...r}}function ru(r,e){let t=new Set(e),n=[];for(let i of r.floors){let s=i.rooms.filter(c=>t.has(c.id));if(!s.length)continue;let a=(c,u)=>s.some(h=>h.points.length>=3&&H([c,u],h.points)),l=new Set(s.map(c=>c.id));n.push({...i,rooms:s,openings:i.openings.filter(c=>l.has(c.room_id)),furniture:i.furniture.filter(c=>a(c.x,c.z)),placements:i.placements.filter(c=>a(c.x,c.z)),walls:(i.walls??[]).filter(c=>a((c.a[0]+c.b[0])/2,(c.a[1]+c.b[1])/2)),outdoor:[]})}let o={...r.settings.roof,type:"none",sections:[],solar:[]};return{...r,floors:n,settings:{...r.settings,roof:o}}}var Ct="nf-outside",yi=class extends re{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 wt(this);kiosk=new Nr({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 Rn(),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=wi(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=Sn(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=wi(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=Sn(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:ru(e,t)}),this.roomsMemo.result}t=e=>M(this.hass,e);stage(){let e=this.plan(),t=this._config,n=this._floorId===void 0?t?.floor??null:this._floorId,o=e&&e.floors.length===1?e.floors[0].id:e?.floors.some(a=>a.id===n)?n:null,i=!!this._roomId&&t?.room_panel!==!1,s=!!this._roomId&&t?.room_panel===!1||!this.thumbs&&this.canSwitch&&!this._roomId&&!!o&&(e?.floors.length??0)>1;return{floorId:o,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&&!i)}}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,o=["temperature","humidity","co2"].filter(s=>this.shows(s)),i=(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")?i(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?i(void 0,[[e.explode,()=>this._explode=!0,n("floors_apart")],[!e.explode,()=>this._explode=!1,n("floors_stacked")]]):f}
|
||||
${o.length>0?i(n("heatmap"),["none",...o].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=tu(t,e.floorId);if(!n.length)return f;let o=n.length>1,i=(l,c)=>{this.canSwitch&&l!==e.floorId&&(this._floorId=l),this._roomId=c===this._roomId?null:c},s=Jt(this.hass,t.floors).length>0,a=()=>{this.canSwitch&&(this._floorId=null),this._roomId=this._roomId===Ct?null:Ct};return m`<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=>m`${o?m`<span class="nf-card-rooms-floor">${l.floorName}</span>`:f}${l.rooms.map(c=>m`<button class="nf-chip" aria-pressed=${c.id===this._roomId} @click=${()=>i(l.floorId,c.id)}>${c.name}</button>`)}`)}
|
||||
${s?m`<button class="nf-chip" aria-pressed=${this._roomId===Ct} 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 m`${e?.fullscreen_button&&!n?m`<button class="nf-card-full" title=${t(this._fullscreen?"fullscreen_exit":"fullscreen")} aria-label=${t(this._fullscreen?"fullscreen_exit":"fullscreen")} @click=${()=>this.toggleFullscreen()}>
|
||||
</div>`}renderRoomButtons(e){let t=this.plan();if(!this._config?.room_buttons||!t||this._clean)return f;let n=tu(t,e.floorId);if(!n.length)return f;let o=n.length>1,i=(l,c)=>{this.canSwitch&&l!==e.floorId&&(this._floorId=l),this._roomId=c===this._roomId?null:c},s=Jt(this.hass,t.floors).length>0,a=()=>{this.canSwitch&&(this._floorId=null),this._roomId=this._roomId===Ct?null:Ct};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`${o?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=${()=>i(l.floorId,c.id)}>${c.name}</button>`)}`)}
|
||||
${s?p`<button class="nf-chip" aria-pressed=${this._roomId===Ct} 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?m`<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?m`<span>${e.dashboard_label}</span>`:"\u2302"}
|
||||
</button>`:f}`}renderStage(e){let t=this.plan(),n=this._config,o=()=>{this._clean=!this._clean,this._clean?this.kiosk.stopClean():this.kiosk.armClean()},i=n?.controls_hidden!==void 0||(n?.controls_hide_after??0)>0;return m`<nf-view3d
|
||||
${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,o=()=>{this._clean=!this._clean,this._clean?this.kiosk.stopClean():this.kiosk.armClean()},i=n?.controls_hidden!==void 0||(n?.controls_hide_after??0)>0;return p`<nf-view3d
|
||||
.hass=${dt(this.hass,t.floors)}
|
||||
.building=${t}
|
||||
.packs=${this.data.packs}
|
||||
@@ -4173,7 +4177,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
.flows=${n?.flows??null}
|
||||
.holograms=${n?.holograms??null}
|
||||
.floorThumbs=${this.thumbs}
|
||||
.roomLabels=${n?.room_names!==!1}
|
||||
.roomLabels=${this._roomNames??n?.room_names!==!1}
|
||||
.roomNamesButton=${!0}
|
||||
@room-names-change=${s=>this._roomNames=s.detail.value}
|
||||
.floorStack=${n?.floor_stack??"dim"}
|
||||
.panelOpen=${!!this._roomId&&n?.room_panel!==!1}
|
||||
.alerts=${n?.alerts!==!1}
|
||||
@@ -4196,7 +4202,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
@room-tap=${s=>{this.canSwitch&&t.floors.length>1&&s.detail.floorId&&e.floorId!==s.detail.floorId?(this._floorId=s.detail.floorId,this._roomId=null):s.detail.roomId&&(this._roomId=s.detail.roomId===this._roomId?null:s.detail.roomId)}}
|
||||
@floor-tap=${s=>{this._floorId=s.detail.floorId,this._roomId=null}}
|
||||
@back=${()=>this.back()}
|
||||
></nf-view3d>`}renderRoomPanel(){let e=this.plan();return m`<nf-room-panel
|
||||
></nf-view3d>`}renderRoomPanel(){let e=this.plan();return p`<nf-room-panel
|
||||
.building=${this.plan()??null}
|
||||
class="nf-card-panel"
|
||||
.hass=${dt(this.hass,e.floors)}
|
||||
@@ -4206,15 +4212,15 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
.confirmEntities=${st(this.hass,e.floors)}
|
||||
.phrases=${e.settings.announce_phrases??null}
|
||||
@close=${()=>this._roomId=null}
|
||||
></nf-room-panel>`}render(){if(this.hass&&or(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(),o=this._fullscreen?"100vh":t?.fill?"calc(100vh - var(--header-height, 56px) - 16px)":`${t?.height??420}px`,i=/^#[0-9a-f]{6}$/i.test(t?.accent??"")?t.accent:null,s=()=>this.kiosk.touched();return m`<ha-card class=${this._night?"nf-night":""} style=${i?`--nf-accent:${i}`:""} @pointerdown=${s} @keydown=${s} @wheel=${s}>
|
||||
></nf-room-panel>`}render(){if(this.hass&&or(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(),o=this._fullscreen?"100vh":t?.fill?"calc(100vh - var(--header-height, 56px) - 16px)":`${t?.height??420}px`,i=/^#[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=${i?`--nf-accent:${i}`:""} @pointerdown=${s} @keydown=${s} @wheel=${s}>
|
||||
<div class="nf-card-body" style="height:${o}">
|
||||
${e&&e.floors.some(a=>a.rooms.length)?this.renderStage(n):m`<p class="nf-card-msg">${this.data.error??(e?A(this.hass,"no_building"):A(this.hass,"loading"))}</p>`}
|
||||
${e&&e.floors.some(a=>a.rooms.length)?this.renderStage(n):p`<p class="nf-card-msg">${this.data.error??(e?M(this.hass,"no_building"):M(this.hass,"loading"))}</p>`}
|
||||
${this._roomId&&e&&t?.room_panel!==!1?this.renderRoomPanel():f}
|
||||
${this.renderRoomButtons(n)}
|
||||
${n.showBar&&e?this.renderBar(n):f}
|
||||
${this.renderCorners()}
|
||||
</div>
|
||||
</ha-card>`}static styles=[$e,Ue,nu,gr]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",yi);let r=window;r.customCards=r.customCards??[],r.customCards.push({type:"nextfloor-card",name:A(void 0,"card_name"),description:A(void 0,"card_description"),preview:!1})}ro();
|
||||
</ha-card>`}static styles=[$e,Ue,nu,gr]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",yi);let r=window;r.customCards=r.customCards??[],r.customCards.push({type:"nextfloor-card",name:M(void 0,"card_name"),description:M(void 0,"card_description"),preview:!1})}ro();
|
||||
/*! Bundled license information:
|
||||
|
||||
@lit/reactive-element/css-tag.js:
|
||||
|
||||
Reference in new issue
Block a user