feat: improve Symcon controls, device readings and designer help

This commit is contained in:
jhartworks committed 2026-11-10 09:19:13 +01:00
1 parent ff54f4461a
commit 00fca890de
50 files changed
+2447 -1840

No files matched your search

+8
View File
@@ -6,6 +6,8 @@ All notable changes to NextFloor, newest first. Every release lists what is **Ad
### Added
- **Room illuminance and multiple device readings:** Rooms can link a brightness sensor and show lux with a sun symbol; CO₂ uses a cloud. A small + button adds device/furniture values with independent object-tree choices, custom symbols and optional labels, shown on device markers and in the room panel.
- **Floating room climate cards:** Each room can show temperature, humidity and CO₂ in a glass card above its own position, using its selected sensors. Cards follow live values and room/floor navigation and can be toggled without configuring an energy meter.
- **IP-Symcon variable reload:** A button in the designer title bar reloads the complete object tree, variables and current presentation metadata without closing the plan, with progress, success and error feedback.
@@ -14,12 +16,18 @@ All notable changes to NextFloor, newest first. Every release lists what is **Ad
### Changed
- **Designer help popups:** Explanations are opened through compact information symbols instead of occupying the forms. Keyboard and touch users can open and dismiss the dialogs.
- **Compact room climate cards:** Floating cards show symbols and values without repeating the room name or labels. Unlinked metrics and entirely empty cards are hidden; linked unavailable sensors retain a dash.
- **Foldable wall menu:** The wall settings in the room sidebar can be collapsed using their heading.
- **IP-Symcon picker main category:** Hidden categories and their variables always remain visible. I/O, splitter, core, configurator, discovery and visualization instances are grouped under a collapsed virtual “System” folder, with searchable/selectable descendants and no changes to the actual Symcon object tree.
### Fixed
- **IP-Symcon blind feedback and directions:** Numeric position feedback can be selected independently of inferred domains and is read using its native range. Blind and slat directions can be reversed separately across live readings, 3D geometry, sliders, buttons, swipes and grouped actions, without writing to feedback variables.
- **IP-Symcon room humidity selection:** Manual room-climate fields accept numeric Integer/Float variables even without inferred classes or profiles. German “Feuchtigkeit” and subscript “CO₂” names are recognized, and parent category names no longer override measurement classes.
- **IP-Symcon dimmers and venetian blinds:** Numeric variables can be explicitly linked as dimmers or blind controls independently of inferred names. Native integer/float ranges and steps are respected in both directions. Separate blind-height and slat-position variables can be selected in the object tree and controlled independently in the room panel and quick menu; dimmer sliders stay available while off.
@@ -1,7 +1,7 @@
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
var p={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"};var M=globalThis,N=M.ShadowRoot&&(M.ShadyCSS===void 0||M.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,V=Symbol(),me=new WeakMap,R=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==V)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(N&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=me.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&me.set(t,e))}return e}toString(){return this.cssText}},pe=i=>new R(typeof i=="string"?i:i+"",void 0,V),U=(i,...e)=>{let t=i.length===1?i[0]:e.reduce((n,r,o)=>n+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+i[o+1],i[0]);return new R(t,i,V)},fe=(i,e)=>{if(N)i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),r=M.litNonce;r!==void 0&&n.setAttribute("nonce",r),n.textContent=t.cssText,i.appendChild(n)}},j=N?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return pe(t)})(i):i;var{is:Ke,defineProperty:Ge,getOwnPropertyDescriptor:Oe,getOwnPropertyNames:Ie,getOwnPropertySymbols:Ze,getPrototypeOf:Ve}=Object,C=globalThis,ge=C.trustedTypes,Ue=ge?ge.emptyScript:"",je=C.reactiveElementPolyfillSupport,F=(i,e)=>i,q={toAttribute(i,e){switch(e){case Boolean:i=i?Ue:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},we=(i,e)=>!Ke(i,e),be={attribute:!0,type:String,converter:q,reflect:!1,useDefault:!1,hasChanged:we};Symbol.metadata??=Symbol("metadata"),C.litPropertyMetadata??=new WeakMap;var b=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=be){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(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&&Ge(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:o}=Oe(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:r,set(a){let s=r?.call(this);o?.call(this,a),this.requestUpdate(e,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??be}static _$Ei(){if(this.hasOwnProperty(F("elementProperties")))return;let e=Ve(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(F("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(F("properties"))){let t=this.properties,n=[...Ie(t),...Ze(t)];for(let r of n)this.createProperty(r,t[r])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,r]of t)this.elementProperties.set(n,r)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let r=this._$Eu(t,n);r!==void 0&&this._$Eh.set(r,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 r of n)t.unshift(j(r))}else e!==void 0&&t.push(j(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.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return fe(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.Line truncated
\f\r]`,x=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ye=/-->/g,Se=/>/g,S=RegExp(`>|${J}(?:([^\\s"'>=/]+)(${J}*=${J}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ae=/'/g,De=/"/g,Re=/^(?:script|style|textarea|title)$/i,ie=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),l=ie(1),ct=ie(2),ut=ie(3),z=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),ze=new WeakMap,A=D.createTreeWalker(D,129);function Fe(i,e){if(!re(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return ve!==void 0?ve.createHTML(e):e}var Xe=(i,e)=>{let t=i.length-1,n=[],r,o=e===2?"<svg>":e===3?"<math>":"",a=x;for(let s=0;s<t;s++){let h=i[s],u,m,_=-1,g=0;for(;g<h.length&&(a.lastIndex=g,m=a.exec(h),m!==null);)g=a.lastIndex,a===x?m[1]==="!--"?a=ye:m[1]!==void 0?a=Se:m[2]!==void 0?(Re.test(m[2])&&(r=RegExp("</"+m[2],"g")),a=S):m[3]!==void 0&&(a=S):a===S?m[0]===">"?(a=r??x,_=-1):m[1]===void 0?_=-2:(_=a.lastIndex-m[2].length,u=m[1],a=m[3]===void 0?S:m[3]==='"'?De:Ae):a===De||a===Ae?a=S:a===ye||a===Se?a=x:(a=S,r=void 0);let k=a===S&&i[s+1].startsWith("/>")?" ":"";o+=a===x?h+qe:_>=0?(n.push(u),h.slice(0,_)+Ee+h.slice(_)+v+k):h+v+(_===-2?s:k)}return[Fe(i,o+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},B=class i{constructor({strings:e,_$litType$:t},n){let r;this.parts=[];let o=0,a=0,s=e.length-1,h=this.parts,[u,m]=Xe(e,t);if(this.el=i.createElement(u,n),A.currentNode=this.el.content,t===2||t===3){let _=this.el.content.firstChild;_.replaceWith(..._.childNodes)}for(;(r=A.nextNode())!==null&&h.length<s;){if(r.nodeType===1){if(r.hasAttributes())for(let _ of r.getAttributeNames())if(_.endsWith(Ee)){let g=m[a++],k=r.getAttribute(_).split(v),L=/([.?@])?(.*)/.exec(g);h.push({type:1,index:o,name:L[2],strings:k,ctor:L[1]==="."?Y:L[1]==="?"?Q:L[1]==="@"?ee:T}),r.removeAttribute(_)}else _.startsWith(v)&&(h.push({type:6,index:o}),r.removeAttribute(_));if(Re.test(r.tagName)){let _=r.textContent.split(v),g=_.length-1;if(g>0){r.textContent=K?K.emptyScript:"";for(let k=0;k<g;k++)r.append(_[k],H()),A.nextNode(),h.push({type:2,index:++o});r.append(_[g],H())}}}else if(r.nodeType===8)if(r.data===Te)h.push({type:2,index:o});else{let _=-1;for(;(_=r.data.indexOf(v,_+1))!==-1;)h.push({type:7,index:o}),_+=v.length-1}o++}}static createElement(e,t){let n=D.createElement("template");return n.innerHTML=e,n}};function E(i,e,t=i,n){if(e===z)return e;let r=n!==void 0?t._$Co?.[n]:t._$Cl,o=W(e)?void 0:e._$litDirective$;return r?.constructor!==o&&(r?._$AO?.(!1),o===void 0?r=void 0:(r=new o(i),r._$AT(i,t,n)),n!==void 0?(t._$Co??=[])[n]=r:t._$Cl=r),r!==void 0&&(e=E(i,r._$AS(i,e.values),r,n)),e}var X=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,r=(e?.creationScope??D).importNode(t,!0);A.currentNode=r;let o=A.nextNode(),a=0,s=0,h=n[0];for(;h!==void 0;){if(a===h.index){let u;h.type===2?u=new P(o,o.nextSibling,this,e):h.type===1?u=new h.ctor(o,h.name,h.strings,this,e):h.type===6&&(u=new te(o,this,e)),this._$AV.push(u),h=n[++s]}a!==h?.index&&(o=A.nextNode(),a++)}return A.currentNode=D,r}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++}},P=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.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=E(this,e,t),W(e)?e===d||e==null||e===""?(this._$AH!==d&&this._$AR(),this._$AH=d):e!==this._$AH&&e!==z&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Je(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!==d&&W(this._$AH)?this._$AA.nextSibling.data=e:this.T(D.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,r=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=B.createElement(Fe(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{let o=new X(r,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=ze.get(e.strings);return t===void 0&&ze.set(e.strings,t=new B(e)),t}k(e){re(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,r=0;for(let o of e)r===t.length?t.push(n=new i(this.O(H()),this.O(H()),this,this.options)):n=t[r],n._$AI(o),r++;r<t.length&&(this._$AR(n&&n._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=ke(e).nextSibling;ke(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},T=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,o){this.type=1,this._$AH=d,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=o,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):thiLine truncated
var p={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"};var M=globalThis,N=M.ShadowRoot&&(M.ShadyCSS===void 0||M.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,V=Symbol(),me=new WeakMap,R=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==V)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(N&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=me.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&me.set(t,e))}return e}toString(){return this.cssText}},pe=i=>new R(typeof i=="string"?i:i+"",void 0,V),U=(i,...e)=>{let t=i.length===1?i[0]:e.reduce((n,r,o)=>n+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+i[o+1],i[0]);return new R(t,i,V)},fe=(i,e)=>{if(N)i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),r=M.litNonce;r!==void 0&&n.setAttribute("nonce",r),n.textContent=t.cssText,i.appendChild(n)}},j=N?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return pe(t)})(i):i;var{is:Ke,defineProperty:Ge,getOwnPropertyDescriptor:Oe,getOwnPropertyNames:Ie,getOwnPropertySymbols:Ze,getPrototypeOf:Ve}=Object,C=globalThis,ge=C.trustedTypes,Ue=ge?ge.emptyScript:"",je=C.reactiveElementPolyfillSupport,F=(i,e)=>i,q={toAttribute(i,e){switch(e){case Boolean:i=i?Ue:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},we=(i,e)=>!Ke(i,e),be={attribute:!0,type:String,converter:q,reflect:!1,useDefault:!1,hasChanged:we};Symbol.metadata??=Symbol("metadata"),C.litPropertyMetadata??=new WeakMap;var b=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=be){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(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&&Ge(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:o}=Oe(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:r,set(a){let s=r?.call(this);o?.call(this,a),this.requestUpdate(e,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??be}static _$Ei(){if(this.hasOwnProperty(F("elementProperties")))return;let e=Ve(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(F("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(F("properties"))){let t=this.properties,n=[...Ie(t),...Ze(t)];for(let r of n)this.createProperty(r,t[r])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,r]of t)this.elementProperties.set(n,r)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let r=this._$Eu(t,n);r!==void 0&&this._$Eh.set(r,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 r of n)t.unshift(j(r))}else e!==void 0&&t.push(j(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.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return fe(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.Line truncated
\f\r]`,W=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ye=/-->/g,Se=/>/g,S=RegExp(`>|${J}(?:([^\\s"'>=/]+)(${J}*=${J}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ae=/'/g,De=/"/g,Re=/^(?:script|style|textarea|title)$/i,ie=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),l=ie(1),ct=ie(2),ut=ie(3),z=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),ze=new WeakMap,A=D.createTreeWalker(D,129);function Fe(i,e){if(!re(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return ve!==void 0?ve.createHTML(e):e}var Xe=(i,e)=>{let t=i.length-1,n=[],r,o=e===2?"<svg>":e===3?"<math>":"",a=W;for(let s=0;s<t;s++){let h=i[s],u,m,_=-1,g=0;for(;g<h.length&&(a.lastIndex=g,m=a.exec(h),m!==null);)g=a.lastIndex,a===W?m[1]==="!--"?a=ye:m[1]!==void 0?a=Se:m[2]!==void 0?(Re.test(m[2])&&(r=RegExp("</"+m[2],"g")),a=S):m[3]!==void 0&&(a=S):a===S?m[0]===">"?(a=r??W,_=-1):m[1]===void 0?_=-2:(_=a.lastIndex-m[2].length,u=m[1],a=m[3]===void 0?S:m[3]==='"'?De:Ae):a===De||a===Ae?a=S:a===ye||a===Se?a=W:(a=S,r=void 0);let k=a===S&&i[s+1].startsWith("/>")?" ":"";o+=a===W?h+qe:_>=0?(n.push(u),h.slice(0,_)+Ee+h.slice(_)+v+k):h+v+(_===-2?s:k)}return[Fe(i,o+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},B=class i{constructor({strings:e,_$litType$:t},n){let r;this.parts=[];let o=0,a=0,s=e.length-1,h=this.parts,[u,m]=Xe(e,t);if(this.el=i.createElement(u,n),A.currentNode=this.el.content,t===2||t===3){let _=this.el.content.firstChild;_.replaceWith(..._.childNodes)}for(;(r=A.nextNode())!==null&&h.length<s;){if(r.nodeType===1){if(r.hasAttributes())for(let _ of r.getAttributeNames())if(_.endsWith(Ee)){let g=m[a++],k=r.getAttribute(_).split(v),L=/([.?@])?(.*)/.exec(g);h.push({type:1,index:o,name:L[2],strings:k,ctor:L[1]==="."?Y:L[1]==="?"?Q:L[1]==="@"?ee:T}),r.removeAttribute(_)}else _.startsWith(v)&&(h.push({type:6,index:o}),r.removeAttribute(_));if(Re.test(r.tagName)){let _=r.textContent.split(v),g=_.length-1;if(g>0){r.textContent=K?K.emptyScript:"";for(let k=0;k<g;k++)r.append(_[k],x()),A.nextNode(),h.push({type:2,index:++o});r.append(_[g],x())}}}else if(r.nodeType===8)if(r.data===Te)h.push({type:2,index:o});else{let _=-1;for(;(_=r.data.indexOf(v,_+1))!==-1;)h.push({type:7,index:o}),_+=v.length-1}o++}}static createElement(e,t){let n=D.createElement("template");return n.innerHTML=e,n}};function E(i,e,t=i,n){if(e===z)return e;let r=n!==void 0?t._$Co?.[n]:t._$Cl,o=H(e)?void 0:e._$litDirective$;return r?.constructor!==o&&(r?._$AO?.(!1),o===void 0?r=void 0:(r=new o(i),r._$AT(i,t,n)),n!==void 0?(t._$Co??=[])[n]=r:t._$Cl=r),r!==void 0&&(e=E(i,r._$AS(i,e.values),r,n)),e}var X=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,r=(e?.creationScope??D).importNode(t,!0);A.currentNode=r;let o=A.nextNode(),a=0,s=0,h=n[0];for(;h!==void 0;){if(a===h.index){let u;h.type===2?u=new P(o,o.nextSibling,this,e):h.type===1?u=new h.ctor(o,h.name,h.strings,this,e):h.type===6&&(u=new te(o,this,e)),this._$AV.push(u),h=n[++s]}a!==h?.index&&(o=A.nextNode(),a++)}return A.currentNode=D,r}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++}},P=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.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=E(this,e,t),H(e)?e===d||e==null||e===""?(this._$AH!==d&&this._$AR(),this._$AH=d):e!==this._$AH&&e!==z&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Je(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!==d&&H(this._$AH)?this._$AA.nextSibling.data=e:this.T(D.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,r=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=B.createElement(Fe(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{let o=new X(r,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=ze.get(e.strings);return t===void 0&&ze.set(e.strings,t=new B(e)),t}k(e){re(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,r=0;for(let o of e)r===t.length?t.push(n=new i(this.O(x()),this.O(x()),this,this.options)):n=t[r],n._$AI(o),r++;r<t.length&&(this._$AR(n&&n._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=ke(e).nextSibling;ke(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},T=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,o){this.type=1,this._$AH=d,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=o,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):thiLine truncated
<input type="checkbox" .checked=${e} @change=${o=>r(nt(o))} />
<span>${i.t(t)}${n?l`<small>${i.t(n)}</small>`:d}</span>
</label>`}var c=(i,e,t,n)=>f(i,i.value[e],t,n,r=>i.set(e,r)),se=(i,e,t,n)=>f(i,i.value[e],t,n,r=>i.set(e,r||void 0));function w(i,e,t,n,r){return l`<label class="field"
@@ -115,7 +115,7 @@ var p={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",f
grid-template-columns: 1fr;
}
}
`;var ce=globalThis,de=ce.__nextfloorBuiltin?.de??{},_e=ce.__nextfloorBuiltin?.en??{};ce.__nextfloorBuiltin??={de,en:_e};var $e=()=>typeof p=="object"&&p||{},rt=globalThis,Z=rt.__nextfloorTexts??=new Map;function Le(i){let e=i.toLowerCase().split("-")[0];return e!=="de"&&e!=="en"&&e in $e()?e:void 0}function it(i){let e=Le(i),t=e===void 0?void 0:Z.get(e);return t instanceof Promise?void 0:t}function Me(i,e){let t=Le(i?.language??navigator.language);if(t===void 0)return!1;let n=Z.get(t);return n===void 0&&(n=fetch(new URL(`./lang/${t}.json?v=${$e()[t]}`,import.meta.url)).then(r=>r.ok?r.json():{}).catch(()=>({})).then(r=>{Z.set(t,r&&typeof r=="object"?r:{})}),Z.set(t,n)),n instanceof Promise?(n.then(()=>e.requestUpdate()),!0):!1}function Ne(i,e,t={}){let n=i?.language??navigator.language,r=n.startsWith("de"),o=(r?void 0:it(n)?.[e])??(r?de:_e)[e]??_e[e]??de[e]??e;for(let[a,s]of Object.entries(t))o=o.replace(`{${a}}`,String(s));return o}var ue=class extends y{static properties={hass:{attribute:!1},_config:{state:!0},_floors:{state:!0},_rooms:{state:!0},_templates:{state:!0}};loading=!1;form;constructor(){super(),this._config={type:"custom:nextfloor-card"},this._floors=[],this._rooms=[],this._templates=[];let e=this;this.form={get value(){return{...ae,...e._config}},t:(t,n)=>Ne(e.hass,t,n),set:(t,n)=>e.write(t,n)}}setConfig(e){this._config=e}willUpdate(){this.hass&&!this.loading&&this._floors.length===0&&(this.loading=!0,He(this.hass).then(e=>{this._floors=e.building.floors.map(t=>({id:t.id,name:t.name})),this._templates=Object.keys(e.building.settings.card_templates??{}),this._rooms=e.building.floors.flatMap(t=>t.rooms.map(n=>({id:n.id,name:n.name,floor:t.name})))},()=>{}))}write(e,t){let n={...this._config};t===void 0||t===""||ae[e]===t?delete n[e]:n[e]=t,this.publish(n)}publish(e){this._config=e,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:e},bubbles:!0,composed:!0}))}roomsChoice(){if(this._rooms.length===0)return l``;let e=new Set(this._config.rooms??[]),t=(n,r)=>{let o=this._rooms.map(a=>a.id).filter(a=>a===n?r:e.has(a));this.form.set("rooms",o.length?o:void 0)};return l`<fieldset class="rooms">
`;var ce=globalThis,de=ce.__nextfloorBuiltin?.de??{},_e=ce.__nextfloorBuiltin?.en??{};ce.__nextfloorBuiltin??={de,en:_e};var $e=()=>typeof p=="object"&&p||{},rt=globalThis,Z=rt.__nextfloorTexts??=new Map;function Le(i){let e=i.toLowerCase().split("-")[0];return e!=="de"&&e!=="en"&&e in $e()?e:void 0}function it(i){let e=Le(i),t=e===void 0?void 0:Z.get(e);return t instanceof Promise?void 0:t}function Me(i,e){let t=Le(i?.language??navigator.language);if(t===void 0)return!1;let n=Z.get(t);return n===void 0&&(n=fetch(new URL(`./lang/${t}.json?v=${$e()[t]}`,import.meta.url)).then(r=>r.ok?r.json():{}).catch(()=>({})).then(r=>{Z.set(t,r&&typeof r=="object"?r:{})}),Z.set(t,n)),n instanceof Promise?(n.then(()=>e.requestUpdate()),!0):!1}function Ne(i,e,t={}){let n=i?.language??navigator.language,r=n.startsWith("de"),o=(r?void 0:it(n)?.[e])??(r?de:_e)[e]??_e[e]??de[e]??e;for(let[a,s]of Object.entries(t))o=o.replace(`{${a}}`,String(s));return o}var ue=class extends y{static properties={hass:{attribute:!1},_config:{state:!0},_floors:{state:!0},_rooms:{state:!0},_templates:{state:!0}};loading=!1;form;constructor(){super(),this._config={type:"custom:nextfloor-card"},this._floors=[],this._rooms=[],this._templates=[];let e=this;this.form={get value(){return{...ae,...e._config}},t:(t,n)=>Ne(e.hass,t,n),set:(t,n)=>e.write(t,n)}}setConfig(e){this._config=e}willUpdate(){this.hass&&!this.loading&&this._floors.length===0&&(this.loading=!0,xe(this.hass).then(e=>{this._floors=e.building.floors.map(t=>({id:t.id,name:t.name})),this._templates=Object.keys(e.building.settings.card_templates??{}),this._rooms=e.building.floors.flatMap(t=>t.rooms.map(n=>({id:n.id,name:n.name,floor:t.name})))},()=>{}))}write(e,t){let n={...this._config};t===void 0||t===""||ae[e]===t?delete n[e]:n[e]=t,this.publish(n)}publish(e){this._config=e,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:e},bubbles:!0,composed:!0}))}roomsChoice(){if(this._rooms.length===0)return l``;let e=new Set(this._config.rooms??[]),t=(n,r)=>{let o=this._rooms.map(a=>a.id).filter(a=>a===n?r:e.has(a));this.form.set("rooms",o.length?o:void 0)};return l`<fieldset class="rooms">
<legend>${this.form.t("card_rooms")}</legend>
<small>${this.form.t("card_rooms_hint")}</small>
${this._rooms.map(n=>l`<label class="toggle"><input type="checkbox" .checked=${e.has(n.id)} @change=${r=>t(n.id,r.target.checked)} /><span>${this._floors.length>1?`${n.floor} \xB7 `:""}${n.name}</span></label>`)}
@@ -190,7 +190,7 @@ var p={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",f
</div>`:d}
<p class="hint">${e.t("card_pro_hint")}</p>`}furnitureColors(e){let t=this._config.furniture_colors??{},n=(r,o)=>{let a={...t,[r]:o};o||delete a[r],e.set("furniture_colors",Object.keys(a).length?a:void 0)};return l`<details class="field">
<summary>${e.t("furn_colors_card")}${Object.keys(t).length?` (${Object.keys(t).length})`:""}</summary>
${We.map(r=>l`<label class="field"
${He.map(r=>l`<label class="field"
>${e.t(`furn_color_${r}`)}
<input type="color" .value=${t[r]??Be[r]} @input=${o=>n(r,o.target.value)} />
${t[r]?l`<button type="button" class="link" @click=${()=>n(r,null)}>${e.t("furn_color_house")}</button>`:d}
File diff suppressed because it is too large. Load diff
+205 -206
View File
@@ -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 xn=globalThis,kn=xn.ShadowRoot&&(xn.ShadyCSS===void 0||xn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Hr=Symbol(),bi=new WeakMap,It=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Hr)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(kn&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=bi.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&bi.set(t,e))}return e}toString(){return this.cssText}},wi=r=>new It(typeof r=="string"?r:r+"",void 0,Hr),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 It(t,r,Hr)},vi=(r,e)=>{if(kn)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),o=xn.litNonce;o!==void 0&&n.setAttribute("nonce",o),n.textContent=t.cssText,r.appendChild(n)}},Ir=kn?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return wi(t)})(r):r;var{is:Jc,defineProperty:Qc,getOwnPropertyDescriptor:Xc,getOwnPropertyNames:eu,getOwnPropertySymbols:tu,getPrototypeOf:nu}=Object,Sn=globalThis,yi=Sn.trustedTypes,ru=yi?yi.emptyScript:"",ou=Sn.reactiveElementPolyfillSupport,Ct=(r,e)=>r,Cr={toAttribute(r,e){switch(e){case Boolean:r=r?ru: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}},ki=(r,e)=>!Jc(r,e),xi={attribute:!0,type:String,converter:Cr,reflect:!1,useDefault:!1,hasChanged:ki};Symbol.metadata??=Symbol("metadata"),Sn.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=xi){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&&Qc(this.prototype,e,o)}}static getPropertyDescriptor(e,t,n){let{get:o,set:i}=Xc(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)??xi}static _$Ei(){if(this.hasOwnProperty(Ct("elementProperties")))return;let e=nu(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Ct("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ct("properties"))){let t=this.properties,n=[...eu(t),...tu(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(Ir(o))}else e!==void 0&&t.push(Ir(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]`,Nt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Mi=/-->/g,Ai=/>/g,Ze=RegExp(`>|${Nr}(?:([^\\s"'>=/]+)(${Nr}*=${Nr}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ei=/'/g,Ri=/"/g,Di=/^(?:script|style|textarea|title)$/i,Ur=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),m=Ur(1),J=Ur(2),Cm=Ur(3),Qe=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),zi=new WeakMap,Ye=Je.createTreeWalker(Je,129);function Pi(r,e){if(!Gr(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return $i!==void 0?$i.createHTML(e):e}var au=(r,e)=>{let t=r.length-1,n=[],o,i=e===2?"<svg>":e===3?"<math>":"",s=Nt;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===Nt?u[1]==="!--"?s=Mi:u[1]!==void 0?s=Ai:u[2]!==void 0?(Di.test(u[2])&&(o=RegExp("</"+u[2],"g")),s=Ze):u[3]!==void 0&&(s=Ze):s===Ze?u[0]===">"?(s=o??Nt,h=-1):u[1]===void 0?h=-2:(h=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?Ze:u[3]==='"'?Ri:Ei):s===Ri||s===Ei?s=Ze:s===Mi||s===Ai?s=Nt:(s=Ze,o=void 0);let d=s===Ze&&r[a+1].startsWith("/>")?" ":"";i+=s===Nt?l+iu:h>=0?(n.push(c),l.slice(0,h)+Ti+l.slice(h)+We+d):l+We+(h===-2?a:d)}return[Pi(r,i+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},Lt=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]=au(e,t);if(this.el=r.createElement(c,n),Ye.currentNode=this.el.content,t===2||t===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(o=Ye.nextNode())!==null&&l.length<a;){if(o.nodeType===1){if(o.hasAttributes())for(let h of o.getAttributeNames())if(h.endsWith(Ti)){let p=u[s++],d=o.getAttribute(h).split(We),g=/([.?@])?(.*)/.exec(p);l.push({type:1,index:i,name:g[2],strings:d,ctor:g[1]==="."?Wr:g[1]==="?"?Lr:g[1]==="@"?Br:ht}),o.removeAttribute(h)}else h.startsWith(We)&&(l.push({type:6,index:i}),o.removeAttribute(h));if(Di.test(o.tagName)){let h=o.textContent.split(We),p=h.length-1;if(p>0){o.textContent=$n?$n.emptyScript:"";for(let d=0;d<p;d++)o.append(h[d],Ot()),Ye.nextNode(),l.push({type:2,index:++i});o.append(h[p],Ot())}}}else if(o.nodeType===8)if(o.data===Fi)l.push({type:2,index:i});else{let h=-1;for(;(h=o.data.indexOf(We,h+1))!==-1;)l.push({type:7,index:i}),h+=We.length-1}i++}}static createElement(e,t){let n=Je.createElement("template");return n.innerHTML=e,n}};function dt(r,e,t=r,n){if(e===Qe)return e;let o=n!==void 0?t._$Co?.[n]:t._$Cl,i=Wt(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=dt(r,o._$AS(r,e.values),o,n)),e}var Or=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??Je).importNode(t,!0);Ye.currentNode=o;let i=Ye.nextNode(),s=0,a=0,l=n[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new Bt(i,i.nextSibling,this,e):l.type===1?c=new l.ctor(i,l.name,l.strings,this,e):l.type===6&&(c=new Vr(i,this,e)),this._$AV.push(c),l=n[++a]}s!==l?.index&&(i=Ye.nextNode(),s++)}return Ye.currentNode=Je,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++}},Bt=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=dt(this,e,t),Wt(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==Qe&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):su(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&&Wt(this._$AH)?this._$AA.nextSibling.data=e:this.T(Je.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=Lt.createElement(Pi(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===o)this._$AH.p(t);else{let i=new Or(o,this),s=i.u(this.options);i.p(t),this.T(s),this._$AH=i}}_$AC(e){let t=zi.get(e.strings);return t===void 0&&zi.set(e.strings,t=new Lt(e)),t}k(e){Gr(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(Ot()),this.O(Ot()),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=Si(e).nextSibling;Si(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},ht=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
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(),ki=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=ki.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&ki.set(t,e))}return e}toString(){return this.cssText}},Si=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)},$i=(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 Si(t)})(r):r;var{is:iu,defineProperty:su,getOwnPropertyDescriptor:au,getOwnPropertyNames:lu,getOwnPropertySymbols:cu,getPrototypeOf:uu}=Object,An=globalThis,Mi=An.trustedTypes,du=Mi?Mi.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}},Ei=(r,e)=>!iu(r,e),Ai={attribute:!0,type:String,converter:Lr,reflect:!1,useDefault:!1,hasChanged:Ei};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=Ai){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)??Ai}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,Ti=/-->/g,Fi=/>/g,Je=RegExp(`>|${Br}(?:([^\\s"'>=/]+)(${Br}*=${Br}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),Di=/'/g,Pi=/"/g,Ni=/^(?:script|style|textarea|title)$/i,Yr=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),m=Yr(1),J=Yr(2),Um=Yr(3),et=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),Hi=new WeakMap,Qe=Xe.createTreeWalker(Xe,129);function Wi(r,e){if(!Zr(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return zi!==void 0?zi.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=Ti:u[1]!==void 0?s=Fi:u[2]!==void 0?(Ni.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]==='"'?Pi:Di):s===Pi||s===Di?s=Je:s===Ti||s===Fi?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)+Ii+l.slice(h)+Le+d):l+Le+(h===-2?a:d)}return[Wi(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(Ii)){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(Ni.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===Ci)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(Wi(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=Hi.get(e.strings);return t===void 0&&Hi.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=Ri(e).nextSibling;Ri(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
Ein Plugin l\xE4uft mit denselben Rechten wie NextFloor in deinem Browser. Die Datei wurde gepr\xFCft, ihr Inhalt ist festgelegt:
{url}`,manual:"Anleitung",manual_more:"Mehr erfahren",feature_text_energy:"Energieteilchen fliegen in B\xF6gen von den Solarfeldern zum Wechselrichter, zwischen Haus, Akku, Netz und Verbrauchern \u2013 schneller und dichter, je mehr Strom flie\xDFt. Die Module funkeln mit ihrer Produktion, eine Glaskarte \xFCber dem Dach zeigt die Bilanz und wie autark das Haus gerade ist.",live_autarky:"autark",live_fold:"Karte verkleinern",live_unfold:"Karte aufklappen",live_day_hint:"Die letzten 24 Stunden: Solar (Fl\xE4che) und Verbrauch (Linie)",live_week_hint:"Die letzten 7 Tage: Sonne {solar} kWh, Verbrauch {use} kWh (gelb: Sonne, hell: Verbrauch)",live_days:"Tage",live_car_away:"Unterwegs",live_car_charging:"L\xE4dt",live_car_plugged:"Eingesteckt",live_car_lock:"Verriegeln",live_car_unlock:"Entriegeln",live_car_unlock_confirm:"{name} wirklich entriegeln?",live_car_climate:"Klimatisierung",live_car_charge:"Laden starten/stoppen",live_media_prev:"Zur\xFCck",live_media_playpause:"Abspielen/Pause",live_media_next:"Weiter",live_media_volume:"Lautst\xE4rke",live_car_device:"Auto (eine Entit\xE4t des Autos)",live_car_device_hint:"Ladestand, Reichweite, Laden, Stecker, Schloss und Klima findet NextFloor selbst am Ger\xE4t des Autos. Ohne Angabe nimmt es den Anwesenheitssensor des Stellplatzes.",live_car_departure_entity:"Abfahrtszeit (optional)",live_car_departure:"Abfahrt {time}",live_car_open:"Offen: {parts}",printer_printing:"druckt",printer_done:"fertig",printer_paused:"pausiert",printer_error:"Fehler",printer_idle:"bereit",printer_done_at:"fertig um {time}",printer_layer:"Schicht",printer_nozzle:"D\xFCse",printer_bed:"Bett",heatpump_heating:"heizt",heatpump_water:"macht Warmwasser",heatpump_cooling:"k\xFChlt",heatpump_defrost:"taut ab",heatpump_idle:"in Ruhe",heatpump_flow_return:"Vor- \u2192 R\xFCcklauf",heatpump_heat:"W\xE4rme",heatpump_power:"Strom",heatpump_outside:"au\xDFen",pack_missing_item:"M\xF6bel aus entferntem Pack",back_to_room:"Zur\xFCck zu {room}",back_to_floor:"Zur\xFCck zur Etage",hint_furniture:"Raum antippen, dann rechts ein M\xF6belst\xFCck w\xE4hlen \xB7 M\xF6bel ziehen, an den Ecken die Gr\xF6\xDFe \xE4ndern",furniture_into:"Neue M\xF6bel kommen in die Mitte von \u201E{room}\u201C.",furniture_pick_room:"Tipp: Erst einen Raum antippen \u2013 dann landen neue M\xF6bel in seiner Mitte.",flows:"Stromfluss",flows_hint:"Energieb\xF6gen zwischen Solarfeldern, Wechselrichter, Akku, Netz und Verbrauchern ein- oder ausblenden",chk_title:"Einrichtung",chk_hint:"Was der Energiefluss braucht. Antippen springt an die Stelle.",chk_solar:"Solarfeld angelegt",chk_solar_add:"Ein Solarfeld aufs Dach legen",chk_meter:"Stromz\xE4hler mit Netzsensor",chk_meter_sensor:"Stromz\xE4hler: Netzsensor (W) fehlt",chk_meter_add:"Stromz\xE4hler anlegen",chk_inverter:"Wechselrichter mit Leistungssensor",chk_inverter_sensor:"Wechselrichter: Leistungssensor fehlt",chk_inverter_add:"Wechselrichter anlegen",chk_battery:"Stromspeicher mit Leistung und Ladestand",chk_battery_sensor:"Stromspeicher: Leistung oder Ladestand fehlt",chk_battery_opt:"Stromspeicher (optional)",chk_grid:"Netzanschluss gesetzt",chk_grid_opt:"Netzanschluss (optional, sonst automatisch)",energy_sign_grid:"Das Haus zeigt Einspeisung, obwohl die Sonne nichts liefert. Der Netzsensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_battery:"Der Speicher l\xE4dt ohne Sonne und ohne Netzbezug. Sein Sensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_flip:"Vorzeichen umkehren",help_title:"Hilfe und R\xFCckmeldung",help_hint:"Fehler bitte als Issue auf GitHub, W\xFCnsche als Diskussion \u2013 so geht nichts verloren, und alle sehen den Stand.",help_issue:"Problem melden",help_idea:"Idee vorschlagen",furn_name:"Name (optional)",furn_mirror:"Spiegeln",furn_mirror_hint:"Links und rechts vertauschen \u2013 das L-Sofa andersherum, der Schrank mit der T\xFCr auf der anderen Seite, die K\xFCchenzeile gespiegelt.",hint_opening:"Auf eine Wand tippen, um eine T\xFCr oder ein Fenster einzusetzen \u2013 die Art w\xE4hlst du danach rechts",preset_door:"T\xFCr",preset_door_double:"Doppelt\xFCr",preset_window:"Fenster",preset_window_double:"Fenster 2-fl\xFCgelig",preset_terrace:"Terrassent\xFCr",preset_terrace_double:"Terrassent\xFCr 2-fl\xFCgelig",preset_lift_slide:"Hebe-Schiebet\xFCr",preset_garage:"Garagentor",preset_front:"Haust\xFCr",opening_style:"Stil",sidelight_auto:"automatisch",sidelight_hinge:"Seitenteil an der Anschlagseite",sidelight_hinge_hint:"Das Seitenteil sitzt sonst gegen\xFCber dem Anschlag; mit Haken neben den B\xE4ndern.",sidelight_width:"Breite Seitenteil (m)",sidelight_width_left:"Seitenteil links (m)",sidelight_width_right:"Seitenteil rechts (m)",style_auto:"Automatisch ({style})",style_interior:"Zimmert\xFCr",style_front:"Haust\xFCr",style_front_glass:"Haust\xFCr mit Glasausschnitt",style_sidelight:"Haust\xFCr mit Seitenteil",style_sidelights:"Haust\xFCr mit 2 Seitenteilen",style_glass:"Glast\xFCr",style_sliding:"Schiebet\xFCr",style_p Line truncated
{url}`,manual:"Anleitung",manual_more:"Mehr erfahren",feature_text_energy:"Energieteilchen fliegen in B\xF6gen von den Solarfeldern zum Wechselrichter, zwischen Haus, Akku, Netz und Verbrauchern \u2013 schneller und dichter, je mehr Strom flie\xDFt. Die Module funkeln mit ihrer Produktion, eine Glaskarte \xFCber dem Dach zeigt die Bilanz und wie autark das Haus gerade ist.",live_autarky:"autark",live_fold:"Karte verkleinern",live_unfold:"Karte aufklappen",live_day_hint:"Die letzten 24 Stunden: Solar (Fl\xE4che) und Verbrauch (Linie)",live_week_hint:"Die letzten 7 Tage: Sonne {solar} kWh, Verbrauch {use} kWh (gelb: Sonne, hell: Verbrauch)",live_days:"Tage",live_car_away:"Unterwegs",live_car_charging:"L\xE4dt",live_car_plugged:"Eingesteckt",live_car_lock:"Verriegeln",live_car_unlock:"Entriegeln",live_car_unlock_confirm:"{name} wirklich entriegeln?",live_car_climate:"Klimatisierung",live_car_charge:"Laden starten/stoppen",live_media_prev:"Zur\xFCck",live_media_playpause:"Abspielen/Pause",live_media_next:"Weiter",live_media_volume:"Lautst\xE4rke",live_car_device:"Auto (eine Entit\xE4t des Autos)",live_car_device_hint:"Ladestand, Reichweite, Laden, Stecker, Schloss und Klima findet NextFloor selbst am Ger\xE4t des Autos. Ohne Angabe nimmt es den Anwesenheitssensor des Stellplatzes.",live_car_departure_entity:"Abfahrtszeit (optional)",live_car_departure:"Abfahrt {time}",live_car_open:"Offen: {parts}",printer_printing:"druckt",printer_done:"fertig",printer_paused:"pausiert",printer_error:"Fehler",printer_idle:"bereit",printer_done_at:"fertig um {time}",printer_layer:"Schicht",printer_nozzle:"D\xFCse",printer_bed:"Bett",heatpump_heating:"heizt",heatpump_water:"macht Warmwasser",heatpump_cooling:"k\xFChlt",heatpump_defrost:"taut ab",heatpump_idle:"in Ruhe",heatpump_flow_return:"Vor- \u2192 R\xFCcklauf",heatpump_heat:"W\xE4rme",heatpump_power:"Strom",heatpump_outside:"au\xDFen",pack_missing_item:"M\xF6bel aus entferntem Pack",back_to_room:"Zur\xFCck zu {room}",back_to_floor:"Zur\xFCck zur Etage",hint_furniture:"Raum antippen, dann rechts ein M\xF6belst\xFCck w\xE4hlen \xB7 M\xF6bel ziehen, an den Ecken die Gr\xF6\xDFe \xE4ndern",furniture_into:"Neue M\xF6bel kommen in die Mitte von \u201E{room}\u201C.",furniture_pick_room:"Tipp: Erst einen Raum antippen \u2013 dann landen neue M\xF6bel in seiner Mitte.",flows:"Stromfluss",flows_hint:"Energieb\xF6gen zwischen Solarfeldern, Wechselrichter, Akku, Netz und Verbrauchern ein- oder ausblenden",chk_title:"Einrichtung",chk_hint:"Was der Energiefluss braucht. Antippen springt an die Stelle.",chk_solar:"Solarfeld angelegt",chk_solar_add:"Ein Solarfeld aufs Dach legen",chk_meter:"Stromz\xE4hler mit Netzsensor",chk_meter_sensor:"Stromz\xE4hler: Netzsensor (W) fehlt",chk_meter_add:"Stromz\xE4hler anlegen",chk_inverter:"Wechselrichter mit Leistungssensor",chk_inverter_sensor:"Wechselrichter: Leistungssensor fehlt",chk_inverter_add:"Wechselrichter anlegen",chk_battery:"Stromspeicher mit Leistung und Ladestand",chk_battery_sensor:"Stromspeicher: Leistung oder Ladestand fehlt",chk_battery_opt:"Stromspeicher (optional)",chk_grid:"Netzanschluss gesetzt",chk_grid_opt:"Netzanschluss (optional, sonst automatisch)",energy_sign_grid:"Das Haus zeigt Einspeisung, obwohl die Sonne nichts liefert. Der Netzsensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_battery:"Der Speicher l\xE4dt ohne Sonne und ohne Netzbezug. Sein Sensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_flip:"Vorzeichen umkehren",help_title:"Hilfe und R\xFCckmeldung",help_hint:"Fehler bitte als Issue auf GitHub, W\xFCnsche als Diskussion \u2013 so geht nichts verloren, und alle sehen den Stand.",help_issue:"Problem melden",help_idea:"Idee vorschlagen",furn_name:"Name (optional)",furn_mirror:"Spiegeln",furn_mirror_hint:"Links und rechts vertauschen \u2013 das L-Sofa andersherum, der Schrank mit der T\xFCr auf der anderen Seite, die K\xFCchenzeile gespiegelt.",hint_opening:"Auf eine Wand tippen, um eine T\xFCr oder ein Fenster einzusetzen \u2013 die Art w\xE4hlst du danach rechts",preset_door:"T\xFCr",preset_door_double:"Doppelt\xFCr",preset_window:"Fenster",preset_window_double:"Fenster 2-fl\xFCgelig",preset_terrace:"Terrassent\xFCr",preset_terrace_double:"Terrassent\xFCr 2-fl\xFCgelig",preset_lift_slide:"Hebe-Schiebet\xFCr",preset_garage:"Garagentor",preset_front:"Haust\xFCr",opening_style:"Stil",sidelight_auto:"automatisch",sidelight_hinge:"Seitenteil an der Anschlagseite",sidelight_hinge_hint:"Das Seitenteil sitzt sonst gegen\xFCber dem Anschlag; mit Haken neben den B\xE4ndern.",sidelight_width:"Breite Seitenteil (m)",sidelight_width_left:"Seitenteil links (m)",sidelight_width_right:"Seitenteil rechts (m)",style_auto:"Automatisch ({style})",style_interior:"Zimmert\xFCr",style_front:"Haust\xFCr",style_front_glass:"Haust\xFCr mit Glasausschnitt",style_sidelight:"Haust\xFCr mit Seitenteil",style_sidelights:"Haust\xFCr mit 2 Seitenteilen",style_glass:"Glast\xFCr",style_sliding:"Schiebet\xFCr",style_p Line truncated
A plugin runs with the same rights as NextFloor in your browser. The file has been reviewed and its content is fixed:
{url}`,manual:"Manual",manual_more:"Learn more",feature_text_energy:"Energy particles fly in arcs from the solar fields to the inverter, between house, battery, grid and consumers \u2013 faster and denser the more power flows. The modules sparkle with their production, a glass card over the roof shows the balance and how self-sufficient the house is right now.",live_autarky:"self-sufficient",live_fold:"Make the card small",live_unfold:"Open the card",live_day_hint:"The last 24 hours: solar (area) and consumption (line)",live_week_hint:"The last 7 days: sun {solar} kWh, use {use} kWh (yellow: sun, light: use)",live_days:"days",live_car_away:"On the road",live_car_charging:"Charging",live_car_plugged:"Plugged in",live_car_lock:"Lock",live_car_unlock:"Unlock",live_car_unlock_confirm:"Really unlock {name}?",live_car_climate:"Climate",live_car_charge:"Start/stop charging",live_media_prev:"Previous",live_media_playpause:"Play/pause",live_media_next:"Next",live_media_volume:"Volume",live_car_device:"Car (any entity of the car)",live_car_device_hint:"Charge, range, charging, plug, lock and climate are found by NextFloor on the car's device. Without one it takes the spot's presence sensor.",live_car_departure_entity:"Departure time (optional)",live_car_departure:"Departs {time}",live_car_open:"Open: {parts}",printer_printing:"printing",printer_done:"done",printer_paused:"paused",printer_error:"error",printer_idle:"idle",printer_done_at:"done at {time}",printer_layer:"Layer",printer_nozzle:"Nozzle",printer_bed:"Bed",heatpump_heating:"heating",heatpump_water:"making hot water",heatpump_cooling:"cooling",heatpump_defrost:"defrosting",heatpump_idle:"resting",heatpump_flow_return:"Flow \u2192 return",heatpump_heat:"Heat",heatpump_power:"Power",heatpump_outside:"outside",pack_missing_item:"Furniture of a removed pack",back_to_room:"Back to {room}",back_to_floor:"Back to the floor",hint_furniture:"Tap a room, then pick an item on the right \xB7 drag items, resize them by their corners",furniture_into:"New items go into the middle of \u201C{room}\u201D.",furniture_pick_room:"Tip: tap a room first \u2013 new items then land in its middle.",flows:"Power flow",flows_hint:"Show or hide the energy arcs between solar fields, inverter, battery, grid and consumers",chk_title:"Setup",chk_hint:"What the energy flow needs. Tap a row to jump there.",chk_solar:"Solar field in place",chk_solar_add:"Put a solar field on the roof",chk_meter:"Meter with grid sensor",chk_meter_sensor:"Meter: grid sensor (W) missing",chk_meter_add:"Add the meter",chk_inverter:"Inverter with power sensor",chk_inverter_sensor:"Inverter: power sensor missing",chk_inverter_add:"Add an inverter",chk_battery:"Home battery with power and charge",chk_battery_sensor:"Home battery: power or charge missing",chk_battery_opt:"Home battery (optional)",chk_grid:"Grid connection set",chk_grid_opt:"Grid connection (optional, else automatic)",energy_sign_grid:"The house shows export while the sun produces nothing. The grid sensor probably has its sign reversed.",energy_sign_battery:"The battery charges with no sun and no grid draw. Its sensor probably has its sign reversed.",energy_sign_flip:"Flip the sign",help_title:"Help and feedback",help_hint:"Please report problems as a GitHub issue and wishes as a discussion \u2013 nothing gets lost, and everyone sees the state.",help_issue:"Report a problem",help_idea:"Propose an idea",furn_name:"Name (optional)",furn_mirror:"Mirror",furn_mirror_hint:"Swap left and right \u2013 the L-sofa the other way round, the cabinet with its door on the other side, the kitchen run mirrored.",hint_opening:"Tap a wall to add a door or window \u2013 choose its kind on the right afterwards",preset_door:"Door",preset_door_double:"Double door",preset_window:"Window",preset_window_double:"Double window",preset_terrace:"Terrace door",preset_terrace_double:"French doors",preset_lift_slide:"Lift-and-slide door",preset_garage:"Garage door",preset_front:"Front door",opening_style:"Style",sidelight_auto:"automatic",sidelight_hinge:"Sidelight on the hinge side",sidelight_hinge_hint:"The sidelight sits opposite the hinge otherwise; ticked, it sits next to the hinges.",sidelight_width:"Sidelight width (m)",sidelight_width_left:"Left sidelight (m)",sidelight_width_right:"Right sidelight (m)",style_auto:"Automatic ({style})",style_interior:"Room door",style_front:"Front door",style_front_glass:"Front door with glass",style_sidelight:"Front door with sidelight",style_sidelights:"Front door with two sidelights",style_glass:"Glass door",style_sliding:"Sliding door",style_passage:"Opening (no door)",style_standard:"Standard",style_bars:"With glazing bars",style_glass_wall:"Glass wall (fixed)",preset_glass_wall:"Glass wall",glass_panes:"Panes",glass_panes_auto:"automatic (about 0.9 m)",glass_panes_hint:"0 = one single pane without mullions, empty = about every 0.9 m",flip_hinge:"Swap hinge side",flip_main_leaf:"Swap main leaf",flip_hinge_hint:"Hinges to the other side" Line truncated
{url}`,manual:"Manual",manual_more:"Learn more",feature_text_energy:"Energy particles fly in arcs from the solar fields to the inverter, between house, battery, grid and consumers \u2013 faster and denser the more power flows. The modules sparkle with their production, a glass card over the roof shows the balance and how self-sufficient the house is right now.",live_autarky:"self-sufficient",live_fold:"Make the card small",live_unfold:"Open the card",live_day_hint:"The last 24 hours: solar (area) and consumption (line)",live_week_hint:"The last 7 days: sun {solar} kWh, use {use} kWh (yellow: sun, light: use)",live_days:"days",live_car_away:"On the road",live_car_charging:"Charging",live_car_plugged:"Plugged in",live_car_lock:"Lock",live_car_unlock:"Unlock",live_car_unlock_confirm:"Really unlock {name}?",live_car_climate:"Climate",live_car_charge:"Start/stop charging",live_media_prev:"Previous",live_media_playpause:"Play/pause",live_media_next:"Next",live_media_volume:"Volume",live_car_device:"Car (any entity of the car)",live_car_device_hint:"Charge, range, charging, plug, lock and climate are found by NextFloor on the car's device. Without one it takes the spot's presence sensor.",live_car_departure_entity:"Departure time (optional)",live_car_departure:"Departs {time}",live_car_open:"Open: {parts}",printer_printing:"printing",printer_done:"done",printer_paused:"paused",printer_error:"error",printer_idle:"idle",printer_done_at:"done at {time}",printer_layer:"Layer",printer_nozzle:"Nozzle",printer_bed:"Bed",heatpump_heating:"heating",heatpump_water:"making hot water",heatpump_cooling:"cooling",heatpump_defrost:"defrosting",heatpump_idle:"resting",heatpump_flow_return:"Flow \u2192 return",heatpump_heat:"Heat",heatpump_power:"Power",heatpump_outside:"outside",pack_missing_item:"Furniture of a removed pack",back_to_room:"Back to {room}",back_to_floor:"Back to the floor",hint_furniture:"Tap a room, then pick an item on the right \xB7 drag items, resize them by their corners",furniture_into:"New items go into the middle of \u201C{room}\u201D.",furniture_pick_room:"Tip: tap a room first \u2013 new items then land in its middle.",flows:"Power flow",flows_hint:"Show or hide the energy arcs between solar fields, inverter, battery, grid and consumers",chk_title:"Setup",chk_hint:"What the energy flow needs. Tap a row to jump there.",chk_solar:"Solar field in place",chk_solar_add:"Put a solar field on the roof",chk_meter:"Meter with grid sensor",chk_meter_sensor:"Meter: grid sensor (W) missing",chk_meter_add:"Add the meter",chk_inverter:"Inverter with power sensor",chk_inverter_sensor:"Inverter: power sensor missing",chk_inverter_add:"Add an inverter",chk_battery:"Home battery with power and charge",chk_battery_sensor:"Home battery: power or charge missing",chk_battery_opt:"Home battery (optional)",chk_grid:"Grid connection set",chk_grid_opt:"Grid connection (optional, else automatic)",energy_sign_grid:"The house shows export while the sun produces nothing. The grid sensor probably has its sign reversed.",energy_sign_battery:"The battery charges with no sun and no grid draw. Its sensor probably has its sign reversed.",energy_sign_flip:"Flip the sign",help_title:"Help and feedback",help_hint:"Please report problems as a GitHub issue and wishes as a discussion \u2013 nothing gets lost, and everyone sees the state.",help_issue:"Report a problem",help_idea:"Propose an idea",furn_name:"Name (optional)",furn_mirror:"Mirror",furn_mirror_hint:"Swap left and right \u2013 the L-sofa the other way round, the cabinet with its door on the other side, the kitchen run mirrored.",hint_opening:"Tap a wall to add a door or window \u2013 choose its kind on the right afterwards",preset_door:"Door",preset_door_double:"Double door",preset_window:"Window",preset_window_double:"Double window",preset_terrace:"Terrace door",preset_terrace_double:"French doors",preset_lift_slide:"Lift-and-slide door",preset_garage:"Garage door",preset_front:"Front door",opening_style:"Style",sidelight_auto:"automatic",sidelight_hinge:"Sidelight on the hinge side",sidelight_hinge_hint:"The sidelight sits opposite the hinge otherwise; ticked, it sits next to the hinges.",sidelight_width:"Sidelight width (m)",sidelight_width_left:"Left sidelight (m)",sidelight_width_right:"Right sidelight (m)",style_auto:"Automatic ({style})",style_interior:"Room door",style_front:"Front door",style_front_glass:"Front door with glass",style_sidelight:"Front door with sidelight",style_sidelights:"Front door with two sidelights",style_glass:"Glass door",style_sliding:"Sliding door",style_passage:"Opening (no door)",style_standard:"Standard",style_bars:"With glazing bars",style_glass_wall:"Glass wall (fixed)",preset_glass_wall:"Glass wall",glass_panes:"Panes",glass_panes_auto:"automatic (about 0.9 m)",glass_panes_hint:"0 = one single pane without mullions, empty = about every 0.9 m",flip_hinge:"Swap hinge side",flip_main_leaf:"Swap main leaf",flip_hinge_hint:"Hinges to the other side" Line truncated
:host {
--nf-text: var(--primary-text-color, #e1e1e1);
--nf-muted: var(--secondary-text-color, #9b9b9b);
@@ -35,7 +35,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
font-family: var(--nf-font);
color: var(--nf-text);
}
`,hr=ne`
`,gr=ne`
:host([readable]) {
--secondary-text-color: var(--primary-text-color, #e1e1e1);
--divider-color: color-mix(in srgb, var(--primary-text-color, #e1e1e1) 40%, transparent);
@@ -46,7 +46,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
:host([readable]) .nf-overlay {
zoom: 1.2;
}
`,Ke=ne`
`,Ue=ne`
/* a group of switches: one rounded pill, the active one tinted with the accent */
.nf-seg {
display: inline-flex;
@@ -209,12 +209,12 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
min-height: 40px;
}
}
`;function pr(r){return r?.themes?.darkMode===!1?"light":"dark"}var Fh=4,Dh=8,Ph=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[255,95,210],[120,255,150]],Et=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">
<path d=${nr(r)} />
</svg>`,mr={previous:"M6 6h2v12H6zM20 6v12l-10-6z",play:"M8 5v14l11-7z",pause:"M7 5h4v14H7zM13 5h4v14h-4z",next:"M16 6h2v12h-2zM4 6v12l10-6z"},Do=r=>m`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d=${r} /></svg>`,Hh=24,Ih=10,Po=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 dr(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(ur)}]),this._moodName=null};return m`<div class="nf-rp-moods">
`;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">
<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"},No=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,Wo=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">
<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(Xa(l,s(h)))}}>
${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)))}}>
<option value="">→</option>
${i.map(c=>m`<option value=${c.id}>${c.name}</option>`)}
</select>`:f}
@@ -224,38 +224,38 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
><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=vt(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 on(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=At(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=To(this.hass,this.building,this.floor,e);try{let n=await Ka(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<Ih?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,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=Io(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">
<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">
<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=Z(this.hass,this.floor,e,"temperature");if(o===null||o<Hh)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(Ca(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">
<span>☀ ${this.t("shade_hint",{n:s.length,temp:`${O(this.hass,oe(this.hass,o),1)} ${X(this.hass)}`})}</span>
</div>`}renderShade(){let e=this.room,{latitude:t,longitude:n}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||n===void 0)return f;let 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">
<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(!$t(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=m`<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=Ia(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}
<div class="nf-rp-sun-bars" role="img" aria-label=${a.map((u,h)=>`${c[h]} ${O(this.hass,u,1)} h`).join(", ")}>
${a.map((u,h)=>m`<span title=${`${O(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=Ga(e.month,o),s=a=>`${O(this.hass,a,a<10?2:1)} kWh`;return m`<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 ${O(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=sn(s,220,36,i*1.2),l=c=>`${O(this.hass,oe(this.hass,c),1)}\xB0`;return m`<div class="nf-rp-curve" title=${this.t("room_curve_hint")}>
</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}
<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")}>
⚡ ${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")}>
<svg viewBox="0 0 220 36" preserveAspectRatio="none" aria-hidden="true">${J`<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 E(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=rn(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}=rn(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()||L(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 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
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?Os(this.hass,this.floor,t):{shown:n,more:[]}},a=ho(this.hass,s).map(x=>x.primary),l=a.length,c=this._showAll?[...i,...a]:i,u=x=>c.filter(y=>x.includes(D(y))).map(y=>this.hass.states[y]),h=u(["light"]),p=u(["cover"]),d=u(["climate"]),g=u(["media"]),b=u(["switch","fan","lock"]),_=u(["sensor","binary"]),w=u(["scene","script"]),S=this.facts(d),M=h.filter(x=>x.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(D(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}>
<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()}
${this.renderOpenWhileHeating(d)} ${this.renderEmptyLights(t,M)}
${this.renderOpenWhileHeating(d)} ${this.renderEmptyLights(t,k)}
${this.renderCurve()}
</div>
<button class="nf-rp-close" aria-label=${this.t(this._folded?"panel_unfold":"panel_fold")} title=${this.t(this._folded?"panel_unfold":"panel_fold")} aria-expanded=${this._folded?"false":"true"} @click=${()=>this._folded=!this._folded}>
@@ -266,51 +266,52 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
</button>
</header>
<div class="nf-rp-body" ?hidden=${this._folded}>
${this.renderAllOff([...h,...g,...b])}
${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>`}
${w.length?this.section("panel_scenes",[m`<div class="nf-rp-scenes">
${w.map(x=>m`<button
${v.length?this.section("panel_scenes",[m`<div class="nf-rp-scenes">
${v.map(y=>m`<button
class="nf-btn"
?disabled=${I(x)}
@click=${()=>this.call(D(x.entity_id)==="scene"?"scene":"script","turn_on",{entity_id:x.entity_id})}
?disabled=${I(y)}
@click=${()=>this.call(D(y.entity_id)==="scene"?"scene":"script","turn_on",{entity_id:y.entity_id})}
>
${this.name(x.entity_id)}
${this.name(y.entity_id)}
</button>`)}
</div>`]):f}
${h.length?this.section("panel_lights",[...h.map(x=>this.lightRow(x)),...t?[this.renderMoods(t,h)]:[]],m`${M.length<h.length?m`<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_on",{entity_id:h.filter(x=>!I(x)).map(x=>x.entity_id)})}>
${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)})}>
${this.t("panel_all_on")}
</button>`:f}${M.length?m`<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_off",{entity_id:M.map(x=>x.entity_id)})}>
</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)})}>
${this.t("panel_all_off")}
</button>`:f}`):f}
${p.length?this.section("panel_covers",p.map(x=>this.coverRow(x)),p.length>1&&Bn(p,this.confirmEntities).length?m`<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","open_cover",{entity_id:Bn(p,this.confirmEntities)})}>
${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)})}>
${this.t("panel_all_open")}</button
><button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:Bn(p,this.confirmEntities)})}>
><button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:Gn(p,this.confirmEntities)})}>
${this.t("panel_all_close")}
</button>`:f):f}
${d.length?this.section("panel_climate",d.map(x=>this.climateRow(x))):f}
${g.length?this.section("panel_media",g.map(x=>this.mediaRow(x))):f}
${b.length?this.section("panel_switches",b.map(x=>this.switchRow(x))):f}
${_.length?this.section("panel_sensors",_.map(x=>this.sensorRow(x))):f}
${ma(this.hass)&&pa(this.hass,this.floor,t)?this.announceSection(t):f}
${d.length?this.section("panel_climate",d.map(y=>this.climateRow(y))):f}
${_.length?this.section("panel_media",_.map(y=>this.mediaRow(y))):f}
${b.length?this.section("panel_switches",b.map(y=>this.switchRow(y))):f}
${g.length?this.section("panel_sensors",g.map(y=>this.sensorRow(y))):f}
${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}>
${this._showAll?this.t("panel_less"):this.t("panel_more",{n:l})}
</button>`:f}
</div>
</section>`}facts(e){let t=[],n=this.room;if(!n)return t;let o=(y,F)=>{let T=Z(this.hass,this.floor,n,y);if(T===null)return null;if(y==="temperature")return`${O(this.hass,oe(this.hass,T),1)} ${X(this.hass)}`;let C=vt(this.hass,this.floor,n,y)[0],R=this.hass.states[C]?.attributes.unit_of_measurement??F;return`${O(this.hass,T,1)} ${R}`},i=e.find(y=>typeof y.attributes.current_temperature=="number"),s=o("temperature","\xB0C");s?t.push(s):i&&n.climate?.temperature!=="none"&&t.push(`${O(this.hass,i.attributes.current_temperature,1)} ${X(this.hass)}`);let a=o("humidity","%");a&&t.push(a);let l=this.floor&&this.building?zo(this.hass,this.building,this.floor,n):null;l!==null&&t.push(`\u26A1 ${at(this.hass,l)}`);let c=this.floor?this.floor.openings.filter(y=>y.room_id===n.id).flatMap(y=>[y.contact,y.contact2,y.tilt,y.tilt2]).map(y=>y&&y!=="none"?this.hass.states[y]:void 0).filter(y=>y?.state==="on").map(y=>Date.parse(String(y.last_changed??""))).filter(Number.isFinite):[];c.length&&t.push(`\u{1FA9F} ${this.t("open_since",{time:Fo(Date.now()-Math.min(...c))})}`);let u=K(this.hass,n).map(y=>this.hass.states[y]).filter(y=>!!y&&y.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(y.attributes.device_class)));if(u.length)if(u.some(y=>y.state==="on"))t.push(`\u{1F6B6} ${this.t("presence_now")}`);else{let y=Math.max(...u.map(F=>Date.parse(String(F.last_changed??""))||0));y>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:Fo(Date.now()-y)})}`)}let h=this.building?qa(this.hass,this.building).filter(y=>y.roomId===n.id&&y.level<ja):[];h.length&&t.push(`\u{1FAAB} ${this.t("battery_low_n",{n:h.length,names:h.map(y=>`${this.name(y.entity)} ${Math.round(y.level)} %`).join(", ")})}`);let p=(this.building?.settings.circuits??[]).filter(y=>y.rooms.includes(n.id)).map(y=>y.name),d=this.building?.settings.room_facts_off??[];p.length&&!d.includes("circuits")&&t.push(`\u{1F50C} ${p.join(", ")}`);let{latitude:g,longitude:b,time_zone:_}=this.hass.config??{};if(this.floor&&g!==void 0&&b!==void 0&&this.building&&!d.includes("sun")){let y=$t(this.building,this.floor,n,{latitude:g,longitude:b,zone:_});y.facing.length&&t.push(`\u2600 ${this.t("room_sun_hours",{h:O(this.hass,y.hours,1),facing:y.facing.join(", ")})}`)}let w=Z(this.hass,this.floor,n,"temperature"),S=Z(this.hass,this.floor,n,"humidity"),M=ar(Z(this.hass,this.floor,n,"co2"),S,Mt(w,S));M&&!d.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${M}`)}`);let x=lr(w,S,Z(this.hass,this.floor,n,"co2"),st(new Date,this.hass.config?.latitude));return x!==null&&(w!==null||S!==null)&&!d.includes("comfort")&&t.push(`\u{1F60A} ${this.t("comfort_n",{n:x})}`),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=>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,F)=>{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??F;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?Ho(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:Co(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(F=>Date.parse(String(F.last_changed??""))||0));E>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:Co(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>
<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 Qi({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?m`<p class="nf-rp-note ${this._said.failed?"nf-rp-fail":""}" role="status">${this._said.text}</p>`:f}`])}pluginSections(e,t){return rs({hass:this.hass,room:{id:e.id,name:e.name,area_id:e.area_id??null},entities:t}).map(o=>m`<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">
<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">
<span class="nf-rp-icon ${n?"nf-rp-on":""}">${Et("light")}</span>
<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}))}
@@ -334,23 +335,23 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
@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")}>
${Ph.map(d=>m`<button
${Bh.map(d=>m`<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=Qn(this.hass,this.building?.floors??[],e.entity_id);e=Xn(this.hass,e,t);let n=e.attributes,o=n.supported_features??0,i=e.entity_id,s=I(e)&&!Ut(e);return m`<div class="nf-rp-row">
<span class="nf-rp-icon">${Et("cover")}</span>
</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">
<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&Dh?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?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}
<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&Fh&&typeof n.current_position=="number"?m`<label class="nf-rp-slider"
${o&Oh&&typeof n.current_position=="number"?m`<label class="nf-rp-slider"
><span>${this.t("position")}</span>
<input
type="range"
@@ -368,18 +369,18 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
max="100"
?disabled=${s}
.value=${String(n.current_tilt_position)}
@change=${a=>this.call("cover","set_cover_tilt_position",{entity_id:t??i,tilt_position:Number(a.target.value)})}
@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}
</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">
<span class="nf-rp-icon ${t.hvac_action==="heating"?"nf-rp-on":""}">${Et("climate")}</span>
<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">
<button class="nf-btn" aria-label=${this.t("temp_down")} @click=${()=>c(o-i)}>−</button>
<span><small>${this.t("target_temp")}</small> ${O(this.hass,o,1)} ${X(this.hass)}</span>
<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">
@@ -392,19 +393,19 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
</button>`)}
</div>`:f}
</div>`}stateOf(e,t=te(this.hass,e)){if(this.room?.no_state?.includes(e.entity_id))return"";let n=D(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">
<span class="nf-rp-icon ${e.state==="playing"?"nf-rp-on":""}">${Et("media")}</span>
<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}
<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})}>
${Do(mr.previous)}
${No(br.previous)}
</button>
<button class="nf-btn nf-rp-small" aria-label=${this.t("play_pause")} ?disabled=${I(e)} @click=${()=>this.call("media_player","media_play_pause",{entity_id:n})}>
${Do(e.state==="playing"?mr.pause:mr.play)}
${No(e.state==="playing"?br.pause:br.play)}
</button>
<button class="nf-btn nf-rp-small" aria-label=${this.t("next")} ?disabled=${o} @click=${()=>this.call("media_player","media_next_track",{entity_id:n})}>
${Do(mr.next)}
${No(br.next)}
</button>
</div>
${typeof t.volume_level=="number"?m`<label class="nf-rp-slider"
@@ -417,15 +418,15 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
@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=D(t),o=t.slice(0,t.indexOf(".")),i=n==="lock"?e.state==="unlocked"||e.state==="open":Q(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">
<span class="nf-rp-icon ${i?"nf-rp-on":""}">${Et(n)}</span>
<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=D(e.entity_id),n=t==="binary"&&e.state==="on";return m`<div class="nf-rp-row">
<span class="nf-rp-icon ${n?"nf-rp-on":""}">${Et(t)}</span>
<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>
</div>`}fire(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))}static styles=[$e,Ke,ne`
</div>`}fire(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))}static styles=[$e,Ue,ne`
:host {
display: block;
}
@@ -806,38 +807,38 @@ 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",Po);function il(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 Ch=[[/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]]],sl=[34,211,238];function Ho(r){return r?Ch.find(([e])=>e.test(r))?.[1]??sl:sl}function Io(r){if(r.state==="playing"||r.state==="paused")return!0;let e=t=>typeof r.attributes[t]=="string"&&r.attributes[t]!=="";return r.state==="on"&&(e("media_title")||e("media_channel")||e("source")||e("app_name"))}var Co=r=>r.state==="playing"||r.state==="on"&&Io(r);function al(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:Co(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:Ho(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 ll(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 Nh=3;function cl(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||!Q(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??Nh))})}return n}var fr=r=>r&&r!=="none"?r:null,ul=r=>Math.min(1,Math.max(0,r));function dl(r,e){let t=new Map;for(let n of e.settings.roof?.windows??[]){let o=Re(r,{cover:fr(n.cover),contact:fr(n.contact),tilt:fr(n.tilt)},"window"),i=fr(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"?ul(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 Oh(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 Ge=(r,e)=>typeof r[e]=="string"?r[e]:"";function hl(r,e,t){let n=[];for(let o of e.floors)for(let i of o.furniture){if(!Zn(i.type))continue;let s=t?.get(i.id)?.entity??null,a=s?.startsWith("media_player.")?s:Oh(o,i),l=a?r.states[a]:void 0;if(!l||!Io(l))continue;let c=l.attributes,u=Ge(c,"app_name")||Ge(c,"source")||null;n.push({id:i.id,furnitureId:i.id,floorId:o.id,color:Ho(u),title:Ge(c,"media_title")||Ge(c,"media_channel")||u||"",subtitle:Ge(c,"media_artist")||Ge(c,"media_series_title")||Ge(c,"media_album_name"),app:u,picture:Ge(c,"entity_picture")||null,playing:Co(l),ambilight:i.ambilight??1})}return n}function pl(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 ml(r,e){return(r===null?0:ul((r+4)/16))*(1-.45*e)}function Ue(r,e){return e&&r.states[e]?e:Object.keys(r.states).filter(t=>t.startsWith("weather.")).sort()[0]??null}var gr=new Set(["contact_lost","unlocked_night","own"]);function Wh(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 Lh=600*1e3,Bh=new Set(["rainy","pouring","lightning-rainy","hail","snowy-rainy"]),Vh=new Map([["smoke","smoke"],["gas","gas"],["carbon_monoxide","co"],["moisture","water"]]),fl=(r,e)=>{if(e.startsWith("binary_sensor."))return Vh.get(String(r.states[e]?.attributes.device_class))};function Kh(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 gl(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=>fl(r,u)); Line truncated
`]};customElements.get("nf-room-panel")||customElements.define("nf-room-panel",Wo);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 Oo(r){return r?Gh.find(([e])=>e.test(r))?.[1]??hl:hl}function Lo(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 Bo=r=>r.state==="playing"||r.state==="on"&&Lo(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:Bo(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:Oo(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||!Q(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||!Lo(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:Oo(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:Bo(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
${J`<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 em(r,e,t,n){let o=e.summary,i=c=>E(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">${gn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)}%</b></div></div>`:f}
</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}
${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}>
${a}
${s!==null?m`<div class="live-own">${gn(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?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}
<div class="live-rows">${l}</div>
${nm(r,e.curves)} ${tm(r,e.week)}
</div>`}function tm(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:J`<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=${E(r,"live_week_hint",{solar:O(r,l(e.solar),0),use:O(r,l(e.use),0)})}>
${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:J`<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)})}>
<svg viewBox=${`0 0 ${o} ${i}`} preserveAspectRatio="none" aria-hidden="true">
${e.days.map((c,u)=>J`${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 ${E(r,"live_days")}</span>
</div>`}function nm(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=sn(e.solar,o,i,n),a=sn(e.use,o,i,n);return m`<div class="live-day" title=${E(r,"live_day_hint")}>
<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")}>
<svg viewBox=${`0 0 ${o} ${i}`} preserveAspectRatio="none" aria-hidden="true">
${s?J`<path d=${`${s}L${o},${i}L0,${i}Z`} class="live-day-solar"></path>`:f}
${a?J`<path d=${a} class="live-day-use"></path>`:f}
</svg>
<span>24 h</span>
</div>`}function rm(r,e,t,n){let o=e.car,i=(u,h)=>E(r,u,h),s=uc(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 ${O(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=${g=>(g.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 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 class="live-own">
${gn((o.soc??0)/100,s)}
${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">🌡 ${O(r,o.inside,1)} °C</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}
<div class="live-actions">
@@ -846,7 +847,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${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 om(r,e,t,n){let o=e.media,i=l=>E(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")}>
</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 class="live-rows">
<div class="live-title" title=${o.title}>${o.title||o.name}</div>
@@ -865,9 +866,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
/>`:f}
</div>
</div>
</div>`}function dc(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 im(r,e,t){let n=e.printer,o=(c,u)=>E(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 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 class="live-own">
${n.picture?m`<img class="live-print-pic" src=${n.picture} alt="" />`:gn(i/100,n.printing?"#38bdf8":"#8aa0c8")}
${n.picture?m`<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">
@@ -878,10 +879,10 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${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}
</div>
</div>`}function sm(r,e,t){let n=e.pump,o=a=>E(r,a),i=a=>a===null?"\u2013":`${O(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 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 class="live-own">
${gn(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?O(r,n.cop,1):s}</b><span>${n.cop!==null?"COP":""}</span></div>
${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>
</div>
<div class="live-rows">
<div class="live-title">${e.name}</div>
@@ -891,15 +892,14 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${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}
</div>
</div>`}function am(r,e,t){let n=(o,i,s)=>o===null?"\u2013":`${O(r,o,i)} ${s}`;return m`<div class="live-card live-card-roomclimate" data-i=${t} data-room=${e.roomId}>
<div class="live-title">${e.name||E(r,"room")}</div>
<div class="live-row live-climate-temperature"><span>🌡 ${E(r,"climate_temperature")}</span><b>${n(e.temperature===null?null:r?oe(r,e.temperature):e.temperature,1,r?X(r):"\xB0C")}</b></div>
<div class="live-row live-climate-humidity"><span>💧 ${E(r,"climate_humidity")}</span><b>${n(e.humidity,0,"%")}</b></div>
<div class="live-row live-climate-co2"><span>${E(r,"climate_co2")}</span><b>${n(e.co2,0,"ppm")}</b></div>
${e.temperature===null&&e.humidity===null&&e.co2===null?m`<small class="live-status">${E(r,"climate_card_missing")}</small>`:f}
</div>`}function hc(r,e,t,n,o=!1){return e.length?m`<div class="live-cards">
${e.map((i,s)=>i.kind==="roomclimate"?am(r,i,s):o?f:i.kind==="house"?em(r,i,s,n):i.kind==="car"?rm(r,i,s,t):i.kind==="printer"?im(r,i,s):i.kind==="heatpump"?sm(r,i,s):om(r,i,s,t))}
</div>`:f}var pc=ne`
</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>`:f}var vc=ne`
.live-cards {
position: absolute;
inset: 0;
@@ -1001,18 +1001,17 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.live-card-roomclimate {
display: grid;
gap: 4px;
min-width: 190px;
min-width: 96px;
max-width: calc(100vw - 24px);
box-sizing: border-box;
}
.live-card-roomclimate .live-title {
overflow: hidden;
text-overflow: ellipsis;
max-width: 220px;
.live-card-roomclimate .live-row {
gap: 12px;
}
.live-climate-temperature b { color: color-mix(in srgb, #ffca8a 80%, var(--nf-text)); }
.live-climate-humidity b { color: color-mix(in srgb, #7dd3fc 80%, var(--nf-text)); }
.live-climate-co2 b { color: color-mix(in srgb, #c4b5fd 80%, var(--nf-text)); }
.live-climate-illuminance b { color: color-mix(in srgb, #fde68a 80%, var(--nf-text)); }
.live-row {
display: flex;
justify-content: space-between;
@@ -1220,7 +1219,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
text-transform: uppercase;
letter-spacing: 0.04em;
}
`;function Er(r){return r.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var ni=r=>r.points.length>=3;function mc(r,e,t){return r.rooms.filter(ni).find(n=>H([e,t],n.points))}function lm(r,e,t,n){let o=[];for(let a of e.rooms.filter(ni)){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=mc(e,l,c),p=[h?.name,n?e.name:void 0].filter(d=>!!d).join(" \xB7 ");o.push({kind:"device",name:L(r,a),where:p,floorId:e.id,roomId:h?.id??null,entity:a,icon:D(a),x:l,z:c,y:u})};for(let a of e.placements){let l=a.y??wt(D(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=mc(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 fc(r,e){let t=ot(r,e.floors),n=e.floors.length>1,o=e.floors.flatMap(i=>lm(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)&&ni(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 cm(r,e){return(Er(r.name).startsWith(e)?0:2)+(r.kind==="room"?0:1)}function gc(r,e,t=8){let n=Er(e).split(/\s+/).filter(Boolean);if(n.length===0)return[];let o=Er(e.trim());return r.filter(i=>{let s=Er([i.name,i.where,i.entity].filter(Boolean).join(" "));return n.every(a=>s.includes(a))}).map(i=>({item:i,cost:cm(i,o)})).sort((i,s)=>i.cost-s.cost||i.item.name.localeCompare(s.item.name)).slice(0,t).map(i=>i.item)}var um=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[190,90,255],[255,95,210],[255,70,70],[120,255,150]],dm=[2200,2700,3200,4e3,5e3,6500],hm=["hs","rgb","rgbw","rgbww","xy"],pm=4,_c=16,bc=32,mm=128;function oi(r){let e=r.attributes.supported_color_modes??[],t=e.some(n=>hm.includes(n));return{dim:e.some(n=>n!=="onoff"),color:t,temp:e.includes("color_temp")}}function ii(r){return((r.attributes.supported_features??0)&pm)!==0&&typeof r.attributes.current_position=="number"}var ri=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 E(this.hass,e,t)}ask(){return!this.confirmSwitch||confirm(this.t("confirm_switch",{name:L(this.hass,this.entity)}))}call(e,t,n={}){this.hass.callService(e,t,{entity_id:this.entity,...n})}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}details(){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=oi(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?um.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?dm.map(s=>m`<button class="qm-swatch" style="background:${fm(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 Fr(r){return r.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var ai=r=>r.points.length>=3;function wc(r,e,t){return r.rooms.filter(ai).find(n=>H([e,t],n.points))}function gm(r,e,t,n){let o=[];for(let a of e.rooms.filter(ai)){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:D(a),x:l,z:c,y:u})};for(let a of e.placements){let l=a.y??yt(D(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)&&ai(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(Fr(r.name).startsWith(e)?0:2)+(r.kind==="room"?0:1)}function xc(r,e,t=8){let n=Fr(e).split(/\s+/).filter(Boolean);if(n.length===0)return[];let o=Fr(e.trim());return r.filter(i=>{let s=Fr([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 ci(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 ui(r){return((r.attributes.supported_features??0)&ym)!==0&&typeof r.attributes.current_position=="number"}var li=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=ci(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"}">
${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>
@@ -1235,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=Xn(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=ii(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=ui(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">
${this.ring(a)}
<button
class="qm-power qm-blind ${c&&l<100?"qm-on":""}"
@@ -1245,7 +1244,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
@click=${()=>n?this.call("cover","stop_cover"):this.ask()&&this.call("cover",l>50?"open_cover":"close_cover")}
>
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M4 4h16M5 4v15M19 4v15M7 8h10M7 12h10M7 16h10" /></svg>
<b>${t!==null?`${t} %`:te(this.hass,e)}</b>
<b>${t!==null?`${Math.round(t)} %`:te(this.hass,e)}</b>
</button>
</div>
${o?m`<input
@@ -1257,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&mm&&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&xm&&n!==null?m`<label class="qm-tilt"
><span>${this.t("cover_tilt")} · ${Math.round(n)} %</span>
<input
class="qm-slider"
@@ -1266,10 +1265,10 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
max="100"
.value=${String(n)}
aria-label=${this.t("cover_tilt")}
@change=${o=>this.call("cover","set_cover_tilt_position",{entity_id:this.tiltEntity||this.entity,tilt_position:Number(o.target.value)})}
/></label>`:t&(_c|bc)?m`<div class="qm-tilt-buttons">
${t&_c?m`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","open_cover_tilt")}>${this.t("cover_tilt_open")}</button>`:f}
${t&bc?m`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","close_cover_tilt")}>${this.t("cover_tilt_close")}</button>`:f}
@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">
<button
class="qm-power ${t?"qm-on":""}"
@@ -1279,7 +1278,7 @@ 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,g=!1)=>m`<button class="qm-swatch qm-slot ${g?"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=>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"}">
${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>
@@ -1291,8 +1290,8 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${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=D(this.entity),n=I(e)&&!Ut(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=${L(this.hass,this.entity)}>
<div class="qm-title">${L(this.hass,this.entity)}</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=D(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)}>
<div class="qm-title">${O(this.hass,this.entity)}</div>
${n}
<button class="qm-details" @click=${()=>this.details()}>${this.t("details")} …</button>
</div>`}static styles=[$e,ne`
@@ -1538,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 fm(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",ri);var gm=new URL(import.meta.url),_m=new URL("./nextfloor-3d.js?v=74227cd20cc3",gm).href,wc;function vc(){return wc??=import(_m),wc}function yc(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 bm=new Set(["on","home","open","true","active","playing","heat","heating"]);function Rr(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):bm.has(o)||Number.isFinite(Number(o))&&Number(o)>0;return t.invert?!s:s}function si(r,e){let t=[];for(let n of e.floors)for(let o of n.furniture)Rr(r,o)||t.push(o.id);return t.sort()}function xc(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 kc="image:";function ai(r,e,t){let n=(e??"").trim();if(!n)return null;if(n.startsWith(kc))return t(n.slice(kc.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 _n=r=>Number(r);function wn(r){if(Array.isArray(r)){let[i,s]=[_n(r[0]),_n(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]=[_n(e),_n(t)];return Number.isFinite(n)&&Number.isFinite(o)?[n,o]:null}function Sc(r){return r?wn(r.charger)??wn(r.charger_position):null}function $c(r){for(let[e,t]of Object.entries(r.states))if(e.startsWith("camera.")&&(wn(t.attributes?.vacuum_position)??Sc(t.attributes)))return e;return null}var wm=r=>Array.isArray(r)?typeof r[0]=="number":!!r&&typeof r=="object",bn=(r,e)=>e?[r[0],-r[1]]:r;function vm(r){if(!r)return null;let e=r.mirror===!0,[t,n]=bn(r.ga,e),[o,i]=bn(r.gb,e),[s,a]=r.a,[l,c]=r.b,[u,h]=[o-t,i-n],[p,d]=[l-s,c-a],g=Math.hypot(u,h),b=Math.hypot(p,d);if(!(g>1e-6)||!(b>1e-6))return null;let _=b/g,w=Math.atan2(d,p)-Math.atan2(h,u),[S,M]=[Math.cos(w),Math.sin(w)];return x=>{let y=bn(x,e),[F,T]=[y[0]-t,y[1]-n];return[s+_*(F*S-T*M),a+_*(F*M+T*S)]}}function ym(r){if(!r)return null;let e=r.mirror===!0,[t,n]=bn(r.ga,e),[o,i]=bn(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 Mc(r,e,t){if(!e)return null;let n=r.states[e]?.attributes;if(!n)return null;let o=vm(t)??(g=>g),i=ym(t)??0,s=t?.mirror===!0?-1:1,a=n.vacuum_position,l=wn(a),c=l?(()=>{let[g,b]=o(l),_=_n(a?.a)*s;if(!Number.isFinite(_))return{x:g,z:b,heading:0};let w=_*Math.PI/180+i;return{x:g,z:b,heading:Math.atan2(Math.cos(w),Math.sin(w))}})():null,u=Sc(n),h=Array.isArray(n.path)?n.path:[],p=h.length>0&&wm(h[0])?[h]:h,d=[];for(let g of p){let b=[];for(let _ of Array.isArray(g)?g:[]){let w=wn(_);w&&b.push(o(w))}b.length>1&&d.push(b)}return!c&&!u&&!d.length?null:{pose:c,charger:u?o(u):null,path:d}}var Ac="nextfloor.lock3d",Ec=520,ci=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
`]};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",li);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 Dr(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 di(r,e){let t=[];for(let n of e.floors)for(let o of n.furniture)Dr(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 hi(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,F]=[z[0]-t,z[1]-n];return[s+g*(E*S-F*k),a+g*(E*k+F*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 Fc(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 Dc="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=>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?At(this.hass,o.history,o.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==i.entities)&&(this.openingLinks=rt(i,n.floors),this.furnitureLinks=ot(i,n.floors),this.linkedRegistry=i.entities,this.findIndex=null,this.alertSrc=this.alerts?gl(i,n,this.weatherEntityId,this.openingLinks):null,this.watched=Sl({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(v=>this.shownStates.get(v)!==i.states[v])))return;si(i,n).join(",")!==this.shownFor?.key&&t.setBuilding(this.shownBuilding(i)),this.shownStates=new Map(this.watched.map(v=>[v,i.states[v]])),this.refreshToday(n),this.refreshForecast(n);let a=en(i,n),l=ra(i,n.floors.some(v=>v.layer&&this.hiddenLayers.has(v.id))?this.shownBuilding(i):n);this.placementInfo=new Map(l.map(v=>[v.id,{floorId:v.floorId,roomId:v.roomId,x:v.x,z:v.z,y:v.y,rotation:v.rotation??0}]));let c=this.furnitureMarkers(i,n,new Set(l.map(v=>v.id)),new Set(a.map(v=>v.powerEntity)));a.push(...c.consumers);let u=tn(i,n,a,De(n,v=>this.furnitureLinks?.get(v.id)?.power??null)),h=new Map(a.filter(v=>v.id!==v.powerEntity).map(v=>[v.id,v.power]));this.confirmSet=it(i,n.floors);let p=new Set(this.liveCardsOn?this._liveCards.flatMap(v=>v.kind==="media"?[v.media.entity]:v.kind==="car"?[v.spot]:[]):[]);for(let v of n.floors)for(let k of v.outdoor??[]){if(!k.area_id&&!k.temp_entity&&!k.pump_entity)continue;let B=k.temp_entity?i.states[k.temp_entity]:void 0,z=k.pump_entity?i.states[k.pump_entity]:void 0,[W,de]=xe(k.points),qe=B&&Number.isFinite(Number(B.state))?`${O(i,oe(i,Kn(Number(B.state),B.attributes.unit_of_measurement)),1)} ${X(i)}`:"",ut=!!z&&Q(z);l.push({id:k.area_id?`outdoor:${k.id}`:k.pump_entity??k.temp_entity,floorId:v.id,roomId:null,x:W,z:de,y:Nn(v,k,W,de)+.7,icon:ke(k.type==="pool"?"pool":k.type==="terrace"?"table-chair":"tree-outline"),name:k.area_id&&i.areas?.[k.area_id]?.name||E(i,`out_${k.type}`),text:[qe,ut?E(i,"pool_pump_on"):""].filter(Boolean).join(" \xB7 "),active:ut,unavailable:!1,glow:null,show:"always"})}let d=new Map;for(let v of n.floors){for(let k of v.placements)k.pin_offset&&d.set(`${v.id}:${k.entity_id}`,k.pin_offset);for(let k of v.furniture)k.pin_offset&&d.set(`f:${k.id}`,k.pin_offset)}let g=v=>{let k=v.lamp?void 0:(v.furnitureId?d.get(`f:${v.furnitureId}`):void 0)??d.get(`${v.floorId}:${v.id}`);return k?{...v,x:v.x+(k.x??0),z:v.z+(k.z??0),y:v.y+(k.y??0)}:v};t.setDevices([...[...l,...c.markers].map(g).map(v=>{let k=v.show==="no_power"||"energyDevice"in v&&v.energyDevice?null:h.get(v.id)??null,B={...v,power:k,powerText:k===null?void 0:ae(i,k),effect:this.dimmed?void 0:v.effect,text:this.subMeterText(i,n,u,v.furnitureId)??v.text},z=v.ownName&&(v.showName||this.markerNames)?v.ownName:"",W=p.has(v.id)||!!v.furnitureId&&p.has(v.furnitureId);return{...B,pin:this.showPin(B)&&!W,full:v.show==="always",caption:z}})]),t.setPickTargets(c.targets,this.openingTargets(),this.secondBlinds()),t.setScreens(c.screens),t.setFridgeDoors(Ns(i,n.floors)),t.setCovers(Zs(i,n)),t.setRobots(this.robotInfos(i,n));let b=new Map;for(let v of n.floors)for(let k of v.furniture)!q(k.type)?.pet||!k.room_sensor||k.room_sensor==="none"||b.set(k.id,fo(i,v.rooms.filter(B=>B.points.length>=3),null,k.room_sensor)?.id??null);b.size&&t.setPetRooms(b),t.setRoofWindows(dl(i,n)),t.setParked(Lo(i,n)),t.setGateStates(zl(i,n));let _=new Map(n.floors.flatMap(v=>v.openings.map(k=>[k.id,k.type]))),w=new Map([...this.openingLinks].map(([v,k])=>[v,Re(i,k,_.get(v))]));t.setOpeningStates(w),this.setAlerts(this.alertSrc?No(i,n,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(i);let S=[...l,...c.markers].map(v=>`${v.id}:${v.glow?`${v.glow.level.toFixed(1)}/${v.glow.color.map(k=>k.toFixed(1)).join("/")}`:0}`).join(";")+"|"+[...w].map(([v,k])=>`${v}:${k.open}:${k.cover===null?"-":k.cover.toFixed(1)}`).join(";");if(S!==this.thumbSig){let v=this.thumbSig==="";this.thumbSig=S,v||this.scheduleThumbs(1500)}let M=Gl(i,n,a,n.energy.advanced?v=>this.furnitureLinks?.get(v.id)?.power??null:void 0),x=this.liveCars(i,n);for(let v of x){if(!v.car.home||!v.car.charging&&!v.car.plugged)continue;let k=n.floors.flatMap(W=>W.furniture.filter(de=>de.type==="wallbox").map(de=>({floorId:W.id,x:de.x,z:de.z,y:1}))).sort((W,de)=>Math.hypot(W.x-v.at.x,W.z-v.at.z)-Math.hypot(de.x-v.at.x,de.z-v.at.z))[0],B=k&&k.floorId===v.at.floorId&&Math.hypot(k.x-v.at.x,k.z-v.at.z)<9,z=k??pn(n);!z||!v.car.charging&&!B||M.arcs.push({key:`car:${v.spot}`,from:z,to:{...v.at,y:.8},power:v.car.charging?v.car.chargingW??7e3:0,color:[80,175,255],...B?{via:[{...z,y:.35},{floorId:v.at.floorId,x:(z.x+v.at.x)/2,z:(z.z+v.at.z)/2,y:.08},{...v.at,y:.5}],cable:!0}:{}})}let y=pn(n);for(let v of this.liveHeatPumps(n)){let k=v.pump.heat??(v.pump.mode==="heating"||v.pumLine truncated
<button class="nf-thumbs-fold" title=${E(this.hass,n?"thumbs_show":"thumbs_fold")} aria-label=${E(this.hass,n?"thumbs_show":"thumbs_fold")} @click=${o}>${n?"\u25B8":"\u25C2"}</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;di(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&&Q(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,wo(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(Uo(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?Vo(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>
<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>${E(this.hass,"all_floors")}</span>
<span>${A(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="" />`}
<span>${e.get(i.floorId)??""}</span>
</button>`)}
</nav>`}onDeviceHold(e,t,n){let o=D(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=D(e);if(l==="light"&&oi(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"&&ii(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,ha(this.hass,n=>this.announce(n)).then(n=>{t?n():this.stopAnnouncements=n})}announce(e){let t=e;if(t?.reload===!0){(!t.template||t.template===this.templateName)&&setTimeout(()=>location.reload(),500+Math.random()*6e3);return}if(typeof e?.message!="string"||!e.message.trim()||!la(e,this.screenName)||!ca(e))return;let n=ua(e.message);this._announcement={message:e.message,until:Date.now()+n},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,n),da(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?m`<button class="nf-announcement" role="alert" title=${E(this.hass,"close")} @click=${()=>this._announcement=null}>
</nav>`}onDeviceHold(e,t,n){let o=D(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=D(e);if(l==="light"&&ci(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"&&ui(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}>
<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=${Oo(this.hass,e,n)} @click=${()=>this.jumpTo(n)}>${Oo(this.hass,e,n)}</button>`)}
${t.map(n=>m`<button class="nf-alert nf-alert-${n.kind}" style=${n.color?`border-left-color:${n.color}`:""} title=${Ko(this.hass,e,n)} @click=${()=>this.jumpTo(n)}>${Ko(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=>D(i)==="scene"||D(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)}>${L(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=${E(this.hass,"find")} aria-label=${E(this.hass,"find")} @click=${()=>this._find=""}>
${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=""}>
<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=gc(this.findIndex??=fc(this.hass,e),this._find);return m`<div class="nf-find">
</button>`;let t=xc(this.findIndex??=yc(this.hass,e),this._find);return m`<div class="nf-find">
<input
type="search"
placeholder=${E(this.hass,"find_placeholder")}
placeholder=${A(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=${E(this.hass,"close")} @click=${()=>this._find=null}>✕</button>
<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)}>
<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?nr(n.icon):"M4 10l8-6 8 6v10H4z"} /></svg></span>
<span class="nf-find-icon"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d=${n.icon?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>${E(this.hass,"find_none")}</p>`}
</button>`):m`<p>${A(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=(_,w)=>E(t,_,w),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)=>A(t,g,v),o=m`<button
class="nf-central-btn ${this._central?"nf-central-on":""}"
title=${n("central")}
aria-label=${n("central")}
@@ -1582,15 +1581,15 @@ 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(_=>_.id===this.floorId):void 0,s=i?[i]:e.floors,a=s.flatMap(_=>go(t,_).lights),l=s.flatMap(_=>go(t,_).covers),c=a.filter(_=>t.states[_]?.state==="on").length,u=!i,h=(_,w,S,M)=>{if(M.length){if(u&&this._armed!==_){this._armed=_,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(w,S,{entity_id:M})}},p=(_,w,S,M,x)=>m`<button class="nf-btn ${this._armed===_?"nf-central-armed":""}" ?disabled=${!x.length} @click=${()=>h(_,S,M,x)}>
${this._armed===_?n("central_sure"):n(w)}
</button>`,d=e.settings.favorite_floors??{},g=(e.settings.favorites??[]).filter(_=>t.states[_]&&(!d[_]||!i||d[_]===i.id)),b=this.buttons??e.settings.buttons??[];return m`${o}
</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=>yo(t,g).lights),l=s.flatMap(g=>yo(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)}>
${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}
<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(_=>t.states[_]?.state==="off"))}
${p("lights_off","central_off","light","turn_off",a.filter(_=>t.states[_]?.state==="on"))}
${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"))}
</div>
${l.length?m`<div class="nf-central-row">
<span>${n("central_covers")} <small>${l.length}</small></span>
@@ -1598,26 +1597,26 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${p("covers_close","central_close","cover","close_cover",l)}
</div>`:f}
<b>${n("central_favorites")}</b>
${g.length?m`<div class="nf-central-favs">
${g.map(_=>{let[w,S]=Vs(_),M=t.states[_],x=w==="homeassistant"&&M?.state==="on";return m`<button
${_.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
class="nf-chip"
aria-pressed=${x||this._sceneFired===_}
?disabled=${I(M)}
@click=${()=>{t.callService(w,S,{entity_id:_}),this._sceneFired=_,setTimeout(()=>this._sceneFired=null,600)}}
aria-pressed=${y||this._sceneFired===g}
?disabled=${I(k)}
@click=${()=>{t.callService(v,S,{entity_id:g}),this._sceneFired=g,setTimeout(()=>this._sceneFired=null,600)}}
>
${L(t,_)}
${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(_=>m`<button
${b.map(g=>m`<button
class="nf-chip nf-own-btn"
aria-pressed=${Ks(t,_)}
@click=${w=>{_o(t,w.currentTarget,_),_.action!=="service"&&(this._central=!1)}}
aria-pressed=${Ys(t,g)}
@click=${v=>{xo(t,v.currentTarget,g),g.action!=="service"&&(this._central=!1)}}
>
${_.icon?m`<ha-icon .icon=${_.icon.startsWith("mdi:")?_.icon:`mdi:${_.icon}`}></ha-icon>`:f}${_.label}
${g.icon?m`<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(Ac,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 on(this.hass,tl(this.watched),n,t);if(!this._travel||this._travel.from!==n)return;this._travel={...this._travel,history:o,moments:nl(o,n,t),loading:!1}}catch{this._travel=null,this._error=E(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=>E(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(Dc,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")}>
<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">
@@ -1630,18 +1629,18 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
<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=>E(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=>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()}>
${this._walking?"\u2715":J`<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()}>
<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=E(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=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()}>
<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?J`<path d="M8 11V8a4 4 0 0 1 8 0v3" />`:J`<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=E(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 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
class="nf-eye ${this.clean?"nf-eye-clean":""}"
title=${e}
aria-label=${e}
@@ -1650,12 +1649,12 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
>
${this.clean?J`<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>`:J`<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">
<span>${L(this.hass,e.entity)}</span>
<b>${t?E(this.hass,"swipe_off"):`${e.value} %`}</b>
<span>${O(this.hass,e.entity)}</span>
<b>${t?A(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?bo(o.gang_entities,q(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?ko(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 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=Q(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>${L(t,o)}</span><i>${s?te(t,s):"\u2013"}</i></button>`})}
${e.ids.map((o,i)=>{let s=t.states[o],a=Q(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>
<nf-quick-menu
style="left:${i}px;top:${s}px"
@@ -1666,63 +1665,63 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.presets=${(this.building?.settings.media_presets??[]).filter(a=>!a.speakers?.length||a.speakers.includes(e.entity))}
?confirmSwitch=${this.confirmSet.has(e.entity)}
.myPosition=${this.myPositionOf(e.entity)}
.tiltEntity=${Qn(this.hass,this.building?.floors??[],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&&_o(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??De(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&fe(this,a);return}let i=D(e);if(i==="cover"||i==="media"){this._menu={entity:e,x:t,y:n};return}if(i==="lock"){let s=po(this.hass,e),a=L(this.hass,e);confirm(E(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(i&&bs.has(i)){if(this.confirmSet.has(e)&&!confirm(E(this.hass,"confirm_switch",{name:L(this.hass,e)})))return;ia(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 Ji({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=${E(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&&xo(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=D(e);if(i==="cover"||i==="media"){this._menu={entity:e,x:t,y:n};return}if(i==="lock"){let s=bo(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&&ks.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 ns({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>
<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(!oc(i.type))continue;let s=this.furnitureLinks?.get(i.id),a=rc(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(!Xo(i.type))continue;let s=this.furnitureLinks?.get(i.id),a=Qo(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=cc(e,i);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=Wo(e,i),l=a?xl(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||L(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 al(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,Ql(t,n,o).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,n=e.settings.forecast&&t?Ue(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,tc(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=ec(this._forecast,Math.max(1,Math.min(7,o.days)));if(!i.length)return f;let s=Ue(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=${E(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(!oi(i.type))continue;let s=this.furnitureLinks?.get(i.id),a=ri(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=Go(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")}>
<ul>
${i.map((d,g)=>m`<li>
<span class="nf-fc-day">${g===0?E(n,"today"):h.format(new Date(d.day))}</span>
${i.map((d,_)=>m`<li>
<span class="nf-fc-day">${_===0?A(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-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=Yl(t,e,Date.now(),{today:E(t,"care_bin_today"),tomorrow:E(t,"care_bin_tomorrow")}),o=Jl([...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 E(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=${E(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: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")}>
<button class="nf-today-head" aria-expanded=${i} @click=${()=>this._todayOpen=!i}>
<b>📅 ${E(t,"today")}</b><span>${s}</span>
<b>📅 ${A(t,"today")}</b><span>${s}</span>
</button>
${i?o.length?m`<ul>
${c}
</ul>`:m`<p class="nf-today-none">${E(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=De(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};Ba(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?j(n?.states[i.power_entity]):null;if(i&&s!==null){let a=t&&t>0?` \xB7 ${E(n,"floor_power_share",{n:Math.round(Math.max(0,s)/t*100)})}`:"";o.push({icon:"\u26A1",label:i.name,value:`${at(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:E(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=>tn(a,e,en(a,e),De(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),o=rl(t,n),i=Date.now(),s=i-24*36e5;on(t,o,s,i,!0).then(a=>{this.dayCurves=ol(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=pn(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,g=0;for(let b of h.rooms)for(let[_,w]of b.points)p+=_,d+=w,g++;a.push({kind:"house",at:{floorId:h.id,x:g?p/g:u.x,z:g?d/g: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(...Ul(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,g,b)=>this.placeLhCard(p,d,g,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&&dc(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=>E(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:`${O(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">
</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>
</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=${E(this.hass,"holos_hint")} aria-label=${E(this.hass,"holos")} @click=${()=>this.toggleLhCards()}>
<span>${E(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=${L(this.hass,t)} @click=${()=>fe(this,t)}>
<span>${L(this.hass,t)}</span><b>${te(this.hass,this.hass.states[t])}</b>
</button>`)}renderMapCredit(){let e=this.building?.settings.map;return Rl(e)?m`<a class="nf-map-credit" href=${Bo(e).href} target="_blank" rel="noopener">${Bo(e).text}</a>`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=st(new Date,this.hass?.config?.latitude??50),t=cr(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=>E(this.hass,l);return m`<div class="nf-legend">
</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)}>
<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=${jo(e).href} target="_blank" rel="noopener">${jo(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>
<span class="nf-legend-bar" style="background:${La(this.heatMode,e)}"></span>
<span class="nf-legend-range"><span>${O(this.hass,o,0)} ${s}</span><span>${O(this.hass,i,0)} ${s}</span></span>
<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)=>E(e,c,u),o=t.floors.flatMap(c=>c.furniture.filter(u=>ei(u.type)).map(u=>ti(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=ac(a);return m`<div class="nf-legend">
</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=>ii(u.type)).map(u=>si(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">
<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=an[this.theme]??an.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=an[this.theme]??an.neon,o=`--nf-sky:${t(n.night[0],n.day[0])};--nf-ground:${t(n.night[1],n.day[1])}`+il(this.building?.settings.backdrop);return m`<div
</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
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()} ${hc(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._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.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?E(this.hass,"stats_fps",{fps:this._stats.fps,ms:this._stats.worstMs}):E(this.hass,"stats_idle")}</b>
${this._stats.busy.length?m`(${this._stats.busy.map(i=>E(this.hass,`stats_busy_${i}`)).join(", ")})`:f} ·
${E(this.hass,"stats",{calls:this._stats.calls,tris:this._stats.triangles.toLocaleString()})} ·
${E(this.hass,this._stats.low?"stats_low":"stats_full",{r:O(this.hass,this._stats.pixelRatio,2)})}</span
><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
>`:f}
</div>`}static styles=[$e,Ke,pc,ne`
</div>`}static styles=[$e,Ue,vc,ne`
:host {
display: block;
position: relative;
@@ -3300,26 +3299,26 @@ 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",ci);function ae(r,e){return Math.abs(e)>=1e3?`${O(r,e/1e3,1)} kW`:`${Math.round(e)} W`}function li(r){return r.type==="tv_board"?r.h+.9:r.type==="tv_wall"||r.type==="kitchen_wall"?r.h+.25:r.h+.35}function km(r,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:te(r,e)}var Rc;function zc(){let r=new URL("./nextfloor-editor.js?v=a47d165ade30",new URL(import.meta.url)).href;return Rc??=import(r),Rc}var Sm=.25,Tc=r=>Math.round(r*1e3)/1e3,Fc=(r,e,t)=>r.rooms.find(n=>n.points.length>=3&&H([e,t],n.points));function di(r,e,t,n,o){let i=Fc(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 $m(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 ui=(r,e)=>Math.abs((r-e+540)%360-180);function Dc(r,e,t,n=Sm){let o=Fc(r,e.x,e.z);if(!o)return null;let i=o.points,s=tt(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],g=ie(Y([e.x,e.z],l),p);if(g<0||g>h)return;let b=$m(r,o,l,d)?t/2:0,_=ie(Y([e.x,e.z],l),d)-b,w=Math.atan2(-d[0],d[1])*180/Math.PI,M=[{rotation:w,extent:e.d/2},{rotation:w+90,extent:e.w/2},{rotation:w-90,extent:e.w/2}].reduce((y,F)=>ui(e.rotation,F.rotation)<ui(e.rotation,y.rotation)?F:y);if(ui(e.rotation,M.rotation)>50)return;let x=_-M.extent;Math.abs(x)>n||a&&Math.abs(x)>=Math.abs(a.gap)||(a={x:Tc(e.x-d[0]*x),z:Tc(e.z-d[1]*x),rotation:(Math.round(M.rotation)%360+360)%360,gap:x})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function zr(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 Tr(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 Pc(r,e){let t=structuredClone(r);for(let n of t.floors)n.furniture=n.furniture.filter(o=>o.id!==e);return t}function Hc(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 Ic(r,e,t,n){return Tr(r,e,(o,i)=>{[o.x,o.z]=di(i,o.x,o.z,t,n)})}function Cc(r,e,t,n){let o=r.settings.wall_interior??.12;return zr(r,e,(i,s)=>{[i.x,i.z]=di(s,i.x,i.z,t,n);let a=Dc(s,i,o);a&&Object.assign(i,a)})}var hi=(r,e)=>((r+e)%360+360)%360,Nc=r=>Number.parseFloat(r.replace(",",".")),vn=(r,e)=>Math.round(r*10**e)/10**e;function pi(r){let{min:e,max:t,accepts:n=()=>!0}=r,o=i=>{let s=Nc(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 pi(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=093db5e24b2d",new URL(import.meta.url)).href;return Hc??=import(r),Hc}var Fm=.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 gi(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 Dm(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 fi=(r,e)=>Math.abs((r-e+540)%360-180);function Wc(r,e,t,n=Fm){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=De(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=Dm(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)=>fi(e.rotation,E.rotation)<fi(e.rotation,z.rotation)?E:z);if(fi(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]=gi(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]=gi(s,i.x,i.z,t,n);let a=Wc(s,i,o);a&&Object.assign(i,a)})}var _i=(r,e)=>((r+e)%360+360)%360,Kc=r=>Number.parseFloat(r.replace(",",".")),kn=(r,e)=>Math.round(r*10**e)/10**e;function bi(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}
>${r.label}
<input type="number" inputmode="decimal" step=${r.step} min=${e} max=${t??f} .value=${String(vn(r.value,2))} @change=${o} />
</label>`}var Wc=(r,e)=>m`<button class="nf-chip" @click=${e}>${r.t("height_auto")}</button>`,Oc=(r,e)=>m`<button class="nf-chip" @click=${()=>e(-r)}>↺ ${r}°</button><button class="nf-chip" @click=${()=>e(r)}>↻ ${r}°</button>`;function Mm(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)=>pi({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]=vn(l,3))}),i=ps(n)?m`${pi({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=vn(s,3))})}
${n.mount_y!=null?Wc(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 Am(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=D(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}))}>
<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)=>bi({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=bs(n)?m`${bi({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=D(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?wt(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}
${pi({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=vn(l,3))})}
${n.y!==null?Wc(r,()=>r.editDevice(e,l=>l.y=null)):f}`}function Lc(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>
${Mm(r,e)} ${Oc(45,s=>r.turnFurniture(e,s))}
</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}
${bi({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))}
<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>${L(r.hass,t)}</span>
${Am(r,t)} ${Oc(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 Bc=J`<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=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=J`<svg class="nf-mark" viewBox="60 40 392 420" aria-hidden="true">
<polygon points="106,150 256,66 406,150 256,234" fill="none" stroke="currentColor" stroke-opacity=".55" stroke-width="12" stroke-dasharray="6 22" stroke-linecap="round"/>
<polygon points="106,382 256,466 256,488 106,404" fill="#34507d"/><polygon points="406,382 256,466 256,488 406,404" fill="#2a4068"/><polygon points="106,382 256,298 406,382 256,466" fill="#5f7fb6"/>
<polygon points="106,310 256,394 256,416 106,332" fill="#4a72b8"/><polygon points="406,310 256,394 256,416 406,332" fill="#3b5c98"/><polygon points="106,310 256,226 406,310 256,394" fill="#8ab6f5"/>
<polygon points="106,238 256,322 256,344 106,260" fill="#2a74d8"/><polygon points="406,238 256,322 256,344 406,260" fill="#2161b8"/><polygon points="106,238 256,154 406,238 256,322" fill="#4fb6ff"/>
<circle cx="256" cy="236" r="16" fill="#ffe08a"/>
</svg>`;var le=(r,e)=>({name:r,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),Pt=(r,e,t)=>({name:r,fallback:t,read:n=>e.find(o=>o===n)??t,write:n=>n}),mi={explode:le("explode",!0),keepRoof:le("roof",!1),solidWalls:le("solid_walls",!1),quality:Pt("quality",["auto","low","high"],"auto"),stats:le("stats",!1),markers:Pt("markers",["none","important","all"],"important"),heat:Pt("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:Pt("theme",br,"neon"),clock:Pt("clock",["none","top_left","top_right","bottom_left","bottom_right"],"none"),accent:{name:"accent",fallback:null,read:r=>/^#[0-9a-f]{6}$/i.test(r)?r:null,write:r=>r??""},floorStack:Pt("floor_stack",["dim","stacked","single"],"dim"),roomNames:le("room_names",!0),clean:le("clean",!1),navWrap:le("nav_wrap",!1),weather:le("weather",!0),timeSlider:le("time_slider",!1),menuOpen:le("menu_open",!1),keepCamera:le("keep_camera",!1),readable:le("readable",!1),plain:le("plain",!1),rightBack:le("right_back",!1),zoom:{name:"zoom",fallback:100,read:r=>/^\d{2,3}$/.test(r)?Math.min(250,Math.max(60,Number(r))):100,write:r=>String(Math.round(Math.min(250,Math.max(60,r))))},screenName:{name:"screen_name",fallback:"",read:r=>r.slice(0,60),write:r=>r.trim().slice(0,60)},announceMuted:le("announce_muted",!1),glassWalls:{name:"glass_walls",fallback:20,read:r=>/^\d{1,3}$/.test(r)?Math.min(100,Number(r)):20,write:r=>String(Math.round(Math.min(100,Math.max(0,r))))}};function Vc(r=Dr()){try{return r?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function Kc(r=Dr()){try{return r?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function Dr(){try{return localStorage}catch{return null}}var Fr=class{storage;constructor(e){this.storage=e}raw(e){try{return this.storage?.getItem(`nextfloor.${e}`)??null}catch{return null}}load(e=""){let t={};for(let n of Object.keys(mi)){let o=mi[n],i=this.raw(o.name);t[n]=i===null?o.fallback:o.read(i)}return new URLSearchParams(e).has("nf_stats")&&(t.stats=!0),t}save(e,t){let n=mi[e];try{this.storage?.setItem(`nextfloor.${n.name}`,n.write(t))}catch{}}};var Gc=ne`
</svg>`;var le=(r,e)=>({name:r,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),It=(r,e,t)=>({name:r,fallback:t,read:n=>e.find(o=>o===n)??t,write:n=>n}),vi={explode:le("explode",!0),keepRoof:le("roof",!1),solidWalls:le("solid_walls",!1),quality:It("quality",["auto","low","high"],"auto"),stats:le("stats",!1),markers:It("markers",["none","important","all"],"important"),heat:It("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:It("theme",xr,"neon"),clock:It("clock",["none","top_left","top_right","bottom_left","bottom_right"],"none"),accent:{name:"accent",fallback:null,read:r=>/^#[0-9a-f]{6}$/i.test(r)?r:null,write:r=>r??""},floorStack:It("floor_stack",["dim","stacked","single"],"dim"),roomNames:le("room_names",!0),clean:le("clean",!1),navWrap:le("nav_wrap",!1),weather:le("weather",!0),timeSlider:le("time_slider",!1),menuOpen:le("menu_open",!1),keepCamera:le("keep_camera",!1),readable:le("readable",!1),plain:le("plain",!1),rightBack:le("right_back",!1),zoom:{name:"zoom",fallback:100,read:r=>/^\d{2,3}$/.test(r)?Math.min(250,Math.max(60,Number(r))):100,write:r=>String(Math.round(Math.min(250,Math.max(60,r))))},screenName:{name:"screen_name",fallback:"",read:r=>r.slice(0,60),write:r=>r.trim().slice(0,60)},announceMuted:le("announce_muted",!1),glassWalls:{name:"glass_walls",fallback:20,read:r=>/^\d{1,3}$/.test(r)?Math.min(100,Number(r)):20,write:r=>String(Math.round(Math.min(100,Math.max(0,r))))}};function Zc(r=Cr()){try{return r?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function Yc(r=Cr()){try{return r?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function Cr(){try{return localStorage}catch{return null}}var Ir=class{storage;constructor(e){this.storage=e}raw(e){try{return this.storage?.getItem(`nextfloor.${e}`)??null}catch{return null}}load(e=""){let t={};for(let n of Object.keys(vi)){let o=vi[n],i=this.raw(o.name);t[n]=i===null?o.fallback:o.read(i)}return new URLSearchParams(e).has("nf_stats")&&(t.stats=!0),t}save(e,t){let n=vi[e];try{this.storage?.setItem(`nextfloor.${n.name}`,n.write(t))}catch{}}};var Jc=ne`
.nf-dot {
display: inline-block;
width: 8px;
@@ -3804,11 +3803,11 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
gap: 12px;
margin: auto;
}
`;var fi=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 bt(this);store=new Fr(Dr());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:et(pt(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>
`;var Qc=new WeakMap,Xc=new WeakMap,Im={open_cover:"close_cover",close_cover:"open_cover",open_cover_tilt:"close_cover_tilt",close_cover_tilt:"open_cover_tilt"};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,{inverted:c.cover_inverted,tiltInverted:c.cover_tilt_inverted,tilt:c.cover_tilt==="none"?null:c.cover_tilt,position:c.position,positionInverted:c.position_inverted});for(let l of Re(t,e).values())l.cover&&!i.has(l.cover)&&i.set(l.cover,{inverted:l.coverInverted,tiltInverted:l.coverTiltInverted,tilt:l.coverTilt,position:l.position,positionInverted:l.positionInverted}),l.cover2&&!i.has(l.cover2)&&i.set(l.cover2,{inverted:l.cover2Inverted,tiltInverted:l.cover2TiltInverted,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&&c.positionInverted&&(p=100-p),p===null&&(p=typeof u.attributes.current_position=="number"?u.attributes.current_position:null),p!==null&&(h.current_position=c.inverted?100-p: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&&(c.tiltInverted&&(_=100-_),h.current_tilt_position=_,h.supported_features=Number(h.supported_features??0)|128);let b=u.state;c.inverted&&(b={open:"closed",closed:"open",opening:"closing",closing:"opening"}[b]??b),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");if(v&&_.tilt&&(b.entity_id=_.tilt),v?_.tiltInverted:_.inverted){g=Im[g]??g;let k=v?"tilt_position":"position";typeof b[k]=="number"&&(b[k]=100-b[k])}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 wi=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"
><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)=>E(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=pr(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=Zt(this.hass,e.floors,e.settings.outside_hidden);return this.outsideMemo={building:e,entities:this.hass.entities,ids:n},n}openOutside(){let e=!this._outside;this.openFloor(null),this._outside=e}onRoomTap(e){let{floorId:t,roomId:n}=e.detail;if(n==="nf-outside")return this.openOutside();if((this.data.building?.floors.length??0)>1&&t&&this._floorId!==t)return this.openFloor(t);n&&(this._roomId=n===this._roomId?null:n,this._outside=!1)}furnishHost={hass:void 0,building:void 0,t:this.t,editFurniture:(e,t)=>this.applyEdit(n=>zr(n,e,t)),editDevice:(e,t)=>this.applyEdit(n=>Tr(n,e,t)),turnFurniture:(e,t)=>this.applyEdit(n=>zr(n,e,o=>o.rotation=hi(o.rotation,t))),turnDevice:(e,t)=>this.applyEdit(n=>Tr(n,e,o=>o.rotation=hi(o.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>Pc(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>Hc(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&&tr(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}`:""}>
/></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=_i(o.rotation,t))),turnDevice:(e,t)=>this.applyEdit(n=>Hr(n,e,o=>o.rotation=_i(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}
@@ -3821,7 +3820,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
</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>
<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",br,e.theme,t=>this.t(`theme_${t}`),t=>this.setPref("theme",t),this.accentPicker())}
${this.choiceRow("theme",xr,e.theme,t=>this.t(`theme_${t}`),t=>this.setPref("theme",t),this.accentPicker())}
${this.choiceRow("markers",["none","important","all"],e.markers,t=>this.t(`markers_${t}`),t=>this.setPref("markers",t))}
<label class="nf-seg nf-clock-pick" title=${this.t("clock")}
>🕒
@@ -3860,7 +3859,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
</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">
<ha-menu-button .hass=${this.hass} .narrow=${this.narrow}></ha-menu-button>
<h1>${Bc}NextFloor</h1>
<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}
<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}
@@ -3874,7 +3873,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
<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():(zc().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?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??[]}
@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
class="nf-body"
@@ -3882,10 +3881,10 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.building=${e}
.narrow=${this.narrow}
.packs=${this.data.packs}
.loadCardEditor=${Mn}
.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=rn(el(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>
></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>`)}
${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
@@ -3897,7 +3896,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
</button>`)]),l=this.t(o?"nav_row":"nav_wrap");return m`<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,g])=>m`<button aria-pressed=${p} @click=${d}>${g}</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 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">
<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">
@@ -3926,7 +3925,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
<div class="nf-stage-wrap ${this._roomId?"nf-room-open":""}">
<nf-view3d
class="nf-body"
.hass=${this.hass}
.hass=${dt(this.hass,e.floors)}
.building=${e}
.packs=${this.data.packs}
.floorStack=${t.floorStack}
@@ -3945,7 +3944,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.keepRoof=${t.keepRoof}
.markerMode=${t.markers}
.heatMode=${t.heat}
.theme=${wr(t.theme,this.sunState())}
.theme=${kr(t.theme,this.sunState())}
.timeOfDay=${this._timeOfDay}
.clock=${t.clock==="none"?null:t.clock}
.announcements=${!t.announceMuted}
@@ -3964,9 +3963,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
?furnish=${this._furnish}
.selectedFurniture=${this._selFurniture}
@furniture-select=${o=>this._selFurniture=o.detail.id}
@furniture-move=${o=>this.applyEdit(i=>Cc(i,o.detail.id,o.detail.x,o.detail.z))}
@furniture-move=${o=>this.applyEdit(i=>Vc(i,o.detail.id,o.detail.x,o.detail.z))}
@device-select=${o=>this._selDevice=o.detail.id}
@device-move=${o=>this.applyEdit(i=>Ic(i,o.detail.id,o.detail.x,o.detail.z))}
@device-move=${o=>this.applyEdit(i=>Bc(i,o.detail.id,o.detail.x,o.detail.z))}
.quality=${t.quality}
?showStats=${t.stats}
@room-tap=${this.onRoomTap}
@@ -3976,10 +3975,10 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${n?m`<nf-room-panel
.building=${this.data.building??null}
class="nf-room-panel"
.hass=${this.hass}
.hass=${dt(this.hass,e.floors)}
.room=${n}
.floor=${e.floors.find(o=>o.rooms.some(i=>i.id===this._roomId))??null}
.confirmEntities=${it(this.hass,e.floors)}
.confirmEntities=${st(this.hass,e.floors)}
.phrases=${e.settings.announce_phrases??null}
.rooms=${e.floors.flatMap(o=>o.rooms)}
@mood-change=${o=>this.saveMoods(o.detail.roomId,o.detail.moods)}
@@ -3987,17 +3986,17 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
></nf-room-panel>`:this._outside?m`<nf-room-panel
.building=${this.data.building??null}
class="nf-room-panel"
.hass=${this.hass}
.hass=${dt(this.hass,e.floors)}
.room=${null}
.outside=${this.outsideIds(e)}
.confirmEntities=${it(this.hass,e.floors)}
.confirmEntities=${st(this.hass,e.floors)}
.phrases=${e.settings.announce_phrases??null}
@close=${()=>this._outside=!1}
></nf-room-panel>`:f}
${t.clean?f:this.renderOverlay(e)}
${this._furnish?Lc(this.furnishHost,this._selFurniture,this._selDevice):f}
${this._furnish?jc(this.furnishHost,this._selFurniture,this._selDevice):f}
</div>
`}static styles=[$e,Ke,Gc,hr]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",fi);var Em=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,Uc=(r,e)=>Number(r)*60+Number(e);function yn(r,e,t=new Date){if(!r||r==="off")return!1;if(r==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let n=Em.exec(r.trim());if(!n)return!1;let o=Uc(n[1],n[2]),i=Uc(n[3],n[4]),s=t.getHours()*60+t.getMinutes();return o>i?s>=o||s<i:s>=o&&s<i}var Pr=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(yn(this.host.config()?.night,this.host.hass())),6e4)}stop(){clearTimeout(this.cleanTimer),clearTimeout(this.idleTimer),clearInterval(this.nightTimer)}};function jc(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 qc=ne`
`}static styles=[$e,Ue,Jc,gr]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",wi);var Cm=/^(\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=Cm.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);
@@ -4121,26 +4120,26 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
justify-content: flex-end;
}
}
`;function gi(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 Zc(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 Ht="nf-outside",_i=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 bt(this);kiosk=new Pr({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 Mn(),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=gi(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=yn(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=gi(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=pr(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let n=yn(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:Zc(e,t)}),this.roomsMemo.result}t=e=>E(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">
`;function yi(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",xi=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=yi(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=yi(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}
${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=jc(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=Zt(this.hass,t.floors).length>0,a=()=>{this.canSwitch&&(this._floorId=null),this._roomId=this._roomId===Ht?null:Ht};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")}>
</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===Ht} title=${this.t("outside_area_hint")} @click=${a}>🌳 ${this.t("outside_area")}</button>`:f}
${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()}>
${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
.hass=${this.hass}
.hass=${dt(this.hass,t.floors)}
.building=${t}
.packs=${this.data.packs}
.floorId=${e.floorId}
.roomId=${this._roomId===Ht?null:this._roomId}
.outsideOpen=${this._roomId===Ht}
.roomId=${this._roomId===Ct?null:this._roomId}
.outsideOpen=${this._roomId===Ct}
.wallMode=${e.walls}
.solidWalls=${n?.solid_walls===!0}
.explode=${e.explode}
@@ -4163,7 +4162,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.zoom=${typeof n?.zoom=="number"?n.zoom:1}
.buttons=${n?.buttons?.map((s,a)=>({id:`card_${a}`,...s}))??null}
.heatMode=${e.heat}
.theme=${wr(n?.theme,this.hass?.states["sun.sun"]?.state)}
.theme=${kr(n?.theme,this.hass?.states["sun.sun"]?.state)}
.clock=${n?.clock&&n.clock!=="none"?n.clock:null}
.lockButton=${n?.lock_button!==!1}
.walkButton=${n?.walk_button!==!1}
@@ -4179,10 +4178,10 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.panelOpen=${!!this._roomId&&n?.room_panel!==!1}
.alerts=${n?.alerts!==!1}
.alertJump=${!!n?.alert_jump}
.announcements=${n?.announcements!==!1&&!Kc()}
.announcements=${n?.announcements!==!1&&!Yc()}
.sensorBar=${n?.sensor_bar!==!1}
.glassWalls=${typeof n?.glass_walls=="number"?Math.min(100,Math.max(0,n.glass_walls)):null}
.screenName=${n?.screen_name??Vc()}
.screenName=${n?.screen_name??Zc()}
.scenes=${n?.scenes!==!1}
.clean=${this._clean}
.cleanButton=${i}
@@ -4200,22 +4199,22 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
></nf-view3d>`}renderRoomPanel(){let e=this.plan();return m`<nf-room-panel
.building=${this.plan()??null}
class="nf-card-panel"
.hass=${this.hass}
.hass=${dt(this.hass,e.floors)}
.room=${e.floors.flatMap(t=>t.rooms).find(t=>t.id===this._roomId)??null}
.floor=${e.floors.find(t=>t.rooms.some(n=>n.id===this._roomId))??null}
.outside=${this._roomId===Ht?Zt(this.hass,e.floors):null}
.confirmEntities=${it(this.hass,e.floors)}
.outside=${this._roomId===Ct?Jt(this.hass,e.floors):null}
.confirmEntities=${st(this.hass,e.floors)}
.phrases=${e.settings.announce_phrases??null}
@close=${()=>this._roomId=null}
></nf-room-panel>`}render(){if(this.hass&&tr(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 m`<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?E(this.hass,"no_building"):E(this.hass,"loading"))}</p>`}
${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>`}
${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,Ke,qc,hr]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",_i);let r=window;r.customCards=r.customCards??[],r.customCards.push({type:"nextfloor-card",name:E(void 0,"card_name"),description:E(void 0,"card_description"),preview:!1})}Xr();
</ha-card>`}static styles=[$e,Ue,nu,gr]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",xi);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();
/*! Bundled license information:
@lit/reactive-element/css-tag.js:
+1
View File
@@ -52,6 +52,7 @@ ROOM_SCHEMA = vol.Schema(
vol.Optional("temperature", default=None): _SENSOR_REFS,
vol.Optional("humidity", default=None): _SENSOR_REFS,
vol.Optional("co2", default=None): _SENSOR_REFS,
vol.Optional("illuminance", default=None): _SENSOR_REFS,
},
),
vol.Required("id"): _ID,
+3 -2
View File
@@ -18,6 +18,7 @@ import type { Building } from "./model.ts";
import { roomsOnly } from "./rooms-only.ts";
import { colorSchemeOf, controls, readableStyles, tokens } from "./styles.ts";
import type { HomeAssistant } from "./types.ts";
import { withCoverControls } from "./entities/cover-controls.ts";
import type { WallMode } from "./viewer/viewer3d.ts";
import { lookNow } from "./themes.ts";
@@ -313,7 +314,7 @@ export class NextFloorCard extends LitElement {
};
const eye = c?.controls_hidden !== undefined || (c?.controls_hide_after ?? 0) > 0;
return html`<nf-view3d
.hass=${this.hass}
.hass=${withCoverControls(this.hass, b.floors)}
.building=${b}
.packs=${this.data.packs}
.floorId=${s.floorId}
@@ -392,7 +393,7 @@ export class NextFloorCard extends LitElement {
return html`<nf-room-panel
.building=${this.plan() ?? null}
class="nf-card-panel"
.hass=${this.hass}
.hass=${withCoverControls(this.hass, b.floors)}
.room=${b.floors.flatMap((f) => f.rooms).find((r) => r.id === this._roomId) ?? null}
.floor=${b.floors.find((f) => f.rooms.some((r) => r.id === this._roomId)) ?? null}
.outside=${this._roomId === OUTSIDE ? outsideEntities(this.hass, b.floors) : null}
+4 -2
View File
@@ -1,6 +1,8 @@
// 2D editor: floors, rooms (rectangles and free shapes), snapping, undo, background template.
import { html, LitElement, nothing, svg, type PropertyValues, type TemplateResult } from "lit";
import { withCoverControls } from "../entities/cover-controls.ts";
import { hint } from "./editor/fields.ts";
import { fetchImage, importPack, storeImage } from "../api.ts";
import { defaultHeight, entityName, kindOf, roomEntities } from "../devices.ts";
import { closeGaps, suggestedThickness } from "../geometry/gaps.ts";
@@ -1043,7 +1045,7 @@ export class NfEditor extends LitElement {
</div>`}
${this.render3dBar()}
<nf-view3d
.hass=${this.hass}
.hass=${this.hass ? withCoverControls(this.hass, this._doc3d.floors) : undefined}
.building=${this._doc3d}
.floorId=${this.houseTool ? null : this._floorId}
.roomId=${null}
@@ -3210,7 +3212,7 @@ export class NfEditor extends LitElement {
${this.planLayers(floor, walls?.walls ?? null)}
</svg>
${this.renderContext()}
<p class="nf-hint ${this._fixedHint ? "nf-hint-fixed" : ""}">${this._pick ? this.t("robot_cal_doing") : !floor ? this.t("hint_empty") : this._fixedHint ? this.t("fixed_drag_hint") : this.t(`hint_${this._tool}` as I18nKey)}</p>
${this._pick || this._fixedHint ? html`<p class="nf-hint ${this._fixedHint ? "nf-hint-fixed" : ""}">${this._pick ? this.t("robot_cal_doing") : this.t("fixed_drag_hint")}</p>` : html`<div class="nf-hint">${hint(!floor ? this.t("hint_empty") : this.t(`hint_${this._tool}` as I18nKey))}</div>`}
<button class="nf-keys-open" title=${this.t("keys_title")} aria-label=${this.t("keys_title")} @click=${() => (this._keys = true)}>?</button>
${this.isAdmin
? renderTour((k, vars) => this.t(k, vars), this._tour, (step) => {
+4 -3
View File
@@ -7,6 +7,7 @@ import { LitElement, html, nothing, type PropertyValues } from "lit";
import { uid, type BleFingerprint, type BleTag } from "../../model.ts";
import { fingerprintsOf, locate, RECORD_SECONDS, replaceRoom, signalLevel, type Reading } from "./ops/ble.ts";
import type { EditorHost } from "./host.ts";
import { hint } from "./fields.ts";
interface Scan {
address: string | null;
@@ -187,7 +188,7 @@ export class NfBleLocate extends LitElement {
<span class="nf-ble-track"><span class="nf-ble-fill" style="width:${Math.round(signalLevel(r.rssi) * 100)}%"></span></span>
<span class="nf-ble-db">${Math.round(r.rssi)}</span>
</div>`)}
${entries.length === 1 ? html`<p class="nf-sub">${t("ble_one_scanner")}</p>` : nothing}
${entries.length === 1 ? hint(t("ble_one_scanner")) : nothing}
</div>`;
}
@@ -215,7 +216,7 @@ export class NfBleLocate extends LitElement {
</button>
${this._room && count(this._room) ? html`<button class="nf-btn" ?disabled=${recording} @click=${() => this.update2(tag.id, (x) => (x.prints = x.prints.filter((p) => p.room !== this._room)))}>${t("ble_forget_room")}</button>` : nothing}
</div>
<p class="nf-sub">${t("ble_learn_hint")}</p>`;
${hint(t("ble_learn_hint"))}`;
}
protected render() {
@@ -238,7 +239,7 @@ export class NfBleLocate extends LitElement {
<button class="nf-btn" title=${t("delete")} @click=${() => this.removeTag(x.id)}>✕</button>
</div>`,
)}
${tag ? html`<div class="nf-ble-learn">${this.learn(tag)}<p class="nf-sub">${t("ble_sensor_hint", { name: tag.name })}</p></div>` : nothing}
${tag ? html`<div class="nf-ble-learn">${this.learn(tag)}${hint(t("ble_sensor_hint", { name: tag.name }))}</div>` : nothing}
<div class="nf-form">
<label class="nf-field nf-wide">${t("ble_add")}
<select .value=${this._pick} @change=${(e: Event) => (this._pick = (e.target as HTMLSelectElement).value)}>
@@ -0,0 +1,21 @@
import { html, type TemplateResult } from "lit";
import { uid, type DeviceValueLink } from "../../model.ts";
import { valueSymbol } from "../../entities/device-values.ts";
import { entityOptions } from "./entities.ts";
import { entityField, hint, textField } from "./fields.ts";
import type { EditorHost } from "./host.ts";
export function renderDeviceValues(host: EditorHost, links: readonly DeviceValueLink[] = [], set: (next: DeviceValueLink[] | undefined) => void): TemplateResult {
const options = entityOptions(host.hass, (id) => !host.hass?.states[id]?.attributes.symcon_source_entity || links.some((l) => l.entity === id));
const patch = (id: string, change: Partial<DeviceValueLink>) => set(links.map((l) => l.id === id ? { ...l, ...change } : l));
return html`<div class="nf-value-links nf-wide">
<div class="nf-h3row"><h4>${host.t("device_values")}</h4><button class="nf-btn nf-value-add" title=${host.t("device_value_add")} aria-label=${host.t("device_value_add")} ?disabled=${!host.admin} @click=${() => set([...links, { id: uid("value"), entity: null }])}>+</button></div>
${links.map((l, i) => html`<div class="nf-form nf-value-link" data-value=${l.id}>
${entityField(host, `${host.t("device_value")} ${i + 1}`, l.entity, undefined, options, (v) => patch(l.id, { entity: v === "none" ? null : v }))}
${textField(host, host.t("device_value_icon"), l.icon ?? "", (icon) => patch(l.id, { icon: icon || null }), { maxlength: 16, placeholder: valueSymbol(l.entity ? host.hass?.states[l.entity] : undefined) })}
${textField(host, host.t("device_value_label"), l.label ?? "", (label) => patch(l.id, { label: label || null }), { maxlength: 60 })}
<button class="nf-link nf-value-remove nf-wide" ?disabled=${!host.admin} @click=${() => { const next = links.filter((v) => v.id !== l.id); set(next.length ? next : undefined); }}>× ${host.t("device_value_remove")}</button>
</div>`)}
${hint(host.t("device_values_hint"))}
</div>`;
}
+4 -3
View File
@@ -10,6 +10,7 @@ import type { EntityOption } from "./entities.ts";
import type { EditorHost } from "./host.ts";
import { pluginMdiIcon } from "../../plugins/registry.ts";
import "../entity-picker.ts";
import "../help-popup.ts";
const valueOf = (e: Event) => (e.target as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement).value;
@@ -150,7 +151,7 @@ export function pinShiftField(host: EditorHost, value: PinOffset | null | undefi
<div class="nf-form">
${numberField(host, "↔ x", v.x ?? 0, set("x"), 0.05)} ${numberField(host, "↕ z", v.z ?? 0, set("z"), 0.05)} ${numberField(host, host.t("pin_shift_up"), v.y ?? 0, set("y"), 0.05)}
${value ? html`<button class="nf-btn nf-field-btn" ?disabled=${!host.admin} @click=${() => onChange(null)}>${host.t("height_auto")}</button>` : nothing}
<p class="nf-sub nf-wide">${host.t("pin_shift_hint")}</p>
${hint(host.t("pin_shift_hint"), "nf-wide")}
</div>
</details>`;
}
@@ -158,8 +159,8 @@ export function pinShiftField(host: EditorHost, value: PinOffset | null | undefi
/** A row of buttons at the bottom of a form. */
export const actions = (...buttons: (TemplateResult | typeof nothing)[]): TemplateResult => html`<div class="nf-actions">${buttons}</div>`;
/** A help line under a form. */
export const hint = (text: string, extraClass = ""): TemplateResult => html`<p class="nf-sub ${extraClass}">${text}</p>`;
/** A compact information button that opens the explanation in a dialog. */
export const hint = (text: string, extraClass = ""): TemplateResult => html`<nf-help-popup class=${extraClass} .text=${text}></nf-help-popup>`;
/** A percentage between 10 and 150 for how strongly a lamp glows. 100 % is stored as "no value of its own". */
export function glowField(host: EditorHost, value: number | null | undefined, onChange: (v: number | null) => void, o: { label?: I18nKey; hint?: I18nKey; lowest?: number } = {}): TemplateResult {
@@ -2,7 +2,7 @@
// fields or the furniture; only what depends on the compass follows (the sun's light, wind, the compass labels of roof faces).
import { html, svg, type TemplateResult } from "lit";
import { numberField } from "../fields.ts";
import { hint, numberField } from "../fields.ts";
import type { EditorHost } from "../host.ts";
import { turnedNorth } from "../ops/settings.ts";
@@ -29,7 +29,7 @@ export function renderCompass(host: EditorHost, north: number, set: (north: numb
<button class="nf-btn" ?disabled=${!host.admin} @click=${turn(-90)}>↺ 90°</button>
<button class="nf-btn" ?disabled=${!host.admin} @click=${turn(90)}>↻ 90°</button>
</div>
<span class="nf-sub">${t("compass_hint")}</span>
${hint(t("compass_hint"))}
</div>
</div>`;
}
@@ -148,7 +148,7 @@ export function renderRoomClimate(host: EditorHost, room: Room, patch: (patch: P
};
return html`<details class="nf-points" ?open=${chosen || !!room.climate_card}>
<summary>${host.t("climate")}</summary>
<div class="nf-form">${field("temperature", host.t("climate_temperature"))} ${field("humidity", host.t("climate_humidity"))} ${field("co2", host.t("climate_co2"))}</div>
<div class="nf-form">${field("temperature", host.t("climate_temperature"))} ${field("humidity", host.t("climate_humidity"))} ${field("co2", host.t("climate_co2"))} ${field("illuminance", host.t("climate_illuminance"))}</div>
${checkField(host, host.t("climate_card"), !!room.climate_card, (on) => patch({ climate_card: on || undefined }))}
${hint(host.t("climate_card_hint"))}
${hint(host.t("climate_hint"))}
@@ -9,6 +9,8 @@ import { packItemLabel, packLabel } from "../../../furniture-names.ts";
import { isClimateFurniture, isElectric, isPackType, packType, type FurniturePack } from "../../../packs.ts";
import { checkField, deviceIcon, entityField, glowField, iconField, markerField, pinShiftField, numberField, selectField, textField } from "../fields.ts";
import { entityOptions } from "../entities.ts";
import { isPositionVariable } from "../../../entities/position-value.ts";
import { renderDeviceValues } from "../device-values.ts";
import type { EditorHost } from "../host.ts";
import { lightEffectFields } from "../light-effect-fields.ts";
import { pluginDeviceSettings, pluginText, settingsWithDefaults } from "../../../plugins/registry.ts";
@@ -98,6 +100,11 @@ export function renderDeviceForm(host: EditorHost, placed: Placement, actions: D
</p>
<div class="nf-form">
${kind === "cover" ? entityField(host, t("cover_tilt_entity"), placed.cover_tilt ?? null, undefined, entityOptions(host.hass, (id) => id.startsWith("cover.")), (v) => set({ cover_tilt: v && v !== "none" ? v : null })) : nothing}
${kind === "cover" ? html`
${checkField(host, t("cover_direction_invert"), !!placed.cover_inverted, (on) => set({ cover_inverted: on || undefined }))}
${checkField(host, t("cover_tilt_direction_invert"), !!placed.cover_tilt_inverted, (on) => set({ cover_tilt_inverted: on || undefined }))}
${entityField(host, t("cover_position_entity"), placed.position ?? null, undefined, entityOptions(host.hass, (id) => isPositionVariable(host.hass, id)), (v) => set({ position: v && v !== "none" ? v : null }))}
${placed.position ? checkField(host, t("cover_position_invert"), !!placed.position_inverted, (on) => set({ position_inverted: on || undefined })) : nothing}` : nothing}
${light ? html`${selectField(host, t("lamp_mount"), mount, lampMounts, mountChange, { wide: true })}${glowField(host, placed.glow_scale, (v) => set({ glow_scale: v }))}` : nothing}
${light ? lightEffectFields(host, placed, host.hass?.states[placed.entity_id]?.attributes.effect_list, set) : nothing}
${placed.entity_id.startsWith("media_player.") ? glowField(host, placed.sound_rings, (v) => set({ sound_rings: v }), { label: "sound_rings", hint: "sound_rings_hint", lowest: 0 }) : nothing}
@@ -113,6 +120,7 @@ export function renderDeviceForm(host: EditorHost, placed: Placement, actions: D
${placed.name ? checkField(host, t("show_name"), !!placed.show_name, (on) => set({ show_name: on || undefined })) : nothing}
${iconField(host, placed.icon, (v) => set({ icon: v }))}
${pluginFields(host, placed, set)}
${renderDeviceValues(host, placed.values, (values) => set({ values }))}
</div>
${host.admin
? html`<div class="nf-actions">
@@ -11,6 +11,7 @@ import { checkField, entityField, glowField, hint, iconField, markerField, pinSh
import type { EditorHost } from "../host.ts";
import { lightEffectFields } from "../light-effect-fields.ts";
import { lightEffectSource } from "../../../light-effects.ts";
import { renderDeviceValues } from "../device-values.ts";
import { calibrationFrom, calibrationFromRooms, gridPlaces, gridRooms, mapCamera, nudgeCalibration, type CalibrationNudge, type Place } from "../../../live/vacuum-map.ts";
/** What the forms of a piece of furniture make the editor do. */
@@ -313,5 +314,6 @@ export function furnitureLinks(host: EditorHost, item: Furniture, actions: Furni
? html`${linkBlock(entityField(host, t("furn_door_left"), item.door_left ?? null, undefined, doors, (v) => actions.update({ door_left: v })), entityField(host, t("furn_door_right"), item.door_right ?? null, undefined, doors, (v) => actions.update({ door_right: v })))}
${hint(t("fridge_hint"))}`
: nothing}
${renderDeviceValues(host, item.values, (values) => actions.update({ values }))}
${hint(t(hintKey))}`;
}
@@ -6,6 +6,7 @@ import { entityName, openingEntities, windowPosition } from "../../../devices.ts
import type { I18nKey } from "../../../i18n.ts";
import { DOOR_STYLES, OPENING_PRESETS, openingPreset, openingStyle, WINDOW_OPENINGS, WINDOW_STYLES, type Opening, type OpeningPreset, type OpeningStyle } from "../../../model.ts";
import { entityOptions, isNumeric } from "../entities.ts";
import { isPositionVariable } from "../../../entities/position-value.ts";
import { checkField, entityField, hint, numberField, selectField } from "../fields.ts";
import type { EditorHost } from "../host.ts";
@@ -41,7 +42,7 @@ function choices(host: EditorHost) {
return {
covers: entityOptions(hass, (id) => id.startsWith("cover.")),
// numbers that can report where a blind is
positions: entityOptions(hass, (id) => /^(sensor|number|input_number)\./.test(id) && Number.isFinite(Number(stateOf(id)?.state))),
positions: entityOptions(hass, (id) => isPositionVariable(hass, id)),
// plain contacts, and handle sensors with three states (open, tilted, closed)
contacts: entityOptions(hass, (id) => isContact(id) || (isNumeric(id) && windowPosition(stateOf(id)) !== null)),
plainContacts: entityOptions(hass, isContact),
@@ -171,7 +172,9 @@ function blindFields(host: EditorHost, o: Opening, actions: OpeningActions, list
return html`${entityField(host, t(symcon ? "symcon_cover_position" : window ? "cover_entity" : "door_cover"), o.cover, automatic, lists.covers, (v) => actions.update({ cover: v }))}
${symcon || (hasBlind && o.blind === "venetian") ? entityField(host, t("cover_tilt_entity"), o.cover_tilt ?? null, undefined, lists.covers, (v) => actions.update({ cover_tilt: noneAsNull(v) })) : nothing}
${hasBlind
? html`${entityField(host, t("cover_position_entity"), o.position ?? null, undefined, lists.positions, (v) => actions.update({ position: noneAsNull(v) }))}
? html`${checkField(host, t("cover_direction_invert"), !!o.cover_inverted, (on) => actions.update({ cover_inverted: on || undefined }))}
${o.cover_tilt || o.blind === "venetian" ? checkField(host, t("cover_tilt_direction_invert"), !!o.cover_tilt_inverted, (on) => actions.update({ cover_tilt_inverted: on || undefined })) : nothing}
${entityField(host, t("cover_position_entity"), o.position ?? null, undefined, lists.positions, (v) => actions.update({ position: noneAsNull(v) }))}
${o.position ? checkField(host, t("cover_position_invert"), !!o.position_inverted, (on) => actions.update({ position_inverted: on })) : nothing}
${checkField(host, t("device_confirm"), !!o.confirm, (on) => actions.update({ confirm: on }), { title: t("cover_confirm_hint") })}
${window
@@ -180,6 +183,7 @@ function blindFields(host: EditorHost, o: Opening, actions: OpeningActions, list
: nothing}
${!window && o.type !== "garage" ? entityField(host, t("cover2_entity"), o.cover2 ?? null, undefined, lists.covers, (v) => actions.update({ cover2: noneAsNull(v) })) : nothing}
${o.cover2 && o.cover2 !== "none" ? entityField(host, t("cover2_tilt_entity"), o.cover2_tilt ?? null, undefined, lists.covers, (v) => actions.update({ cover2_tilt: noneAsNull(v) })) : nothing}
${o.cover2 && o.cover2 !== "none" ? html`${checkField(host, t("cover2_direction_invert"), !!o.cover2_inverted, (on) => actions.update({ cover2_inverted: on || undefined }))}${checkField(host, t("cover2_tilt_direction_invert"), !!o.cover2_tilt_inverted, (on) => actions.update({ cover2_tilt_inverted: on || undefined }))}` : nothing}
${numberField(host, t("cover_my"), o.my_position ?? 0, (v) => actions.update({ my_position: v > 0 ? Math.min(100, Math.round(v)) : null }), 5, 0)}
${hint(t("blind_hint"), "nf-wide")}`
: nothing}`;
+1 -1
View File
@@ -113,7 +113,7 @@ function ceilingField(host: EditorHost, room: Room, floor: Floor, actions: RoomA
${room.ceiling != null ? html`<button class="nf-btn nf-field-btn" ?disabled=${!host.admin} @click=${() => actions.patch({ ceiling: null })}>${t("height_auto")}</button>` : nothing}
${hint(t("room_ceiling_tip"), "nf-wide")}
${room.ceiling != null && room.ceiling > floor.height + 0.005
? html`<p class="nf-sub nf-wide">${t("room_ceiling_through", { ceiling: formatNumber(host.hass, room.ceiling, 2), floor: formatNumber(host.hass, floor.height, 2) })}</p>`
? hint(t("room_ceiling_through", { ceiling: formatNumber(host.hass, room.ceiling, 2), floor: formatNumber(host.hass, floor.height, 2) }), "nf-wide")
: nothing}`;
}
@@ -2,6 +2,7 @@ import { html, nothing, type TemplateResult } from "lit";
import { LIGHT_ANIMATIONS, type LightEffectConfig } from "../../light-effects.ts";
import { pluginLightAnimationNames } from "../../plugins/registry.ts";
import type { EditorHost } from "./host.ts";
import { hint } from "./fields.ts";
/** A small local-only mapping editor. Unknown stored identifiers remain untouched until edited. */
export function lightEffectFields(host: EditorHost, config: LightEffectConfig, effects: unknown, update: (patch: LightEffectConfig) => void): TemplateResult {
@@ -32,7 +33,7 @@ export function lightEffectFields(host: EditorHost, config: LightEffectConfig, e
};
return html`<details class="nf-wide">
<summary>${host.t("light_effects")}</summary>
<p class="nf-sub">${host.t("light_effects_hint")}</p>
${hint(host.t("light_effects_hint"))}
<label class="nf-check"><input type="checkbox" .checked=${config.animations_enabled !== false} ?disabled=${!host.admin}
@change=${(e: Event) => update({ animations_enabled: (e.target as HTMLInputElement).checked })} />${host.t("light_effects_enabled")}</label>
${names.map((name) => html`<label class="nf-field nf-wide">${name}
@@ -46,6 +47,7 @@ export function lightEffectFields(host: EditorHost, config: LightEffectConfig, e
<label class="nf-field nf-wide">${host.t("light_effect_add")}<input type="text" ?disabled=${!host.admin} placeholder="Regenbogen"
@input=${(e: Event) => (e.target as HTMLInputElement).setCustomValidity("")}
@change=${(e: Event) => { const input = e.target as HTMLInputElement; if (set(input.value, "none", input, true)) input.value = ""; }} /></label>
<p class="nf-sub" data-effect-feedback role="status" aria-live="polite">${host.t("light_effect_name_limit")} ${host.t("light_effect_count_limit")}</p>
${hint(`${host.t("light_effect_name_limit")} ${host.t("light_effect_count_limit")}`)}
<p class="nf-sub" data-effect-feedback role="status" aria-live="polite"></p>
</details>`;
}
+3
View File
@@ -2,6 +2,9 @@ import { css } from "lit";
/** The editor's own styles: the plan canvas, the side panel with its forms and libraries, the 3D pane and the phone layout. */
export const editorStyles = css`
.nf-value-links h4 { margin: 12px 0; }
.nf-value-add { min-width: 30px; font-size: 18px; padding: 3px 8px; }
.nf-value-link { padding: 8px 0; border-bottom: 1px solid var(--nf-line); }
:host {
display: block;
height: 100%;
+2 -1
View File
@@ -9,6 +9,7 @@ import { openingPreset } from "../../model.ts";
import type { EditorHost } from "./host.ts";
import { furnitureAt, openingAt, wallElevation, wallFrame, type ElevationBox } from "./ops/wall-view.ts";
import { formatLength } from "../../units.ts";
import { hint } from "./fields.ts";
const SNAP = 0.01;
const snap = (v: number) => Math.round(v / SNAP) * SNAP;
@@ -172,7 +173,7 @@ export class NfWallView extends LitElement {
<input type="number" step="0.01" min="0" .value=${sel.y0.toFixed(2)} ?disabled=${!this.host.admin} @change=${(e: Event) => this.place(sel, sel.x0, Number((e.target as HTMLInputElement).value))}
/></label>`
: nothing}`
: html`<span class="muted">${t("wall_view_hint")}</span>`}
: hint(t("wall_view_hint"))}
</footer>
</div>
</div>`;
+34
View File
@@ -0,0 +1,34 @@
import { css, html, LitElement } from "lit";
import { tokens } from "../styles.ts";
/** Explanations stay reachable by keyboard without taking space in the form. */
export class NfHelpPopup extends LitElement {
static properties = { text: { attribute: false } };
declare text: string;
constructor() { super(); this.text = ""; }
private get dialog() { return this.renderRoot.querySelector<HTMLDialogElement>("dialog"); }
render() {
return html`<button class="info" type="button" aria-label="Information anzeigen" aria-haspopup="dialog" title="Information" @click=${() => this.dialog?.showModal()}>ⓘ</button>
<dialog aria-label="Information" @keydown=${(event: KeyboardEvent) => event.stopPropagation()} @click=${(event: MouseEvent) => {
if (event.target !== event.currentTarget) return;
const r = this.dialog!.getBoundingClientRect();
if (event.clientX < r.left || event.clientX > r.right || event.clientY < r.top || event.clientY > r.bottom) this.dialog?.close();
}}>
<header><b>Information</b><button class="close" type="button" aria-label="Schließen" @click=${() => this.dialog?.close()}>×</button></header>
<p>${this.text}</p>
</dialog>`;
}
static styles = [tokens, css`
:host { display:inline-block; margin:4px 0; vertical-align:middle; }
button { font:inherit; cursor:pointer; color:var(--nf-muted); background:transparent; border:1px solid var(--nf-line); border-radius:50%; pointer-events:auto; }
.info { width:26px; height:26px; padding:0; font-size:18px; line-height:24px; }
button:hover { color:var(--nf-accent); }
button:focus-visible { outline:2px solid var(--nf-accent); outline-offset:2px; }
dialog { box-sizing:border-box; width:min(560px,calc(100vw - 32px)); max-height:80vh; max-height:80dvh; overflow:auto; padding:18px 22px; border:1px solid var(--nf-line); border-radius:14px; background:var(--nf-chrome-solid); color:var(--nf-text); font:14px/1.5 system-ui,sans-serif; box-shadow:var(--nf-shadow); pointer-events:auto; }
dialog::backdrop { background:#050b16a6; }
header { display:flex; align-items:center; justify-content:space-between; gap:20px; font-size:16px; }
.close { width:30px; height:30px; padding:0; font-size:23px; }
p { white-space:pre-wrap; overflow-wrap:anywhere; margin:16px 0 4px; }
`];
}
if (!customElements.get("nf-help-popup")) customElements.define("nf-help-popup", NfHelpPopup);
+4 -3
View File
@@ -9,6 +9,7 @@ import type { FurniturePack } from "../packs.ts";
import { controls, tokens } from "../styles.ts";
import type { HomeAssistant } from "../types.ts";
import type { ModelInfo } from "../viewer/viewer3d.ts";
import { hint } from "./editor/fields.ts";
type Present = "unknown" | "yes" | "no";
@@ -214,7 +215,7 @@ export class NfModelUpload extends LitElement {
<button class="nf-btn" @click=${() => this.turn(-1)}>↺ 90°</button>
<button class="nf-btn" @click=${() => this.turn(1)}>↻ 90°</button>
</div>
<small class="nf-sub">${this.t("model_front_hint")}</small>
${hint(this.t("model_front_hint"))}
</div>
<div class="nf-field">
<span>${this.t("model_paint")}</span>
@@ -242,12 +243,12 @@ export class NfModelUpload extends LitElement {
if (slots.length === 0 || !(this.hass?.user?.is_admin ?? false)) return nothing;
return html`<section class="nf-ext-card">
<h3>${this.t("models")}</h3>
<p class="nf-sub">${this.t("models_hint")}</p>
${hint(this.t("models_hint"))}
${slots.map((slot) => this.row(slot))}
${this._draft ? this.editor(this._draft) : nothing}
${this._busy && !this._draft ? html`<p class="nf-sub">${this.t("loading")}</p>` : nothing}
${this._message ? html`<p class="nf-sub ${this._message.ok ? "nf-notice" : "nf-pack-error"}">${this._message.text}</p>` : nothing}
<p class="nf-sub">${this.t("models_licence")}</p>
${hint(this.t("models_licence"))}
</section>`;
}
+2 -2
View File
@@ -162,7 +162,7 @@ export class NfQuickMenu extends LitElement {
@click=${() => (moving ? this.call("cover", "stop_cover") : this.ask() && this.call("cover", closed > 50 ? "open_cover" : "close_cover"))}
>
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M4 4h16M5 4v15M19 4v15M7 8h10M7 12h10M7 16h10" /></svg>
<b>${pos !== null ? `${pos} %` : stateText(this.hass, st)}</b>
<b>${pos !== null ? `${Math.round(pos)} %` : stateText(this.hass, st)}</b>
</button>
</div>
${setPos
@@ -193,7 +193,7 @@ export class NfQuickMenu extends LitElement {
max="100"
.value=${String(tilt)}
aria-label=${this.t("cover_tilt")}
@change=${(e: Event) => this.call("cover", "set_cover_tilt_position", { entity_id: this.tiltEntity || this.entity, tilt_position: Number((e.target as HTMLInputElement).value) })}
@change=${(e: Event) => this.call("cover", "set_cover_tilt_position", { entity_id: st.attributes.nf_cover_control ? this.entity : this.tiltEntity || this.entity, tilt_position: Number((e.target as HTMLInputElement).value) })}
/></label>`;
if (features & (COVER_OPEN_TILT | COVER_CLOSE_TILT))
return html`<div class="qm-tilt-buttons">
+13 -1
View File
@@ -22,6 +22,8 @@ import { curvePath } from "../live/day-curves.ts";
import { controls, tokens } from "../styles.ts";
import type { HassEntity, HomeAssistant } from "../types.ts";
import { coverTiltEntity, coverWithTilt } from "../entities/covers.ts";
import { deviceValueReadouts } from "../entities/device-values.ts";
import { pointInPolygon } from "../model.ts";
const COVER_SET_POSITION = 4;
const COVER_STOP = 8;
@@ -533,6 +535,7 @@ export class NfRoomPanel extends LitElement {
${media.length ? this.section("panel_media", media.map((st) => this.mediaRow(st))) : nothing}
${switches.length ? this.section("panel_switches", switches.map((st) => this.switchRow(st))) : nothing}
${sensors.length ? this.section("panel_sensors", sensors.map((st) => this.sensorRow(st))) : nothing}
${this.extraValues(room)}
${canAnnounce(this.hass) && roomHasSpeaker(this.hass, this.floor, room) ? this.announceSection(room) : nothing}
${this.pluginSections(room, ids)}
${hiddenCount
@@ -545,6 +548,13 @@ export class NfRoomPanel extends LitElement {
}
/** Header facts: the room's temperature and humidity from its climate sensors (chosen or automatic). */
private extraValues(room: Room) {
if (!this.floor) return nothing;
const groups = [...this.floor.placements.filter((p) => !p.outside && pointInPolygon([p.x, p.z], room.points)).map((p) => ({ name: p.name || entityName(this.hass, p.entity_id), rows: deviceValueReadouts(this.hass, p.values) })),
...this.floor.furniture.filter((f) => pointInPolygon([f.x, f.z], room.points)).map((f) => ({ name: f.name || (f.entity && f.entity !== "none" ? entityName(this.hass, f.entity) : this.t("device")), rows: deviceValueReadouts(this.hass, f.values) }))].filter((g) => g.rows.length);
return groups.length ? this.section("device_values", groups.map((g) => html`<div class="nf-extra-values"><b>${g.name}</b>${g.rows.map((v) => html`<div class="nf-rp-row"><span class="nf-rp-icon">${v.icon}</span><span class="nf-rp-name">${v.label}</span><b class="nf-rp-state">${v.text}</b></div>`)}</div>`)) : nothing;
}
private facts(climates: HassEntity[]): string[] {
const out: string[] = [];
const room = this.room;
@@ -564,6 +574,8 @@ export class NfRoomPanel extends LitElement {
else if (climateTemp && room.climate?.temperature !== "none") out.push(`${formatNumber(this.hass, climateTemp.attributes.current_temperature as number, 1)} ${tempUnit(this.hass)}`);
const hum = value("humidity", "%");
if (hum) out.push(hum);
const lux = roomClimateValue(this.hass, this.floor ?? null, room, "illuminance");
if (lux !== null) out.push(`☀ ${formatNumber(this.hass, lux, 0)} lx`);
// what the room's devices draw now
const power = this.floor && this.building ? roomPower(this.hass, this.building, this.floor, room) : null;
if (power !== null) out.push(`⚡ ${powerText(this.hass, power)}`);
@@ -755,7 +767,7 @@ export class NfRoomPanel extends LitElement {
max="100"
?disabled=${na}
.value=${String(a.current_tilt_position)}
@change=${(e: Event) => this.call("cover", "set_cover_tilt_position", { entity_id: tiltEntity ?? id, tilt_position: Number((e.target as HTMLInputElement).value) })}
@change=${(e: Event) => this.call("cover", "set_cover_tilt_position", { entity_id: a.nf_cover_control ? id : tiltEntity ?? id, tilt_position: Number((e.target as HTMLInputElement).value) })}
/></label>`
: features & 48
? html`<div class="nf-rp-buttons">
+8 -5
View File
@@ -50,6 +50,7 @@ import { scaleGlow, buildMarkers, openMoreInfo, stateText, toggleEntity, withPlu
import { fanSpin } from "../entities/fans.ts";
import { fixtureGlow } from "../entities/kinds.ts";
import { coverTiltEntity } from "../entities/covers.ts";
import { deviceValuesText } from "../entities/device-values.ts";
import { furnitureShown, hiddenFurniture, withoutHidden } from "../entities/visibility.ts";
import { pictureUrl } from "../entities/pictures.ts";
import { fetchImage } from "../api.ts";
@@ -1236,7 +1237,7 @@ export class NfView3d extends LitElement {
const deviceTemp = !isCooling(f.type) ? deviceTempOf(hass, f.temp_entity) : null;
const deviceTempText = deviceTemp === null ? "" : `🌡 ${formatNumber(hass, fromCelsius(hass, deviceTemp), 1)} ${tempUnit(hass)}`;
const extraRef = f.type === "home_battery" ? f.soc : f.type === "wallbox" ? f.status : temps ? (f.temp_entity && f.temp_entity !== "none" ? f.temp_entity : f.temp_entity2) : deviceTemp !== null ? f.temp_entity : null;
const extra = extraRef && extraRef !== "none" ? extraRef : null;
const extra = extraRef && extraRef !== "none" ? extraRef : (f.values ?? []).find((v) => v.entity && v.entity !== "none")?.entity ?? null;
const link = linked ?? (extra ? { entity: null, power: null } : undefined);
if (!link) continue;
// a battery goes by its charge first: its power sensor is often placed on its own as well
@@ -1330,6 +1331,7 @@ export class NfView3d extends LitElement {
? formatPower(hass, Math.max(0, power))
: "",
deviceTempText,
deviceValuesText(hass, f.values),
]
.filter(Boolean)
.join(" · "),
@@ -1341,7 +1343,7 @@ export class NfView3d extends LitElement {
// inverter, battery, wallbox: their own text (watts, charge, status) is always worth a pin
energyDevice: f.type === "inverter" || f.type === "home_battery" || f.type === "wallbox" || f.type === "meter",
// a fridge's temperatures are worth a pin, like an energy device's values
readout: !!temps || undefined,
readout: !!temps || !!f.values?.some((v) => v.entity && v.entity !== "none") || undefined,
show: f.marker ?? undefined,
fromFurniture: true,
});
@@ -1563,7 +1565,7 @@ export class NfView3d extends LitElement {
}
/** A lamp: its 3D model glows with the linked light and is tapped directly. */
private lampMarker(hass: HomeAssistant, floor: Building["floors"][number], f: Furniture, entity: string | null): DeviceMarker & { fromFurniture: boolean } {
private lampMarker(hass: HomeAssistant, floor: Building["floors"][number], f: Furniture, entity: string | null): DeviceMarker & { fromFurniture: boolean; readout?: boolean } {
const st = entity ? hass.states[entity] : undefined;
// further bulbs of the same fixture (a night light, an ambient ring): the lamp glows with them while its main light is off
const others = (f.extra_lights ?? []).map((id) => hass.states[id]).filter((s): s is HassEntity => !!s);
@@ -1607,7 +1609,7 @@ export class NfView3d extends LitElement {
bollard: base + f.h + 0.25,
garden: base + f.h + 0.25,
}[model];
const marker: DeviceMarker & { fromFurniture: boolean } = {
const marker: DeviceMarker & { fromFurniture: boolean; readout?: boolean } = {
// a lamp without a light keeps a key of its own (it is drawn, but not tappable)
id: entity ?? `lamp:${f.id}`,
floorId: floor.id,
@@ -1617,7 +1619,8 @@ export class NfView3d extends LitElement {
y,
icon: iconSvg("light"),
name: f.name || (entity ? entityName(hass, entity) : furnitureName(hass, f.type)),
text: st && (isActive(st) || !otherOn) ? stateText(hass, st) : otherOn ? entityName(hass, otherOn.entity_id) : "",
text: [st && (isActive(st) || !otherOn) ? stateText(hass, st) : otherOn ? entityName(hass, otherOn.entity_id) : "", deviceValuesText(hass, f.values)].filter(Boolean).join(" · "),
readout: !!f.values?.some((v) => v.entity && v.entity !== "none"),
active: (st ? isActive(st) : false) || !!otherOn,
unavailable: st ? isUnavailable(st) : false,
glow: st || others.length ? scaleGlow(fixtureGlow(st, others, f.color_entity && f.color_entity !== "none" ? hass.states[f.color_entity] : undefined), f.glow_scale) : null,
@@ -48,6 +48,14 @@ test("a standalone blind's separate slat position is watched", () => {
assert.ok(watchedEntities(inputs({ building: b })).includes("cover.slats"));
});
test("all custom device and furniture readings are watched", () => {
const b = building();
b.floors[0].placements[0].values = [{ id: "a", entity: "sensor.inside" }, { id: "b", entity: "sensor.outside" }];
b.floors[0].furniture[0].values = [{ id: "c", entity: "sensor.lux" }];
const ids = watchedEntities(inputs({ building: b, needsRoomSensors: false }));
for (const id of ["sensor.inside", "sensor.outside", "sensor.lux"]) assert.ok(ids.includes(id));
});
test("room cards watch explicitly chosen values outside the area, including a source that is temporarily missing", () => {
const b = building();
Object.assign(b.floors[0].rooms[0], { climate_card: true, climate: { humidity: "cover.knx", temperature: "sensor.missing", co2: "sensor.other_room" } });
+3 -3
View File
@@ -42,7 +42,7 @@ function furnitureIds(inputs: WatchInputs): MaybeId[] {
...pieces.flatMap((m) => [m.state_entity, m.state_entity2, m.color_entity, ...(m.gang_entities ?? []), ...(m.extra_lights ?? []), m.cover_entity, m.care_entity, m.room_sensor, m.show_when?.entity, m.picture && /^[a-z_]+\.[a-z0-9_]+$/.test(m.picture) ? m.picture : null]),
// a washer's, dryer's or dishwasher's time left comes from a sensor next to its switch
...pieces.filter((m) => m.type === "washer" || m.type === "dryer" || m.type === "dishwasher").flatMap((m) => deviceSiblings(hass, furnitureLinks.get(m.id)?.entity ?? furnitureLinks.get(m.id)?.power).filter((id) => id.startsWith("sensor."))),
...pieces.flatMap((m) => [m.door_left, m.door_right, m.soc, m.status, m.charge, m.export, m.temp_entity, m.temp_entity2]),
...pieces.flatMap((m) => [m.door_left, m.door_right, m.soc, m.status, m.charge, m.export, m.temp_entity, m.temp_entity2, ...(m.values ?? []).map((v) => v.entity)]),
...pieces.filter((m) => m.type === "robot_vacuum").map((m) => robotRoomSensor(hass, furnitureLinks.get(m.id)?.entity ?? null, m.room_sensor)),
...pieces.flatMap((m) => (m.pictures ?? []).flatMap((rule) => [rule.entity, ...(rule.image.startsWith("camera:") ? [rule.image.slice("camera:".length)] : [])])),
];
@@ -60,11 +60,11 @@ export function watchedEntities(inputs: WatchInputs): string[] {
const energy = b.energy;
const lightsOfRooms = roomsOf(b).flatMap((r) => roomEntities(hass, r).filter((id) => kindOf(id) === "light"));
const sensorsOfRooms = b.floors.flatMap((f) => f.rooms.flatMap((r) => inputs.needsRoomSensors || r.climate_card
? [...roomEntities(hass, r).filter((id) => id.startsWith("sensor.") || id.startsWith("climate.")), ...Object.values(r.climate ?? {}).flat(), ...(["temperature", "humidity", "co2"] as const).flatMap((key) => roomClimateSensors(hass, f, r, key))]
? [...roomEntities(hass, r).filter((id) => id.startsWith("sensor.") || id.startsWith("climate.")), ...Object.values(r.climate ?? {}).flat(), ...(["temperature", "humidity", "co2", "illuminance"] as const).flatMap((key) => roomClimateSensors(hass, f, r, key))]
: []));
const ids: MaybeId[] = [
...placed,
...b.floors.flatMap((f) => f.placements.map((p) => p.cover_tilt)),
...b.floors.flatMap((f) => f.placements.flatMap((p) => [p.cover_tilt, p.position, ...(p.values ?? []).map((v) => v.entity)])),
...openingIds(inputs.openingLinks),
...placed.map((id) => powerSensorFor(hass, id)),
// what plugins draw for a device may follow further entities (a camera's motion sensor)
@@ -0,0 +1,58 @@
import assert from "node:assert/strict";
import { test } from "node:test";
import { box, entity, floorWith, hassOf, opening } from "./fixtures.ts";
import { openingEntities, openingState } from "./openings.ts";
import { isPositionVariable, positionPercent } from "./position-value.ts";
import { withCoverControls } from "./cover-controls.ts";
test("Symcon position feedback accepts numeric actuator domains and respects native integer/float ranges", () => {
const h = hassOf([
entity("cover.feedback", "open", { symcon_id: 1, symcon_variable_type: 1, symcon_numeric_value: 128, symcon_min: 0, symcon_max: 255 }),
entity("light.fraction", "on", { symcon_id: 2, symcon_variable_type: 2, symcon_numeric_value: 0.4, symcon_min: 0, symcon_max: 1 }),
entity("cover.one", "open", { symcon_id: 3, symcon_variable_type: 1, symcon_numeric_value: 1, symcon_min: 0, symcon_max: 100 }),
entity("sensor.text", "50", { symcon_id: 4, symcon_variable_type: 3 }),
]);
assert.equal(isPositionVariable(h, "cover.feedback"), true);
assert.equal(isPositionVariable(h, "light.fraction"), true);
assert.equal(isPositionVariable(h, "sensor.text"), false);
assert.equal(positionPercent(h, "cover.feedback"), 128 / 255 * 100);
assert.equal(positionPercent(h, "light.fraction"), 40);
assert.equal(positionPercent(h, "cover.one"), 1, "integer 1 is one percent, not a normalized float at full travel");
});
test("blind and slat inversions act independently on feedback, 3D, sliders, buttons and grouped commands", async () => {
for (const inverted of [false, true]) for (const tiltInverted of [false, true]) {
const calls: unknown[] = [];
const raw = hassOf([entity("cover.height", "open", { current_position: 5 }), entity("cover.slats", "open", { current_position: 30, symcon_id: 9 }), entity("cover.feedback", "open", { symcon_numeric_value: 40, symcon_min: 0, symcon_max: 100 }), entity("cover.normal", "open", { current_position: 90 })], {}, { callService: async (domain: string, service: string, data: unknown) => { calls.push([domain, service, data]); } });
const floor = floorWith([box("r", 0, 0, 4, 4)], { openings: [opening("w", "r", "window", { cover: "cover.height", cover_tilt: "cover.slats", position: "cover.feedback", cover_inverted: inverted, cover_tilt_inverted: tiltInverted })] });
const view = withCoverControls(raw, [floor]);
assert.equal(view.states["cover.height"].attributes.current_position, inverted ? 60 : 40);
assert.equal(view.states["cover.height"].attributes.current_tilt_position, tiltInverted ? 70 : 30);
const links = openingEntities(raw, [floor]).get("w")!;
const fromRaw = openingState(raw, links), fromView = openingState(view, links);
assert.equal(fromRaw.cover, fromView.cover, "3D feedback cannot be inverted twice");
assert.equal(fromRaw.slats, fromView.slats);
await view.callService("cover", "set_cover_position", { entity_id: "cover.height", position: 75 });
await view.callService("cover", "set_cover_tilt_position", { entity_id: "cover.height", tilt_position: 20 });
await view.callService("cover", "open_cover", { entity_id: ["cover.height", "cover.normal"] });
assert.deepEqual(calls, [
["cover", "set_cover_position", { entity_id: "cover.height", position: inverted ? 25 : 75 }],
["cover", "set_cover_tilt_position", { entity_id: "cover.slats", tilt_position: tiltInverted ? 80 : 20 }],
["cover", inverted ? "close_cover" : "open_cover", { entity_id: "cover.height" }],
["cover", "open_cover", { entity_id: "cover.normal" }],
]);
assert.equal(raw.states["cover.height"].attributes.current_position, 5, "the native state remains unchanged");
}
});
test("standalone covers, feedback-only inversion, facade reuse and changed settings remain consistent", async () => {
const raw = hassOf([entity("cover.height", "closed", { current_position: 0, current_tilt_position: 20 }), entity("sensor.feedback", "25", { unit_of_measurement: "%" })]);
const floor = floorWith([], { placements: [{ entity_id: "cover.height", x: 1, z: 1, y: null, position: "sensor.feedback", position_inverted: true, cover_tilt_inverted: true }] });
const floors = [floor];
const first = withCoverControls(raw, floors);
assert.equal(first.states["cover.height"].attributes.current_position, 75);
assert.equal(first.states["cover.height"].attributes.current_tilt_position, 80);
assert.equal(withCoverControls(first, floors), first, "nested views cannot invert an already adapted facade again");
const next = withCoverControls(first, [{ ...floor, placements: [{ ...floor.placements[0], cover_inverted: true }] }]);
assert.equal(next.states["cover.height"].attributes.current_position, 25);
});
+84
View File
@@ -0,0 +1,84 @@
// Present a plan's cover wiring as one consistent logical direction to every view and command.
import type { Floor } from "../model.ts";
import type { HassEntity, HomeAssistant } from "../types.ts";
import { openingEntities } from "./openings.ts";
import { positionPercent } from "./position-value.ts";
interface Binding {
inverted?: boolean;
tiltInverted?: boolean;
tilt?: string | null;
position?: string | null;
positionInverted?: boolean;
}
const cache = new WeakMap<HomeAssistant, WeakMap<readonly Floor[], HomeAssistant>>();
const sources = new WeakMap<HomeAssistant, HomeAssistant>();
const swapped: Record<string, string> = { open_cover: "close_cover", close_cover: "open_cover", open_cover_tilt: "close_cover_tilt", close_cover_tilt: "open_cover_tilt" };
export function withCoverControls(hass: HomeAssistant, floors: readonly Floor[]): HomeAssistant {
const raw = sources.get(hass) ?? hass;
const memo = cache.get(raw) ?? new WeakMap<readonly Floor[], HomeAssistant>();
cache.set(raw, memo);
const existing = memo.get(floors);
if (existing) return existing;
const bindings = new Map<string, Binding>();
for (const f of floors) for (const p of f.placements) if (p.entity_id.startsWith("cover.")) {
bindings.set(p.entity_id, { inverted: p.cover_inverted, tiltInverted: p.cover_tilt_inverted, tilt: p.cover_tilt === "none" ? null : p.cover_tilt, position: p.position, positionInverted: p.position_inverted });
}
for (const e of openingEntities(raw, floors).values()) {
if (e.cover && !bindings.has(e.cover)) bindings.set(e.cover, { inverted: e.coverInverted, tiltInverted: e.coverTiltInverted, tilt: e.coverTilt, position: e.position, positionInverted: e.positionInverted });
if (e.cover2 && !bindings.has(e.cover2)) bindings.set(e.cover2, { inverted: e.cover2Inverted, tiltInverted: e.cover2TiltInverted, tilt: e.cover2Tilt });
}
const states = { ...raw.states };
for (const [id, b] of bindings) {
const st = raw.states[id];
if (!st) continue;
const a: Record<string, unknown> = { ...st.attributes, nf_cover_control: true };
let position = positionPercent(raw, b.position);
if (position !== null && b.positionInverted) position = 100 - position;
if (position === null) position = typeof st.attributes.current_position === "number" ? st.attributes.current_position : null;
if (position !== null) a.current_position = b.inverted ? 100 - position : position;
const tiltState = b.tilt ? raw.states[b.tilt] : st;
let tilt = typeof tiltState?.attributes.current_tilt_position === "number" ? tiltState.attributes.current_tilt_position : b.tilt ? positionPercent(raw, b.tilt) : null;
if (tilt !== null) {
if (b.tiltInverted) tilt = 100 - tilt;
a.current_tilt_position = tilt;
a.supported_features = Number(a.supported_features ?? 0) | 128;
}
let state = st.state;
if (b.inverted) state = ({ open: "closed", closed: "open", opening: "closing", closing: "opening" } as Record<string, string>)[state] ?? state;
if (typeof a.current_position === "number" && state !== "unavailable" && state !== "unknown" && state !== "opening" && state !== "closing") state = a.current_position > 0 ? "open" : "closed";
states[id] = { ...st, state, attributes: a } satisfies HassEntity;
}
const result: HomeAssistant = { ...raw, states, callService: async (domain, service, data = {}) => {
if (domain !== "cover") return raw.callService(domain, service, data);
const ids = Array.isArray(data.entity_id) ? data.entity_id : [data.entity_id];
const send = async (id: unknown) => {
const b = typeof id === "string" ? bindings.get(id) : undefined;
if (!b) return raw.callService(domain, service, { ...data, entity_id: id });
const payload: Record<string, unknown> = { ...data, entity_id: id };
let command = service;
if (command === "toggle" || command === "toggle_cover") command = states[String(id)]?.state === "closed" ? "open_cover" : "close_cover";
const tilt = command.includes("tilt");
if (tilt && b.tilt) payload.entity_id = b.tilt;
if (tilt ? b.tiltInverted : b.inverted) {
command = swapped[command] ?? command;
const key = tilt ? "tilt_position" : "position";
if (typeof payload[key] === "number") payload[key] = 100 - payload[key];
}
// A separate HA position-only cover controls its slats through its position service.
const target = b.tilt ? raw.states[b.tilt] : undefined;
if (tilt && b.tilt && !target?.attributes.symcon_id && typeof target?.attributes.current_tilt_position !== "number") {
if (command === "set_cover_tilt_position") { command = "set_cover_position"; payload.position = payload.tilt_position; delete payload.tilt_position; }
else if (command === "open_cover_tilt") command = "open_cover";
else if (command === "close_cover_tilt") command = "close_cover";
}
return raw.callService(domain, command, payload);
};
return Array.isArray(data.entity_id) ? Promise.all(ids.map(send)) : send(ids[0]);
} };
sources.set(result, raw);
memo.set(floors, result);
return result;
}
+1
View File
@@ -17,6 +17,7 @@ export function coverTiltEntity(hass: HomeAssistant, floors: readonly Floor[], i
}
export function coverWithTilt(hass: HomeAssistant, st: HassEntity, tilt: string | null | undefined): HassEntity {
if (st.attributes.nf_cover_control) return st;
if (!tilt) return st;
const a = hass.states[tilt]?.attributes;
const position = a?.current_tilt_position ?? a?.current_position;
@@ -0,0 +1,27 @@
import assert from "node:assert/strict";
import { test } from "node:test";
import { entity, hassOf } from "./fixtures.ts";
import { deviceValueReadouts, deviceValuesText } from "./device-values.ts";
test("several temperatures and other device values keep independent symbols, labels and native readings", () => {
const h = hassOf([
entity("cover.temp", "open", { symcon_numeric_value: 22.7, unit_of_measurement: "°C", device_class: "temperature" }),
entity("sensor.out", "48.5", { unit_of_measurement: "°C", friendly_name: "Ausgang", device_class: "temperature" }),
entity("sensor.humidity", "55", { unit_of_measurement: "%", device_class: "humidity" }),
entity("sensor.status", "normal", {}),
]);
const links = [{ id: "a", entity: "cover.temp", icon: "❄", label: "Innen" }, { id: "b", entity: "sensor.out", icon: "🔥" }, { id: "c", entity: "sensor.humidity" }, { id: "d", entity: "sensor.status", icon: "✓" }];
const rows = deviceValueReadouts(h, links);
assert.deepEqual(rows.map((v) => v.icon), ["❄", "🔥", "💧", "✓"]);
assert.equal(rows[0].text, "22.7 °C", "an inferred actuator domain cannot replace the numeric reading with an on/off state");
assert.equal(rows[1].label, "Ausgang");
assert.equal(rows[3].text, "normal");
assert.match(deviceValuesText(h, links), /❄ Innen: 22.7 °C.*🔥 48.5 °C.*💧 55 %/);
assert.equal(deviceValueReadouts(h, [links[1]])[0].id, "b", "removing one link keeps the others intact");
});
test("unassigned values stay hidden and linked unavailable readings retain a dash", () => {
const h = hassOf([entity("sensor.offline", "unavailable"), entity("sensor.native", "on", { symcon_formatted: "Ein" })]);
const rows = deviceValueReadouts(h, [{ id: "empty", entity: null }, { id: "none", entity: "none" }, { id: "offline", entity: "sensor.offline" }, { id: "native", entity: "sensor.native" }]);
assert.deepEqual(rows.map((v) => v.text), ["–", "Ein"]);
});
+31
View File
@@ -0,0 +1,31 @@
import type { DeviceValueLink } from "../model.ts";
import type { HassEntity, HomeAssistant } from "../types.ts";
import { formatNumber } from "../i18n.ts";
import { entityName, isUnavailable } from "./kinds.ts";
export function valueSymbol(st: HassEntity | undefined): string {
const a = st?.attributes;
return ({ temperature: "🌡", humidity: "💧", carbon_dioxide: "☁", illuminance: "☀", power: "⚡", energy: "⚡" } as Record<string, string>)[String(a?.device_class)] ?? (a?.unit_of_measurement === "°C" ? "🌡" : "◉");
}
export function deviceValueReadouts(hass: HomeAssistant, links: readonly DeviceValueLink[] = []): { id: string; entity: string; icon: string; label: string; text: string }[] {
return links.flatMap((link) => {
if (!link.entity || link.entity === "none") return [];
const st = hass.states[link.entity];
let text = "–";
if (st && !isUnavailable(st)) {
const a = st.attributes;
if (typeof a.symcon_formatted === "string" && a.symcon_formatted.trim()) text = a.symcon_formatted;
else {
const raw = a.symcon_numeric_value ?? st.state;
const n = typeof raw === "number" || (typeof raw === "string" && raw.trim()) ? Number(raw) : NaN;
text = Number.isFinite(n) ? `${formatNumber(hass, n, hass.entities?.[link.entity]?.display_precision ?? (a.symcon_variable_type === 1 ? 0 : 1))}${a.unit_of_measurement ? ` ${a.unit_of_measurement}` : ""}` : String(raw ?? "–");
}
}
return [{ id: link.id, entity: link.entity, icon: link.icon?.trim() || valueSymbol(st), label: link.label?.trim() || entityName(hass, link.entity), text }];
});
}
export function deviceValuesText(hass: HomeAssistant, links: readonly DeviceValueLink[] = []): string {
return deviceValueReadouts(hass, links).map((v) => `${v.icon} ${v.label && links.find((l) => l.id === v.id)?.label ? `${v.label}: ` : ""}${v.text}`).join(" · ");
}
+28 -16
View File
@@ -4,10 +4,13 @@ import type { Floor, Opening } from "../model.ts";
import type { HassEntity, HomeAssistant } from "../types.ts";
import { isUnavailable, kindOf } from "./kinds.ts";
import { roomEntities } from "./registry.ts";
import { positionPercent } from "./position-value.ts";
export interface OpeningEntities {
cover: string | null;
coverTilt?: string | null;
coverInverted?: boolean;
coverTiltInverted?: boolean;
contact: string | null;
tilt: string | null;
/** Contact and tilt sensor of the second leaf of a double door or window. */
@@ -30,6 +33,8 @@ export interface OpeningEntities {
/** A second blind of a wide window (its right half, seen from the room). */
cover2?: string | null;
cover2Tilt?: string | null;
cover2Inverted?: boolean;
cover2TiltInverted?: boolean;
}
const BLIND_CLASSES = new Set([undefined, "shutter", "blind", "awning", "shade", "curtain", "window"]);
@@ -95,6 +100,10 @@ export function openingEntities(hass: HomeAssistant, floors: readonly Floor[]):
cover2: o.type === "garage" ? null : unlessNone(o.cover2),
coverTilt: unlessNone(o.cover_tilt),
cover2Tilt: unlessNone(o.cover2_tilt),
coverInverted: !!o.cover_inverted,
coverTiltInverted: !!o.cover_tilt_inverted,
cover2Inverted: !!o.cover2_inverted,
cover2TiltInverted: !!o.cover2_tilt_inverted,
});
}
}
@@ -131,39 +140,42 @@ export const DOOR_DEFAULT_OPEN = 0.5;
/** How far a blind is open according to a position sensor: a percentage or a 0-1 fraction. Null when unknown. */
function reportedPosition(hass: HomeAssistant, id: string | null | undefined): number | null {
const st = id ? hass.states[id] : undefined;
const value = st && !isUnavailable(st) ? Number(st.state) : NaN;
if (!Number.isFinite(value)) return null;
const isPercent = st!.attributes.unit_of_measurement === "%" || value > 1;
return Math.min(1, Math.max(0, isPercent ? value / 100 : value));
const value = positionPercent(hass, id);
return value === null ? null : value / 100;
}
/** How closed the blind is (0 open, 1 closed) from the position sensor, else from the cover entity. Null without cover data. */
/** How far a cover entity is closed (0 up, 1 down), or null without one. */
function coverClosed(hass: HomeAssistant, id: string | null | undefined): number | null {
function coverClosed(hass: HomeAssistant, id: string | null | undefined, inverted = false): number | null {
const cover = id ? hass.states[id] : undefined;
if (!cover || isUnavailable(cover)) return id ? 0 : null;
const percent = cover.attributes.current_position;
if (typeof percent === "number") return 1 - Math.min(100, Math.max(0, percent)) / 100;
if (cover.state === "closed") return 1;
if (typeof percent === "number") { const closed = 1 - Math.min(100, Math.max(0, percent)) / 100; return inverted && !cover.attributes.nf_cover_control ? 1 - closed : closed; }
if (cover.state === "closed") return inverted && !cover.attributes.nf_cover_control ? 0 : 1;
if (cover.state === "open") return inverted && !cover.attributes.nf_cover_control ? 1 : 0;
return cover.state === "opening" || cover.state === "closing" ? 0.5 : 0;
}
/** How far the slats of a venetian blind are open (0 shut, 1 level), from its tilt position; null when it reports none. */
function slatsOpen(hass: HomeAssistant, id: string | null | undefined, separate?: string | null): number | null {
function slatsOpen(hass: HomeAssistant, id: string | null | undefined, separate?: string | null, inverted = false): number | null {
const main = hass.states[id || ""];
if (main?.attributes.nf_cover_control) return typeof main.attributes.current_tilt_position === "number" ? main.attributes.current_tilt_position / 100 : null;
const a = hass.states[separate || id || ""]?.attributes;
const tilt = a?.current_tilt_position ?? (separate ? a?.current_position : undefined);
return typeof tilt === "number" ? Math.min(100, Math.max(0, tilt)) / 100 : null;
const value = typeof tilt === "number" ? Math.min(100, Math.max(0, tilt)) : separate ? positionPercent(hass, separate) : null;
return value === null ? null : (inverted ? 100 - value : value) / 100;
}
function blindClosedFraction(hass: HomeAssistant, e: OpeningEntities): number | null {
if (hass.states[e.cover || ""]?.attributes.nf_cover_control) return coverClosed(hass, e.cover);
const reported = reportedPosition(hass, e.position);
if (reported !== null) return e.positionInverted ? reported : 1 - reported;
if (reported !== null) { const closed = e.positionInverted ? reported : 1 - reported; return e.coverInverted ? 1 - closed : closed; }
const cover = e.cover ? hass.states[e.cover] : undefined;
if (cover && !isUnavailable(cover)) {
const percent = cover.attributes.current_position;
if (typeof percent === "number") return 1 - Math.min(100, Math.max(0, percent)) / 100;
if (cover.state === "closed") return 1;
if (typeof percent === "number") return coverClosed(hass, e.cover, e.coverInverted);
if (cover.state === "closed") return e.coverInverted ? 0 : 1;
if (cover.state === "open") return e.coverInverted ? 1 : 0;
return cover.state === "opening" || cover.state === "closing" ? 0.5 : 0;
}
return e.cover ? 0 : null;
@@ -202,10 +214,10 @@ export function openingState(hass: HomeAssistant, e: OpeningEntities, type: Open
const isKnown = (id: string | null | undefined) => !!id && !!hass.states[id] && !isUnavailable(hass.states[id]);
const positionOf = (id: string | null | undefined) => (id ? windowPosition(hass.states[id]) : null);
const cover = blindClosedFraction(hass, e);
const slats = slatsOpen(hass, e.cover, e.coverTilt);
const slats2 = slatsOpen(hass, e.cover2, e.cover2Tilt);
const slats = slatsOpen(hass, e.cover, e.coverTilt, e.coverTiltInverted);
const slats2 = slatsOpen(hass, e.cover2, e.cover2Tilt, e.cover2TiltInverted);
const blindState = {
...(e.cover2 ? { cover2: coverClosed(hass, e.cover2) } : {}),
...(e.cover2 ? { cover2: coverClosed(hass, e.cover2, e.cover2Inverted) } : {}),
...(slats !== null ? { slats } : {}),
...(slats2 !== null ? { slats2 } : {}),
};
+28
View File
@@ -0,0 +1,28 @@
import type { HomeAssistant } from "../types.ts";
import { symconPercent } from "../symcon-controls.ts";
import { isUnavailable } from "./kinds.ts";
/** A feedback variable can be numeric even when its inferred entity domain is an actuator. */
export function isPositionVariable(hass: HomeAssistant | undefined, id: string): boolean {
const st = hass?.states[id];
if (!st) return false;
const a = st.attributes;
if (typeof a.symcon_id === "number") return a.symcon_variable_type === 1 || a.symcon_variable_type === 2;
return typeof a.current_position === "number" || (/^(sensor|number|input_number)\./.test(id) && !!st.state.trim() && Number.isFinite(Number(st.state)));
}
/** Percent open, using native Symcon ranges before considering plain 0–100 or 0–1 sensors. */
export function positionPercent(hass: HomeAssistant, id: string | null | undefined): number | null {
const st = id ? hass.states[id] : undefined;
if (!st || isUnavailable(st)) return null;
const a = st.attributes;
if (a.nf_cover_control && typeof a.current_position === "number") return a.current_position;
const native = symconPercent(st);
if (native !== null) return native;
if (typeof a.current_position === "number") return Math.max(0, Math.min(100, a.current_position));
if (!st.state.trim()) return null;
const value = Number(st.state);
if (!Number.isFinite(value)) return null;
const percent = a.unit_of_measurement === "%" || value > 1 || value < 0 ? value : value * 100;
return Math.max(0, Math.min(100, percent));
}
+3 -2
View File
@@ -206,7 +206,7 @@ export const primaryEntities = (hass: HomeAssistant, ids: readonly string[]): st
// ---------------------------------------------------------------- room climate
/** Device classes of the three room values. */
export const CLIMATE_CLASSES = { temperature: "temperature", humidity: "humidity", co2: "carbon_dioxide" } as const;
export const CLIMATE_CLASSES = { temperature: "temperature", humidity: "humidity", co2: "carbon_dioxide", illuminance: "illuminance" } as const;
export type ClimateKey = keyof typeof CLIMATE_CLASSES;
/** Numeric room values, including Symcon readings whose legacy domain was inferred from a parent name. */
@@ -222,6 +222,7 @@ export function isClimateValueSensor(hass: HomeAssistant, id: string, key: Clima
if (key === "temperature" && ["°c", "°f", "℃", "℉", "k"].includes(unit)) return true;
if (key === "humidity" && !a.device_class && ["%", "%rh", "%r.h.", "%rf", "%r.f."].includes(unit)) return true;
if (key === "co2" && unit === "ppm" && /co[₂2]/i.test(String(a.friendly_name ?? ""))) return true;
if (key === "illuminance" && ["lx", "lux"].includes(unit)) return true;
return a.device_class === CLIMATE_CLASSES[key];
}
@@ -277,7 +278,7 @@ export function roomClimateValue(hass: HomeAssistant, floor: Floor | null, room:
if (readings.length) return readings.reduce((sum, v) => sum + v, 0) / readings.length;
if (room.climate?.[key]) return null;
// no room sensor: a thermostat of the room's area tells its temperature and humidity (heating curves, the heat map)
if (key === "co2" || room.climate?.[key] === "none") return null;
if ((key !== "temperature" && key !== "humidity") || room.climate?.[key] === "none") return null;
const attr = key === "temperature" ? "current_temperature" : "current_humidity";
const climates = roomEntities(hass, room)
.filter((id) => id.startsWith("climate."))
+24
View File
@@ -28,7 +28,19 @@ const DE = {
climate_card: "Raumklima als schwebende Karte",
climate_card_hint: "Zeigt Temperatur, Luftfeuchtigkeit und CO₂ über diesem Raum. In der 3D-Ansicht lassen sie sich über „Karten“ ein- und ausblenden.",
climate_card_missing: "Keine aktuellen Messwerte",
climate_illuminance: "Helligkeit",
device_values: "Zusätzliche Werte",
device_value: "Datenpunkt",
device_value_add: "Wert hinzufügen",
device_value_remove: "Wert entfernen",
device_value_icon: "Symbol",
device_value_label: "Bezeichnung (optional)",
device_values_hint: "Über + weitere Datenpunkte auswählen, zum Beispiel mehrere Temperaturen oder andere Messwerte. Als Symbol eignen sich Emojis oder kurze Zeichen wie 🌡, 💧, ☁ oder ⚡. Die Werte erscheinen am Gerät und im Raumfenster.",
cover_tilt_entity: "Lamellenposition",
cover_direction_invert: "Wirksinn Behang umkehren",
cover_tilt_direction_invert: "Wirksinn Lamellen umkehren",
cover2_direction_invert: "Wirksinn zweiter Behang umkehren",
cover2_tilt_direction_invert: "Wirksinn Lamellen des zweiten Behangs umkehren",
cover2_tilt_entity: "Lamellenposition (zweiter Behang)",
symcon_variables_loading: "Variablen werden geladen …",
symcon_variables_loaded: "Variablen und Objektbaum wurden neu geladen.",
@@ -2057,7 +2069,19 @@ const EN: Record<Key, string> = {
climate_card: "Room climate as a floating card",
climate_card_hint: "Shows temperature, humidity and CO₂ over this room. Toggle them with “Cards” in the 3D view.",
climate_card_missing: "No current readings",
climate_illuminance: "Illuminance",
device_values: "Additional values",
device_value: "Data point",
device_value_add: "Add value",
device_value_remove: "Remove value",
device_value_icon: "Symbol",
device_value_label: "Label (optional)",
device_values_hint: "Use + to select additional data points, such as several temperatures or other readings. Symbols can be emoji or short characters such as 🌡, 💧, ☁ or ⚡. Values appear on the device and in the room panel.",
cover_tilt_entity: "Slat position",
cover_direction_invert: "Reverse blind direction",
cover_tilt_direction_invert: "Reverse slat direction",
cover2_direction_invert: "Reverse second blind direction",
cover2_tilt_direction_invert: "Reverse second blind slat direction",
cover2_tilt_entity: "Slat position (second blind)",
symcon_variables_loading: "Loading variables …",
symcon_variables_loaded: "Variables and object tree reloaded.",
+9 -11
View File
@@ -316,12 +316,11 @@ function heatPumpCard(hass: HomeAssistant | undefined, c: HeatPumpCard, i: numbe
function roomClimateCard(hass: HomeAssistant | undefined, c: RoomClimateCard, i: number): TemplateResult {
const value = (n: number | null, digits: number, unit: string) => n === null ? "–" : `${formatNumber(hass, n, digits)} ${unit}`;
return html`<div class="live-card live-card-roomclimate" data-i=${i} data-room=${c.roomId}>
<div class="live-title">${c.name || translate(hass, "room")}</div>
<div class="live-row live-climate-temperature"><span>🌡 ${translate(hass, "climate_temperature")}</span><b>${value(c.temperature === null ? null : hass ? fromCelsius(hass, c.temperature) : c.temperature, 1, hass ? tempUnit(hass) : "°C")}</b></div>
<div class="live-row live-climate-humidity"><span>💧 ${translate(hass, "climate_humidity")}</span><b>${value(c.humidity, 0, "%")}</b></div>
<div class="live-row live-climate-co2"><span>${translate(hass, "climate_co2")}</span><b>${value(c.co2, 0, "ppm")}</b></div>
${c.temperature === null && c.humidity === null && c.co2 === null ? html`<small class="live-status">${translate(hass, "climate_card_missing")}</small>` : nothing}
return html`<div class="live-card live-card-roomclimate" data-i=${i} data-room=${c.roomId} role="group" aria-label=${`${c.name || translate(hass, "room")} · ${translate(hass, "climate")}`}>
${c.showTemperature ? html`<div class="live-row live-climate-temperature"><span title=${translate(hass, "climate_temperature")} aria-label=${translate(hass, "climate_temperature")}>🌡</span><b>${value(c.temperature === null ? null : hass ? fromCelsius(hass, c.temperature) : c.temperature, 1, hass ? tempUnit(hass) : "°C")}</b></div>` : nothing}
${c.showHumidity ? html`<div class="live-row live-climate-humidity"><span title=${translate(hass, "climate_humidity")} aria-label=${translate(hass, "climate_humidity")}>💧</span><b>${value(c.humidity, 0, "%")}</b></div>` : nothing}
${c.showCo2 ? html`<div class="live-row live-climate-co2"><span title=${translate(hass, "climate_co2")} aria-label=${translate(hass, "climate_co2")}>☁</span><b>${value(c.co2, 0, "ppm")}</b></div>` : nothing}
${c.showIlluminance ? html`<div class="live-row live-climate-illuminance"><span title=${translate(hass, "climate_illuminance")} aria-label=${translate(hass, "climate_illuminance")}>☀</span><b>${value(c.illuminance, 0, "lx")}</b></div>` : nothing}
</div>`;
}
@@ -434,18 +433,17 @@ export const liveCardStyles = css`
.live-card-roomclimate {
display: grid;
gap: 4px;
min-width: 190px;
min-width: 96px;
max-width: calc(100vw - 24px);
box-sizing: border-box;
}
.live-card-roomclimate .live-title {
overflow: hidden;
text-overflow: ellipsis;
max-width: 220px;
.live-card-roomclimate .live-row {
gap: 12px;
}
.live-climate-temperature b { color: color-mix(in srgb, #ffca8a 80%, var(--nf-text)); }
.live-climate-humidity b { color: color-mix(in srgb, #7dd3fc 80%, var(--nf-text)); }
.live-climate-co2 b { color: color-mix(in srgb, #c4b5fd 80%, var(--nf-text)); }
.live-climate-illuminance b { color: color-mix(in srgb, #fde68a 80%, var(--nf-text)); }
.live-row {
display: flex;
justify-content: space-between;
+15 -4
View File
@@ -6,16 +6,18 @@ import { roomClimateCards } from "./room-climate-card.ts";
test("enabled room cards use explicit numeric sensors, averages and temperature conversion", () => {
const b = emptyBuilding();
const room = { ...box("living", 0, 0, 4, 4), name: "Wohnzimmer", climate_card: true, climate: { temperature: ["sensor.c", "sensor.f"], humidity: "cover.knx", co2: "sensor.co2" } };
const room = { ...box("living", 0, 0, 4, 4), name: "Wohnzimmer", climate_card: true, climate: { temperature: ["sensor.c", "sensor.f"], humidity: "cover.knx", co2: "sensor.co2", illuminance: "sensor.lux" } };
b.floors = [floorWith([room, box("disabled", 5, 0, 8, 4)])];
const h = hassOf([
entity("sensor.c", "20", { unit_of_measurement: "°C" }), entity("sensor.f", "68", { unit_of_measurement: "°F" }),
entity("cover.knx", "open", { symcon_numeric_value: 48.5 }), entity("sensor.co2", "780"),
entity("cover.knx", "open", { symcon_numeric_value: 48.5 }), entity("sensor.co2", "780"), entity("sensor.lux", "320", { unit_of_measurement: "lx" }),
]);
const cards = roomClimateCards(h, normalizeBuilding(b), null, null);
assert.equal(cards.length, 1);
assert.deepEqual([cards[0].temperature, cards[0].humidity, cards[0].co2], [20, 48.5, 780]);
assert.equal(cards[0].name, "Wohnzimmer");
assert.equal(cards[0].illuminance, 320);
assert.equal(cards[0].showIlluminance, true);
assert.ok(pointInPolygon([cards[0].at.x, cards[0].at.z], room.points));
h.states["cover.knx"] = entity("cover.knx", "open", { symcon_numeric_value: 55 });
assert.equal(roomClimateCards(h, b, null, null)[0].humidity, 55, "a fresh state updates the card values");
@@ -23,8 +25,8 @@ test("enabled room cards use explicit numeric sensors, averages and temperature
test("floor/room navigation filters cards and concave rooms keep their anchor inside", () => {
const b = emptyBuilding();
const room = { ...box("u", 0, 0, 6, 6), climate_card: true, points: [[0, 0], [6, 0], [6, 6], [4, 6], [4, 2], [2, 2], [2, 6], [0, 6]] as [number, number][] };
const upper = { ...floorWith([{ ...box("upper", 0, 0, 4, 4), climate_card: true }]), id: "upper" };
const room = { ...box("u", 0, 0, 6, 6), climate_card: true, climate: { temperature: "sensor.pending" }, points: [[0, 0], [6, 0], [6, 6], [4, 6], [4, 2], [2, 2], [2, 6], [0, 6]] as [number, number][] };
const upper = { ...floorWith([{ ...box("upper", 0, 0, 4, 4), climate_card: true, climate: { temperature: "sensor.pending" } }]), id: "upper" };
b.floors = [floorWith([room]), upper];
const h = hassOf([]);
const all = roomClimateCards(h, b, null, null);
@@ -40,4 +42,13 @@ test("missing, unavailable and disabled readings stay missing rather than becomi
const h = hassOf([entity("sensor.offline", "unavailable"), entity("sensor.empty", ""), entity("climate.other", "heat", { current_temperature: 30 })], { "climate.other": { area_id: "a" } });
const [card] = roomClimateCards(h, b, null, null);
assert.deepEqual([card.temperature, card.humidity, card.co2], [null, null, null]);
assert.deepEqual([card.showTemperature, card.showHumidity, card.showCo2], [true, true, false]);
});
test("unlinked metrics are hidden and an entirely unlinked room has no empty card", () => {
const b = emptyBuilding();
b.floors = [floorWith([{ ...box("r", 0, 0, 4, 4), climate_card: true, climate: { temperature: "sensor.t", humidity: "none", co2: "none" } }, { ...box("empty", 5, 0, 9, 4), climate_card: true }])];
const [card, ...rest] = roomClimateCards(hassOf([entity("sensor.t", "22.7", { unit_of_measurement: "°C" })]), b, null, null);
assert.equal(rest.length, 0);
assert.deepEqual([card.showTemperature, card.showHumidity, card.showCo2], [true, false, false]);
});
+19 -4
View File
@@ -1,4 +1,4 @@
import { roomClimateValue } from "../devices.ts";
import { roomClimateSensors, roomClimateValue, type ClimateKey } from "../devices.ts";
import { centroid, pointInPolygon, spotGrid, type Building } from "../model.ts";
import type { HomeAssistant } from "../types.ts";
import type { PlanPoint } from "../viewer/live-energy.ts";
@@ -12,6 +12,11 @@ export interface RoomClimateCard {
temperature: number | null;
humidity: number | null;
co2: number | null;
showTemperature: boolean;
showHumidity: boolean;
showCo2: boolean;
illuminance: number | null;
showIlluminance: boolean;
}
/** One opt-in card per room, using the exact same sensor assignments and averaging as the room panel. */
@@ -21,13 +26,23 @@ export function roomClimateCards(hass: HomeAssistant, building: Building, floorI
if (floorId && floor.id !== floorId) continue;
for (const room of floor.rooms) {
if (!room.climate_card || room.points.length < 3 || (roomId && room.id !== roomId)) continue;
const temperature = roomClimateValue(hass, floor, room, "temperature");
const humidity = roomClimateValue(hass, floor, room, "humidity");
const co2 = roomClimateValue(hass, floor, room, "co2");
const illuminance = roomClimateValue(hass, floor, room, "illuminance");
const linked = (key: ClimateKey, value: number | null) => {
const chosen = room.climate?.[key];
if (chosen === "none") return false;
return (chosen ? [chosen].flat().some((id) => !!id && id !== "none") : false) || roomClimateSensors(hass, floor, room, key).length > 0 || value !== null;
};
const showTemperature = linked("temperature", temperature), showHumidity = linked("humidity", humidity), showCo2 = linked("co2", co2);
const showIlluminance = linked("illuminance", illuminance);
if (!showTemperature && !showHumidity && !showCo2 && !showIlluminance) continue;
const middle = centroid(room.points);
const [x, z] = pointInPolygon(middle, room.points) ? middle : spotGrid(room, 9, 9).sort((a, b) => Math.hypot(a[0] - middle[0], a[1] - middle[1]) - Math.hypot(b[0] - middle[0], b[1] - middle[1]))[0] ?? room.points[0];
cards.push({ kind: "roomclimate", roomId: room.id, name: room.name,
at: { floorId: floor.id, x, z, y: (room.ceiling ?? floor.height) + 0.4 },
temperature: roomClimateValue(hass, floor, room, "temperature"),
humidity: roomClimateValue(hass, floor, room, "humidity"),
co2: roomClimateValue(hass, floor, room, "co2"),
temperature, humidity, co2, illuminance, showTemperature, showHumidity, showCo2, showIlluminance,
});
}
}
+2 -1
View File
@@ -6,6 +6,7 @@ import { formatNumber, translate, type I18nKey } from "./i18n.ts";
import { iconSvg, mdiIcon } from "./icons.ts";
import { ceilingAt, offsetAt, pointInPolygon, type Building, type Floor, type Placement, type Room } from "./model.ts";
import type { HassEntity, HomeAssistant } from "./types.ts";
import { deviceValuesText } from "./entities/device-values.ts";
import type { DeviceMarker } from "./viewer/viewer3d.ts";
import { lightAnimation } from "./light-effects.ts";
import { pluginFloorWedge, pluginKind, pluginMarkerPatch } from "./plugins/registry.ts";
@@ -135,7 +136,7 @@ function markerFor(hass: HomeAssistant, floor: Floor, placed: Placement): Device
name: placed.name || entityName(hass, placed.entity_id, areaName),
ownName: placed.name || undefined,
showName: !!placed.show_name,
text: stateText(hass, st),
text: [stateText(hass, st), deviceValuesText(hass, placed.values)].filter(Boolean).join(" · "),
active: isActive(st),
unavailable: isUnavailable(st),
glow: kind === "light" ? scaleGlow(lightGlow(st), placed.glow_scale) : null,
+19
View File
@@ -16,6 +16,15 @@ export interface RoomClimate {
temperature?: string | string[] | null;
humidity?: string | string[] | null;
co2?: string | string[] | null;
illuminance?: string | string[] | null;
}
/** Additional readouts attached to a device; entity references always come from the picker. */
export interface DeviceValueLink {
id: string;
entity: EntityRef;
icon?: string | null;
label?: string | null;
}
/** A wall height on a room edge, or one per part of a split edge. */
@@ -162,9 +171,13 @@ export interface Opening {
cover: EntityRef;
/** Separate numeric control for the venetian blind's slat position. */
cover_tilt?: EntityRef;
cover_inverted?: boolean;
cover_tilt_inverted?: boolean;
/** Windows and doors: a second blind for the right half (seen from the room) of a wide window. */
cover2?: string | null;
cover2_tilt?: EntityRef;
cover2_inverted?: boolean;
cover2_tilt_inverted?: boolean;
/** The kind of blind: a roller shutter outside (null, default), a venetian blind (Raffstore) outside with slats, or a roller blind inside. */
blind?: "roller" | "venetian" | "inside" | null;
/** The favourite position of the blind (%, open = 100) – Somfy's "My": a button in its menu moves it there. */
@@ -234,6 +247,7 @@ export interface Furniture extends LightEffectConfig {
/** Fridges and freezers: a temperature sensor of the fridge (temp_entity) and one of the freezer compartment; the marker shows them and warns when too warm. Any other device: its own thermometer, shown on its pin (#112). */
temp_entity?: string | null;
temp_entity2?: string | null;
values?: DeviceValueLink[];
/** Smart fridge: door sensors of the left (freezer) and right (fridge) door; the doors open in 3D while they report open. */
door_left?: EntityRef;
door_right?: EntityRef;
@@ -343,6 +357,11 @@ export interface Placement extends LightEffectConfig {
simple?: boolean;
/** A placed blind's separate slat position control. */
cover_tilt?: EntityRef;
values?: DeviceValueLink[];
cover_inverted?: boolean;
cover_tilt_inverted?: boolean;
position?: EntityRef;
position_inverted?: boolean;
/** Its marker in 3D: automatic (null), always shown, shown without watts, or hidden. */
marker?: MarkerShow | null;
/** An own symbol for the marker: a Material Design icon name without "mdi:" (null = by kind). */
+4 -3
View File
@@ -21,6 +21,7 @@ import { panelStyles } from "./panel/styles.ts";
import { colorSchemeOf, controls, readableStyles, tokens } from "./styles.ts";
import { LOOKS, lookNow, type Look } from "./themes.ts";
import type { HomeAssistant } from "./types.ts";
import { withCoverControls } from "./entities/cover-controls.ts";
import { allOffPlan, floorSwitchables, type ServiceCall } from "./live/all-off.ts";
import type { FloorStack, Quality, WallMode } from "./viewer/viewer3d.ts";
@@ -580,7 +581,7 @@ export class NextFloorPanel extends LitElement {
<div class="nf-stage-wrap ${this._roomId ? "nf-room-open" : ""}">
<nf-view3d
class="nf-body"
.hass=${this.hass}
.hass=${withCoverControls(this.hass, building.floors)}
.building=${building}
.packs=${this.data.packs}
.floorStack=${p.floorStack}
@@ -631,7 +632,7 @@ export class NextFloorPanel extends LitElement {
? html`<nf-room-panel
.building=${this.data.building ?? null}
class="nf-room-panel"
.hass=${this.hass}
.hass=${withCoverControls(this.hass, building.floors)}
.room=${room}
.floor=${building.floors.find((f) => f.rooms.some((r) => r.id === this._roomId)) ?? null}
.confirmEntities=${confirmEntities(this.hass, building.floors)}
@@ -644,7 +645,7 @@ export class NextFloorPanel extends LitElement {
? html`<nf-room-panel
.building=${this.data.building ?? null}
class="nf-room-panel"
.hass=${this.hass}
.hass=${withCoverControls(this.hass, building.floors)}
.room=${null}
.outside=${this.outsideIds(building)}
.confirmEntities=${confirmEntities(this.hass, building.floors)}
+8 -3
View File
@@ -35,7 +35,7 @@ try {
window.fetch = async (url, init) => {
if (!String(url).includes("/hook/climate-fixture/")) return originalFetch(url, init);
window.bootstrapCalls++;
const variables = [raw(201, "Raumtemperatur", 2, 21.5, "°C"), raw(202, "Messwert Raumfeuchtigkeit", 2, window.humidityValue, "%", "cover"), raw(203, "CO₂", 1, 780, "ppm")];
const variables = [raw(201, "Raumtemperatur", 2, 21.5, "°C"), raw(202, "Messwert Raumfeuchtigkeit", 2, window.humidityValue, "%", "cover"), raw(203, "CO₂", 1, 780, "ppm"), raw(204, "Raumhelligkeit", 2, 320.5, "lx")];
const objects = [{ object_id: 100, parent_id: 0, name: "Haus", path: "Haus", object_type: 0, position: 0, hidden: true, icon: "" },
...variables.map((v) => ({ object_id: v.attributes.symcon_id, parent_id: 100, entity_id: v.entity_id, name: v.name, path: v.path, object_type: 2, position: 0, hidden: false, icon: "" }))];
return new Response(JSON.stringify({ state_revision: window.bootstrapCalls, building_revision: 1, variables, objects, areas: [] }));
@@ -88,11 +88,13 @@ try {
await window.pickClimate("Temperatur", 201, "Raumtemperatur");
await window.pickClimate("Luftfeuchte", 202, "Messwert Raumfeuchtigkeit");
await window.pickClimate("CO₂", 203, "CO₂");
await window.pickClimate("Helligkeit", 204, "Raumhelligkeit");
const label = [...window.climateSection.querySelectorAll("label.nf-check")].find((el) => el.textContent.includes("schwebende Karte"));
label.querySelector("input").click();
await e.updateComplete;
const second = e._doc.floors[0].rooms[1];
second.climate = { temperature: "none", humidity: "none", co2: "none" };
second.climate = { temperature: "sensor.201", humidity: "none", co2: "none", illuminance: "none" };
window.compactRoomId = second.id;
e.selectItem("room", second.id);
await e.updateComplete;
const section2 = [...e.shadowRoot.querySelectorAll("details.nf-points")].find((d) => d.querySelector("summary").textContent === "Raumklima");
@@ -111,9 +113,12 @@ try {
assert.match(await text(), /21,5\s*°C/);
assert.match(await text(), /52\s*%/);
assert.match(await text(), /780\s*ppm/);
assert.match(await text(), /321\s*lx/);
assert.equal(await page.evaluate(() => window.climateView.shadowRoot.querySelector(".live-climate-co2 span").textContent), "☁", "CO2 uses a cloud symbol");
assert.equal(await page.evaluate(() => !!window.climateView.shadowRoot.querySelector(".live-card-house")), false, "climate cards do not require an energy meter");
assert.equal(await page.evaluate(() => window.nfPanel.data.building.floors[0].rooms[0].climate.humidity), "cover.202");
assert.equal(await page.evaluate(() => [...window.climateView.shadowRoot.querySelectorAll(".live-card-roomclimate")].some((c) => c.textContent.includes("Keine aktuellen Messwerte"))), true);
assert.equal(await page.evaluate(() => window.climateView.shadowRoot.querySelector(`.live-card[data-room="${window.compactRoomId}"]`).querySelectorAll(".live-row").length), 1, "unlinked humidity and CO2 do not get rows");
assert.equal(await page.evaluate(() => [...window.climateView.shadowRoot.querySelectorAll(".live-card-roomclimate")].some((c) => /Wohnzimmer|Küche|Temperatur|Luftfeuchte/.test(c.textContent))), false, "cards show no repeated room name or metric labels");
await page.evaluate(() => { window.humidityValue = 62.4; window.nfPanel.shadowRoot.querySelector(".nf-reload-variables").click(); });
await page.waitForFunction(() => window.climateView.shadowRoot.querySelector(`.live-card[data-room="${window.climateRoomId}"]`).textContent.includes("62 %"));
const out = join(root, "preview/screenshots");
+84 -9
View File
@@ -112,12 +112,13 @@ try {
}), true, "reload button fits the mobile title bar");
// Exercise the actual adapter's numeric roles and the designer's real object-tree fields.
const adapter = await build({ entryPoints: [join(root, "frontend/src/symcon-bridge.ts")], bundle: true, write: false, format: "iife", globalName: "SymconAdapter", logLevel: "silent" });
const adapter = await build({ stdin: { contents: 'export { SymconBridge } from "./symcon-bridge.ts"; export { withCoverControls } from "./entities/cover-controls.ts";', resolveDir: join(root, "frontend/src") }, bundle: true, write: false, format: "iife", globalName: "SymconAdapter", logLevel: "silent" });
await page.addScriptTag({ content: adapter.outputFiles[0].text });
await page.setViewport({ width: 1440, height: 1000 });
await page.evaluate(async () => {
const raw = (id, name, max, value, entity = `sensor.${id}`) => ({ entity_id: entity, name, path: `Haus / KNX / ${name}`, state: String(value), attributes: { symcon_id: id, symcon_variable_type: 1, symcon_numeric_value: value, symcon_min: 0, symcon_max: max, symcon_step: 1, symcon_has_action: true } });
const variables = [raw(42, "Dimmerwert", 255, 128, "cover.42"), raw(101, "Behang Position", 100, 40), raw(102, "Lamellen Position", 255, 128)];
const variables = [raw(42, "Dimmerwert", 255, 128, "cover.42"), raw(101, "Behang Position", 100, 40), raw(102, "Lamellen Position", 255, 128), raw(103, "Positionsrückmeldung", 255, 51, "cover.103"), raw(104, "Temperatur innen", 100, 21.7), raw(105, "Temperatur außen", 100, 48.2), raw(106, "Leistung", 100, 7.3)];
for (const v of variables.filter((v) => v.attributes.symcon_id >= 104)) Object.assign(v.attributes, { symcon_variable_type: 2, unit_of_measurement: v.attributes.symcon_id === 106 ? "W" : "°C" });
const objects = [{ object_id: 100, parent_id: 0, name: "Haus", path: "Haus", object_type: 0, position: 0, hidden: true, icon: "" },
...variables.map((v) => ({ object_id: v.attributes.symcon_id, parent_id: 100, name: v.name, path: v.path, entity_id: v.entity_id, object_type: 2, position: 0, hidden: false, icon: "" }))];
const originalFetch = window.fetch;
@@ -176,14 +177,23 @@ try {
if (!field("Lamellenposition")) throw new Error("Slat selector must already exist before a position is selected");
await window.chooseControl(field("Position (Behang)"), 101, "Behang Position");
await window.chooseControl(field("Lamellenposition"), 102, "Lamellen Position");
await window.chooseControl(field("Positions-Sensor (live)"), 103, "Positionsrückmeldung");
const check = (text) => [...e.shadowRoot.querySelectorAll("label.nf-check")].find((el) => el.textContent.includes(text)).querySelector("input").click();
check("Wirksinn Behang umkehren");
await e.updateComplete;
check("Wirksinn Lamellen umkehren");
await e.updateComplete;
await p.updateComplete;
await e.updateComplete;
window.controlHass = window.SymconAdapter.withCoverControls(p.hass, e._doc.floors);
const roomPanel = document.createElement("nf-room-panel");
Object.assign(roomPanel, { hass: p.hass, building: e._doc, floor: e._doc.floors[0], room: e._doc.floors[0].rooms[0] });
Object.assign(roomPanel, { hass: window.controlHass, building: e._doc, floor: e._doc.floors[0], room: e._doc.floors[0].rooms[0] });
roomPanel.id = "controls-room";
roomPanel.style = "position:fixed;right:12px;top:80px;width:370px;max-height:85vh;overflow:auto;z-index:1000;background:#202020";
document.body.append(roomPanel);
await roomPanel.updateComplete;
const quick = document.createElement("nf-quick-menu");
Object.assign(quick, { hass: p.hass, entity: "cover.101", tiltEntity: "cover.102" });
Object.assign(quick, { hass: window.controlHass, entity: "cover.101", tiltEntity: "cover.102" });
quick.id = "controls-quick";
quick.style = "position:fixed;left:30px;top:270px;z-index:1001";
document.body.append(quick);
@@ -192,9 +202,14 @@ try {
assert.deepEqual(await page.evaluate(() => {
const f = window.ed._doc.floors[0];
const o = f.openings.find((o) => o.id === window.controlWindow);
return [f.furniture.find((m) => m.id === window.controlLamp).entity, o.cover, o.cover_tilt];
}), ["light.42", "cover.101", "cover.102"], "object-tree confirmations retain distinct native integer variables");
return [f.furniture.find((m) => m.id === window.controlLamp).entity, o.cover, o.cover_tilt, o.position, o.cover_inverted, o.cover_tilt_inverted];
}), ["light.42", "cover.101", "cover.102", "cover.103", true, true], "native feedback selection and independent direction switches persist");
assert.equal(await page.evaluate(() => window.controlHass.states["cover.101"].attributes.current_position), 80, "display follows inverted 0-255 feedback rather than the command value");
assert.equal(await page.evaluate(() => window.controlHass.states["cover.101"].attributes.current_tilt_position), 100 - 128 / 255 * 100);
await page.evaluate(async () => {
window.logicalControlCalls = [];
const send = window.controlHass.callService;
window.controlHass.callService = (domain, service, data) => { window.logicalControlCalls.push([domain, service, data]); return send(domain, service, data); };
const panel = document.querySelector("#controls-room");
const set = (input, value) => { if (!input) throw new Error("Expected control slider is missing"); input.value = value; input.dispatchEvent(new Event("change", { bubbles: true })); };
const rows = [...panel.shadowRoot.querySelectorAll(".nf-rp-row")];
@@ -215,10 +230,11 @@ try {
await page.waitForFunction(() => window.actuatorCalls.length === 4);
assert.deepEqual(await page.evaluate(() => window.actuatorCalls.map((c) => [c.domain, c.service, c.data])), [
["light", "turn_on", { entity_id: "light.42", brightness_pct: 25 }],
["cover", "set_cover_position", { entity_id: "cover.101", position: 60 }],
["cover", "set_cover_tilt_position", { entity_id: "cover.102", tilt_position: 30 }],
["cover", "set_cover_position", { entity_id: "cover.101", position: 40 }],
["cover", "set_cover_tilt_position", { entity_id: "cover.102", tilt_position: 70 }],
]);
["cover", "set_cover_tilt_position", { entity_id: "cover.102", tilt_position: 30 }],
], JSON.stringify(await page.evaluate(() => window.logicalControlCalls)));
assert.equal(await page.evaluate(() => window.actuatorCalls.some((c) => c.data.entity_id === "cover.103")), false, "feedback is never written");
await page.evaluate(async () => {
const e = window.ed;
e._doc.floors[0].placements.push({ entity_id: "cover.101", x: 1, z: 1, y: null });
@@ -226,8 +242,67 @@ try {
await e.updateComplete;
const field = [...e.shadowRoot.querySelectorAll("label.nf-field")].find((el) => el.textContent.trim().startsWith("Lamellenposition"));
await window.chooseControl(field.querySelector("nf-entity-picker"), 102, "Lamellen Position");
const positionField = [...e.shadowRoot.querySelectorAll("label.nf-field")].find((el) => el.textContent.trim().startsWith("Positions-Sensor (live)"));
await window.chooseControl(positionField.querySelector("nf-entity-picker"), 103, "Positionsrückmeldung");
const check = (text) => [...e.shadowRoot.querySelectorAll("label.nf-check")].find((el) => el.textContent.includes(text)).querySelector("input").click();
check("Wirksinn Behang umkehren");
await e.updateComplete;
check("Wirksinn Lamellen umkehren");
await e.updateComplete;
});
assert.equal(await page.evaluate(() => window.ed._doc.floors[0].placements.find((p) => p.entity_id === "cover.101").cover_tilt), "cover.102", "standalone blinds also expose the actual native slat picker");
await page.evaluate(async () => {
const e = window.ed, p = window.nfPanel;
window.editSync = async () => { await e.updateComplete; await p.updateComplete; await e.updateComplete; };
for (const [id, name, icon] of [[104, "Temperatur innen", "❄"], [105, "Temperatur außen", "🔥"], [106, "Leistung", "⚡"]]) {
e.shadowRoot.querySelector(".nf-value-add").click();
await window.editSync();
const row = [...e.shadowRoot.querySelectorAll(".nf-value-link")].at(-1);
await window.chooseControl(row.querySelector("nf-entity-picker"), id, name);
await window.editSync();
const current = [...e.shadowRoot.querySelectorAll(".nf-value-link")].at(-1);
const input = [...current.querySelectorAll("label.nf-field")].find((l) => l.textContent.trim().startsWith("Symbol")).querySelector("input");
input.value = icon;
input.dispatchEvent(new Event("change", { bubbles: true }));
await window.editSync();
}
const roomPanel = document.querySelector("#controls-room");
Object.assign(roomPanel, { hass: window.SymconAdapter.withCoverControls(p.hass, e._doc.floors), building: e._doc, floor: e._doc.floors[0], room: e._doc.floors[0].rooms[0] });
document.querySelector("#controls-quick").hass = roomPanel.hass;
await roomPanel.updateComplete;
});
assert.deepEqual(await page.evaluate(() => window.ed._doc.floors[0].placements.find((p) => p.entity_id === "cover.101").values.map((v) => [v.entity, v.icon])), [["sensor.104", "❄"], ["sensor.105", "🔥"], ["sensor.106", "⚡"]]);
assert.equal(await page.evaluate(() => document.querySelector("#controls-room").shadowRoot.querySelector(".nf-extra-values").textContent.includes("48,2 °C")), true, "multiple device temperatures render their native values");
await page.evaluate(async () => {
const e = window.ed;
const ids = e._doc.floors[0].placements.find((p) => p.entity_id === "cover.101").values.map((v) => v.id);
e.shadowRoot.querySelectorAll(".nf-value-remove")[1].click();
await window.editSync();
const left = e._doc.floors[0].placements.find((p) => p.entity_id === "cover.101").values.map((v) => v.id);
if (left.join() !== [ids[0], ids[2]].join()) throw new Error("Removing a value changed the other links");
e.selectItem("furniture", window.controlLamp);
await window.editSync();
e.shadowRoot.querySelector(".nf-value-add").click();
await window.editSync();
await window.chooseControl(e.shadowRoot.querySelector(".nf-value-link nf-entity-picker"), 104, "Temperatur innen");
await window.editSync();
e.selectItem("room", e._doc.floors[0].rooms[0].id);
await window.editSync();
const help = [...e.shadowRoot.querySelectorAll("nf-help-popup")].find((h) => h.text.includes("Deckenleuchten"));
await help.updateComplete;
window.helpPopup = help;
if (e.shadowRoot.textContent.includes("Deckenleuchten")) throw new Error("Explanation still takes space in the form");
help.shadowRoot.querySelector(".info").click();
});
assert.equal(await page.evaluate(() => window.helpPopup.shadowRoot.querySelector("dialog").open), true);
assert.match(await page.evaluate(() => window.helpPopup.shadowRoot.querySelector("dialog").textContent), /Deckenleuchten/);
await page.setViewport({ width: 390, height: 844 });
assert.equal(await page.evaluate(() => { const r = window.helpPopup.shadowRoot.querySelector("dialog").getBoundingClientRect(); return r.left >= 0 && r.right <= innerWidth && r.top >= 0 && r.bottom <= innerHeight; }), true, "information popup fits a phone");
await page.screenshot({ path: join(out, "symcon-info-mobile.png") });
await page.keyboard.press("Escape");
await page.waitForFunction(() => !window.helpPopup.shadowRoot.querySelector("dialog").open);
assert.equal(await page.evaluate(() => window.helpPopup.shadowRoot.querySelector("dialog").open), false);
await page.setViewport({ width: 1440, height: 1000 });
await page.screenshot({ path: join(out, "symcon-dimmer-blind-controls.png") });
assert.deepEqual(errors, []);
console.log("OK: collapsible walls, variable reload, KNX temperature, numeric dimmer/position/slat tree bindings, off-state dimming and independent room/quick-menu commands");
@@ -1,7 +1,7 @@
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
var p={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"};var M=globalThis,N=M.ShadowRoot&&(M.ShadyCSS===void 0||M.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,V=Symbol(),me=new WeakMap,R=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==V)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(N&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=me.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&me.set(t,e))}return e}toString(){return this.cssText}},pe=i=>new R(typeof i=="string"?i:i+"",void 0,V),U=(i,...e)=>{let t=i.length===1?i[0]:e.reduce((n,r,o)=>n+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+i[o+1],i[0]);return new R(t,i,V)},fe=(i,e)=>{if(N)i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),r=M.litNonce;r!==void 0&&n.setAttribute("nonce",r),n.textContent=t.cssText,i.appendChild(n)}},j=N?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return pe(t)})(i):i;var{is:Ke,defineProperty:Ge,getOwnPropertyDescriptor:Oe,getOwnPropertyNames:Ie,getOwnPropertySymbols:Ze,getPrototypeOf:Ve}=Object,C=globalThis,ge=C.trustedTypes,Ue=ge?ge.emptyScript:"",je=C.reactiveElementPolyfillSupport,F=(i,e)=>i,q={toAttribute(i,e){switch(e){case Boolean:i=i?Ue:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},we=(i,e)=>!Ke(i,e),be={attribute:!0,type:String,converter:q,reflect:!1,useDefault:!1,hasChanged:we};Symbol.metadata??=Symbol("metadata"),C.litPropertyMetadata??=new WeakMap;var b=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=be){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(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&&Ge(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:o}=Oe(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:r,set(a){let s=r?.call(this);o?.call(this,a),this.requestUpdate(e,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??be}static _$Ei(){if(this.hasOwnProperty(F("elementProperties")))return;let e=Ve(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(F("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(F("properties"))){let t=this.properties,n=[...Ie(t),...Ze(t)];for(let r of n)this.createProperty(r,t[r])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,r]of t)this.elementProperties.set(n,r)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let r=this._$Eu(t,n);r!==void 0&&this._$Eh.set(r,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 r of n)t.unshift(j(r))}else e!==void 0&&t.push(j(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.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return fe(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.Line truncated
\f\r]`,x=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ye=/-->/g,Se=/>/g,S=RegExp(`>|${J}(?:([^\\s"'>=/]+)(${J}*=${J}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ae=/'/g,De=/"/g,Re=/^(?:script|style|textarea|title)$/i,ie=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),l=ie(1),ct=ie(2),ut=ie(3),z=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),ze=new WeakMap,A=D.createTreeWalker(D,129);function Fe(i,e){if(!re(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return ve!==void 0?ve.createHTML(e):e}var Xe=(i,e)=>{let t=i.length-1,n=[],r,o=e===2?"<svg>":e===3?"<math>":"",a=x;for(let s=0;s<t;s++){let h=i[s],u,m,_=-1,g=0;for(;g<h.length&&(a.lastIndex=g,m=a.exec(h),m!==null);)g=a.lastIndex,a===x?m[1]==="!--"?a=ye:m[1]!==void 0?a=Se:m[2]!==void 0?(Re.test(m[2])&&(r=RegExp("</"+m[2],"g")),a=S):m[3]!==void 0&&(a=S):a===S?m[0]===">"?(a=r??x,_=-1):m[1]===void 0?_=-2:(_=a.lastIndex-m[2].length,u=m[1],a=m[3]===void 0?S:m[3]==='"'?De:Ae):a===De||a===Ae?a=S:a===ye||a===Se?a=x:(a=S,r=void 0);let k=a===S&&i[s+1].startsWith("/>")?" ":"";o+=a===x?h+qe:_>=0?(n.push(u),h.slice(0,_)+Ee+h.slice(_)+v+k):h+v+(_===-2?s:k)}return[Fe(i,o+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},B=class i{constructor({strings:e,_$litType$:t},n){let r;this.parts=[];let o=0,a=0,s=e.length-1,h=this.parts,[u,m]=Xe(e,t);if(this.el=i.createElement(u,n),A.currentNode=this.el.content,t===2||t===3){let _=this.el.content.firstChild;_.replaceWith(..._.childNodes)}for(;(r=A.nextNode())!==null&&h.length<s;){if(r.nodeType===1){if(r.hasAttributes())for(let _ of r.getAttributeNames())if(_.endsWith(Ee)){let g=m[a++],k=r.getAttribute(_).split(v),L=/([.?@])?(.*)/.exec(g);h.push({type:1,index:o,name:L[2],strings:k,ctor:L[1]==="."?Y:L[1]==="?"?Q:L[1]==="@"?ee:T}),r.removeAttribute(_)}else _.startsWith(v)&&(h.push({type:6,index:o}),r.removeAttribute(_));if(Re.test(r.tagName)){let _=r.textContent.split(v),g=_.length-1;if(g>0){r.textContent=K?K.emptyScript:"";for(let k=0;k<g;k++)r.append(_[k],H()),A.nextNode(),h.push({type:2,index:++o});r.append(_[g],H())}}}else if(r.nodeType===8)if(r.data===Te)h.push({type:2,index:o});else{let _=-1;for(;(_=r.data.indexOf(v,_+1))!==-1;)h.push({type:7,index:o}),_+=v.length-1}o++}}static createElement(e,t){let n=D.createElement("template");return n.innerHTML=e,n}};function E(i,e,t=i,n){if(e===z)return e;let r=n!==void 0?t._$Co?.[n]:t._$Cl,o=W(e)?void 0:e._$litDirective$;return r?.constructor!==o&&(r?._$AO?.(!1),o===void 0?r=void 0:(r=new o(i),r._$AT(i,t,n)),n!==void 0?(t._$Co??=[])[n]=r:t._$Cl=r),r!==void 0&&(e=E(i,r._$AS(i,e.values),r,n)),e}var X=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,r=(e?.creationScope??D).importNode(t,!0);A.currentNode=r;let o=A.nextNode(),a=0,s=0,h=n[0];for(;h!==void 0;){if(a===h.index){let u;h.type===2?u=new P(o,o.nextSibling,this,e):h.type===1?u=new h.ctor(o,h.name,h.strings,this,e):h.type===6&&(u=new te(o,this,e)),this._$AV.push(u),h=n[++s]}a!==h?.index&&(o=A.nextNode(),a++)}return A.currentNode=D,r}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++}},P=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.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=E(this,e,t),W(e)?e===d||e==null||e===""?(this._$AH!==d&&this._$AR(),this._$AH=d):e!==this._$AH&&e!==z&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Je(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!==d&&W(this._$AH)?this._$AA.nextSibling.data=e:this.T(D.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,r=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=B.createElement(Fe(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{let o=new X(r,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=ze.get(e.strings);return t===void 0&&ze.set(e.strings,t=new B(e)),t}k(e){re(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,r=0;for(let o of e)r===t.length?t.push(n=new i(this.O(H()),this.O(H()),this,this.options)):n=t[r],n._$AI(o),r++;r<t.length&&(this._$AR(n&&n._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=ke(e).nextSibling;ke(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},T=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,o){this.type=1,this._$AH=d,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=o,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):thiLine truncated
var p={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"};var M=globalThis,N=M.ShadowRoot&&(M.ShadyCSS===void 0||M.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,V=Symbol(),me=new WeakMap,R=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==V)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(N&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=me.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&me.set(t,e))}return e}toString(){return this.cssText}},pe=i=>new R(typeof i=="string"?i:i+"",void 0,V),U=(i,...e)=>{let t=i.length===1?i[0]:e.reduce((n,r,o)=>n+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+i[o+1],i[0]);return new R(t,i,V)},fe=(i,e)=>{if(N)i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),r=M.litNonce;r!==void 0&&n.setAttribute("nonce",r),n.textContent=t.cssText,i.appendChild(n)}},j=N?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return pe(t)})(i):i;var{is:Ke,defineProperty:Ge,getOwnPropertyDescriptor:Oe,getOwnPropertyNames:Ie,getOwnPropertySymbols:Ze,getPrototypeOf:Ve}=Object,C=globalThis,ge=C.trustedTypes,Ue=ge?ge.emptyScript:"",je=C.reactiveElementPolyfillSupport,F=(i,e)=>i,q={toAttribute(i,e){switch(e){case Boolean:i=i?Ue:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},we=(i,e)=>!Ke(i,e),be={attribute:!0,type:String,converter:q,reflect:!1,useDefault:!1,hasChanged:we};Symbol.metadata??=Symbol("metadata"),C.litPropertyMetadata??=new WeakMap;var b=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=be){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(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&&Ge(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:o}=Oe(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:r,set(a){let s=r?.call(this);o?.call(this,a),this.requestUpdate(e,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??be}static _$Ei(){if(this.hasOwnProperty(F("elementProperties")))return;let e=Ve(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(F("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(F("properties"))){let t=this.properties,n=[...Ie(t),...Ze(t)];for(let r of n)this.createProperty(r,t[r])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,r]of t)this.elementProperties.set(n,r)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let r=this._$Eu(t,n);r!==void 0&&this._$Eh.set(r,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 r of n)t.unshift(j(r))}else e!==void 0&&t.push(j(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.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return fe(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.Line truncated
\f\r]`,W=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ye=/-->/g,Se=/>/g,S=RegExp(`>|${J}(?:([^\\s"'>=/]+)(${J}*=${J}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ae=/'/g,De=/"/g,Re=/^(?:script|style|textarea|title)$/i,ie=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),l=ie(1),ct=ie(2),ut=ie(3),z=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),ze=new WeakMap,A=D.createTreeWalker(D,129);function Fe(i,e){if(!re(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return ve!==void 0?ve.createHTML(e):e}var Xe=(i,e)=>{let t=i.length-1,n=[],r,o=e===2?"<svg>":e===3?"<math>":"",a=W;for(let s=0;s<t;s++){let h=i[s],u,m,_=-1,g=0;for(;g<h.length&&(a.lastIndex=g,m=a.exec(h),m!==null);)g=a.lastIndex,a===W?m[1]==="!--"?a=ye:m[1]!==void 0?a=Se:m[2]!==void 0?(Re.test(m[2])&&(r=RegExp("</"+m[2],"g")),a=S):m[3]!==void 0&&(a=S):a===S?m[0]===">"?(a=r??W,_=-1):m[1]===void 0?_=-2:(_=a.lastIndex-m[2].length,u=m[1],a=m[3]===void 0?S:m[3]==='"'?De:Ae):a===De||a===Ae?a=S:a===ye||a===Se?a=W:(a=S,r=void 0);let k=a===S&&i[s+1].startsWith("/>")?" ":"";o+=a===W?h+qe:_>=0?(n.push(u),h.slice(0,_)+Ee+h.slice(_)+v+k):h+v+(_===-2?s:k)}return[Fe(i,o+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},B=class i{constructor({strings:e,_$litType$:t},n){let r;this.parts=[];let o=0,a=0,s=e.length-1,h=this.parts,[u,m]=Xe(e,t);if(this.el=i.createElement(u,n),A.currentNode=this.el.content,t===2||t===3){let _=this.el.content.firstChild;_.replaceWith(..._.childNodes)}for(;(r=A.nextNode())!==null&&h.length<s;){if(r.nodeType===1){if(r.hasAttributes())for(let _ of r.getAttributeNames())if(_.endsWith(Ee)){let g=m[a++],k=r.getAttribute(_).split(v),L=/([.?@])?(.*)/.exec(g);h.push({type:1,index:o,name:L[2],strings:k,ctor:L[1]==="."?Y:L[1]==="?"?Q:L[1]==="@"?ee:T}),r.removeAttribute(_)}else _.startsWith(v)&&(h.push({type:6,index:o}),r.removeAttribute(_));if(Re.test(r.tagName)){let _=r.textContent.split(v),g=_.length-1;if(g>0){r.textContent=K?K.emptyScript:"";for(let k=0;k<g;k++)r.append(_[k],x()),A.nextNode(),h.push({type:2,index:++o});r.append(_[g],x())}}}else if(r.nodeType===8)if(r.data===Te)h.push({type:2,index:o});else{let _=-1;for(;(_=r.data.indexOf(v,_+1))!==-1;)h.push({type:7,index:o}),_+=v.length-1}o++}}static createElement(e,t){let n=D.createElement("template");return n.innerHTML=e,n}};function E(i,e,t=i,n){if(e===z)return e;let r=n!==void 0?t._$Co?.[n]:t._$Cl,o=H(e)?void 0:e._$litDirective$;return r?.constructor!==o&&(r?._$AO?.(!1),o===void 0?r=void 0:(r=new o(i),r._$AT(i,t,n)),n!==void 0?(t._$Co??=[])[n]=r:t._$Cl=r),r!==void 0&&(e=E(i,r._$AS(i,e.values),r,n)),e}var X=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,r=(e?.creationScope??D).importNode(t,!0);A.currentNode=r;let o=A.nextNode(),a=0,s=0,h=n[0];for(;h!==void 0;){if(a===h.index){let u;h.type===2?u=new P(o,o.nextSibling,this,e):h.type===1?u=new h.ctor(o,h.name,h.strings,this,e):h.type===6&&(u=new te(o,this,e)),this._$AV.push(u),h=n[++s]}a!==h?.index&&(o=A.nextNode(),a++)}return A.currentNode=D,r}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++}},P=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.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=E(this,e,t),H(e)?e===d||e==null||e===""?(this._$AH!==d&&this._$AR(),this._$AH=d):e!==this._$AH&&e!==z&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Je(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!==d&&H(this._$AH)?this._$AA.nextSibling.data=e:this.T(D.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,r=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=B.createElement(Fe(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{let o=new X(r,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=ze.get(e.strings);return t===void 0&&ze.set(e.strings,t=new B(e)),t}k(e){re(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,r=0;for(let o of e)r===t.length?t.push(n=new i(this.O(x()),this.O(x()),this,this.options)):n=t[r],n._$AI(o),r++;r<t.length&&(this._$AR(n&&n._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=ke(e).nextSibling;ke(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},T=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,o){this.type=1,this._$AH=d,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=o,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):thiLine truncated
<input type="checkbox" .checked=${e} @change=${o=>r(nt(o))} />
<span>${i.t(t)}${n?l`<small>${i.t(n)}</small>`:d}</span>
</label>`}var c=(i,e,t,n)=>f(i,i.value[e],t,n,r=>i.set(e,r)),se=(i,e,t,n)=>f(i,i.value[e],t,n,r=>i.set(e,r||void 0));function w(i,e,t,n,r){return l`<label class="field"
@@ -115,7 +115,7 @@ var p={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",f
grid-template-columns: 1fr;
}
}
`;var ce=globalThis,de=ce.__nextfloorBuiltin?.de??{},_e=ce.__nextfloorBuiltin?.en??{};ce.__nextfloorBuiltin??={de,en:_e};var $e=()=>typeof p=="object"&&p||{},rt=globalThis,Z=rt.__nextfloorTexts??=new Map;function Le(i){let e=i.toLowerCase().split("-")[0];return e!=="de"&&e!=="en"&&e in $e()?e:void 0}function it(i){let e=Le(i),t=e===void 0?void 0:Z.get(e);return t instanceof Promise?void 0:t}function Me(i,e){let t=Le(i?.language??navigator.language);if(t===void 0)return!1;let n=Z.get(t);return n===void 0&&(n=fetch(new URL(`./lang/${t}.json?v=${$e()[t]}`,import.meta.url)).then(r=>r.ok?r.json():{}).catch(()=>({})).then(r=>{Z.set(t,r&&typeof r=="object"?r:{})}),Z.set(t,n)),n instanceof Promise?(n.then(()=>e.requestUpdate()),!0):!1}function Ne(i,e,t={}){let n=i?.language??navigator.language,r=n.startsWith("de"),o=(r?void 0:it(n)?.[e])??(r?de:_e)[e]??_e[e]??de[e]??e;for(let[a,s]of Object.entries(t))o=o.replace(`{${a}}`,String(s));return o}var ue=class extends y{static properties={hass:{attribute:!1},_config:{state:!0},_floors:{state:!0},_rooms:{state:!0},_templates:{state:!0}};loading=!1;form;constructor(){super(),this._config={type:"custom:nextfloor-card"},this._floors=[],this._rooms=[],this._templates=[];let e=this;this.form={get value(){return{...ae,...e._config}},t:(t,n)=>Ne(e.hass,t,n),set:(t,n)=>e.write(t,n)}}setConfig(e){this._config=e}willUpdate(){this.hass&&!this.loading&&this._floors.length===0&&(this.loading=!0,He(this.hass).then(e=>{this._floors=e.building.floors.map(t=>({id:t.id,name:t.name})),this._templates=Object.keys(e.building.settings.card_templates??{}),this._rooms=e.building.floors.flatMap(t=>t.rooms.map(n=>({id:n.id,name:n.name,floor:t.name})))},()=>{}))}write(e,t){let n={...this._config};t===void 0||t===""||ae[e]===t?delete n[e]:n[e]=t,this.publish(n)}publish(e){this._config=e,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:e},bubbles:!0,composed:!0}))}roomsChoice(){if(this._rooms.length===0)return l``;let e=new Set(this._config.rooms??[]),t=(n,r)=>{let o=this._rooms.map(a=>a.id).filter(a=>a===n?r:e.has(a));this.form.set("rooms",o.length?o:void 0)};return l`<fieldset class="rooms">
`;var ce=globalThis,de=ce.__nextfloorBuiltin?.de??{},_e=ce.__nextfloorBuiltin?.en??{};ce.__nextfloorBuiltin??={de,en:_e};var $e=()=>typeof p=="object"&&p||{},rt=globalThis,Z=rt.__nextfloorTexts??=new Map;function Le(i){let e=i.toLowerCase().split("-")[0];return e!=="de"&&e!=="en"&&e in $e()?e:void 0}function it(i){let e=Le(i),t=e===void 0?void 0:Z.get(e);return t instanceof Promise?void 0:t}function Me(i,e){let t=Le(i?.language??navigator.language);if(t===void 0)return!1;let n=Z.get(t);return n===void 0&&(n=fetch(new URL(`./lang/${t}.json?v=${$e()[t]}`,import.meta.url)).then(r=>r.ok?r.json():{}).catch(()=>({})).then(r=>{Z.set(t,r&&typeof r=="object"?r:{})}),Z.set(t,n)),n instanceof Promise?(n.then(()=>e.requestUpdate()),!0):!1}function Ne(i,e,t={}){let n=i?.language??navigator.language,r=n.startsWith("de"),o=(r?void 0:it(n)?.[e])??(r?de:_e)[e]??_e[e]??de[e]??e;for(let[a,s]of Object.entries(t))o=o.replace(`{${a}}`,String(s));return o}var ue=class extends y{static properties={hass:{attribute:!1},_config:{state:!0},_floors:{state:!0},_rooms:{state:!0},_templates:{state:!0}};loading=!1;form;constructor(){super(),this._config={type:"custom:nextfloor-card"},this._floors=[],this._rooms=[],this._templates=[];let e=this;this.form={get value(){return{...ae,...e._config}},t:(t,n)=>Ne(e.hass,t,n),set:(t,n)=>e.write(t,n)}}setConfig(e){this._config=e}willUpdate(){this.hass&&!this.loading&&this._floors.length===0&&(this.loading=!0,xe(this.hass).then(e=>{this._floors=e.building.floors.map(t=>({id:t.id,name:t.name})),this._templates=Object.keys(e.building.settings.card_templates??{}),this._rooms=e.building.floors.flatMap(t=>t.rooms.map(n=>({id:n.id,name:n.name,floor:t.name})))},()=>{}))}write(e,t){let n={...this._config};t===void 0||t===""||ae[e]===t?delete n[e]:n[e]=t,this.publish(n)}publish(e){this._config=e,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:e},bubbles:!0,composed:!0}))}roomsChoice(){if(this._rooms.length===0)return l``;let e=new Set(this._config.rooms??[]),t=(n,r)=>{let o=this._rooms.map(a=>a.id).filter(a=>a===n?r:e.has(a));this.form.set("rooms",o.length?o:void 0)};return l`<fieldset class="rooms">
<legend>${this.form.t("card_rooms")}</legend>
<small>${this.form.t("card_rooms_hint")}</small>
${this._rooms.map(n=>l`<label class="toggle"><input type="checkbox" .checked=${e.has(n.id)} @change=${r=>t(n.id,r.target.checked)} /><span>${this._floors.length>1?`${n.floor} \xB7 `:""}${n.name}</span></label>`)}
@@ -190,7 +190,7 @@ var p={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",f
</div>`:d}
<p class="hint">${e.t("card_pro_hint")}</p>`}furnitureColors(e){let t=this._config.furniture_colors??{},n=(r,o)=>{let a={...t,[r]:o};o||delete a[r],e.set("furniture_colors",Object.keys(a).length?a:void 0)};return l`<details class="field">
<summary>${e.t("furn_colors_card")}${Object.keys(t).length?` (${Object.keys(t).length})`:""}</summary>
${We.map(r=>l`<label class="field"
${He.map(r=>l`<label class="field"
>${e.t(`furn_color_${r}`)}
<input type="color" .value=${t[r]??Be[r]} @input=${o=>n(r,o.target.value)} />
${t[r]?l`<button type="button" class="link" @click=${()=>n(r,null)}>${e.t("furn_color_house")}</button>`:d}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+2
View File
@@ -544,6 +544,7 @@ class NextFloor extends IPSModuleStrict
'°c', '°f', '℃', '℉', 'k' => 'temperature',
'ppm' => str_contains($text, 'co2') || str_contains($text, 'co₂') ? 'carbon_dioxide' : '',
'w', 'kw' => 'power',
'lx', 'lux' => 'illuminance',
default => ''
};
if ($unitClass !== '') {
@@ -553,6 +554,7 @@ class NextFloor extends IPSModuleStrict
str_contains($text, 'temperature') || str_contains($text, 'temperatur') => 'temperature',
str_contains($text, 'humidity') || str_contains($text, 'feucht') => 'humidity',
str_contains($text, 'co2') => 'carbon_dioxide',
str_contains($text, 'illuminance') || str_contains($text, 'beleuchtungsst') => 'illuminance',
str_contains($text, 'watt') || str_contains($text, 'power') || str_contains($text, 'leistung') => 'power',
preg_match('/kontakt|fenster|tür|tuer|motion|bewegung|presence|anwesen/', $text) === 1 => 'opening',
default => ''
+27 -1
View File
@@ -16,7 +16,7 @@ In **Kerninstanzen → Modules** wird dieses Repository verwendet:
Im Zahnrad des Eintrags den Branch **`symcon`** wählen und auf Aktualisierungen prüfen.
`main` enthält die Quellen für die Entwicklung, `symcon` die installierbare Bibliothek.
Nach der Aktualisierung auf **0.2.6 / Build 9** die Konsole neu laden. Unter
Nach der Aktualisierung auf **0.2.7 / Build 10** die Konsole neu laden. Unter
**Instanz hinzufügen → Hersteller NextFloor** erscheint **„NextFloor Designer und 3D-Kachel“**.
### Für die Entwicklung
@@ -46,6 +46,32 @@ Die Dateien unter `NextFloor/assets/` und `NextFloor/packs/` werden durch
Der Build prüft anschließend die Modulmetadaten und die installierbare Verzeichnisstruktur.
Dieselbe Prüfung lässt sich separat mit `node symcon/tests/validate-package.mjs` ausführen.
## Änderungen in 0.2.7
- Im Raumklima ist **Helligkeit** als weiterer Datenpunkt wählbar. Die Raumkarte zeigt ihn
mit einem Sonnensymbol in Lux; CO₂ verwendet ein Wolkensymbol.
- Unter **Zusätzliche Werte** fügt **+** beliebig weitere Datenpunkte an Geräte und
verknüpfte Möbel an. Jeder Wert hat eine eigene Auswahl aus dem Objektbaum, ein frei
eingebbares Symbol (Emoji/Zeichen) und eine optionale Bezeichnung. Mehrere Temperaturen
oder andere Werte erscheinen gemeinsam am Gerät und im Raumfenster; einzelne Werte
lassen sich wieder entfernen.
- Erklärende Hilfetexte im Designer sind hinter **ⓘ** zusammengefasst. Ein Klick öffnet
die jeweilige Erklärung als Popup, das per Schließen-Knopf oder Escape geschlossen wird.
- Der **Positions-Sensor (live)** einer Jalousie lässt sich unabhängig vom automatisch
vermuteten Gerätetyp aus dem Objektbaum auswählen. Integer und Float werden unterstützt;
Rückmeldungen in 0–100, 0–255 oder 0–1 werden anhand des Symcon-Wertebereichs eingelesen.
- **Wirksinn Behang umkehren** und **Wirksinn Lamellen umkehren** sind getrennt einstellbar,
auch bei einzeln platzierten Jalousien und beim zweiten Behang eines Fensters. Die Umkehrung
gilt für die Anzeige, 3D-Darstellung, Regler, Auf/Zu, Schnellmenü, Wischbedienung und
Gruppenbefehle. Der Positionssensor wird dabei ausschließlich gelesen.
- Die bisherige Option **Sensor zählt umgekehrt** korrigiert weiterhin nur eine abweichende
Richtung der Rückmeldung. Die neuen Wirksinn-Schalter drehen Anzeige und Bedienung zusammen.
- Die Raumklimakarten zeigen nur Symbole und Werte, ohne erneut den Raumnamen oder die
Messwert-Beschriftungen anzuzeigen. Nicht verknüpfte Messwerte erhalten keine Zeile;
eine vollständig unbestückte Karte wird nicht angezeigt. Verknüpfte, vorübergehend nicht
verfügbare Werte bleiben als „–“ erkennbar.
## Änderungen in 0.2.6
- Pro Raum lässt sich unter **Raumklima → Raumklima als schwebende Karte** eine Glaskarte
+3 -3
View File
@@ -6,7 +6,7 @@
"compatibility": {
"version": "9.0"
},
"version": "0.2.6",
"build": 9,
"date": 1794211200
"version": "0.2.7",
"build": 10,
"date": 1794297600
}
+1
View File
@@ -55,6 +55,7 @@ check($humidity['attributes']['device_class'] === 'humidity', 'Feuchtigkeit is r
check($humidity['attributes']['symcon_numeric_value'] === 51.6 && $humidity['attributes']['unit_of_measurement'] === '%', 'Float humidity values keep their raw value and effective percent unit');
$co2 = $describe->invoke($module, 11, 'CO₂', 'Haus / Temperaturen / CO₂', 10);
check($co2['attributes']['device_class'] === 'carbon_dioxide', 'CO2 with a subscript 2 is recognized for integer ppm variables');
check((new ReflectionMethod($module, 'deviceClassFor'))->invoke($module, '', 'Raumhelligkeit', 'lx') === 'illuminance', 'Lux units identify room brightness');
$dimmer = $describe->invoke($module, 6, 'Dimmer', 'Haus / Dimmer', 10);
check($dimmer['attributes']['brightness'] === 128, 'An integer dimmer uses its real 0-255 range');
$floatDimmer = $describe->invoke($module, 7, 'Wert', 'Haus / Wert', 10);