fix: restrict blind direction reversal to 3D appearance
This commit is contained in:
1 parent
b9a095bc6e
commit
7a9b2c0a38
19 files changed
+721
-629
No files matched your search
+1
-1
@@ -28,7 +28,7 @@ All notable changes to NextFloor, newest first. Every release lists what is **Ad
|
|||||||
|
|
||||||
- **Symcon picker width and unlinking:** Long selected object names and paths are truncated within the form, with the full path in a tooltip. A dedicated clear button removes the binding directly and preserves other room-climate sensors.
|
- **Symcon picker width and unlinking:** Long selected object names and paths are truncated within the form, with the full path in a tooltip. A dedicated clear button removes the binding directly and preserves other room-climate sensors.
|
||||||
|
|
||||||
- **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 blind feedback and visual 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 in 3D only. Displayed readings, sliders, buttons, swipes and grouped commands keep their original values, including zero; feedback variables are never written.
|
||||||
|
|
||||||
- **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 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.
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
|
/*! 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
|
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]`,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=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
|
\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
|
||||||
<input type="checkbox" .checked=${e} @change=${o=>r(nt(o))} />
|
<input type="checkbox" .checked=${e} @change=${o=>r(nt(o))} />
|
||||||
<span>${i.t(t)}${n?l`<small>${i.t(n)}</small>`:d}</span>
|
<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"
|
</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;
|
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,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">
|
`;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">
|
||||||
<legend>${this.form.t("card_rooms")}</legend>
|
<legend>${this.form.t("card_rooms")}</legend>
|
||||||
<small>${this.form.t("card_rooms_hint")}</small>
|
<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>`)}
|
${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}
|
</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">
|
<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>
|
<summary>${e.t("furn_colors_card")}${Object.keys(t).length?` (${Object.keys(t).length})`:""}</summary>
|
||||||
${He.map(r=>l`<label class="field"
|
${We.map(r=>l`<label class="field"
|
||||||
>${e.t(`furn_color_${r}`)}
|
>${e.t(`furn_color_${r}`)}
|
||||||
<input type="color" .value=${t[r]??Be[r]} @input=${o=>n(r,o.target.value)} />
|
<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}
|
${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
@@ -1,13 +1,13 @@
|
|||||||
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
|
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
|
||||||
var $={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",fr:"6312d0f61ebf",hu:"27ba348531dc",it:"1b705e76dd00",nb:"c5ea24fb9ef6",nl:"b64142c67c2e",pl:"8527a4930402",pt:"31857a2d2277",ro:"e3cb5f449f0f",sk:"320611594db0",sl:"8071691ceda3",sv:"711b911ec8da",tr:"7c83ce1c3372",zh:"50518d9f494e"};Array.prototype.at||Object.defineProperty(Array.prototype,"at",{configurable:!0,writable:!0,value:function(e){let t=Math.trunc(e)||0;return this[t<0?this.length+t:t]}});typeof globalThis.structuredClone!="function"&&(globalThis.structuredClone=r=>r===void 0?r:JSON.parse(JSON.stringify(r)));var $n=globalThis,Mn=$n.ShadowRoot&&($n.ShadyCSS===void 0||$n.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Wr=Symbol(),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
|
var $={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",fr:"6312d0f61ebf",hu:"27ba348531dc",it:"1b705e76dd00",nb:"c5ea24fb9ef6",nl:"b64142c67c2e",pl:"8527a4930402",pt:"31857a2d2277",ro:"e3cb5f449f0f",sk:"320611594db0",sl:"8071691ceda3",sv:"711b911ec8da",tr:"7c83ce1c3372",zh:"50518d9f494e"};Array.prototype.at||Object.defineProperty(Array.prototype,"at",{configurable:!0,writable:!0,value:function(e){let t=Math.trunc(e)||0;return this[t<0?this.length+t:t]}});typeof globalThis.structuredClone!="function"&&(globalThis.structuredClone=r=>r===void 0?r:JSON.parse(JSON.stringify(r)));var $n=globalThis,Mn=$n.ShadowRoot&&($n.ShadyCSS===void 0||$n.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Wr=Symbol(),xi=new WeakMap,Nt=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Wr)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Mn&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=xi.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&xi.set(t,e))}return e}toString(){return this.cssText}},ki=r=>new Nt(typeof r=="string"?r:r+"",void 0,Wr),ne=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((n,o,i)=>n+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+r[i+1],r[0]);return new Nt(t,r,Wr)},Si=(r,e)=>{if(Mn)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),o=$n.litNonce;o!==void 0&&n.setAttribute("nonce",o),n.textContent=t.cssText,r.appendChild(n)}},Or=Mn?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return ki(t)})(r):r;var{is:iu,defineProperty:su,getOwnPropertyDescriptor:au,getOwnPropertyNames:lu,getOwnPropertySymbols:cu,getPrototypeOf:uu}=Object,An=globalThis,$i=An.trustedTypes,du=$i?$i.emptyScript:"",hu=An.reactiveElementPolyfillSupport,Wt=(r,e)=>r,Lr={toAttribute(r,e){switch(e){case Boolean:r=r?du:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},Ai=(r,e)=>!iu(r,e),Mi={attribute:!0,type:String,converter:Lr,reflect:!1,useDefault:!1,hasChanged:Ai};Symbol.metadata??=Symbol("metadata"),An.litPropertyMetadata??=new WeakMap;var Ae=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Mi){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),o=this.getPropertyDescriptor(e,n,t);o!==void 0&&su(this.prototype,e,o)}}static getPropertyDescriptor(e,t,n){let{get:o,set:i}=au(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:o,set(s){let a=o?.call(this);i?.call(this,s),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Mi}static _$Ei(){if(this.hasOwnProperty(Wt("elementProperties")))return;let e=uu(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Wt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Wt("properties"))){let t=this.properties,n=[...lu(t),...cu(t)];for(let o of n)this.createProperty(o,t[o])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,o]of t)this.elementProperties.set(n,o)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let o=this._$Eu(t,n);o!==void 0&&this._$Eh.set(o,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let o of n)t.unshift(Or(o))}else e!==void 0&&t.push(Or(e));return t}static _$Eu(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shaLine truncated
|
||||||
\f\r]`,Ot=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ti=/-->/g,Fi=/>/g,Je=RegExp(`>|${Br}(?:([^\\s"'>=/]+)(${Br}*=${Br}*(?:[^
|
\f\r]`,Ot=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,zi=/-->/g,Ti=/>/g,Je=RegExp(`>|${Br}(?:([^\\s"'>=/]+)(${Br}*=${Br}*(?:[^
|
||||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),Di=/'/g,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
|
\f\r"'\`<>=]|("|')|))|$)`,"g"),Di=/'/g,Fi=/"/g,Ci=/^(?:script|style|textarea|title)$/i,Yr=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),m=Yr(1),Q=Yr(2),Gm=Yr(3),et=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),Pi=new WeakMap,Qe=Xe.createTreeWalker(Xe,129);function Ni(r,e){if(!Zr(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ri!==void 0?Ri.createHTML(e):e}var fu=(r,e)=>{let t=r.length-1,n=[],o,i=e===2?"<svg>":e===3?"<math>":"",s=Ot;for(let a=0;a<t;a++){let l=r[a],c,u,h=-1,p=0;for(;p<l.length&&(s.lastIndex=p,u=s.exec(l),u!==null);)p=s.lastIndex,s===Ot?u[1]==="!--"?s=zi:u[1]!==void 0?s=Ti:u[2]!==void 0?(Ci.test(u[2])&&(o=RegExp("</"+u[2],"g")),s=Je):u[3]!==void 0&&(s=Je):s===Je?u[0]===">"?(s=o??Ot,h=-1):u[1]===void 0?h=-2:(h=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?Je:u[3]==='"'?Fi:Di):s===Fi||s===Di?s=Je:s===zi||s===Ti?s=Ot:(s=Je,o=void 0);let d=s===Je&&r[a+1].startsWith("/>")?" ":"";i+=s===Ot?l+pu:h>=0?(n.push(c),l.slice(0,h)+Hi+l.slice(h)+Le+d):l+Le+(h===-2?a:d)}return[Ni(r,i+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},Vt=class r{constructor({strings:e,_$litType$:t},n){let o;this.parts=[];let i=0,s=0,a=e.length-1,l=this.parts,[c,u]=fu(e,t);if(this.el=r.createElement(c,n),Qe.currentNode=this.el.content,t===2||t===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(o=Qe.nextNode())!==null&&l.length<a;){if(o.nodeType===1){if(o.hasAttributes())for(let h of o.getAttributeNames())if(h.endsWith(Hi)){let p=u[s++],d=o.getAttribute(h).split(Le),_=/([.?@])?(.*)/.exec(p);l.push({type:1,index:i,name:_[2],strings:d,ctor:_[1]==="."?Kr:_[1]==="?"?Gr:_[1]==="@"?Ur:mt}),o.removeAttribute(h)}else h.startsWith(Le)&&(l.push({type:6,index:i}),o.removeAttribute(h));if(Ci.test(o.tagName)){let h=o.textContent.split(Le),p=h.length-1;if(p>0){o.textContent=En?En.emptyScript:"";for(let d=0;d<p;d++)o.append(h[d],Lt()),Qe.nextNode(),l.push({type:2,index:++i});o.append(h[p],Lt())}}}else if(o.nodeType===8)if(o.data===Ii)l.push({type:2,index:i});else{let h=-1;for(;(h=o.data.indexOf(Le,h+1))!==-1;)l.push({type:7,index:i}),h+=Le.length-1}i++}}static createElement(e,t){let n=Xe.createElement("template");return n.innerHTML=e,n}};function pt(r,e,t=r,n){if(e===et)return e;let o=n!==void 0?t._$Co?.[n]:t._$Cl,i=Bt(e)?void 0:e._$litDirective$;return o?.constructor!==i&&(o?._$AO?.(!1),i===void 0?o=void 0:(o=new i(r),o._$AT(r,t,n)),n!==void 0?(t._$Co??=[])[n]=o:t._$Cl=o),o!==void 0&&(e=pt(r,o._$AS(r,e.values),o,n)),e}var Vr=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,o=(e?.creationScope??Xe).importNode(t,!0);Qe.currentNode=o;let i=Qe.nextNode(),s=0,a=0,l=n[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new Kt(i,i.nextSibling,this,e):l.type===1?c=new l.ctor(i,l.name,l.strings,this,e):l.type===6&&(c=new jr(i,this,e)),this._$AV.push(c),l=n[++a]}s!==l?.index&&(i=Qe.nextNode(),s++)}return Qe.currentNode=Xe,o}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},Kt=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,o){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=pt(this,e,t),Bt(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==et&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):mu(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==f&&Bt(this._$AH)?this._$AA.nextSibling.data=e:this.T(Xe.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,o=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=Vt.createElement(Ni(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===o)this._$AH.p(t);else{let i=new Vr(o,this),s=i.u(this.options);i.p(t),this.T(s),this._$AH=i}}_$AC(e){let t=Pi.get(e.strings);return t===void 0&&Pi.set(e.strings,t=new Vt(e)),t}k(e){Zr(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,o=0;for(let i of e)o===t.length?t.push(n=new r(this.O(Lt()),this.O(Lt()),this,this.options)):n=t[o],n._$AI(i),o++;o<t.length&&(this._$AR(n&&n._$AB.nextSibling,o),t.length=o)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=Ei(e).nextSibling;Ei(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},mt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,o,i){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=o,this.options=i,n.length>2||n[0]!==""||n[1]!==""?(this._Line truncated
|
||||||
|
|
||||||
Ein Plugin l\xE4uft mit denselben Rechten wie NextFloor in deinem Browser. Die Datei wurde gepr\xFCft, ihr Inhalt ist festgelegt:
|
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:
|
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 {
|
:host {
|
||||||
--nf-text: var(--primary-text-color, #e1e1e1);
|
--nf-text: var(--primary-text-color, #e1e1e1);
|
||||||
--nf-muted: var(--secondary-text-color, #9b9b9b);
|
--nf-muted: var(--secondary-text-color, #9b9b9b);
|
||||||
@@ -211,7 +211,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
}
|
}
|
||||||
`;function _r(r){return r?.themes?.darkMode===!1?"light":"dark"}var Oh=4,Lh=8,Bh=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[255,95,210],[120,255,150]],zt=r=>m`<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
`;function _r(r){return r?.themes?.darkMode===!1?"light":"dark"}var Oh=4,Lh=8,Bh=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[255,95,210],[120,255,150]],zt=r=>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)} />
|
<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">
|
</svg>`,br={previous:"M6 6h2v12H6zM20 6v12l-10-6z",play:"M8 5v14l11-7z",pause:"M7 5h4v14H7zM13 5h4v14h-4z",next:"M16 6h2v12h-2zM4 6v12l10-6z"},Co=r=>m`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d=${r} /></svg>`,Vh=24,Kh=10,No=class extends re{static properties={hass:{attribute:!1},room:{attribute:!1},floor:{attribute:!1},confirmEntities:{attribute:!1},phrases:{attribute:!1},outside:{attribute:!1},_showAll:{state:!0},_said:{state:!0},_folded:{state:!0},_curve:{state:!0},_moodName:{state:!0},_undo:{state:!0},_energy:{state:!0},_sunYear:{state:!0},rooms:{attribute:!1},building:{attribute:!1}};saidTimer;memo=null;curveFor="";undoTimer;constructor(){super(),this.room=null,this.floor=null,this.phrases=null,this.outside=null,this._said=null,this._showAll=!1,this._folded=!1,this._curve=null,this._moodName=null,this._undo=null,this._energy=null,this._sunYear=!1,this.rooms=null,this.building=null}fireMoods(e,t){this.dispatchEvent(new CustomEvent("mood-change",{detail:{roomId:e.id,moods:t},bubbles:!0,composed:!0}))}runMood(e){for(let t of fr(e))this.call("light",t.service,t.data)}renderMoods(e,t){let n=e.moods??[],o=!!this.rooms&&!!this.hass.user?.is_admin;if(!n.length&&!o)return f;let i=(this.rooms??[]).filter(l=>l.id!==e.id&&l.area_id),s=l=>K(this.hass,l).filter(c=>c.startsWith("light.")),a=()=>{let l=(this._moodName??"").trim()||this.t("mood_new");this.fireMoods(e,[...n,{id:`mood_${Date.now().toString(36)}`,name:l,lights:t.map(mr)}]),this._moodName=null};return m`<div class="nf-rp-moods">
|
||||||
${n.map(l=>m`<span class="nf-rp-mood">
|
${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>
|
<button class="nf-btn" title=${this.t("mood_set")} @click=${()=>this.runMood(l.lights)}>✨ ${l.name}</button>
|
||||||
${i.length?m`<select class="nf-rp-mood-to" aria-label=${this.t("mood_carry")} title=${this.t("mood_carry")} @change=${c=>{let u=c.target,h=i.find(p=>p.id===u.value);u.value="",h&&this.runMood(il(l,s(h)))}}>
|
${i.length?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)))}}>
|
||||||
@@ -224,7 +224,7 @@ 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()} />
|
><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
|
<button class="nf-btn" @click=${a}>${this.t("mood_save")}</button></span
|
||||||
>`:f}
|
>`:f}
|
||||||
</div>`}async loadCurve(e){let t=Ve(this.hass,this.floor,e,"temperature"),n=t.length?t:K(this.hass,e).filter(s=>s.startsWith("climate."));if(!n.length)return;let o=Date.now(),i=o-24*36e5;try{let s=await ln(this.hass,n,i,o,!!t.length);if(this.room?.id!==e.id)return;let a=[];for(let l=1;l<=96;l++){let c=Rt(this.hass,s,i+(o-i)*l/96),u=n.map(h=>h.startsWith("climate.")?Number(c.states[h]?.attributes.current_temperature):Number(c.states[h]?.state)).filter(Number.isFinite);a.push(u.length?u.reduce((h,p)=>h+p,0)/u.length:null)}this._curve=a.some(l=>l!==null)?a:null}catch{this._curve=null}}async loadEnergy(e){if(!this.floor||!this.building)return;let t=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">
|
</div>`}async loadCurve(e){let t=Ve(this.hass,this.floor,e,"temperature"),n=t.length?t:K(this.hass,e).filter(s=>s.startsWith("climate."));if(!n.length)return;let o=Date.now(),i=o-24*36e5;try{let s=await ln(this.hass,n,i,o,!!t.length);if(this.room?.id!==e.id)return;let a=[];for(let l=1;l<=96;l++){let c=Rt(this.hass,s,i+(o-i)*l/96),u=n.map(h=>h.startsWith("climate.")?Number(c.states[h]?.attributes.current_temperature):Number(c.states[h]?.state)).filter(Number.isFinite);a.push(u.length?u.reduce((h,p)=>h+p,0)/u.length:null)}this._curve=a.some(l=>l!==null)?a:null}catch{this._curve=null}}async loadEnergy(e){if(!this.floor||!this.building)return;let t=Ho(this.hass,this.building,this.floor,e);try{let n=await Ya(this.hass,t);this.room?.id===e.id&&(this._energy=n)}catch{this._energy=null}}renderEmptyLights(e,t){if(!t.length||!this.room)return f;let n=K(this.hass,e).map(s=>this.hass.states[s]).filter(s=>!!s&&s.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(s.attributes.device_class)));if(!n.length||n.some(s=>s.state!=="off"))return f;let o=Math.max(...n.map(s=>Date.parse(String(s.last_changed??""))||0)),i=Math.floor((Date.now()-o)/6e4);return!o||i<Kh?f:m`<div class="nf-rp-shade">
|
||||||
<span>💡 ${this.t("empty_lights_hint",{n:t.length,min:i})}</span>
|
<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>
|
<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_off",{entity_id:t.map(s=>s.entity_id)})}>${this.t("empty_lights_off")}</button>
|
||||||
</div>`}renderOpenWhileHeating(e){let t=this.room;if(!t||!this.floor)return f;let n=e.filter(a=>a.attributes.hvac_action==="heating"||a.state==="heat"&&a.attributes.hvac_action===void 0);if(!n.length)return f;let o=a=>!!a&&a!=="none"&&this.hass.states[a]?.state==="on",i=this.floor.openings.filter(a=>a.room_id===t.id&&[a.contact,a.contact2,a.tilt,a.tilt2].some(o));if(!i.length)return f;let s=()=>{for(let a of n)(a.attributes.hvac_modes??[]).includes("off")?this.call("climate","set_hvac_mode",{entity_id:a.entity_id,hvac_mode:"off"}):typeof a.attributes.min_temp=="number"&&this.call("climate","set_temperature",{entity_id:a.entity_id,temperature:a.attributes.min_temp})};return m`<div class="nf-rp-shade nf-rp-open-heat">
|
</div>`}renderOpenWhileHeating(e){let t=this.room;if(!t||!this.floor)return f;let n=e.filter(a=>a.attributes.hvac_action==="heating"||a.state==="heat"&&a.attributes.hvac_action===void 0);if(!n.length)return f;let o=a=>!!a&&a!=="none"&&this.hass.states[a]?.state==="on",i=this.floor.openings.filter(a=>a.room_id===t.id&&[a.contact,a.contact2,a.tilt,a.tilt2].some(o));if(!i.length)return f;let s=()=>{for(let a of n)(a.attributes.hvac_modes??[]).includes("off")?this.call("climate","set_hvac_mode",{entity_id:a.entity_id,hvac_mode:"off"}):typeof a.attributes.min_temp=="number"&&this.call("climate","set_temperature",{entity_id:a.entity_id,temperature:a.attributes.min_temp})};return m`<div class="nf-rp-shade nf-rp-open-heat">
|
||||||
@@ -241,7 +241,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
</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")}>
|
</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}`:""}
|
⚡ ${this.t("room_energy",{today:s(e.today),month:s(e.month)})}${i?` \xB7 ${W(this.hass,i.value,2)} ${i.currency}`:""}
|
||||||
</p>`}renderCurve(){let e=this._curve;if(!e)return f;let t=e.filter(c=>c!==null),n=Math.min(...t),o=Math.max(...t),i=Math.max(1,o-n),s=e.map(c=>c===null?null:c-n+i*.1),a=cn(s,220,36,i*1.2),l=c=>`${W(this.hass,oe(this.hass,c),1)}\xB0`;return m`<div class="nf-rp-curve" title=${this.t("room_curve_hint")}>
|
</p>`}renderCurve(){let e=this._curve;if(!e)return f;let t=e.filter(c=>c!==null),n=Math.min(...t),o=Math.max(...t),i=Math.max(1,o-n),s=e.map(c=>c===null?null:c-n+i*.1),a=cn(s,220,36,i*1.2),l=c=>`${W(this.hass,oe(this.hass,c),1)}\xB0`;return 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>
|
<svg viewBox="0 0 220 36" preserveAspectRatio="none" aria-hidden="true">${Q`<path d=${a}></path>`}</svg>
|
||||||
<span>24 h · ${l(n)} – ${l(o)}</span>
|
<span>24 h · ${l(n)} – ${l(o)}</span>
|
||||||
</div>`}willUpdate(e){let t=e.get("room");e.has("room")&&t?.id!==this.room?.id&&(this._folded=!1,this._undo=null),this.room&&this.hass&&this.curveFor!==this.room.id&&(this.curveFor=this.room.id,this._curve=null,this._energy=null,this.loadCurve(this.room),this.loadEnergy(this.room))}updated(e){e.has("_folded")&&this.toggleAttribute("folded",this._folded)}t(e,t){return A(this.hass,e,t)}call(e,t,n){this.hass.callService(e,t,n)}renderClean(e){let t=e.clean_entity,n=t?this.hass.states[t]:void 0;if(!t||!n)return f;let o=t.slice(0,t.indexOf(".")),i=()=>o==="script"?this.call("script","turn_on",{entity_id:t}):this.call(o,"press",{entity_id:t});return m`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" ?disabled=${I(n)} title=${this.t("room_clean_run_hint")} @click=${i}>🧹 ${this.t("room_clean_run")}</button></div>`}allOff(e){let t=an(e);for(let n of t.off)this.call(n.domain,n.service,n.data);this._undo=t.undo,clearTimeout(this.undoTimer),this.undoTimer=setTimeout(()=>this._undo=null,1e4)}undoAllOff(){for(let e of this._undo??[])this.call(e.domain,e.service,e.data);this._undo=null,clearTimeout(this.undoTimer)}renderAllOff(e){if(this._undo)return m`<div class="nf-rp-alloff"><span>${this.t("all_off_done")}</span><button class="nf-btn nf-rp-small" @click=${()=>this.undoAllOff()}>↶ ${this.t("all_off_undo")}</button></div>`;let{count:t}=an(e);return t<2?f:m`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" title=${this.t("all_off_hint")} @click=${()=>this.allOff(e)}>⏻ ${this.t("all_off_n",{n:t})}</button></div>`}get areaName(){return this.room?.area_id?this.hass.areas?.[this.room.area_id]?.name:void 0}placedAs(e){for(let t of this.building?.floors??[])for(let n of t.placements)if(n.entity_id===e)return n}name(e){return this.placedAs(e)?.name?.trim()||O(this.hass,e,this.areaName)}nameButton(e){return m`<button class="nf-rp-name" title=${this.t("details")} @click=${()=>fe(this,e)}>${this.name(e)}</button>`}askFor(e){return!this.confirmEntities?.has(e)||confirm(this.t("confirm_switch",{name:this.name(e)}))}toggle(e,t,n){let o=()=>{this.confirmEntities?.has(e.entity_id)&&!confirm(this.t("confirm_switch",{name:this.name(e.entity_id)}))||n()};return m`<button
|
</div>`}willUpdate(e){let t=e.get("room");e.has("room")&&t?.id!==this.room?.id&&(this._folded=!1,this._undo=null),this.room&&this.hass&&this.curveFor!==this.room.id&&(this.curveFor=this.room.id,this._curve=null,this._energy=null,this.loadCurve(this.room),this.loadEnergy(this.room))}updated(e){e.has("_folded")&&this.toggleAttribute("folded",this._folded)}t(e,t){return 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"
|
class="nf-switch"
|
||||||
@@ -250,7 +250,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
aria-label=${this.name(e.entity_id)}
|
aria-label=${this.name(e.entity_id)}
|
||||||
?disabled=${I(e)}
|
?disabled=${I(e)}
|
||||||
@click=${o}
|
@click=${o}
|
||||||
></button>`}outsideRoom=null;render(){let e=!this.room&&this.outside?this.outside:null;e&&!this.outsideRoom&&(this.outsideRoom={id:"nf-outside",name:this.t("outside_area"),area_id:null,points:[],floor_material:"grass"});let t=this.room??(e?this.outsideRoom:null);if(!t||!this.hass)return f;let n=e??K(this.hass,t),o=this.memo,{shown:i,more:s}=e?{shown:e,more:[]}:o&&o.entities===this.hass.entities&&o.floor===this.floor&&o.room===t?o:this.memo={entities:this.hass.entities,floor:this.floor,room:t,...this.floor?Gs(this.hass,this.floor,t):{shown:n,more:[]}},a=go(this.hass,s).map(y=>y.primary),l=a.length,c=this._showAll?[...i,...a]:i,u=y=>c.filter(z=>y.includes(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}>
|
></button>`}outsideRoom=null;render(){let e=!this.room&&this.outside?this.outside:null;e&&!this.outsideRoom&&(this.outsideRoom={id:"nf-outside",name:this.t("outside_area"),area_id:null,points:[],floor_material:"grass"});let t=this.room??(e?this.outsideRoom:null);if(!t||!this.hass)return f;let n=e??K(this.hass,t),o=this.memo,{shown:i,more:s}=e?{shown:e,more:[]}:o&&o.entities===this.hass.entities&&o.floor===this.floor&&o.room===t?o:this.memo={entities:this.hass.entities,floor:this.floor,room:t,...this.floor?Gs(this.hass,this.floor,t):{shown:n,more:[]}},a=go(this.hass,s).map(y=>y.primary),l=a.length,c=this._showAll?[...i,...a]:i,u=y=>c.filter(z=>y.includes(F(z))).map(z=>this.hass.states[z]),h=u(["light"]),p=u(["cover"]),d=u(["climate"]),_=u(["media"]),b=u(["switch","fan","lock"]),g=u(["sensor","binary"]),v=u(["scene","script"]),S=this.facts(d),k=h.filter(y=>y.state==="on");return m`<section class="nf-rp" aria-label=${t.name}>
|
||||||
<header class="nf-rp-head">
|
<header class="nf-rp-head">
|
||||||
<div>
|
<div>
|
||||||
<h2>${t.name}</h2>
|
<h2>${t.name}</h2>
|
||||||
@@ -259,7 +259,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
${this.renderCurve()}
|
${this.renderCurve()}
|
||||||
</div>
|
</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}>
|
<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}>
|
||||||
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${this._folded?J`<path d="M6 14l6-6 6 6" />`:J`<path d="M6 12h12" />`}</svg>
|
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${this._folded?Q`<path d="M6 14l6-6 6 6" />`:Q`<path d="M6 12h12" />`}</svg>
|
||||||
</button>
|
</button>
|
||||||
<button class="nf-rp-close" aria-label=${this.t("close")} @click=${()=>this.fire("close")}>
|
<button class="nf-rp-close" aria-label=${this.t("close")} @click=${()=>this.fire("close")}>
|
||||||
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18" /></svg>
|
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18" /></svg>
|
||||||
@@ -273,7 +273,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
${v.map(y=>m`<button
|
${v.map(y=>m`<button
|
||||||
class="nf-btn"
|
class="nf-btn"
|
||||||
?disabled=${I(y)}
|
?disabled=${I(y)}
|
||||||
@click=${()=>this.call(D(y.entity_id)==="scene"?"scene":"script","turn_on",{entity_id:y.entity_id})}
|
@click=${()=>this.call(F(y.entity_id)==="scene"?"scene":"script","turn_on",{entity_id:y.entity_id})}
|
||||||
>
|
>
|
||||||
${this.name(y.entity_id)}
|
${this.name(y.entity_id)}
|
||||||
</button>`)}
|
</button>`)}
|
||||||
@@ -299,12 +299,12 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
${this._showAll?this.t("panel_less"):this.t("panel_more",{n:l})}
|
${this._showAll?this.t("panel_less"):this.t("panel_more",{n:l})}
|
||||||
</button>`:f}
|
</button>`:f}
|
||||||
</div>
|
</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>
|
</section>`}extraValues(e){if(!this.floor)return f;let t=[...this.floor.placements.filter(n=>!n.outside&&H([n.x,n.z],e.points)).map(n=>({name:n.name||O(this.hass,n.entity_id),rows:sr(this.hass,n.values)})),...this.floor.furniture.filter(n=>H([n.x,n.z],e.points)).map(n=>({name:n.name||(n.entity&&n.entity!=="none"?O(this.hass,n.entity):this.t("device")),rows:sr(this.hass,n.values)}))].filter(n=>n.rows.length);return t.length?this.section("device_values",t.map(n=>m`<div class="nf-extra-values"><b>${n.name}</b>${n.rows.map(o=>m`<div class="nf-rp-row"><span class="nf-rp-icon">${o.icon}</span><span class="nf-rp-name">${o.label}</span><b class="nf-rp-state">${o.text}</b></div>`)}</div>`)):f}facts(e){let t=[],n=this.room;if(!n)return t;let o=(E,D)=>{let C=U(this.hass,this.floor,n,E);if(C===null)return null;if(E==="temperature")return`${W(this.hass,oe(this.hass,C),1)} ${X(this.hass)}`;let R=Ve(this.hass,this.floor,n,E)[0],M=this.hass.states[R]?.attributes.unit_of_measurement??D;return`${W(this.hass,C,1)} ${M}`},i=e.find(E=>typeof E.attributes.current_temperature=="number"),s=o("temperature","\xB0C");s?t.push(s):i&&n.climate?.temperature!=="none"&&t.push(`${W(this.hass,i.attributes.current_temperature,1)} ${X(this.hass)}`);let a=o("humidity","%");a&&t.push(a);let l=U(this.hass,this.floor??null,n,"illuminance");l!==null&&t.push(`\u2600 ${W(this.hass,l,0)} lx`);let c=this.floor&&this.building?Po(this.hass,this.building,this.floor,n):null;c!==null&&t.push(`\u26A1 ${lt(this.hass,c)}`);let u=this.floor?this.floor.openings.filter(E=>E.room_id===n.id).flatMap(E=>[E.contact,E.contact2,E.tilt,E.tilt2]).map(E=>E&&E!=="none"?this.hass.states[E]:void 0).filter(E=>E?.state==="on").map(E=>Date.parse(String(E.last_changed??""))).filter(Number.isFinite):[];u.length&&t.push(`\u{1FA9F} ${this.t("open_since",{time:Io(Date.now()-Math.min(...u))})}`);let h=K(this.hass,n).map(E=>this.hass.states[E]).filter(E=>!!E&&E.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(E.attributes.device_class)));if(h.length)if(h.some(E=>E.state==="on"))t.push(`\u{1F6B6} ${this.t("presence_now")}`);else{let E=Math.max(...h.map(D=>Date.parse(String(D.last_changed??""))||0));E>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:Io(Date.now()-E)})}`)}let p=this.building?el(this.hass,this.building).filter(E=>E.roomId===n.id&&E.level<Xa):[];p.length&&t.push(`\u{1FAAB} ${this.t("battery_low_n",{n:p.length,names:p.map(E=>`${this.name(E.entity)} ${Math.round(E.level)} %`).join(", ")})}`);let d=(this.building?.settings.circuits??[]).filter(E=>E.rooms.includes(n.id)).map(E=>E.name),_=this.building?.settings.room_facts_off??[];d.length&&!_.includes("circuits")&&t.push(`\u{1F50C} ${d.join(", ")}`);let{latitude:b,longitude:g,time_zone:v}=this.hass.config??{};if(this.floor&&b!==void 0&&g!==void 0&&this.building&&!_.includes("sun")){let E=At(this.building,this.floor,n,{latitude:b,longitude:g,zone:v});E.facing.length&&t.push(`\u2600 ${this.t("room_sun_hours",{h:W(this.hass,E.hours,1),facing:E.facing.join(", ")})}`)}let S=U(this.hass,this.floor,n,"temperature"),k=U(this.hass,this.floor,n,"humidity"),y=dr(U(this.hass,this.floor,n,"co2"),k,Et(S,k));y&&!_.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${y}`)}`);let z=hr(S,k,U(this.hass,this.floor,n,"co2"),at(new Date,this.hass.config?.latitude));return z!==null&&(S!==null||k!==null)&&!_.includes("comfort")&&t.push(`\u{1F60A} ${this.t("comfort_n",{n:z})}`),t}announceSection(e){let t=this.phrases?.length?this.phrases:[1,2,3,4,5].map(i=>this.t(`announce_phrase_${i}`)),n=i=>{let s=i.trim();s&&(clearTimeout(this.saidTimer),this.hass.callService("nextfloor","announce",{message:s,rooms:[e.id],on_screens:!1}).then(()=>this._said={text:this.t("announce_sent",{message:s}),failed:!1},a=>this._said={text:this.t("announce_failed",{error:a?.message??String(a)}),failed:!0}),this.saidTimer=setTimeout(()=>this._said=null,6e3))},o=i=>{i.preventDefault();let s=i.currentTarget.querySelector("input");n(s.value),s.value=""};return this.section("panel_announce",[m`<div class="nf-rp-scenes">${t.map(i=>m`<button class="nf-btn" @click=${()=>n(i)}>${i}</button>`)}</div>
|
||||||
<form class="nf-rp-say" @submit=${o}>
|
<form class="nf-rp-say" @submit=${o}>
|
||||||
<input type="text" maxlength="500" placeholder=${this.t("announce_placeholder")} aria-label=${this.t("announce_placeholder")} />
|
<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>
|
<button class="nf-btn nf-primary" type="submit">${this.t("announce_send")}</button>
|
||||||
</form>
|
</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 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}>
|
${this._said?m`<p class="nf-rp-note ${this._said.failed?"nf-rp-fail":""}" role="status">${this._said.text}</p>`:f}`])}pluginSections(e,t){return ns({hass:this.hass,room:{id:e.id,name:e.name,area_id:e.area_id??null},entities:t}).map(o=>m`<div class="nf-rp-sec nf-rp-plugin" data-plugin=${o.key}>
|
||||||
<div class="nf-rp-sec-head"><h3>${o.title}</h3></div>
|
<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}
|
${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>`)}section(e,t,n=f){return m`<div class="nf-rp-sec">
|
||||||
@@ -392,20 +392,20 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
${this.stateLabel(u)}
|
${this.stateLabel(u)}
|
||||||
</button>`)}
|
</button>`)}
|
||||||
</div>`:f}
|
</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">
|
</div>`}stateOf(e,t=te(this.hass,e)){if(this.room?.no_state?.includes(e.entity_id))return"";let n=F(e.entity_id);return e.state==="unknown"&&n!=="sensor"&&n!=="binary"?"":t}stateLabel(e){let t=`state_${e}`,n=this.t(t);return n===t?e:n}mediaRow(e){let t=e.attributes,n=e.entity_id,o=I(e)||e.state==="off",i=[t.media_title,t.media_artist].filter(s=>typeof s=="string"&&s).join(" \xB7 ");return m`<div class="nf-rp-row">
|
||||||
<span class="nf-rp-icon ${e.state==="playing"?"nf-rp-on":""}">${zt("media")}</span>
|
<span class="nf-rp-icon ${e.state==="playing"?"nf-rp-on":""}">${zt("media")}</span>
|
||||||
${this.nameButton(n)}
|
${this.nameButton(n)}
|
||||||
<span class="nf-rp-state">${this.stateOf(e,this.stateLabel(e.state))}</span>
|
<span class="nf-rp-state">${this.stateOf(e,this.stateLabel(e.state))}</span>
|
||||||
${i?m`<p class="nf-rp-media nf-rp-wide">${i}</p>`:f}
|
${i?m`<p class="nf-rp-media nf-rp-wide">${i}</p>`:f}
|
||||||
<div class="nf-rp-buttons nf-rp-wide">
|
<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})}>
|
<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})}>
|
||||||
${No(br.previous)}
|
${Co(br.previous)}
|
||||||
</button>
|
</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})}>
|
<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})}>
|
||||||
${No(e.state==="playing"?br.pause:br.play)}
|
${Co(e.state==="playing"?br.pause:br.play)}
|
||||||
</button>
|
</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})}>
|
<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})}>
|
||||||
${No(br.next)}
|
${Co(br.next)}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
${typeof t.volume_level=="number"?m`<label class="nf-rp-slider"
|
${typeof t.volume_level=="number"?m`<label class="nf-rp-slider"
|
||||||
@@ -417,12 +417,12 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
.value=${String(Math.round(t.volume_level*100))}
|
.value=${String(Math.round(t.volume_level*100))}
|
||||||
@change=${s=>this.call("media_player","volume_set",{entity_id:n,volume_level:Number(s.target.value)/100})}
|
@change=${s=>this.call("media_player","volume_set",{entity_id:n,volume_level:Number(s.target.value)/100})}
|
||||||
/></label>`:f}
|
/></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">
|
</div>`}switchRow(e){let t=e.entity_id,n=F(t),o=t.slice(0,t.indexOf(".")),i=n==="lock"?e.state==="unlocked"||e.state==="open":J(e),s=()=>n==="lock"?this.call("lock",i?"lock":"unlock",{entity_id:t}):this.call(o,"toggle",{entity_id:t});return m`<div class="nf-rp-row">
|
||||||
<span class="nf-rp-icon ${i?"nf-rp-on":""}">${zt(n)}</span>
|
<span class="nf-rp-icon ${i?"nf-rp-on":""}">${zt(n)}</span>
|
||||||
${this.nameButton(t)}
|
${this.nameButton(t)}
|
||||||
<span class="nf-rp-state">${this.stateOf(e)}</span>
|
<span class="nf-rp-state">${this.stateOf(e)}</span>
|
||||||
${this.toggle(e,i,s)}
|
${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">
|
</div>`}sensorRow(e){let t=F(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":""}">${zt(t)}</span>
|
<span class="nf-rp-icon ${n?"nf-rp-on":""}">${zt(t)}</span>
|
||||||
${this.nameButton(e.entity_id)}
|
${this.nameButton(e.entity_id)}
|
||||||
<span class="nf-rp-state">${this.stateOf(e)}</span>
|
<span class="nf-rp-state">${this.stateOf(e)}</span>
|
||||||
@@ -807,8 +807,8 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
outline: 2px solid var(--nf-accent);
|
outline: 2px solid var(--nf-accent);
|
||||||
outline-offset: 2px;
|
outline-offset: 2px;
|
||||||
}
|
}
|
||||||
`]};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
|
`]};customElements.get("nf-room-panel")||customElements.define("nf-room-panel",No);function dl(r){if(!r)return"";let e=Math.min(.8,Math.max(0,r.dim??.35)),t=r.image&&/^(https:\/\/|\/local\/|\/api\/)[^"'()\\\s]+$/.test(r.image)?r.image:null,n=r.color&&/^#[0-9a-f]{6}$/i.test(r.color)?r.color:null;return t?`;background:linear-gradient(rgba(0,0,0,${e}),rgba(0,0,0,${e})),center / cover no-repeat url("${t}")${n?` ${n}`:""}`:n?`;background:${n}`:""}var Gh=[[/spotify/i,[30,215,96]],[/netflix/i,[229,9,20]],[/youtube/i,[255,0,51]],[/prime|amazon/i,[0,168,225]],[/disney/i,[17,60,207]],[/apple ?music|itunes/i,[250,45,72]],[/apple ?tv/i,[200,200,210]],[/plex/i,[229,160,13]],[/tidal/i,[0,255,255]],[/deezer/i,[162,56,255]],[/radio|tunein/i,[255,140,60]]],hl=[34,211,238];function Wo(r){return r?Gh.find(([e])=>e.test(r))?.[1]??hl:hl}function Oo(r){if(r.state==="playing"||r.state==="paused")return!0;let e=t=>typeof r.attributes[t]=="string"&&r.attributes[t]!=="";return r.state==="on"&&(e("media_title")||e("media_channel")||e("source")||e("app_name"))}var Lo=r=>r.state==="playing"||r.state==="on"&&Oo(r);function pl(r,e){let t=[],n=new Set;for(let o of e){if(!o.entity.startsWith("media_player.")||n.has(o.entity))continue;n.add(o.entity);let i=r.states[o.entity];if(!i)continue;let s=i.attributes,a=u=>typeof s[u]=="string"?s[u]:"",l=a("app_name")||a("source")||a("app_id")||null,c=typeof s.volume_level=="number"?s.volume_level:null;t.push({entity:o.entity,name:o.name,at:o.at,playing:Lo(i),title:a("media_title")||a("media_channel")||l||"",artist:a("media_artist")||a("media_album_name")||a("media_series_title"),picture:a("entity_picture")||null,volume:c,color:Wo(l),app:l,group:Array.isArray(s.group_members)?s.group_members.filter(u=>typeof u=="string"&&u!==o.entity):[],rings:o.rings??1})}return t}function ml(r){let e=new Map(r.filter(o=>o.playing).map(o=>[o.entity,o])),t=[],n=new Set;for(let o of e.values())for(let i of o.group){let s=e.get(i),a=[o.entity,i].sort().join("|");s&&!n.has(a)&&(n.add(a),t.push([o,s]))}return t}var Uh=3;function fl(r,e,t){let n=[];for(let o of e.floors)for(let i of o.furniture){if(!i.type.endsWith(":sprinkler"))continue;let s=t?.get(i.id)?.entity??null;!s||!J(r.states[s])||n.push({id:i.id,at:{floorId:o.id,x:i.x,y:ce(o,i)+i.h,z:i.z},reach:Math.min(15,Math.max(.5,i.spray??Uh))})}return n}var vr=r=>r&&r!=="none"?r:null,gl=r=>Math.min(1,Math.max(0,r));function _l(r,e){let t=new Map;for(let n of e.settings.roof?.windows??[]){let o=ze(r,{cover:vr(n.cover),contact:vr(n.contact),tilt:vr(n.tilt)},"window"),i=vr(n.window),s=i?r.states[i]:void 0,a=o.open;if(s&&!I(s)){let l=s.attributes.current_position;a=typeof l=="number"?gl(l/100):s.state==="open"||s.state==="opening"?1:0}t.set(n.id,{open:a,tilt:o.tilt,cover:o.cover??0})}return t}function jh(r,e){let t=o=>Math.hypot(o.x-e.x,o.z-e.z);return r.placements.filter(o=>o.entity_id.startsWith("media_player.")&&t(o)<Math.max(2,e.w)).sort((o,i)=>t(o)-t(i))[0]?.entity_id??null}var je=(r,e)=>typeof r[e]=="string"?r[e]:"";function bl(r,e,t){let n=[];for(let o of e.floors)for(let i of o.furniture){if(!Qn(i.type))continue;let s=t?.get(i.id)?.entity??null,a=s?.startsWith("media_player.")?s:jh(o,i),l=a?r.states[a]:void 0;if(!l||!Oo(l))continue;let c=l.attributes,u=je(c,"app_name")||je(c,"source")||null;n.push({id:i.id,furnitureId:i.id,floorId:o.id,color:Wo(u),title:je(c,"media_title")||je(c,"media_channel")||u||"",subtitle:je(c,"media_artist")||je(c,"media_series_title")||je(c,"media_album_name"),app:u,picture:je(c,"entity_picture")||null,playing:Lo(l),ambilight:i.ambilight??1})}return n}function vl(r){let e=r.states["sun.sun"]?.attributes;return typeof e?.elevation=="number"&&typeof e.azimuth=="number"?{elevation:e.elevation,azimuth:e.azimuth}:null}function wl(r,e){return(r===null?0:gl((r+4)/16))*(1-.45*e)}function qe(r,e){return e&&r.states[e]?e:Object.keys(r.states).filter(t=>t.startsWith("weather.")).sort()[0]??null}var wr=new Set(["contact_lost","unlocked_night","own"]);function qh(r,e){let t=r.states[e.entity];if(!t||["unavailable","unknown"].includes(t.state))return!1;let n=(e.state??"on").trim(),o=/^([<>])\s*(-?\d+(?:[.,]\d+)?)$/.exec(n);if(o){let i=Number(t.state),s=Number(o[2].replace(",","."));return Number.isFinite(i)&&(o[1]==="<"?i<s:i>s)}return n.split(",").map(i=>i.trim().toLowerCase()).filter(Boolean).includes(String(t.state).toLowerCase())}var Zh=600*1e3,Yh=new Set(["rainy","pouring","lightning-rainy","hail","snowy-rainy"]),Jh=new Map([["smoke","smoke"],["gas","gas"],["carbon_monoxide","co"],["moisture","water"]]),yl=(r,e)=>{if(e.startsWith("binary_sensor."))return Jh.get(String(r.states[e]?.attributes.device_class))};function Qh(r,e){let t=new Set,n=[];for(let o of r.floors)for(let i of o.openings){let s=e.get(i.id);for(let a of s?[s.contact,s.contact2,s.tilt,s.tilt2]:[])!a||t.has(a)||(t.add(a),n.push({floorId:o.id,roomId:i.room_id,entity:a}))}return n}function xl(r,e,t,n){let o=[];for(let a of e.floors)for(let l of a.rooms){let c=K(r,l).filter(u=>yl(r,u));
Line truncated
|
||||||
${J`<circle cx="27" cy="27" r=${22} class="live-ring-bg"></circle>
|
${Q`<circle cx="27" cy="27" r=${22} class="live-ring-bg"></circle>
|
||||||
<circle cx="27" cy="27" r=${22} stroke=${e} stroke-dasharray=${`${(n*Math.max(0,Math.min(1,r))).toFixed(1)} ${n.toFixed(1)}`} transform="rotate(-90 27 27)" class="live-ring-fg"></circle>`}
|
<circle cx="27" cy="27" r=${22} stroke=${e} stroke-dasharray=${`${(n*Math.max(0,Math.min(1,r))).toFixed(1)} ${n.toFixed(1)}`} transform="rotate(-90 27 27)" class="live-ring-fg"></circle>`}
|
||||||
</svg>`}function lm(r,e,t,n){let o=e.summary,i=c=>A(r,c),s=e.autarky,a=n?m`<button class="live-fold" title=${i(n.folded?"live_unfold":"live_fold")} aria-label=${i(n.folded?"live_unfold":"live_fold")} aria-expanded=${!n.folded} @click=${n.toggle}>${n.folded?"+":"\u2212"}</button>`:f;if(n?.folded){let c=o.solar!==null?`\u2600 ${Me(r,o.solar)}`:o.consumption!==null?`\u2302 ${Me(r,o.consumption)}`:null;return m`<div class="live-card live-card-house live-folded" data-i=${t}>
|
</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}
|
${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}
|
||||||
@@ -819,15 +819,15 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
${s!==null?m`<div class="live-own">${vn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)} %</b><span>${i("live_autarky")}</span></div></div>`:f}
|
${s!==null?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>
|
<div class="live-rows">${l}</div>
|
||||||
${um(r,e.curves)} ${cm(r,e.week)}
|
${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)})}>
|
</div>`}function cm(r,e){if(!e)return f;let t=[...e.solar,...e.use].filter(c=>c!==null&&c>0);if(!t.length)return f;let n=Math.max(...t)*1.1||1,[o,i]=[150,30],s=o/7,a=(c,u,h)=>c===null||c<=0?f:Q`<rect x=${u.toFixed(1)} y=${(i-c/n*i).toFixed(1)} width=${(s*.36).toFixed(1)} height=${(c/n*i).toFixed(1)} class=${h}></rect>`,l=c=>c.reduce((u,h)=>u+(h??0),0);return m`<div class="live-day live-week" title=${A(r,"live_week_hint",{solar:W(r,l(e.solar),0),use:W(r,l(e.use),0)})}>
|
||||||
<svg viewBox=${`0 0 ${o} ${i}`} preserveAspectRatio="none" aria-hidden="true">
|
<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")}`)}
|
${e.days.map((c,u)=>Q`${a(e.solar[u],u*s+s*.1,"live-week-solar")}${a(e.use[u],u*s+s*.5,"live-week-use")}`)}
|
||||||
</svg>
|
</svg>
|
||||||
<span>7 ${A(r,"live_days")}</span>
|
<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")}>
|
</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">
|
<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}
|
${s?Q`<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}
|
${a?Q`<path d=${a} class="live-day-use"></path>`:f}
|
||||||
</svg>
|
</svg>
|
||||||
<span>24 h</span>
|
<span>24 h</span>
|
||||||
</div>`}function dm(r,e,t,n){let o=e.car,i=(u,h)=>A(r,u,h),s=gc(o.soc),a=o.home?o.charging?`\u26A1 ${i("live_car_charging")}${o.chargingW?` \xB7 ${Me(r,o.chargingW)}`:""}`:o.plugged?`\u{1F50C} ${i("live_car_plugged")}`:"":`${i("live_car_away")}${o.where?` \xB7 ${o.where}`:""}${o.distance!==null?` \xB7 ${W(r,o.distance,o.distance<10?1:0)} km`:""}`,l=o.entities,c=(u,h,p,d)=>m`<button class="live-btn ${u?"live-on":""}" title=${h} aria-label=${h} aria-pressed=${u??!1} @click=${_=>(_.stopPropagation(),d())}>${p}</button>`;return m`<div class="live-card live-card-car ${o.charging?"live-charging":""} ${o.home?"":"live-away"}" data-i=${t} style=${`--live-soc:${s}`}>
|
</div>`}function 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}`}>
|
||||||
@@ -1219,7 +1219,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
letter-spacing: 0.04em;
|
letter-spacing: 0.04em;
|
||||||
}
|
}
|
||||||
`;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"}">
|
`;function Dr(r){return r.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var si=r=>r.points.length>=3;function wc(r,e,t){return r.rooms.filter(si).find(n=>H([e,t],n.points))}function gm(r,e,t,n){let o=[];for(let a of e.rooms.filter(si)){let[l,c]=xe(a.points);o.push({kind:"room",name:a.name,where:n?e.name:"",floorId:e.id,roomId:a.id,entity:null,icon:null,x:l,z:c,y:0})}let i=new Set,s=(a,l,c,u)=>{if(i.has(a)||!(a in r.states))return;i.add(a);let h=wc(e,l,c),p=[h?.name,n?e.name:void 0].filter(d=>!!d).join(" \xB7 ");o.push({kind:"device",name:O(r,a),where:p,floorId:e.id,roomId:h?.id??null,entity:a,icon:F(a),x:l,z:c,y:u})};for(let a of e.placements){let l=a.y??yt(F(a.entity_id)??"sensor",me(e,a.x,a.z),a.mount);s(a.entity_id,a.x,a.z,l)}for(let a of e.furniture){let l=t.get(a.id),c=l?.entity??l?.power;if(!c)continue;let u=me(e,a.x,a.z)-.3;s(c,a.x,a.z,Math.min(u,Math.max(.5,a.h)))}for(let a of e.notes??[]){if(!a.text)continue;let l=wc(e,a.x,a.z),c=[l?.name,n?e.name:void 0].filter(u=>!!u).join(" \xB7 ");o.push({kind:"note",name:`\u270E ${a.text.length>60?`${a.text.slice(0,59)}\u2026`:a.text}`,where:c,floorId:e.id,roomId:l?.id??null,entity:null,icon:null,x:a.x,z:a.z,y:1.3})}return o}function yc(r,e){let t=it(r,e.floors),n=e.floors.length>1,o=e.floors.flatMap(i=>gm(r,i,t,n));for(let i of e.settings.circuits??[]){let s=e.floors.flatMap(h=>h.rooms.filter(p=>i.rooms.includes(p.id)&&si(p)).map(p=>({f:h,r:p})));if(!s.length)continue;let[{f:a,r:l}]=s,[c,u]=xe(l.points);o.push({kind:"circuit",name:`\u{1F50C} ${i.name}`,where:s.map(h=>h.r.name).join(", "),floorId:a.id,roomId:l.id,entity:null,icon:null,x:c,z:u,y:0})}return o}function _m(r,e){return(Dr(r.name).startsWith(e)?0:2)+(r.kind==="room"?0:1)}function xc(r,e,t=8){let n=Dr(e).split(/\s+/).filter(Boolean);if(n.length===0)return[];let o=Dr(e.trim());return r.filter(i=>{let s=Dr([i.name,i.where,i.entity].filter(Boolean).join(" "));return n.every(a=>s.includes(a))}).map(i=>({item:i,cost:_m(i,o)})).sort((i,s)=>i.cost-s.cost||i.item.name.localeCompare(s.item.name)).slice(0,t).map(i=>i.item)}var bm=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[190,90,255],[255,95,210],[255,70,70],[120,255,150]],vm=[2200,2700,3200,4e3,5e3,6500],wm=["hs","rgb","rgbw","rgbww","xy"],ym=4,kc=16,Sc=32,xm=128;function li(r){let e=r.attributes.supported_color_modes??[],t=e.some(n=>wm.includes(n));return{dim:e.some(n=>n!=="onoff"),color:t,temp:e.includes("color_temp")}}function ci(r){return((r.attributes.supported_features??0)&ym)!==0&&typeof r.attributes.current_position=="number"}var ai=class extends re{static properties={hass:{attribute:!1},entity:{attribute:!1},car:{attribute:!1},presets:{attribute:!1},confirmSwitch:{type:Boolean},myPosition:{attribute:!1},tiltEntity:{attribute:!1},low:{type:Boolean,reflect:!0}};t(e,t){return A(this.hass,e,t)}ask(){return!this.confirmSwitch||confirm(this.t("confirm_switch",{name:O(this.hass,this.entity)}))}call(e,t,n={}){this.hass.callService(e,t,{entity_id:this.entity,...n})}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}details(){fe(this,this.entity),this.close()}ring(e){let t=e.length;return e.map((n,o)=>{let i=o/t*Math.PI*2-Math.PI/2;return m`<div class="qm-at" style="left:${50+Math.cos(i)*39}%;top:${50+Math.sin(i)*39}%">${n}</div>`})}renderLight(e){let t=li(e),n=e.state==="on",o=n&&typeof e.attributes.brightness=="number"?Math.round(e.attributes.brightness/2.55):n?100:0,i=t.color?bm.map(s=>m`<button class="qm-swatch" style="background:rgb(${s.join(",")})" aria-label=${`RGB ${s.join(", ")}`} @click=${()=>this.call("light","turn_on",{rgb_color:s})}></button>`):t.temp?vm.map(s=>m`<button class="qm-swatch" style="background:${km(s)}" aria-label=${`${s} K`} @click=${()=>this.call("light","turn_on",{color_temp_kelvin:s})}></button>`):[];return m`<div class="qm-ring ${i.length?"":"qm-ring-small"}">
|
||||||
${this.ring(i)}
|
${this.ring(i)}
|
||||||
<button class="qm-power ${n?"qm-on":""}" aria-pressed=${n} @click=${()=>this.ask()&&this.call("light","toggle")}>
|
<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>
|
<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>
|
||||||
@@ -1234,7 +1234,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
.value=${String(Math.max(1,o))}
|
.value=${String(Math.max(1,o))}
|
||||||
aria-label=${this.t("brightness")}
|
aria-label=${this.t("brightness")}
|
||||||
@change=${s=>this.call("light","turn_on",{brightness_pct:Number(s.target.value)})}
|
@change=${s=>this.call("light","turn_on",{brightness_pct:Number(s.target.value)})}
|
||||||
/>`:f}`}renderCover(e){e=nr(this.hass,e,this.tiltEntity);let t=typeof e.attributes.current_position=="number"?e.attributes.current_position:null,n=e.state==="opening"||e.state==="closing",o=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">
|
/>`:f}`}renderCover(e){e=nr(this.hass,e,this.tiltEntity);let t=typeof e.attributes.current_position=="number"?e.attributes.current_position:null,n=e.state==="opening"||e.state==="closing",o=ci(e),i=(u,h,p,d=!1)=>m`<button class="qm-swatch qm-slot ${d?"qm-slot-on":""}" aria-label=${h} @click=${p}>${u}</button>`,s=u=>t!==null&&Math.abs(t-u)<3,a=[i("\u25B2",this.t("cover_open"),()=>this.ask()&&this.call("cover","open_cover"),s(100)),...o?[75,50].map(u=>i(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],i("\u25BC",this.t("cover_close"),()=>this.ask()&&this.call("cover","close_cover"),s(0)),...o?[25].map(u=>i(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],...Number(e.attributes.supported_features??0)&8?[i("\u25A0",this.t("cover_stop"),()=>this.call("cover","stop_cover"),n)]:[],...this.myPosition!=null&&(o||Number(e.attributes.supported_features??0)&8)?[i("My",this.t("cover_my_go",{p:this.myPosition}),()=>this.ask()&&(o?this.call("cover","set_cover_position",{position:this.myPosition}):this.call("cover","stop_cover")),s(this.myPosition))]:[]],l=t===null?e.state==="closed"?100:0:100-t,c=t!==null||n||e.state==="open"||e.state==="closed";return m`<div class="qm-ring">
|
||||||
${this.ring(a)}
|
${this.ring(a)}
|
||||||
<button
|
<button
|
||||||
class="qm-power qm-blind ${c&&l<100?"qm-on":""}"
|
class="qm-power qm-blind ${c&&l<100?"qm-on":""}"
|
||||||
@@ -1290,7 +1290,7 @@ 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>
|
${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}
|
<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>
|
${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)&&!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-play">${this.presets.map(h=>m`<button class="qm-chip" @click=${()=>this.call("media_player","play_media",{media_content_type:h.type,media_content_id:h.content})}>${h.label}</button>`)}</div>`:f}`}render(){let e=this.hass?.states[this.entity];if(!e)return f;let t=F(this.entity),n=I(e)&&!qt(e)?m`<p class="qm-note">${te(this.hass,e)}</p>`:t==="light"?this.renderLight(e):t==="cover"?this.renderCover(e):t==="media"?this.renderMedia(e):this.renderToggle(e);return m`<div class="qm" role="dialog" aria-label=${O(this.hass,this.entity)}>
|
||||||
<div class="qm-title">${O(this.hass,this.entity)}</div>
|
<div class="qm-title">${O(this.hass,this.entity)}</div>
|
||||||
${n}
|
${n}
|
||||||
<button class="qm-details" @click=${()=>this.details()}>${this.t("details")} …</button>
|
<button class="qm-details" @click=${()=>this.details()}>${this.t("details")} …</button>
|
||||||
@@ -1537,9 +1537,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
.qm-note {
|
.qm-note {
|
||||||
color: var(--nf-muted);
|
color: var(--nf-muted);
|
||||||
}
|
}
|
||||||
`]};function km(r){let e=Math.min(1,Math.max(0,(r-2200)/4300)),t=(n,o)=>Math.round(n+(o-n)*e);return`rgb(${t(255,200)},${t(170,225)},${t(80,255)})`}customElements.get("nf-quick-menu")||customElements.define("nf-quick-menu",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
|
`]};function km(r){let e=Math.min(1,Math.max(0,(r-2200)/4300)),t=(n,o)=>Math.round(n+(o-n)*e);return`rgb(${t(255,200)},${t(170,225)},${t(80,255)})`}customElements.get("nf-quick-menu")||customElements.define("nf-quick-menu",ai);var Sm=new URL(import.meta.url),$m=new URL("./nextfloor-3d.js?v=74227cd20cc3",Sm).href,$c;function Mc(){return $c??=import($m),$c}function Ac(r){if(!r||r.state!=="on")return 0;let e=typeof r.attributes.percentage=="number"?r.attributes.percentage:60;return e<=0?0:.2+.6*Math.min(100,e)/100}var Mm=new Set(["on","home","open","true","active","playing","heat","heating"]);function Fr(r,e){let t=e.show_when;if(!t?.entity||!r)return!0;let n=r.states[t.entity];if(!n||I(n))return!0;let o=String(n.state).toLowerCase(),i=(t.state??"").split(",").map(a=>a.trim().toLowerCase()).filter(Boolean),s=i.length?i.includes(o):Mm.has(o)||Number.isFinite(Number(o))&&Number(o)>0;return t.invert?!s:s}function ui(r,e){let t=[];for(let n of e.floors)for(let o of n.furniture)Fr(r,o)||t.push(o.id);return t.sort()}function Ec(r,e){if(!e.length)return r;let t=new Set(e);return{...r,floors:r.floors.map(n=>n.furniture.some(o=>t.has(o.id))?{...n,furniture:n.furniture.filter(o=>!t.has(o.id))}:n)}}var Rc="image:";function di(r,e,t){let n=(e??"").trim();if(!n)return null;if(n.startsWith(Rc))return t(n.slice(Rc.length));if(/^(https?:\/\/|\/)/.test(n))return n;if(/^[a-z_]+\.[a-z0-9_]+$/.test(n)){let o=r?.states[n]?.attributes.entity_picture;return typeof o=="string"&&o?o:null}return null}var wn=r=>Number(r);function xn(r){if(Array.isArray(r)){let[i,s]=[wn(r[0]),wn(r[1])];return Number.isFinite(i)&&Number.isFinite(s)?[i,s]:null}if(!r||typeof r!="object")return null;let{x:e,y:t}=r,[n,o]=[wn(e),wn(t)];return Number.isFinite(n)&&Number.isFinite(o)?[n,o]:null}function zc(r){return r?xn(r.charger)??xn(r.charger_position):null}function Tc(r){for(let[e,t]of Object.entries(r.states))if(e.startsWith("camera.")&&(xn(t.attributes?.vacuum_position)??zc(t.attributes)))return e;return null}var Am=r=>Array.isArray(r)?typeof r[0]=="number":!!r&&typeof r=="object",yn=(r,e)=>e?[r[0],-r[1]]:r;function Em(r){if(!r)return null;let e=r.mirror===!0,[t,n]=yn(r.ga,e),[o,i]=yn(r.gb,e),[s,a]=r.a,[l,c]=r.b,[u,h]=[o-t,i-n],[p,d]=[l-s,c-a],_=Math.hypot(u,h),b=Math.hypot(p,d);if(!(_>1e-6)||!(b>1e-6))return null;let g=b/_,v=Math.atan2(d,p)-Math.atan2(h,u),[S,k]=[Math.cos(v),Math.sin(v)];return y=>{let z=yn(y,e),[E,D]=[z[0]-t,z[1]-n];return[s+g*(E*S-D*k),a+g*(E*k+D*S)]}}function Rm(r){if(!r)return null;let e=r.mirror===!0,[t,n]=yn(r.ga,e),[o,i]=yn(r.gb,e),s=Math.atan2(r.b[1]-r.a[1],r.b[0]-r.a[0])-Math.atan2(i-n,o-t);return Number.isFinite(s)?s:null}function Dc(r,e,t){if(!e)return null;let n=r.states[e]?.attributes;if(!n)return null;let o=Em(t)??(_=>_),i=Rm(t)??0,s=t?.mirror===!0?-1:1,a=n.vacuum_position,l=xn(a),c=l?(()=>{let[_,b]=o(l),g=wn(a?.a)*s;if(!Number.isFinite(g))return{x:_,z:b,heading:0};let v=g*Math.PI/180+i;return{x:_,z:b,heading:Math.atan2(Math.cos(v),Math.sin(v))}})():null,u=zc(n),h=Array.isArray(n.path)?n.path:[],p=h.length>0&&Am(h[0])?[h]:h,d=[];for(let _ of p){let b=[];for(let g of Array.isArray(_)?_:[]){let v=xn(g);v&&b.push(o(v))}b.length>1&&d.push(b)}return!c&&!u&&!d.length?null:{pose:c,charger:u?o(u):null,path:d}}var Fc="nextfloor.lock3d",Pc=520,pi=class extends re{static properties={hass:{attribute:!1},building:{attribute:!1},floorId:{attribute:!1},roomId:{attribute:!1},wallMode:{attribute:!1},solidWalls:{attribute:!1},glassWalls:{attribute:!1},explode:{type:Boolean},keepRoof:{attribute:!1},markerMode:{attribute:!1},markerNames:{attribute:!1},markersOutside:{attribute:!1},tapInRoom:{type:Boolean},roomDoubleTap:{attribute:!1},heatMode:{attribute:!1},theme:{attribute:!1},accent:{attribute:!1},furnitureColors:{attribute:!1},packs:{attribute:!1},showEnergy:{attribute:!1},flows:{attribute:!1},holograms:{attribute:!1},furnish:{type:Boolean},surfaceGrab:{attribute:!1},furnishTypes:{attribute:!1},weather:{type:Boolean},weatherEntityId:{attribute:!1},weatherDensity:{attribute:!1},timeOfDay:{attribute:!1},selectedFurniture:{attribute:!1},selectedDevice:{attribute:!1},_sky:{state:!0},quality:{attribute:!1},showStats:{type:Boolean},_stats:{state:!0},_error:{state:!0},_energy:{state:!0},_flows:{state:!0},_liveEnergy:{state:!0},_liveCards:{state:!0},_liveCardOn:{state:!0},_houseFolded:{state:!0},_swipe:{state:!0},_menu:{state:!0},_pluginWindow:{state:!0},_plate:{state:!0},_blend:{state:!0},_wallBig:{state:!0},_find:{state:!0},_central:{state:!0},_thumbsCompact:{state:!0},_armed:{state:!0},central:{attribute:!1},centralOpen:{attribute:!1},keepCamera:{attribute:!1},plain:{attribute:!1},rightBack:{attribute:!1},templateName:{attribute:!1},readable:{type:Boolean,reflect:!0},today:{attribute:!1},_todayOpen:{state:!0},_todayItems:{state:!0},_forecast:{state:!0},zoom:{attribute:!1},buttons:{attribute:!1},_thumbs:{state:!0},floorThumbs:{attribute:!1},clean:{attribute:!1},cleanButton:{attribute:!1},clock:{attribute:!1},lockButton:{attribute:!1},walkButto
Line truncated
|
||||||
${e.map(t=>m`<button class="nf-chip" aria-pressed=${!this.hiddenLayers.has(t.id)} @click=${()=>this.toggleLayer(t.id)}>${this.hiddenLayers.has(t.id)?"\u25CC":"\u{1F441}"} ${t.name}</button>`)}
|
${e.map(t=>m`<button class="nf-chip" aria-pressed=${!this.hiddenLayers.has(t.id)} @click=${()=>this.toggleLayer(t.id)}>${this.hiddenLayers.has(t.id)?"\u25CC":"\u{1F441}"} ${t.name}</button>`)}
|
||||||
</div>`}syncDevices(e){let t=this.viewer,n=this.building;if(!t||!n||!this.hass)return;let o=this._travel,i=o&&!o.loading?Rt(this.hass,o.history,o.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==i.entities)&&(this.openingLinks=Re(i,n.floors),this.furnitureLinks=it(i,n.floors),this.linkedRegistry=i.entities,this.findIndex=null,this.alertSrc=this.alerts?xl(i,n,this.weatherEntityId,this.openingLinks):null,this.watched=zl({hass:i,building:n,openingLinks:this.openingLinks,furnitureLinks:this.furnitureLinks,needsRoomSensors:this.heatMode!=="none"||this.roomLabels,alertSources:this.alertSrc,weatherEntityId:this.weatherEntityId}),e=!0),!(e||this.watched.some(w=>this.shownStates.get(w)!==i.states[w])))return;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
|
</div>`}syncDevices(e){let t=this.viewer,n=this.building;if(!t||!n||!this.hass)return;let o=this._travel,i=o&&!o.loading?Rt(this.hass,o.history,o.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==i.entities)&&(this.openingLinks=Re(i,n.floors),this.furnitureLinks=it(i,n.floors),this.linkedRegistry=i.entities,this.findIndex=null,this.alertSrc=this.alerts?xl(i,n,this.weatherEntityId,this.openingLinks):null,this.watched=zl({hass:i,building:n,openingLinks:this.openingLinks,furnitureLinks:this.furnitureLinks,needsRoomSensors:this.heatMode!=="none"||this.roomLabels,alertSources:this.alertSrc,weatherEntityId:this.weatherEntityId}),e=!0),!(e||this.watched.some(w=>this.shownStates.get(w)!==i.states[w])))return;ui(i,n).join(",")!==this.shownFor?.key&&t.setBuilding(this.shownBuilding(i)),this.shownStates=new Map(this.watched.map(w=>[w,i.states[w]])),this.refreshToday(n),this.refreshForecast(n);let a=rn(i,n),l=ca(i,n.floors.some(w=>w.layer&&this.hiddenLayers.has(w.id))?this.shownBuilding(i):n);this.placementInfo=new Map(l.map(w=>[w.id,{floorId:w.floorId,roomId:w.roomId,x:w.x,z:w.z,y:w.y,rotation:w.rotation??0}]));let c=this.furnitureMarkers(i,n,new Set(l.map(w=>w.id)),new Set(a.map(w=>w.powerEntity)));a.push(...c.consumers);let u=on(i,n,a,Pe(n,w=>this.furnitureLinks?.get(w.id)?.power??null)),h=new Map(a.filter(w=>w.id!==w.powerEntity).map(w=>[w.id,w.power]));this.confirmSet=st(i,n.floors);let p=new Set(this.liveCardsOn?this._liveCards.flatMap(w=>w.kind==="media"?[w.media.entity]:w.kind==="car"?[w.spot]:[]):[]);for(let w of n.floors)for(let x of w.outdoor??[]){if(!x.area_id&&!x.temp_entity&&!x.pump_entity)continue;let B=x.temp_entity?i.states[x.temp_entity]:void 0,T=x.pump_entity?i.states[x.pump_entity]:void 0,[L,de]=xe(x.points),Ye=B&&Number.isFinite(Number(B.state))?`${W(i,oe(i,jn(Number(B.state),B.attributes.unit_of_measurement)),1)} ${X(i)}`:"",ht=!!T&&J(T);l.push({id:x.area_id?`outdoor:${x.id}`:x.pump_entity??x.temp_entity,floorId:w.id,roomId:null,x:L,z:de,y:Ln(w,x,L,de)+.7,icon:ke(x.type==="pool"?"pool":x.type==="terrace"?"table-chair":"tree-outline"),name:x.area_id&&i.areas?.[x.area_id]?.name||A(i,`out_${x.type}`),text:[Ye,ht?A(i,"pool_pump_on"):""].filter(Boolean).join(" \xB7 "),active:ht,unavailable:!1,glow:null,show:"always"})}let d=new Map;for(let w of n.floors){for(let x of w.placements)x.pin_offset&&d.set(`${w.id}:${x.entity_id}`,x.pin_offset);for(let x of w.furniture)x.pin_offset&&d.set(`f:${x.id}`,x.pin_offset)}let _=w=>{let x=w.lamp?void 0:(w.furnitureId?d.get(`f:${w.furnitureId}`):void 0)??d.get(`${w.floorId}:${w.id}`);return x?{...w,x:w.x+(x.x??0),z:w.z+(x.z??0),y:w.y+(x.y??0)}:w};t.setDevices([...[...l,...c.markers].map(_).map(w=>{let x=w.show==="no_power"||"energyDevice"in w&&w.energyDevice?null:h.get(w.id)??null,B={...w,power:x,powerText:x===null?void 0:ae(i,x),effect:this.dimmed?void 0:w.effect,text:this.subMeterText(i,n,u,w.furnitureId)??w.text},T=w.ownName&&(w.showName||this.markerNames)?w.ownName:"",L=p.has(w.id)||!!w.furnitureId&&p.has(w.furnitureId);return{...B,pin:this.showPin(B)&&!L,full:w.show==="always",caption:T}})]),t.setPickTargets(c.targets,this.openingTargets(),this.secondBlinds()),t.setScreens(c.screens),t.setFridgeDoors(Ks(i,n.floors)),t.setCovers(ta(i,n)),t.setRobots(this.robotInfos(i,n));let b=new Map;for(let w of n.floors)for(let x of w.furniture)!Z(x.type)?.pet||!x.room_sensor||x.room_sensor==="none"||b.set(x.id,vo(i,w.rooms.filter(B=>B.points.length>=3),null,x.room_sensor)?.id??null);b.size&&t.setPetRooms(b),t.setRoofWindows(_l(i,n)),t.setParked(Go(i,n)),t.setGateStates(Il(i,n));let g=new Map(n.floors.flatMap(w=>w.openings.map(x=>[x.id,x.type]))),v=new Map([...this.openingLinks].map(([w,x])=>[w,ze(i,x,g.get(w))]));t.setOpeningStates(v),this.setAlerts(this.alertSrc?Bo(i,n,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(i);let S=[...l,...c.markers].map(w=>`${w.id}:${w.glow?`${w.glow.level.toFixed(1)}/${w.glow.color.map(x=>x.toFixed(1)).join("/")}`:0}`).join(";")+"|"+[...v].map(([w,x])=>`${w}:${x.open}:${x.cover===null?"-":x.cover.toFixed(1)}`).join(";");if(S!==this.thumbSig){let w=this.thumbSig==="";this.thumbSig=S,w||this.scheduleThumbs(1500)}let k=Jl(i,n,a,n.energy.advanced?w=>this.furnitureLinks?.get(w.id)?.power??null:void 0),y=this.liveCars(i,n);for(let w of y){if(!w.car.home||!w.car.charging&&!w.car.plugged)continue;let x=n.floors.flatMap(L=>L.furniture.filter(de=>de.type==="wallbox").map(de=>({floorId:L.id,x:de.x,z:de.z,y:1}))).sort((L,de)=>Math.hypot(L.x-w.at.x,L.z-w.at.z)-Math.hypot(de.x-w.at.x,de.z-w.at.z))[0],B=x&&x.floorId===w.at.floorId&&Math.hypot(x.x-w.at.x,x.z-w.at.z)<9,T=x??gn(n);!T||!w.car.charging&&!B||k.arcs.push({key:`car:${w.spot}`,from:T,to:{...w.at,y:.8},power:w.car.charging?w.car.chargingW??7e3:0,color:[80,175,255],...B?{via:[{...T,y:.35},{floorId:w.at.floorId,x:(T.x+w.at.x)/2,z:(T.z+w.at.z)/2,y:.08},{...w.at,y:.5}],cable:!0}:{}})}let z=gn(n);for(let w of this.liveHeatPumps(n)){let x=w.pump.heat??(w.pump.mode==="heating"||w.pumLine truncated
|
||||||
<button class="nf-thumbs-fold" title=${A(this.hass,n?"thumbs_show":"thumbs_fold")} aria-label=${A(this.hass,n?"thumbs_show":"thumbs_fold")} @click=${o}>${n?"\u25B8":"\u25C2"}</button>
|
<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})}>
|
<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>
|
<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>
|
||||||
@@ -1549,12 +1549,12 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
${n?f:m`<img src=${i.url} alt="" />`}
|
${n?f:m`<img src=${i.url} alt="" />`}
|
||||||
<span>${e.get(i.floorId)??""}</span>
|
<span>${e.get(i.floorId)??""}</span>
|
||||||
</button>`)}
|
</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"&&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}>
|
</nav>`}onDeviceHold(e,t,n){let o=F(e);o==="light"||o==="cover"||o==="switch"||o==="fan"||o==="lock"?this._menu={entity:e,x:t,y:n}:fe(this,e)}onDeviceSwipe(e,t,n,o,i){let s=this.hass?.states[e];if(t==="start"){if(!s||I(s)||this.confirmSet.has(e))return!1;let l=F(e);if(l==="light"&&li(s).dim){let c=s.state==="on"?typeof s.attributes.brightness=="number"?Math.round(s.attributes.brightness/2.55):100:0;return this._swipe={entity:e,kind:"light",start:c,value:c,x:o,y:i},!0}if(l==="fan"&&typeof s.attributes.percentage_step=="number"){let c=s.state==="on"&&typeof s.attributes.percentage=="number"?s.attributes.percentage:0;return this._swipe={entity:e,kind:"fan",start:c,value:c,x:o,y:i},!0}if(l==="cover"&&ci(s)){let c=s.attributes.current_position;return this._swipe={entity:e,kind:"cover",start:c,value:c,x:o,y:i},!0}return!1}let a=this._swipe;if(!a||a.entity!==e)return!1;if(t==="move"){let l=Math.round(Math.min(100,Math.max(0,a.start-n/220*100)));l!==a.value&&(this._swipe={...a,value:l});let c=performance.now();c-this.swipeSent>350&&(this.swipeSent=c,this.applySwipe())}else this.applySwipe(),clearTimeout(this.swipeTimer),this.swipeTimer=setTimeout(()=>this._swipe=null,700);return!0}applySwipe(){let e=this._swipe;!e||!this.hass||(e.kind==="light"?e.value<=0?this.hass.callService("light","turn_off",{entity_id:e.entity}):this.hass.callService("light","turn_on",{entity_id:e.entity,brightness_pct:e.value}):e.kind==="fan"?e.value<=0?this.hass.callService("fan","turn_off",{entity_id:e.entity}):this.hass.callService("fan","set_percentage",{entity_id:e.entity,percentage:e.value}):this.hass.callService("cover","set_cover_position",{entity_id:e.entity,position:e.value}))}openRoom(e,t){this.floorId===e&&this.roomId===t||(this.floorId!==e?(this.fire("floor-tap",{floorId:e}),setTimeout(()=>this.fire("room-tap",{floorId:e,roomId:t}),60)):this.fire("room-tap",{floorId:e,roomId:t}))}goTo(e){if(this._find=null,e.kind==="room"||e.kind==="circuit"){e.roomId&&this.openRoom(e.floorId,e.roomId);return}this.floorId!==e.floorId&&this.fire("floor-tap",{floorId:e.floorId}),setTimeout(()=>this.viewer?.focus(e.floorId,e.x,e.z,e.y,e.entity),120)}listenToAnnouncements(e){if(!e){this.stopAnnouncements?.(),this.stopAnnouncements=null,clearTimeout(this.announceTimer);return}if(this.stopAnnouncements)return;let t=!1;this.stopAnnouncements=()=>t=!0,ba(this.hass,n=>this.announce(n)).then(n=>{t?n():this.stopAnnouncements=n})}announce(e){let t=e;if(t?.reload===!0){(!t.template||t.template===this.templateName)&&setTimeout(()=>location.reload(),500+Math.random()*6e3);return}if(typeof e?.message!="string"||!e.message.trim()||!ma(e,this.screenName)||!fa(e))return;let n=ga(e.message);this._announcement={message:e.message,until:Date.now()+n},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,n),_a(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?m`<button class="nf-announcement" role="alert" title=${A(this.hass,"close")} @click=${()=>this._announcement=null}>
|
||||||
<span class="nf-announcement-icon" aria-hidden="true">📢</span><span class="nf-announcement-text">${e.message}</span>
|
<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">
|
</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=${Ko(this.hass,e,n)} @click=${()=>this.jumpTo(n)}>${Ko(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=${Vo(this.hass,e,n)} @click=${()=>this.jumpTo(n)}>${Vo(this.hass,e,n)}</button>`)}
|
||||||
${this._alerts.length>3?m`<span class="nf-alert-more">+${this._alerts.length-3}</span>`:f}
|
${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">
|
</div>`}renderScenes(){let e=this.building;if(!this.scenes||!this.roomId||this.panelOpen||!e||!this.hass)return f;let t=e.floors.flatMap(i=>i.rooms).find(i=>i.id===this.roomId),n=t?K(this.hass,t).filter(i=>F(i)==="scene"||F(i)==="script").slice(0,6):[];if(!n.length)return f;let o=t?.area_id?this.hass.areas?.[t.area_id]?.name:void 0;return m`<div class="nf-scenes">
|
||||||
${n.map(i=>m`<button class="nf-chip" aria-pressed=${this._sceneFired===i} @click=${()=>this.runScene(i)}>${O(this.hass,i,o)}</button>`)}
|
${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=""}>
|
</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>
|
<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>
|
||||||
@@ -1581,7 +1581,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
@click=${()=>{this._central=!this._central,this._armed=null}}
|
@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>
|
<svg viewBox="0 0 24 24" width="19" height="19" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linejoin="round"><path d="M12 3.5l2.6 5.3 5.9.9-4.3 4.1 1 5.8L12 16.9l-5.2 2.7 1-5.8-4.3-4.1 5.9-.9z" /></svg>
|
||||||
</button>`;if(!this._central)return o;let i=this.floorId?e.floors.find(g=>g.id===this.floorId):void 0,s=i?[i]:e.floors,a=s.flatMap(g=>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)}>
|
</button>`;if(!this._central)return o;let i=this.floorId?e.floors.find(g=>g.id===this.floorId):void 0,s=i?[i]:e.floors,a=s.flatMap(g=>wo(t,g).lights),l=s.flatMap(g=>wo(t,g).covers),c=a.filter(g=>t.states[g]?.state==="on").length,u=!i,h=(g,v,S,k)=>{if(k.length){if(u&&this._armed!==g){this._armed=g,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(v,S,{entity_id:k})}},p=(g,v,S,k,y)=>m`<button class="nf-btn ${this._armed===g?"nf-central-armed":""}" ?disabled=${!y.length} @click=${()=>h(g,S,k,y)}>
|
||||||
${this._armed===g?n("central_sure"):n(v)}
|
${this._armed===g?n("central_sure"):n(v)}
|
||||||
</button>`,d=e.settings.favorite_floors??{},_=(e.settings.favorites??[]).filter(g=>t.states[g]&&(!d[g]||!i||d[g]===i.id)),b=this.buttons??e.settings.buttons??[];return m`${o}
|
</button>`,d=e.settings.favorite_floors??{},_=(e.settings.favorites??[]).filter(g=>t.states[g]&&(!d[g]||!i||d[g]===i.id)),b=this.buttons??e.settings.buttons??[];return m`${o}
|
||||||
<div class="nf-central ${this.centralOpen?"nf-central-big":""}" role="dialog" aria-label=${n("central")}>
|
<div class="nf-central ${this.centralOpen?"nf-central-big":""}" role="dialog" aria-label=${n("central")}>
|
||||||
@@ -1611,16 +1611,16 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
${b.map(g=>m`<button
|
${b.map(g=>m`<button
|
||||||
class="nf-chip nf-own-btn"
|
class="nf-chip nf-own-btn"
|
||||||
aria-pressed=${Ys(t,g)}
|
aria-pressed=${Ys(t,g)}
|
||||||
@click=${v=>{xo(t,v.currentTarget,g),g.action!=="service"&&(this._central=!1)}}
|
@click=${v=>{yo(t,v.currentTarget,g),g.action!=="service"&&(this._central=!1)}}
|
||||||
>
|
>
|
||||||
${g.icon?m`<ha-icon .icon=${g.icon.startsWith("mdi:")?g.icon:`mdi:${g.icon}`}></ha-icon>`:f}${g.label}
|
${g.icon?m`<ha-icon .icon=${g.icon.startsWith("mdi:")?g.icon:`mdi:${g.icon}`}></ha-icon>`:f}${g.label}
|
||||||
</button>`)}
|
</button>`)}
|
||||||
</div>`:f}
|
</div>`:f}
|
||||||
</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")}>
|
</div>`}toggleLock(){this._locked=!this._locked;try{localStorage.setItem(Fc,this._locked?"1":"0")}catch{}}async openTravel(e){if(clearInterval(this.travelTimer),this.travelTimer=void 0,e===null||!this.hass){this._travel=null,this.syncDevices(!0);return}let t=Date.now(),n=t-e*36e5;this._travel={history:new Map,from:n,to:t,t:n,playing:!1,speed:e>24?3600:600,hours:e,moments:[],loading:!0};try{let o=await ln(this.hass,al(this.watched),n,t);if(!this._travel||this._travel.from!==n)return;this._travel={...this._travel,history:o,moments:ll(o,n,t),loading:!1}}catch{this._travel=null,this._error=A(this.hass,"travel_failed");return}this.syncDevices(!0)}travelTo(e){let t=this._travel;t&&(this._travel={...t,t:Math.min(t.to,Math.max(t.from,e))},this.syncDevices(!0))}playTravel(e){let t=this._travel;t&&(clearInterval(this.travelTimer),this.travelTimer=void 0,this._travel={...t,playing:e,t:e&&t.t>=t.to?t.from:t.t},e&&(this.travelTimer=setInterval(()=>{let n=this._travel;if(!n)return;let o=n.t+250*n.speed;o>=n.to&&this.playTravel(!1),this.travelTo(o)},250)))}renderTravel(){if(!this.hass||this.clean)return f;let e=a=>A(this.hass,a),t=this._travel;if(!t)return this.travelButton?m`<button class="nf-travel-btn" title=${e("travel")} aria-label=${e("travel")} @click=${()=>{this.openTravel(24)}}>⏪</button>`:f;let n=this.hass.language??navigator.language,o=new Intl.DateTimeFormat(n,{weekday:"short",hour:"2-digit",minute:"2-digit"}).format(new Date(t.t)),i=t.to-t.from||1,s=[[60,"travel_speed_min"],[600,"travel_speed_10min"],[3600,"travel_speed_hour"]];return m`<div class="nf-travel" role="group" aria-label=${e("travel")}>
|
||||||
<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>
|
<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>
|
<b class="nf-travel-when">${t.loading?e("travel_loading"):o}</b>
|
||||||
<div class="nf-travel-track">
|
<div class="nf-travel-track">
|
||||||
<svg viewBox="0 0 1000 10" preserveAspectRatio="none" aria-hidden="true">${t.moments.map(a=>J`<rect x=${(a-t.from)/i*1e3} y="0" width="1.6" height="10" />`)}</svg>
|
<svg viewBox="0 0 1000 10" preserveAspectRatio="none" aria-hidden="true">${t.moments.map(a=>Q`<rect x=${(a-t.from)/i*1e3} y="0" width="1.6" height="10" />`)}</svg>
|
||||||
<input type="range" min=${t.from} max=${t.to} step="60000" .value=${String(t.t)} ?disabled=${t.loading} aria-label=${e("travel")} @input=${a=>this.travelTo(Number(a.target.value))} />
|
<input type="range" min=${t.from} max=${t.to} step="60000" .value=${String(t.t)} ?disabled=${t.loading} aria-label=${e("travel")} @input=${a=>this.travelTo(Number(a.target.value))} />
|
||||||
</div>
|
</div>
|
||||||
<select aria-label=${e("travel_speed")} @change=${a=>this._travel={...t,speed:Number(a.target.value)}}>
|
<select aria-label=${e("travel_speed")} @change=${a=>this._travel={...t,speed:Number(a.target.value)}}>
|
||||||
@@ -1630,7 +1630,7 @@ 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===168} @click=${()=>{this.openTravel(168)}}>7 ${e("travel_days")}</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>
|
<button class="nf-travel-live" @click=${()=>{this.openTravel(null)}}>● ${e("travel_live")}</button>
|
||||||
</div>`}toggleWalk(){let e=this.viewer;e&&(this._walking?(e.stopWalk(),this._walking=!1):this._walking=e.startWalk()!==null,this._stick=null)}stickMove(e,t=!1){let n=e.currentTarget;if(t)n.setPointerCapture(e.pointerId);else if(!this._stick)return;let o=n.getBoundingClientRect(),i=o.width/2,[s,a]=[(e.clientX-o.left-i)/i,(e.clientY-o.top-i)/i],l=Math.hypot(s,a);l>1&&([s,a]=[s/l,a/l]),this._stick=[s,a],this.viewer?.setWalkStick(Math.abs(s)<.12?0:s,Math.abs(a)<.12?0:a)}stickEnd(){this._stick=null,this.viewer?.setWalkStick(0,0)}renderWalk(){if(!this.hass||this.clean||!this.walkButton&&!this._walking)return f;let e=n=>A(this.hass,n),t=this._stick??[0,0];return m`<button class="nf-walk-btn ${this._walking?"nf-walk-on":""}" title=${e(this._walking?"walk_stop":"walk")} aria-label=${e(this._walking?"walk_stop":"walk")} aria-pressed=${this._walking} @click=${()=>this.toggleWalk()}>
|
</div>`}toggleWalk(){let e=this.viewer;e&&(this._walking?(e.stopWalk(),this._walking=!1):this._walking=e.startWalk()!==null,this._stick=null)}stickMove(e,t=!1){let n=e.currentTarget;if(t)n.setPointerCapture(e.pointerId);else if(!this._stick)return;let o=n.getBoundingClientRect(),i=o.width/2,[s,a]=[(e.clientX-o.left-i)/i,(e.clientY-o.top-i)/i],l=Math.hypot(s,a);l>1&&([s,a]=[s/l,a/l]),this._stick=[s,a],this.viewer?.setWalkStick(Math.abs(s)<.12?0:s,Math.abs(a)<.12?0:a)}stickEnd(){this._stick=null,this.viewer?.setWalkStick(0,0)}renderWalk(){if(!this.hass||this.clean||!this.walkButton&&!this._walking)return f;let e=n=>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>`}
|
${this._walking?"\u2715":Q`<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="13" cy="4" r="2" /><path d="M10 21l2-6 3 3v5M9 12l1-4 4 1 3 3M8 9l-2 4" /></svg>`}
|
||||||
</button>
|
</button>
|
||||||
${this._walking?m`<div class="nf-stick" @pointerdown=${n=>this.stickMove(n,!0)} @pointermove=${n=>this.stickMove(n)} @pointerup=${()=>this.stickEnd()} @pointercancel=${()=>this.stickEnd()}>
|
${this._walking?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>
|
<span style="transform:translate(${t[0]*34}px, ${t[1]*34}px)"></span>
|
||||||
@@ -1638,7 +1638,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
<p class="nf-walk-hint">${e("walk_hint")}</p>`:f}`}renderLock(){if(!this.lockButton||!this.hass||this.clean)return f;let e=A(this.hass,this._locked?"lock3d_off":"lock3d_on");return m`<button class="nf-lock3d ${this._locked?"nf-lock3d-on":""}" title=${e} aria-label=${e} aria-pressed=${this._locked} @click=${()=>this.toggleLock()}>
|
<p class="nf-walk-hint">${e("walk_hint")}</p>`:f}`}renderLock(){if(!this.lockButton||!this.hass||this.clean)return f;let e=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">
|
<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" />
|
<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" />`}
|
${this._locked?Q`<path d="M8 11V8a4 4 0 0 1 8 0v3" />`:Q`<path d="M8 11V8a4 4 0 0 1 7.5-2" />`}
|
||||||
</svg>
|
</svg>
|
||||||
</button>`}renderClock(e=!1){if(!this.clock||!this.hass||this.clock==="top_left"&&!e)return f;let t=this.hass.language??navigator.language,n=new Date(this._now),o=new Intl.DateTimeFormat(t,{hour:"2-digit",minute:"2-digit"}).format(n),i=new Intl.DateTimeFormat(t,{weekday:"long",day:"numeric",month:"long"}).format(n);return m`<div class="nf-clock nf-clock-${this.clock}" aria-hidden="true"><b>${o}</b><span>${i}</span></div>`}renderEye(){if(!this.cleanButton||!this.hass||this._find!==null&&!this.clean)return f;let e=A(this.hass,this.clean?"controls_show":"controls_hide");return m`<button
|
</button>`}renderClock(e=!1){if(!this.clock||!this.hass||this.clock==="top_left"&&!e)return f;let t=this.hass.language??navigator.language,n=new Date(this._now),o=new Intl.DateTimeFormat(t,{hour:"2-digit",minute:"2-digit"}).format(n),i=new Intl.DateTimeFormat(t,{weekday:"long",day:"numeric",month:"long"}).format(n);return 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":""}"
|
class="nf-eye ${this.clean?"nf-eye-clean":""}"
|
||||||
@@ -1647,14 +1647,14 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
aria-pressed=${this.clean}
|
aria-pressed=${this.clean}
|
||||||
@click=${()=>this.dispatchEvent(new CustomEvent("clean-toggle",{bubbles:!0,composed:!0}))}
|
@click=${()=>this.dispatchEvent(new CustomEvent("clean-toggle",{bubbles:!0,composed:!0}))}
|
||||||
>
|
>
|
||||||
${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>`}
|
${this.clean?Q`<svg viewBox="0 0 24 24" width="20" height="20"><path fill="currentColor" d="M12 6a9.8 9.8 0 0 1 9 6 9.8 9.8 0 0 1-9 6 9.8 9.8 0 0 1-9-6 9.8 9.8 0 0 1 9-6m0 2a4 4 0 1 0 0 8 4 4 0 0 0 0-8m0 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4" /></svg>`:Q`<svg viewBox="0 0 24 24" width="20" height="20"><path fill="currentColor" d="M2.4 3.8 3.8 2.4l17.8 17.8-1.4 1.4-3.3-3.3A10.5 10.5 0 0 1 12 19a9.8 9.8 0 0 1-9-6 10.3 10.3 0 0 1 3.6-4.3L2.4 3.8M12 7a4 4 0 0 1 4 4c0 .5-.1 1-.3 1.5l-5.2-5.2c.5-.2 1-.3 1.5-.3m-4 4a4 4 0 0 0 5.5 3.7l-5.2-5.2c-.2.5-.3 1-.3 1.5m4-7a9.8 9.8 0 0 1 9 6 10 10 0 0 1-2.6 3.6l-1.4-1.4A8 8 0 0 0 18.8 12 8 8 0 0 0 9.6 7.2L8 5.6A10.3 10.3 0 0 1 12 4" /></svg>`}
|
||||||
</button>`}renderSwipe(){let e=this._swipe;if(!e||!this.hass)return f;let t=e.kind==="light"&&e.value<=0;return m`<div class="nf-swipe" style="left:${e.x}px;top:${e.y}px">
|
</button>`}renderSwipe(){let e=this._swipe;if(!e||!this.hass)return f;let t=e.kind==="light"&&e.value<=0;return m`<div class="nf-swipe" style="left:${e.x}px;top:${e.y}px">
|
||||||
<span>${O(this.hass,e.entity)}</span>
|
<span>${O(this.hass,e.entity)}</span>
|
||||||
<b>${t?A(this.hass,"swipe_off"):`${e.value} %`}</b>
|
<b>${t?A(this.hass,"swipe_off"):`${e.value} %`}</b>
|
||||||
<i><em style="height:${e.value}%"></em></i>
|
<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?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>`}tapPlate(e,t,n){let o=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),i=o?xo(o.gang_entities,Z(o.type)?.gangs??0):[];if(i.length===1)return this.onDeviceTap(i[0],t,n);i.length>1&&(this._plate={ids:i,x:t,y:n})}renderPlate(){let e=this._plate;if(!e||!this.hass)return f;let t=this.hass,n=()=>this._plate=null;return m`<div class="nf-menu-backdrop" @click=${n}></div>
|
||||||
<div 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">
|
<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>${O(t,o)}</span><i>${s?te(t,s):"\u2013"}</i></button>`})}
|
${e.ids.map((o,i)=>{let s=t.states[o],a=J(s)||s?.state==="on";return m`<button role="menuitem" class=${a?"on":""} @click=${()=>{n(),this.onDeviceTap(o,e.x,e.y)}}><b>${i+1}</b><span>${O(t,o)}</span><i>${s?te(t,s):"\u2013"}</i></button>`})}
|
||||||
</div>`}renderMenu(){let e=this._menu;if(!e||!this.hass)return f;let t=this.renderRoot.querySelector(".nf-stage"),n=t?.clientWidth??800,o=t?.clientHeight??600,i=Math.max(8,Math.min(n-240,e.x-116)),s=Math.max(8,Math.min(o-360,e.y-170));return m`<div class="nf-menu-backdrop" @click=${()=>this._menu=null}></div>
|
</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
|
<nf-quick-menu
|
||||||
style="left:${i}px;top:${s}px"
|
style="left:${i}px;top:${s}px"
|
||||||
@@ -1667,10 +1667,10 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
.myPosition=${this.myPositionOf(e.entity)}
|
.myPosition=${this.myPositionOf(e.entity)}
|
||||||
.tiltEntity=${tr(this.hass,this.building?.floors??[],e.entity)}
|
.tiltEntity=${tr(this.hass,this.building?.floors??[],e.entity)}
|
||||||
@close=${()=>this._menu=null}
|
@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&&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()}>
|
></nf-quick-menu>`}myPositionOf(e){for(let t of this.building?.floors??[])for(let n of t.openings){let o=this.openingLinks?.get(n.id);if(n.my_position!=null&&(o?.cover===e||o?.cover2===e))return n.my_position}return null}onDeviceTap(e,t=0,n=0){if(e.startsWith("lamp:")||this._travel)return;let o=e.startsWith("tap:")?e.slice(4):this.tapPins.get(e);if(o){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===o);s?.tap&&yo(this.hass,this,s.tap);return}if(this.pluginTapped(e))return;if(e.startsWith("gang:"))return this.tapPlate(e.slice(5),t,n);if(e.startsWith("outdoor:")){this.fire("room-tap",{floorId:null,roomId:"nf-outside"});return}if(e==="grid"){let s=this.building,a=s?s.energy.grid??Pe(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&fe(this,a);return}let i=F(e);if(i==="cover"||i==="media"){this._menu={entity:e,x:t,y:n};return}if(i==="lock"){let s=_o(this.hass,e),a=O(this.hass,e);confirm(A(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(i&&xs.has(i)){if(this.confirmSet.has(e)&&!confirm(A(this.hass,"confirm_switch",{name:O(this.hass,e)})))return;da(this.hass,e)}else fe(this,e)}pluginTapped(e){let t=this.hass?.states[e],n=this.placementInfo.get(e);if(!t||!n)return!1;let o=this.building?.floors.find(i=>i.id===n.floorId)?.placements.find(i=>i.entity_id===e);return ts({hass:this.hass,entityId:e,state:t},n,o?.plugin??void 0,{showWindow:(i,s)=>{i&&"hass"in i&&(i.hass=this.hass),this._pluginWindow=i?{node:i,title:s?.title??""}:null},moreInfo:i=>fe(this,i??e)})}renderPluginWindow(){let e=this._pluginWindow;return e?m`<div class="nf-plugin-window" @pointerdown=${t=>t.stopPropagation()}>
|
||||||
<div class="nf-pw-head"><span>${e.title}</span><button class="nf-pw-close" aria-label=${A(this.hass,"close")} @click=${()=>this._pluginWindow=null}>✕</button></div>
|
<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 class="nf-pw-body">${e.node}</div>
|
||||||
</div>`:f}startViewOf(){return this.startView??this.building?.settings.start_view??null}currentView(){return this.viewer?.currentView()??null}resetView(){this.viewer?.resetView()}fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}toggleFlows(){this._flows=!this._flows;try{localStorage.setItem("nextfloor.flows",this._flows?"1":"0")}catch{}this.syncDevices(!0)}liveHeatPumps(e){let t=this.hass;if(!t)return[];let n=[];for(let o of e.floors)for(let i of o.furniture){if(!uc(i.type))continue;let s=this.furnitureLinks?.get(i.id),a=cc(t,s?.entity??s?.power??null);a&&n.push({id:i.id,name:i.name||he(t,i.type),floorId:o.id,x:i.x,z:i.z,at:{floorId:o.id,x:i.x,z:i.z,y:ce(o,i)+i.h+.5},pump:a})}return n}livePrinters(e){let t=this.hass,n=[];if(!t)return n;for(let o of e.floors)for(let i of o.furniture){if(!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")}>
|
</div>`:f}startViewOf(){return this.startView??this.building?.settings.start_view??null}currentView(){return this.viewer?.currentView()??null}resetView(){this.viewer?.resetView()}fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}toggleFlows(){this._flows=!this._flows;try{localStorage.setItem("nextfloor.flows",this._flows?"1":"0")}catch{}this.syncDevices(!0)}liveHeatPumps(e){let t=this.hass;if(!t)return[];let n=[];for(let o of e.floors)for(let i of o.furniture){if(!uc(i.type))continue;let s=this.furnitureLinks?.get(i.id),a=cc(t,s?.entity??s?.power??null);a&&n.push({id:i.id,name:i.name||he(t,i.type),floorId:o.id,x:i.x,z:i.z,at:{floorId:o.id,x:i.x,z:i.z,y:ce(o,i)+i.h+.5},pump:a})}return n}livePrinters(e){let t=this.hass,n=[];if(!t)return n;for(let o of e.floors)for(let i of o.furniture){if(!ri(i.type))continue;let s=this.furnitureLinks?.get(i.id),a=ni(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||n.push({id:i.id,name:i.name||he(t,i.type),at:{floorId:o.id,x:i.x,z:i.z,y:ce(o,i)+i.h+.5},printer:a})}return n}liveCars(e,t){let n=[];for(let o of t.floors)for(let i of o.furniture){if(i.type!=="parking")continue;let s=fc(e,i);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=Ko(e,i),l=a?El(i,a):null,c=i.name||(a?he(e,a):he(e,i.type));n.push({spot:i.id,name:c,at:{floorId:o.id,x:i.x,z:i.z,y:ce(o,i)+(l?.h??.2)+.6},car:s})}return n}liveMedia(e,t){let n=[];for(let o of t.floors){for(let i of o.furniture){let s=this.furnitureLinks?.get(i.id)?.entity;s?.startsWith("media_player.")&&n.push({entity:s,name:i.name||he(e,i.type),at:{floorId:o.id,x:i.x,z:i.z,y:ce(o,i)+i.h+.15},rings:i.sound_rings})}for(let i of o.placements)i.entity_id.startsWith("media_player.")&&n.push({entity:i.entity_id,name:i.name||O(e,i.entity_id),at:{floorId:o.id,x:i.x,z:i.z,y:(i.y??1.1)+.15},rings:i.sound_rings})}return pl(e,n)}refreshToday(e){let t=this.hass,n=e.settings.calendars??[],o=Math.max(1,Math.min(7,e.settings.today_days??1)),i=`${new Date().toDateString()}|${o}`;!t||!n.length||Date.now()-this.todayAt<9e5&&i===this.todayDay||(this.todayAt=Date.now(),this.todayDay=i,oc(t,n,o).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,n=e.settings.forecast&&t?qe(t,this.weatherEntityId??e.settings.weather_entity):null;if(!t||!n)return;let o=`${n}|${new Date().toDateString()}`;Date.now()-this.forecastAt<18e5&&o===this.forecastKey||(this.forecastAt=Date.now(),this.forecastKey=o,ac(t,n).then(i=>this._forecast=i))}renderForecast(e){let t=this.building,n=this.hass,o=t?.settings.forecast;if(!t||!n||!o||o.corner!==e||this.clean)return f;if(e==="top_right"&&(this.roomId||this.panelOpen))return f;let i=sc(this._forecast,Math.max(1,Math.min(7,o.days)));if(!i.length)return f;let s=qe(n,this.weatherEntityId??t.settings.weather_entity),a=s?n.states[s]?.attributes:void 0,l=String(a?.temperature_unit??"\xB0"),c=String(a?.precipitation_unit??"mm"),u=n.language??navigator.language,h=new Intl.DateTimeFormat(u,{weekday:"short"}),p=d=>d===null?"\u2013":`${Math.round(d)}\xB0`;return m`<section class="nf-forecast" aria-label=${A(n,"forecast")}>
|
||||||
<ul>
|
<ul>
|
||||||
${i.map((d,_)=>m`<li>
|
${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-day">${_===0?A(n,"today"):h.format(new Date(d.day))}</span>
|
||||||
@@ -1697,12 +1697,12 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
<span>${A(this.hass,"holos")}</span><b>◫</b>
|
<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)}>
|
</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>
|
<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">
|
</button>`)}renderMapCredit(){let e=this.building?.settings.map;return Hl(e)?m`<a class="nf-map-credit" href=${Uo(e).href} target="_blank" rel="noopener">${Uo(e).text}</a>`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=at(new Date,this.hass?.config?.latitude??50),t=pr(this.heatMode,e),n=this.heatMode==="temperature",o=n?oe(this.hass,t.stops[0][0]):t.stops[0][0],i=n?oe(this.hass,t.stops[t.stops.length-1][0]):t.stops[t.stops.length-1][0],s=n?X(this.hass):t.unit,a=l=>A(this.hass,l);return m`<div class="nf-legend">
|
||||||
<b>${a(`heat_${this.heatMode}`)}${this.heatMode==="temperature"?m` <small>${a(e?"heat_summer":"heat_winter")}</small>`:f}</b>
|
<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:${ja(this.heatMode,e)}"></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>
|
<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>`}
|
${this.heatValues.size?f:m`<span class="nf-legend-none">${a("heat_none_found")}</span>`}
|
||||||
</div>`}renderWifiLegend(){let e=this.hass,t=this.building;if(!e||!t)return f;let n=(c,u)=>A(e,c,u),o=t.floors.flatMap(c=>c.furniture.filter(u=>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">
|
</div>`}renderWifiLegend(){let e=this.hass,t=this.building;if(!e||!t)return f;let n=(c,u)=>A(e,c,u),o=t.floors.flatMap(c=>c.furniture.filter(u=>oi(u.type)).map(u=>ii(e,this.furnitureLinks?.get(u.id)?.entity??this.furnitureLinks?.get(u.id)?.power??null))),s=o.filter(c=>!!c).reduce((c,u)=>c+(u.clients??0),0),a=t.floors.flatMap(c=>c.placements.map(u=>e.states[u.entity_id])),l=pc(a);return m`<div class="nf-legend">
|
||||||
<b>📶 ${n("heat_wifi")}</b>
|
<b>📶 ${n("heat_wifi")}</b>
|
||||||
<span>${n("wifi_aps",{n:o.length,clients:s})}</span>
|
<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.online+l.offline.length?m`<span>${n("wifi_network",{online:l.online,offline:l.offline.length})}</span>`:f}
|
||||||
@@ -3299,26 +3299,26 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
inset: auto 16px 16px;
|
inset: auto 16px 16px;
|
||||||
color: var(--nf-danger);
|
color: var(--nf-danger);
|
||||||
}
|
}
|
||||||
`]};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=6bcac3b155cd",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}
|
`]};customElements.get("nf-view3d")||customElements.define("nf-view3d",pi);function ae(r,e){return Math.abs(e)>=1e3?`${W(r,e/1e3,1)} kW`:`${Math.round(e)} W`}function hi(r){return r.type==="tv_board"?r.h+.9:r.type==="tv_wall"||r.type==="kitchen_wall"?r.h+.25:r.h+.35}function Tm(r,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:te(r,e)}var Hc;function Ic(){let r=new URL("./nextfloor-editor.js?v=dafe94a24af9",new URL(import.meta.url)).href;return Hc??=import(r),Hc}var Dm=.25,Cc=r=>Math.round(r*1e3)/1e3,Nc=(r,e,t)=>r.rooms.find(n=>n.points.length>=3&&H([e,t],n.points));function fi(r,e,t,n,o){let i=Nc(r,e,t);if(!i)return[n,o];let s=(a,l)=>H([a,l],i.points);return s(n,o)?[n,o]:s(n,t)?[n,t]:s(e,o)?[e,o]:[e,t]}function Fm(r,e,t,n){return r.rooms.some(o=>o.id!==e.id&&o.points.some((i,s)=>{let a=o.points[(s+1)%o.points.length];return Math.abs(ie(Y(i,t),n))<.02&&Math.abs(ie(Y(a,t),n))<.02}))}var mi=(r,e)=>Math.abs((r-e+540)%360-180);function Wc(r,e,t,n=Dm){let o=Nc(r,e.x,e.z);if(!o)return null;let i=o.points,s=rt(i)>=0?1:-1,a=null;return i.forEach((l,c)=>{let u=i[(c+1)%i.length],h=Fe(Y(u,l));if(h<.3)return;let p=[(u[0]-l[0])/h,(u[1]-l[1])/h],d=[-p[1]*s,p[0]*s],_=ie(Y([e.x,e.z],l),p);if(_<0||_>h)return;let b=Fm(r,o,l,d)?t/2:0,g=ie(Y([e.x,e.z],l),d)-b,v=Math.atan2(-d[0],d[1])*180/Math.PI,k=[{rotation:v,extent:e.d/2},{rotation:v+90,extent:e.w/2},{rotation:v-90,extent:e.w/2}].reduce((z,E)=>mi(e.rotation,E.rotation)<mi(e.rotation,z.rotation)?E:z);if(mi(e.rotation,k.rotation)>50)return;let y=g-k.extent;Math.abs(y)>n||a&&Math.abs(y)>=Math.abs(a.gap)||(a={x:Cc(e.x-d[0]*y),z:Cc(e.z-d[1]*y),rotation:(Math.round(k.rotation)%360+360)%360,gap:y})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function Pr(r,e,t){let n=structuredClone(r);for(let o of n.floors){let i=o.furniture.find(s=>s.id===e);i&&t(i,o)}return n}function Hr(r,e,t){let n=structuredClone(r);for(let o of n.floors){let i=o.placements.find(s=>s.entity_id===e);i&&t(i,o)}return n}function Oc(r,e){let t=structuredClone(r);for(let n of t.floors)n.furniture=n.furniture.filter(o=>o.id!==e);return t}function Lc(r,e){let t=structuredClone(r);for(let n of t.floors)n.placements=n.placements.filter(o=>o.entity_id!==e);return t}function Bc(r,e,t,n){return Hr(r,e,(o,i)=>{[o.x,o.z]=fi(i,o.x,o.z,t,n)})}function Vc(r,e,t,n){let o=r.settings.wall_interior??.12;return Pr(r,e,(i,s)=>{[i.x,i.z]=fi(s,i.x,i.z,t,n);let a=Wc(s,i,o);a&&Object.assign(i,a)})}var gi=(r,e)=>((r+e)%360+360)%360,Kc=r=>Number.parseFloat(r.replace(",",".")),kn=(r,e)=>Math.round(r*10**e)/10**e;function _i(r){let{min:e,max:t,accepts:n=()=>!0}=r,o=i=>{let s=Kc(i.target.value);!Number.isFinite(s)||!n(s)||r.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return m`<label class="nf-size" title=${r.title}
|
||||||
>${r.label}
|
>${r.label}
|
||||||
<input type="number" inputmode="decimal" step=${r.step} min=${e} max=${t??f} .value=${String(kn(r.value,2))} @change=${o} />
|
<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))})}
|
</label>`}var Uc=(r,e)=>m`<button class="nf-chip" @click=${e}>${r.t("height_auto")}</button>`,Gc=(r,e)=>m`<button class="nf-chip" @click=${()=>e(-r)}>↺ ${r}°</button><button class="nf-chip" @click=${()=>e(r)}>↻ ${r}°</button>`;function Pm(r,e){let t=r.building.floors.find(s=>s.furniture.some(a=>a.id===e)),n=t?.furniture.find(s=>s.id===e);if(!t||!n)return f;let o=(s,a)=>_i({label:r.t(a),title:r.t(`size_${s}`),value:n[s],step:.05,min:.05,accepts:l=>l>0,apply:l=>r.editFurniture(e,c=>c[s]=kn(l,3))}),i=_s(n)?m`${_i({label:"\u2195",title:r.t("mount_height"),value:n.mount_y??ce(t,n),step:.05,min:0,accepts:s=>s>=0,apply:s=>r.editFurniture(e,a=>a.mount_y=kn(s,3))})}
|
||||||
${n.mount_y!=null?Uc(r,()=>r.editFurniture(e,s=>s.mount_y=null)):f}`:f;return m`${o("w","size_short_w")}${o("d","size_short_d")}${o("h","size_short_h")} ${i}`}function Hm(r,e){let t=r.building.floors.find(l=>l.placements.some(c=>c.entity_id===e)),n=t?.placements.find(l=>l.entity_id===e);if(!t||!n)return f;let o=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}))}>
|
${n.mount_y!=null?Uc(r,()=>r.editFurniture(e,s=>s.mount_y=null)):f}`:f;return m`${o("w","size_short_w")}${o("d","size_short_d")}${o("h","size_short_h")} ${i}`}function Hm(r,e){let t=r.building.floors.find(l=>l.placements.some(c=>c.entity_id===e)),n=t?.placements.find(l=>l.entity_id===e);if(!t||!n)return f;let o=F(e),i=(l,c,u)=>m`<select class="nf-size-select" title=${r.t(l)} @change=${h=>r.editDevice(e,p=>Object.assign(p,{mount:h.target.value,y:null}))}>
|
||||||
${c.map(([h,p])=>m`<option value=${h} ?selected=${h===u}>${p}</option>`)}
|
${c.map(([h,p])=>m`<option value=${h} ?selected=${h===u}>${p}</option>`)}
|
||||||
</select>`,s=["ceiling","floor","table","wall"].map(l=>[l,r.t(`lamp_${l}`)]),a=o?yt(o,me(t,n.x,n.z),o==="light"?n.mount??"ceiling":null):1;return m`${o==="light"?i("lamp_mount",s,n.mount??"ceiling"):f}
|
</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))})}
|
${_i({label:r.t("size_short_h"),title:r.t("marker_height"),value:n.y??a,step:.05,min:0,accepts:l=>l>=0,apply:l=>r.editDevice(e,c=>c.y=kn(l,3))})}
|
||||||
${n.y!==null?Uc(r,()=>r.editDevice(e,l=>l.y=null)):f}`}function jc(r,e,t){let n=r.t,o;if(e){let i=r.building.floors.flatMap(s=>s.furniture).find(s=>s.id===e)?.type;o=m`<span>${i?he(r.hass,i):""}</span>
|
${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))}
|
${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" title=${n("furn_mirror_hint")} @click=${()=>r.editFurniture(e,s=>s.mirror=!s.mirror)}>⇋ ${n("furn_mirror")}</button>
|
||||||
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeFurniture(e)}>${n("delete")}</button>`}else t?o=m`<span>${O(r.hass,t)}</span>
|
<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))}
|
${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">
|
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeDevice(t)}>${n("delete")}</button>`:o=m`<span>${n("furnish_hint")}</span>`;return m`<div class="nf-furnish-bar">${o}<button class="nf-chip nf-chip-on" @click=${()=>r.finish()}>${n("done")}</button></div>`}var qc=Q`<svg class="nf-mark" viewBox="60 40 392 420" aria-hidden="true">
|
||||||
<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,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,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,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"/>
|
<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"/>
|
<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"}),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`
|
</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}),bi={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(bi)){let o=bi[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=bi[e];try{this.storage?.setItem(`nextfloor.${n.name}`,n.write(t))}catch{}}};var Jc=ne`
|
||||||
.nf-dot {
|
.nf-dot {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 8px;
|
width: 8px;
|
||||||
@@ -3803,11 +3803,11 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
gap: 12px;
|
gap: 12px;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
`;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>
|
`;var Qc=new WeakMap,Xc=new WeakMap;function dt(r,e){let t=Xc.get(r)??r,n=Qc.get(t)??new WeakMap;Qc.set(t,n);let o=n.get(e);if(o)return o;let i=new Map;for(let l of e)for(let c of l.placements)c.entity_id.startsWith("cover.")&&i.set(c.entity_id,{tilt:c.cover_tilt==="none"?null:c.cover_tilt,position:c.position});for(let l of Re(t,e).values())l.cover&&!i.has(l.cover)&&i.set(l.cover,{tilt:l.coverTilt,position:l.position}),l.cover2&&!i.has(l.cover2)&&i.set(l.cover2,{tilt:l.cover2Tilt});let s={...t.states};for(let[l,c]of i){let u=t.states[l];if(!u)continue;let h={...u.attributes,nf_cover_control:!0},p=xt(t,c.position);p===null&&(p=typeof u.attributes.current_position=="number"?u.attributes.current_position:null),p!==null&&(h.current_position=p);let d=c.tilt?t.states[c.tilt]:u,_=typeof d?.attributes.current_tilt_position=="number"?d.attributes.current_tilt_position:c.tilt?xt(t,c.tilt):null;_!==null&&(h.current_tilt_position=_,h.supported_features=Number(h.supported_features??0)|128);let b=u.state;typeof h.current_position=="number"&&b!=="unavailable"&&b!=="unknown"&&b!=="opening"&&b!=="closing"&&(b=h.current_position>0?"open":"closed"),s[l]={...u,state:b,attributes:h}}let a={...t,states:s,callService:async(l,c,u={})=>{if(l!=="cover")return t.callService(l,c,u);let h=Array.isArray(u.entity_id)?u.entity_id:[u.entity_id],p=async d=>{let _=typeof d=="string"?i.get(d):void 0;if(!_)return t.callService(l,c,{...u,entity_id:d});let b={...u,entity_id:d},g=c;(g==="toggle"||g==="toggle_cover")&&(g=s[String(d)]?.state==="closed"?"open_cover":"close_cover");let v=g.includes("tilt");v&&_.tilt&&(b.entity_id=_.tilt);let S=_.tilt?t.states[_.tilt]:void 0;return v&&_.tilt&&!S?.attributes.symcon_id&&typeof S?.attributes.current_tilt_position!="number"&&(g==="set_cover_tilt_position"?(g="set_cover_position",b.position=b.tilt_position,delete b.tilt_position):g==="open_cover_tilt"?g="open_cover":g==="close_cover_tilt"&&(g="close_cover")),t.callService(l,g,b)};return Array.isArray(u.entity_id)?Promise.all(h.map(p)):p(h[0])}};return Xc.set(a,t),n.set(e,a),a}var vi=class extends re{static properties={hass:{attribute:!1},narrow:{type:Boolean},route:{attribute:!1},panel:{attribute:!1},_mode:{state:!0},_editorReady:{state:!0},_floorId:{state:!0},_roomId:{state:!0},_wallMode:{state:!0},_prefs:{state:!0},_furnish:{state:!0},_selFurniture:{state:!0},_selDevice:{state:!0},_optsOpen:{state:!0},_switchesOpen:{state:!0},_timeOfDay:{state:!0},_outside:{state:!0},_timeDrag:{state:!0},_floorUndo:{state:!0},_variablesLoading:{state:!0},_variablesNotice:{state:!0},_variablesError:{state:!0}};outsideMemo=null;floorUndoTimer;data=new wt(this);store=new Ir(Cr());constructor(){super(),this.narrow=!1,this._mode="view",this._editorReady=!!customElements.get("nf-editor"),this._floorId=null,this._roomId=null,this._wallMode="auto",this._prefs=this.store.load(location.search),this._furnish=!1,this._selFurniture=null,this._selDevice=null,this._optsOpen=!1,this._switchesOpen=!1,this._timeOfDay=null,this._outside=!1,this._timeDrag=null,this._floorUndo=null,this._variablesLoading=!1,this._variablesNotice="",this._variablesError=!1}toggleTimeSlider(e){this.setPref("timeSlider",e),e||([this._timeOfDay,this._timeDrag]=[null,null])}sunState(){let e=this.hass?.config;return this._timeOfDay===null||e?.latitude===void 0||e.longitude===void 0?this.hass?.states["sun.sun"]?.state:nt(ft(this._timeOfDay,e.time_zone),e.latitude,e.longitude).elevation>0?"above_horizon":"below_horizon"}renderTimeOfDay(){let e=this.t;if(this.hass?.config?.latitude===void 0)return f;let t=this._timeDrag??this._timeOfDay,n=i=>`${String(Math.floor(i)).padStart(2,"0")}:${String(Math.round(i%1*60)).padStart(2,"0")}`,o=()=>{let i=new Date;return Math.round((i.getHours()+i.getMinutes()/60)*4)/4};return m`<button class="nf-chip" aria-pressed=${t!==null} title=${e("time_of_day_hint")} @click=${()=>(this._timeDrag=null,this._timeOfDay=t===null?o():null)}>☀ ${t===null?e("time_of_day"):n(t)}</button>
|
||||||
${t!==null?m`<label class="nf-chip nf-time-slider"
|
${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)}
|
><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))}
|
@change=${i=>(this._timeDrag=null,this._timeOfDay=Number(i.target.value))}
|
||||||
/></label>`:f}`}t=(e,t)=>A(this.hass,e,t);setPref(e,t){this._prefs={...this._prefs,[e]:t},this.store.save(e,t)}willUpdate(e){this.toggleAttribute("readable",!!this._prefs?.readable),e.has("hass")&&this.hass&&(this.style.colorScheme=_r(this.hass),this.data.setHass(this.hass));let t=this.data.building;t&&this._floorId&&!t.floors.some(n=>n.id===this._floorId)&&(this._floorId=null,this._roomId=null)}get isAdmin(){return this.hass?.user?.is_admin??!1}setMode(e){e!==this._mode&&(e==="view"&&this.data.flush(),this._mode=e)}openFloor(e){this._floorId=e,this._roomId=null,this._outside=!1}outsideIds(e){let t=this.outsideMemo;if(t&&t.building===e&&t.entities===this.hass.entities)return t.ids;let n=Jt(this.hass,e.floors,e.settings.outside_hidden);return this.outsideMemo={building:e,entities:this.hass.entities,ids:n},n}openOutside(){let e=!this._outside;this.openFloor(null),this._outside=e}onRoomTap(e){let{floorId:t,roomId:n}=e.detail;if(n==="nf-outside")return this.openOutside();if((this.data.building?.floors.length??0)>1&&t&&this._floorId!==t)return this.openFloor(t);n&&(this._roomId=n===this._roomId?null:n,this._outside=!1)}furnishHost={hass:void 0,building:void 0,t:this.t,editFurniture:(e,t)=>this.applyEdit(n=>Pr(n,e,t)),editDevice:(e,t)=>this.applyEdit(n=>Hr(n,e,t)),turnFurniture:(e,t)=>this.applyEdit(n=>Pr(n,e,o=>o.rotation=_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}`:""}>
|
/></label>`:f}`}t=(e,t)=>A(this.hass,e,t);setPref(e,t){this._prefs={...this._prefs,[e]:t},this.store.save(e,t)}willUpdate(e){this.toggleAttribute("readable",!!this._prefs?.readable),e.has("hass")&&this.hass&&(this.style.colorScheme=_r(this.hass),this.data.setHass(this.hass));let t=this.data.building;t&&this._floorId&&!t.floors.some(n=>n.id===this._floorId)&&(this._floorId=null,this._roomId=null)}get isAdmin(){return this.hass?.user?.is_admin??!1}setMode(e){e!==this._mode&&(e==="view"&&this.data.flush(),this._mode=e)}openFloor(e){this._floorId=e,this._roomId=null,this._outside=!1}outsideIds(e){let t=this.outsideMemo;if(t&&t.building===e&&t.entities===this.hass.entities)return t.ids;let n=Jt(this.hass,e.floors,e.settings.outside_hidden);return this.outsideMemo={building:e,entities:this.hass.entities,ids:n},n}openOutside(){let e=!this._outside;this.openFloor(null),this._outside=e}onRoomTap(e){let{floorId:t,roomId:n}=e.detail;if(n==="nf-outside")return this.openOutside();if((this.data.building?.floors.length??0)>1&&t&&this._floorId!==t)return this.openFloor(t);n&&(this._roomId=n===this._roomId?null:n,this._outside=!1)}furnishHost={hass:void 0,building:void 0,t:this.t,editFurniture:(e,t)=>this.applyEdit(n=>Pr(n,e,t)),editDevice:(e,t)=>this.applyEdit(n=>Hr(n,e,t)),turnFurniture:(e,t)=>this.applyEdit(n=>Pr(n,e,o=>o.rotation=gi(o.rotation,t))),turnDevice:(e,t)=>this.applyEdit(n=>Hr(n,e,o=>o.rotation=gi(o.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>Oc(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>Lc(t,e)),this._selDevice=null},finish:()=>{this._furnish=!1,this._selFurniture=null,this._selDevice=null}};saveMoods(e,t){this.applyEdit(n=>({...n,floors:n.floors.map(o=>({...o,rooms:o.rooms.map(i=>i.id===e?{...i,moods:t.length?t:void 0}:i)}))}))}applyEdit(e){let t=this.data.building;t&&this.data.edit(e(t))}view3d(){return this.renderRoot.querySelector("nf-view3d")}back(){this._outside?this._outside=!1:this._roomId?this._roomId=null:this._floorId&&(this.data.building?.floors.length??0)>1?this._floorId=null:this.view3d()?.resetView()}onKey=e=>{e.key!=="Escape"||this._mode!=="view"||(this._prefs.clean?this.setPref("clean",!1):this.back())};connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this.onKey)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.onKey)}render(){if(this.hass&&or(this.hass,this))return f;let e=this.data.building,t=this._prefs.clean&&this._mode==="view",n=f;return e&&(this._mode==="editor"&&this.isAdmin?n=this.renderEditor(e):this._mode==="extensions"&&this.isAdmin?n=this.renderExtensions():n=this.renderView(e)),m`<div class="nf-app ${t?"nf-clean":""}" style=${this._prefs.accent?`--nf-accent:${this._prefs.accent}`:""}>
|
||||||
${t?f:m`${this.renderHeader(e)}${this.renderNotices()}`}
|
${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}
|
${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}
|
${!e&&!this.data.error?m`<p class="nf-message">${this.t("loading")}</p>`:f}
|
||||||
@@ -3996,7 +3996,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
${t.clean?f:this.renderOverlay(e)}
|
${t.clean?f:this.renderOverlay(e)}
|
||||||
${this._furnish?jc(this.furnishHost,this._selFurniture,this._selDevice):f}
|
${this._furnish?jc(this.furnishHost,this._selFurniture,this._selDevice):f}
|
||||||
</div>
|
</div>
|
||||||
`}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`
|
`}static styles=[$e,Ue,Jc,gr]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",vi);var Im=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,eu=(r,e)=>Number(r)*60+Number(e);function Sn(r,e,t=new Date){if(!r||r==="off")return!1;if(r==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let n=Im.exec(r.trim());if(!n)return!1;let o=eu(n[1],n[2]),i=eu(n[3],n[4]),s=t.getHours()*60+t.getMinutes();return o>i?s>=o||s<i:s>=o&&s<i}var Nr=class{host;cleanTimer;idleTimer;nightTimer;constructor(e){this.host=e}armClean(e=!1){clearTimeout(this.cleanTimer);let t=this.host.config()?.controls_hide_after??0;t>0&&(e&&this.host.isClean()&&this.host.setClean(!1),this.cleanTimer=setTimeout(()=>this.host.setClean(!0),t*1e3))}stopClean(){clearTimeout(this.cleanTimer)}armIdle(){clearTimeout(this.idleTimer);let e=this.host.config()?.idle_return??0;e>0&&(this.idleTimer=setTimeout(()=>this.host.goHome(),e*1e3))}touched(){this.host.isOrbit()&&this.host.setOrbit(!1),this.armIdle(),this.armClean(!0)}start(){this.armIdle(),this.nightTimer=setInterval(()=>this.host.setNight(Sn(this.host.config()?.night,this.host.hass())),6e4)}stop(){clearTimeout(this.cleanTimer),clearTimeout(this.idleTimer),clearInterval(this.nightTimer)}};function tu(r,e){return r?r.floors.filter(t=>(e===null||t.id===e)&&t.rooms.length>0).map(t=>({floorId:t.id,floorName:t.name,rooms:t.rooms.map(n=>({id:n.id,name:n.name||"\u2013",floorId:t.id}))})):[]}var nu=ne`
|
||||||
ha-card {
|
ha-card {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
background: var(--nf-bg);
|
background: var(--nf-bg);
|
||||||
@@ -4120,7 +4120,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;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">
|
`;function wi(r,e){let t=r.template,n=t?e?.[t]:void 0;if(!n)return r;let{type:o,template:i,...s}=n;return{...s,...r}}function ru(r,e){let t=new Set(e),n=[];for(let i of r.floors){let s=i.rooms.filter(c=>t.has(c.id));if(!s.length)continue;let a=(c,u)=>s.some(h=>h.points.length>=3&&H([c,u],h.points)),l=new Set(s.map(c=>c.id));n.push({...i,rooms:s,openings:i.openings.filter(c=>l.has(c.room_id)),furniture:i.furniture.filter(c=>a(c.x,c.z)),placements:i.placements.filter(c=>a(c.x,c.z)),walls:(i.walls??[]).filter(c=>a((c.a[0]+c.b[0])/2,(c.a[1]+c.b[1])/2)),outdoor:[]})}let o={...r.settings.roof,type:"none",sections:[],solar:[]};return{...r,floors:n,settings:{...r.settings,roof:o}}}var Ct="nf-outside",yi=class extends re{static properties={hass:{attribute:!1},_config:{state:!0},_roomId:{state:!0},_floorId:{state:!0},_walls:{state:!0},_heat:{state:!0},_explode:{state:!0},_fullscreen:{state:!0},_clean:{state:!0},_night:{state:!0},_orbit:{state:!0}};_own=null;templatesSeen;roomApplied=!1;data=new wt(this);kiosk=new Nr({config:()=>this._config,hass:()=>this.hass,setClean:e=>this._clean=e,isClean:()=>this._clean,setOrbit:e=>this._orbit=e,isOrbit:()=>this._orbit,setNight:e=>this._night=e,goHome:()=>this.returnHome()});constructor(){super(),this._roomId=null,this._floorId=void 0,this._walls=null,this._heat=null,this._explode=null,this._fullscreen=!1,this._clean=!1,this._night=!1,this._orbit=!1}view3d(){return this.shadowRoot?.querySelector("nf-view3d")}returnHome(){this._roomId=this._config?.room??null,this._floorId=void 0,this.view3d()?.resetView(),this._config?.idle_orbit&&(this._orbit=!0)}openDashboard(e){history.pushState(null,"",e),window.dispatchEvent(new CustomEvent("location-changed",{bubbles:!0,composed:!0,detail:{replace:!1}}))}onFullscreen=()=>this._fullscreen=!!document.fullscreenElement&&this.shadowRoot?.contains(document.fullscreenElement)===!0;connectedCallback(){super.connectedCallback(),document.addEventListener("fullscreenchange",this.onFullscreen),this.kiosk.start()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("fullscreenchange",this.onFullscreen),this.kiosk.stop()}toggleFullscreen(){document.fullscreenElement?document.exitFullscreen():this.shadowRoot?.querySelector("ha-card")?.requestFullscreen?.()}static async getConfigElement(){return await Rn(),document.createElement("nextfloor-card-editor")}static getStubConfig(){return{type:"custom:nextfloor-card"}}setConfig(e){if(e.height!==void 0&&!(e.height>100))throw new Error("height must be a number of pixels above 100");this._own=e,this._config=wi(e,this.data.building?.settings.card_templates),this._floorId=void 0,this._walls=null,this._heat=null,this._explode=null,this._orbit=!1,this._night=Sn(e.night,this.hass),this._clean=e.controls_hidden===!0,this.kiosk.armClean(),this.kiosk.armIdle()}getCardSize(){return Math.ceil((this._config?.height??420)/50)}getGridOptions(){return{columns:"full",rows:this._config?.fill?12:Math.ceil((this._config?.height??420)/56),min_rows:4}}willUpdate(e){let t=this.data.building?.settings.card_templates;if(this._own?.template&&t!==this.templatesSeen&&(this.templatesSeen=t,this._config=wi(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=_r(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let n=Sn(this._config?.night,this.hass);n!==this._night&&(this._night=n)}get canSwitch(){return!this._config?.floor||this.thumbs}get thumbs(){return this._config?.floor_thumbs??!this._config?.floor}back(){this._roomId?this._roomId=null:this.canSwitch&&(this._floorId=null)}roomsMemo=null;plan(){let e=this.data.building??null,t=this._config?.rooms;if(!e||!t?.length)return e;let n=t.join(",");return(!this.roomsMemo||this.roomsMemo.source!==e||this.roomsMemo.ids!==n)&&(this.roomsMemo={source:e,ids:n,result:ru(e,t)}),this.roomsMemo.result}t=e=>A(this.hass,e);stage(){let e=this.plan(),t=this._config,n=this._floorId===void 0?t?.floor??null:this._floorId,o=e&&e.floors.length===1?e.floors[0].id:e?.floors.some(a=>a.id===n)?n:null,i=!!this._roomId&&t?.room_panel!==!1,s=!!this._roomId&&t?.room_panel===!1||!this.thumbs&&this.canSwitch&&!this._roomId&&!!o&&(e?.floors.length??0)>1;return{floorId:o,walls:this._walls??t?.walls??"auto",heat:this._heat??t?.heatmap??"none",explode:this._explode??t?.explode??!0,canGoBack:s,showBar:!!e&&!this._clean&&(s||!!t?.controls&&!i)}}shows(e){let t=this._config?.controls;return t===!0||Array.isArray(t)&&t.includes(e)}renderBar(e){let t=this.plan(),n=this.t,o=["temperature","humidity","co2"].filter(s=>this.shows(s)),i=(s,a)=>m`<div class="nf-seg" role=${s?"group":f} aria-label=${s??f}>${a.map(([l,c,u])=>m`<button aria-pressed=${l} @click=${c}>${u}</button>`)}</div>`;return m`<div class="nf-card-controls">
|
||||||
${e.canGoBack?m`<button class="nf-chip" @click=${()=>this.back()}>${n("back")}</button>`:f}
|
${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("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}
|
${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}
|
||||||
@@ -4214,7 +4214,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
${n.showBar&&e?this.renderBar(n):f}
|
${n.showBar&&e?this.renderBar(n):f}
|
||||||
${this.renderCorners()}
|
${this.renderCorners()}
|
||||||
</div>
|
</div>
|
||||||
</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();
|
</ha-card>`}static styles=[$e,Ue,nu,gr]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",yi);let r=window;r.customCards=r.customCards??[],r.customCards.push({type:"nextfloor-card",name:A(void 0,"card_name"),description:A(void 0,"card_description"),preview:!1})}ro();
|
||||||
/*! Bundled license information:
|
/*! Bundled license information:
|
||||||
|
|
||||||
@lit/reactive-element/css-tag.js:
|
@lit/reactive-element/css-tag.js:
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { iconPath } from "../../../icons.ts";
|
|||||||
import { ceilingAt, FURNITURE_TYPES, isLamp, type LampMount, type Placement } from "../../../model.ts";
|
import { ceilingAt, FURNITURE_TYPES, isLamp, type LampMount, type Placement } from "../../../model.ts";
|
||||||
import { packItemLabel, packLabel } from "../../../furniture-names.ts";
|
import { packItemLabel, packLabel } from "../../../furniture-names.ts";
|
||||||
import { isClimateFurniture, isElectric, isPackType, packType, type FurniturePack } from "../../../packs.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 { checkField, deviceIcon, entityField, glowField, hint, iconField, markerField, pinShiftField, numberField, selectField, textField } from "../fields.ts";
|
||||||
import { entityOptions } from "../entities.ts";
|
import { entityOptions } from "../entities.ts";
|
||||||
import { isPositionVariable } from "../../../entities/position-value.ts";
|
import { isPositionVariable } from "../../../entities/position-value.ts";
|
||||||
import { renderDeviceValues } from "../device-values.ts";
|
import { renderDeviceValues } from "../device-values.ts";
|
||||||
@@ -104,7 +104,8 @@ export function renderDeviceForm(host: EditorHost, placed: Placement, actions: D
|
|||||||
${checkField(host, t("cover_direction_invert"), !!placed.cover_inverted, (on) => set({ cover_inverted: on || undefined }))}
|
${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 }))}
|
${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 }))}
|
${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}
|
${placed.position ? checkField(host, t("cover_position_invert"), !!placed.position_inverted, (on) => set({ position_inverted: on || undefined })) : nothing}
|
||||||
|
${hint(t("cover_direction_hint"), "nf-wide")}` : 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 ? 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}
|
${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}
|
${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}
|
||||||
|
|||||||
@@ -185,6 +185,7 @@ function blindFields(host: EditorHost, o: Opening, actions: OpeningActions, list
|
|||||||
${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" ? 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}
|
${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)}
|
${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("cover_direction_hint"), "nf-wide")}
|
||||||
${hint(t("blind_hint"), "nf-wide")}`
|
${hint(t("blind_hint"), "nf-wide")}`
|
||||||
: nothing}`;
|
: nothing}`;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { box, entity, floorWith, hassOf, opening } from "./fixtures.ts";
|
|||||||
import { openingEntities, openingState } from "./openings.ts";
|
import { openingEntities, openingState } from "./openings.ts";
|
||||||
import { isPositionVariable, positionPercent } from "./position-value.ts";
|
import { isPositionVariable, positionPercent } from "./position-value.ts";
|
||||||
import { withCoverControls } from "./cover-controls.ts";
|
import { withCoverControls } from "./cover-controls.ts";
|
||||||
|
import { stateText } from "../markers.ts";
|
||||||
|
|
||||||
test("Symcon position feedback accepts numeric actuator domains and respects native integer/float ranges", () => {
|
test("Symcon position feedback accepts numeric actuator domains and respects native integer/float ranges", () => {
|
||||||
const h = hassOf([
|
const h = hassOf([
|
||||||
@@ -20,39 +21,92 @@ test("Symcon position feedback accepts numeric actuator domains and respects nat
|
|||||||
assert.equal(positionPercent(h, "cover.one"), 1, "integer 1 is one percent, not a normalized float at full travel");
|
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 () => {
|
test("blind and slat inversions affect only 3D, retaining readings and slider, button and grouped command values", async () => {
|
||||||
for (const inverted of [false, true]) for (const tiltInverted of [false, true]) {
|
for (const inverted of [false, true]) for (const tiltInverted of [false, true]) {
|
||||||
const calls: unknown[] = [];
|
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 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 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]);
|
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_position, 40);
|
||||||
assert.equal(view.states["cover.height"].attributes.current_tilt_position, tiltInverted ? 70 : 30);
|
assert.equal(view.states["cover.height"].attributes.current_tilt_position, 30);
|
||||||
|
assert.equal(stateText(view, view.states["cover.height"]), "40 %");
|
||||||
const links = openingEntities(raw, [floor]).get("w")!;
|
const links = openingEntities(raw, [floor]).get("w")!;
|
||||||
const fromRaw = openingState(raw, links), fromView = openingState(view, links);
|
const fromRaw = openingState(raw, links), fromView = openingState(view, links);
|
||||||
|
assert.ok(Math.abs(fromView.cover! - (inverted ? 0.4 : 0.6)) < 1e-9);
|
||||||
|
assert.equal(fromView.slats, tiltInverted ? 0.7 : 0.3);
|
||||||
assert.equal(fromRaw.cover, fromView.cover, "3D feedback cannot be inverted twice");
|
assert.equal(fromRaw.cover, fromView.cover, "3D feedback cannot be inverted twice");
|
||||||
assert.equal(fromRaw.slats, fromView.slats);
|
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_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", "set_cover_tilt_position", { entity_id: "cover.height", tilt_position: 20 });
|
||||||
await view.callService("cover", "open_cover", { entity_id: ["cover.height", "cover.normal"] });
|
await view.callService("cover", "open_cover", { entity_id: ["cover.height", "cover.normal"] });
|
||||||
assert.deepEqual(calls, [
|
assert.deepEqual(calls, [
|
||||||
["cover", "set_cover_position", { entity_id: "cover.height", position: inverted ? 25 : 75 }],
|
["cover", "set_cover_position", { entity_id: "cover.height", position: 75 }],
|
||||||
["cover", "set_cover_tilt_position", { entity_id: "cover.slats", tilt_position: tiltInverted ? 80 : 20 }],
|
["cover", "set_cover_tilt_position", { entity_id: "cover.slats", tilt_position: 20 }],
|
||||||
["cover", inverted ? "close_cover" : "open_cover", { entity_id: "cover.height" }],
|
["cover", "open_cover", { entity_id: "cover.height" }],
|
||||||
["cover", "open_cover", { entity_id: "cover.normal" }],
|
["cover", "open_cover", { entity_id: "cover.normal" }],
|
||||||
]);
|
]);
|
||||||
assert.equal(raw.states["cover.height"].attributes.current_position, 5, "the native state remains unchanged");
|
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 () => {
|
test("standalone feedback inversion is visual only, including facade reuse and changed settings", async () => {
|
||||||
const raw = hassOf([entity("cover.height", "closed", { current_position: 0, current_tilt_position: 20 }), entity("sensor.feedback", "25", { unit_of_measurement: "%" })]);
|
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 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 floors = [floor];
|
||||||
const first = withCoverControls(raw, floors);
|
const first = withCoverControls(raw, floors);
|
||||||
assert.equal(first.states["cover.height"].attributes.current_position, 75);
|
assert.equal(first.states["cover.height"].attributes.current_position, 25);
|
||||||
assert.equal(first.states["cover.height"].attributes.current_tilt_position, 80);
|
assert.equal(first.states["cover.height"].attributes.current_tilt_position, 20);
|
||||||
assert.equal(withCoverControls(first, floors), first, "nested views cannot invert an already adapted facade again");
|
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 }] }]);
|
const next = withCoverControls(first, [{ ...floor, placements: [{ ...floor.placements[0], cover_inverted: true }] }]);
|
||||||
assert.equal(next.states["cover.height"].attributes.current_position, 25);
|
assert.equal(next.states["cover.height"].attributes.current_position, 25);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("zero and full travel stay unchanged in values and commands, while each blind half reverses only its geometry", async () => {
|
||||||
|
for (const value of [0, 100]) for (const inverted of [false, true]) for (const tiltInverted of [false, true]) {
|
||||||
|
const calls: unknown[] = [];
|
||||||
|
const raw = hassOf([
|
||||||
|
entity("cover.main", value ? "open" : "closed", { current_position: value, current_tilt_position: value, symcon_id: 1 }),
|
||||||
|
entity("cover.second", value ? "open" : "closed", { current_position: value, current_tilt_position: value, symcon_id: 2 }),
|
||||||
|
], {}, { callService: async (domain: string, service: string, data: unknown) => { calls.push([domain, service, data]); } });
|
||||||
|
const floors = [floorWith([box("r", 0, 0, 4, 4)], { openings: [opening("w", "r", "window", { cover: "cover.main", cover2: "cover.second", cover_inverted: inverted, cover_tilt_inverted: tiltInverted, cover2_inverted: inverted, cover2_tilt_inverted: tiltInverted })] })];
|
||||||
|
const controls = withCoverControls(raw, floors);
|
||||||
|
const visual = openingState(controls, openingEntities(controls, floors).get("w")!);
|
||||||
|
const fraction = value / 100;
|
||||||
|
assert.equal(visual.cover, inverted ? fraction : 1 - fraction);
|
||||||
|
assert.equal(visual.cover2, visual.cover);
|
||||||
|
assert.equal(visual.slats, tiltInverted ? 1 - fraction : fraction);
|
||||||
|
assert.equal(visual.slats2, visual.slats);
|
||||||
|
assert.equal(stateText(controls, controls.states["cover.main"]), `${value} %`);
|
||||||
|
for (const id of ["cover.main", "cover.second"]) {
|
||||||
|
assert.equal(controls.states[id].attributes.current_tilt_position, value);
|
||||||
|
await controls.callService("cover", "set_cover_position", { entity_id: id, position: value });
|
||||||
|
await controls.callService("cover", "set_cover_tilt_position", { entity_id: id, tilt_position: value });
|
||||||
|
await controls.callService("cover", "close_cover", { entity_id: id });
|
||||||
|
await controls.callService("cover", "open_cover_tilt", { entity_id: id });
|
||||||
|
await controls.callService("cover", "stop_cover", { entity_id: id });
|
||||||
|
}
|
||||||
|
assert.deepEqual(calls, ["cover.main", "cover.second"].flatMap((id) => [
|
||||||
|
["cover", "set_cover_position", { entity_id: id, position: value }],
|
||||||
|
["cover", "set_cover_tilt_position", { entity_id: id, tilt_position: value }],
|
||||||
|
["cover", "close_cover", { entity_id: id }],
|
||||||
|
["cover", "open_cover_tilt", { entity_id: id }],
|
||||||
|
["cover", "stop_cover", { entity_id: id }],
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test("a reversed feedback sensor changes only 3D, not the value shown on the cover", () => {
|
||||||
|
const raw = hassOf([entity("cover.main", "closed", { current_position: 0 }), entity("sensor.feedback", "0", { unit_of_measurement: "%" })]);
|
||||||
|
const floors = [floorWith([box("r", 0, 0, 4, 4)], { openings: [opening("w", "r", "window", { cover: "cover.main", position: "sensor.feedback", position_inverted: true })] })];
|
||||||
|
const controls = withCoverControls(raw, floors);
|
||||||
|
assert.equal(controls.states["cover.main"].attributes.current_position, 0);
|
||||||
|
assert.equal(stateText(controls, controls.states["cover.main"]), "0 %");
|
||||||
|
assert.equal(openingState(controls, openingEntities(controls, floors).get("w")!).cover, 0);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("unavailable slat feedback does not substitute the blind height in 3D", () => {
|
||||||
|
const raw = hassOf([entity("cover.main", "open", { current_position: 40 }), entity("cover.slats", "unavailable")]);
|
||||||
|
const floors = [floorWith([box("r", 0, 0, 4, 4)], { openings: [opening("w", "r", "window", { cover: "cover.main", cover_tilt: "cover.slats", cover_tilt_inverted: true })] })];
|
||||||
|
const controls = withCoverControls(raw, floors);
|
||||||
|
assert.equal(openingState(controls, openingEntities(controls, floors).get("w")!).slats, undefined);
|
||||||
|
});
|
||||||
@@ -1,20 +1,16 @@
|
|||||||
// Present a plan's cover wiring as one consistent logical direction to every view and command.
|
// Combine live cover feedback and separate slat controls without changing values or command direction.
|
||||||
import type { Floor } from "../model.ts";
|
import type { Floor } from "../model.ts";
|
||||||
import type { HassEntity, HomeAssistant } from "../types.ts";
|
import type { HassEntity, HomeAssistant } from "../types.ts";
|
||||||
import { openingEntities } from "./openings.ts";
|
import { openingEntities } from "./openings.ts";
|
||||||
import { positionPercent } from "./position-value.ts";
|
import { positionPercent } from "./position-value.ts";
|
||||||
|
|
||||||
interface Binding {
|
interface Binding {
|
||||||
inverted?: boolean;
|
|
||||||
tiltInverted?: boolean;
|
|
||||||
tilt?: string | null;
|
tilt?: string | null;
|
||||||
position?: string | null;
|
position?: string | null;
|
||||||
positionInverted?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const cache = new WeakMap<HomeAssistant, WeakMap<readonly Floor[], HomeAssistant>>();
|
const cache = new WeakMap<HomeAssistant, WeakMap<readonly Floor[], HomeAssistant>>();
|
||||||
const sources = new WeakMap<HomeAssistant, 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 {
|
export function withCoverControls(hass: HomeAssistant, floors: readonly Floor[]): HomeAssistant {
|
||||||
const raw = sources.get(hass) ?? hass;
|
const raw = sources.get(hass) ?? hass;
|
||||||
@@ -24,11 +20,11 @@ export function withCoverControls(hass: HomeAssistant, floors: readonly Floor[])
|
|||||||
if (existing) return existing;
|
if (existing) return existing;
|
||||||
const bindings = new Map<string, Binding>();
|
const bindings = new Map<string, Binding>();
|
||||||
for (const f of floors) for (const p of f.placements) if (p.entity_id.startsWith("cover.")) {
|
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 });
|
bindings.set(p.entity_id, { tilt: p.cover_tilt === "none" ? null : p.cover_tilt, position: p.position });
|
||||||
}
|
}
|
||||||
for (const e of openingEntities(raw, floors).values()) {
|
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.cover && !bindings.has(e.cover)) bindings.set(e.cover, { tilt: e.coverTilt, position: e.position });
|
||||||
if (e.cover2 && !bindings.has(e.cover2)) bindings.set(e.cover2, { inverted: e.cover2Inverted, tiltInverted: e.cover2TiltInverted, tilt: e.cover2Tilt });
|
if (e.cover2 && !bindings.has(e.cover2)) bindings.set(e.cover2, { tilt: e.cover2Tilt });
|
||||||
}
|
}
|
||||||
const states = { ...raw.states };
|
const states = { ...raw.states };
|
||||||
for (const [id, b] of bindings) {
|
for (const [id, b] of bindings) {
|
||||||
@@ -36,18 +32,15 @@ export function withCoverControls(hass: HomeAssistant, floors: readonly Floor[])
|
|||||||
if (!st) continue;
|
if (!st) continue;
|
||||||
const a: Record<string, unknown> = { ...st.attributes, nf_cover_control: true };
|
const a: Record<string, unknown> = { ...st.attributes, nf_cover_control: true };
|
||||||
let position = positionPercent(raw, b.position);
|
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) position = typeof st.attributes.current_position === "number" ? st.attributes.current_position : null;
|
||||||
if (position !== null) a.current_position = b.inverted ? 100 - position : position;
|
if (position !== null) a.current_position = position;
|
||||||
const tiltState = b.tilt ? raw.states[b.tilt] : st;
|
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;
|
const tilt = typeof tiltState?.attributes.current_tilt_position === "number" ? tiltState.attributes.current_tilt_position : b.tilt ? positionPercent(raw, b.tilt) : null;
|
||||||
if (tilt !== null) {
|
if (tilt !== null) {
|
||||||
if (b.tiltInverted) tilt = 100 - tilt;
|
|
||||||
a.current_tilt_position = tilt;
|
a.current_tilt_position = tilt;
|
||||||
a.supported_features = Number(a.supported_features ?? 0) | 128;
|
a.supported_features = Number(a.supported_features ?? 0) | 128;
|
||||||
}
|
}
|
||||||
let state = st.state;
|
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";
|
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;
|
states[id] = { ...st, state, attributes: a } satisfies HassEntity;
|
||||||
}
|
}
|
||||||
@@ -62,11 +55,6 @@ export function withCoverControls(hass: HomeAssistant, floors: readonly Floor[])
|
|||||||
if (command === "toggle" || command === "toggle_cover") command = states[String(id)]?.state === "closed" ? "open_cover" : "close_cover";
|
if (command === "toggle" || command === "toggle_cover") command = states[String(id)]?.state === "closed" ? "open_cover" : "close_cover";
|
||||||
const tilt = command.includes("tilt");
|
const tilt = command.includes("tilt");
|
||||||
if (tilt && b.tilt) payload.entity_id = b.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.
|
// A separate HA position-only cover controls its slats through its position service.
|
||||||
const target = b.tilt ? raw.states[b.tilt] : undefined;
|
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 (tilt && b.tilt && !target?.attributes.symcon_id && typeof target?.attributes.current_tilt_position !== "number") {
|
||||||
|
|||||||
@@ -150,24 +150,23 @@ function coverClosed(hass: HomeAssistant, id: string | null | undefined, inverte
|
|||||||
const cover = id ? hass.states[id] : undefined;
|
const cover = id ? hass.states[id] : undefined;
|
||||||
if (!cover || isUnavailable(cover)) return id ? 0 : null;
|
if (!cover || isUnavailable(cover)) return id ? 0 : null;
|
||||||
const percent = cover.attributes.current_position;
|
const percent = cover.attributes.current_position;
|
||||||
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 (typeof percent === "number") { const closed = 1 - Math.min(100, Math.max(0, percent)) / 100; return inverted ? 1 - closed : closed; }
|
||||||
if (cover.state === "closed") return inverted && !cover.attributes.nf_cover_control ? 0 : 1;
|
if (cover.state === "closed") return inverted ? 0 : 1;
|
||||||
if (cover.state === "open") return inverted && !cover.attributes.nf_cover_control ? 1 : 0;
|
if (cover.state === "open") return inverted ? 1 : 0;
|
||||||
return cover.state === "opening" || cover.state === "closing" ? 0.5 : 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. */
|
/** 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, inverted = false): number | null {
|
function slatsOpen(hass: HomeAssistant, id: string | null | undefined, separate?: string | null, inverted = false): number | null {
|
||||||
const main = hass.states[id || ""];
|
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 combined = !!main?.attributes.nf_cover_control;
|
||||||
const a = hass.states[separate || id || ""]?.attributes;
|
const a = combined ? main!.attributes : hass.states[separate || id || ""]?.attributes;
|
||||||
const tilt = a?.current_tilt_position ?? (separate ? a?.current_position : undefined);
|
const tilt = a?.current_tilt_position ?? (!combined && separate ? a?.current_position : undefined);
|
||||||
const value = typeof tilt === "number" ? Math.min(100, Math.max(0, tilt)) : separate ? positionPercent(hass, separate) : 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;
|
return value === null ? null : (inverted ? 100 - value : value) / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
function blindClosedFraction(hass: HomeAssistant, e: OpeningEntities): number | null {
|
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);
|
const reported = reportedPosition(hass, e.position);
|
||||||
if (reported !== null) { const closed = e.positionInverted ? reported : 1 - reported; return e.coverInverted ? 1 - closed : closed; }
|
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;
|
const cover = e.cover ? hass.states[e.cover] : undefined;
|
||||||
|
|||||||
+12
-10
@@ -37,10 +37,11 @@ const DE = {
|
|||||||
device_value_label: "Bezeichnung (optional)",
|
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.",
|
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_tilt_entity: "Lamellenposition",
|
||||||
cover_direction_invert: "Wirksinn Behang umkehren",
|
cover_direction_invert: "Behang in 3D umkehren",
|
||||||
cover_tilt_direction_invert: "Wirksinn Lamellen umkehren",
|
cover_tilt_direction_invert: "Lamellen in 3D umkehren",
|
||||||
cover2_direction_invert: "Wirksinn zweiter Behang umkehren",
|
cover2_direction_invert: "Zweiten Behang in 3D umkehren",
|
||||||
cover2_tilt_direction_invert: "Wirksinn Lamellen des zweiten Behangs umkehren",
|
cover2_tilt_direction_invert: "Lamellen des zweiten Behangs in 3D umkehren",
|
||||||
|
cover_direction_hint: "Die Umkehrung betrifft nur die 3D-Darstellung. Zahlenwerte, Regler und Steuerbefehle bleiben unverändert: Ein empfangener Wert von 0 wird weiterhin als 0 angezeigt und ein eingestellter Wert von 0 als 0 gesendet.",
|
||||||
cover2_tilt_entity: "Lamellenposition (zweiter Behang)",
|
cover2_tilt_entity: "Lamellenposition (zweiter Behang)",
|
||||||
symcon_variables_loading: "Variablen werden geladen …",
|
symcon_variables_loading: "Variablen werden geladen …",
|
||||||
symcon_variables_loaded: "Variablen und Objektbaum wurden neu geladen.",
|
symcon_variables_loaded: "Variablen und Objektbaum wurden neu geladen.",
|
||||||
@@ -1287,7 +1288,7 @@ const DE = {
|
|||||||
cover_entity: "Rollladen",
|
cover_entity: "Rollladen",
|
||||||
door_cover: "Antrieb (Tür oder Tor mit Motor)",
|
door_cover: "Antrieb (Tür oder Tor mit Motor)",
|
||||||
cover_position_entity: "Positions-Sensor (live)",
|
cover_position_entity: "Positions-Sensor (live)",
|
||||||
cover_position_invert: "Sensor zählt umgekehrt (0 = offen)",
|
cover_position_invert: "Positionssensor in 3D umkehren (0 = offen)",
|
||||||
contact_entity: "Kontakt",
|
contact_entity: "Kontakt",
|
||||||
sensor_kind: "Sensor-Art",
|
sensor_kind: "Sensor-Art",
|
||||||
sensor_kind_contact: "Fensterkontakt (offen/zu)",
|
sensor_kind_contact: "Fensterkontakt (offen/zu)",
|
||||||
@@ -2078,10 +2079,11 @@ const EN: Record<Key, string> = {
|
|||||||
device_value_label: "Label (optional)",
|
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.",
|
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_tilt_entity: "Slat position",
|
||||||
cover_direction_invert: "Reverse blind direction",
|
cover_direction_invert: "Reverse blind in 3D",
|
||||||
cover_tilt_direction_invert: "Reverse slat direction",
|
cover_tilt_direction_invert: "Reverse slats in 3D",
|
||||||
cover2_direction_invert: "Reverse second blind direction",
|
cover2_direction_invert: "Reverse second blind in 3D",
|
||||||
cover2_tilt_direction_invert: "Reverse second blind slat direction",
|
cover2_tilt_direction_invert: "Reverse second blind slats in 3D",
|
||||||
|
cover_direction_hint: "Reversal affects only the 3D appearance. Numeric values, sliders and control commands stay unchanged: a received value of 0 is still displayed as 0, and a chosen value of 0 is sent as 0.",
|
||||||
cover2_tilt_entity: "Slat position (second blind)",
|
cover2_tilt_entity: "Slat position (second blind)",
|
||||||
symcon_variables_loading: "Loading variables …",
|
symcon_variables_loading: "Loading variables …",
|
||||||
symcon_variables_loaded: "Variables and object tree reloaded.",
|
symcon_variables_loaded: "Variables and object tree reloaded.",
|
||||||
@@ -3328,7 +3330,7 @@ const EN: Record<Key, string> = {
|
|||||||
cover_entity: "Blind",
|
cover_entity: "Blind",
|
||||||
door_cover: "Drive (motorised door or gate)",
|
door_cover: "Drive (motorised door or gate)",
|
||||||
cover_position_entity: "Position sensor (live)",
|
cover_position_entity: "Position sensor (live)",
|
||||||
cover_position_invert: "Sensor counts the other way round (0 = open)",
|
cover_position_invert: "Reverse position sensor in 3D (0 = open)",
|
||||||
contact_entity: "Contact",
|
contact_entity: "Contact",
|
||||||
sensor_kind: "Sensor type",
|
sensor_kind: "Sensor type",
|
||||||
sensor_kind_contact: "Window contact (open/closed)",
|
sensor_kind_contact: "Window contact (open/closed)",
|
||||||
|
|||||||
@@ -90,6 +90,18 @@ test("toggling uses the service of the entity's own domain", async () => {
|
|||||||
assert.deepEqual(hass.calls[0], ["switch", "toggle", { entity_id: "switch.pump" }]);
|
assert.deepEqual(hass.calls[0], ["switch", "toggle", { entity_id: "switch.pump" }]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("a placed blind reverses its 3D marker without changing its zero reading", () => {
|
||||||
|
const building = emptyBuilding();
|
||||||
|
const floor = newFloor("g", "Ground", 0);
|
||||||
|
floor.placements = [{ entity_id: "cover.a", x: 1, z: 1, y: null, cover_inverted: true }];
|
||||||
|
building.floors = [floor];
|
||||||
|
const hass = hassOf([state("cover.a", "closed", { current_position: 0 })]);
|
||||||
|
const [marker] = buildMarkers(hass, building);
|
||||||
|
assert.equal(marker.text, "0 %");
|
||||||
|
assert.equal(marker.active, true);
|
||||||
|
assert.equal(hass.states["cover.a"].attributes.current_position, 0);
|
||||||
|
});
|
||||||
|
|
||||||
test("a wall button (event entity) shows when it was last pressed, and a dash before its first press", () => {
|
test("a wall button (event entity) shows when it was last pressed, and a dash before its first press", () => {
|
||||||
const hass = hassOf([]);
|
const hass = hassOf([]);
|
||||||
const now = new Date(2026, 10, 1, 18, 0);
|
const now = new Date(2026, 10, 1, 18, 0);
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ function markerFor(hass: HomeAssistant, floor: Floor, placed: Placement): Device
|
|||||||
ownName: placed.name || undefined,
|
ownName: placed.name || undefined,
|
||||||
showName: !!placed.show_name,
|
showName: !!placed.show_name,
|
||||||
text: [stateText(hass, st), deviceValuesText(hass, placed.values)].filter(Boolean).join(" · "),
|
text: [stateText(hass, st), deviceValuesText(hass, placed.values)].filter(Boolean).join(" · "),
|
||||||
active: isActive(st),
|
active: kind === "cover" && (!!placed.cover_inverted !== (!!placed.position && !!placed.position_inverted)) && !isUnavailable(st) ? !isActive(st) : isActive(st),
|
||||||
unavailable: isUnavailable(st),
|
unavailable: isUnavailable(st),
|
||||||
glow: kind === "light" ? scaleGlow(lightGlow(st), placed.glow_scale) : null,
|
glow: kind === "light" ? scaleGlow(lightGlow(st), placed.glow_scale) : null,
|
||||||
effect: kind === "light" ? lightAnimation(placed, st) : undefined,
|
effect: kind === "light" ? lightAnimation(placed, st) : undefined,
|
||||||
|
|||||||
@@ -171,6 +171,7 @@ export interface Opening {
|
|||||||
cover: EntityRef;
|
cover: EntityRef;
|
||||||
/** Separate numeric control for the venetian blind's slat position. */
|
/** Separate numeric control for the venetian blind's slat position. */
|
||||||
cover_tilt?: EntityRef;
|
cover_tilt?: EntityRef;
|
||||||
|
/** Reverse only the 3D appearance; displayed positions and control commands keep their original direction. */
|
||||||
cover_inverted?: boolean;
|
cover_inverted?: boolean;
|
||||||
cover_tilt_inverted?: boolean;
|
cover_tilt_inverted?: boolean;
|
||||||
/** Windows and doors: a second blind for the right half (seen from the room) of a wide window. */
|
/** Windows and doors: a second blind for the right half (seen from the room) of a wide window. */
|
||||||
@@ -358,6 +359,7 @@ export interface Placement extends LightEffectConfig {
|
|||||||
/** A placed blind's separate slat position control. */
|
/** A placed blind's separate slat position control. */
|
||||||
cover_tilt?: EntityRef;
|
cover_tilt?: EntityRef;
|
||||||
values?: DeviceValueLink[];
|
values?: DeviceValueLink[];
|
||||||
|
/** Visual direction only; values and commands are unchanged. */
|
||||||
cover_inverted?: boolean;
|
cover_inverted?: boolean;
|
||||||
cover_tilt_inverted?: boolean;
|
cover_tilt_inverted?: boolean;
|
||||||
position?: EntityRef;
|
position?: EntityRef;
|
||||||
|
|||||||
@@ -179,9 +179,9 @@ try {
|
|||||||
await window.chooseControl(field("Lamellenposition"), 102, "Lamellen Position");
|
await window.chooseControl(field("Lamellenposition"), 102, "Lamellen Position");
|
||||||
await window.chooseControl(field("Positions-Sensor (live)"), 103, "Positionsrückmeldung");
|
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();
|
const check = (text) => [...e.shadowRoot.querySelectorAll("label.nf-check")].find((el) => el.textContent.includes(text)).querySelector("input").click();
|
||||||
check("Wirksinn Behang umkehren");
|
check("Behang in 3D umkehren");
|
||||||
await e.updateComplete;
|
await e.updateComplete;
|
||||||
check("Wirksinn Lamellen umkehren");
|
check("Lamellen in 3D umkehren");
|
||||||
await e.updateComplete;
|
await e.updateComplete;
|
||||||
await p.updateComplete;
|
await p.updateComplete;
|
||||||
await e.updateComplete;
|
await e.updateComplete;
|
||||||
@@ -204,8 +204,8 @@ try {
|
|||||||
const o = f.openings.find((o) => o.id === window.controlWindow);
|
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, o.position, o.cover_inverted, o.cover_tilt_inverted];
|
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");
|
}), ["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_position), 20, "display follows the unchanged 0-255 feedback despite reversed 3D direction");
|
||||||
assert.equal(await page.evaluate(() => window.controlHass.states["cover.101"].attributes.current_tilt_position), 100 - 128 / 255 * 100);
|
assert.equal(await page.evaluate(() => window.controlHass.states["cover.101"].attributes.current_tilt_position), 128 / 255 * 100);
|
||||||
await page.evaluate(async () => {
|
await page.evaluate(async () => {
|
||||||
window.logicalControlCalls = [];
|
window.logicalControlCalls = [];
|
||||||
const send = window.controlHass.callService;
|
const send = window.controlHass.callService;
|
||||||
@@ -230,10 +230,30 @@ try {
|
|||||||
await page.waitForFunction(() => window.actuatorCalls.length === 4);
|
await page.waitForFunction(() => window.actuatorCalls.length === 4);
|
||||||
assert.deepEqual(await page.evaluate(() => window.actuatorCalls.map((c) => [c.domain, c.service, c.data])), [
|
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 }],
|
["light", "turn_on", { entity_id: "light.42", brightness_pct: 25 }],
|
||||||
["cover", "set_cover_position", { entity_id: "cover.101", position: 40 }],
|
["cover", "set_cover_position", { entity_id: "cover.101", position: 60 }],
|
||||||
["cover", "set_cover_tilt_position", { entity_id: "cover.102", tilt_position: 70 }],
|
|
||||||
["cover", "set_cover_tilt_position", { entity_id: "cover.102", tilt_position: 30 }],
|
["cover", "set_cover_tilt_position", { entity_id: "cover.102", tilt_position: 30 }],
|
||||||
|
["cover", "set_cover_tilt_position", { entity_id: "cover.102", tilt_position: 70 }],
|
||||||
], JSON.stringify(await page.evaluate(() => window.logicalControlCalls)));
|
], JSON.stringify(await page.evaluate(() => window.logicalControlCalls)));
|
||||||
|
await page.evaluate(async () => {
|
||||||
|
const raw = window.nfPanel.hass;
|
||||||
|
const states = { ...raw.states };
|
||||||
|
for (const id of ["cover.101", "cover.102", "cover.103"]) states[id] = { ...states[id], state: "closed", attributes: { ...states[id].attributes, symcon_numeric_value: 0, current_position: 0, current_tilt_position: 0 } };
|
||||||
|
const zero = window.SymconAdapter.withCoverControls({ ...raw, states }, window.ed._doc.floors);
|
||||||
|
const panel = document.querySelector("#controls-room"), quick = document.querySelector("#controls-quick");
|
||||||
|
panel.hass = quick.hass = zero;
|
||||||
|
await panel.updateComplete;
|
||||||
|
await quick.updateComplete;
|
||||||
|
const row = [...panel.shadowRoot.querySelectorAll(".nf-rp-row")].find((r) => r.textContent.includes("Behang Position"));
|
||||||
|
const sliders = [...row.querySelectorAll('input[type="range"]')];
|
||||||
|
if (!sliders.every((input) => input.value === "0")) throw new Error("Reversed 3D settings changed a zero slider value");
|
||||||
|
if (quick.shadowRoot.querySelector(".qm-blind b").textContent !== "0 %") throw new Error("Quick menu changed the zero reading");
|
||||||
|
for (const input of sliders) input.dispatchEvent(new Event("change", { bubbles: true }));
|
||||||
|
});
|
||||||
|
await page.waitForFunction(() => window.actuatorCalls.length === 6);
|
||||||
|
assert.deepEqual(await page.evaluate(() => window.actuatorCalls.slice(4).map((c) => [c.service, c.data])), [
|
||||||
|
["set_cover_position", { entity_id: "cover.101", position: 0 }],
|
||||||
|
["set_cover_tilt_position", { entity_id: "cover.102", tilt_position: 0 }],
|
||||||
|
], "zero must be sent unchanged for both blind and slats");
|
||||||
assert.equal(await page.evaluate(() => window.actuatorCalls.some((c) => c.data.entity_id === "cover.103")), false, "feedback is never written");
|
assert.equal(await page.evaluate(() => window.actuatorCalls.some((c) => c.data.entity_id === "cover.103")), false, "feedback is never written");
|
||||||
await page.evaluate(async () => {
|
await page.evaluate(async () => {
|
||||||
const e = window.ed;
|
const e = window.ed;
|
||||||
@@ -245,9 +265,9 @@ try {
|
|||||||
const positionField = [...e.shadowRoot.querySelectorAll("label.nf-field")].find((el) => el.textContent.trim().startsWith("Positions-Sensor (live)"));
|
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");
|
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();
|
const check = (text) => [...e.shadowRoot.querySelectorAll("label.nf-check")].find((el) => el.textContent.includes(text)).querySelector("input").click();
|
||||||
check("Wirksinn Behang umkehren");
|
check("Behang in 3D umkehren");
|
||||||
await e.updateComplete;
|
await e.updateComplete;
|
||||||
check("Wirksinn Lamellen umkehren");
|
check("Lamellen in 3D umkehren");
|
||||||
await e.updateComplete;
|
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");
|
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");
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
|
/*! 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
|
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]`,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=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
|
\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
|
||||||
<input type="checkbox" .checked=${e} @change=${o=>r(nt(o))} />
|
<input type="checkbox" .checked=${e} @change=${o=>r(nt(o))} />
|
||||||
<span>${i.t(t)}${n?l`<small>${i.t(n)}</small>`:d}</span>
|
<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"
|
</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;
|
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,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">
|
`;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">
|
||||||
<legend>${this.form.t("card_rooms")}</legend>
|
<legend>${this.form.t("card_rooms")}</legend>
|
||||||
<small>${this.form.t("card_rooms_hint")}</small>
|
<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>`)}
|
${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}
|
</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">
|
<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>
|
<summary>${e.t("furn_colors_card")}${Object.keys(t).length?` (${Object.keys(t).length})`:""}</summary>
|
||||||
${He.map(r=>l`<label class="field"
|
${We.map(r=>l`<label class="field"
|
||||||
>${e.t(`furn_color_${r}`)}
|
>${e.t(`furn_color_${r}`)}
|
||||||
<input type="color" .value=${t[r]??Be[r]} @input=${o=>n(r,o.target.value)} />
|
<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}
|
${t[r]?l`<button type="button" class="link" @click=${()=>n(r,null)}>${e.t("furn_color_house")}</button>`:d}
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
|
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
|
||||||
var S={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 Mn=globalThis,An=Mn.ShadowRoot&&(Mn.ShadyCSS===void 0||Mn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Lr=Symbol(),Ao=new WeakMap,Ot=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Lr)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(An&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=Ao.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Ao.set(t,e))}return e}toString(){return this.cssText}},Eo=r=>new Ot(typeof r=="string"?r:r+"",void 0,Lr),ne=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((n,i,o)=>n+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+r[o+1],r[0]);return new Ot(t,r,Lr)},Ro=(r,e)=>{if(An)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),i=Mn.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},Br=An?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return Eo(t)})(r):r;var{is:cu,defineProperty:uu,getOwnPropertyDescriptor:du,getOwnPropertyNames:hu,getOwnPropertySymbols:pu,getPrototypeOf:mu}=Object,En=globalThis,zo=En.trustedTypes,fu=zo?zo.emptyScript:"",gu=En.reactiveElementPolyfillSupport,Wt=(r,e)=>r,Vr={toAttribute(r,e){switch(e){case Boolean:r=r?fu: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}},Fo=(r,e)=>!cu(r,e),To={attribute:!0,type:String,converter:Vr,reflect:!1,useDefault:!1,hasChanged:Fo};Symbol.metadata??=Symbol("metadata"),En.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=To){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),i=this.getPropertyDescriptor(e,n,t);i!==void 0&&uu(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){let{get:i,set:o}=du(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:i,set(s){let a=i?.call(this);o?.call(this,s),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??To}static _$Ei(){if(this.hasOwnProperty(Wt("elementProperties")))return;let e=mu(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=[...hu(t),...pu(t)];for(let i of n)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,i]of t)this.elementProperties.set(n,i)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let i=this._$Eu(t,n);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let i of n)t.unshift(Br(i))}else e!==void 0&&t.push(Br(e));return t}static _$Eu(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shaLine truncated
|
var k={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 Mn=globalThis,An=Mn.ShadowRoot&&(Mn.ShadyCSS===void 0||Mn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Lr=Symbol(),Mo=new WeakMap,Ot=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Lr)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(An&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=Mo.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Mo.set(t,e))}return e}toString(){return this.cssText}},Ao=r=>new Ot(typeof r=="string"?r:r+"",void 0,Lr),ne=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((n,i,o)=>n+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+r[o+1],r[0]);return new Ot(t,r,Lr)},Eo=(r,e)=>{if(An)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),i=Mn.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},Br=An?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return Ao(t)})(r):r;var{is:cu,defineProperty:uu,getOwnPropertyDescriptor:du,getOwnPropertyNames:hu,getOwnPropertySymbols:pu,getPrototypeOf:mu}=Object,En=globalThis,Ro=En.trustedTypes,fu=Ro?Ro.emptyScript:"",gu=En.reactiveElementPolyfillSupport,Wt=(r,e)=>r,Vr={toAttribute(r,e){switch(e){case Boolean:r=r?fu: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}},To=(r,e)=>!cu(r,e),zo={attribute:!0,type:String,converter:Vr,reflect:!1,useDefault:!1,hasChanged:To};Symbol.metadata??=Symbol("metadata"),En.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=zo){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),i=this.getPropertyDescriptor(e,n,t);i!==void 0&&uu(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){let{get:i,set:o}=du(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:i,set(s){let a=i?.call(this);o?.call(this,s),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??zo}static _$Ei(){if(this.hasOwnProperty(Wt("elementProperties")))return;let e=mu(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=[...hu(t),...pu(t)];for(let i of n)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,i]of t)this.elementProperties.set(n,i)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let i=this._$Eu(t,n);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let i of n)t.unshift(Br(i))}else e!==void 0&&t.push(Br(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]`,Lt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ho=/-->/g,Io=/>/g,Je=RegExp(`>|${Kr}(?:([^\\s"'>=/]+)(${Kr}*=${Kr}*(?:[^
|
\f\r]`,Lt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Po=/-->/g,Ho=/>/g,Je=RegExp(`>|${Kr}(?:([^\\s"'>=/]+)(${Kr}*=${Kr}*(?:[^
|
||||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),Co=/'/g,No=/"/g,Bo=/^(?:script|style|textarea|title)$/i,Qr=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),m=Qr(1),J=Qr(2),ef=Qr(3),et=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),Oo=new WeakMap,Qe=Xe.createTreeWalker(Xe,129);function Vo(r,e){if(!Jr(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Po!==void 0?Po.createHTML(e):e}var vu=(r,e)=>{let t=r.length-1,n=[],i,o=e===2?"<svg>":e===3?"<math>":"",s=Lt;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===Lt?u[1]==="!--"?s=Ho:u[1]!==void 0?s=Io:u[2]!==void 0?(Bo.test(u[2])&&(i=RegExp("</"+u[2],"g")),s=Je):u[3]!==void 0&&(s=Je):s===Je?u[0]===">"?(s=i??Lt,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]==='"'?No:Co):s===No||s===Co?s=Je:s===Ho||s===Io?s=Lt:(s=Je,i=void 0);let d=s===Je&&r[a+1].startsWith("/>")?" ":"";o+=s===Lt?l+_u:h>=0?(n.push(c),l.slice(0,h)+Wo+l.slice(h)+Le+d):l+Le+(h===-2?a:d)}return[Vo(r,o+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},Kt=class r{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let o=0,s=0,a=e.length-1,l=this.parts,[c,u]=vu(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(;(i=Qe.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let h of i.getAttributeNames())if(h.endsWith(Wo)){let p=u[s++],d=i.getAttribute(h).split(Le),_=/([.?@])?(.*)/.exec(p);l.push({type:1,index:o,name:_[2],strings:d,ctor:_[1]==="."?Ur:_[1]==="?"?jr:_[1]==="@"?qr:mt}),i.removeAttribute(h)}else h.startsWith(Le)&&(l.push({type:6,index:o}),i.removeAttribute(h));if(Bo.test(i.tagName)){let h=i.textContent.split(Le),p=h.length-1;if(p>0){i.textContent=Rn?Rn.emptyScript:"";for(let d=0;d<p;d++)i.append(h[d],Bt()),Qe.nextNode(),l.push({type:2,index:++o});i.append(h[p],Bt())}}}else if(i.nodeType===8)if(i.data===Lo)l.push({type:2,index:o});else{let h=-1;for(;(h=i.data.indexOf(Le,h+1))!==-1;)l.push({type:7,index:o}),h+=Le.length-1}o++}}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 i=n!==void 0?t._$Co?.[n]:t._$Cl,o=Vt(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(r),i._$AT(r,t,n)),n!==void 0?(t._$Co??=[])[n]=i:t._$Cl=i),i!==void 0&&(e=pt(r,i._$AS(r,e.values),i,n)),e}var Gr=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,i=(e?.creationScope??Xe).importNode(t,!0);Qe.currentNode=i;let o=Qe.nextNode(),s=0,a=0,l=n[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new Gt(o,o.nextSibling,this,e):l.type===1?c=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(c=new Zr(o,this,e)),this._$AV.push(c),l=n[++a]}s!==l?.index&&(o=Qe.nextNode(),s++)}return Qe.currentNode=Xe,i}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},Gt=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=pt(this,e,t),Vt(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):bu(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&&Vt(this._$AH)?this._$AA.nextSibling.data=e:this.T(Xe.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,i=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=Kt.createElement(Vo(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{let o=new Gr(i,this),s=o.u(this.options);o.p(t),this.T(s),this._$AH=o}}_$AC(e){let t=Oo.get(e.strings);return t===void 0&&Oo.set(e.strings,t=new Kt(e)),t}k(e){Jr(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,i=0;for(let o of e)i===t.length?t.push(n=new r(this.O(Bt()),this.O(Bt()),this,this.options)):n=t[i],n._$AI(o),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=Do(e).nextSibling;Do(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,i,o){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=o,n.length>2||n[0]!==""||n[1]!==""?(this._Line truncated
|
\f\r"'\`<>=]|("|')|))|$)`,"g"),Io=/'/g,Co=/"/g,Lo=/^(?:script|style|textarea|title)$/i,Qr=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),m=Qr(1),Q=Qr(2),Xm=Qr(3),et=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),No=new WeakMap,Qe=Xe.createTreeWalker(Xe,129);function Bo(r,e){if(!Jr(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Fo!==void 0?Fo.createHTML(e):e}var vu=(r,e)=>{let t=r.length-1,n=[],i,o=e===2?"<svg>":e===3?"<math>":"",s=Lt;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===Lt?u[1]==="!--"?s=Po:u[1]!==void 0?s=Ho:u[2]!==void 0?(Lo.test(u[2])&&(i=RegExp("</"+u[2],"g")),s=Je):u[3]!==void 0&&(s=Je):s===Je?u[0]===">"?(s=i??Lt,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]==='"'?Co:Io):s===Co||s===Io?s=Je:s===Po||s===Ho?s=Lt:(s=Je,i=void 0);let d=s===Je&&r[a+1].startsWith("/>")?" ":"";o+=s===Lt?l+_u:h>=0?(n.push(c),l.slice(0,h)+Oo+l.slice(h)+Le+d):l+Le+(h===-2?a:d)}return[Bo(r,o+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},Kt=class r{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let o=0,s=0,a=e.length-1,l=this.parts,[c,u]=vu(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(;(i=Qe.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let h of i.getAttributeNames())if(h.endsWith(Oo)){let p=u[s++],d=i.getAttribute(h).split(Le),_=/([.?@])?(.*)/.exec(p);l.push({type:1,index:o,name:_[2],strings:d,ctor:_[1]==="."?Ur:_[1]==="?"?jr:_[1]==="@"?qr:mt}),i.removeAttribute(h)}else h.startsWith(Le)&&(l.push({type:6,index:o}),i.removeAttribute(h));if(Lo.test(i.tagName)){let h=i.textContent.split(Le),p=h.length-1;if(p>0){i.textContent=Rn?Rn.emptyScript:"";for(let d=0;d<p;d++)i.append(h[d],Bt()),Qe.nextNode(),l.push({type:2,index:++o});i.append(h[p],Bt())}}}else if(i.nodeType===8)if(i.data===Wo)l.push({type:2,index:o});else{let h=-1;for(;(h=i.data.indexOf(Le,h+1))!==-1;)l.push({type:7,index:o}),h+=Le.length-1}o++}}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 i=n!==void 0?t._$Co?.[n]:t._$Cl,o=Vt(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(r),i._$AT(r,t,n)),n!==void 0?(t._$Co??=[])[n]=i:t._$Cl=i),i!==void 0&&(e=pt(r,i._$AS(r,e.values),i,n)),e}var Gr=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,i=(e?.creationScope??Xe).importNode(t,!0);Qe.currentNode=i;let o=Qe.nextNode(),s=0,a=0,l=n[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new Gt(o,o.nextSibling,this,e):l.type===1?c=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(c=new Zr(o,this,e)),this._$AV.push(c),l=n[++a]}s!==l?.index&&(o=Qe.nextNode(),s++)}return Qe.currentNode=Xe,i}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},Gt=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=pt(this,e,t),Vt(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):bu(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&&Vt(this._$AH)?this._$AA.nextSibling.data=e:this.T(Xe.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,i=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=Kt.createElement(Bo(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{let o=new Gr(i,this),s=o.u(this.options);o.p(t),this.T(s),this._$AH=o}}_$AC(e){let t=No.get(e.strings);return t===void 0&&No.set(e.strings,t=new Kt(e)),t}k(e){Jr(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,i=0;for(let o of e)i===t.length?t.push(n=new r(this.O(Bt()),this.O(Bt()),this,this.options)):n=t[i],n._$AI(o),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=Do(e).nextSibling;Do(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,i,o){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=o,n.length>2||n[0]!==""||n[1]!==""?(this._Line truncated
|
||||||
|
|
||||||
Ein Plugin l\xE4uft mit denselben Rechten wie NextFloor in deinem Browser. Die Datei wurde gepr\xFCft, ihr Inhalt ist festgelegt:
|
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:
|
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 {
|
:host {
|
||||||
--nf-text: var(--primary-text-color, #e1e1e1);
|
--nf-text: var(--primary-text-color, #e1e1e1);
|
||||||
--nf-muted: var(--secondary-text-color, #9b9b9b);
|
--nf-muted: var(--secondary-text-color, #9b9b9b);
|
||||||
@@ -211,7 +211,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
}
|
}
|
||||||
`;function br(r){return r?.themes?.darkMode===!1?"light":"dark"}var Kh=4,Gh=8,Uh=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[255,95,210],[120,255,150]],zt=r=>m`<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
`;function br(r){return r?.themes?.darkMode===!1?"light":"dark"}var Kh=4,Gh=8,Uh=[[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=${sr(r)} />
|
<path d=${sr(r)} />
|
||||||
</svg>`,vr={previous:"M6 6h2v12H6zM20 6v12l-10-6z",play:"M8 5v14l11-7z",pause:"M7 5h4v14H7zM13 5h4v14h-4z",next:"M16 6h2v12h-2zM4 6v12l10-6z"},Wi=r=>m`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d=${r} /></svg>`,jh=24,qh=10,Li=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 gr(e))this.call("light",t.service,t.data)}renderMoods(e,t){let n=e.moods??[],i=!!this.rooms&&!!this.hass.user?.is_admin;if(!n.length&&!i)return f;let o=(this.rooms??[]).filter(l=>l.id!==e.id&&l.area_id),s=l=>K(this.hass,l).filter(c=>c.startsWith("light.")),a=()=>{let l=(this._moodName??"").trim()||this.t("mood_new");this.fireMoods(e,[...n,{id:`mood_${Date.now().toString(36)}`,name:l,lights:t.map(fr)}]),this._moodName=null};return m`<div class="nf-rp-moods">
|
</svg>`,vr={previous:"M6 6h2v12H6zM20 6v12l-10-6z",play:"M8 5v14l11-7z",pause:"M7 5h4v14H7zM13 5h4v14h-4z",next:"M16 6h2v12h-2zM4 6v12l10-6z"},Oi=r=>m`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d=${r} /></svg>`,jh=24,qh=10,Wi=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 gr(e))this.call("light",t.service,t.data)}renderMoods(e,t){let n=e.moods??[],i=!!this.rooms&&!!this.hass.user?.is_admin;if(!n.length&&!i)return f;let o=(this.rooms??[]).filter(l=>l.id!==e.id&&l.area_id),s=l=>K(this.hass,l).filter(c=>c.startsWith("light.")),a=()=>{let l=(this._moodName??"").trim()||this.t("mood_new");this.fireMoods(e,[...n,{id:`mood_${Date.now().toString(36)}`,name:l,lights:t.map(fr)}]),this._moodName=null};return m`<div class="nf-rp-moods">
|
||||||
${n.map(l=>m`<span class="nf-rp-mood">
|
${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>
|
<button class="nf-btn" title=${this.t("mood_set")} @click=${()=>this.runMood(l.lights)}>✨ ${l.name}</button>
|
||||||
${o.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=o.find(p=>p.id===u.value);u.value="",h&&this.runMood(cl(l,s(h)))}}>
|
${o.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=o.find(p=>p.id===u.value);u.value="",h&&this.runMood(cl(l,s(h)))}}>
|
||||||
@@ -224,7 +224,7 @@ 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()} />
|
><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
|
<button class="nf-btn" @click=${a}>${this.t("mood_save")}</button></span
|
||||||
>`:f}
|
>`:f}
|
||||||
</div>`}async loadCurve(e){let t=Ve(this.hass,this.floor,e,"temperature"),n=t.length?t:K(this.hass,e).filter(s=>s.startsWith("climate."));if(!n.length)return;let i=Date.now(),o=i-24*36e5;try{let s=await cn(this.hass,n,o,i,!!t.length);if(this.room?.id!==e.id)return;let a=[];for(let l=1;l<=96;l++){let c=Rt(this.hass,s,o+(i-o)*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=Ni(this.hass,this.building,this.floor,e);try{let n=await el(this.hass,t);this.room?.id===e.id&&(this._energy=n)}catch{this._energy=null}}renderEmptyLights(e,t){if(!t.length||!this.room)return f;let n=K(this.hass,e).map(s=>this.hass.states[s]).filter(s=>!!s&&s.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(s.attributes.device_class)));if(!n.length||n.some(s=>s.state!=="off"))return f;let i=Math.max(...n.map(s=>Date.parse(String(s.last_changed??""))||0)),o=Math.floor((Date.now()-i)/6e4);return!i||o<qh?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 i=Date.now(),o=i-24*36e5;try{let s=await cn(this.hass,n,o,i,!!t.length);if(this.room?.id!==e.id)return;let a=[];for(let l=1;l<=96;l++){let c=Rt(this.hass,s,o+(i-o)*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=Ci(this.hass,this.building,this.floor,e);try{let n=await el(this.hass,t);this.room?.id===e.id&&(this._energy=n)}catch{this._energy=null}}renderEmptyLights(e,t){if(!t.length||!this.room)return f;let n=K(this.hass,e).map(s=>this.hass.states[s]).filter(s=>!!s&&s.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(s.attributes.device_class)));if(!n.length||n.some(s=>s.state!=="off"))return f;let i=Math.max(...n.map(s=>Date.parse(String(s.last_changed??""))||0)),o=Math.floor((Date.now()-i)/6e4);return!i||o<qh?f:m`<div class="nf-rp-shade">
|
||||||
<span>💡 ${this.t("empty_lights_hint",{n:t.length,min:o})}</span>
|
<span>💡 ${this.t("empty_lights_hint",{n:t.length,min:o})}</span>
|
||||||
<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_off",{entity_id:t.map(s=>s.entity_id)})}>${this.t("empty_lights_off")}</button>
|
<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_off",{entity_id:t.map(s=>s.entity_id)})}>${this.t("empty_lights_off")}</button>
|
||||||
</div>`}renderOpenWhileHeating(e){let t=this.room;if(!t||!this.floor)return f;let n=e.filter(a=>a.attributes.hvac_action==="heating"||a.state==="heat"&&a.attributes.hvac_action===void 0);if(!n.length)return f;let i=a=>!!a&&a!=="none"&&this.hass.states[a]?.state==="on",o=this.floor.openings.filter(a=>a.room_id===t.id&&[a.contact,a.contact2,a.tilt,a.tilt2].some(i));if(!o.length)return f;let s=()=>{for(let a of n)(a.attributes.hvac_modes??[]).includes("off")?this.call("climate","set_hvac_mode",{entity_id:a.entity_id,hvac_mode:"off"}):typeof a.attributes.min_temp=="number"&&this.call("climate","set_temperature",{entity_id:a.entity_id,temperature:a.attributes.min_temp})};return m`<div class="nf-rp-shade nf-rp-open-heat">
|
</div>`}renderOpenWhileHeating(e){let t=this.room;if(!t||!this.floor)return f;let n=e.filter(a=>a.attributes.hvac_action==="heating"||a.state==="heat"&&a.attributes.hvac_action===void 0);if(!n.length)return f;let i=a=>!!a&&a!=="none"&&this.hass.states[a]?.state==="on",o=this.floor.openings.filter(a=>a.room_id===t.id&&[a.contact,a.contact2,a.tilt,a.tilt2].some(i));if(!o.length)return f;let s=()=>{for(let a of n)(a.attributes.hvac_modes??[]).includes("off")?this.call("climate","set_hvac_mode",{entity_id:a.entity_id,hvac_mode:"off"}):typeof a.attributes.min_temp=="number"&&this.call("climate","set_temperature",{entity_id:a.entity_id,temperature:a.attributes.min_temp})};return m`<div class="nf-rp-shade nf-rp-open-heat">
|
||||||
@@ -241,7 +241,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
</div>`}renderEnergy(){let e=this._energy;if(!e||e.month<=0)return f;let t=this.building?.energy.tariff,n=t?this.hass.states[t]:void 0,i=n?{value:Number(n.state),unit:String(n.attributes.unit_of_measurement??"")}:null,o=tl(e.month,i),s=a=>`${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")}>
|
</div>`}renderEnergy(){let e=this._energy;if(!e||e.month<=0)return f;let t=this.building?.energy.tariff,n=t?this.hass.states[t]:void 0,i=n?{value:Number(n.state),unit:String(n.attributes.unit_of_measurement??"")}:null,o=tl(e.month,i),s=a=>`${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)})}${o?` \xB7 ${O(this.hass,o.value,2)} ${o.currency}`:""}
|
⚡ ${this.t("room_energy",{today:s(e.today),month:s(e.month)})}${o?` \xB7 ${O(this.hass,o.value,2)} ${o.currency}`:""}
|
||||||
</p>`}renderCurve(){let e=this._curve;if(!e)return f;let t=e.filter(c=>c!==null),n=Math.min(...t),i=Math.max(...t),o=Math.max(1,i-n),s=e.map(c=>c===null?null:c-n+o*.1),a=un(s,220,36,o*1.2),l=c=>`${O(this.hass,ie(this.hass,c),1)}\xB0`;return m`<div class="nf-rp-curve" title=${this.t("room_curve_hint")}>
|
</p>`}renderCurve(){let e=this._curve;if(!e)return f;let t=e.filter(c=>c!==null),n=Math.min(...t),i=Math.max(...t),o=Math.max(1,i-n),s=e.map(c=>c===null?null:c-n+o*.1),a=un(s,220,36,o*1.2),l=c=>`${O(this.hass,ie(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>
|
<svg viewBox="0 0 220 36" preserveAspectRatio="none" aria-hidden="true">${Q`<path d=${a}></path>`}</svg>
|
||||||
<span>24 h · ${l(n)} – ${l(i)}</span>
|
<span>24 h · ${l(n)} – ${l(i)}</span>
|
||||||
</div>`}willUpdate(e){let t=e.get("room");e.has("room")&&t?.id!==this.room?.id&&(this._folded=!1,this._undo=null),this.room&&this.hass&&this.curveFor!==this.room.id&&(this.curveFor=this.room.id,this._curve=null,this._energy=null,this.loadCurve(this.room),this.loadEnergy(this.room))}updated(e){e.has("_folded")&&this.toggleAttribute("folded",this._folded)}t(e,t){return 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 i=t.slice(0,t.indexOf(".")),o=()=>i==="script"?this.call("script","turn_on",{entity_id:t}):this.call(i,"press",{entity_id:t});return m`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" ?disabled=${I(n)} title=${this.t("room_clean_run_hint")} @click=${o}>🧹 ${this.t("room_clean_run")}</button></div>`}allOff(e){let t=ln(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}=ln(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()||W(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 i=()=>{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 i=t.slice(0,t.indexOf(".")),o=()=>i==="script"?this.call("script","turn_on",{entity_id:t}):this.call(i,"press",{entity_id:t});return m`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" ?disabled=${I(n)} title=${this.t("room_clean_run_hint")} @click=${o}>🧹 ${this.t("room_clean_run")}</button></div>`}allOff(e){let t=ln(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}=ln(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()||W(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 i=()=>{this.confirmEntities?.has(e.entity_id)&&!confirm(this.t("confirm_switch",{name:this.name(e.entity_id)}))||n()};return m`<button
|
||||||
class="nf-switch"
|
class="nf-switch"
|
||||||
@@ -250,16 +250,16 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
aria-label=${this.name(e.entity_id)}
|
aria-label=${this.name(e.entity_id)}
|
||||||
?disabled=${I(e)}
|
?disabled=${I(e)}
|
||||||
@click=${i}
|
@click=${i}
|
||||||
></button>`}outsideRoom=null;render(){let e=!this.room&&this.outside?this.outside:null;e&&!this.outsideRoom&&(this.outsideRoom={id:"nf-outside",name:this.t("outside_area"),area_id:null,points:[],floor_material:"grass"});let t=this.room??(e?this.outsideRoom:null);if(!t||!this.hass)return f;let n=e??K(this.hass,t),i=this.memo,{shown:o,more:s}=e?{shown:e,more:[]}:i&&i.entities===this.hass.entities&&i.floor===this.floor&&i.room===t?i:this.memo={entities:this.hass.entities,floor:this.floor,room:t,...this.floor?Zs(this.hass,this.floor,t):{shown:n,more:[]}},a=_i(this.hass,s).map(y=>y.primary),l=a.length,c=this._showAll?[...o,...a]:o,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"]),$=this.facts(d),k=h.filter(y=>y.state==="on");return m`<section class="nf-rp" aria-label=${t.name}>
|
></button>`}outsideRoom=null;render(){let e=!this.room&&this.outside?this.outside:null;e&&!this.outsideRoom&&(this.outsideRoom={id:"nf-outside",name:this.t("outside_area"),area_id:null,points:[],floor_material:"grass"});let t=this.room??(e?this.outsideRoom:null);if(!t||!this.hass)return f;let n=e??K(this.hass,t),i=this.memo,{shown:o,more:s}=e?{shown:e,more:[]}:i&&i.entities===this.hass.entities&&i.floor===this.floor&&i.room===t?i:this.memo={entities:this.hass.entities,floor:this.floor,room:t,...this.floor?Zs(this.hass,this.floor,t):{shown:n,more:[]}},a=_i(this.hass,s).map(y=>y.primary),l=a.length,c=this._showAll?[...o,...a]:o,u=y=>c.filter(z=>y.includes(F(z))).map(z=>this.hass.states[z]),h=u(["light"]),p=u(["cover"]),d=u(["climate"]),_=u(["media"]),b=u(["switch","fan","lock"]),g=u(["sensor","binary"]),v=u(["scene","script"]),$=this.facts(d),S=h.filter(y=>y.state==="on");return m`<section class="nf-rp" aria-label=${t.name}>
|
||||||
<header class="nf-rp-head">
|
<header class="nf-rp-head">
|
||||||
<div>
|
<div>
|
||||||
<h2>${t.name}</h2>
|
<h2>${t.name}</h2>
|
||||||
${$.length?m`<p class="nf-rp-facts">${$.join(" \xB7 ")}</p>`:f} ${this.renderEnergy()} ${this.renderSunYear()} ${this.renderShade()}
|
${$.length?m`<p class="nf-rp-facts">${$.join(" \xB7 ")}</p>`:f} ${this.renderEnergy()} ${this.renderSunYear()} ${this.renderShade()}
|
||||||
${this.renderOpenWhileHeating(d)} ${this.renderEmptyLights(t,k)}
|
${this.renderOpenWhileHeating(d)} ${this.renderEmptyLights(t,S)}
|
||||||
${this.renderCurve()}
|
${this.renderCurve()}
|
||||||
</div>
|
</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}>
|
<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}>
|
||||||
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${this._folded?J`<path d="M6 14l6-6 6 6" />`:J`<path d="M6 12h12" />`}</svg>
|
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${this._folded?Q`<path d="M6 14l6-6 6 6" />`:Q`<path d="M6 12h12" />`}</svg>
|
||||||
</button>
|
</button>
|
||||||
<button class="nf-rp-close" aria-label=${this.t("close")} @click=${()=>this.fire("close")}>
|
<button class="nf-rp-close" aria-label=${this.t("close")} @click=${()=>this.fire("close")}>
|
||||||
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18" /></svg>
|
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18" /></svg>
|
||||||
@@ -273,14 +273,14 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
${v.map(y=>m`<button
|
${v.map(y=>m`<button
|
||||||
class="nf-btn"
|
class="nf-btn"
|
||||||
?disabled=${I(y)}
|
?disabled=${I(y)}
|
||||||
@click=${()=>this.call(D(y.entity_id)==="scene"?"scene":"script","turn_on",{entity_id:y.entity_id})}
|
@click=${()=>this.call(F(y.entity_id)==="scene"?"scene":"script","turn_on",{entity_id:y.entity_id})}
|
||||||
>
|
>
|
||||||
${this.name(y.entity_id)}
|
${this.name(y.entity_id)}
|
||||||
</button>`)}
|
</button>`)}
|
||||||
</div>`]):f}
|
</div>`]):f}
|
||||||
${h.length?this.section("panel_lights",[...h.map(y=>this.lightRow(y)),...t?[this.renderMoods(t,h)]:[]],m`${k.length<h.length?m`<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_on",{entity_id:h.filter(y=>!I(y)).map(y=>y.entity_id)})}>
|
${h.length?this.section("panel_lights",[...h.map(y=>this.lightRow(y)),...t?[this.renderMoods(t,h)]:[]],m`${S.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")}
|
${this.t("panel_all_on")}
|
||||||
</button>`:f}${k.length?m`<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_off",{entity_id:k.map(y=>y.entity_id)})}>
|
</button>`:f}${S.length?m`<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_off",{entity_id:S.map(y=>y.entity_id)})}>
|
||||||
${this.t("panel_all_off")}
|
${this.t("panel_all_off")}
|
||||||
</button>`:f}`):f}
|
</button>`:f}`):f}
|
||||||
${p.length?this.section("panel_covers",p.map(y=>this.coverRow(y)),p.length>1&&Un(p,this.confirmEntities).length?m`<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","open_cover",{entity_id:Un(p,this.confirmEntities)})}>
|
${p.length?this.section("panel_covers",p.map(y=>this.coverRow(y)),p.length>1&&Un(p,this.confirmEntities).length?m`<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","open_cover",{entity_id:Un(p,this.confirmEntities)})}>
|
||||||
@@ -299,12 +299,12 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
${this._showAll?this.t("panel_less"):this.t("panel_more",{n:l})}
|
${this._showAll?this.t("panel_less"):this.t("panel_more",{n:l})}
|
||||||
</button>`:f}
|
</button>`:f}
|
||||||
</div>
|
</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||W(this.hass,n.entity_id),rows:ar(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"?W(this.hass,n.entity):this.t("device")),rows:ar(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(i=>m`<div class="nf-rp-row"><span class="nf-rp-icon">${i.icon}</span><span class="nf-rp-name">${i.label}</span><b class="nf-rp-state">${i.text}</b></div>`)}</div>`)):f}facts(e){let t=[],n=this.room;if(!n)return t;let i=(E,F)=>{let C=U(this.hass,this.floor,n,E);if(C===null)return null;if(E==="temperature")return`${O(this.hass,ie(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`${O(this.hass,C,1)} ${M}`},o=e.find(E=>typeof E.attributes.current_temperature=="number"),s=i("temperature","\xB0C");s?t.push(s):o&&n.climate?.temperature!=="none"&&t.push(`${O(this.hass,o.attributes.current_temperature,1)} ${X(this.hass)}`);let a=i("humidity","%");a&&t.push(a);let l=U(this.hass,this.floor??null,n,"illuminance");l!==null&&t.push(`\u2600 ${O(this.hass,l,0)} lx`);let c=this.floor&&this.building?Ci(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:Oi(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:Oi(Date.now()-E)})}`)}let p=this.building?il(this.hass,this.building).filter(E=>E.roomId===n.id&&E.level<rl):[];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:O(this.hass,E.hours,1),facing:E.facing.join(", ")})}`)}let $=U(this.hass,this.floor,n,"temperature"),k=U(this.hass,this.floor,n,"humidity"),y=hr(U(this.hass,this.floor,n,"co2"),k,Et($,k));y&&!_.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${y}`)}`);let z=pr($,k,U(this.hass,this.floor,n,"co2"),at(new Date,this.hass.config?.latitude));return z!==null&&($!==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(o=>this.t(`announce_phrase_${o}`)),n=o=>{let s=o.trim();s&&(clearTimeout(this.saidTimer),this.hass.callService("nextfloor","announce",{message:s,rooms:[e.id],on_screens:!1}).then(()=>this._said={text:this.t("announce_sent",{message:s}),failed:!1},a=>this._said={text:this.t("announce_failed",{error:a?.message??String(a)}),failed:!0}),this.saidTimer=setTimeout(()=>this._said=null,6e3))},i=o=>{o.preventDefault();let s=o.currentTarget.querySelector("input");n(s.value),s.value=""};return this.section("panel_announce",[m`<div class="nf-rp-scenes">${t.map(o=>m`<button class="nf-btn" @click=${()=>n(o)}>${o}</button>`)}</div>
|
</section>`}extraValues(e){if(!this.floor)return f;let t=[...this.floor.placements.filter(n=>!n.outside&&H([n.x,n.z],e.points)).map(n=>({name:n.name||W(this.hass,n.entity_id),rows:ar(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"?W(this.hass,n.entity):this.t("device")),rows:ar(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(i=>m`<div class="nf-rp-row"><span class="nf-rp-icon">${i.icon}</span><span class="nf-rp-name">${i.label}</span><b class="nf-rp-state">${i.text}</b></div>`)}</div>`)):f}facts(e){let t=[],n=this.room;if(!n)return t;let i=(E,D)=>{let C=U(this.hass,this.floor,n,E);if(C===null)return null;if(E==="temperature")return`${O(this.hass,ie(this.hass,C),1)} ${X(this.hass)}`;let R=Ve(this.hass,this.floor,n,E)[0],M=this.hass.states[R]?.attributes.unit_of_measurement??D;return`${O(this.hass,C,1)} ${M}`},o=e.find(E=>typeof E.attributes.current_temperature=="number"),s=i("temperature","\xB0C");s?t.push(s):o&&n.climate?.temperature!=="none"&&t.push(`${O(this.hass,o.attributes.current_temperature,1)} ${X(this.hass)}`);let a=i("humidity","%");a&&t.push(a);let l=U(this.hass,this.floor??null,n,"illuminance");l!==null&&t.push(`\u2600 ${O(this.hass,l,0)} lx`);let c=this.floor&&this.building?Ii(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:Ni(Date.now()-Math.min(...u))})}`);let h=K(this.hass,n).map(E=>this.hass.states[E]).filter(E=>!!E&&E.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(E.attributes.device_class)));if(h.length)if(h.some(E=>E.state==="on"))t.push(`\u{1F6B6} ${this.t("presence_now")}`);else{let E=Math.max(...h.map(D=>Date.parse(String(D.last_changed??""))||0));E>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:Ni(Date.now()-E)})}`)}let p=this.building?il(this.hass,this.building).filter(E=>E.roomId===n.id&&E.level<rl):[];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:O(this.hass,E.hours,1),facing:E.facing.join(", ")})}`)}let $=U(this.hass,this.floor,n,"temperature"),S=U(this.hass,this.floor,n,"humidity"),y=hr(U(this.hass,this.floor,n,"co2"),S,Et($,S));y&&!_.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${y}`)}`);let z=pr($,S,U(this.hass,this.floor,n,"co2"),at(new Date,this.hass.config?.latitude));return z!==null&&($!==null||S!==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(o=>this.t(`announce_phrase_${o}`)),n=o=>{let s=o.trim();s&&(clearTimeout(this.saidTimer),this.hass.callService("nextfloor","announce",{message:s,rooms:[e.id],on_screens:!1}).then(()=>this._said={text:this.t("announce_sent",{message:s}),failed:!1},a=>this._said={text:this.t("announce_failed",{error:a?.message??String(a)}),failed:!0}),this.saidTimer=setTimeout(()=>this._said=null,6e3))},i=o=>{o.preventDefault();let s=o.currentTarget.querySelector("input");n(s.value),s.value=""};return this.section("panel_announce",[m`<div class="nf-rp-scenes">${t.map(o=>m`<button class="nf-btn" @click=${()=>n(o)}>${o}</button>`)}</div>
|
||||||
<form class="nf-rp-say" @submit=${i}>
|
<form class="nf-rp-say" @submit=${i}>
|
||||||
<input type="text" maxlength="500" placeholder=${this.t("announce_placeholder")} aria-label=${this.t("announce_placeholder")} />
|
<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>
|
<button class="nf-btn nf-primary" type="submit">${this.t("announce_send")}</button>
|
||||||
</form>
|
</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 as({hass:this.hass,room:{id:e.id,name:e.name,area_id:e.area_id??null},entities:t}).map(i=>m`<div class="nf-rp-sec nf-rp-plugin" data-plugin=${i.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 ss({hass:this.hass,room:{id:e.id,name:e.name,area_id:e.area_id??null},entities:t}).map(i=>m`<div class="nf-rp-sec nf-rp-plugin" data-plugin=${i.key}>
|
||||||
<div class="nf-rp-sec-head"><h3>${i.title}</h3></div>
|
<div class="nf-rp-sec-head"><h3>${i.title}</h3></div>
|
||||||
${typeof i.content=="string"?m`<p class="nf-rp-note">${i.content}</p>`:i.content}
|
${typeof i.content=="string"?m`<p class="nf-rp-note">${i.content}</p>`:i.content}
|
||||||
</div>`)}section(e,t,n=f){return m`<div class="nf-rp-sec">
|
</div>`)}section(e,t,n=f){return m`<div class="nf-rp-sec">
|
||||||
@@ -392,20 +392,20 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
${this.stateLabel(u)}
|
${this.stateLabel(u)}
|
||||||
</button>`)}
|
</button>`)}
|
||||||
</div>`:f}
|
</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,i=I(e)||e.state==="off",o=[t.media_title,t.media_artist].filter(s=>typeof s=="string"&&s).join(" \xB7 ");return m`<div class="nf-rp-row">
|
</div>`}stateOf(e,t=te(this.hass,e)){if(this.room?.no_state?.includes(e.entity_id))return"";let n=F(e.entity_id);return e.state==="unknown"&&n!=="sensor"&&n!=="binary"?"":t}stateLabel(e){let t=`state_${e}`,n=this.t(t);return n===t?e:n}mediaRow(e){let t=e.attributes,n=e.entity_id,i=I(e)||e.state==="off",o=[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":""}">${zt("media")}</span>
|
<span class="nf-rp-icon ${e.state==="playing"?"nf-rp-on":""}">${zt("media")}</span>
|
||||||
${this.nameButton(n)}
|
${this.nameButton(n)}
|
||||||
<span class="nf-rp-state">${this.stateOf(e,this.stateLabel(e.state))}</span>
|
<span class="nf-rp-state">${this.stateOf(e,this.stateLabel(e.state))}</span>
|
||||||
${o?m`<p class="nf-rp-media nf-rp-wide">${o}</p>`:f}
|
${o?m`<p class="nf-rp-media nf-rp-wide">${o}</p>`:f}
|
||||||
<div class="nf-rp-buttons nf-rp-wide">
|
<div class="nf-rp-buttons nf-rp-wide">
|
||||||
<button class="nf-btn nf-rp-small" aria-label=${this.t("previous")} ?disabled=${i} @click=${()=>this.call("media_player","media_previous_track",{entity_id:n})}>
|
<button class="nf-btn nf-rp-small" aria-label=${this.t("previous")} ?disabled=${i} @click=${()=>this.call("media_player","media_previous_track",{entity_id:n})}>
|
||||||
${Wi(vr.previous)}
|
${Oi(vr.previous)}
|
||||||
</button>
|
</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})}>
|
<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})}>
|
||||||
${Wi(e.state==="playing"?vr.pause:vr.play)}
|
${Oi(e.state==="playing"?vr.pause:vr.play)}
|
||||||
</button>
|
</button>
|
||||||
<button class="nf-btn nf-rp-small" aria-label=${this.t("next")} ?disabled=${i} @click=${()=>this.call("media_player","media_next_track",{entity_id:n})}>
|
<button class="nf-btn nf-rp-small" aria-label=${this.t("next")} ?disabled=${i} @click=${()=>this.call("media_player","media_next_track",{entity_id:n})}>
|
||||||
${Wi(vr.next)}
|
${Oi(vr.next)}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
${typeof t.volume_level=="number"?m`<label class="nf-rp-slider"
|
${typeof t.volume_level=="number"?m`<label class="nf-rp-slider"
|
||||||
@@ -417,12 +417,12 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
.value=${String(Math.round(t.volume_level*100))}
|
.value=${String(Math.round(t.volume_level*100))}
|
||||||
@change=${s=>this.call("media_player","volume_set",{entity_id:n,volume_level:Number(s.target.value)/100})}
|
@change=${s=>this.call("media_player","volume_set",{entity_id:n,volume_level:Number(s.target.value)/100})}
|
||||||
/></label>`:f}
|
/></label>`:f}
|
||||||
</div>`}switchRow(e){let t=e.entity_id,n=D(t),i=t.slice(0,t.indexOf(".")),o=n==="lock"?e.state==="unlocked"||e.state==="open":Q(e),s=()=>n==="lock"?this.call("lock",o?"lock":"unlock",{entity_id:t}):this.call(i,"toggle",{entity_id:t});return m`<div class="nf-rp-row">
|
</div>`}switchRow(e){let t=e.entity_id,n=F(t),i=t.slice(0,t.indexOf(".")),o=n==="lock"?e.state==="unlocked"||e.state==="open":J(e),s=()=>n==="lock"?this.call("lock",o?"lock":"unlock",{entity_id:t}):this.call(i,"toggle",{entity_id:t});return m`<div class="nf-rp-row">
|
||||||
<span class="nf-rp-icon ${o?"nf-rp-on":""}">${zt(n)}</span>
|
<span class="nf-rp-icon ${o?"nf-rp-on":""}">${zt(n)}</span>
|
||||||
${this.nameButton(t)}
|
${this.nameButton(t)}
|
||||||
<span class="nf-rp-state">${this.stateOf(e)}</span>
|
<span class="nf-rp-state">${this.stateOf(e)}</span>
|
||||||
${this.toggle(e,o,s)}
|
${this.toggle(e,o,s)}
|
||||||
</div>`}sensorRow(e){let t=D(e.entity_id),n=t==="binary"&&e.state==="on";return m`<div class="nf-rp-row">
|
</div>`}sensorRow(e){let t=F(e.entity_id),n=t==="binary"&&e.state==="on";return m`<div class="nf-rp-row">
|
||||||
<span class="nf-rp-icon ${n?"nf-rp-on":""}">${zt(t)}</span>
|
<span class="nf-rp-icon ${n?"nf-rp-on":""}">${zt(t)}</span>
|
||||||
${this.nameButton(e.entity_id)}
|
${this.nameButton(e.entity_id)}
|
||||||
<span class="nf-rp-state">${this.stateOf(e)}</span>
|
<span class="nf-rp-state">${this.stateOf(e)}</span>
|
||||||
@@ -807,8 +807,8 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
outline: 2px solid var(--nf-accent);
|
outline: 2px solid var(--nf-accent);
|
||||||
outline-offset: 2px;
|
outline-offset: 2px;
|
||||||
}
|
}
|
||||||
`]};customElements.get("nf-room-panel")||customElements.define("nf-room-panel",Li);function fl(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 Zh=[[/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]]],gl=[34,211,238];function Bi(r){return r?Zh.find(([e])=>e.test(r))?.[1]??gl:gl}function Vi(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 Ki=r=>r.state==="playing"||r.state==="on"&&Vi(r);function _l(r,e){let t=[],n=new Set;for(let i of e){if(!i.entity.startsWith("media_player.")||n.has(i.entity))continue;n.add(i.entity);let o=r.states[i.entity];if(!o)continue;let s=o.attributes,a=u=>typeof s[u]=="string"?s[u]:"",l=a("app_name")||a("source")||a("app_id")||null,c=typeof s.volume_level=="number"?s.volume_level:null;t.push({entity:i.entity,name:i.name,at:i.at,playing:Ki(o),title:a("media_title")||a("media_channel")||l||"",artist:a("media_artist")||a("media_album_name")||a("media_series_title"),picture:a("entity_picture")||null,volume:c,color:Bi(l),app:l,group:Array.isArray(s.group_members)?s.group_members.filter(u=>typeof u=="string"&&u!==i.entity):[],rings:i.rings??1})}return t}function bl(r){let e=new Map(r.filter(i=>i.playing).map(i=>[i.entity,i])),t=[],n=new Set;for(let i of e.values())for(let o of i.group){let s=e.get(o),a=[i.entity,o].sort().join("|");s&&!n.has(a)&&(n.add(a),t.push([i,s]))}return t}var Yh=3;function vl(r,e,t){let n=[];for(let i of e.floors)for(let o of i.furniture){if(!o.type.endsWith(":sprinkler"))continue;let s=t?.get(o.id)?.entity??null;!s||!Q(r.states[s])||n.push({id:o.id,at:{floorId:i.id,x:o.x,y:ce(i,o)+o.h,z:o.z},reach:Math.min(15,Math.max(.5,o.spray??Yh))})}return n}var wr=r=>r&&r!=="none"?r:null,wl=r=>Math.min(1,Math.max(0,r));function yl(r,e){let t=new Map;for(let n of e.settings.roof?.windows??[]){let i=ze(r,{cover:wr(n.cover),contact:wr(n.contact),tilt:wr(n.tilt)},"window"),o=wr(n.window),s=o?r.states[o]:void 0,a=i.open;if(s&&!I(s)){let l=s.attributes.current_position;a=typeof l=="number"?wl(l/100):s.state==="open"||s.state==="opening"?1:0}t.set(n.id,{open:a,tilt:i.tilt,cover:i.cover??0})}return t}function Jh(r,e){let t=i=>Math.hypot(i.x-e.x,i.z-e.z);return r.placements.filter(i=>i.entity_id.startsWith("media_player.")&&t(i)<Math.max(2,e.w)).sort((i,o)=>t(i)-t(o))[0]?.entity_id??null}var je=(r,e)=>typeof r[e]=="string"?r[e]:"";function xl(r,e,t){let n=[];for(let i of e.floors)for(let o of i.furniture){if(!Xn(o.type))continue;let s=t?.get(o.id)?.entity??null,a=s?.startsWith("media_player.")?s:Jh(i,o),l=a?r.states[a]:void 0;if(!l||!Vi(l))continue;let c=l.attributes,u=je(c,"app_name")||je(c,"source")||null;n.push({id:o.id,furnitureId:o.id,floorId:i.id,color:Bi(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:Ki(l),ambilight:o.ambilight??1})}return n}function kl(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 Sl(r,e){return(r===null?0:wl((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 yr=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(),i=/^([<>])\s*(-?\d+(?:[.,]\d+)?)$/.exec(n);if(i){let o=Number(t.state),s=Number(i[2].replace(",","."));return Number.isFinite(o)&&(i[1]==="<"?o<s:o>s)}return n.split(",").map(o=>o.trim().toLowerCase()).filter(Boolean).includes(String(t.state).toLowerCase())}var Xh=600*1e3,ep=new Set(["rainy","pouring","lightning-rainy","hail","snowy-rainy"]),tp=new Map([["smoke","smoke"],["gas","gas"],["carbon_monoxide","co"],["moisture","water"]]),$l=(r,e)=>{if(e.startsWith("binary_sensor."))return tp.get(String(r.states[e]?.attributes.device_class))};function np(r,e){let t=new Set,n=[];for(let i of r.floors)for(let o of i.openings){let s=e.get(o.id);for(let a of s?[s.contact,s.contact2,s.tilt,s.tilt2]:[])!a||t.has(a)||(t.add(a),n.push({floorId:i.id,roomId:o.room_id,entity:a}))}return n}function Ml(r,e,t,n){let i=[];for(let a of e.floors)for(let l of a.rooms){let c=K(r,l).filter(u=>$l(r,u));
Line truncated
|
`]};customElements.get("nf-room-panel")||customElements.define("nf-room-panel",Wi);function fl(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 Zh=[[/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]]],gl=[34,211,238];function Li(r){return r?Zh.find(([e])=>e.test(r))?.[1]??gl:gl}function Bi(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 Vi=r=>r.state==="playing"||r.state==="on"&&Bi(r);function _l(r,e){let t=[],n=new Set;for(let i of e){if(!i.entity.startsWith("media_player.")||n.has(i.entity))continue;n.add(i.entity);let o=r.states[i.entity];if(!o)continue;let s=o.attributes,a=u=>typeof s[u]=="string"?s[u]:"",l=a("app_name")||a("source")||a("app_id")||null,c=typeof s.volume_level=="number"?s.volume_level:null;t.push({entity:i.entity,name:i.name,at:i.at,playing:Vi(o),title:a("media_title")||a("media_channel")||l||"",artist:a("media_artist")||a("media_album_name")||a("media_series_title"),picture:a("entity_picture")||null,volume:c,color:Li(l),app:l,group:Array.isArray(s.group_members)?s.group_members.filter(u=>typeof u=="string"&&u!==i.entity):[],rings:i.rings??1})}return t}function bl(r){let e=new Map(r.filter(i=>i.playing).map(i=>[i.entity,i])),t=[],n=new Set;for(let i of e.values())for(let o of i.group){let s=e.get(o),a=[i.entity,o].sort().join("|");s&&!n.has(a)&&(n.add(a),t.push([i,s]))}return t}var Yh=3;function vl(r,e,t){let n=[];for(let i of e.floors)for(let o of i.furniture){if(!o.type.endsWith(":sprinkler"))continue;let s=t?.get(o.id)?.entity??null;!s||!J(r.states[s])||n.push({id:o.id,at:{floorId:i.id,x:o.x,y:ce(i,o)+o.h,z:o.z},reach:Math.min(15,Math.max(.5,o.spray??Yh))})}return n}var wr=r=>r&&r!=="none"?r:null,wl=r=>Math.min(1,Math.max(0,r));function yl(r,e){let t=new Map;for(let n of e.settings.roof?.windows??[]){let i=ze(r,{cover:wr(n.cover),contact:wr(n.contact),tilt:wr(n.tilt)},"window"),o=wr(n.window),s=o?r.states[o]:void 0,a=i.open;if(s&&!I(s)){let l=s.attributes.current_position;a=typeof l=="number"?wl(l/100):s.state==="open"||s.state==="opening"?1:0}t.set(n.id,{open:a,tilt:i.tilt,cover:i.cover??0})}return t}function Jh(r,e){let t=i=>Math.hypot(i.x-e.x,i.z-e.z);return r.placements.filter(i=>i.entity_id.startsWith("media_player.")&&t(i)<Math.max(2,e.w)).sort((i,o)=>t(i)-t(o))[0]?.entity_id??null}var je=(r,e)=>typeof r[e]=="string"?r[e]:"";function xl(r,e,t){let n=[];for(let i of e.floors)for(let o of i.furniture){if(!Xn(o.type))continue;let s=t?.get(o.id)?.entity??null,a=s?.startsWith("media_player.")?s:Jh(i,o),l=a?r.states[a]:void 0;if(!l||!Bi(l))continue;let c=l.attributes,u=je(c,"app_name")||je(c,"source")||null;n.push({id:o.id,furnitureId:o.id,floorId:i.id,color:Li(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:Vi(l),ambilight:o.ambilight??1})}return n}function kl(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 Sl(r,e){return(r===null?0:wl((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 yr=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(),i=/^([<>])\s*(-?\d+(?:[.,]\d+)?)$/.exec(n);if(i){let o=Number(t.state),s=Number(i[2].replace(",","."));return Number.isFinite(o)&&(i[1]==="<"?o<s:o>s)}return n.split(",").map(o=>o.trim().toLowerCase()).filter(Boolean).includes(String(t.state).toLowerCase())}var Xh=600*1e3,ep=new Set(["rainy","pouring","lightning-rainy","hail","snowy-rainy"]),tp=new Map([["smoke","smoke"],["gas","gas"],["carbon_monoxide","co"],["moisture","water"]]),$l=(r,e)=>{if(e.startsWith("binary_sensor."))return tp.get(String(r.states[e]?.attributes.device_class))};function np(r,e){let t=new Set,n=[];for(let i of r.floors)for(let o of i.openings){let s=e.get(o.id);for(let a of s?[s.contact,s.contact2,s.tilt,s.tilt2]:[])!a||t.has(a)||(t.add(a),n.push({floorId:i.id,roomId:o.room_id,entity:a}))}return n}function Ml(r,e,t,n){let i=[];for(let a of e.floors)for(let l of a.rooms){let c=K(r,l).filter(u=>$l(r,u));
Line truncated
|
||||||
${J`<circle cx="27" cy="27" r=${22} class="live-ring-bg"></circle>
|
${Q`<circle cx="27" cy="27" r=${22} class="live-ring-bg"></circle>
|
||||||
<circle cx="27" cy="27" r=${22} stroke=${e} stroke-dasharray=${`${(n*Math.max(0,Math.min(1,r))).toFixed(1)} ${n.toFixed(1)}`} transform="rotate(-90 27 27)" class="live-ring-fg"></circle>`}
|
<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 hm(r,e,t,n){let i=e.summary,o=c=>A(r,c),s=e.autarky,a=n?m`<button class="live-fold" title=${o(n.folded?"live_unfold":"live_fold")} aria-label=${o(n.folded?"live_unfold":"live_fold")} aria-expanded=${!n.folded} @click=${n.toggle}>${n.folded?"+":"\u2212"}</button>`:f;if(n?.folded){let c=i.solar!==null?`\u2600 ${Me(r,i.solar)}`:i.consumption!==null?`\u2302 ${Me(r,i.consumption)}`:null;return m`<div class="live-card live-card-house live-folded" data-i=${t}>
|
</svg>`}function hm(r,e,t,n){let i=e.summary,o=c=>A(r,c),s=e.autarky,a=n?m`<button class="live-fold" title=${o(n.folded?"live_unfold":"live_fold")} aria-label=${o(n.folded?"live_unfold":"live_fold")} aria-expanded=${!n.folded} @click=${n.toggle}>${n.folded?"+":"\u2212"}</button>`:f;if(n?.folded){let c=i.solar!==null?`\u2600 ${Me(r,i.solar)}`:i.consumption!==null?`\u2302 ${Me(r,i.consumption)}`:null;return m`<div class="live-card live-card-house live-folded" data-i=${t}>
|
||||||
${s!==null?m`<div class="live-own">${wn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)}%</b></div></div>`:f}
|
${s!==null?m`<div class="live-own">${wn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)}%</b></div></div>`:f}
|
||||||
@@ -819,15 +819,15 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
${s!==null?m`<div class="live-own">${wn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)} %</b><span>${o("live_autarky")}</span></div></div>`:f}
|
${s!==null?m`<div class="live-own">${wn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)} %</b><span>${o("live_autarky")}</span></div></div>`:f}
|
||||||
<div class="live-rows">${l}</div>
|
<div class="live-rows">${l}</div>
|
||||||
${mm(r,e.curves)} ${pm(r,e.week)}
|
${mm(r,e.curves)} ${pm(r,e.week)}
|
||||||
</div>`}function pm(r,e){if(!e)return f;let t=[...e.solar,...e.use].filter(c=>c!==null&&c>0);if(!t.length)return f;let n=Math.max(...t)*1.1||1,[i,o]=[150,30],s=i/7,a=(c,u,h)=>c===null||c<=0?f:J`<rect x=${u.toFixed(1)} y=${(o-c/n*o).toFixed(1)} width=${(s*.36).toFixed(1)} height=${(c/n*o).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:O(r,l(e.solar),0),use:O(r,l(e.use),0)})}>
|
</div>`}function pm(r,e){if(!e)return f;let t=[...e.solar,...e.use].filter(c=>c!==null&&c>0);if(!t.length)return f;let n=Math.max(...t)*1.1||1,[i,o]=[150,30],s=i/7,a=(c,u,h)=>c===null||c<=0?f:Q`<rect x=${u.toFixed(1)} y=${(o-c/n*o).toFixed(1)} width=${(s*.36).toFixed(1)} height=${(c/n*o).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:O(r,l(e.solar),0),use:O(r,l(e.use),0)})}>
|
||||||
<svg viewBox=${`0 0 ${i} ${o}`} preserveAspectRatio="none" aria-hidden="true">
|
<svg viewBox=${`0 0 ${i} ${o}`} 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")}`)}
|
${e.days.map((c,u)=>Q`${a(e.solar[u],u*s+s*.1,"live-week-solar")}${a(e.use[u],u*s+s*.5,"live-week-use")}`)}
|
||||||
</svg>
|
</svg>
|
||||||
<span>7 ${A(r,"live_days")}</span>
|
<span>7 ${A(r,"live_days")}</span>
|
||||||
</div>`}function mm(r,e){if(!e)return f;let t=[...e.solar,...e.use].filter(l=>l!==null);if(t.length<4)return f;let n=Math.max(...t)*1.08||1,[i,o]=[150,34],s=un(e.solar,i,o,n),a=un(e.use,i,o,n);return m`<div class="live-day" title=${A(r,"live_day_hint")}>
|
</div>`}function mm(r,e){if(!e)return f;let t=[...e.solar,...e.use].filter(l=>l!==null);if(t.length<4)return f;let n=Math.max(...t)*1.08||1,[i,o]=[150,34],s=un(e.solar,i,o,n),a=un(e.use,i,o,n);return m`<div class="live-day" title=${A(r,"live_day_hint")}>
|
||||||
<svg viewBox=${`0 0 ${i} ${o}`} preserveAspectRatio="none" aria-hidden="true">
|
<svg viewBox=${`0 0 ${i} ${o}`} preserveAspectRatio="none" aria-hidden="true">
|
||||||
${s?J`<path d=${`${s}L${i},${o}L0,${o}Z`} class="live-day-solar"></path>`:f}
|
${s?Q`<path d=${`${s}L${i},${o}L0,${o}Z`} class="live-day-solar"></path>`:f}
|
||||||
${a?J`<path d=${a} class="live-day-use"></path>`:f}
|
${a?Q`<path d=${a} class="live-day-use"></path>`:f}
|
||||||
</svg>
|
</svg>
|
||||||
<span>24 h</span>
|
<span>24 h</span>
|
||||||
</div>`}function fm(r,e,t,n){let i=e.car,o=(u,h)=>A(r,u,h),s=wc(i.soc),a=i.home?i.charging?`\u26A1 ${o("live_car_charging")}${i.chargingW?` \xB7 ${Me(r,i.chargingW)}`:""}`:i.plugged?`\u{1F50C} ${o("live_car_plugged")}`:"":`${o("live_car_away")}${i.where?` \xB7 ${i.where}`:""}${i.distance!==null?` \xB7 ${O(r,i.distance,i.distance<10?1:0)} km`:""}`,l=i.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 ${i.charging?"live-charging":""} ${i.home?"":"live-away"}" data-i=${t} style=${`--live-soc:${s}`}>
|
</div>`}function fm(r,e,t,n){let i=e.car,o=(u,h)=>A(r,u,h),s=wc(i.soc),a=i.home?i.charging?`\u26A1 ${o("live_car_charging")}${i.chargingW?` \xB7 ${Me(r,i.chargingW)}`:""}`:i.plugged?`\u{1F50C} ${o("live_car_plugged")}`:"":`${o("live_car_away")}${i.where?` \xB7 ${i.where}`:""}${i.distance!==null?` \xB7 ${O(r,i.distance,i.distance<10?1:0)} km`:""}`,l=i.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 ${i.charging?"live-charging":""} ${i.home?"":"live-away"}" data-i=${t} style=${`--live-soc:${s}`}>
|
||||||
@@ -1219,7 +1219,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
letter-spacing: 0.04em;
|
letter-spacing: 0.04em;
|
||||||
}
|
}
|
||||||
`;function Dr(r){return r.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var co=r=>r.points.length>=3;function Sc(r,e,t){return r.rooms.filter(co).find(n=>H([e,t],n.points))}function wm(r,e,t,n){let i=[];for(let a of e.rooms.filter(co)){let[l,c]=xe(a.points);i.push({kind:"room",name:a.name,where:n?e.name:"",floorId:e.id,roomId:a.id,entity:null,icon:null,x:l,z:c,y:0})}let o=new Set,s=(a,l,c,u)=>{if(o.has(a)||!(a in r.states))return;o.add(a);let h=Sc(e,l,c),p=[h?.name,n?e.name:void 0].filter(d=>!!d).join(" \xB7 ");i.push({kind:"device",name:W(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=Sc(e,a.x,a.z),c=[l?.name,n?e.name:void 0].filter(u=>!!u).join(" \xB7 ");i.push({kind:"note",name:`\u270E ${a.text.length>60?`${a.text.slice(0,59)}\u2026`:a.text}`,where:c,floorId:e.id,roomId:l?.id??null,entity:null,icon:null,x:a.x,z:a.z,y:1.3})}return i}function $c(r,e){let t=ot(r,e.floors),n=e.floors.length>1,i=e.floors.flatMap(o=>wm(r,o,t,n));for(let o of e.settings.circuits??[]){let s=e.floors.flatMap(h=>h.rooms.filter(p=>o.rooms.includes(p.id)&&co(p)).map(p=>({f:h,r:p})));if(!s.length)continue;let[{f:a,r:l}]=s,[c,u]=xe(l.points);i.push({kind:"circuit",name:`\u{1F50C} ${o.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 i}function ym(r,e){return(Dr(r.name).startsWith(e)?0:2)+(r.kind==="room"?0:1)}function Mc(r,e,t=8){let n=Dr(e).split(/\s+/).filter(Boolean);if(n.length===0)return[];let i=Dr(e.trim());return r.filter(o=>{let s=Dr([o.name,o.where,o.entity].filter(Boolean).join(" "));return n.every(a=>s.includes(a))}).map(o=>({item:o,cost:ym(o,i)})).sort((o,s)=>o.cost-s.cost||o.item.name.localeCompare(s.item.name)).slice(0,t).map(o=>o.item)}var xm=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[190,90,255],[255,95,210],[255,70,70],[120,255,150]],km=[2200,2700,3200,4e3,5e3,6500],Sm=["hs","rgb","rgbw","rgbww","xy"],$m=4,Ac=16,Ec=32,Mm=128;function ho(r){let e=r.attributes.supported_color_modes??[],t=e.some(n=>Sm.includes(n));return{dim:e.some(n=>n!=="onoff"),color:t,temp:e.includes("color_temp")}}function po(r){return((r.attributes.supported_features??0)&$m)!==0&&typeof r.attributes.current_position=="number"}var uo=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:W(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,i)=>{let o=i/t*Math.PI*2-Math.PI/2;return m`<div class="qm-at" style="left:${50+Math.cos(o)*39}%;top:${50+Math.sin(o)*39}%">${n}</div>`})}renderLight(e){let t=ho(e),n=e.state==="on",i=n&&typeof e.attributes.brightness=="number"?Math.round(e.attributes.brightness/2.55):n?100:0,o=t.color?xm.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?km.map(s=>m`<button class="qm-swatch" style="background:${Am(s)}" aria-label=${`${s} K`} @click=${()=>this.call("light","turn_on",{color_temp_kelvin:s})}></button>`):[];return m`<div class="qm-ring ${o.length?"":"qm-ring-small"}">
|
`;function Fr(r){return r.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var lo=r=>r.points.length>=3;function Sc(r,e,t){return r.rooms.filter(lo).find(n=>H([e,t],n.points))}function wm(r,e,t,n){let i=[];for(let a of e.rooms.filter(lo)){let[l,c]=xe(a.points);i.push({kind:"room",name:a.name,where:n?e.name:"",floorId:e.id,roomId:a.id,entity:null,icon:null,x:l,z:c,y:0})}let o=new Set,s=(a,l,c,u)=>{if(o.has(a)||!(a in r.states))return;o.add(a);let h=Sc(e,l,c),p=[h?.name,n?e.name:void 0].filter(d=>!!d).join(" \xB7 ");i.push({kind:"device",name:W(r,a),where:p,floorId:e.id,roomId:h?.id??null,entity:a,icon:F(a),x:l,z:c,y:u})};for(let a of e.placements){let l=a.y??yt(F(a.entity_id)??"sensor",me(e,a.x,a.z),a.mount);s(a.entity_id,a.x,a.z,l)}for(let a of e.furniture){let l=t.get(a.id),c=l?.entity??l?.power;if(!c)continue;let u=me(e,a.x,a.z)-.3;s(c,a.x,a.z,Math.min(u,Math.max(.5,a.h)))}for(let a of e.notes??[]){if(!a.text)continue;let l=Sc(e,a.x,a.z),c=[l?.name,n?e.name:void 0].filter(u=>!!u).join(" \xB7 ");i.push({kind:"note",name:`\u270E ${a.text.length>60?`${a.text.slice(0,59)}\u2026`:a.text}`,where:c,floorId:e.id,roomId:l?.id??null,entity:null,icon:null,x:a.x,z:a.z,y:1.3})}return i}function $c(r,e){let t=ot(r,e.floors),n=e.floors.length>1,i=e.floors.flatMap(o=>wm(r,o,t,n));for(let o of e.settings.circuits??[]){let s=e.floors.flatMap(h=>h.rooms.filter(p=>o.rooms.includes(p.id)&&lo(p)).map(p=>({f:h,r:p})));if(!s.length)continue;let[{f:a,r:l}]=s,[c,u]=xe(l.points);i.push({kind:"circuit",name:`\u{1F50C} ${o.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 i}function ym(r,e){return(Fr(r.name).startsWith(e)?0:2)+(r.kind==="room"?0:1)}function Mc(r,e,t=8){let n=Fr(e).split(/\s+/).filter(Boolean);if(n.length===0)return[];let i=Fr(e.trim());return r.filter(o=>{let s=Fr([o.name,o.where,o.entity].filter(Boolean).join(" "));return n.every(a=>s.includes(a))}).map(o=>({item:o,cost:ym(o,i)})).sort((o,s)=>o.cost-s.cost||o.item.name.localeCompare(s.item.name)).slice(0,t).map(o=>o.item)}var xm=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[190,90,255],[255,95,210],[255,70,70],[120,255,150]],km=[2200,2700,3200,4e3,5e3,6500],Sm=["hs","rgb","rgbw","rgbww","xy"],$m=4,Ac=16,Ec=32,Mm=128;function uo(r){let e=r.attributes.supported_color_modes??[],t=e.some(n=>Sm.includes(n));return{dim:e.some(n=>n!=="onoff"),color:t,temp:e.includes("color_temp")}}function ho(r){return((r.attributes.supported_features??0)&$m)!==0&&typeof r.attributes.current_position=="number"}var co=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:W(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,i)=>{let o=i/t*Math.PI*2-Math.PI/2;return m`<div class="qm-at" style="left:${50+Math.cos(o)*39}%;top:${50+Math.sin(o)*39}%">${n}</div>`})}renderLight(e){let t=uo(e),n=e.state==="on",i=n&&typeof e.attributes.brightness=="number"?Math.round(e.attributes.brightness/2.55):n?100:0,o=t.color?xm.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?km.map(s=>m`<button class="qm-swatch" style="background:${Am(s)}" aria-label=${`${s} K`} @click=${()=>this.call("light","turn_on",{color_temp_kelvin:s})}></button>`):[];return m`<div class="qm-ring ${o.length?"":"qm-ring-small"}">
|
||||||
${this.ring(o)}
|
${this.ring(o)}
|
||||||
<button class="qm-power ${n?"qm-on":""}" aria-pressed=${n} @click=${()=>this.ask()&&this.call("light","toggle")}>
|
<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>
|
<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>
|
||||||
@@ -1234,7 +1234,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
.value=${String(Math.max(1,i))}
|
.value=${String(Math.max(1,i))}
|
||||||
aria-label=${this.t("brightness")}
|
aria-label=${this.t("brightness")}
|
||||||
@change=${s=>this.call("light","turn_on",{brightness_pct:Number(s.target.value)})}
|
@change=${s=>this.call("light","turn_on",{brightness_pct:Number(s.target.value)})}
|
||||||
/>`:f}`}renderCover(e){e=rr(this.hass,e,this.tiltEntity);let t=typeof e.attributes.current_position=="number"?e.attributes.current_position:null,n=e.state==="opening"||e.state==="closing",i=po(e),o=(u,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=[o("\u25B2",this.t("cover_open"),()=>this.ask()&&this.call("cover","open_cover"),s(100)),...i?[75,50].map(u=>o(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],o("\u25BC",this.t("cover_close"),()=>this.ask()&&this.call("cover","close_cover"),s(0)),...i?[25].map(u=>o(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],...Number(e.attributes.supported_features??0)&8?[o("\u25A0",this.t("cover_stop"),()=>this.call("cover","stop_cover"),n)]:[],...this.myPosition!=null&&(i||Number(e.attributes.supported_features??0)&8)?[o("My",this.t("cover_my_go",{p:this.myPosition}),()=>this.ask()&&(i?this.call("cover","set_cover_position",{position:this.myPosition}):this.call("cover","stop_cover")),s(this.myPosition))]:[]],l=t===null?e.state==="closed"?100:0:100-t,c=t!==null||n||e.state==="open"||e.state==="closed";return m`<div class="qm-ring">
|
/>`:f}`}renderCover(e){e=rr(this.hass,e,this.tiltEntity);let t=typeof e.attributes.current_position=="number"?e.attributes.current_position:null,n=e.state==="opening"||e.state==="closing",i=ho(e),o=(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=[o("\u25B2",this.t("cover_open"),()=>this.ask()&&this.call("cover","open_cover"),s(100)),...i?[75,50].map(u=>o(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],o("\u25BC",this.t("cover_close"),()=>this.ask()&&this.call("cover","close_cover"),s(0)),...i?[25].map(u=>o(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],...Number(e.attributes.supported_features??0)&8?[o("\u25A0",this.t("cover_stop"),()=>this.call("cover","stop_cover"),n)]:[],...this.myPosition!=null&&(i||Number(e.attributes.supported_features??0)&8)?[o("My",this.t("cover_my_go",{p:this.myPosition}),()=>this.ask()&&(i?this.call("cover","set_cover_position",{position:this.myPosition}):this.call("cover","stop_cover")),s(this.myPosition))]:[]],l=t===null?e.state==="closed"?100:0:100-t,c=t!==null||n||e.state==="open"||e.state==="closed";return m`<div class="qm-ring">
|
||||||
${this.ring(a)}
|
${this.ring(a)}
|
||||||
<button
|
<button
|
||||||
class="qm-power qm-blind ${c&&l<100?"qm-on":""}"
|
class="qm-power qm-blind ${c&&l<100?"qm-on":""}"
|
||||||
@@ -1290,7 +1290,7 @@ 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>
|
${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 ${i.source===h?"qm-chip-on":""}" @click=${()=>this.call("media_player","select_source",{source:h})}>${h}</button>`)}</div>`:f}
|
<div class="qm-play">${s.map(h=>m`<button class="qm-chip ${i.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>
|
${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)&&!Zt(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=${W(this.hass,this.entity)}>
|
<div class="qm-play">${this.presets.map(h=>m`<button class="qm-chip" @click=${()=>this.call("media_player","play_media",{media_content_type:h.type,media_content_id:h.content})}>${h.label}</button>`)}</div>`:f}`}render(){let e=this.hass?.states[this.entity];if(!e)return f;let t=F(this.entity),n=I(e)&&!Zt(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=${W(this.hass,this.entity)}>
|
||||||
<div class="qm-title">${W(this.hass,this.entity)}</div>
|
<div class="qm-title">${W(this.hass,this.entity)}</div>
|
||||||
${n}
|
${n}
|
||||||
<button class="qm-details" @click=${()=>this.details()}>${this.t("details")} …</button>
|
<button class="qm-details" @click=${()=>this.details()}>${this.t("details")} …</button>
|
||||||
@@ -1537,9 +1537,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
.qm-note {
|
.qm-note {
|
||||||
color: var(--nf-muted);
|
color: var(--nf-muted);
|
||||||
}
|
}
|
||||||
`]};function Am(r){let e=Math.min(1,Math.max(0,(r-2200)/4300)),t=(n,i)=>Math.round(n+(i-n)*e);return`rgb(${t(255,200)},${t(170,225)},${t(80,255)})`}customElements.get("nf-quick-menu")||customElements.define("nf-quick-menu",uo);var Em=new URL(import.meta.url),Rm=new URL("./nextfloor-3d.js?v=74227cd20cc3",Em).href,Rc;function zc(){return Rc??=import(Rm),Rc}function Tc(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 zm=new Set(["on","home","open","true","active","playing","heat","heating"]);function Pr(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 i=String(n.state).toLowerCase(),o=(t.state??"").split(",").map(a=>a.trim().toLowerCase()).filter(Boolean),s=o.length?o.includes(i):zm.has(i)||Number.isFinite(Number(i))&&Number(i)>0;return t.invert?!s:s}function mo(r,e){let t=[];for(let n of e.floors)for(let i of n.furniture)Pr(r,i)||t.push(i.id);return t.sort()}function Fc(r,e){if(!e.length)return r;let t=new Set(e);return{...r,floors:r.floors.map(n=>n.furniture.some(i=>t.has(i.id))?{...n,furniture:n.furniture.filter(i=>!t.has(i.id))}:n)}}var Dc="image:";function fo(r,e,t){let n=(e??"").trim();if(!n)return null;if(n.startsWith(Dc))return t(n.slice(Dc.length));if(/^(https?:\/\/|\/)/.test(n))return n;if(/^[a-z_]+\.[a-z0-9_]+$/.test(n)){let i=r?.states[n]?.attributes.entity_picture;return typeof i=="string"&&i?i:null}return null}var yn=r=>Number(r);function kn(r){if(Array.isArray(r)){let[o,s]=[yn(r[0]),yn(r[1])];return Number.isFinite(o)&&Number.isFinite(s)?[o,s]:null}if(!r||typeof r!="object")return null;let{x:e,y:t}=r,[n,i]=[yn(e),yn(t)];return Number.isFinite(n)&&Number.isFinite(i)?[n,i]:null}function Pc(r){return r?kn(r.charger)??kn(r.charger_position):null}function Hc(r){for(let[e,t]of Object.entries(r.states))if(e.startsWith("camera.")&&(kn(t.attributes?.vacuum_position)??Pc(t.attributes)))return e;return null}var Tm=r=>Array.isArray(r)?typeof r[0]=="number":!!r&&typeof r=="object",xn=(r,e)=>e?[r[0],-r[1]]:r;function Fm(r){if(!r)return null;let e=r.mirror===!0,[t,n]=xn(r.ga,e),[i,o]=xn(r.gb,e),[s,a]=r.a,[l,c]=r.b,[u,h]=[i-t,o-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),[$,k]=[Math.cos(v),Math.sin(v)];return y=>{let z=xn(y,e),[E,F]=[z[0]-t,z[1]-n];return[s+g*(E*$-F*k),a+g*(E*k+F*$)]}}function Dm(r){if(!r)return null;let e=r.mirror===!0,[t,n]=xn(r.ga,e),[i,o]=xn(r.gb,e),s=Math.atan2(r.b[1]-r.a[1],r.b[0]-r.a[0])-Math.atan2(o-n,i-t);return Number.isFinite(s)?s:null}function Ic(r,e,t){if(!e)return null;let n=r.states[e]?.attributes;if(!n)return null;let i=Fm(t)??(_=>_),o=Dm(t)??0,s=t?.mirror===!0?-1:1,a=n.vacuum_position,l=kn(a),c=l?(()=>{let[_,b]=i(l),g=yn(a?.a)*s;if(!Number.isFinite(g))return{x:_,z:b,heading:0};let v=g*Math.PI/180+o;return{x:_,z:b,heading:Math.atan2(Math.cos(v),Math.sin(v))}})():null,u=Pc(n),h=Array.isArray(n.path)?n.path:[],p=h.length>0&&Tm(h[0])?[h]:h,d=[];for(let _ of p){let b=[];for(let g of Array.isArray(_)?_:[]){let v=kn(g);v&&b.push(i(v))}b.length>1&&d.push(b)}return!c&&!u&&!d.length?null:{pose:c,charger:u?i(u):null,path:d}}var Cc="nextfloor.lock3d",Nc=520,_o=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 Am(r){let e=Math.min(1,Math.max(0,(r-2200)/4300)),t=(n,i)=>Math.round(n+(i-n)*e);return`rgb(${t(255,200)},${t(170,225)},${t(80,255)})`}customElements.get("nf-quick-menu")||customElements.define("nf-quick-menu",co);var Em=new URL(import.meta.url),Rm=new URL("./nextfloor-3d.js?v=74227cd20cc3",Em).href,Rc;function zc(){return Rc??=import(Rm),Rc}function Tc(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 zm=new Set(["on","home","open","true","active","playing","heat","heating"]);function Pr(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 i=String(n.state).toLowerCase(),o=(t.state??"").split(",").map(a=>a.trim().toLowerCase()).filter(Boolean),s=o.length?o.includes(i):zm.has(i)||Number.isFinite(Number(i))&&Number(i)>0;return t.invert?!s:s}function po(r,e){let t=[];for(let n of e.floors)for(let i of n.furniture)Pr(r,i)||t.push(i.id);return t.sort()}function Dc(r,e){if(!e.length)return r;let t=new Set(e);return{...r,floors:r.floors.map(n=>n.furniture.some(i=>t.has(i.id))?{...n,furniture:n.furniture.filter(i=>!t.has(i.id))}:n)}}var Fc="image:";function mo(r,e,t){let n=(e??"").trim();if(!n)return null;if(n.startsWith(Fc))return t(n.slice(Fc.length));if(/^(https?:\/\/|\/)/.test(n))return n;if(/^[a-z_]+\.[a-z0-9_]+$/.test(n)){let i=r?.states[n]?.attributes.entity_picture;return typeof i=="string"&&i?i:null}return null}var yn=r=>Number(r);function kn(r){if(Array.isArray(r)){let[o,s]=[yn(r[0]),yn(r[1])];return Number.isFinite(o)&&Number.isFinite(s)?[o,s]:null}if(!r||typeof r!="object")return null;let{x:e,y:t}=r,[n,i]=[yn(e),yn(t)];return Number.isFinite(n)&&Number.isFinite(i)?[n,i]:null}function Pc(r){return r?kn(r.charger)??kn(r.charger_position):null}function Hc(r){for(let[e,t]of Object.entries(r.states))if(e.startsWith("camera.")&&(kn(t.attributes?.vacuum_position)??Pc(t.attributes)))return e;return null}var Tm=r=>Array.isArray(r)?typeof r[0]=="number":!!r&&typeof r=="object",xn=(r,e)=>e?[r[0],-r[1]]:r;function Dm(r){if(!r)return null;let e=r.mirror===!0,[t,n]=xn(r.ga,e),[i,o]=xn(r.gb,e),[s,a]=r.a,[l,c]=r.b,[u,h]=[i-t,o-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]=[Math.cos(v),Math.sin(v)];return y=>{let z=xn(y,e),[E,D]=[z[0]-t,z[1]-n];return[s+g*(E*$-D*S),a+g*(E*S+D*$)]}}function Fm(r){if(!r)return null;let e=r.mirror===!0,[t,n]=xn(r.ga,e),[i,o]=xn(r.gb,e),s=Math.atan2(r.b[1]-r.a[1],r.b[0]-r.a[0])-Math.atan2(o-n,i-t);return Number.isFinite(s)?s:null}function Ic(r,e,t){if(!e)return null;let n=r.states[e]?.attributes;if(!n)return null;let i=Dm(t)??(_=>_),o=Fm(t)??0,s=t?.mirror===!0?-1:1,a=n.vacuum_position,l=kn(a),c=l?(()=>{let[_,b]=i(l),g=yn(a?.a)*s;if(!Number.isFinite(g))return{x:_,z:b,heading:0};let v=g*Math.PI/180+o;return{x:_,z:b,heading:Math.atan2(Math.cos(v),Math.sin(v))}})():null,u=Pc(n),h=Array.isArray(n.path)?n.path:[],p=h.length>0&&Tm(h[0])?[h]:h,d=[];for(let _ of p){let b=[];for(let g of Array.isArray(_)?_:[]){let v=kn(g);v&&b.push(i(v))}b.length>1&&d.push(b)}return!c&&!u&&!d.length?null:{pose:c,charger:u?i(u):null,path:d}}var Cc="nextfloor.lock3d",Nc=520,go=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>`)}
|
${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 i=this._travel,o=i&&!i.loading?Rt(this.hass,i.history,i.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==o.entities)&&(this.openingLinks=Re(o,n.floors),this.furnitureLinks=ot(o,n.floors),this.linkedRegistry=o.entities,this.findIndex=null,this.alertSrc=this.alerts?Ml(o,n,this.weatherEntityId,this.openingLinks):null,this.watched=Pl({hass:o,building:n,openingLinks:this.openingLinks,furnitureLinks:this.furnitureLinks,needsRoomSensors:this.heatMode!=="none"||this.roomLabels,alertSources:this.alertSrc,weatherEntityId:this.weatherEntityId}),e=!0),!(e||this.watched.some(w=>this.shownStates.get(w)!==o.states[w])))return;mo(o,n).join(",")!==this.shownFor?.key&&t.setBuilding(this.shownBuilding(o)),this.shownStates=new Map(this.watched.map(w=>[w,o.states[w]])),this.refreshToday(n),this.refreshForecast(n);let a=on(o,n),l=pa(o,n.floors.some(w=>w.layer&&this.hiddenLayers.has(w.id))?this.shownBuilding(o):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(o,n,new Set(l.map(w=>w.id)),new Set(a.map(w=>w.powerEntity)));a.push(...c.consumers);let u=sn(o,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(o,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?o.states[x.temp_entity]:void 0,T=x.pump_entity?o.states[x.pump_entity]:void 0,[L,de]=xe(x.points),Ye=B&&Number.isFinite(Number(B.state))?`${O(o,ie(o,qn(Number(B.state),B.attributes.unit_of_measurement)),1)} ${X(o)}`:"",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:Bn(w,x,L,de)+.7,icon:ke(x.type==="pool"?"pool":x.type==="terrace"?"table-chair":"tree-outline"),name:x.area_id&&o.areas?.[x.area_id]?.name||A(o,`out_${x.type}`),text:[Ye,ht?A(o,"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(o,x),effect:this.dimmed?void 0:w.effect,text:this.subMeterText(o,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(qs(o,n.floors)),t.setCovers(oa(o,n)),t.setRobots(this.robotInfos(o,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,xi(o,w.rooms.filter(B=>B.points.length>=3),null,x.room_sensor)?.id??null);b.size&&t.setPetRooms(b),t.setRoofWindows(yl(o,n)),t.setParked(qi(o,n)),t.setGateStates(Wl(o,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(o,x,g.get(w))]));t.setOpeningStates(v),this.setAlerts(this.alertSrc?Gi(o,n,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(o);let $=[...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($!==this.thumbSig){let w=this.thumbSig==="";this.thumbSig=$,w||this.scheduleThumbs(1500)}let k=tc(o,n,a,n.energy.advanced?w=>this.furnitureLinks?.get(w.id)?.power??null:void 0),y=this.liveCars(o,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??_n(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=_n(n);for(let w of this.liveHeatPumps(n)){let x=w.pump.heat??(w.pump.mode==="heating"||w.pumLine truncated
|
</div>`}syncDevices(e){let t=this.viewer,n=this.building;if(!t||!n||!this.hass)return;let i=this._travel,o=i&&!i.loading?Rt(this.hass,i.history,i.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==o.entities)&&(this.openingLinks=Re(o,n.floors),this.furnitureLinks=ot(o,n.floors),this.linkedRegistry=o.entities,this.findIndex=null,this.alertSrc=this.alerts?Ml(o,n,this.weatherEntityId,this.openingLinks):null,this.watched=Pl({hass:o,building:n,openingLinks:this.openingLinks,furnitureLinks:this.furnitureLinks,needsRoomSensors:this.heatMode!=="none"||this.roomLabels,alertSources:this.alertSrc,weatherEntityId:this.weatherEntityId}),e=!0),!(e||this.watched.some(w=>this.shownStates.get(w)!==o.states[w])))return;po(o,n).join(",")!==this.shownFor?.key&&t.setBuilding(this.shownBuilding(o)),this.shownStates=new Map(this.watched.map(w=>[w,o.states[w]])),this.refreshToday(n),this.refreshForecast(n);let a=on(o,n),l=pa(o,n.floors.some(w=>w.layer&&this.hiddenLayers.has(w.id))?this.shownBuilding(o):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(o,n,new Set(l.map(w=>w.id)),new Set(a.map(w=>w.powerEntity)));a.push(...c.consumers);let u=sn(o,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(o,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?o.states[x.temp_entity]:void 0,T=x.pump_entity?o.states[x.pump_entity]:void 0,[L,de]=xe(x.points),Ye=B&&Number.isFinite(Number(B.state))?`${O(o,ie(o,qn(Number(B.state),B.attributes.unit_of_measurement)),1)} ${X(o)}`:"",ht=!!T&&J(T);l.push({id:x.area_id?`outdoor:${x.id}`:x.pump_entity??x.temp_entity,floorId:w.id,roomId:null,x:L,z:de,y:Bn(w,x,L,de)+.7,icon:ke(x.type==="pool"?"pool":x.type==="terrace"?"table-chair":"tree-outline"),name:x.area_id&&o.areas?.[x.area_id]?.name||A(o,`out_${x.type}`),text:[Ye,ht?A(o,"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(o,x),effect:this.dimmed?void 0:w.effect,text:this.subMeterText(o,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(qs(o,n.floors)),t.setCovers(oa(o,n)),t.setRobots(this.robotInfos(o,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,yi(o,w.rooms.filter(B=>B.points.length>=3),null,x.room_sensor)?.id??null);b.size&&t.setPetRooms(b),t.setRoofWindows(yl(o,n)),t.setParked(ji(o,n)),t.setGateStates(Wl(o,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(o,x,g.get(w))]));t.setOpeningStates(v),this.setAlerts(this.alertSrc?Ki(o,n,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(o);let $=[...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($!==this.thumbSig){let w=this.thumbSig==="";this.thumbSig=$,w||this.scheduleThumbs(1500)}let S=tc(o,n,a,n.energy.advanced?w=>this.furnitureLinks?.get(w.id)?.power??null:void 0),y=this.liveCars(o,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??_n(n);!T||!w.car.charging&&!B||S.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=_n(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=${i}>${n?"\u25B8":"\u25C2"}</button>
|
<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=${i}>${n?"\u25B8":"\u25C2"}</button>
|
||||||
<button class="nf-thumb nf-thumb-house" aria-pressed=${this.floorId===null} @click=${()=>this.fire("floor-tap",{floorId:null})}>
|
<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>
|
<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>
|
||||||
@@ -1549,12 +1549,12 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
${n?f:m`<img src=${o.url} alt="" />`}
|
${n?f:m`<img src=${o.url} alt="" />`}
|
||||||
<span>${e.get(o.floorId)??""}</span>
|
<span>${e.get(o.floorId)??""}</span>
|
||||||
</button>`)}
|
</button>`)}
|
||||||
</nav>`}onDeviceHold(e,t,n){let i=D(e);i==="light"||i==="cover"||i==="switch"||i==="fan"||i==="lock"?this._menu={entity:e,x:t,y:n}:fe(this,e)}onDeviceSwipe(e,t,n,i,o){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"&&ho(s).dim){let c=s.state==="on"?typeof s.attributes.brightness=="number"?Math.round(s.attributes.brightness/2.55):100:0;return this._swipe={entity:e,kind:"light",start:c,value:c,x:i,y:o},!0}if(l==="fan"&&typeof s.attributes.percentage_step=="number"){let c=s.state==="on"&&typeof s.attributes.percentage=="number"?s.attributes.percentage:0;return this._swipe={entity:e,kind:"fan",start:c,value:c,x:i,y:o},!0}if(l==="cover"&&po(s)){let c=s.attributes.current_position;return this._swipe={entity:e,kind:"cover",start:c,value:c,x:i,y:o},!0}return!1}let a=this._swipe;if(!a||a.entity!==e)return!1;if(t==="move"){let l=Math.round(Math.min(100,Math.max(0,a.start-n/220*100)));l!==a.value&&(this._swipe={...a,value:l});let c=performance.now();c-this.swipeSent>350&&(this.swipeSent=c,this.applySwipe())}else this.applySwipe(),clearTimeout(this.swipeTimer),this.swipeTimer=setTimeout(()=>this._swipe=null,700);return!0}applySwipe(){let e=this._swipe;!e||!this.hass||(e.kind==="light"?e.value<=0?this.hass.callService("light","turn_off",{entity_id:e.entity}):this.hass.callService("light","turn_on",{entity_id:e.entity,brightness_pct:e.value}):e.kind==="fan"?e.value<=0?this.hass.callService("fan","turn_off",{entity_id:e.entity}):this.hass.callService("fan","set_percentage",{entity_id:e.entity,percentage:e.value}):this.hass.callService("cover","set_cover_position",{entity_id:e.entity,position:e.value}))}openRoom(e,t){this.floorId===e&&this.roomId===t||(this.floorId!==e?(this.fire("floor-tap",{floorId:e}),setTimeout(()=>this.fire("room-tap",{floorId:e,roomId:t}),60)):this.fire("room-tap",{floorId:e,roomId:t}))}goTo(e){if(this._find=null,e.kind==="room"||e.kind==="circuit"){e.roomId&&this.openRoom(e.floorId,e.roomId);return}this.floorId!==e.floorId&&this.fire("floor-tap",{floorId:e.floorId}),setTimeout(()=>this.viewer?.focus(e.floorId,e.x,e.z,e.y,e.entity),120)}listenToAnnouncements(e){if(!e){this.stopAnnouncements?.(),this.stopAnnouncements=null,clearTimeout(this.announceTimer);return}if(this.stopAnnouncements)return;let t=!1;this.stopAnnouncements=()=>t=!0,xa(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()||!ba(e,this.screenName)||!va(e))return;let n=wa(e.message);this._announcement={message:e.message,until:Date.now()+n},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,n),ya(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?m`<button class="nf-announcement" role="alert" title=${A(this.hass,"close")} @click=${()=>this._announcement=null}>
|
</nav>`}onDeviceHold(e,t,n){let i=F(e);i==="light"||i==="cover"||i==="switch"||i==="fan"||i==="lock"?this._menu={entity:e,x:t,y:n}:fe(this,e)}onDeviceSwipe(e,t,n,i,o){let s=this.hass?.states[e];if(t==="start"){if(!s||I(s)||this.confirmSet.has(e))return!1;let l=F(e);if(l==="light"&&uo(s).dim){let c=s.state==="on"?typeof s.attributes.brightness=="number"?Math.round(s.attributes.brightness/2.55):100:0;return this._swipe={entity:e,kind:"light",start:c,value:c,x:i,y:o},!0}if(l==="fan"&&typeof s.attributes.percentage_step=="number"){let c=s.state==="on"&&typeof s.attributes.percentage=="number"?s.attributes.percentage:0;return this._swipe={entity:e,kind:"fan",start:c,value:c,x:i,y:o},!0}if(l==="cover"&&ho(s)){let c=s.attributes.current_position;return this._swipe={entity:e,kind:"cover",start:c,value:c,x:i,y:o},!0}return!1}let a=this._swipe;if(!a||a.entity!==e)return!1;if(t==="move"){let l=Math.round(Math.min(100,Math.max(0,a.start-n/220*100)));l!==a.value&&(this._swipe={...a,value:l});let c=performance.now();c-this.swipeSent>350&&(this.swipeSent=c,this.applySwipe())}else this.applySwipe(),clearTimeout(this.swipeTimer),this.swipeTimer=setTimeout(()=>this._swipe=null,700);return!0}applySwipe(){let e=this._swipe;!e||!this.hass||(e.kind==="light"?e.value<=0?this.hass.callService("light","turn_off",{entity_id:e.entity}):this.hass.callService("light","turn_on",{entity_id:e.entity,brightness_pct:e.value}):e.kind==="fan"?e.value<=0?this.hass.callService("fan","turn_off",{entity_id:e.entity}):this.hass.callService("fan","set_percentage",{entity_id:e.entity,percentage:e.value}):this.hass.callService("cover","set_cover_position",{entity_id:e.entity,position:e.value}))}openRoom(e,t){this.floorId===e&&this.roomId===t||(this.floorId!==e?(this.fire("floor-tap",{floorId:e}),setTimeout(()=>this.fire("room-tap",{floorId:e,roomId:t}),60)):this.fire("room-tap",{floorId:e,roomId:t}))}goTo(e){if(this._find=null,e.kind==="room"||e.kind==="circuit"){e.roomId&&this.openRoom(e.floorId,e.roomId);return}this.floorId!==e.floorId&&this.fire("floor-tap",{floorId:e.floorId}),setTimeout(()=>this.viewer?.focus(e.floorId,e.x,e.z,e.y,e.entity),120)}listenToAnnouncements(e){if(!e){this.stopAnnouncements?.(),this.stopAnnouncements=null,clearTimeout(this.announceTimer);return}if(this.stopAnnouncements)return;let t=!1;this.stopAnnouncements=()=>t=!0,xa(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()||!ba(e,this.screenName)||!va(e))return;let n=wa(e.message);this._announcement={message:e.message,until:Date.now()+n},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,n),ya(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>
|
<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">
|
</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=${Ui(this.hass,e,n)} @click=${()=>this.jumpTo(n)}>${Ui(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=${Gi(this.hass,e,n)} @click=${()=>this.jumpTo(n)}>${Gi(this.hass,e,n)}</button>`)}
|
||||||
${this._alerts.length>3?m`<span class="nf-alert-more">+${this._alerts.length-3}</span>`:f}
|
${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(o=>o.rooms).find(o=>o.id===this.roomId),n=t?K(this.hass,t).filter(o=>D(o)==="scene"||D(o)==="script").slice(0,6):[];if(!n.length)return f;let i=t?.area_id?this.hass.areas?.[t.area_id]?.name:void 0;return m`<div class="nf-scenes">
|
</div>`}renderScenes(){let e=this.building;if(!this.scenes||!this.roomId||this.panelOpen||!e||!this.hass)return f;let t=e.floors.flatMap(o=>o.rooms).find(o=>o.id===this.roomId),n=t?K(this.hass,t).filter(o=>F(o)==="scene"||F(o)==="script").slice(0,6):[];if(!n.length)return f;let i=t?.area_id?this.hass.areas?.[t.area_id]?.name:void 0;return m`<div class="nf-scenes">
|
||||||
${n.map(o=>m`<button class="nf-chip" aria-pressed=${this._sceneFired===o} @click=${()=>this.runScene(o)}>${W(this.hass,o,i)}</button>`)}
|
${n.map(o=>m`<button class="nf-chip" aria-pressed=${this._sceneFired===o} @click=${()=>this.runScene(o)}>${W(this.hass,o,i)}</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=""}>
|
</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>
|
<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>
|
||||||
@@ -1581,7 +1581,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
@click=${()=>{this._central=!this._central,this._armed=null}}
|
@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>
|
<svg viewBox="0 0 24 24" width="19" height="19" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linejoin="round"><path d="M12 3.5l2.6 5.3 5.9.9-4.3 4.1 1 5.8L12 16.9l-5.2 2.7 1-5.8-4.3-4.1 5.9-.9z" /></svg>
|
||||||
</button>`;if(!this._central)return i;let o=this.floorId?e.floors.find(g=>g.id===this.floorId):void 0,s=o?[o]:e.floors,a=s.flatMap(g=>ki(t,g).lights),l=s.flatMap(g=>ki(t,g).covers),c=a.filter(g=>t.states[g]?.state==="on").length,u=!o,h=(g,v,$,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,$,{entity_id:k})}},p=(g,v,$,k,y)=>m`<button class="nf-btn ${this._armed===g?"nf-central-armed":""}" ?disabled=${!y.length} @click=${()=>h(g,$,k,y)}>
|
</button>`;if(!this._central)return i;let o=this.floorId?e.floors.find(g=>g.id===this.floorId):void 0,s=o?[o]:e.floors,a=s.flatMap(g=>xi(t,g).lights),l=s.flatMap(g=>xi(t,g).covers),c=a.filter(g=>t.states[g]?.state==="on").length,u=!o,h=(g,v,$,S)=>{if(S.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,$,{entity_id:S})}},p=(g,v,$,S,y)=>m`<button class="nf-btn ${this._armed===g?"nf-central-armed":""}" ?disabled=${!y.length} @click=${()=>h(g,$,S,y)}>
|
||||||
${this._armed===g?n("central_sure"):n(v)}
|
${this._armed===g?n("central_sure"):n(v)}
|
||||||
</button>`,d=e.settings.favorite_floors??{},_=(e.settings.favorites??[]).filter(g=>t.states[g]&&(!d[g]||!o||d[g]===o.id)),b=this.buttons??e.settings.buttons??[];return m`${i}
|
</button>`,d=e.settings.favorite_floors??{},_=(e.settings.favorites??[]).filter(g=>t.states[g]&&(!d[g]||!o||d[g]===o.id)),b=this.buttons??e.settings.buttons??[];return m`${i}
|
||||||
<div class="nf-central ${this.centralOpen?"nf-central-big":""}" role="dialog" aria-label=${n("central")}>
|
<div class="nf-central ${this.centralOpen?"nf-central-big":""}" role="dialog" aria-label=${n("central")}>
|
||||||
@@ -1598,10 +1598,10 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
</div>`:f}
|
</div>`:f}
|
||||||
<b>${n("central_favorites")}</b>
|
<b>${n("central_favorites")}</b>
|
||||||
${_.length?m`<div class="nf-central-favs">
|
${_.length?m`<div class="nf-central-favs">
|
||||||
${_.map(g=>{let[v,$]=Xs(g),k=t.states[g],y=v==="homeassistant"&&k?.state==="on";return m`<button
|
${_.map(g=>{let[v,$]=Xs(g),S=t.states[g],y=v==="homeassistant"&&S?.state==="on";return m`<button
|
||||||
class="nf-chip"
|
class="nf-chip"
|
||||||
aria-pressed=${y||this._sceneFired===g}
|
aria-pressed=${y||this._sceneFired===g}
|
||||||
?disabled=${I(k)}
|
?disabled=${I(S)}
|
||||||
@click=${()=>{t.callService(v,$,{entity_id:g}),this._sceneFired=g,setTimeout(()=>this._sceneFired=null,600)}}
|
@click=${()=>{t.callService(v,$,{entity_id:g}),this._sceneFired=g,setTimeout(()=>this._sceneFired=null,600)}}
|
||||||
>
|
>
|
||||||
${W(t,g)}
|
${W(t,g)}
|
||||||
@@ -1611,7 +1611,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
${b.map(g=>m`<button
|
${b.map(g=>m`<button
|
||||||
class="nf-chip nf-own-btn"
|
class="nf-chip nf-own-btn"
|
||||||
aria-pressed=${ea(t,g)}
|
aria-pressed=${ea(t,g)}
|
||||||
@click=${v=>{Si(t,v.currentTarget,g),g.action!=="service"&&(this._central=!1)}}
|
@click=${v=>{ki(t,v.currentTarget,g),g.action!=="service"&&(this._central=!1)}}
|
||||||
>
|
>
|
||||||
${g.icon?m`<ha-icon .icon=${g.icon.startsWith("mdi:")?g.icon:`mdi:${g.icon}`}></ha-icon>`:f}${g.label}
|
${g.icon?m`<ha-icon .icon=${g.icon.startsWith("mdi:")?g.icon:`mdi:${g.icon}`}></ha-icon>`:f}${g.label}
|
||||||
</button>`)}
|
</button>`)}
|
||||||
@@ -1620,7 +1620,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
<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>
|
<button class="nf-travel-play" aria-label=${e(t.playing?"travel_pause":"travel_play")} ?disabled=${t.loading} @click=${()=>this.playTravel(!t.playing)}>${t.playing?"\u23F8":"\u25B6"}</button>
|
||||||
<b class="nf-travel-when">${t.loading?e("travel_loading"):i}</b>
|
<b class="nf-travel-when">${t.loading?e("travel_loading"):i}</b>
|
||||||
<div class="nf-travel-track">
|
<div class="nf-travel-track">
|
||||||
<svg viewBox="0 0 1000 10" preserveAspectRatio="none" aria-hidden="true">${t.moments.map(a=>J`<rect x=${(a-t.from)/o*1e3} y="0" width="1.6" height="10" />`)}</svg>
|
<svg viewBox="0 0 1000 10" preserveAspectRatio="none" aria-hidden="true">${t.moments.map(a=>Q`<rect x=${(a-t.from)/o*1e3} y="0" width="1.6" height="10" />`)}</svg>
|
||||||
<input type="range" min=${t.from} max=${t.to} step="60000" .value=${String(t.t)} ?disabled=${t.loading} aria-label=${e("travel")} @input=${a=>this.travelTo(Number(a.target.value))} />
|
<input type="range" min=${t.from} max=${t.to} step="60000" .value=${String(t.t)} ?disabled=${t.loading} aria-label=${e("travel")} @input=${a=>this.travelTo(Number(a.target.value))} />
|
||||||
</div>
|
</div>
|
||||||
<select aria-label=${e("travel_speed")} @change=${a=>this._travel={...t,speed:Number(a.target.value)}}>
|
<select aria-label=${e("travel_speed")} @change=${a=>this._travel={...t,speed:Number(a.target.value)}}>
|
||||||
@@ -1630,7 +1630,7 @@ 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===168} @click=${()=>{this.openTravel(168)}}>7 ${e("travel_days")}</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>
|
<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 i=n.getBoundingClientRect(),o=i.width/2,[s,a]=[(e.clientX-i.left-o)/o,(e.clientY-i.top-o)/o],l=Math.hypot(s,a);l>1&&([s,a]=[s/l,a/l]),this._stick=[s,a],this.viewer?.setWalkStick(Math.abs(s)<.12?0:s,Math.abs(a)<.12?0:a)}stickEnd(){this._stick=null,this.viewer?.setWalkStick(0,0)}renderWalk(){if(!this.hass||this.clean||!this.walkButton&&!this._walking)return f;let e=n=>A(this.hass,n),t=this._stick??[0,0];return m`<button class="nf-walk-btn ${this._walking?"nf-walk-on":""}" title=${e(this._walking?"walk_stop":"walk")} aria-label=${e(this._walking?"walk_stop":"walk")} aria-pressed=${this._walking} @click=${()=>this.toggleWalk()}>
|
</div>`}toggleWalk(){let e=this.viewer;e&&(this._walking?(e.stopWalk(),this._walking=!1):this._walking=e.startWalk()!==null,this._stick=null)}stickMove(e,t=!1){let n=e.currentTarget;if(t)n.setPointerCapture(e.pointerId);else if(!this._stick)return;let i=n.getBoundingClientRect(),o=i.width/2,[s,a]=[(e.clientX-i.left-o)/o,(e.clientY-i.top-o)/o],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>`}
|
${this._walking?"\u2715":Q`<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="13" cy="4" r="2" /><path d="M10 21l2-6 3 3v5M9 12l1-4 4 1 3 3M8 9l-2 4" /></svg>`}
|
||||||
</button>
|
</button>
|
||||||
${this._walking?m`<div class="nf-stick" @pointerdown=${n=>this.stickMove(n,!0)} @pointermove=${n=>this.stickMove(n)} @pointerup=${()=>this.stickEnd()} @pointercancel=${()=>this.stickEnd()}>
|
${this._walking?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>
|
<span style="transform:translate(${t[0]*34}px, ${t[1]*34}px)"></span>
|
||||||
@@ -1638,7 +1638,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
<p class="nf-walk-hint">${e("walk_hint")}</p>`:f}`}renderLock(){if(!this.lockButton||!this.hass||this.clean)return f;let e=A(this.hass,this._locked?"lock3d_off":"lock3d_on");return m`<button class="nf-lock3d ${this._locked?"nf-lock3d-on":""}" title=${e} aria-label=${e} aria-pressed=${this._locked} @click=${()=>this.toggleLock()}>
|
<p class="nf-walk-hint">${e("walk_hint")}</p>`:f}`}renderLock(){if(!this.lockButton||!this.hass||this.clean)return f;let e=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">
|
<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" />
|
<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" />`}
|
${this._locked?Q`<path d="M8 11V8a4 4 0 0 1 8 0v3" />`:Q`<path d="M8 11V8a4 4 0 0 1 7.5-2" />`}
|
||||||
</svg>
|
</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),i=new Intl.DateTimeFormat(t,{hour:"2-digit",minute:"2-digit"}).format(n),o=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>${i}</b><span>${o}</span></div>`}renderEye(){if(!this.cleanButton||!this.hass||this._find!==null&&!this.clean)return f;let e=A(this.hass,this.clean?"controls_show":"controls_hide");return m`<button
|
</button>`}renderClock(e=!1){if(!this.clock||!this.hass||this.clock==="top_left"&&!e)return f;let t=this.hass.language??navigator.language,n=new Date(this._now),i=new Intl.DateTimeFormat(t,{hour:"2-digit",minute:"2-digit"}).format(n),o=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>${i}</b><span>${o}</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":""}"
|
class="nf-eye ${this.clean?"nf-eye-clean":""}"
|
||||||
@@ -1647,14 +1647,14 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
aria-pressed=${this.clean}
|
aria-pressed=${this.clean}
|
||||||
@click=${()=>this.dispatchEvent(new CustomEvent("clean-toggle",{bubbles:!0,composed:!0}))}
|
@click=${()=>this.dispatchEvent(new CustomEvent("clean-toggle",{bubbles:!0,composed:!0}))}
|
||||||
>
|
>
|
||||||
${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>`}
|
${this.clean?Q`<svg viewBox="0 0 24 24" width="20" height="20"><path fill="currentColor" d="M12 6a9.8 9.8 0 0 1 9 6 9.8 9.8 0 0 1-9 6 9.8 9.8 0 0 1-9-6 9.8 9.8 0 0 1 9-6m0 2a4 4 0 1 0 0 8 4 4 0 0 0 0-8m0 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4" /></svg>`:Q`<svg viewBox="0 0 24 24" width="20" height="20"><path fill="currentColor" d="M2.4 3.8 3.8 2.4l17.8 17.8-1.4 1.4-3.3-3.3A10.5 10.5 0 0 1 12 19a9.8 9.8 0 0 1-9-6 10.3 10.3 0 0 1 3.6-4.3L2.4 3.8M12 7a4 4 0 0 1 4 4c0 .5-.1 1-.3 1.5l-5.2-5.2c.5-.2 1-.3 1.5-.3m-4 4a4 4 0 0 0 5.5 3.7l-5.2-5.2c-.2.5-.3 1-.3 1.5m4-7a9.8 9.8 0 0 1 9 6 10 10 0 0 1-2.6 3.6l-1.4-1.4A8 8 0 0 0 18.8 12 8 8 0 0 0 9.6 7.2L8 5.6A10.3 10.3 0 0 1 12 4" /></svg>`}
|
||||||
</button>`}renderSwipe(){let e=this._swipe;if(!e||!this.hass)return f;let t=e.kind==="light"&&e.value<=0;return m`<div class="nf-swipe" style="left:${e.x}px;top:${e.y}px">
|
</button>`}renderSwipe(){let e=this._swipe;if(!e||!this.hass)return f;let t=e.kind==="light"&&e.value<=0;return m`<div class="nf-swipe" style="left:${e.x}px;top:${e.y}px">
|
||||||
<span>${W(this.hass,e.entity)}</span>
|
<span>${W(this.hass,e.entity)}</span>
|
||||||
<b>${t?A(this.hass,"swipe_off"):`${e.value} %`}</b>
|
<b>${t?A(this.hass,"swipe_off"):`${e.value} %`}</b>
|
||||||
<i><em style="height:${e.value}%"></em></i>
|
<i><em style="height:${e.value}%"></em></i>
|
||||||
</div>`}tapPlate(e,t,n){let i=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),o=i?$i(i.gang_entities,Z(i.type)?.gangs??0):[];if(o.length===1)return this.onDeviceTap(o[0],t,n);o.length>1&&(this._plate={ids:o,x:t,y:n})}renderPlate(){let e=this._plate;if(!e||!this.hass)return f;let t=this.hass,n=()=>this._plate=null;return m`<div class="nf-menu-backdrop" @click=${n}></div>
|
</div>`}tapPlate(e,t,n){let i=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),o=i?Si(i.gang_entities,Z(i.type)?.gangs??0):[];if(o.length===1)return this.onDeviceTap(o[0],t,n);o.length>1&&(this._plate={ids:o,x:t,y:n})}renderPlate(){let e=this._plate;if(!e||!this.hass)return f;let t=this.hass,n=()=>this._plate=null;return 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">
|
<div class="nf-plate-menu" style="left:${Math.max(8,e.x-110)}px;top:${Math.max(8,e.y-20-e.ids.length*46)}px" role="menu">
|
||||||
${e.ids.map((i,o)=>{let s=t.states[i],a=Q(s)||s?.state==="on";return m`<button role="menuitem" class=${a?"on":""} @click=${()=>{n(),this.onDeviceTap(i,e.x,e.y)}}><b>${o+1}</b><span>${W(t,i)}</span><i>${s?te(t,s):"\u2013"}</i></button>`})}
|
${e.ids.map((i,o)=>{let s=t.states[i],a=J(s)||s?.state==="on";return m`<button role="menuitem" class=${a?"on":""} @click=${()=>{n(),this.onDeviceTap(i,e.x,e.y)}}><b>${o+1}</b><span>${W(t,i)}</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,i=t?.clientHeight??600,o=Math.max(8,Math.min(n-240,e.x-116)),s=Math.max(8,Math.min(i-360,e.y-170));return m`<div class="nf-menu-backdrop" @click=${()=>this._menu=null}></div>
|
</div>`}renderMenu(){let e=this._menu;if(!e||!this.hass)return f;let t=this.renderRoot.querySelector(".nf-stage"),n=t?.clientWidth??800,i=t?.clientHeight??600,o=Math.max(8,Math.min(n-240,e.x-116)),s=Math.max(8,Math.min(i-360,e.y-170));return m`<div class="nf-menu-backdrop" @click=${()=>this._menu=null}></div>
|
||||||
<nf-quick-menu
|
<nf-quick-menu
|
||||||
style="left:${o}px;top:${s}px"
|
style="left:${o}px;top:${s}px"
|
||||||
@@ -1667,10 +1667,10 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
.myPosition=${this.myPositionOf(e.entity)}
|
.myPosition=${this.myPositionOf(e.entity)}
|
||||||
.tiltEntity=${nr(this.hass,this.building?.floors??[],e.entity)}
|
.tiltEntity=${nr(this.hass,this.building?.floors??[],e.entity)}
|
||||||
@close=${()=>this._menu=null}
|
@close=${()=>this._menu=null}
|
||||||
></nf-quick-menu>`}myPositionOf(e){for(let t of this.building?.floors??[])for(let n of t.openings){let i=this.openingLinks?.get(n.id);if(n.my_position!=null&&(i?.cover===e||i?.cover2===e))return n.my_position}return null}onDeviceTap(e,t=0,n=0){if(e.startsWith("lamp:")||this._travel)return;let i=e.startsWith("tap:")?e.slice(4):this.tapPins.get(e);if(i){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===i);s?.tap&&Si(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 o=D(e);if(o==="cover"||o==="media"){this._menu={entity:e,x:t,y:n};return}if(o==="lock"){let s=wi(this.hass,e),a=W(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(o&&As.has(o)){if(this.confirmSet.has(e)&&!confirm(A(this.hass,"confirm_switch",{name:W(this.hass,e)})))return;fa(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 i=this.building?.floors.find(o=>o.id===n.floorId)?.placements.find(o=>o.entity_id===e);return ss({hass:this.hass,entityId:e,state:t},n,i?.plugin??void 0,{showWindow:(o,s)=>{o&&"hass"in o&&(o.hass=this.hass),this._pluginWindow=o?{node:o,title:s?.title??""}:null},moreInfo:o=>fe(this,o??e)})}renderPluginWindow(){let e=this._pluginWindow;return e?m`<div class="nf-plugin-window" @pointerdown=${t=>t.stopPropagation()}>
|
></nf-quick-menu>`}myPositionOf(e){for(let t of this.building?.floors??[])for(let n of t.openings){let i=this.openingLinks?.get(n.id);if(n.my_position!=null&&(i?.cover===e||i?.cover2===e))return n.my_position}return null}onDeviceTap(e,t=0,n=0){if(e.startsWith("lamp:")||this._travel)return;let i=e.startsWith("tap:")?e.slice(4):this.tapPins.get(e);if(i){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===i);s?.tap&&ki(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 o=F(e);if(o==="cover"||o==="media"){this._menu={entity:e,x:t,y:n};return}if(o==="lock"){let s=vi(this.hass,e),a=W(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(o&&Ms.has(o)){if(this.confirmSet.has(e)&&!confirm(A(this.hass,"confirm_switch",{name:W(this.hass,e)})))return;fa(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 i=this.building?.floors.find(o=>o.id===n.floorId)?.placements.find(o=>o.entity_id===e);return os({hass:this.hass,entityId:e,state:t},n,i?.plugin??void 0,{showWindow:(o,s)=>{o&&"hass"in o&&(o.hass=this.hass),this._pluginWindow=o?{node:o,title:s?.title??""}:null},moreInfo:o=>fe(this,o??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-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 class="nf-pw-body">${e.node}</div>
|
||||||
</div>`:f}startViewOf(){return this.startView??this.building?.settings.start_view??null}currentView(){return this.viewer?.currentView()??null}resetView(){this.viewer?.resetView()}fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}toggleFlows(){this._flows=!this._flows;try{localStorage.setItem("nextfloor.flows",this._flows?"1":"0")}catch{}this.syncDevices(!0)}liveHeatPumps(e){let t=this.hass;if(!t)return[];let n=[];for(let i of e.floors)for(let o of i.furniture){if(!mc(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=pc(t,s?.entity??s?.power??null);a&&n.push({id:o.id,name:o.name||he(t,o.type),floorId:i.id,x:o.x,z:o.z,at:{floorId:i.id,x:o.x,z:o.z,y:ce(i,o)+o.h+.5},pump:a})}return n}livePrinters(e){let t=this.hass,n=[];if(!t)return n;for(let i of e.floors)for(let o of i.furniture){if(!so(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=oo(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||n.push({id:o.id,name:o.name||he(t,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:ce(i,o)+o.h+.5},printer:a})}return n}liveCars(e,t){let n=[];for(let i of t.floors)for(let o of i.furniture){if(o.type!=="parking")continue;let s=vc(e,o);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=ji(e,o),l=a?Fl(o,a):null,c=o.name||(a?he(e,a):he(e,o.type));n.push({spot:o.id,name:c,at:{floorId:i.id,x:o.x,z:o.z,y:ce(i,o)+(l?.h??.2)+.6},car:s})}return n}liveMedia(e,t){let n=[];for(let i of t.floors){for(let o of i.furniture){let s=this.furnitureLinks?.get(o.id)?.entity;s?.startsWith("media_player.")&&n.push({entity:s,name:o.name||he(e,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:ce(i,o)+o.h+.15},rings:o.sound_rings})}for(let o of i.placements)o.entity_id.startsWith("media_player.")&&n.push({entity:o.entity_id,name:o.name||W(e,o.entity_id),at:{floorId:i.id,x:o.x,z:o.z,y:(o.y??1.1)+.15},rings:o.sound_rings})}return _l(e,n)}refreshToday(e){let t=this.hass,n=e.settings.calendars??[],i=Math.max(1,Math.min(7,e.settings.today_days??1)),o=`${new Date().toDateString()}|${i}`;!t||!n.length||Date.now()-this.todayAt<9e5&&o===this.todayDay||(this.todayAt=Date.now(),this.todayDay=o,lc(t,n,i).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,n=e.settings.forecast&&t?qe(t,this.weatherEntityId??e.settings.weather_entity):null;if(!t||!n)return;let i=`${n}|${new Date().toDateString()}`;Date.now()-this.forecastAt<18e5&&i===this.forecastKey||(this.forecastAt=Date.now(),this.forecastKey=i,dc(t,n).then(o=>this._forecast=o))}renderForecast(e){let t=this.building,n=this.hass,i=t?.settings.forecast;if(!t||!n||!i||i.corner!==e||this.clean)return f;if(e==="top_right"&&(this.roomId||this.panelOpen))return f;let o=uc(this._forecast,Math.max(1,Math.min(7,i.days)));if(!o.length)return f;let s=qe(n,this.weatherEntityId??t.settings.weather_entity),a=s?n.states[s]?.attributes:void 0,l=String(a?.temperature_unit??"\xB0"),c=String(a?.precipitation_unit??"mm"),u=n.language??navigator.language,h=new Intl.DateTimeFormat(u,{weekday:"short"}),p=d=>d===null?"\u2013":`${Math.round(d)}\xB0`;return m`<section class="nf-forecast" aria-label=${A(n,"forecast")}>
|
</div>`:f}startViewOf(){return this.startView??this.building?.settings.start_view??null}currentView(){return this.viewer?.currentView()??null}resetView(){this.viewer?.resetView()}fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}toggleFlows(){this._flows=!this._flows;try{localStorage.setItem("nextfloor.flows",this._flows?"1":"0")}catch{}this.syncDevices(!0)}liveHeatPumps(e){let t=this.hass;if(!t)return[];let n=[];for(let i of e.floors)for(let o of i.furniture){if(!mc(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=pc(t,s?.entity??s?.power??null);a&&n.push({id:o.id,name:o.name||he(t,o.type),floorId:i.id,x:o.x,z:o.z,at:{floorId:i.id,x:o.x,z:o.z,y:ce(i,o)+o.h+.5},pump:a})}return n}livePrinters(e){let t=this.hass,n=[];if(!t)return n;for(let i of e.floors)for(let o of i.furniture){if(!oo(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=io(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||n.push({id:o.id,name:o.name||he(t,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:ce(i,o)+o.h+.5},printer:a})}return n}liveCars(e,t){let n=[];for(let i of t.floors)for(let o of i.furniture){if(o.type!=="parking")continue;let s=vc(e,o);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=Ui(e,o),l=a?Dl(o,a):null,c=o.name||(a?he(e,a):he(e,o.type));n.push({spot:o.id,name:c,at:{floorId:i.id,x:o.x,z:o.z,y:ce(i,o)+(l?.h??.2)+.6},car:s})}return n}liveMedia(e,t){let n=[];for(let i of t.floors){for(let o of i.furniture){let s=this.furnitureLinks?.get(o.id)?.entity;s?.startsWith("media_player.")&&n.push({entity:s,name:o.name||he(e,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:ce(i,o)+o.h+.15},rings:o.sound_rings})}for(let o of i.placements)o.entity_id.startsWith("media_player.")&&n.push({entity:o.entity_id,name:o.name||W(e,o.entity_id),at:{floorId:i.id,x:o.x,z:o.z,y:(o.y??1.1)+.15},rings:o.sound_rings})}return _l(e,n)}refreshToday(e){let t=this.hass,n=e.settings.calendars??[],i=Math.max(1,Math.min(7,e.settings.today_days??1)),o=`${new Date().toDateString()}|${i}`;!t||!n.length||Date.now()-this.todayAt<9e5&&o===this.todayDay||(this.todayAt=Date.now(),this.todayDay=o,lc(t,n,i).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,n=e.settings.forecast&&t?qe(t,this.weatherEntityId??e.settings.weather_entity):null;if(!t||!n)return;let i=`${n}|${new Date().toDateString()}`;Date.now()-this.forecastAt<18e5&&i===this.forecastKey||(this.forecastAt=Date.now(),this.forecastKey=i,dc(t,n).then(o=>this._forecast=o))}renderForecast(e){let t=this.building,n=this.hass,i=t?.settings.forecast;if(!t||!n||!i||i.corner!==e||this.clean)return f;if(e==="top_right"&&(this.roomId||this.panelOpen))return f;let o=uc(this._forecast,Math.max(1,Math.min(7,i.days)));if(!o.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>
|
<ul>
|
||||||
${o.map((d,_)=>m`<li>
|
${o.map((d,_)=>m`<li>
|
||||||
<span class="nf-fc-day">${_===0?A(n,"today"):h.format(new Date(d.day))}</span>
|
<span class="nf-fc-day">${_===0?A(n,"today"):h.format(new Date(d.day))}</span>
|
||||||
@@ -1697,12 +1697,12 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
<span>${A(this.hass,"holos")}</span><b>◫</b>
|
<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=${W(this.hass,t)} @click=${()=>fe(this,t)}>
|
</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=${W(this.hass,t)} @click=${()=>fe(this,t)}>
|
||||||
<span>${W(this.hass,t)}</span><b>${te(this.hass,this.hass.states[t])}</b>
|
<span>${W(this.hass,t)}</span><b>${te(this.hass,this.hass.states[t])}</b>
|
||||||
</button>`)}renderMapCredit(){let e=this.building?.settings.map;return Ol(e)?m`<a class="nf-map-credit" href=${Zi(e).href} target="_blank" rel="noopener">${Zi(e).text}</a>`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=at(new Date,this.hass?.config?.latitude??50),t=mr(this.heatMode,e),n=this.heatMode==="temperature",i=n?ie(this.hass,t.stops[0][0]):t.stops[0][0],o=n?ie(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">
|
</button>`)}renderMapCredit(){let e=this.building?.settings.map;return Ol(e)?m`<a class="nf-map-credit" href=${qi(e).href} target="_blank" rel="noopener">${qi(e).text}</a>`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=at(new Date,this.hass?.config?.latitude??50),t=mr(this.heatMode,e),n=this.heatMode==="temperature",i=n?ie(this.hass,t.stops[0][0]):t.stops[0][0],o=n?ie(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>
|
<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:${Ja(this.heatMode,e)}"></span>
|
<span class="nf-legend-bar" style="background:${Ja(this.heatMode,e)}"></span>
|
||||||
<span class="nf-legend-range"><span>${O(this.hass,i,0)} ${s}</span><span>${O(this.hass,o,0)} ${s}</span></span>
|
<span class="nf-legend-range"><span>${O(this.hass,i,0)} ${s}</span><span>${O(this.hass,o,0)} ${s}</span></span>
|
||||||
${this.heatValues.size?f:m`<span class="nf-legend-none">${a("heat_none_found")}</span>`}
|
${this.heatValues.size?f:m`<span class="nf-legend-none">${a("heat_none_found")}</span>`}
|
||||||
</div>`}renderWifiLegend(){let e=this.hass,t=this.building;if(!e||!t)return f;let n=(c,u)=>A(e,c,u),i=t.floors.flatMap(c=>c.furniture.filter(u=>ao(u.type)).map(u=>lo(e,this.furnitureLinks?.get(u.id)?.entity??this.furnitureLinks?.get(u.id)?.power??null))),s=i.filter(c=>!!c).reduce((c,u)=>c+(u.clients??0),0),a=t.floors.flatMap(c=>c.placements.map(u=>e.states[u.entity_id])),l=_c(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),i=t.floors.flatMap(c=>c.furniture.filter(u=>so(u.type)).map(u=>ao(e,this.furnitureLinks?.get(u.id)?.entity??this.furnitureLinks?.get(u.id)?.power??null))),s=i.filter(c=>!!c).reduce((c,u)=>c+(u.clients??0),0),a=t.floors.flatMap(c=>c.placements.map(u=>e.states[u.entity_id])),l=_c(a);return m`<div class="nf-legend">
|
||||||
<b>📶 ${n("heat_wifi")}</b>
|
<b>📶 ${n("heat_wifi")}</b>
|
||||||
<span>${n("wifi_aps",{n:i.length,clients:s})}</span>
|
<span>${n("wifi_aps",{n:i.length,clients:s})}</span>
|
||||||
${l.online+l.offline.length?m`<span>${n("wifi_network",{online:l.online,offline:l.offline.length})}</span>`:f}
|
${l.online+l.offline.length?m`<span>${n("wifi_network",{online:l.online,offline:l.offline.length})}</span>`:f}
|
||||||
@@ -3299,26 +3299,26 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
inset: auto 16px 16px;
|
inset: auto 16px 16px;
|
||||||
color: var(--nf-danger);
|
color: var(--nf-danger);
|
||||||
}
|
}
|
||||||
`]};customElements.get("nf-view3d")||customElements.define("nf-view3d",_o);function ae(r,e){return Math.abs(e)>=1e3?`${O(r,e/1e3,1)} kW`:`${Math.round(e)} W`}function go(r){return r.type==="tv_board"?r.h+.9:r.type==="tv_wall"||r.type==="kitchen_wall"?r.h+.25:r.h+.35}function Hm(r,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:te(r,e)}var Oc;function Wc(){let r=new URL("./nextfloor-editor.js?v=6bcac3b155cd",new URL(import.meta.url)).href;return Oc??=import(r),Oc}var Im=.25,Lc=r=>Math.round(r*1e3)/1e3,Bc=(r,e,t)=>r.rooms.find(n=>n.points.length>=3&&H([e,t],n.points));function vo(r,e,t,n,i){let o=Bc(r,e,t);if(!o)return[n,i];let s=(a,l)=>H([a,l],o.points);return s(n,i)?[n,i]:s(n,t)?[n,t]:s(e,i)?[e,i]:[e,t]}function Cm(r,e,t,n){return r.rooms.some(i=>i.id!==e.id&&i.points.some((o,s)=>{let a=i.points[(s+1)%i.points.length];return Math.abs(oe(Y(o,t),n))<.02&&Math.abs(oe(Y(a,t),n))<.02}))}var bo=(r,e)=>Math.abs((r-e+540)%360-180);function Vc(r,e,t,n=Im){let i=Bc(r,e.x,e.z);if(!i)return null;let o=i.points,s=rt(o)>=0?1:-1,a=null;return o.forEach((l,c)=>{let u=o[(c+1)%o.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],_=oe(Y([e.x,e.z],l),p);if(_<0||_>h)return;let b=Cm(r,i,l,d)?t/2:0,g=oe(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)=>bo(e.rotation,E.rotation)<bo(e.rotation,z.rotation)?E:z);if(bo(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:Lc(e.x-d[0]*y),z:Lc(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 Hr(r,e,t){let n=structuredClone(r);for(let i of n.floors){let o=i.furniture.find(s=>s.id===e);o&&t(o,i)}return n}function Ir(r,e,t){let n=structuredClone(r);for(let i of n.floors){let o=i.placements.find(s=>s.entity_id===e);o&&t(o,i)}return n}function Kc(r,e){let t=structuredClone(r);for(let n of t.floors)n.furniture=n.furniture.filter(i=>i.id!==e);return t}function Gc(r,e){let t=structuredClone(r);for(let n of t.floors)n.placements=n.placements.filter(i=>i.entity_id!==e);return t}function Uc(r,e,t,n){return Ir(r,e,(i,o)=>{[i.x,i.z]=vo(o,i.x,i.z,t,n)})}function jc(r,e,t,n){let i=r.settings.wall_interior??.12;return Hr(r,e,(o,s)=>{[o.x,o.z]=vo(s,o.x,o.z,t,n);let a=Vc(s,o,i);a&&Object.assign(o,a)})}var wo=(r,e)=>((r+e)%360+360)%360,qc=r=>Number.parseFloat(r.replace(",",".")),Sn=(r,e)=>Math.round(r*10**e)/10**e;function yo(r){let{min:e,max:t,accepts:n=()=>!0}=r,i=o=>{let s=qc(o.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",go);function ae(r,e){return Math.abs(e)>=1e3?`${O(r,e/1e3,1)} kW`:`${Math.round(e)} W`}function fo(r){return r.type==="tv_board"?r.h+.9:r.type==="tv_wall"||r.type==="kitchen_wall"?r.h+.25:r.h+.35}function Hm(r,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:te(r,e)}var Oc;function Wc(){let r=new URL("./nextfloor-editor.js?v=dafe94a24af9",new URL(import.meta.url)).href;return Oc??=import(r),Oc}var Im=.25,Lc=r=>Math.round(r*1e3)/1e3,Bc=(r,e,t)=>r.rooms.find(n=>n.points.length>=3&&H([e,t],n.points));function bo(r,e,t,n,i){let o=Bc(r,e,t);if(!o)return[n,i];let s=(a,l)=>H([a,l],o.points);return s(n,i)?[n,i]:s(n,t)?[n,t]:s(e,i)?[e,i]:[e,t]}function Cm(r,e,t,n){return r.rooms.some(i=>i.id!==e.id&&i.points.some((o,s)=>{let a=i.points[(s+1)%i.points.length];return Math.abs(oe(Y(o,t),n))<.02&&Math.abs(oe(Y(a,t),n))<.02}))}var _o=(r,e)=>Math.abs((r-e+540)%360-180);function Vc(r,e,t,n=Im){let i=Bc(r,e.x,e.z);if(!i)return null;let o=i.points,s=rt(o)>=0?1:-1,a=null;return o.forEach((l,c)=>{let u=o[(c+1)%o.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],_=oe(Y([e.x,e.z],l),p);if(_<0||_>h)return;let b=Cm(r,i,l,d)?t/2:0,g=oe(Y([e.x,e.z],l),d)-b,v=Math.atan2(-d[0],d[1])*180/Math.PI,S=[{rotation:v,extent:e.d/2},{rotation:v+90,extent:e.w/2},{rotation:v-90,extent:e.w/2}].reduce((z,E)=>_o(e.rotation,E.rotation)<_o(e.rotation,z.rotation)?E:z);if(_o(e.rotation,S.rotation)>50)return;let y=g-S.extent;Math.abs(y)>n||a&&Math.abs(y)>=Math.abs(a.gap)||(a={x:Lc(e.x-d[0]*y),z:Lc(e.z-d[1]*y),rotation:(Math.round(S.rotation)%360+360)%360,gap:y})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function Hr(r,e,t){let n=structuredClone(r);for(let i of n.floors){let o=i.furniture.find(s=>s.id===e);o&&t(o,i)}return n}function Ir(r,e,t){let n=structuredClone(r);for(let i of n.floors){let o=i.placements.find(s=>s.entity_id===e);o&&t(o,i)}return n}function Kc(r,e){let t=structuredClone(r);for(let n of t.floors)n.furniture=n.furniture.filter(i=>i.id!==e);return t}function Gc(r,e){let t=structuredClone(r);for(let n of t.floors)n.placements=n.placements.filter(i=>i.entity_id!==e);return t}function Uc(r,e,t,n){return Ir(r,e,(i,o)=>{[i.x,i.z]=bo(o,i.x,i.z,t,n)})}function jc(r,e,t,n){let i=r.settings.wall_interior??.12;return Hr(r,e,(o,s)=>{[o.x,o.z]=bo(s,o.x,o.z,t,n);let a=Vc(s,o,i);a&&Object.assign(o,a)})}var vo=(r,e)=>((r+e)%360+360)%360,qc=r=>Number.parseFloat(r.replace(",",".")),Sn=(r,e)=>Math.round(r*10**e)/10**e;function wo(r){let{min:e,max:t,accepts:n=()=>!0}=r,i=o=>{let s=qc(o.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}
|
>${r.label}
|
||||||
<input type="number" inputmode="decimal" step=${r.step} min=${e} max=${t??f} .value=${String(Sn(r.value,2))} @change=${i} />
|
<input type="number" inputmode="decimal" step=${r.step} min=${e} max=${t??f} .value=${String(Sn(r.value,2))} @change=${i} />
|
||||||
</label>`}var Yc=(r,e)=>m`<button class="nf-chip" @click=${e}>${r.t("height_auto")}</button>`,Zc=(r,e)=>m`<button class="nf-chip" @click=${()=>e(-r)}>↺ ${r}°</button><button class="nf-chip" @click=${()=>e(r)}>↻ ${r}°</button>`;function Nm(r,e){let t=r.building.floors.find(s=>s.furniture.some(a=>a.id===e)),n=t?.furniture.find(s=>s.id===e);if(!t||!n)return f;let i=(s,a)=>yo({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]=Sn(l,3))}),o=xs(n)?m`${yo({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=Sn(s,3))})}
|
</label>`}var Yc=(r,e)=>m`<button class="nf-chip" @click=${e}>${r.t("height_auto")}</button>`,Zc=(r,e)=>m`<button class="nf-chip" @click=${()=>e(-r)}>↺ ${r}°</button><button class="nf-chip" @click=${()=>e(r)}>↻ ${r}°</button>`;function Nm(r,e){let t=r.building.floors.find(s=>s.furniture.some(a=>a.id===e)),n=t?.furniture.find(s=>s.id===e);if(!t||!n)return f;let i=(s,a)=>wo({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]=Sn(l,3))}),o=ys(n)?m`${wo({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=Sn(s,3))})}
|
||||||
${n.mount_y!=null?Yc(r,()=>r.editFurniture(e,s=>s.mount_y=null)):f}`:f;return m`${i("w","size_short_w")}${i("d","size_short_d")}${i("h","size_short_h")} ${o}`}function Om(r,e){let t=r.building.floors.find(l=>l.placements.some(c=>c.entity_id===e)),n=t?.placements.find(l=>l.entity_id===e);if(!t||!n)return f;let i=D(e),o=(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}))}>
|
${n.mount_y!=null?Yc(r,()=>r.editFurniture(e,s=>s.mount_y=null)):f}`:f;return m`${i("w","size_short_w")}${i("d","size_short_d")}${i("h","size_short_h")} ${o}`}function Om(r,e){let t=r.building.floors.find(l=>l.placements.some(c=>c.entity_id===e)),n=t?.placements.find(l=>l.entity_id===e);if(!t||!n)return f;let i=F(e),o=(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>`)}
|
${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=i?yt(i,me(t,n.x,n.z),i==="light"?n.mount??"ceiling":null):1;return m`${i==="light"?o("lamp_mount",s,n.mount??"ceiling"):f}
|
</select>`,s=["ceiling","floor","table","wall"].map(l=>[l,r.t(`lamp_${l}`)]),a=i?yt(i,me(t,n.x,n.z),i==="light"?n.mount??"ceiling":null):1;return m`${i==="light"?o("lamp_mount",s,n.mount??"ceiling"):f}
|
||||||
${yo({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=Sn(l,3))})}
|
${wo({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=Sn(l,3))})}
|
||||||
${n.y!==null?Yc(r,()=>r.editDevice(e,l=>l.y=null)):f}`}function Jc(r,e,t){let n=r.t,i;if(e){let o=r.building.floors.flatMap(s=>s.furniture).find(s=>s.id===e)?.type;i=m`<span>${o?he(r.hass,o):""}</span>
|
${n.y!==null?Yc(r,()=>r.editDevice(e,l=>l.y=null)):f}`}function Jc(r,e,t){let n=r.t,i;if(e){let o=r.building.floors.flatMap(s=>s.furniture).find(s=>s.id===e)?.type;i=m`<span>${o?he(r.hass,o):""}</span>
|
||||||
${Nm(r,e)} ${Zc(45,s=>r.turnFurniture(e,s))}
|
${Nm(r,e)} ${Zc(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" title=${n("furn_mirror_hint")} @click=${()=>r.editFurniture(e,s=>s.mirror=!s.mirror)}>⇋ ${n("furn_mirror")}</button>
|
||||||
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeFurniture(e)}>${n("delete")}</button>`}else t?i=m`<span>${W(r.hass,t)}</span>
|
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeFurniture(e)}>${n("delete")}</button>`}else t?i=m`<span>${W(r.hass,t)}</span>
|
||||||
${Om(r,t)} ${Zc(45,o=>r.turnDevice(t,o))}
|
${Om(r,t)} ${Zc(45,o=>r.turnDevice(t,o))}
|
||||||
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeDevice(t)}>${n("delete")}</button>`:i=m`<span>${n("furnish_hint")}</span>`;return m`<div class="nf-furnish-bar">${i}<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">
|
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeDevice(t)}>${n("delete")}</button>`:i=m`<span>${n("furnish_hint")}</span>`;return m`<div class="nf-furnish-bar">${i}<button class="nf-chip nf-chip-on" @click=${()=>r.finish()}>${n("done")}</button></div>`}var Qc=Q`<svg class="nf-mark" viewBox="60 40 392 420" aria-hidden="true">
|
||||||
<polygon points="106,150 256,66 406,150 256,234" fill="none" stroke="currentColor" stroke-opacity=".55" stroke-width="12" stroke-dasharray="6 22" stroke-linecap="round"/>
|
<polygon points="106,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,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,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"/>
|
<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"/>
|
<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"}),It=(r,e,t)=>({name:r,fallback:t,read:n=>e.find(i=>i===n)??t,write:n=>n}),xo={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",kr,"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 Xc(r=Nr()){try{return r?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function eu(r=Nr()){try{return r?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function Nr(){try{return localStorage}catch{return null}}var Cr=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(xo)){let i=xo[n],o=this.raw(i.name);t[n]=o===null?i.fallback:i.read(o)}return new URLSearchParams(e).has("nf_stats")&&(t.stats=!0),t}save(e,t){let n=xo[e];try{this.storage?.setItem(`nextfloor.${n.name}`,n.write(t))}catch{}}};var tu=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(i=>i===n)??t,write:n=>n}),yo={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",kr,"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 Xc(r=Nr()){try{return r?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function eu(r=Nr()){try{return r?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function Nr(){try{return localStorage}catch{return null}}var Cr=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(yo)){let i=yo[n],o=this.raw(i.name);t[n]=o===null?i.fallback:i.read(o)}return new URLSearchParams(e).has("nf_stats")&&(t.stats=!0),t}save(e,t){let n=yo[e];try{this.storage?.setItem(`nextfloor.${n.name}`,n.write(t))}catch{}}};var tu=ne`
|
||||||
.nf-dot {
|
.nf-dot {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 8px;
|
width: 8px;
|
||||||
@@ -3803,11 +3803,11 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
gap: 12px;
|
gap: 12px;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
`;var nu=new WeakMap,ru=new WeakMap,Wm={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=ru.get(r)??r,n=nu.get(t)??new WeakMap;nu.set(t,n);let i=n.get(e);if(i)return i;let o=new Map;for(let l of e)for(let c of l.placements)c.entity_id.startsWith("cover.")&&o.set(c.entity_id,{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&&!o.has(l.cover)&&o.set(l.cover,{inverted:l.coverInverted,tiltInverted:l.coverTiltInverted,tilt:l.coverTilt,position:l.position,positionInverted:l.positionInverted}),l.cover2&&!o.has(l.cover2)&&o.set(l.cover2,{inverted:l.cover2Inverted,tiltInverted:l.cover2TiltInverted,tilt:l.cover2Tilt});let s={...t.states};for(let[l,c]of o){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"?o.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=Wm[g]??g;let k=v?"tilt_position":"position";typeof b[k]=="number"&&(b[k]=100-b[k])}let $=_.tilt?t.states[_.tilt]:void 0;return v&&_.tilt&&!$?.attributes.symcon_id&&typeof $?.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 ru.set(a,t),n.set(e,a),a}var ko=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 Cr(Nr());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=o=>`${String(Math.floor(o)).padStart(2,"0")}:${String(Math.round(o%1*60)).padStart(2,"0")}`,i=()=>{let o=new Date;return Math.round((o.getHours()+o.getMinutes()/60)*4)/4};return m`<button class="nf-chip" aria-pressed=${t!==null} title=${e("time_of_day_hint")} @click=${()=>(this._timeDrag=null,this._timeOfDay=t===null?i():null)}>☀ ${t===null?e("time_of_day"):n(t)}</button>
|
`;var nu=new WeakMap,ru=new WeakMap;function dt(r,e){let t=ru.get(r)??r,n=nu.get(t)??new WeakMap;nu.set(t,n);let i=n.get(e);if(i)return i;let o=new Map;for(let l of e)for(let c of l.placements)c.entity_id.startsWith("cover.")&&o.set(c.entity_id,{tilt:c.cover_tilt==="none"?null:c.cover_tilt,position:c.position});for(let l of Re(t,e).values())l.cover&&!o.has(l.cover)&&o.set(l.cover,{tilt:l.coverTilt,position:l.position}),l.cover2&&!o.has(l.cover2)&&o.set(l.cover2,{tilt:l.cover2Tilt});let s={...t.states};for(let[l,c]of o){let u=t.states[l];if(!u)continue;let h={...u.attributes,nf_cover_control:!0},p=xt(t,c.position);p===null&&(p=typeof u.attributes.current_position=="number"?u.attributes.current_position:null),p!==null&&(h.current_position=p);let d=c.tilt?t.states[c.tilt]:u,_=typeof d?.attributes.current_tilt_position=="number"?d.attributes.current_tilt_position:c.tilt?xt(t,c.tilt):null;_!==null&&(h.current_tilt_position=_,h.supported_features=Number(h.supported_features??0)|128);let b=u.state;typeof h.current_position=="number"&&b!=="unavailable"&&b!=="unknown"&&b!=="opening"&&b!=="closing"&&(b=h.current_position>0?"open":"closed"),s[l]={...u,state:b,attributes:h}}let a={...t,states:s,callService:async(l,c,u={})=>{if(l!=="cover")return t.callService(l,c,u);let h=Array.isArray(u.entity_id)?u.entity_id:[u.entity_id],p=async d=>{let _=typeof d=="string"?o.get(d):void 0;if(!_)return t.callService(l,c,{...u,entity_id:d});let b={...u,entity_id:d},g=c;(g==="toggle"||g==="toggle_cover")&&(g=s[String(d)]?.state==="closed"?"open_cover":"close_cover");let v=g.includes("tilt");v&&_.tilt&&(b.entity_id=_.tilt);let $=_.tilt?t.states[_.tilt]:void 0;return v&&_.tilt&&!$?.attributes.symcon_id&&typeof $?.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 ru.set(a,t),n.set(e,a),a}var xo=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 Cr(Nr());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=o=>`${String(Math.floor(o)).padStart(2,"0")}:${String(Math.round(o%1*60)).padStart(2,"0")}`,i=()=>{let o=new Date;return Math.round((o.getHours()+o.getMinutes()/60)*4)/4};return m`<button class="nf-chip" aria-pressed=${t!==null} title=${e("time_of_day_hint")} @click=${()=>(this._timeDrag=null,this._timeOfDay=t===null?i():null)}>☀ ${t===null?e("time_of_day"):n(t)}</button>
|
||||||
${t!==null?m`<label class="nf-chip nf-time-slider"
|
${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=${o=>this._timeDrag=Number(o.target.value)}
|
><input type="range" min="0" max="23.75" step="0.25" .value=${String(t)} aria-label=${e("time_of_day")} @input=${o=>this._timeDrag=Number(o.target.value)}
|
||||||
@change=${o=>(this._timeDrag=null,this._timeOfDay=Number(o.target.value))}
|
@change=${o=>(this._timeDrag=null,this._timeOfDay=Number(o.target.value))}
|
||||||
/></label>`:f}`}t=(e,t)=>A(this.hass,e,t);setPref(e,t){this._prefs={...this._prefs,[e]:t},this.store.save(e,t)}willUpdate(e){this.toggleAttribute("readable",!!this._prefs?.readable),e.has("hass")&&this.hass&&(this.style.colorScheme=br(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=Qt(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=>Hr(n,e,t)),editDevice:(e,t)=>this.applyEdit(n=>Ir(n,e,t)),turnFurniture:(e,t)=>this.applyEdit(n=>Hr(n,e,i=>i.rotation=wo(i.rotation,t))),turnDevice:(e,t)=>this.applyEdit(n=>Ir(n,e,i=>i.rotation=wo(i.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>Kc(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>Gc(t,e)),this._selDevice=null},finish:()=>{this._furnish=!1,this._selFurniture=null,this._selDevice=null}};saveMoods(e,t){this.applyEdit(n=>({...n,floors:n.floors.map(i=>({...i,rooms:i.rooms.map(o=>o.id===e?{...o,moods:t.length?t:void 0}:o)}))}))}applyEdit(e){let t=this.data.building;t&&this.data.edit(e(t))}view3d(){return this.renderRoot.querySelector("nf-view3d")}back(){this._outside?this._outside=!1:this._roomId?this._roomId=null:this._floorId&&(this.data.building?.floors.length??0)>1?this._floorId=null:this.view3d()?.resetView()}onKey=e=>{e.key!=="Escape"||this._mode!=="view"||(this._prefs.clean?this.setPref("clean",!1):this.back())};connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this.onKey)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.onKey)}render(){if(this.hass&&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}`:""}>
|
/></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=br(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=Qt(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=>Hr(n,e,t)),editDevice:(e,t)=>this.applyEdit(n=>Ir(n,e,t)),turnFurniture:(e,t)=>this.applyEdit(n=>Hr(n,e,i=>i.rotation=vo(i.rotation,t))),turnDevice:(e,t)=>this.applyEdit(n=>Ir(n,e,i=>i.rotation=vo(i.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>Kc(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>Gc(t,e)),this._selDevice=null},finish:()=>{this._furnish=!1,this._selFurniture=null,this._selDevice=null}};saveMoods(e,t){this.applyEdit(n=>({...n,floors:n.floors.map(i=>({...i,rooms:i.rooms.map(o=>o.id===e?{...o,moods:t.length?t:void 0}:o)}))}))}applyEdit(e){let t=this.data.building;t&&this.data.edit(e(t))}view3d(){return this.renderRoot.querySelector("nf-view3d")}back(){this._outside?this._outside=!1:this._roomId?this._roomId=null:this._floorId&&(this.data.building?.floors.length??0)>1?this._floorId=null:this.view3d()?.resetView()}onKey=e=>{e.key!=="Escape"||this._mode!=="view"||(this._prefs.clean?this.setPref("clean",!1):this.back())};connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this.onKey)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.onKey)}render(){if(this.hass&&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()}`}
|
${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}
|
${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}
|
${!e&&!this.data.error?m`<p class="nf-message">${this.t("loading")}</p>`:f}
|
||||||
@@ -3996,7 +3996,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
${t.clean?f:this.renderOverlay(e)}
|
${t.clean?f:this.renderOverlay(e)}
|
||||||
${this._furnish?Jc(this.furnishHost,this._selFurniture,this._selDevice):f}
|
${this._furnish?Jc(this.furnishHost,this._selFurniture,this._selDevice):f}
|
||||||
</div>
|
</div>
|
||||||
`}static styles=[$e,Ue,tu,_r]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",ko);var Lm=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,iu=(r,e)=>Number(r)*60+Number(e);function $n(r,e,t=new Date){if(!r||r==="off")return!1;if(r==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let n=Lm.exec(r.trim());if(!n)return!1;let i=iu(n[1],n[2]),o=iu(n[3],n[4]),s=t.getHours()*60+t.getMinutes();return i>o?s>=i||s<o:s>=i&&s<o}var Or=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($n(this.host.config()?.night,this.host.hass())),6e4)}stop(){clearTimeout(this.cleanTimer),clearTimeout(this.idleTimer),clearInterval(this.nightTimer)}};function ou(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 su=ne`
|
`}static styles=[$e,Ue,tu,_r]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",xo);var Wm=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,iu=(r,e)=>Number(r)*60+Number(e);function $n(r,e,t=new Date){if(!r||r==="off")return!1;if(r==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let n=Wm.exec(r.trim());if(!n)return!1;let i=iu(n[1],n[2]),o=iu(n[3],n[4]),s=t.getHours()*60+t.getMinutes();return i>o?s>=i||s<o:s>=i&&s<o}var Or=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($n(this.host.config()?.night,this.host.hass())),6e4)}stop(){clearTimeout(this.cleanTimer),clearTimeout(this.idleTimer),clearInterval(this.nightTimer)}};function ou(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 su=ne`
|
||||||
ha-card {
|
ha-card {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
background: var(--nf-bg);
|
background: var(--nf-bg);
|
||||||
@@ -4120,7 +4120,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;function So(r,e){let t=r.template,n=t?e?.[t]:void 0;if(!n)return r;let{type:i,template:o,...s}=n;return{...s,...r}}function au(r,e){let t=new Set(e),n=[];for(let o of r.floors){let s=o.rooms.filter(c=>t.has(c.id));if(!s.length)continue;let a=(c,u)=>s.some(h=>h.points.length>=3&&H([c,u],h.points)),l=new Set(s.map(c=>c.id));n.push({...o,rooms:s,openings:o.openings.filter(c=>l.has(c.room_id)),furniture:o.furniture.filter(c=>a(c.x,c.z)),placements:o.placements.filter(c=>a(c.x,c.z)),walls:(o.walls??[]).filter(c=>a((c.a[0]+c.b[0])/2,(c.a[1]+c.b[1])/2)),outdoor:[]})}let i={...r.settings.roof,type:"none",sections:[],solar:[]};return{...r,floors:n,settings:{...r.settings,roof:i}}}var Ct="nf-outside",$o=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 Or({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 zn(),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=So(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=$n(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=So(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=br(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let n=$n(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:au(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,i=e&&e.floors.length===1?e.floors[0].id:e?.floors.some(a=>a.id===n)?n:null,o=!!this._roomId&&t?.room_panel!==!1,s=!!this._roomId&&t?.room_panel===!1||!this.thumbs&&this.canSwitch&&!this._roomId&&!!i&&(e?.floors.length??0)>1;return{floorId:i,walls:this._walls??t?.walls??"auto",heat:this._heat??t?.heatmap??"none",explode:this._explode??t?.explode??!0,canGoBack:s,showBar:!!e&&!this._clean&&(s||!!t?.controls&&!o)}}shows(e){let t=this._config?.controls;return t===!0||Array.isArray(t)&&t.includes(e)}renderBar(e){let t=this.plan(),n=this.t,i=["temperature","humidity","co2"].filter(s=>this.shows(s)),o=(s,a)=>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 ko(r,e){let t=r.template,n=t?e?.[t]:void 0;if(!n)return r;let{type:i,template:o,...s}=n;return{...s,...r}}function au(r,e){let t=new Set(e),n=[];for(let o of r.floors){let s=o.rooms.filter(c=>t.has(c.id));if(!s.length)continue;let a=(c,u)=>s.some(h=>h.points.length>=3&&H([c,u],h.points)),l=new Set(s.map(c=>c.id));n.push({...o,rooms:s,openings:o.openings.filter(c=>l.has(c.room_id)),furniture:o.furniture.filter(c=>a(c.x,c.z)),placements:o.placements.filter(c=>a(c.x,c.z)),walls:(o.walls??[]).filter(c=>a((c.a[0]+c.b[0])/2,(c.a[1]+c.b[1])/2)),outdoor:[]})}let i={...r.settings.roof,type:"none",sections:[],solar:[]};return{...r,floors:n,settings:{...r.settings,roof:i}}}var Ct="nf-outside",So=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 Or({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 zn(),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=ko(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=$n(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=ko(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=br(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let n=$n(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:au(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,i=e&&e.floors.length===1?e.floors[0].id:e?.floors.some(a=>a.id===n)?n:null,o=!!this._roomId&&t?.room_panel!==!1,s=!!this._roomId&&t?.room_panel===!1||!this.thumbs&&this.canSwitch&&!this._roomId&&!!i&&(e?.floors.length??0)>1;return{floorId:i,walls:this._walls??t?.walls??"auto",heat:this._heat??t?.heatmap??"none",explode:this._explode??t?.explode??!0,canGoBack:s,showBar:!!e&&!this._clean&&(s||!!t?.controls&&!o)}}shows(e){let t=this._config?.controls;return t===!0||Array.isArray(t)&&t.includes(e)}renderBar(e){let t=this.plan(),n=this.t,i=["temperature","humidity","co2"].filter(s=>this.shows(s)),o=(s,a)=>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}
|
${e.canGoBack?m`<button class="nf-chip" @click=${()=>this.back()}>${n("back")}</button>`:f}
|
||||||
${this.shows("walls")?o(void 0,[[e.walls==="auto",()=>this._walls="auto",n("walls_auto")],[e.walls==="cut",()=>this._walls="cut",n("walls_cut")],[e.walls==="slope",()=>this._walls="slope",n("walls_slope")]]):f}
|
${this.shows("walls")?o(void 0,[[e.walls==="auto",()=>this._walls="auto",n("walls_auto")],[e.walls==="cut",()=>this._walls="cut",n("walls_cut")],[e.walls==="slope",()=>this._walls="slope",n("walls_slope")]]):f}
|
||||||
${this.shows("floors")&&t.floors.length>1&&!e.floorId?o(void 0,[[e.explode,()=>this._explode=!0,n("floors_apart")],[!e.explode,()=>this._explode=!1,n("floors_stacked")]]):f}
|
${this.shows("floors")&&t.floors.length>1&&!e.floorId?o(void 0,[[e.explode,()=>this._explode=!0,n("floors_apart")],[!e.explode,()=>this._explode=!1,n("floors_stacked")]]):f}
|
||||||
@@ -4214,7 +4214,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
${n.showBar&&e?this.renderBar(n):f}
|
${n.showBar&&e?this.renderBar(n):f}
|
||||||
${this.renderCorners()}
|
${this.renderCorners()}
|
||||||
</div>
|
</div>
|
||||||
</ha-card>`}static styles=[$e,Ue,su,_r]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",$o);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})}oi();var Bm="nextfloor-chunks-v1";async function Mo(r,e,t){let n=await fetch(`${r.endpoint}/api?token=${encodeURIComponent(r.token)}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},credentials:"same-origin",body:JSON.stringify({...t,action:e,transport:Bm})}),i=await n.text(),o;try{o=JSON.parse(i)}catch{throw/Output-Buffer exceeds Limit/i.test(i)?new Error("Symcon hat die Antwort wegen seiner Ausgabebegrenzung abgebrochen. Bitte das NextFloor-Modul aktualisieren und den Designer neu laden."):new Error(`Symcon liefert ${i.trim()?"kein g\xFCltiges JSON":"eine leere Antwort"} f\xFCr \u201E${e}\u201C (HTTP ${n.status}).`)}if(!n.ok||!o||typeof o!="object"||"error"in o){let s=o&&typeof o=="object"&&"error"in o?o.error:`HTTP ${n.status}`;throw new Error(String(s))}return o}async function Nt(r,e,t={}){let n=await Mo(r,e,t);if(!("_nextfloor_transfer"in n))return n;let i=n._nextfloor_transfer;if(!i||!/^[a-f0-9]{32}$/.test(i.id)||!Number.isSafeInteger(i.bytes)||i.bytes<=0||i.bytes>67108864||!Number.isSafeInteger(i.chunk_bytes)||i.chunk_bytes<=0||i.chunk_bytes>128*1024||i.chunks!==Math.ceil(i.bytes/i.chunk_bytes)||i.chunks>512)throw new Error("Symcon hat eine ung\xFCltige Daten\xFCbertragung angek\xFCndigt.");try{let o=new TextDecoder("utf-8",{fatal:!0}),s=[];for(let a=0;a<i.chunks;a++){let l=await Mo(r,"transport/read",{transfer_id:i.id,index:a});if(l.index!==a||typeof l.data!="string")throw new Error("Ein Symcon-Datenpaket fehlt oder ist ung\xFCltig.");let c=Uint8Array.from(atob(l.data),u=>u.charCodeAt(0));if(c.length!==Math.min(i.chunk_bytes,i.bytes-a*i.chunk_bytes))throw new Error("Ein Symcon-Datenpaket wurde unvollst\xE4ndig \xFCbertragen.");s.push(o.decode(c,{stream:!0}))}return s.push(o.decode()),JSON.parse(s.join(""))}finally{await Mo(r,"transport/release",{transfer_id:i.id}).catch(()=>{})}}function Vm(){let r=window.__NEXTFLOOR_SYMCON__;if(!r?.endpoint||!r.token)throw new Error("NextFloor Symcon host configuration is missing");return r}var Wr=class{settings=Vm();changeListeners=new Set;buildingListeners=new Set;timer;stateRevision=-1;buildingRevision=-1;objectsSignature="";refreshTask;states={};entities={};areas={};facade={language:this.settings.language||navigator.language||"de",user:{is_admin:!0,name:this.settings.title||"IP-Symcon"},states:this.states,entities:this.entities,areas:this.areas,symconObjects:[],symconRefresh:()=>this.refresh(!0),config:{unit_system:{temperature:"\xB0C"}},themes:{darkMode:window.matchMedia?.("(prefers-color-scheme: dark)").matches??!0},services:{},connection:{subscribeMessage:async(e,t)=>{if(t.type==="nextfloor/building/subscribe"){let n=i=>e({revision:i});return this.buildingListeners.add(n),async()=>{this.buildingListeners.delete(n)}}return async()=>{}}},callWS:e=>this.callWS(e),callService:(e,t,n)=>this.callService(e,t,n),fetchWithAuth:(e,t)=>this.fetchWithToken(e,t),hassUrl:(e="")=>new URL(e,window.location.origin).href};async start(){let e=await Nt(this.settings,"bootstrap");return this.apply(e),this.stateRevision=e.state_revision,this.buildingRevision=e.building_revision,this.timer=setInterval(()=>{this.refresh().catch(()=>{})},800),this.snapshot()}stop(){this.timer&&clearInterval(this.timer),this.timer=void 0}onChange(e){return this.changeListeners.add(e),()=>this.changeListeners.delete(e)}snapshot(){return{...this.facade,states:{...this.states},entities:{...this.entities},areas:{...this.areas}}}refresh(e=!1){if(this.refreshTask)return e?this.refreshTask.catch(()=>{}).then(()=>this.refresh(!0)):this.refreshTask;let t=this.loadSnapshot(e).finally(()=>{this.refreshTask===t&&(this.refreshTask=void 0)});return this.refreshTask=t,t}async loadSnapshot(e){let t=e?await Nt(this.settings,"bootstrap"):await Nt(this.settings,"variables/snapshot",{revision:this.stateRevision});if((e||t.state_revision!==this.stateRevision)&&t.variables){this.stateRevision=t.state_revision,this.apply({variables:t.variables,areas:t.areas,objects:t.objects});for(let n of this.changeListeners)n()}if(t.building_revision!==this.buildingRevision){this.buildingRevision=t.building_revision;for(let n of this.buildingListeners)n(t.building_revision)}}apply(e){this.states=Object.fromEntries(e.variables.map(t=>[t.entity_id,{entity_id:t.entity_id,state:t.state,attributes:{...t.attributes,friendly_name:t.name,symcon_path:t.path}}])),this.entities=Object.fromEntries(e.variables.map(t=>[t.entity_id,{entity_id:t.entity_id,name:t.name,area_id:t.area_id??null,device_id:t.device_id??null}]));for(let t of Object.values(this.states))for(let n of["light","cover"]){let i=Ps(t,n);!i||i.entity_id===t.entity_id||this.states[i.entity_id]||(this.states[i.entity_id]=i,this.entities[i.entity_id]={...thiLine truncated
|
</ha-card>`}static styles=[$e,Ue,su,_r]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",So);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})}oi();var Lm="nextfloor-chunks-v1";async function $o(r,e,t){let n=await fetch(`${r.endpoint}/api?token=${encodeURIComponent(r.token)}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},credentials:"same-origin",body:JSON.stringify({...t,action:e,transport:Lm})}),i=await n.text(),o;try{o=JSON.parse(i)}catch{throw/Output-Buffer exceeds Limit/i.test(i)?new Error("Symcon hat die Antwort wegen seiner Ausgabebegrenzung abgebrochen. Bitte das NextFloor-Modul aktualisieren und den Designer neu laden."):new Error(`Symcon liefert ${i.trim()?"kein g\xFCltiges JSON":"eine leere Antwort"} f\xFCr \u201E${e}\u201C (HTTP ${n.status}).`)}if(!n.ok||!o||typeof o!="object"||"error"in o){let s=o&&typeof o=="object"&&"error"in o?o.error:`HTTP ${n.status}`;throw new Error(String(s))}return o}async function Nt(r,e,t={}){let n=await $o(r,e,t);if(!("_nextfloor_transfer"in n))return n;let i=n._nextfloor_transfer;if(!i||!/^[a-f0-9]{32}$/.test(i.id)||!Number.isSafeInteger(i.bytes)||i.bytes<=0||i.bytes>67108864||!Number.isSafeInteger(i.chunk_bytes)||i.chunk_bytes<=0||i.chunk_bytes>128*1024||i.chunks!==Math.ceil(i.bytes/i.chunk_bytes)||i.chunks>512)throw new Error("Symcon hat eine ung\xFCltige Daten\xFCbertragung angek\xFCndigt.");try{let o=new TextDecoder("utf-8",{fatal:!0}),s=[];for(let a=0;a<i.chunks;a++){let l=await $o(r,"transport/read",{transfer_id:i.id,index:a});if(l.index!==a||typeof l.data!="string")throw new Error("Ein Symcon-Datenpaket fehlt oder ist ung\xFCltig.");let c=Uint8Array.from(atob(l.data),u=>u.charCodeAt(0));if(c.length!==Math.min(i.chunk_bytes,i.bytes-a*i.chunk_bytes))throw new Error("Ein Symcon-Datenpaket wurde unvollst\xE4ndig \xFCbertragen.");s.push(o.decode(c,{stream:!0}))}return s.push(o.decode()),JSON.parse(s.join(""))}finally{await $o(r,"transport/release",{transfer_id:i.id}).catch(()=>{})}}function Bm(){let r=window.__NEXTFLOOR_SYMCON__;if(!r?.endpoint||!r.token)throw new Error("NextFloor Symcon host configuration is missing");return r}var Wr=class{settings=Bm();changeListeners=new Set;buildingListeners=new Set;timer;stateRevision=-1;buildingRevision=-1;objectsSignature="";refreshTask;states={};entities={};areas={};facade={language:this.settings.language||navigator.language||"de",user:{is_admin:!0,name:this.settings.title||"IP-Symcon"},states:this.states,entities:this.entities,areas:this.areas,symconObjects:[],symconRefresh:()=>this.refresh(!0),config:{unit_system:{temperature:"\xB0C"}},themes:{darkMode:window.matchMedia?.("(prefers-color-scheme: dark)").matches??!0},services:{},connection:{subscribeMessage:async(e,t)=>{if(t.type==="nextfloor/building/subscribe"){let n=i=>e({revision:i});return this.buildingListeners.add(n),async()=>{this.buildingListeners.delete(n)}}return async()=>{}}},callWS:e=>this.callWS(e),callService:(e,t,n)=>this.callService(e,t,n),fetchWithAuth:(e,t)=>this.fetchWithToken(e,t),hassUrl:(e="")=>new URL(e,window.location.origin).href};async start(){let e=await Nt(this.settings,"bootstrap");return this.apply(e),this.stateRevision=e.state_revision,this.buildingRevision=e.building_revision,this.timer=setInterval(()=>{this.refresh().catch(()=>{})},800),this.snapshot()}stop(){this.timer&&clearInterval(this.timer),this.timer=void 0}onChange(e){return this.changeListeners.add(e),()=>this.changeListeners.delete(e)}snapshot(){return{...this.facade,states:{...this.states},entities:{...this.entities},areas:{...this.areas}}}refresh(e=!1){if(this.refreshTask)return e?this.refreshTask.catch(()=>{}).then(()=>this.refresh(!0)):this.refreshTask;let t=this.loadSnapshot(e).finally(()=>{this.refreshTask===t&&(this.refreshTask=void 0)});return this.refreshTask=t,t}async loadSnapshot(e){let t=e?await Nt(this.settings,"bootstrap"):await Nt(this.settings,"variables/snapshot",{revision:this.stateRevision});if((e||t.state_revision!==this.stateRevision)&&t.variables){this.stateRevision=t.state_revision,this.apply({variables:t.variables,areas:t.areas,objects:t.objects});for(let n of this.changeListeners)n()}if(t.building_revision!==this.buildingRevision){this.buildingRevision=t.building_revision;for(let n of this.buildingListeners)n(t.building_revision)}}apply(e){this.states=Object.fromEntries(e.variables.map(t=>[t.entity_id,{entity_id:t.entity_id,state:t.state,attributes:{...t.attributes,friendly_name:t.name,symcon_path:t.path}}])),this.entities=Object.fromEntries(e.variables.map(t=>[t.entity_id,{entity_id:t.entity_id,name:t.name,area_id:t.area_id??null,device_id:t.device_id??null}]));for(let t of Object.values(this.states))for(let n of["light","cover"]){let i=Fs(t,n);!i||i.entity_id===t.entity_id||this.states[i.entity_id]||(this.states[i.entity_id]=i,this.entities[i.entity_id]={...thiLine truncated
|
||||||
/*! Bundled license information:
|
/*! Bundled license information:
|
||||||
|
|
||||||
@lit/reactive-element/css-tag.js:
|
@lit/reactive-element/css-tag.js:
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
+10
-1
@@ -16,7 +16,7 @@ In **Kerninstanzen → Modules** wird dieses Repository verwendet:
|
|||||||
|
|
||||||
Im Zahnrad des Eintrags den Branch **`symcon`** wählen und auf Aktualisierungen prüfen.
|
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.
|
`main` enthält die Quellen für die Entwicklung, `symcon` die installierbare Bibliothek.
|
||||||
Nach der Aktualisierung auf **0.2.8 / Build 11** die Konsole neu laden. Unter
|
Nach der Aktualisierung auf **0.2.9 / Build 12** die Konsole neu laden. Unter
|
||||||
**Instanz hinzufügen → Hersteller NextFloor** erscheint **„NextFloor Designer und 3D-Kachel“**.
|
**Instanz hinzufügen → Hersteller NextFloor** erscheint **„NextFloor Designer und 3D-Kachel“**.
|
||||||
|
|
||||||
### Für die Entwicklung
|
### Für die Entwicklung
|
||||||
@@ -46,6 +46,15 @@ Die Dateien unter `NextFloor/assets/` und `NextFloor/packs/` werden durch
|
|||||||
Der Build prüft anschließend die Modulmetadaten und die installierbare Verzeichnisstruktur.
|
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.
|
Dieselbe Prüfung lässt sich separat mit `node symcon/tests/validate-package.mjs` ausführen.
|
||||||
|
|
||||||
|
## Änderungen in 0.2.9
|
||||||
|
|
||||||
|
- **Behang in 3D umkehren** und **Lamellen in 3D umkehren** ändern ausschließlich die
|
||||||
|
Darstellung. Empfangene Werte, Prozentanzeigen, Regler und gesendete Steuerbefehle
|
||||||
|
bleiben unverändert: **0 bleibt 0**, auch bei aktiviertem Schalter.
|
||||||
|
- Dasselbe gilt beim zweiten Behang und für die Umkehrung des Positionssensors.
|
||||||
|
Bereits gespeicherte Umkehrungen gelten nach diesem Update nur für die Darstellung;
|
||||||
|
die Datenpunkte müssen nicht neu verknüpft werden. Ein Infosymbol erklärt die Optionen.
|
||||||
|
|
||||||
## Änderungen in 0.2.8
|
## Änderungen in 0.2.8
|
||||||
|
|
||||||
- Lange Namen und Objektpfade in der Datenpunktauswahl werden mit Auslassungspunkten
|
- Lange Namen und Objektpfade in der Datenpunktauswahl werden mit Auslassungspunkten
|
||||||
|
|||||||
+2
-2
@@ -6,7 +6,7 @@
|
|||||||
"compatibility": {
|
"compatibility": {
|
||||||
"version": "9.0"
|
"version": "9.0"
|
||||||
},
|
},
|
||||||
"version": "0.2.8",
|
"version": "0.2.9",
|
||||||
"build": 11,
|
"build": 12,
|
||||||
"date": 1794297600
|
"date": 1794297600
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user