feat: add 3D hydronic manifolds buffer tanks and fresh water stations
This commit is contained in:
1 parent
93c015ec77
commit
173d02e3cc
37 files changed
+3253
-1815
No files matched your search
@@ -6,6 +6,8 @@ All notable changes to NextFloor, newest first. Every release lists what is **Ad
|
||||
|
||||
### Added
|
||||
|
||||
- **Hydronic 3D equipment (Symcon 0.2.23):** Place configurable heating/cooling manifolds, buffer tanks and fresh-water stations from the furniture library. Manifolds support separate valve/pump circuits and valve-free feed pumps, independent command/readback bindings, raw-value changeover selection and visual-only valve inversion. Buffers start with seven height-configurable probe slots and support up to 64 plus flow/return; fresh-water stations expose flow, return, circulation and domestic hot water with independent charging/circulation pumps. Live pump rotors, valve pointers and probe colours accompany lazy floating cards/dialogs, archive trends and native action controls with read-only guards. Feedback stays authoritative even offline; native values and write ranges remain unchanged. Multi-reading hydraulic cards use nearby free columns to stay on screen.
|
||||
|
||||
- **Native area and room utility hierarchy (Symcon 0.2.22):** Floor overviews group by the linked native area ID and display its category name and readings once. Only rooms with explicitly assigned power/flow or consumption meters appear as indented children. The room editor provides native numeric meter selectors for all five media; children retain live values, archive access and navigation. Existing area totals cover room details; explicit room meters supply missing quantities without double counting and floor meters retain precedence.
|
||||
|
||||
- **Native picker feedback (Symcon 0.2.21):** Rejected selections explain native datatype requirements, instances/categories, missing variables or already linked schedules/presence variables inside the popup. Confirmation cannot apply an older pending choice after a rejection. Manual native variable selection uses actual datatypes instead of name/path/profile/domain heuristics; Boolean garage and staircase lights both support an explicit on/off light role without a dimmer, retaining saved references.
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,254 @@
|
||||
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
|
||||
var Z=globalThis,J=Z.ShadowRoot&&(Z.ShadyCSS===void 0||Z.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Q=Symbol(),yt=new WeakMap,U=class{constructor(t,n,e){if(this._$cssResult$=!0,e!==Q)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=n}get styleSheet(){let t=this.o,n=this.t;if(J&&t===void 0){let e=n!==void 0&&n.length===1;e&&(t=yt.get(n)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&yt.set(n,t))}return t}toString(){return this.cssText}},vt=i=>new U(typeof i=="string"?i:i+"",void 0,Q),x=(i,...t)=>{let n=i.length===1?i[0]:t.reduce((e,r,s)=>e+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+i[s+1],i[0]);return new U(n,i,Q)},xt=(i,t)=>{if(J)i.adoptedStyleSheets=t.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(let n of t){let e=document.createElement("style"),r=Z.litNonce;r!==void 0&&e.setAttribute("nonce",r),e.textContent=n.cssText,i.appendChild(e)}},tt=J?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let n="";for(let e of t.cssRules)n+=e.cssText;return vt(n)})(i):i;var{is:It,defineProperty:Wt,getOwnPropertyDescriptor:Kt,getOwnPropertyNames:qt,getOwnPropertySymbols:Zt,getPrototypeOf:Jt}=Object,Y=globalThis,$t=Y.trustedTypes,Yt=$t?$t.emptyScript:"",Xt=Y.reactiveElementPolyfillSupport,z=(i,t)=>i,et={toAttribute(i,t){switch(t){case Boolean:i=i?Yt:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let n=i;switch(t){case Boolean:n=i!==null;break;case Number:n=i===null?null:Number(i);break;case Object:case Array:try{n=JSON.parse(i)}catch{n=null}}return n}},wt=(i,t)=>!It(i,t),_t={attribute:!0,type:String,converter:et,reflect:!1,useDefault:!1,hasChanged:wt};Symbol.metadata??=Symbol("metadata"),Y.litPropertyMetadata??=new WeakMap;var w=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,n=_t){if(n.state&&(n.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((n=Object.create(n)).wrapped=!0),this.elementProperties.set(t,n),!n.noAccessor){let e=Symbol(),r=this.getPropertyDescriptor(t,e,n);r!==void 0&&Wt(this.prototype,t,r)}}static getPropertyDescriptor(t,n,e){let{get:r,set:s}=Kt(this.prototype,t)??{get(){return this[n]},set(o){this[n]=o}};return{get:r,set(o){let c=r?.call(this);s?.call(this,o),this.requestUpdate(t,c,e)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??_t}static _$Ei(){if(this.hasOwnProperty(z("elementProperties")))return;let t=Jt(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(z("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(z("properties"))){let n=this.properties,e=[...qt(n),...Zt(n)];for(let r of e)this.createProperty(r,n[r])}let t=this[Symbol.metadata];if(t!==null){let n=litPropertyMetadata.get(t);if(n!==void 0)for(let[e,r]of n)this.elementProperties.set(e,r)}this._$Eh=new Map;for(let[n,e]of this.elementProperties){let r=this._$Eu(n,e);r!==void 0&&this._$Eh.set(r,n)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let n=[];if(Array.isArray(t)){let e=new Set(t.flat(1/0).reverse());for(let r of e)n.unshift(tt(r))}else t!==void 0&&n.push(tt(t));return n}static _$Eu(t,n){let e=n.attribute;return e===!1?void 0:typeof e=="string"?e:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,n=this.constructor.elementProperties;for(let e of n.keys())this.hasOwnProperty(e)&&(t.set(e,this[e]),delete this[e]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return xt(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,n,e){this._$AK(t,e)}_$ET(t,n){let e=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,e);if(r!==void 0&&e.reflect===!0){let s=(e.converter?.toAttribute!==void 0?e.converter:et).toAttribute(n,e.type);this._$Em=t,s==null?this.removeAttribute(r):this.setAttributeLine truncated
|
||||
\f\r]`,L=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Et=/-->/g,kt=/>/g,S=RegExp(`>|${nt}(?:([^\\s"'>=/]+)(${nt}*=${nt}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ht=/'/g,Ct=/"/g,Mt=/^(?:script|style|textarea|title)$/i,dt=i=>(t,...n)=>({_$litType$:i,strings:t,values:n}),p=dt(1),pe=dt(2),fe=dt(3),H=Symbol.for("lit-noChange"),a=Symbol.for("lit-nothing"),Rt=new WeakMap,E=k.createTreeWalker(k,129);function Ot(i,t){if(!ct(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return St!==void 0?St.createHTML(t):t}var te=(i,t)=>{let n=i.length-1,e=[],r,s=t===2?"<svg>":t===3?"<math>":"",o=L;for(let c=0;c<n;c++){let l=i[c],u,h,d=-1,f=0;for(;f<l.length&&(o.lastIndex=f,h=o.exec(l),h!==null);)f=o.lastIndex,o===L?h[1]==="!--"?o=Et:h[1]!==void 0?o=kt:h[2]!==void 0?(Mt.test(h[2])&&(r=RegExp("</"+h[2],"g")),o=S):h[3]!==void 0&&(o=S):o===S?h[0]===">"?(o=r??L,d=-1):h[1]===void 0?d=-2:(d=o.lastIndex-h[2].length,u=h[1],o=h[3]===void 0?S:h[3]==='"'?Ct:Ht):o===Ct||o===Ht?o=S:o===Et||o===kt?o=L:(o=S,r=void 0);let v=o===S&&i[c+1].startsWith("/>")?" ":"";s+=o===L?l+Gt:d>=0?(e.push(u),l.slice(0,d)+Pt+l.slice(d)+A+v):l+A+(d===-2?c:v)}return[Ot(i,s+(i[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),e]},j=class i{constructor({strings:t,_$litType$:n},e){let r;this.parts=[];let s=0,o=0,c=t.length-1,l=this.parts,[u,h]=te(t,n);if(this.el=i.createElement(u,e),E.currentNode=this.el.content,n===2||n===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(r=E.nextNode())!==null&&l.length<c;){if(r.nodeType===1){if(r.hasAttributes())for(let d of r.getAttributeNames())if(d.endsWith(Pt)){let f=h[o++],v=r.getAttribute(d).split(A),_=/([.?@])?(.*)/.exec(f);l.push({type:1,index:s,name:_[2],strings:v,ctor:_[1]==="."?rt:_[1]==="?"?st:_[1]==="@"?ot:P}),r.removeAttribute(d)}else d.startsWith(A)&&(l.push({type:6,index:s}),r.removeAttribute(d));if(Mt.test(r.tagName)){let d=r.textContent.split(A),f=d.length-1;if(f>0){r.textContent=X?X.emptyScript:"";for(let v=0;v<f;v++)r.append(d[v],D()),E.nextNode(),l.push({type:2,index:++s});r.append(d[f],D())}}}else if(r.nodeType===8)if(r.data===Nt)l.push({type:2,index:s});else{let d=-1;for(;(d=r.data.indexOf(A,d+1))!==-1;)l.push({type:7,index:s}),d+=A.length-1}s++}}static createElement(t,n){let e=k.createElement("template");return e.innerHTML=t,e}};function R(i,t,n=i,e){if(t===H)return t;let r=e!==void 0?n._$Co?.[e]:n._$Cl,s=F(t)?void 0:t._$litDirective$;return r?.constructor!==s&&(r?._$AO?.(!1),s===void 0?r=void 0:(r=new s(i),r._$AT(i,n,e)),e!==void 0?(n._$Co??=[])[e]=r:n._$Cl=r),r!==void 0&&(t=R(i,r._$AS(i,t.values),r,e)),t}var it=class{constructor(t,n){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:n},parts:e}=this._$AD,r=(t?.creationScope??k).importNode(n,!0);E.currentNode=r;let s=E.nextNode(),o=0,c=0,l=e[0];for(;l!==void 0;){if(o===l.index){let u;l.type===2?u=new V(s,s.nextSibling,this,t):l.type===1?u=new l.ctor(s,l.name,l.strings,this,t):l.type===6&&(u=new at(s,this,t)),this._$AV.push(u),l=e[++c]}o!==l?.index&&(s=E.nextNode(),o++)}return E.currentNode=k,r}p(t){let n=0;for(let e of this._$AV)e!==void 0&&(e.strings!==void 0?(e._$AI(t,e,n),n+=e.strings.length-2):e._$AI(t[n])),n++}},V=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,n,e,r){this.type=2,this._$AH=a,this._$AN=void 0,this._$AA=t,this._$AB=n,this._$AM=e,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,n=this._$AM;return n!==void 0&&t?.nodeType===11&&(t=n.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,n=this){t=R(this,t,n),F(t)?t===a||t==null||t===""?(this._$AH!==a&&this._$AR(),this._$AH=a):t!==this._$AH&&t!==H&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Qt(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==a&&F(this._$AH)?this._$AA.nextSibling.data=t:this.T(k.createTextNode(t)),this._$AH=t}$(t){let{values:n,_$litType$:e}=t,r=typeof e=="number"?this._$AC(t):(e.el===void 0&&(e.el=j.createElement(Ot(e.h,e.h[0]),this.options)),e);if(this._$AH?._$AD===r)this._$AH.p(n);else{let s=new it(r,this),o=s.u(this.options);s.p(n),this.T(o),this._$AH=s}}_$AC(t){let n=Rt.get(t.strings);return n===void 0&&Rt.set(t.strings,n=new j(t)),n}k(t){ct(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,e,r=0;for(let s of t)r===n.length?n.push(e=new i(this.O(D()),this.O(D()),this,this.options)):e=n[r],e._$AI(s),r++;r<n.length&&(this._$AR(e&&e._$AB.nextSibling,r),n.length=r)}_$AR(t=this._$AA.nextSibling,n){for(this._$AP?.(!1,!0,n);t!==this._$AB;){let e=At(t).nextSibling;At(t).remove(),t=e}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},P=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,n,e,r,s){this.type=1,this._$AH=a,this._$AN=void 0,this.element=t,this.name=n,this._$AM=r,this.options=s,e.length>2||e[0]!==""||e[1]!==""?(this._$AH=Array(e.length-1).fill(new String),this.strings=e)Line truncated
|
||||
:host {
|
||||
--nf-text: var(--primary-text-color, #e1e1e1);
|
||||
--nf-muted: var(--secondary-text-color, #9b9b9b);
|
||||
--nf-accent: var(--primary-color, #03a9f4);
|
||||
--nf-accent-text: var(--text-primary-color, #ffffff);
|
||||
--nf-surface: var(--ha-card-background, var(--card-background-color, #1c1c1c));
|
||||
--nf-bg: var(--primary-background-color, #111111);
|
||||
--nf-bg2: var(--secondary-background-color, #1c1c1c);
|
||||
/* floating bars and cards over the 3D view: the card colour, a little see-through */
|
||||
--nf-chrome: color-mix(in srgb, var(--nf-surface) var(--nf-chrome-mix, 84%), transparent);
|
||||
--nf-chrome-solid: var(--nf-surface);
|
||||
--nf-line: var(--divider-color, rgba(255, 255, 255, 0.12));
|
||||
/* quiet fills for buttons and fields, and the tonal accent of an active control */
|
||||
--nf-fill: color-mix(in srgb, var(--nf-text) 7%, transparent);
|
||||
--nf-fill-strong: color-mix(in srgb, var(--nf-text) 13%, transparent);
|
||||
--nf-tonal: color-mix(in srgb, var(--nf-accent) 20%, transparent);
|
||||
--nf-soft: var(--info-color, #4a90e2);
|
||||
--nf-warm: var(--state-light-active-color, #ffa726);
|
||||
--nf-danger: var(--error-color, #db4437);
|
||||
--nf-good: var(--success-color, #43a047);
|
||||
--nf-radius: var(--ha-card-border-radius, 12px);
|
||||
--nf-shadow: var(--ha-card-box-shadow, 0 1px 2px rgba(0, 0, 0, 0.18), 0 6px 20px rgba(0, 0, 0, 0.2));
|
||||
--nf-font: var(--primary-font-family, Roboto, "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif);
|
||||
--nf-title-font: var(--nf-font);
|
||||
font-family: var(--nf-font);
|
||||
color: var(--nf-text);
|
||||
}
|
||||
`,Me=x`
|
||||
:host([readable]) {
|
||||
--secondary-text-color: var(--primary-text-color, #e1e1e1);
|
||||
--divider-color: color-mix(in srgb, var(--primary-text-color, #e1e1e1) 40%, transparent);
|
||||
--nf-chrome-mix: 97%;
|
||||
}
|
||||
:host([readable]) nf-room-panel,
|
||||
:host([readable]) .nf-nav,
|
||||
:host([readable]) .nf-overlay {
|
||||
zoom: 1.2;
|
||||
}
|
||||
`,Oe=x`
|
||||
/* a group of switches: one rounded pill, the active one tinted with the accent */
|
||||
.nf-seg {
|
||||
display: inline-flex;
|
||||
padding: 4px;
|
||||
gap: 2px;
|
||||
border-radius: 999px;
|
||||
background: var(--nf-chrome);
|
||||
box-shadow: var(--nf-shadow);
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
.nf-seg button,
|
||||
.nf-chip {
|
||||
font: inherit;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
border: none;
|
||||
background: none;
|
||||
color: var(--nf-muted);
|
||||
padding: 7px 14px;
|
||||
border-radius: 999px;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
min-height: 36px;
|
||||
transition:
|
||||
background 0.15s,
|
||||
color 0.15s;
|
||||
}
|
||||
.nf-seg button:hover:not(:disabled),
|
||||
.nf-chip:hover {
|
||||
background: var(--nf-fill);
|
||||
color: var(--nf-text);
|
||||
}
|
||||
/* on a small stage (a small window, a zoomed browser, a dashboard column) the switches at the bottom take less room */
|
||||
@container nf ((max-width: 1360px) or (max-height: 640px)) {
|
||||
:is(.nf-overlay, .nf-card-controls) .nf-seg {
|
||||
padding: 3px;
|
||||
}
|
||||
:is(.nf-overlay, .nf-card-controls) :is(.nf-seg button, .nf-chip) {
|
||||
font-size: 12.5px;
|
||||
padding: 5px 10px;
|
||||
}
|
||||
}
|
||||
.nf-time-slider {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 4px 10px;
|
||||
}
|
||||
.nf-time-slider input {
|
||||
width: 160px;
|
||||
accent-color: var(--nf-accent);
|
||||
}
|
||||
.nf-seg button[aria-pressed="true"],
|
||||
.nf-chip[aria-pressed="true"] {
|
||||
background: color-mix(in srgb, var(--nf-accent) 24%, var(--nf-chrome-solid));
|
||||
color: var(--nf-accent);
|
||||
font-weight: 600;
|
||||
}
|
||||
.nf-seg button:disabled {
|
||||
opacity: 0.4;
|
||||
cursor: default;
|
||||
}
|
||||
/* a single pill, like the chips of the Mushroom cards */
|
||||
.nf-chip {
|
||||
background: var(--nf-chrome);
|
||||
color: var(--nf-text);
|
||||
box-shadow: var(--nf-shadow);
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
button:focus-visible,
|
||||
input:focus-visible,
|
||||
select:focus-visible {
|
||||
outline: 2px solid var(--nf-accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
/* the round icon badge every row and card starts with */
|
||||
.nf-ico {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex: none;
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
border-radius: 50%;
|
||||
background: var(--nf-tonal);
|
||||
color: var(--nf-accent);
|
||||
--mdc-icon-size: 20px;
|
||||
}
|
||||
.nf-ico.nf-warm {
|
||||
background: color-mix(in srgb, var(--nf-warm) 22%, transparent);
|
||||
color: var(--nf-warm);
|
||||
}
|
||||
.nf-ico.nf-off {
|
||||
background: var(--nf-fill);
|
||||
color: var(--nf-muted);
|
||||
}
|
||||
.nf-btn {
|
||||
font: inherit;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
border: none;
|
||||
background: var(--nf-fill);
|
||||
color: var(--nf-text);
|
||||
border-radius: var(--nf-radius);
|
||||
padding: 7px 14px;
|
||||
cursor: pointer;
|
||||
min-height: 36px;
|
||||
transition: background 0.15s;
|
||||
}
|
||||
.nf-btn:hover {
|
||||
background: var(--nf-fill-strong);
|
||||
}
|
||||
.nf-btn.nf-danger {
|
||||
color: var(--nf-danger);
|
||||
}
|
||||
.nf-btn.nf-primary {
|
||||
background: var(--nf-accent);
|
||||
color: var(--nf-accent-text);
|
||||
}
|
||||
.nf-btn.nf-primary:hover {
|
||||
background: color-mix(in srgb, var(--nf-accent) 88%, var(--nf-text));
|
||||
}
|
||||
.nf-field {
|
||||
display: grid;
|
||||
gap: 4px;
|
||||
font-size: 12px;
|
||||
color: var(--nf-muted);
|
||||
}
|
||||
.nf-field input,
|
||||
.nf-field select,
|
||||
.nf-field textarea {
|
||||
font: inherit;
|
||||
font-size: 14px;
|
||||
color: var(--nf-text);
|
||||
background: var(--nf-fill);
|
||||
border: none;
|
||||
border-bottom: 1px solid var(--nf-line);
|
||||
border-radius: 10px 10px 4px 4px;
|
||||
padding: 8px 10px;
|
||||
min-width: 0;
|
||||
}
|
||||
.nf-field input:focus,
|
||||
.nf-field select:focus,
|
||||
.nf-field textarea:focus {
|
||||
border-bottom-color: var(--nf-accent);
|
||||
}
|
||||
.nf-field input[type="range"] {
|
||||
padding: 0;
|
||||
accent-color: var(--nf-accent);
|
||||
}
|
||||
.nf-field select option {
|
||||
background: var(--nf-chrome-solid);
|
||||
color: var(--nf-text);
|
||||
}
|
||||
/* fingers need 40 px */
|
||||
@media (pointer: coarse) {
|
||||
.nf-seg button,
|
||||
.nf-chip,
|
||||
.nf-btn {
|
||||
min-height: 40px;
|
||||
}
|
||||
}
|
||||
`;function pt(i,t){let n=new Set;return t.flatMap(e=>{let r=String(i?.states[e]?.attributes.symcon_source_entity||e),s=i?.states[r]?.attributes,o=Number(s?.symcon_id);return!o||!s?.symcon_archive||n.has(o)?[]:(n.add(o),[r])})}var zt,ft=class extends b{static properties={hass:{attribute:!1},ids:{attribute:!1},label:{attribute:!1},busy:{state:!0},error:{state:!0}};constructor(){super(),this.ids=[],this.label="",this.busy=!1,this.error=""}async open(t){t.stopPropagation(),this.busy=!0,this.error="";try{let n=new URL("./nextfloor-trend.js?v=84417e0b2573",import.meta.url).href;await(await(zt??=import(n).catch(r=>{throw zt=void 0,r}))).openTrend(this.hass,this.ids,this.label)}catch(n){this.error=n instanceof Error?n.message:String(n)}finally{this.busy=!1}}render(){if(!pt(this.hass,this.ids).length)return a;let t=this.label?`Trend anzeigen: ${this.label}`:"Trend anzeigen";return p`<button type="button" title=${t} aria-label=${t} aria-haspopup="dialog" ?disabled=${this.busy} @pointerdown=${n=>n.stopPropagation()} @click=${n=>{this.open(n)}}>
|
||||
<svg width="12" height="12" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M3 2v15h15M5 13l4-5 4 2 4-6"/></svg>
|
||||
</button>${this.error?p`<span role="alert">${this.error}</span>`:a}`}static styles=x`:host{position:relative;display:inline-flex;flex:0 0 18px;width:18px;height:18px;vertical-align:middle;margin-left:3px;font-weight:normal;line-height:0}button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:18px;height:18px;padding:2px;border:0;border-radius:3px;background:transparent;color:var(--nf-accent,#40c8ff);opacity:.8;cursor:pointer}svg{display:block;flex-shrink:0}button:hover,button:focus-visible{opacity:1;background:#40c8ff18}button:focus-visible{outline:1px solid currentColor;outline-offset:1px}button:disabled{opacity:.4}span{position:absolute;right:0;top:22px;z-index:10;box-sizing:border-box;width:200px;padding:8px;border:1px solid #ff9b9b50;border-radius:6px;background:var(--nf-chrome-solid,#1c1c1c);font:12px/1.4 system-ui;color:#ff9b9b;white-space:normal}`};customElements.get("nf-trend-button")||customElements.define("nf-trend-button",ft);function G(i,t,n=""){let e=pt(i,t);return e.length?p`<nf-trend-button .hass=${i} .ids=${e} .label=${n}></nf-trend-button>`:a}var ae={heating_manifold:"Heiz-/K\xFChlkreisverteiler",buffer_tank:"Pufferspeicher",freshwater_station:"Frischwasserstation"},Dt=i=>i.name||ae[i.type],Ft=i=>i.name||{heating:"Heizkreis",cooling:"K\xFChlkreis",changeover:"Heizen / K\xFChlen",pump:"Vorschubpumpe"}[i.kind],jt=(i,t)=>t.kind==="pump"?"Pumpenkreis":t.kind==="cooling"?"K\xFChlen":t.kind==="heating"?"Heizen":m(t.mode_entity)&&g(i.states[t.mode_entity])===null?"Betriebsart \u2013":Number(m(t.mode_entity)?g(i.states[t.mode_entity]):0)===(t.cooling_value??1)?"K\xFChlen":"Heizen",bt=(i,t,n)=>[$(i,"Vorlauf",t),$(i,"R\xFCcklauf",n)].filter(e=>e!==null),Lt=(i,t,n)=>{let e=C(i,t),r=C(i,n);return e===null||r===null?a:p`<div class="reading delta"><span>ΔT · VL − RL</span><b>${(e-r).toLocaleString(i.language,{maximumFractionDigits:1})} K</b></div>`};function Vt(i,t){let n=N(t),e=bt(i,n.flow,n.return);if(t.type==="buffer_tank"&&e.unshift(...[...n.sensors??[]].sort((r,s)=>s.level-r.level).flatMap(r=>{let s=$(i,r.name||"F\xFChler",r.entity);return s?[s]:[]})),t.type==="freshwater_station")for(let[r,s]of[["Zirkulation",n.circulation_temperature],["Trinkwarmwasser",n.hot_water]]){let o=$(i,r,s);o&&e.push(o)}for(let r of t.values??[]){let s=$(i,r.label||String(r.entity&&i.states[r.entity]?.attributes.friendly_name||"Wert"),r.entity);s&&e.push({...s,icon:r.icon})}return e}var T=(i,t)=>p`<div class="reading" data-source=${t.id}><span>${t.icon?.startsWith("mdi:")?p`<ha-icon icon=${t.icon}></ha-icon>`:t.icon||a} ${t.label}</span><b>${t.text}${G(i,[t.id],t.label)}</b></div>`;function q(i,t,n){let e=O(i,n);return e.id?p`<div class="reading" data-source=${e.id}><span>${t}<small>${e.feedback?"Ist":"Soll"}</small></span><b><i class="lamp" style=${`background:${e.running===null?"#888":e.running?"#6fe1a2":"#465361"}`}></i>${K(i.states[e.id])}${G(i,[e.id],t)}</b></div>`:a}var Bt=x`
|
||||
:host{display:block;color:var(--nf-text);font:12px/1.4 system-ui,sans-serif;min-width:170px;max-width:300px}
|
||||
button{font:inherit;color:inherit;background:var(--nf-fill,#ffffff10);border:1px solid var(--nf-line);border-radius:7px;padding:5px 8px;cursor:pointer}button:disabled,input:disabled{opacity:.45;cursor:default}button:focus-visible,input:focus-visible{outline:2px solid var(--nf-accent);outline-offset:2px}
|
||||
.title{display:block;width:100%;padding:0 0 5px;border:0;background:none;font-weight:600;text-align:left;white-space:normal}.content{max-height:250px;overflow:auto;overscroll-behavior:contain}.circuit{border-top:1px solid var(--nf-line);padding:5px 0}.circuit-name{font-size:11px;font-weight:600;margin-bottom:3px}.reading{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;align-items:center;min-height:22px}.reading>span{color:var(--nf-muted);white-space:normal}.reading b{display:flex;align-items:center;justify-content:flex-end;white-space:nowrap;font-variant-numeric:tabular-nums;font-weight:500}.reading small{font-size:9px;margin-left:5px;opacity:.75}.delta{font-size:10px}.lamp{display:inline-block;flex:none;width:6px;height:6px;border-radius:50%;margin-right:5px}.empty{color:var(--nf-muted);font-size:11px;white-space:normal;margin:5px 0}nf-trend-button{margin-left:3px}
|
||||
.circuit-name small,h3 small{font-size:10px;color:var(--nf-muted);font-weight:normal;margin-left:5px}
|
||||
ha-icon{--mdc-icon-size:13px;width:13px;height:13px;vertical-align:middle}
|
||||
dialog{box-sizing:border-box;width:min(620px,calc(100vw - 24px));max-width:none;max-height:calc(100dvh - 24px);padding:0;color:var(--nf-text);background:var(--nf-chrome-solid,#1c1c1c);border:1px solid var(--nf-line);border-radius:14px;box-shadow:0 20px 70px #0008;font:13px/1.4 system-ui,sans-serif}dialog::backdrop{background:#050b16a6;backdrop-filter:blur(3px)}header{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 18px;border-bottom:1px solid var(--nf-line)}h2{font-size:17px;margin:0}.body{padding:12px 18px;max-height:calc(100dvh - 120px);overflow:auto;overscroll-behavior:contain}h3{font-size:13px;margin:12px 0 7px}fieldset{min-width:0;margin:8px 0;padding:10px;border:1px solid var(--nf-line);border-radius:9px}legend{font-size:12px;color:var(--nf-muted)}.command{display:flex;align-items:center;gap:12px;margin-top:8px}.command input[type=range]{flex:1;min-width:0;accent-color:var(--nf-accent)}.command input[type=number]{width:90px;box-sizing:border-box;background:var(--nf-fill,#ffffff10);border:1px solid var(--nf-line);border-radius:6px;color:inherit;padding:5px}.command output{font-variant-numeric:tabular-nums;min-width:45px;text-align:right}.error{color:#ff9b9b}.readonly{color:var(--nf-muted);font-size:11px;margin:4px 0}.body .reading{padding:4px 0}.body .circuit{padding-bottom:12px}
|
||||
`,mt=class extends b{static properties={hass:{attribute:!1},item:{attribute:!1},readOnly:{type:Boolean}};render(){if(!this.hass||!this.item)return a;let t=N(this.item),n=Vt(this.hass,this.item);return p`<button class="title" @click=${()=>le(this.hass,this.item,this.readOnly)} aria-haspopup="dialog">${Dt(this.item)} ⚙</button><div class="content">
|
||||
${this.item.type==="heating_manifold"?(t.circuits??[]).map(e=>p`<section class="circuit"><div class="circuit-name">${Ft(e)} <small>${jt(this.hass,e)}</small></div>${B(e)?q(this.hass,"Pumpe",e.pump):a}${I(e)?q(this.hass,"Ventil",e.valve):a}${bt(this.hass,e.flow,e.return).map(r=>T(this.hass,r))}${$(this.hass,"Leistung",e.power)?T(this.hass,$(this.hass,"Leistung",e.power)):a}</section>`):a}
|
||||
${n.map(e=>T(this.hass,e))}${this.item.type==="freshwater_station"?p`${q(this.hass,"Ladepumpe",t.pump)}${q(this.hass,"Zirkulationspumpe",t.circulation)}`:a}
|
||||
${this.item.type!=="heating_manifold"&&!n.length?p`<p class="empty">Noch keine Fühler verknüpft</p>`:a}
|
||||
</div>`}static styles=[ht,Bt]},gt=class extends b{static properties={hass:{attribute:!1},item:{attribute:!1},readOnly:{type:Boolean},pending:{state:!0},error:{state:!0}};constructor(){super(),this.pending=new Set,this.error="",this.readOnly=!1}async show(){await this.updateComplete,this.shadowRoot.querySelector("dialog").showModal()}async send(t,n){let e=this.hass.states[t];if(!(this.readOnly||!e?.attributes.symcon_has_action||g(e)===null||this.pending.has(t))){this.pending=new Set([...this.pending,t]),this.error="";try{await this.hass.callService("symcon","set_value",{entity_id:t,value:n})}catch(r){this.error=r instanceof Error?r.message:String(r)}finally{this.pending=new Set([...this.pending].filter(r=>r!==t))}}}control(t,n){if(!m(n?.command)&&!m(n?.feedback))return a;let e=m(n?.command)?n.command:null,r=e?this.hass.states[e]:void 0,s=r?.attributes,o=g(r),c=!!e&&!!s?.symcon_has_action&&o!==null&&!this.readOnly&&!this.pending.has(e),l=Number(s?.symcon_min??0),u=Number(s?.symcon_max??100),h=Number(s?.symcon_step||(s?.symcon_variable_type===1?1:.1)),d=M(r),f=v=>{let _=v.target;e&&_.value.trim()&&_.checkValidity()&&Number.isFinite(_.valueAsNumber)&&this.send(e,_.valueAsNumber)};return p`<fieldset data-control=${t}><legend>${t}</legend>${q(this.hass,t,n)}
|
||||
${e?p`<div class="reading"><span>Befehl / Sollwert</span><b>${K(r)}${G(this.hass,[e],`${t} \xB7 Sollwert`)}</b></div>
|
||||
${s?.symcon_variable_type===0?p`<div class="command"><button data-command=${e} ?disabled=${!c} @click=${()=>{this.send(e,!W(r))}}>${W(r)?"Ausschalten / Schlie\xDFen":"Einschalten / \xD6ffnen"}</button></div>`:[1,2].includes(Number(s?.symcon_variable_type))?p`<div class="command"><input type="range" aria-label=${`${t} Sollwert`} data-command=${e} min=${l} max=${u} step=${h} .value=${String(d??l)} ?disabled=${!c} @change=${f}/><input type="number" aria-label=${`${t} nativer Sollwert`} min=${l} max=${u} step=${h} .value=${d===null?"":String(d)} ?disabled=${!c} @change=${f}/></div>`:a}
|
||||
${this.readOnly?p`<p class="readonly">Historische Ansicht · nur Anzeige</p>`:s?.symcon_has_action?a:p`<p class="readonly">Nur Anzeige · keine Symcon-Schaltaktion hinterlegt</p>`}`:a}
|
||||
</fieldset>`}render(){if(!this.hass||!this.item)return a;let t=N(this.item),n=Vt(this.hass,this.item);return p`<dialog @close=${()=>{this.remove(),y===this&&(y=null)}} @keydown=${e=>e.stopPropagation()}><header><h2>${Dt(this.item)}</h2><button aria-label="Schließen" @click=${()=>this.shadowRoot.querySelector("dialog").close()}>×</button></header><div class="body">
|
||||
${this.item.type==="heating_manifold"?(t.circuits??[]).map(e=>p`<section class="circuit" data-circuit=${e.id}><h3>${Ft(e)} <small>${jt(this.hass,e)}</small></h3>${B(e)?this.control("Pumpe",e.pump):a}${I(e)?this.control("Ventil",e.valve):a}${bt(this.hass,e.flow,e.return).map(r=>T(this.hass,r))}${Lt(this.hass,e.flow,e.return)}${$(this.hass,"Pumpenleistung",e.power)?T(this.hass,$(this.hass,"Pumpenleistung",e.power)):a}</section>`):a}
|
||||
${n.map(e=>T(this.hass,e))}${this.item.type!=="heating_manifold"?Lt(this.hass,t.flow,t.return):a}
|
||||
${this.item.type==="freshwater_station"?p`${this.control("Ladepumpe",t.pump)}${this.control("Zirkulationspumpe",t.circulation)}`:a}
|
||||
${!n.length&&this.item.type!=="heating_manifold"?p`<p class="empty">Die Fühler lassen sich im Editor über den Objektbaum zuweisen.</p>`:a}
|
||||
${this.error?p`<p class="error" role="alert">${this.error}</p>`:a}
|
||||
</div></dialog>`}static styles=[ht,Bt,x`:host{max-width:none;min-width:0}`]},y=null;function Ke(){y?.remove(),y=null}async function le(i,t,n=!1){y?.remove();let e=document.createElement("nf-hydronic-dialog");y=e,Object.assign(e,{hass:i,item:t,readOnly:n}),document.body.append(e),await e.show()}function qe(i,t,n=!1){if(!y)return;let e=t.floors.flatMap(r=>r.furniture).find(r=>r.id===y.item.id);if(!e||!Ut(e.type)){y.remove(),y=null;return}Object.assign(y,{hass:i,item:e,readOnly:n})}customElements.get("nf-hydronic-card")||customElements.define("nf-hydronic-card",mt);customElements.get("nf-hydronic-dialog")||customElements.define("nf-hydronic-dialog",gt);export{Ke as closeHydronic,oe as hydronicVisual,le as openHydronic,qe as refreshHydronic};
|
||||
/*! Bundled license information:
|
||||
|
||||
@lit/reactive-element/css-tag.js:
|
||||
(**
|
||||
* @license
|
||||
* Copyright 2019 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*)
|
||||
|
||||
@lit/reactive-element/reactive-element.js:
|
||||
lit-html/lit-html.js:
|
||||
lit-element/lit-element.js:
|
||||
(**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*)
|
||||
|
||||
lit-html/is-server.js:
|
||||
(**
|
||||
* @license
|
||||
* Copyright 2022 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*)
|
||||
*/
|
||||
@@ -1,13 +1,13 @@
|
||||
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
|
||||
var x={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",fr:"6312d0f61ebf",hu:"27ba348531dc",it:"1b705e76dd00",nb:"c5ea24fb9ef6",nl:"b64142c67c2e",pl:"8527a4930402",pt:"31857a2d2277",ro:"e3cb5f449f0f",sk:"320611594db0",sl:"8071691ceda3",sv:"711b911ec8da",tr:"7c83ce1c3372",zh:"50518d9f494e"};Array.prototype.at||Object.defineProperty(Array.prototype,"at",{configurable:!0,writable:!0,value:function(e){let t=Math.trunc(e)||0;return this[t<0?this.length+t:t]}});typeof globalThis.structuredClone!="function"&&(globalThis.structuredClone=r=>r===void 0?r:JSON.parse(JSON.stringify(r)));var On=globalThis,Bn=On.ShadowRoot&&(On.ShadyCSS===void 0||On.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,si=Symbol(),Qo=new WeakMap,Qt=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==si)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(Bn&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=Qo.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Qo.set(t,e))}return e}toString(){return this.cssText}},Xo=r=>new Qt(typeof r=="string"?r:r+"",void 0,si),J=(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 Qt(t,r,si)},es=(r,e)=>{if(Bn)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),i=On.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},ai=Bn?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return Xo(t)})(r):r;var{is:jc,defineProperty:qc,getOwnPropertyDescriptor:Zc,getOwnPropertyNames:Yc,getOwnPropertySymbols:Jc,getPrototypeOf:Qc}=Object,Vn=globalThis,ts=Vn.trustedTypes,Xc=ts?ts.emptyScript:"",ed=Vn.reactiveElementPolyfillSupport,Xt=(r,e)=>r,li={toAttribute(r,e){switch(e){case Boolean:r=r?Xc:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},rs=(r,e)=>!jc(r,e),ns={attribute:!0,type:String,converter:li,reflect:!1,useDefault:!1,hasChanged:rs};Symbol.metadata??=Symbol("metadata"),Vn.litPropertyMetadata??=new WeakMap;var Pe=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=ns){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),i=this.getPropertyDescriptor(e,n,t);i!==void 0&&qc(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){let{get:i,set:o}=Zc(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:i,set(s){let a=i?.call(this);o?.call(this,s),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??ns}static _$Ei(){if(this.hasOwnProperty(Xt("elementProperties")))return;let e=Qc(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Xt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Xt("properties"))){let t=this.properties,n=[...Yc(t),...Jc(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(ai(i))}else e!==void 0&&t.push(ai(e));return t}static _$Eu(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadLine truncated
|
||||
\f\r]`,en=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ss=/-->/g,as=/>/g,at=RegExp(`>|${ui}(?:([^\\s"'>=/]+)(${ui}*=${ui}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),ls=/'/g,us=/"/g,ms=/^(?:script|style|textarea|title)$/i,_i=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),p=_i(1),ne=_i(2),Wf=_i(3),ct=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),cs=new WeakMap,lt=ut.createTreeWalker(ut,129);function ps(r,e){if(!gi(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return os!==void 0?os.createHTML(e):e}var rd=(r,e)=>{let t=r.length-1,n=[],i,o=e===2?"<svg>":e===3?"<math>":"",s=en;for(let a=0;a<t;a++){let l=r[a],u,c,d=-1,m=0;for(;m<l.length&&(s.lastIndex=m,c=s.exec(l),c!==null);)m=s.lastIndex,s===en?c[1]==="!--"?s=ss:c[1]!==void 0?s=as:c[2]!==void 0?(ms.test(c[2])&&(i=RegExp("</"+c[2],"g")),s=at):c[3]!==void 0&&(s=at):s===at?c[0]===">"?(s=i??en,d=-1):c[1]===void 0?d=-2:(d=s.lastIndex-c[2].length,u=c[1],s=c[3]===void 0?at:c[3]==='"'?us:ls):s===us||s===ls?s=at:s===ss||s===as?s=en:(s=at,i=void 0);let h=s===at&&r[a+1].startsWith("/>")?" ":"";o+=s===en?l+td:d>=0?(n.push(u),l.slice(0,d)+ds+l.slice(d)+Je+h):l+Je+(d===-2?a:h)}return[ps(r,o+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},rn=class r{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let o=0,s=0,a=e.length-1,l=this.parts,[u,c]=rd(e,t);if(this.el=r.createElement(u,n),lt.currentNode=this.el.content,t===2||t===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(i=lt.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let d of i.getAttributeNames())if(d.endsWith(ds)){let m=c[s++],h=i.getAttribute(d).split(Je),g=/([.?@])?(.*)/.exec(m);l.push({type:1,index:o,name:g[2],strings:h,ctor:g[1]==="."?di:g[1]==="?"?hi:g[1]==="@"?mi:St}),i.removeAttribute(d)}else d.startsWith(Je)&&(l.push({type:6,index:o}),i.removeAttribute(d));if(ms.test(i.tagName)){let d=i.textContent.split(Je),m=d.length-1;if(m>0){i.textContent=Kn?Kn.emptyScript:"";for(let h=0;h<m;h++)i.append(d[h],tn()),lt.nextNode(),l.push({type:2,index:++o});i.append(d[m],tn())}}}else if(i.nodeType===8)if(i.data===hs)l.push({type:2,index:o});else{let d=-1;for(;(d=i.data.indexOf(Je,d+1))!==-1;)l.push({type:7,index:o}),d+=Je.length-1}o++}}static createElement(e,t){let n=ut.createElement("template");return n.innerHTML=e,n}};function kt(r,e,t=r,n){if(e===ct)return e;let i=n!==void 0?t._$Co?.[n]:t._$Cl,o=nn(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=kt(r,i._$AS(r,e.values),i,n)),e}var ci=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,i=(e?.creationScope??ut).importNode(t,!0);lt.currentNode=i;let o=lt.nextNode(),s=0,a=0,l=n[0];for(;l!==void 0;){if(s===l.index){let u;l.type===2?u=new on(o,o.nextSibling,this,e):l.type===1?u=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(u=new pi(o,this,e)),this._$AV.push(u),l=n[++a]}s!==l?.index&&(o=lt.nextNode(),s++)}return lt.currentNode=ut,i}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},on=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=kt(this,e,t),nn(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==ct&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):nd(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&&nn(this._$AH)?this._$AA.nextSibling.data=e:this.T(ut.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,i=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=rn.createElement(ps(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{let o=new ci(i,this),s=o.u(this.options);o.p(t),this.T(s),this._$AH=o}}_$AC(e){let t=cs.get(e.strings);return t===void 0&&cs.set(e.strings,t=new rn(e)),t}k(e){gi(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(tn()),this.O(tn()),this,this.options)):n=t[i],n._$AI(o),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=is(e).nextSibling;is(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},St=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,o){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=o,n.length>2||n[0]!==""||n[1]!==""?(this.Line truncated
|
||||
var x={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",fr:"6312d0f61ebf",hu:"27ba348531dc",it:"1b705e76dd00",nb:"c5ea24fb9ef6",nl:"b64142c67c2e",pl:"8527a4930402",pt:"31857a2d2277",ro:"e3cb5f449f0f",sk:"320611594db0",sl:"8071691ceda3",sv:"711b911ec8da",tr:"7c83ce1c3372",zh:"50518d9f494e"};Array.prototype.at||Object.defineProperty(Array.prototype,"at",{configurable:!0,writable:!0,value:function(e){let t=Math.trunc(e)||0;return this[t<0?this.length+t:t]}});typeof globalThis.structuredClone!="function"&&(globalThis.structuredClone=r=>r===void 0?r:JSON.parse(JSON.stringify(r)));var Bn=globalThis,Vn=Bn.ShadowRoot&&(Bn.ShadyCSS===void 0||Bn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,li=Symbol(),ts=new WeakMap,Xt=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==li)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(Vn&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=ts.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&ts.set(t,e))}return e}toString(){return this.cssText}},ns=r=>new Xt(typeof r=="string"?r:r+"",void 0,li),J=(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 Xt(t,r,li)},rs=(r,e)=>{if(Vn)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),i=Bn.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},ui=Vn?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return ns(t)})(r):r;var{is:Qc,defineProperty:Xc,getOwnPropertyDescriptor:ed,getOwnPropertyNames:td,getOwnPropertySymbols:nd,getPrototypeOf:rd}=Object,Kn=globalThis,is=Kn.trustedTypes,id=is?is.emptyScript:"",od=Kn.reactiveElementPolyfillSupport,en=(r,e)=>r,ci={toAttribute(r,e){switch(e){case Boolean:r=r?id: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}},ss=(r,e)=>!Qc(r,e),os={attribute:!0,type:String,converter:ci,reflect:!1,useDefault:!1,hasChanged:ss};Symbol.metadata??=Symbol("metadata"),Kn.litPropertyMetadata??=new WeakMap;var Pe=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=os){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&&Xc(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){let{get:i,set:o}=ed(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)??os}static _$Ei(){if(this.hasOwnProperty(en("elementProperties")))return;let e=rd(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(en("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(en("properties"))){let t=this.properties,n=[...td(t),...nd(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(ui(i))}else e!==void 0&&t.push(ui(e));return t}static _$Eu(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadLine truncated
|
||||
\f\r]`,tn=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,us=/-->/g,cs=/>/g,at=RegExp(`>|${di}(?:([^\\s"'>=/]+)(${di}*=${di}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),ds=/'/g,hs=/"/g,gs=/^(?:script|style|textarea|title)$/i,vi=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),p=vi(1),ne=vi(2),Jf=vi(3),ct=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),ms=new WeakMap,lt=ut.createTreeWalker(ut,129);function _s(r,e){if(!bi(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return ls!==void 0?ls.createHTML(e):e}var ld=(r,e)=>{let t=r.length-1,n=[],i,o=e===2?"<svg>":e===3?"<math>":"",s=tn;for(let a=0;a<t;a++){let l=r[a],u,c,m=-1,d=0;for(;d<l.length&&(s.lastIndex=d,c=s.exec(l),c!==null);)d=s.lastIndex,s===tn?c[1]==="!--"?s=us:c[1]!==void 0?s=cs:c[2]!==void 0?(gs.test(c[2])&&(i=RegExp("</"+c[2],"g")),s=at):c[3]!==void 0&&(s=at):s===at?c[0]===">"?(s=i??tn,m=-1):c[1]===void 0?m=-2:(m=s.lastIndex-c[2].length,u=c[1],s=c[3]===void 0?at:c[3]==='"'?hs:ds):s===hs||s===ds?s=at:s===us||s===cs?s=tn:(s=at,i=void 0);let h=s===at&&r[a+1].startsWith("/>")?" ":"";o+=s===tn?l+sd:m>=0?(n.push(u),l.slice(0,m)+ps+l.slice(m)+Je+h):l+Je+(m===-2?a:h)}return[_s(r,o+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},on=class r{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let o=0,s=0,a=e.length-1,l=this.parts,[u,c]=ld(e,t);if(this.el=r.createElement(u,n),lt.currentNode=this.el.content,t===2||t===3){let m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(i=lt.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let m of i.getAttributeNames())if(m.endsWith(ps)){let d=c[s++],h=i.getAttribute(m).split(Je),g=/([.?@])?(.*)/.exec(d);l.push({type:1,index:o,name:g[2],strings:h,ctor:g[1]==="."?mi:g[1]==="?"?pi:g[1]==="@"?fi:$t}),i.removeAttribute(m)}else m.startsWith(Je)&&(l.push({type:6,index:o}),i.removeAttribute(m));if(gs.test(i.tagName)){let m=i.textContent.split(Je),d=m.length-1;if(d>0){i.textContent=Gn?Gn.emptyScript:"";for(let h=0;h<d;h++)i.append(m[h],nn()),lt.nextNode(),l.push({type:2,index:++o});i.append(m[d],nn())}}}else if(i.nodeType===8)if(i.data===fs)l.push({type:2,index:o});else{let m=-1;for(;(m=i.data.indexOf(Je,m+1))!==-1;)l.push({type:7,index:o}),m+=Je.length-1}o++}}static createElement(e,t){let n=ut.createElement("template");return n.innerHTML=e,n}};function St(r,e,t=r,n){if(e===ct)return e;let i=n!==void 0?t._$Co?.[n]:t._$Cl,o=rn(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(r),i._$AT(r,t,n)),n!==void 0?(t._$Co??=[])[n]=i:t._$Cl=i),i!==void 0&&(e=St(r,i._$AS(r,e.values),i,n)),e}var hi=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,i=(e?.creationScope??ut).importNode(t,!0);lt.currentNode=i;let o=lt.nextNode(),s=0,a=0,l=n[0];for(;l!==void 0;){if(s===l.index){let u;l.type===2?u=new sn(o,o.nextSibling,this,e):l.type===1?u=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(u=new gi(o,this,e)),this._$AV.push(u),l=n[++a]}s!==l?.index&&(o=lt.nextNode(),s++)}return lt.currentNode=ut,i}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},sn=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=St(this,e,t),rn(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==ct&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):ad(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&&rn(this._$AH)?this._$AA.nextSibling.data=e:this.T(ut.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,i=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=on.createElement(_s(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{let o=new hi(i,this),s=o.u(this.options);o.p(t),this.T(s),this._$AH=o}}_$AC(e){let t=ms.get(e.strings);return t===void 0&&ms.set(e.strings,t=new on(e)),t}k(e){bi(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(nn()),this.O(nn()),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=as(e).nextSibling;as(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},$t=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,o){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=o,n.length>2||n[0]!==""||n[1]!==""?(this.Line truncated
|
||||
|
||||
Ein Plugin l\xE4uft mit denselben Rechten wie NextFloor in deinem Browser. Die Datei wurde gepr\xFCft, ihr Inhalt ist festgelegt:
|
||||
{url}`,manual:"Anleitung",manual_more:"Mehr erfahren",feature_text_energy:"Energieteilchen fliegen in B\xF6gen von den Solarfeldern zum Wechselrichter, zwischen Haus, Akku, Netz und Verbrauchern \u2013 schneller und dichter, je mehr Strom flie\xDFt. Die Module funkeln mit ihrer Produktion, eine Glaskarte \xFCber dem Dach zeigt die Bilanz und wie autark das Haus gerade ist.",live_autarky:"autark",live_fold:"Karte verkleinern",live_unfold:"Karte aufklappen",live_day_hint:"Die letzten 24 Stunden: Solar (Fl\xE4che) und Verbrauch (Linie)",live_week_hint:"Die letzten 7 Tage: Sonne {solar} kWh, Verbrauch {use} kWh (gelb: Sonne, hell: Verbrauch)",live_days:"Tage",live_car_away:"Unterwegs",live_car_charging:"L\xE4dt",live_car_plugged:"Eingesteckt",live_car_lock:"Verriegeln",live_car_unlock:"Entriegeln",live_car_unlock_confirm:"{name} wirklich entriegeln?",live_car_climate:"Klimatisierung",live_car_charge:"Laden starten/stoppen",live_media_prev:"Zur\xFCck",live_media_playpause:"Abspielen/Pause",live_media_next:"Weiter",live_media_volume:"Lautst\xE4rke",live_car_device:"Auto (eine Entit\xE4t des Autos)",live_car_device_hint:"Ladestand, Reichweite, Laden, Stecker, Schloss und Klima findet NextFloor selbst am Ger\xE4t des Autos. Ohne Angabe nimmt es den Anwesenheitssensor des Stellplatzes.",live_car_departure_entity:"Abfahrtszeit (optional)",live_car_departure:"Abfahrt {time}",live_car_open:"Offen: {parts}",printer_printing:"druckt",printer_done:"fertig",printer_paused:"pausiert",printer_error:"Fehler",printer_idle:"bereit",printer_done_at:"fertig um {time}",printer_layer:"Schicht",printer_nozzle:"D\xFCse",printer_bed:"Bett",heatpump_heating:"heizt",heatpump_water:"macht Warmwasser",heatpump_cooling:"k\xFChlt",heatpump_defrost:"taut ab",heatpump_idle:"in Ruhe",heatpump_flow_return:"Vor- \u2192 R\xFCcklauf",heatpump_heat:"W\xE4rme",heatpump_power:"Strom",heatpump_outside:"au\xDFen",pack_missing_item:"M\xF6bel aus entferntem Pack",back_to_room:"Zur\xFCck zu {room}",back_to_floor:"Zur\xFCck zur Etage",hint_furniture:"Raum antippen, dann rechts ein M\xF6belst\xFCck w\xE4hlen \xB7 M\xF6bel ziehen, an den Ecken die Gr\xF6\xDFe \xE4ndern",furniture_into:"Neue M\xF6bel kommen in die Mitte von \u201E{room}\u201C.",furniture_pick_room:"Tipp: Erst einen Raum antippen \u2013 dann landen neue M\xF6bel in seiner Mitte.",flows:"Stromfluss",flows_hint:"Energieb\xF6gen zwischen Solarfeldern, Wechselrichter, Akku, Netz und Verbrauchern ein- oder ausblenden",chk_title:"Einrichtung",chk_hint:"Was der Energiefluss braucht. Antippen springt an die Stelle.",chk_solar:"Solarfeld angelegt",chk_solar_add:"Ein Solarfeld aufs Dach legen",chk_meter:"Stromz\xE4hler mit Netzsensor",chk_meter_sensor:"Stromz\xE4hler: Netzsensor (W) fehlt",chk_meter_add:"Stromz\xE4hler anlegen",chk_inverter:"Wechselrichter mit Leistungssensor",chk_inverter_sensor:"Wechselrichter: Leistungssensor fehlt",chk_inverter_add:"Wechselrichter anlegen",chk_battery:"Stromspeicher mit Leistung und Ladestand",chk_battery_sensor:"Stromspeicher: Leistung oder Ladestand fehlt",chk_battery_opt:"Stromspeicher (optional)",chk_grid:"Netzanschluss gesetzt",chk_grid_opt:"Netzanschluss (optional, sonst automatisch)",energy_sign_grid:"Das Haus zeigt Einspeisung, obwohl die Sonne nichts liefert. Der Netzsensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_battery:"Der Speicher l\xE4dt ohne Sonne und ohne Netzbezug. Sein Sensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_flip:"Vorzeichen umkehren",help_title:"Hilfe und R\xFCckmeldung",help_hint:"Fehler bitte als Issue auf GitHub, W\xFCnsche als Diskussion \u2013 so geht nichts verloren, und alle sehen den Stand.",help_issue:"Problem melden",help_idea:"Idee vorschlagen",furn_name:"Name (optional)",furn_mirror:"Spiegeln",furn_mirror_hint:"Links und rechts vertauschen \u2013 das L-Sofa andersherum, der Schrank mit der T\xFCr auf der anderen Seite, die K\xFCchenzeile gespiegelt.",hint_opening:"Auf eine Wand tippen, um eine T\xFCr oder ein Fenster einzusetzen \u2013 die Art w\xE4hlst du danach rechts",preset_door:"T\xFCr",preset_door_double:"Doppelt\xFCr",preset_window:"Fenster",preset_window_double:"Fenster 2-fl\xFCgelig",preset_terrace:"Terrassent\xFCr",preset_terrace_double:"Terrassent\xFCr 2-fl\xFCgelig",preset_lift_slide:"Hebe-Schiebet\xFCr",preset_garage:"Garagentor",preset_front:"Haust\xFCr",opening_style:"Stil",sidelight_auto:"automatisch",sidelight_hinge:"Seitenteil an der Anschlagseite",sidelight_hinge_hint:"Das Seitenteil sitzt sonst gegen\xFCber dem Anschlag; mit Haken neben den B\xE4ndern.",sidelight_width:"Breite Seitenteil (m)",sidelight_width_left:"Seitenteil links (m)",sidelight_width_right:"Seitenteil rechts (m)",style_auto:"Automatisch ({style})",style_interior:"Zimmert\xFCr",style_front:"Haust\xFCr",style_front_glass:"Haust\xFCr mit Glasausschnitt",style_sidelight:"Haust\xFCr mit Seitenteil",style_sidelights:"Haust\xFCr mit 2 Seitenteilen",style_glass:"Glast\xFCr",style_sliding:"Schiebet\xFCr",style_p
Line truncated
|
||||
{url}`,manual:"Anleitung",manual_more:"Mehr erfahren",feature_text_energy:"Energieteilchen fliegen in B\xF6gen von den Solarfeldern zum Wechselrichter, zwischen Haus, Akku, Netz und Verbrauchern \u2013 schneller und dichter, je mehr Strom flie\xDFt. Die Module funkeln mit ihrer Produktion, eine Glaskarte \xFCber dem Dach zeigt die Bilanz und wie autark das Haus gerade ist.",live_autarky:"autark",live_fold:"Karte verkleinern",live_unfold:"Karte aufklappen",live_day_hint:"Die letzten 24 Stunden: Solar (Fl\xE4che) und Verbrauch (Linie)",live_week_hint:"Die letzten 7 Tage: Sonne {solar} kWh, Verbrauch {use} kWh (gelb: Sonne, hell: Verbrauch)",live_days:"Tage",live_car_away:"Unterwegs",live_car_charging:"L\xE4dt",live_car_plugged:"Eingesteckt",live_car_lock:"Verriegeln",live_car_unlock:"Entriegeln",live_car_unlock_confirm:"{name} wirklich entriegeln?",live_car_climate:"Klimatisierung",live_car_charge:"Laden starten/stoppen",live_media_prev:"Zur\xFCck",live_media_playpause:"Abspielen/Pause",live_media_next:"Weiter",live_media_volume:"Lautst\xE4rke",live_car_device:"Auto (eine Entit\xE4t des Autos)",live_car_device_hint:"Ladestand, Reichweite, Laden, Stecker, Schloss und Klima findet NextFloor selbst am Ger\xE4t des Autos. Ohne Angabe nimmt es den Anwesenheitssensor des Stellplatzes.",live_car_departure_entity:"Abfahrtszeit (optional)",live_car_departure:"Abfahrt {time}",live_car_open:"Offen: {parts}",printer_printing:"druckt",printer_done:"fertig",printer_paused:"pausiert",printer_error:"Fehler",printer_idle:"bereit",printer_done_at:"fertig um {time}",printer_layer:"Schicht",printer_nozzle:"D\xFCse",printer_bed:"Bett",heatpump_heating:"heizt",heatpump_water:"macht Warmwasser",heatpump_cooling:"k\xFChlt",heatpump_defrost:"taut ab",heatpump_idle:"in Ruhe",heatpump_flow_return:"Vor- \u2192 R\xFCcklauf",heatpump_heat:"W\xE4rme",heatpump_power:"Strom",heatpump_outside:"au\xDFen",pack_missing_item:"M\xF6bel aus entferntem Pack",back_to_room:"Zur\xFCck zu {room}",back_to_floor:"Zur\xFCck zur Etage",hint_furniture:"Raum antippen, dann rechts ein M\xF6belst\xFCck w\xE4hlen \xB7 M\xF6bel ziehen, an den Ecken die Gr\xF6\xDFe \xE4ndern",furniture_into:"Neue M\xF6bel kommen in die Mitte von \u201E{room}\u201C.",furniture_pick_room:"Tipp: Erst einen Raum antippen \u2013 dann landen neue M\xF6bel in seiner Mitte.",flows:"Stromfluss",flows_hint:"Energieb\xF6gen zwischen Solarfeldern, Wechselrichter, Akku, Netz und Verbrauchern ein- oder ausblenden",chk_title:"Einrichtung",chk_hint:"Was der Energiefluss braucht. Antippen springt an die Stelle.",chk_solar:"Solarfeld angelegt",chk_solar_add:"Ein Solarfeld aufs Dach legen",chk_meter:"Stromz\xE4hler mit Netzsensor",chk_meter_sensor:"Stromz\xE4hler: Netzsensor (W) fehlt",chk_meter_add:"Stromz\xE4hler anlegen",chk_inverter:"Wechselrichter mit Leistungssensor",chk_inverter_sensor:"Wechselrichter: Leistungssensor fehlt",chk_inverter_add:"Wechselrichter anlegen",chk_battery:"Stromspeicher mit Leistung und Ladestand",chk_battery_sensor:"Stromspeicher: Leistung oder Ladestand fehlt",chk_battery_opt:"Stromspeicher (optional)",chk_grid:"Netzanschluss gesetzt",chk_grid_opt:"Netzanschluss (optional, sonst automatisch)",energy_sign_grid:"Das Haus zeigt Einspeisung, obwohl die Sonne nichts liefert. Der Netzsensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_battery:"Der Speicher l\xE4dt ohne Sonne und ohne Netzbezug. Sein Sensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_flip:"Vorzeichen umkehren",help_title:"Hilfe und R\xFCckmeldung",help_hint:"Fehler bitte als Issue auf GitHub, W\xFCnsche als Diskussion \u2013 so geht nichts verloren, und alle sehen den Stand.",help_issue:"Problem melden",help_idea:"Idee vorschlagen",furn_name:"Name (optional)",furn_mirror:"Spiegeln",furn_mirror_hint:"Links und rechts vertauschen \u2013 das L-Sofa andersherum, der Schrank mit der T\xFCr auf der anderen Seite, die K\xFCchenzeile gespiegelt.",hint_opening:"Auf eine Wand tippen, um eine T\xFCr oder ein Fenster einzusetzen \u2013 die Art w\xE4hlst du danach rechts",preset_door:"T\xFCr",preset_door_double:"Doppelt\xFCr",preset_window:"Fenster",preset_window_double:"Fenster 2-fl\xFCgelig",preset_terrace:"Terrassent\xFCr",preset_terrace_double:"Terrassent\xFCr 2-fl\xFCgelig",preset_lift_slide:"Hebe-Schiebet\xFCr",preset_garage:"Garagentor",preset_front:"Haust\xFCr",opening_style:"Stil",sidelight_auto:"automatisch",sidelight_hinge:"Seitenteil an der Anschlagseite",sidelight_hinge_hint:"Das Seitenteil sitzt sonst gegen\xFCber dem Anschlag; mit Haken neben den B\xE4ndern.",sidelight_width:"Breite Seitenteil (m)",sidelight_width_left:"Seitenteil links (m)",sidelight_width_right:"Seitenteil rechts (m)",style_auto:"Automatisch ({style})",style_interior:"Zimmert\xFCr",style_front:"Haust\xFCr",style_front_glass:"Haust\xFCr mit Glasausschnitt",style_sidelight:"Haust\xFCr mit Seitenteil",style_sidelights:"Haust\xFCr mit 2 Seitenteilen",style_glass:"Glast\xFCr",style_sliding:"Schiebet\xFCr",style_p
Line truncated
|
||||
|
||||
A plugin runs with the same rights as NextFloor in your browser. The file has been reviewed and its content is fixed:
|
||||
{url}`,manual:"Manual",manual_more:"Learn more",feature_text_energy:"Energy particles fly in arcs from the solar fields to the inverter, between house, battery, grid and consumers \u2013 faster and denser the more power flows. The modules sparkle with their production, a glass card over the roof shows the balance and how self-sufficient the house is right now.",live_autarky:"self-sufficient",live_fold:"Make the card small",live_unfold:"Open the card",live_day_hint:"The last 24 hours: solar (area) and consumption (line)",live_week_hint:"The last 7 days: sun {solar} kWh, use {use} kWh (yellow: sun, light: use)",live_days:"days",live_car_away:"On the road",live_car_charging:"Charging",live_car_plugged:"Plugged in",live_car_lock:"Lock",live_car_unlock:"Unlock",live_car_unlock_confirm:"Really unlock {name}?",live_car_climate:"Climate",live_car_charge:"Start/stop charging",live_media_prev:"Previous",live_media_playpause:"Play/pause",live_media_next:"Next",live_media_volume:"Volume",live_car_device:"Car (any entity of the car)",live_car_device_hint:"Charge, range, charging, plug, lock and climate are found by NextFloor on the car's device. Without one it takes the spot's presence sensor.",live_car_departure_entity:"Departure time (optional)",live_car_departure:"Departs {time}",live_car_open:"Open: {parts}",printer_printing:"printing",printer_done:"done",printer_paused:"paused",printer_error:"error",printer_idle:"idle",printer_done_at:"done at {time}",printer_layer:"Layer",printer_nozzle:"Nozzle",printer_bed:"Bed",heatpump_heating:"heating",heatpump_water:"making hot water",heatpump_cooling:"cooling",heatpump_defrost:"defrosting",heatpump_idle:"resting",heatpump_flow_return:"Flow \u2192 return",heatpump_heat:"Heat",heatpump_power:"Power",heatpump_outside:"outside",pack_missing_item:"Furniture of a removed pack",back_to_room:"Back to {room}",back_to_floor:"Back to the floor",hint_furniture:"Tap a room, then pick an item on the right \xB7 drag items, resize them by their corners",furniture_into:"New items go into the middle of \u201C{room}\u201D.",furniture_pick_room:"Tip: tap a room first \u2013 new items then land in its middle.",flows:"Power flow",flows_hint:"Show or hide the energy arcs between solar fields, inverter, battery, grid and consumers",chk_title:"Setup",chk_hint:"What the energy flow needs. Tap a row to jump there.",chk_solar:"Solar field in place",chk_solar_add:"Put a solar field on the roof",chk_meter:"Meter with grid sensor",chk_meter_sensor:"Meter: grid sensor (W) missing",chk_meter_add:"Add the meter",chk_inverter:"Inverter with power sensor",chk_inverter_sensor:"Inverter: power sensor missing",chk_inverter_add:"Add an inverter",chk_battery:"Home battery with power and charge",chk_battery_sensor:"Home battery: power or charge missing",chk_battery_opt:"Home battery (optional)",chk_grid:"Grid connection set",chk_grid_opt:"Grid connection (optional, else automatic)",energy_sign_grid:"The house shows export while the sun produces nothing. The grid sensor probably has its sign reversed.",energy_sign_battery:"The battery charges with no sun and no grid draw. Its sensor probably has its sign reversed.",energy_sign_flip:"Flip the sign",help_title:"Help and feedback",help_hint:"Please report problems as a GitHub issue and wishes as a discussion \u2013 nothing gets lost, and everyone sees the state.",help_issue:"Report a problem",help_idea:"Propose an idea",furn_name:"Name (optional)",furn_mirror:"Mirror",furn_mirror_hint:"Swap left and right \u2013 the L-sofa the other way round, the cabinet with its door on the other side, the kitchen run mirrored.",hint_opening:"Tap a wall to add a door or window \u2013 choose its kind on the right afterwards",preset_door:"Door",preset_door_double:"Double door",preset_window:"Window",preset_window_double:"Double window",preset_terrace:"Terrace door",preset_terrace_double:"French doors",preset_lift_slide:"Lift-and-slide door",preset_garage:"Garage door",preset_front:"Front door",opening_style:"Style",sidelight_auto:"automatic",sidelight_hinge:"Sidelight on the hinge side",sidelight_hinge_hint:"The sidelight sits opposite the hinge otherwise; ticked, it sits next to the hinges.",sidelight_width:"Sidelight width (m)",sidelight_width_left:"Left sidelight (m)",sidelight_width_right:"Right sidelight (m)",style_auto:"Automatic ({style})",style_interior:"Room door",style_front:"Front door",style_front_glass:"Front door with glass",style_sidelight:"Front door with sidelight",style_sidelights:"Front door with two sidelights",style_glass:"Glass door",style_sliding:"Sliding door",style_passage:"Opening (no door)",style_standard:"Standard",style_bars:"With glazing bars",style_glass_wall:"Glass wall (fixed)",preset_glass_wall:"Glass wall",glass_panes:"Panes",glass_panes_auto:"automatic (about 0.9 m)",glass_panes_hint:"0 = one single pane without mullions, empty = about every 0.9 m",flip_hinge:"Swap hinge side",flip_main_leaf:"Swap main leaf",flip_hinge_hint:"Hinges to the other side"
Line truncated
|
||||
{url}`,manual:"Manual",manual_more:"Learn more",feature_text_energy:"Energy particles fly in arcs from the solar fields to the inverter, between house, battery, grid and consumers \u2013 faster and denser the more power flows. The modules sparkle with their production, a glass card over the roof shows the balance and how self-sufficient the house is right now.",live_autarky:"self-sufficient",live_fold:"Make the card small",live_unfold:"Open the card",live_day_hint:"The last 24 hours: solar (area) and consumption (line)",live_week_hint:"The last 7 days: sun {solar} kWh, use {use} kWh (yellow: sun, light: use)",live_days:"days",live_car_away:"On the road",live_car_charging:"Charging",live_car_plugged:"Plugged in",live_car_lock:"Lock",live_car_unlock:"Unlock",live_car_unlock_confirm:"Really unlock {name}?",live_car_climate:"Climate",live_car_charge:"Start/stop charging",live_media_prev:"Previous",live_media_playpause:"Play/pause",live_media_next:"Next",live_media_volume:"Volume",live_car_device:"Car (any entity of the car)",live_car_device_hint:"Charge, range, charging, plug, lock and climate are found by NextFloor on the car's device. Without one it takes the spot's presence sensor.",live_car_departure_entity:"Departure time (optional)",live_car_departure:"Departs {time}",live_car_open:"Open: {parts}",printer_printing:"printing",printer_done:"done",printer_paused:"paused",printer_error:"error",printer_idle:"idle",printer_done_at:"done at {time}",printer_layer:"Layer",printer_nozzle:"Nozzle",printer_bed:"Bed",heatpump_heating:"heating",heatpump_water:"making hot water",heatpump_cooling:"cooling",heatpump_defrost:"defrosting",heatpump_idle:"resting",heatpump_flow_return:"Flow \u2192 return",heatpump_heat:"Heat",heatpump_power:"Power",heatpump_outside:"outside",pack_missing_item:"Furniture of a removed pack",back_to_room:"Back to {room}",back_to_floor:"Back to the floor",hint_furniture:"Tap a room, then pick an item on the right \xB7 drag items, resize them by their corners",furniture_into:"New items go into the middle of \u201C{room}\u201D.",furniture_pick_room:"Tip: tap a room first \u2013 new items then land in its middle.",flows:"Power flow",flows_hint:"Show or hide the energy arcs between solar fields, inverter, battery, grid and consumers",chk_title:"Setup",chk_hint:"What the energy flow needs. Tap a row to jump there.",chk_solar:"Solar field in place",chk_solar_add:"Put a solar field on the roof",chk_meter:"Meter with grid sensor",chk_meter_sensor:"Meter: grid sensor (W) missing",chk_meter_add:"Add the meter",chk_inverter:"Inverter with power sensor",chk_inverter_sensor:"Inverter: power sensor missing",chk_inverter_add:"Add an inverter",chk_battery:"Home battery with power and charge",chk_battery_sensor:"Home battery: power or charge missing",chk_battery_opt:"Home battery (optional)",chk_grid:"Grid connection set",chk_grid_opt:"Grid connection (optional, else automatic)",energy_sign_grid:"The house shows export while the sun produces nothing. The grid sensor probably has its sign reversed.",energy_sign_battery:"The battery charges with no sun and no grid draw. Its sensor probably has its sign reversed.",energy_sign_flip:"Flip the sign",help_title:"Help and feedback",help_hint:"Please report problems as a GitHub issue and wishes as a discussion \u2013 nothing gets lost, and everyone sees the state.",help_issue:"Report a problem",help_idea:"Propose an idea",furn_name:"Name (optional)",furn_mirror:"Mirror",furn_mirror_hint:"Swap left and right \u2013 the L-sofa the other way round, the cabinet with its door on the other side, the kitchen run mirrored.",hint_opening:"Tap a wall to add a door or window \u2013 choose its kind on the right afterwards",preset_door:"Door",preset_door_double:"Double door",preset_window:"Window",preset_window_double:"Double window",preset_terrace:"Terrace door",preset_terrace_double:"French doors",preset_lift_slide:"Lift-and-slide door",preset_garage:"Garage door",preset_front:"Front door",opening_style:"Style",sidelight_auto:"automatic",sidelight_hinge:"Sidelight on the hinge side",sidelight_hinge_hint:"The sidelight sits opposite the hinge otherwise; ticked, it sits next to the hinges.",sidelight_width:"Sidelight width (m)",sidelight_width_left:"Left sidelight (m)",sidelight_width_right:"Right sidelight (m)",style_auto:"Automatic ({style})",style_interior:"Room door",style_front:"Front door",style_front_glass:"Front door with glass",style_sidelight:"Front door with sidelight",style_sidelights:"Front door with two sidelights",style_glass:"Glass door",style_sliding:"Sliding door",style_passage:"Opening (no door)",style_standard:"Standard",style_bars:"With glazing bars",style_glass_wall:"Glass wall (fixed)",preset_glass_wall:"Glass wall",glass_panes:"Panes",glass_panes_auto:"automatic (about 0.9 m)",glass_panes_hint:"0 = one single pane without mullions, empty = about every 0.9 m",flip_hinge:"Swap hinge side",flip_main_leaf:"Swap main leaf",flip_hinge_hint:"Hinges to the other side"
Line truncated
|
||||
:host {
|
||||
--nf-text: var(--primary-text-color, #e1e1e1);
|
||||
--nf-muted: var(--secondary-text-color, #9b9b9b);
|
||||
@@ -35,7 +35,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
font-family: var(--nf-font);
|
||||
color: var(--nf-text);
|
||||
}
|
||||
`,$r=J`
|
||||
`,Mr=J`
|
||||
:host([readable]) {
|
||||
--secondary-text-color: var(--primary-text-color, #e1e1e1);
|
||||
--divider-color: color-mix(in srgb, var(--primary-text-color, #e1e1e1) 40%, transparent);
|
||||
@@ -209,18 +209,18 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
min-height: 40px;
|
||||
}
|
||||
}
|
||||
`;function Mr(r){return r?.themes?.darkMode===!1?"light":"dark"}function fn(r,e){let t=new Set;return e.flatMap(n=>{let i=String(r?.states[n]?.attributes.symcon_source_entity||n),o=r?.states[i]?.attributes,s=Number(o?.symcon_id);return!s||!o?.symcon_archive||t.has(s)?[]:(t.add(s),[i])})}var Xa,Yi=class extends Q{static properties={hass:{attribute:!1},ids:{attribute:!1},label:{attribute:!1},busy:{state:!0},error:{state:!0}};constructor(){super(),this.ids=[],this.label="",this.busy=!1,this.error=""}async open(e){e.stopPropagation(),this.busy=!0,this.error="";try{let t=new URL("./nextfloor-trend.js?v=84417e0b2573",import.meta.url).href;await(await(Xa??=import(t).catch(i=>{throw Xa=void 0,i}))).openTrend(this.hass,this.ids,this.label)}catch(t){this.error=t instanceof Error?t.message:String(t)}finally{this.busy=!1}}render(){if(!fn(this.hass,this.ids).length)return f;let e=this.label?`Trend anzeigen: ${this.label}`:"Trend anzeigen";return p`<button type="button" title=${e} aria-label=${e} aria-haspopup="dialog" ?disabled=${this.busy} @pointerdown=${t=>t.stopPropagation()} @click=${t=>{this.open(t)}}>
|
||||
`;function Ar(r){return r?.themes?.darkMode===!1?"light":"dark"}function gn(r,e){let t=new Set;return e.flatMap(n=>{let i=String(r?.states[n]?.attributes.symcon_source_entity||n),o=r?.states[i]?.attributes,s=Number(o?.symcon_id);return!s||!o?.symcon_archive||t.has(s)?[]:(t.add(s),[i])})}var nl,Qi=class extends Q{static properties={hass:{attribute:!1},ids:{attribute:!1},label:{attribute:!1},busy:{state:!0},error:{state:!0}};constructor(){super(),this.ids=[],this.label="",this.busy=!1,this.error=""}async open(e){e.stopPropagation(),this.busy=!0,this.error="";try{let t=new URL("./nextfloor-trend.js?v=84417e0b2573",import.meta.url).href;await(await(nl??=import(t).catch(i=>{throw nl=void 0,i}))).openTrend(this.hass,this.ids,this.label)}catch(t){this.error=t instanceof Error?t.message:String(t)}finally{this.busy=!1}}render(){if(!gn(this.hass,this.ids).length)return f;let e=this.label?`Trend anzeigen: ${this.label}`:"Trend anzeigen";return p`<button type="button" title=${e} aria-label=${e} aria-haspopup="dialog" ?disabled=${this.busy} @pointerdown=${t=>t.stopPropagation()} @click=${t=>{this.open(t)}}>
|
||||
<svg width="12" height="12" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M3 2v15h15M5 13l4-5 4 2 4-6"/></svg>
|
||||
</button>${this.error?p`<span role="alert">${this.error}</span>`:f}`}static styles=J`:host{position:relative;display:inline-flex;flex:0 0 18px;width:18px;height:18px;vertical-align:middle;margin-left:3px;font-weight:normal;line-height:0}button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:18px;height:18px;padding:2px;border:0;border-radius:3px;background:transparent;color:var(--nf-accent,#40c8ff);opacity:.8;cursor:pointer}svg{display:block;flex-shrink:0}button:hover,button:focus-visible{opacity:1;background:#40c8ff18}button:focus-visible{outline:1px solid currentColor;outline-offset:1px}button:disabled{opacity:.4}span{position:absolute;right:0;top:22px;z-index:10;box-sizing:border-box;width:200px;padding:8px;border:1px solid #ff9b9b50;border-radius:6px;background:var(--nf-chrome-solid,#1c1c1c);font:12px/1.4 system-ui;color:#ff9b9b;white-space:normal}`};customElements.get("nf-trend-button")||customElements.define("nf-trend-button",Yi);function G(r,e,t=""){let n=fn(r,e);return n.length?p`<nf-trend-button .hass=${r} .ids=${n} .label=${t}></nf-trend-button>`:f}var Ji=class extends Q{static properties={hass:{attribute:!1},room:{attribute:!1},_pending:{state:!0},_error:{state:!0}};constructor(){super(),this._pending=new Set,this._error=""}async send(e,t,n,i){this._pending=new Set([...this._pending,e]),this._error="";try{await this.hass.callService(t,n,{entity_id:e,...i})}catch(o){this._error=o instanceof Error?o.message:String(o)}finally{this._pending=new Set([...this._pending].filter(o=>o!==e))}}value(e,t,n){let i=this.hass.states[t],o=tt(i),s=i?.attributes,a=n&&!!s?.symcon_has_action&&o!==null&&!this._pending.has(t);return p`<div class="value"><span>${e}</span><b>${nt(i)}${G(this.hass,[t],e)}</b>
|
||||
${n&&s?.symcon_has_action&&s.symcon_variable_type===0?p`<button class="nf-chip" aria-pressed=${se(i)===!0} ?disabled=${!a} @click=${()=>{this.send(t,"symcon","set_value",{value:!se(i)})}}>${se(i)?"Ein":"Aus"}</button>`:n&&s?.symcon_has_action&&[1,2].includes(Number(s.symcon_variable_type))?p`<input type="number" aria-label=${e} .value=${String(Oe(i)??"")} min=${String(s.symcon_min??0)} max=${String(s.symcon_max??100)} step=${String(s.symcon_step||(s.symcon_variable_type===1?1:.1))} ?disabled=${!a}
|
||||
</button>${this.error?p`<span role="alert">${this.error}</span>`:f}`}static styles=J`:host{position:relative;display:inline-flex;flex:0 0 18px;width:18px;height:18px;vertical-align:middle;margin-left:3px;font-weight:normal;line-height:0}button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:18px;height:18px;padding:2px;border:0;border-radius:3px;background:transparent;color:var(--nf-accent,#40c8ff);opacity:.8;cursor:pointer}svg{display:block;flex-shrink:0}button:hover,button:focus-visible{opacity:1;background:#40c8ff18}button:focus-visible{outline:1px solid currentColor;outline-offset:1px}button:disabled{opacity:.4}span{position:absolute;right:0;top:22px;z-index:10;box-sizing:border-box;width:200px;padding:8px;border:1px solid #ff9b9b50;border-radius:6px;background:var(--nf-chrome-solid,#1c1c1c);font:12px/1.4 system-ui;color:#ff9b9b;white-space:normal}`};customElements.get("nf-trend-button")||customElements.define("nf-trend-button",Qi);function G(r,e,t=""){let n=gn(r,e);return n.length?p`<nf-trend-button .hass=${r} .ids=${n} .label=${t}></nf-trend-button>`:f}var Xi=class extends Q{static properties={hass:{attribute:!1},room:{attribute:!1},_pending:{state:!0},_error:{state:!0}};constructor(){super(),this._pending=new Set,this._error=""}async send(e,t,n,i){this._pending=new Set([...this._pending,e]),this._error="";try{await this.hass.callService(t,n,{entity_id:e,...i})}catch(o){this._error=o instanceof Error?o.message:String(o)}finally{this._pending=new Set([...this._pending].filter(o=>o!==e))}}value(e,t,n){let i=this.hass.states[t],o=tt(i),s=i?.attributes,a=n&&!!s?.symcon_has_action&&o!==null&&!this._pending.has(t);return p`<div class="value"><span>${e}</span><b>${nt(i)}${G(this.hass,[t],e)}</b>
|
||||
${n&&s?.symcon_has_action&&s.symcon_variable_type===0?p`<button class="nf-chip" aria-pressed=${ae(i)===!0} ?disabled=${!a} @click=${()=>{this.send(t,"symcon","set_value",{value:!ae(i)})}}>${ae(i)?"Ein":"Aus"}</button>`:n&&s?.symcon_has_action&&[1,2].includes(Number(s.symcon_variable_type))?p`<input type="number" aria-label=${e} .value=${String(Le(i)??"")} min=${String(s.symcon_min??0)} max=${String(s.symcon_max??100)} step=${String(s.symcon_step||(s.symcon_variable_type===1?1:.1))} ?disabled=${!a}
|
||||
@change=${l=>{let u=l.target;u.value.trim()&&u.checkValidity()&&this.send(t,"symcon","set_value",{value:Number(u.value)})}} />`:f}
|
||||
</div>`}schedule(e){let t=this.hass.states[e];if(!t?.attributes.symcon_schedule)return p`<p class="missing">Schaltuhr nicht verfügbar</p>`;let n=t.attributes.actions??[],i=t.attributes.groups??[],o=Number(t.attributes.next_run??0),s=n.find(u=>u.id===t.attributes.next_action),a=["Mo","Di","Mi","Do","Fr","Sa","So"],l=u=>`${String(u.hour).padStart(2,"0")}:${String(u.minute).padStart(2,"0")}${u.second?`:${String(u.second).padStart(2,"0")}`:""}`;return p`<details class="schedule"><summary>${String(t.attributes.friendly_name??"Schaltuhr")}</summary>
|
||||
<label class="nf-check"><input type="checkbox" .checked=${t.state==="on"} ?disabled=${this._pending.has(e)} @change=${u=>{this.send(e,"schedule","set_active",{active:u.target.checked})}} /> Aktiv</label>
|
||||
${o>0?p`<p class="next">Nächster Schaltpunkt: ${new Date(o*1e3).toLocaleString(this.hass.language)}${s?` \xB7 ${s.name}`:""}</p>`:f}
|
||||
${i.length?i.map(u=>p`<div class="schedule-group"><b>${a.filter((c,d)=>u.days&1<<d).join(" \xB7 ")}</b><div class="points">
|
||||
${[...u.points].sort((c,d)=>c.hour*3600+c.minute*60+c.second-(d.hour*3600+d.minute*60+d.second)).map(c=>{let d=n.find(m=>m.id===c.action);return p`<span class="point"><time>${l(c)}</time><span class="dot" style=${`background:#${Number(d?.color??8885929).toString(16).padStart(6,"0").slice(-6)}`}></span>${d?.name||"Aktion"}</span>`})}
|
||||
${i.length?i.map(u=>p`<div class="schedule-group"><b>${a.filter((c,m)=>u.days&1<<m).join(" \xB7 ")}</b><div class="points">
|
||||
${[...u.points].sort((c,m)=>c.hour*3600+c.minute*60+c.second-(m.hour*3600+m.minute*60+m.second)).map(c=>{let m=n.find(d=>d.id===c.action);return p`<span class="point"><time>${l(c)}</time><span class="dot" style=${`background:#${Number(m?.color??8885929).toString(16).padStart(6,"0").slice(-6)}`}></span>${m?.name||"Aktion"}</span>`})}
|
||||
</div></div>`):p`<p class="missing">Keine Schaltpunkte vorhanden.</p>`}
|
||||
</details>`}render(){if(!this.hass||!this.room)return f;let e=Qa.filter(i=>i.key!=="status"&&this.room.hvac?.[i.key]&&this.room.hvac[i.key]!=="none"),t=this.room.hvac?.schedules??[],n=this.room.floor_heating&&this.room.floor_heating!=="none"?this.room.floor_heating:null;return p`${n||e.length?p`<section><h3>Raumklima</h3>${n?this.value("Fu\xDFbodenheizung",n,!0):f}${e.map(i=>this.value(i.label,this.room.hvac[i.key],!!i.control))}</section>`:f}
|
||||
</details>`}render(){if(!this.hass||!this.room)return f;let e=tl.filter(i=>i.key!=="status"&&this.room.hvac?.[i.key]&&this.room.hvac[i.key]!=="none"),t=this.room.hvac?.schedules??[],n=this.room.floor_heating&&this.room.floor_heating!=="none"?this.room.floor_heating:null;return p`${n||e.length?p`<section><h3>Raumklima</h3>${n?this.value("Fu\xDFbodenheizung",n,!0):f}${e.map(i=>this.value(i.label,this.room.hvac[i.key],!!i.control))}</section>`:f}
|
||||
${t.length?p`<section><h3>Schaltuhren</h3>${t.map(i=>this.schedule(i))}</section>`:f}
|
||||
${this._error?p`<p role="alert" class="error">${this._error}</p>`:f}`}static styles=[_e,ze,J`
|
||||
:host { display:block; }
|
||||
@@ -240,12 +240,12 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
.point time { font-variant-numeric:tabular-nums; }
|
||||
.dot { width:8px; height:8px; border-radius:50%; }
|
||||
.error { color:var(--nf-danger,#ff6b7a); font-size:12px; }
|
||||
`]};customElements.get("nf-room-hvac")||customElements.define("nf-room-hvac",Ji);var Te={electricity:"Strom",water:"Wasser",gas:"Gas",heating:"Heizen",cooling:"K\xFChlen"},gn={electricity:"\u26A1",water:"\u{1F4A7}",gas:"\u{1F525}",heating:"\u2668",cooling:"\u2744"},Rr=r=>r.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/ß/g,"ss").replace(/[^a-z0-9]+/g," ").trim(),Wh="{485D0419-BE97-4548-AA9C-C083EB82E61E}",Lh=r=>r.object_type!==0&&!(r.object_type===1&&r.module_id?.toUpperCase()===Wh)?null:{elektro:"electricity",strom:"electricity","elektro strom":"electricity","strom elektro":"electricity",wasser:"water",gas:"gas",heizen:"heating",heizung:"heating",warme:"heating",waerme:"heating",kuhlen:"cooling",kuehlen:"cooling",kuhlung:"cooling",kuehlung:"cooling",kalte:"cooling",kaelte:"cooling"}[Rr(r.name)]??null,Ar=r=>/^symcon-category-(\d+)$/.exec(r??"")?.[1],Xi=r=>/\b(heute|tag|tagesverbrauch|today|daily)\b/.test(r)?"day":/monat|month/.test(r)?"month":/jahr|year/.test(r)?"year":"total",zr=(r,e)=>String(r.states[e]?.attributes.symcon_source_entity||e);function nl(r){let e=String(r?.attributes.unit_of_measurement??"").trim(),t=e.replace(/[³]/g,"3").replace(/[²]/g,"2").replace(/\s+/g,"").toLowerCase();return["w","kw","mw"].includes(t)?{metric:"power",unit:"W",factor:e==="mW"?.001:t==="kw"?1e3:t==="mw"?1e6:1}:["wh","kwh","mwh","j","kj","mj","gj"].includes(t)?{metric:"energy",unit:"kWh",factor:{wh:.001,kwh:1,mwh:1e3,j:1/36e5,kj:1/3600,mj:1/3.6,gj:1e3/3.6}[t]}:["m3/h","m3h","m3/min","m3/s","l/h","l/min","l/s","liter/h","liter/min"].includes(t)?{metric:"power",unit:"m\xB3/h",factor:{"m3/h":1,m3h:1,"m3/min":60,"m3/s":3600,"l/h":.001,"l/min":.06,"l/s":3.6,"liter/h":.001,"liter/min":.06}[t]}:["m3","l","liter"].includes(t)?{metric:"energy",unit:"m\xB3",factor:t==="m3"?1:.001}:null}function Oh(r,e){if(!e.entity_id||e.object_type!==2&&e.object_type!==6)return null;let t=zr(r,e.entity_id),n=r.states[t];if(!n||![1,2].includes(Number(n.attributes.symcon_variable_type)))return null;let i=Rr(e.name),o=nl(n),s=/^(leistung|wirkleistung|gesamtleistung|aktuelle leistung|durchfluss|volumenstrom)(\b|$)/.test(i),a=/^(verbrauch|energie|energieverbrauch|gesamtverbrauch|gesamtenergie|zahlerstand|zaehlerstand|arbeit)(\b|$)/.test(i),l=o?.metric??(s?"power":a?"energy":null);if(!l)return null;let u=l==="power"?/^(leistung|wirkleistung|gesamtleistung|durchfluss|volumenstrom)$/.test(i):/^(verbrauch|energie|energieverbrauch|gesamtverbrauch|gesamtenergie|zahlerstand|zaehlerstand|arbeit)$/.test(i),c=l==="energy"?Xi(i):"total";return{metric:l,source:t,period:c,group:`${l}|${o?.unit??String(n.attributes.unit_of_measurement??"")}|${c}`,score:/^gesamt(leistung|verbrauch|energie)$/.test(i)?110:u?100:(l==="power"?s:a)?70:20}}var el=new WeakMap,tl=new WeakMap;function rl(r){let e=el.get(r);if(e)return e;let t={nodes:new Map(r.map(n=>[n.object_id,n])),children:new Map};for(let n of r){let i=t.children.get(n.parent_id)??[];i.push(n),t.children.set(n.parent_id,i)}return el.set(r,t),t}function eo(r,e,t){if(!K(r))return[];let n=[e.area_id,...e.sub_areas??[]].map(Ar).filter(m=>!!m);if(!n.length)return[];let i=new Set(t.filter(m=>m.id!==e.id).flatMap(m=>[m.area_id,...m.sub_areas??[]]).map(Ar).filter(m=>!!m&&!n.includes(m))),o=`${n.join(",")}|${[...i].sort().join(",")}`,s=tl.get(r)??new Map;tl.set(r,s);let a=s.get(o);if(a)return a;let l=rl(r.symconObjects),u=[],c=new Set,d=(m,h,g)=>{if(c.has(m)||i.has(String(m)))return;c.add(m);let _=l.nodes.get(m);if(!_)return;let b=Lh(_),v=b??h,S=new Set(b&&b!==h?[]:g),k=l.children.get(m)??[];if(v){let M=k.map(z=>Oh(r,z)).filter(z=>z!==null);for(let z of new Set(M.map(R=>R.group))){if(S.has(z))continue;let R=M.filter(E=>E.group===z),F=Math.max(...R.map(E=>E.score)),T=R.filter(E=>E.score===F);for(let E of F>=100?T.slice(0,1):T)u.push({kind:v,metric:E.metric,id:E.source,period:E.period});S.add(z)}}for(let M of k)(M.object_type===0||M.object_type===1)&&d(M.object_id,v,S)};for(let m of n)d(Number(m),null,new Set);return s.set(o,u),u}function It(r,e,t=!1){let n=new Map,i=new Set;for(let o of e){let s=zr(r,o.id),a=`${o.kind}|${o.metric}|${s}`;if(i.has(a))continue;i.add(a);let l=r.states[s],u=nl(l),c=u?.metric===o.metric?u.unit:String(l?.attributes.unit_of_measurement??"").trim(),d=`${o.kind}|${o.metric}|${c}|${o.period}`,m=n.get(d)??{kind:o.kind,metric:o.metric,unit:c,value:null,period:o.period,sources:[],manual:t,incomplete:!1},h=Oe(l);h===null?m.incomplete=!0:m.value=(m.value??0)+h*(u?.metric===o.metric?u.factor:1),m.sources.push(s),n.set(d,m)}return[...n.values()]}function Er(r,e){return Ie.flatMap(t=>["power","energy"].flatMap(n=>{let i=e.utility_meters?.[t]?.[n];if(!i||i==="none")return[];let o=zr(r,i);return[{kind:t,metric:n,id:o,period:n==="energy"?Xi(Rr(String(r.states[o]?.attributes.friendly_name??""))):"total"}]}))}function il(r,e){return K(r)?It(r,Er(r,e),!0):[]}function Ct(r,e,t=[]){let n=il(r,e);return n.length?n:It(r,eo(r,e,t))}function to(r,e,t=e.rooms){if(!K(r))return[];let n=new Map;for(let
Line truncated
|
||||
<h4>${gn[e]} ${Te[e]}</h4>
|
||||
`]};customElements.get("nf-room-hvac")||customElements.define("nf-room-hvac",Xi);var Te={electricity:"Strom",water:"Wasser",gas:"Gas",heating:"Heizen",cooling:"K\xFChlen"},_n={electricity:"\u26A1",water:"\u{1F4A7}",gas:"\u{1F525}",heating:"\u2668",cooling:"\u2744"},zr=r=>r.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/ß/g,"ss").replace(/[^a-z0-9]+/g," ").trim(),Kh="{485D0419-BE97-4548-AA9C-C083EB82E61E}",Gh=r=>r.object_type!==0&&!(r.object_type===1&&r.module_id?.toUpperCase()===Kh)?null:{elektro:"electricity",strom:"electricity","elektro strom":"electricity","strom elektro":"electricity",wasser:"water",gas:"gas",heizen:"heating",heizung:"heating",warme:"heating",waerme:"heating",kuhlen:"cooling",kuehlen:"cooling",kuhlung:"cooling",kuehlung:"cooling",kalte:"cooling",kaelte:"cooling"}[zr(r.name)]??null,Er=r=>/^symcon-category-(\d+)$/.exec(r??"")?.[1],to=r=>/\b(heute|tag|tagesverbrauch|today|daily)\b/.test(r)?"day":/monat|month/.test(r)?"month":/jahr|year/.test(r)?"year":"total",Tr=(r,e)=>String(r.states[e]?.attributes.symcon_source_entity||e);function ol(r){let e=String(r?.attributes.unit_of_measurement??"").trim(),t=e.replace(/[³]/g,"3").replace(/[²]/g,"2").replace(/\s+/g,"").toLowerCase();return["w","kw","mw"].includes(t)?{metric:"power",unit:"W",factor:e==="mW"?.001:t==="kw"?1e3:t==="mw"?1e6:1}:["wh","kwh","mwh","j","kj","mj","gj"].includes(t)?{metric:"energy",unit:"kWh",factor:{wh:.001,kwh:1,mwh:1e3,j:1/36e5,kj:1/3600,mj:1/3.6,gj:1e3/3.6}[t]}:["m3/h","m3h","m3/min","m3/s","l/h","l/min","l/s","liter/h","liter/min"].includes(t)?{metric:"power",unit:"m\xB3/h",factor:{"m3/h":1,m3h:1,"m3/min":60,"m3/s":3600,"l/h":.001,"l/min":.06,"l/s":3.6,"liter/h":.001,"liter/min":.06}[t]}:["m3","l","liter"].includes(t)?{metric:"energy",unit:"m\xB3",factor:t==="m3"?1:.001}:null}function Uh(r,e){if(!e.entity_id||e.object_type!==2&&e.object_type!==6)return null;let t=Tr(r,e.entity_id),n=r.states[t];if(!n||![1,2].includes(Number(n.attributes.symcon_variable_type)))return null;let i=zr(e.name),o=ol(n),s=/^(leistung|wirkleistung|gesamtleistung|aktuelle leistung|durchfluss|volumenstrom)(\b|$)/.test(i),a=/^(verbrauch|energie|energieverbrauch|gesamtverbrauch|gesamtenergie|zahlerstand|zaehlerstand|arbeit)(\b|$)/.test(i),l=o?.metric??(s?"power":a?"energy":null);if(!l)return null;let u=l==="power"?/^(leistung|wirkleistung|gesamtleistung|durchfluss|volumenstrom)$/.test(i):/^(verbrauch|energie|energieverbrauch|gesamtverbrauch|gesamtenergie|zahlerstand|zaehlerstand|arbeit)$/.test(i),c=l==="energy"?to(i):"total";return{metric:l,source:t,period:c,group:`${l}|${o?.unit??String(n.attributes.unit_of_measurement??"")}|${c}`,score:/^gesamt(leistung|verbrauch|energie)$/.test(i)?110:u?100:(l==="power"?s:a)?70:20}}var rl=new WeakMap,il=new WeakMap;function sl(r){let e=rl.get(r);if(e)return e;let t={nodes:new Map(r.map(n=>[n.object_id,n])),children:new Map};for(let n of r){let i=t.children.get(n.parent_id)??[];i.push(n),t.children.set(n.parent_id,i)}return rl.set(r,t),t}function no(r,e,t){if(!K(r))return[];let n=[e.area_id,...e.sub_areas??[]].map(Er).filter(d=>!!d);if(!n.length)return[];let i=new Set(t.filter(d=>d.id!==e.id).flatMap(d=>[d.area_id,...d.sub_areas??[]]).map(Er).filter(d=>!!d&&!n.includes(d))),o=`${n.join(",")}|${[...i].sort().join(",")}`,s=il.get(r)??new Map;il.set(r,s);let a=s.get(o);if(a)return a;let l=sl(r.symconObjects),u=[],c=new Set,m=(d,h,g)=>{if(c.has(d)||i.has(String(d)))return;c.add(d);let _=l.nodes.get(d);if(!_)return;let b=Gh(_),v=b??h,S=new Set(b&&b!==h?[]:g),k=l.children.get(d)??[];if(v){let M=k.map(z=>Uh(r,z)).filter(z=>z!==null);for(let z of new Set(M.map(R=>R.group))){if(S.has(z))continue;let R=M.filter(E=>E.group===z),F=Math.max(...R.map(E=>E.score)),T=R.filter(E=>E.score===F);for(let E of F>=100?T.slice(0,1):T)u.push({kind:v,metric:E.metric,id:E.source,period:E.period});S.add(z)}}for(let M of k)(M.object_type===0||M.object_type===1)&&m(M.object_id,v,S)};for(let d of n)m(Number(d),null,new Set);return s.set(o,u),u}function Ct(r,e,t=!1){let n=new Map,i=new Set;for(let o of e){let s=Tr(r,o.id),a=`${o.kind}|${o.metric}|${s}`;if(i.has(a))continue;i.add(a);let l=r.states[s],u=ol(l),c=u?.metric===o.metric?u.unit:String(l?.attributes.unit_of_measurement??"").trim(),m=`${o.kind}|${o.metric}|${c}|${o.period}`,d=n.get(m)??{kind:o.kind,metric:o.metric,unit:c,value:null,period:o.period,sources:[],manual:t,incomplete:!1},h=Le(l);h===null?d.incomplete=!0:d.value=(d.value??0)+h*(u?.metric===o.metric?u.factor:1),d.sources.push(s),n.set(m,d)}return[...n.values()]}function Rr(r,e){return Ie.flatMap(t=>["power","energy"].flatMap(n=>{let i=e.utility_meters?.[t]?.[n];if(!i||i==="none")return[];let o=Tr(r,i);return[{kind:t,metric:n,id:o,period:n==="energy"?to(zr(String(r.states[o]?.attributes.friendly_name??""))):"total"}]}))}function al(r,e){return K(r)?Ct(r,Rr(r,e),!0):[]}function Nt(r,e,t=[]){let n=al(r,e);return n.length?n:Ct(r,no(r,e,t))}function ro(r,e,t=e.rooms){if(!K(r))return[];let n=new Map;for(let
Line truncated
|
||||
<h4>${_n[e]} ${Te[e]}</h4>
|
||||
${this.readings.filter(t=>t.kind===e).map(t=>p`<div class="reading" title=${`${t.manual?"Eigener Z\xE4hler":"Bereichsz\xE4hler"}${t.incomplete?" \xB7 Err: Mindestens ein Wert fehlt; angezeigt wird die Summe der verf\xFCgbaren Werte.":""}
|
||||
${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states[n]?.attributes.friendly_name||n).join(`
|
||||
`)}`}>
|
||||
<span>${Nt(t)}${t.manual?p` <small>· Zähler</small>`:""}</span><b>${Fe(this.hass,t)}${G(this.hass,t.sources,`${Te[t.kind]} \xB7 ${Nt(t)}`)}</b>
|
||||
<span>${Ot(t)}${t.manual?p` <small>· Zähler</small>`:""}</span><b>${Fe(this.hass,t)}${G(this.hass,t.sources,`${Te[t.kind]} \xB7 ${Ot(t)}`)}</b>
|
||||
</div>`)}
|
||||
</section>`)}`}static styles=J`
|
||||
:host { display:block; color:var(--nf-text); font:inherit; }
|
||||
@@ -256,12 +256,12 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.reading span { color:var(--nf-muted,#aaa); }
|
||||
b { white-space:nowrap; font-variant-numeric:tabular-nums; }
|
||||
small { font-size:.85em; }
|
||||
`};customElements.get("nf-utility-report")||customElements.define("nf-utility-report",no);var ee=(r,e)=>[r[0]-e[0],r[1]-e[1]],He=(r,e)=>[r[0]+e[0],r[1]+e[1]],ye=(r,e)=>[r[0]*e,r[1]*e],ue=(r,e)=>r[0]*e[0]+r[1]*e[1],Be=(r,e)=>r[0]*e[1]-r[1]*e[0],Ve=r=>Math.hypot(r[0],r[1]),xe=r=>{let e=Ve(r)||1;return[r[0]/e,r[1]/e]},ro=r=>[-r[1],r[0]],io=r=>[r[1],-r[0]];function al(r){let e=r.heightEnd!==void 0;return{...r,a:r.b,b:r.a,left:r.right,right:r.left,roomLeft:r.roomRight,roomRight:r.roomLeft,height:e?r.heightEnd:r.height,heightEnd:e?r.height:void 0}}function Bh(r,e){let t=r.map(n=>({...n}));for(let n of e){let i=t.find(o=>o.room_id===n.room_id&&o.edge===n.edge&&(Math.abs(o.t1-n.t0)<1e-6||Math.abs(n.t1-o.t0)<1e-6));i?(i.t0=Math.min(i.t0,n.t0),i.t1=Math.max(i.t1,n.t1)):t.push({...n})}return t}function Vh(r,e,t){if(r.a===e.b)return!1;let n=xe(ee(t[r.b],t[r.a])),i=xe(ee(t[e.b],t[e.a]));return Math.abs(Be(n,i))>1e-6||ue(n,i)<=0||r.free||e.free||r.heightEnd!==void 0||e.heightEnd!==void 0?!1:r.height===e.height&&r.exterior===e.exterior&&r.roomLeft===e.roomLeft&&r.roomRight===e.roomRight&&Math.abs(r.left-e.left)<=1e-9&&Math.abs(r.right-e.right)<=1e-9}function ll(r,e,t=new Set){let n=r.slice();for(;;){let i=new Map;n.forEach((s,a)=>{for(let l of[s.a,s.b])i.set(l,[...i.get(l)??[],a])});let o=null;for(let[s,a]of i){if(a.length!==2||t.has(s))continue;let l=n[a[0]].b===s?n[a[0]]:al(n[a[0]]),u=n[a[1]].a===s?n[a[1]]:al(n[a[1]]);if(!Vh(l,u,e))continue;let c={...l,b:u.b,sources:Bh(l.sources,u.sources)};o=[...n.filter((d,m)=>m!==a[0]&&m!==a[1]),c];break}if(!o)return n;n=o}}function ul(r,e){let t=new Map;r.forEach((i,o)=>{let s=xe(ee(e[i.b],e[i.a])),a=[[i.a,{key:`${o}:a`,d:s,left:i.left,right:i.right,angle:Math.atan2(s[1],s[0])}],[i.b,{key:`${o}:b`,d:ye(s,-1),left:i.right,right:i.left,angle:Math.atan2(-s[1],-s[0])}]];for(let[l,u]of a)t.set(l,[...t.get(l)??[],u])});let n=new Map;for(let[i,o]of t){let s=e[i];o.sort((l,u)=>l.angle-u.angle);for(let l of o)n.set(l.key,{left:He(s,ye(ro(l.d),l.left)),right:He(s,ye(io(l.d),l.right))});if(o.length<2)continue;let a=4*Math.max(...o.map(l=>Math.max(l.left,l.right)))+1e-9;o.forEach((l,u)=>{let c=o[(u+1)%o.length],d=He(s,ye(ro(l.d),l.left)),m=He(s,ye(io(c.d),c.right)),h=Be(l.d,c.d);if(Math.abs(h)<1e-4)return;let g=He(d,ye(l.d,Be(ee(m,d),c.d)/h));Ve(ee(g,s))>a||(n.get(l.key).left=g,n.get(c.key).right=g)})}return n}function cl(r,e){let t=r.filter((n,i)=>Ve(ee(n,r[(i+1)%r.length]))>e);for(;;){if(t.length<=3)return t;let n=t.findIndex((i,o)=>{let s=t[(o+t.length-1)%t.length],a=t[(o+1)%t.length],[l,u]=[ee(i,s),ee(a,i)];return Math.abs(Be(xe(l),xe(u)))<1e-7&&ue(l,u)>0});if(n===-1)return t;t=t.filter((i,o)=>o!==n)}}function Kh(r){let e=[];return{points:e,idOf(t){let n=e.findIndex(i=>Math.abs(i[0]-t[0])<=r&&Math.abs(i[1]-t[1])<=r);return n>=0?n:(e.push([t[0],t[1]]),e.length-1)}}}function Gh(r,e){let t=[];for(let n of r){let i=n.points;if(i.length<3||Math.abs(mt(i))<1e-6)continue;let o=mt(i)>0,s=i.map(a=>e.idOf(a));s.forEach((a,l)=>{let u=s[(l+1)%s.length];a!==u&&t.push(o?{u:a,v:u,room:n.id,edge:l,forward:!0}:{u,v:a,room:n.id,edge:l,forward:!1})})}return t}function Uh(r,e,t){let n=[];for(let i of r){let[o,s]=[e[i.u],e[i.v]],a=ee(s,o),l=Ve(a),u=ye(a,1/l),c=e.map((m,h)=>({id:h,rel:ee(m,o)})).filter(({id:m,rel:h})=>m!==i.u&&m!==i.v&&ue(h,u)>t&&ue(h,u)<l-t&&Math.abs(Be(u,h))<=t).map(({id:m,rel:h})=>({t:ue(h,u),id:m})).sort((m,h)=>m.t-h.t),d=[{t:0,id:i.u},...c,{t:l,id:i.v}];for(let m=0;m+1<d.length;m++){let[h,g]=[d[m],d[m+1]];n.push({u:h.id,v:g.id,room:i.room,edge:i.edge,t0:i.forward?h.t:l-g.t,t1:i.forward?g.t:l-h.t,forward:i.forward})}}return n}var dl=r=>({room_id:r.room,edge:r.edge,t0:r.t0,t1:r.t1});function jh(r,e){let t=new Map(r.map(a=>[a.id,a])),n=new Map;for(let a of e){let l=`${a.room}:${a.edge}`;n.set(l,[...n.get(l)??[],a.t0].sort((u,c)=>u-c))}let i=a=>{let l=t.get(a.room)?.wall_heights?.[a.edge];return Array.isArray(l)?l[(n.get(`${a.room}:${a.edge}`)??[]).indexOf(a.t0)]??null:l},o=a=>{let l=t.get(a.room),[u,c]=[l?.wall_heights?.[a.edge],l?.wall_slopes?.[a.edge]];if(!l||typeof u!="number"||typeof c!="number"||u<=0||c<=0)return null;let[d,m]=[l.points[a.edge],l.points[(a.edge+1)%l.points.length]];return{from:u,to:c,length:Math.hypot(m[0]-d[0],m[1]-d[1])}},s=a=>{let l=o(a);if(!l||l.length<1e-9){let c=i(a);return typeof c=="number"&&c>0?[c,c]:[null,null]}let u=c=>l.from+(l.to-l.from)*c/l.length;return a.forward?[u(a.t0),u(a.t1)]:[u(a.t1),u(a.t0)]};return{heightsOf(a){let[l,u]=[1/0,1/0];for(let d of a){let[m,h]=s(d),[g,_]=d===a[0]?[m,h]:[h,m];g!==null&&(l=Math.min(l,g)),_!==null&&(u=Math.min(u,_))}let c=a.map(d=>t.get(d.room)?.ceiling);if(c.every(d=>typeof d=="number"&&d>0)){let d=Math.max(...c);l===1/0&&(l=d),u===1/0&&(u=d)}return{...l<1/0?{a:l}:{},...u<1/0?{b:u}:{}}},thicknessOf(a){let l=a.map(u=>{let c=t.get(u.room)?.wall_thickness?.[u.edge];return Array.isArray(c)?c[(n.get(`${u.room}:${u.edge}`)??[]).indexOf(u.t0)]:c}).filter(u=>typeof u=="number"&&u>0);return l.length?Math.max(...l):void 0},hasNoWa
Line truncated
|
||||
<path d=${yr(r)} />
|
||||
</svg>`,Nr={previous:"M6 6h2v12H6zM20 6v12l-10-6z",play:"M8 5v14l11-7z",pause:"M7 5h4v14H7zM13 5h4v14h-4z",next:"M16 6h2v12h-2zM4 6v12l10-6z"},co=r=>p`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d=${r} /></svg>`,Hm=24,Pm=10,ho=class extends Q{static properties={hass:{attribute:!1},room:{attribute:!1},floor:{attribute:!1},confirmEntities:{attribute:!1},phrases:{attribute:!1},outside:{attribute:!1},_showAll:{state:!0},_said:{state:!0},_folded:{state:!0},_curve:{state:!0},_moodName:{state:!0},_undo:{state:!0},_energy:{state:!0},_sunYear:{state:!0},rooms:{attribute:!1},building:{attribute:!1}};saidTimer;memo=null;curveFor="";undoTimer;constructor(){super(),this.room=null,this.floor=null,this.phrases=null,this.outside=null,this._said=null,this._showAll=!1,this._folded=!1,this._curve=null,this._moodName=null,this._undo=null,this._energy=null,this._sunYear=!1,this.rooms=null,this.building=null}fireMoods(e,t){this.dispatchEvent(new CustomEvent("mood-change",{detail:{roomId:e.id,moods:t},bubbles:!0,composed:!0}))}runMood(e){for(let t of Cr(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=>U(this.hass,l).filter(u=>u.startsWith("light.")),a=()=>{let l=(this._moodName??"").trim()||this.t("mood_new");this.fireMoods(e,[...n,{id:`mood_${Date.now().toString(36)}`,name:l,lights:t.map(Ir)}]),this._moodName=null};return p`<div class="nf-rp-moods">
|
||||
`};customElements.get("nf-utility-report")||customElements.define("nf-utility-report",io);var ee=(r,e)=>[r[0]-e[0],r[1]-e[1]],He=(r,e)=>[r[0]+e[0],r[1]+e[1]],we=(r,e)=>[r[0]*e,r[1]*e],ue=(r,e)=>r[0]*e[0]+r[1]*e[1],Be=(r,e)=>r[0]*e[1]-r[1]*e[0],Ve=r=>Math.hypot(r[0],r[1]),xe=r=>{let e=Ve(r)||1;return[r[0]/e,r[1]/e]},oo=r=>[-r[1],r[0]],so=r=>[r[1],-r[0]];function cl(r){let e=r.heightEnd!==void 0;return{...r,a:r.b,b:r.a,left:r.right,right:r.left,roomLeft:r.roomRight,roomRight:r.roomLeft,height:e?r.heightEnd:r.height,heightEnd:e?r.height:void 0}}function jh(r,e){let t=r.map(n=>({...n}));for(let n of e){let i=t.find(o=>o.room_id===n.room_id&&o.edge===n.edge&&(Math.abs(o.t1-n.t0)<1e-6||Math.abs(n.t1-o.t0)<1e-6));i?(i.t0=Math.min(i.t0,n.t0),i.t1=Math.max(i.t1,n.t1)):t.push({...n})}return t}function qh(r,e,t){if(r.a===e.b)return!1;let n=xe(ee(t[r.b],t[r.a])),i=xe(ee(t[e.b],t[e.a]));return Math.abs(Be(n,i))>1e-6||ue(n,i)<=0||r.free||e.free||r.heightEnd!==void 0||e.heightEnd!==void 0?!1:r.height===e.height&&r.exterior===e.exterior&&r.roomLeft===e.roomLeft&&r.roomRight===e.roomRight&&Math.abs(r.left-e.left)<=1e-9&&Math.abs(r.right-e.right)<=1e-9}function dl(r,e,t=new Set){let n=r.slice();for(;;){let i=new Map;n.forEach((s,a)=>{for(let l of[s.a,s.b])i.set(l,[...i.get(l)??[],a])});let o=null;for(let[s,a]of i){if(a.length!==2||t.has(s))continue;let l=n[a[0]].b===s?n[a[0]]:cl(n[a[0]]),u=n[a[1]].a===s?n[a[1]]:cl(n[a[1]]);if(!qh(l,u,e))continue;let c={...l,b:u.b,sources:jh(l.sources,u.sources)};o=[...n.filter((m,d)=>d!==a[0]&&d!==a[1]),c];break}if(!o)return n;n=o}}function hl(r,e){let t=new Map;r.forEach((i,o)=>{let s=xe(ee(e[i.b],e[i.a])),a=[[i.a,{key:`${o}:a`,d:s,left:i.left,right:i.right,angle:Math.atan2(s[1],s[0])}],[i.b,{key:`${o}:b`,d:we(s,-1),left:i.right,right:i.left,angle:Math.atan2(-s[1],-s[0])}]];for(let[l,u]of a)t.set(l,[...t.get(l)??[],u])});let n=new Map;for(let[i,o]of t){let s=e[i];o.sort((l,u)=>l.angle-u.angle);for(let l of o)n.set(l.key,{left:He(s,we(oo(l.d),l.left)),right:He(s,we(so(l.d),l.right))});if(o.length<2)continue;let a=4*Math.max(...o.map(l=>Math.max(l.left,l.right)))+1e-9;o.forEach((l,u)=>{let c=o[(u+1)%o.length],m=He(s,we(oo(l.d),l.left)),d=He(s,we(so(c.d),c.right)),h=Be(l.d,c.d);if(Math.abs(h)<1e-4)return;let g=He(m,we(l.d,Be(ee(d,m),c.d)/h));Ve(ee(g,s))>a||(n.get(l.key).left=g,n.get(c.key).right=g)})}return n}function ml(r,e){let t=r.filter((n,i)=>Ve(ee(n,r[(i+1)%r.length]))>e);for(;;){if(t.length<=3)return t;let n=t.findIndex((i,o)=>{let s=t[(o+t.length-1)%t.length],a=t[(o+1)%t.length],[l,u]=[ee(i,s),ee(a,i)];return Math.abs(Be(xe(l),xe(u)))<1e-7&&ue(l,u)>0});if(n===-1)return t;t=t.filter((i,o)=>o!==n)}}function Zh(r){let e=[];return{points:e,idOf(t){let n=e.findIndex(i=>Math.abs(i[0]-t[0])<=r&&Math.abs(i[1]-t[1])<=r);return n>=0?n:(e.push([t[0],t[1]]),e.length-1)}}}function Yh(r,e){let t=[];for(let n of r){let i=n.points;if(i.length<3||Math.abs(mt(i))<1e-6)continue;let o=mt(i)>0,s=i.map(a=>e.idOf(a));s.forEach((a,l)=>{let u=s[(l+1)%s.length];a!==u&&t.push(o?{u:a,v:u,room:n.id,edge:l,forward:!0}:{u,v:a,room:n.id,edge:l,forward:!1})})}return t}function Jh(r,e,t){let n=[];for(let i of r){let[o,s]=[e[i.u],e[i.v]],a=ee(s,o),l=Ve(a),u=we(a,1/l),c=e.map((d,h)=>({id:h,rel:ee(d,o)})).filter(({id:d,rel:h})=>d!==i.u&&d!==i.v&&ue(h,u)>t&&ue(h,u)<l-t&&Math.abs(Be(u,h))<=t).map(({id:d,rel:h})=>({t:ue(h,u),id:d})).sort((d,h)=>d.t-h.t),m=[{t:0,id:i.u},...c,{t:l,id:i.v}];for(let d=0;d+1<m.length;d++){let[h,g]=[m[d],m[d+1]];n.push({u:h.id,v:g.id,room:i.room,edge:i.edge,t0:i.forward?h.t:l-g.t,t1:i.forward?g.t:l-h.t,forward:i.forward})}}return n}var pl=r=>({room_id:r.room,edge:r.edge,t0:r.t0,t1:r.t1});function Qh(r,e){let t=new Map(r.map(a=>[a.id,a])),n=new Map;for(let a of e){let l=`${a.room}:${a.edge}`;n.set(l,[...n.get(l)??[],a.t0].sort((u,c)=>u-c))}let i=a=>{let l=t.get(a.room)?.wall_heights?.[a.edge];return Array.isArray(l)?l[(n.get(`${a.room}:${a.edge}`)??[]).indexOf(a.t0)]??null:l},o=a=>{let l=t.get(a.room),[u,c]=[l?.wall_heights?.[a.edge],l?.wall_slopes?.[a.edge]];if(!l||typeof u!="number"||typeof c!="number"||u<=0||c<=0)return null;let[m,d]=[l.points[a.edge],l.points[(a.edge+1)%l.points.length]];return{from:u,to:c,length:Math.hypot(d[0]-m[0],d[1]-m[1])}},s=a=>{let l=o(a);if(!l||l.length<1e-9){let c=i(a);return typeof c=="number"&&c>0?[c,c]:[null,null]}let u=c=>l.from+(l.to-l.from)*c/l.length;return a.forward?[u(a.t0),u(a.t1)]:[u(a.t1),u(a.t0)]};return{heightsOf(a){let[l,u]=[1/0,1/0];for(let m of a){let[d,h]=s(m),[g,_]=m===a[0]?[d,h]:[h,d];g!==null&&(l=Math.min(l,g)),_!==null&&(u=Math.min(u,_))}let c=a.map(m=>t.get(m.room)?.ceiling);if(c.every(m=>typeof m=="number"&&m>0)){let m=Math.max(...c);l===1/0&&(l=m),u===1/0&&(u=m)}return{...l<1/0?{a:l}:{},...u<1/0?{b:u}:{}}},thicknessOf(a){let l=a.map(u=>{let c=t.get(u.room)?.wall_thickness?.[u.edge];return Array.isArray(c)?c[(n.get(`${u.room}:${u.edge}`)??[]).indexOf(u.t0)]:c}).filter(u=>typeof u=="number"&&u>0);return l.length?Math.max(...l):void 0},hasNoWa
Line truncated
|
||||
<path d=${xr(r)} />
|
||||
</svg>`,Or={previous:"M6 6h2v12H6zM20 6v12l-10-6z",play:"M8 5v14l11-7z",pause:"M7 5h4v14H7zM13 5h4v14h-4z",next:"M16 6h2v12h-2zM4 6v12l10-6z"},mo=r=>p`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d=${r} /></svg>`,Om=24,Wm=10,po=class extends Q{static properties={hass:{attribute:!1},room:{attribute:!1},floor:{attribute:!1},confirmEntities:{attribute:!1},phrases:{attribute:!1},outside:{attribute:!1},_showAll:{state:!0},_said:{state:!0},_folded:{state:!0},_curve:{state:!0},_moodName:{state:!0},_undo:{state:!0},_energy:{state:!0},_sunYear:{state:!0},rooms:{attribute:!1},building:{attribute:!1}};saidTimer;memo=null;curveFor="";undoTimer;constructor(){super(),this.room=null,this.floor=null,this.phrases=null,this.outside=null,this._said=null,this._showAll=!1,this._folded=!1,this._curve=null,this._moodName=null,this._undo=null,this._energy=null,this._sunYear=!1,this.rooms=null,this.building=null}fireMoods(e,t){this.dispatchEvent(new CustomEvent("mood-change",{detail:{roomId:e.id,moods:t},bubbles:!0,composed:!0}))}runMood(e){for(let t of Nr(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=>U(this.hass,l).filter(u=>u.startsWith("light.")),a=()=>{let l=(this._moodName??"").trim()||this.t("mood_new");this.fireMoods(e,[...n,{id:`mood_${Date.now().toString(36)}`,name:l,lights:t.map(Cr)}]),this._moodName=null};return p`<div class="nf-rp-moods">
|
||||
${n.map(l=>p`<span class="nf-rp-mood">
|
||||
<button class="nf-btn" title=${this.t("mood_set")} @click=${()=>this.runMood(l.lights)}>✨ ${l.name}</button>
|
||||
${o.length?p`<select class="nf-rp-mood-to" aria-label=${this.t("mood_carry")} title=${this.t("mood_carry")} @change=${u=>{let c=u.target,d=o.find(m=>m.id===c.value);c.value="",d&&this.runMood(Gl(l,s(d)))}}>
|
||||
${o.length?p`<select class="nf-rp-mood-to" aria-label=${this.t("mood_carry")} title=${this.t("mood_carry")} @change=${u=>{let c=u.target,m=o.find(d=>d.id===c.value);c.value="",m&&this.runMood(ql(l,s(m)))}}>
|
||||
<option value="">→</option>
|
||||
${o.map(u=>p`<option value=${u.id}>${u.name}</option>`)}
|
||||
</select>`:f}
|
||||
@@ -271,33 +271,33 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
><input type="text" maxlength="40" placeholder=${this.t("mood_new")} .value=${this._moodName} @input=${l=>this._moodName=l.target.value} @keydown=${l=>l.key==="Enter"&&a()} />
|
||||
<button class="nf-btn" @click=${a}>${this.t("mood_save")}</button></span
|
||||
>`:f}
|
||||
</div>`}async loadCurve(e){let t=ge(this.hass,this.floor,e,"temperature"),n=t.length?t:U(this.hass,e).filter(s=>s.startsWith("climate."));if(!n.length)return;let i=Date.now(),o=i-24*36e5;try{let s=await Sn(this.hass,n,o,i,!!t.length);if(this.room?.id!==e.id)return;let a=[];for(let l=1;l<=96;l++){let u=Bt(this.hass,s,o+(i-o)*l/96),c=n.map(d=>d.startsWith("climate.")?Number(u.states[d]?.attributes.current_temperature):Number(u.states[d]?.state)).filter(Number.isFinite);a.push(c.length?c.reduce((d,m)=>d+m,0)/c.length:null)}this._curve=a.some(l=>l!==null)?a:null}catch{this._curve=null}}async loadEnergy(e){if(!this.floor||!this.building)return;if(K(this.hass)){this._energy=null;return}let t=lo(this.hass,this.building,this.floor,e);try{let n=await Il(this.hass,t);this.room?.id===e.id&&(this._energy=n)}catch{this._energy=null}}renderEmptyLights(e,t){if(!t.length||!this.room)return f;let n=U(this.hass,e).map(s=>this.hass.states[s]).filter(s=>!!s&&s.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(s.attributes.device_class)));if(!n.length||n.some(s=>s.state!=="off"))return f;let i=Math.max(...n.map(s=>Date.parse(String(s.last_changed??""))||0)),o=Math.floor((Date.now()-i)/6e4);return!i||o<Pm?f:p`<div class="nf-rp-shade">
|
||||
</div>`}async loadCurve(e){let t=ge(this.hass,this.floor,e,"temperature"),n=t.length?t:U(this.hass,e).filter(s=>s.startsWith("climate."));if(!n.length)return;let i=Date.now(),o=i-24*36e5;try{let s=await $n(this.hass,n,o,i,!!t.length);if(this.room?.id!==e.id)return;let a=[];for(let l=1;l<=96;l++){let u=Vt(this.hass,s,o+(i-o)*l/96),c=n.map(m=>m.startsWith("climate.")?Number(u.states[m]?.attributes.current_temperature):Number(u.states[m]?.state)).filter(Number.isFinite);a.push(c.length?c.reduce((m,d)=>m+d,0)/c.length:null)}this._curve=a.some(l=>l!==null)?a:null}catch{this._curve=null}}async loadEnergy(e){if(!this.floor||!this.building)return;if(K(this.hass)){this._energy=null;return}let t=co(this.hass,this.building,this.floor,e);try{let n=await Ol(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=U(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<Wm?f:p`<div class="nf-rp-shade">
|
||||
<span>💡 ${this.t("empty_lights_hint",{n:t.length,min:o})}</span>
|
||||
<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_off",{entity_id:t.map(s=>s.entity_id)})}>${this.t("empty_lights_off")}</button>
|
||||
</div>`}renderOpenWhileHeating(e){let t=this.room;if(!t||!this.floor)return f;let n=e.filter(a=>a.attributes.hvac_action==="heating"||a.state==="heat"&&a.attributes.hvac_action===void 0);if(!n.length)return f;let i=a=>!!a&&a!=="none"&&this.hass.states[a]?.state==="on",o=this.floor.openings.filter(a=>a.room_id===t.id&&[a.contact,a.contact2,a.tilt,a.tilt2].some(i));if(!o.length)return f;let s=()=>{for(let a of n)(a.attributes.hvac_modes??[]).includes("off")?this.call("climate","set_hvac_mode",{entity_id:a.entity_id,hvac_mode:"off"}):typeof a.attributes.min_temp=="number"&&this.call("climate","set_temperature",{entity_id:a.entity_id,temperature:a.attributes.min_temp})};return p`<div class="nf-rp-shade nf-rp-open-heat">
|
||||
<span>🪟 ${this.t("open_heating_hint",{n:o.length})}</span>
|
||||
<button class="nf-btn nf-rp-small" @click=${s}>${this.t("open_heating_off")}</button>
|
||||
</div>`}renderShade(){let e=this.room,{latitude:t,longitude:n}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||n===void 0)return f;let i=Z(this.hass,this.floor,e,"temperature");if(i===null||i<Hm)return f;let o=a=>{let l=a&&a!=="none"?this.hass.states[a]:void 0;if(!l||C(l))return!1;let u=l.attributes.current_position;return typeof u=="number"?u>30:l.state==="open"},s=[...new Set(Rl(this.building,this.floor,e,{latitude:t,longitude:n}).flatMap(a=>[a.cover,a.cover2].filter(o)))];return s.length?p`<div class="nf-rp-shade">
|
||||
<span>☀ ${this.t("shade_hint",{n:s.length,temp:`${W(this.hass,le(this.hass,i),1)} ${re(this.hass)}`})}</span>
|
||||
</div>`}renderShade(){let e=this.room,{latitude:t,longitude:n}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||n===void 0)return f;let i=Z(this.hass,this.floor,e,"temperature");if(i===null||i<Om)return f;let o=a=>{let l=a&&a!=="none"?this.hass.states[a]:void 0;if(!l||C(l))return!1;let u=l.attributes.current_position;return typeof u=="number"?u>30:l.state==="open"},s=[...new Set(Dl(this.building,this.floor,e,{latitude:t,longitude:n}).flatMap(a=>[a.cover,a.cover2].filter(o)))];return s.length?p`<div class="nf-rp-shade">
|
||||
<span>☀ ${this.t("shade_hint",{n:s.length,temp:`${O(this.hass,le(this.hass,i),1)} ${re(this.hass)}`})}</span>
|
||||
<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:s})}>${this.t("shade_close")}</button>
|
||||
</div>`:f}renderSunYear(){let e=this.room,{latitude:t,longitude:n}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||n===void 0)return f;let i={latitude:t,longitude:n};if(!Lt(this.building,this.floor,e,{...i,zone:this.hass.config?.time_zone}).facing.length)return f;let s=p`<button class="nf-rp-sun-year" aria-expanded=${this._sunYear} title=${this.t("room_sun_year_hint")} @click=${()=>this._sunYear=!this._sunYear}>
|
||||
☀ ${this.t("room_sun_year")}
|
||||
</button>`;if(!this._sunYear)return s;let a=El(this.building,this.floor,e,i),l=Math.max(1,...a),u=Array.from({length:12},(c,d)=>new Date(2026,d,15).toLocaleDateString(this.hass.language,{month:"narrow"}));return p`${s}
|
||||
<div class="nf-rp-sun-bars" role="img" aria-label=${a.map((c,d)=>`${u[d]} ${W(this.hass,c,1)} h`).join(", ")}>
|
||||
${a.map((c,d)=>p`<span title=${`${W(this.hass,c,1)} h`}><i style=${`height:${Math.round(c/l*100)}%`}></i><b>${u[d]}</b></span>`)}
|
||||
</div>`}renderEnergy(){let e=this._energy;if(!e||e.month<=0)return f;let t=this.building?.energy.tariff,n=t?this.hass.states[t]:void 0,i=n?{value:Number(n.state),unit:String(n.attributes.unit_of_measurement??"")}:null,o=Cl(e.month,i),s=a=>`${W(this.hass,a,a<10?2:1)} kWh`;return p`<p class="nf-rp-facts nf-rp-energy" title=${this.t("room_energy_hint")}>
|
||||
⚡ ${this.t("room_energy",{today:s(e.today),month:s(e.month)})}${o?` \xB7 ${W(this.hass,o.value,2)} ${o.currency}`:""}
|
||||
</p>`}renderCurve(){let e=this._curve;if(!e)return f;let t=e.filter(u=>u!==null),n=Math.min(...t),i=Math.max(...t),o=Math.max(1,i-n),s=e.map(u=>u===null?null:u-n+o*.1),a=$n(s,220,36,o*1.2),l=u=>`${W(this.hass,le(this.hass,u),1)}\xB0`;return p`<div class="nf-rp-curve" title=${this.t("room_curve_hint")}>
|
||||
</button>`;if(!this._sunYear)return s;let a=Tl(this.building,this.floor,e,i),l=Math.max(1,...a),u=Array.from({length:12},(c,m)=>new Date(2026,m,15).toLocaleDateString(this.hass.language,{month:"narrow"}));return p`${s}
|
||||
<div class="nf-rp-sun-bars" role="img" aria-label=${a.map((c,m)=>`${u[m]} ${O(this.hass,c,1)} h`).join(", ")}>
|
||||
${a.map((c,m)=>p`<span title=${`${O(this.hass,c,1)} h`}><i style=${`height:${Math.round(c/l*100)}%`}></i><b>${u[m]}</b></span>`)}
|
||||
</div>`}renderEnergy(){let e=this._energy;if(!e||e.month<=0)return f;let t=this.building?.energy.tariff,n=t?this.hass.states[t]:void 0,i=n?{value:Number(n.state),unit:String(n.attributes.unit_of_measurement??"")}:null,o=Wl(e.month,i),s=a=>`${O(this.hass,a,a<10?2:1)} kWh`;return p`<p class="nf-rp-facts nf-rp-energy" title=${this.t("room_energy_hint")}>
|
||||
⚡ ${this.t("room_energy",{today:s(e.today),month:s(e.month)})}${o?` \xB7 ${O(this.hass,o.value,2)} ${o.currency}`:""}
|
||||
</p>`}renderCurve(){let e=this._curve;if(!e)return f;let t=e.filter(u=>u!==null),n=Math.min(...t),i=Math.max(...t),o=Math.max(1,i-n),s=e.map(u=>u===null?null:u-n+o*.1),a=Mn(s,220,36,o*1.2),l=u=>`${O(this.hass,le(this.hass,u),1)}\xB0`;return p`<div class="nf-rp-curve" title=${this.t("room_curve_hint")}>
|
||||
<svg viewBox="0 0 220 36" preserveAspectRatio="none" aria-hidden="true">${ne`<path d=${a}></path>`}</svg>
|
||||
<span>24 h · ${l(n)} – ${l(i)}</span>
|
||||
</div>`}willUpdate(e){let t=e.get("room");e.has("room")&&t?.id!==this.room?.id&&(this._folded=!1,this._undo=null),this.room&&this.hass&&this.curveFor!==this.room.id&&(this.curveFor=this.room.id,this._curve=null,this._energy=null,this.loadCurve(this.room),this.loadEnergy(this.room))}updated(e){e.has("_folded")&&this.toggleAttribute("folded",this._folded)}t(e,t){return $(this.hass,e,t)}call(e,t,n){this.hass.callService(e,t,n)}renderClean(e){let t=e.clean_entity,n=t?this.hass.states[t]:void 0;if(!t||!n)return f;let i=t.slice(0,t.indexOf(".")),o=()=>i==="script"?this.call("script","turn_on",{entity_id:t}):this.call(i,"press",{entity_id:t});return p`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" ?disabled=${C(n)} title=${this.t("room_clean_run_hint")} @click=${o}>🧹 ${this.t("room_clean_run")}</button></div>`}allOff(e){let t=kn(e);for(let n of t.off)this.call(n.domain,n.service,n.data);this._undo=t.undo,clearTimeout(this.undoTimer),this.undoTimer=setTimeout(()=>this._undo=null,1e4)}undoAllOff(){for(let e of this._undo??[])this.call(e.domain,e.service,e.data);this._undo=null,clearTimeout(this.undoTimer)}renderAllOff(e){if(this._undo)return p`<div class="nf-rp-alloff"><span>${this.t("all_off_done")}</span><button class="nf-btn nf-rp-small" @click=${()=>this.undoAllOff()}>↶ ${this.t("all_off_undo")}</button></div>`;let{count:t}=kn(e);return t<2?f:p`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" title=${this.t("all_off_hint")} @click=${()=>this.allOff(e)}>⏻ ${this.t("all_off_n",{n:t})}</button></div>`}get areaName(){return this.room?.area_id?this.hass.areas?.[this.room.area_id]?.name:void 0}placedAs(e){for(let t of this.building?.floors??[])for(let n of t.placements)if(n.entity_id===e)return n}name(e){return this.placedAs(e)?.name?.trim()||L(this.hass,e,this.areaName)}nameButton(e){return p`<button class="nf-rp-name" title=${this.t("details")} @click=${()=>we(this,e)}>${this.name(e)}</button>`}askFor(e){return!this.confirmEntities?.has(e)||confirm(this.t("confirm_switch",{name:this.name(e)}))}toggle(e,t,n){let i=()=>{this.confirmEntities?.has(e.entity_id)&&!confirm(this.t("confirm_switch",{name:this.name(e.entity_id)}))||n()};return p`<button
|
||||
</div>`}willUpdate(e){let t=e.get("room");e.has("room")&&t?.id!==this.room?.id&&(this._folded=!1,this._undo=null),this.room&&this.hass&&this.curveFor!==this.room.id&&(this.curveFor=this.room.id,this._curve=null,this._energy=null,this.loadCurve(this.room),this.loadEnergy(this.room))}updated(e){e.has("_folded")&&this.toggleAttribute("folded",this._folded)}t(e,t){return $(this.hass,e,t)}call(e,t,n){this.hass.callService(e,t,n)}renderClean(e){let t=e.clean_entity,n=t?this.hass.states[t]:void 0;if(!t||!n)return f;let i=t.slice(0,t.indexOf(".")),o=()=>i==="script"?this.call("script","turn_on",{entity_id:t}):this.call(i,"press",{entity_id:t});return p`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" ?disabled=${C(n)} title=${this.t("room_clean_run_hint")} @click=${o}>🧹 ${this.t("room_clean_run")}</button></div>`}allOff(e){let t=Sn(e);for(let n of t.off)this.call(n.domain,n.service,n.data);this._undo=t.undo,clearTimeout(this.undoTimer),this.undoTimer=setTimeout(()=>this._undo=null,1e4)}undoAllOff(){for(let e of this._undo??[])this.call(e.domain,e.service,e.data);this._undo=null,clearTimeout(this.undoTimer)}renderAllOff(e){if(this._undo)return p`<div class="nf-rp-alloff"><span>${this.t("all_off_done")}</span><button class="nf-btn nf-rp-small" @click=${()=>this.undoAllOff()}>↶ ${this.t("all_off_undo")}</button></div>`;let{count:t}=Sn(e);return t<2?f:p`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" title=${this.t("all_off_hint")} @click=${()=>this.allOff(e)}>⏻ ${this.t("all_off_n",{n:t})}</button></div>`}get areaName(){return this.room?.area_id?this.hass.areas?.[this.room.area_id]?.name:void 0}placedAs(e){for(let t of this.building?.floors??[])for(let n of t.placements)if(n.entity_id===e)return n}name(e){return this.placedAs(e)?.name?.trim()||W(this.hass,e,this.areaName)}nameButton(e){return p`<button class="nf-rp-name" title=${this.t("details")} @click=${()=>ye(this,e)}>${this.name(e)}</button>`}askFor(e){return!this.confirmEntities?.has(e)||confirm(this.t("confirm_switch",{name:this.name(e)}))}toggle(e,t,n){let i=()=>{this.confirmEntities?.has(e.entity_id)&&!confirm(this.t("confirm_switch",{name:this.name(e.entity_id)}))||n()};return p`<button
|
||||
class="nf-switch"
|
||||
role="switch"
|
||||
aria-checked=${t?"true":"false"}
|
||||
aria-label=${this.name(e.entity_id)}
|
||||
?disabled=${C(e)}
|
||||
@click=${i}
|
||||
></button>`}outsideRoom=null;render(){let e=!this.room&&this.outside?this.outside:null;e&&!this.outsideRoom&&(this.outsideRoom={id:"nf-outside",name:this.t("outside_area"),area_id:null,points:[],floor_material:"grass"});let t=this.room??(e?this.outsideRoom:null);if(!t||!this.hass)return f;let n=e??U(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?ya(this.hass,this.floor,t):{shown:n,more:[]}},a=Ii(this.hass,s).map(R=>R.primary),l=a.length,u=[t.floor_heating,...Object.values(t.hvac??{}).flat()].filter(R=>!!R&&R!=="none"),c=new Set(u.map(R=>this.hass.states[R]?.attributes.symcon_id).filter(Boolean)),d=(this._showAll?[...o,...a]:o).filter(R=>!K(this.hass)||!c.has(this.hass.states[R]?.attributes.symcon_id)),m=R=>d.filter(F=>R.includes(H(F))).map(F=>this.hass.states[F]),h=m(["light"]),g=m(["cover"]),_=m(["climate"]),b=m(["media"]),v=m(["switch","fan","lock"]),S=m(["sensor","binary"]),k=m(["scene","script"]),M=this.facts(_),z=h.filter(R=>R.state==="on");return p`<section class="nf-rp" aria-label=${t.name}>
|
||||
></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??U(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?Sa(this.hass,this.floor,t):{shown:n,more:[]}},a=Ni(this.hass,s).map(R=>R.primary),l=a.length,u=[t.floor_heating,...Object.values(t.hvac??{}).flat()].filter(R=>!!R&&R!=="none"),c=new Set(u.map(R=>this.hass.states[R]?.attributes.symcon_id).filter(Boolean)),m=(this._showAll?[...o,...a]:o).filter(R=>!K(this.hass)||!c.has(this.hass.states[R]?.attributes.symcon_id)),d=R=>m.filter(F=>R.includes(P(F))).map(F=>this.hass.states[F]),h=d(["light"]),g=d(["cover"]),_=d(["climate"]),b=d(["media"]),v=d(["switch","fan","lock"]),S=d(["sensor","binary"]),k=d(["scene","script"]),M=this.facts(_),z=h.filter(R=>R.state==="on");return p`<section class="nf-rp" aria-label=${t.name}>
|
||||
<header class="nf-rp-head">
|
||||
<div>
|
||||
<h2>${t.name}</h2>
|
||||
@@ -313,15 +313,15 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
</button>
|
||||
</header>
|
||||
<div class="nf-rp-body" ?hidden=${this._folded}>
|
||||
<nf-utility-report .hass=${this.hass} .readings=${Ct(this.hass,t,this.building?.floors.flatMap(R=>R.rooms))}></nf-utility-report>
|
||||
<nf-utility-report .hass=${this.hass} .readings=${Nt(this.hass,t,this.building?.floors.flatMap(R=>R.rooms))}></nf-utility-report>
|
||||
${this.renderAllOff([...h,...b,...v])}
|
||||
${this.renderClean(t)}
|
||||
${!t.area_id&&!e&&!(K(this.hass)&&u.length)?p`<p class="nf-rp-note">${this.t("panel_no_area")}</p>`:!d.length&&!(K(this.hass)&&u.length)?p`<p class="nf-rp-note">${this.t("panel_empty")}</p>`:f}
|
||||
${!t.area_id&&!e&&!(K(this.hass)&&u.length)?p`<p class="nf-rp-note">${this.t("panel_no_area")}</p>`:!m.length&&!(K(this.hass)&&u.length)?p`<p class="nf-rp-note">${this.t("panel_empty")}</p>`:f}
|
||||
${k.length?this.section("panel_scenes",[p`<div class="nf-rp-scenes">
|
||||
${k.map(R=>p`<button
|
||||
class="nf-btn"
|
||||
?disabled=${C(R)}
|
||||
@click=${()=>this.call(H(R.entity_id)==="scene"?"scene":"script","turn_on",{entity_id:R.entity_id})}
|
||||
@click=${()=>this.call(P(R.entity_id)==="scene"?"scene":"script","turn_on",{entity_id:R.entity_id})}
|
||||
>
|
||||
${this.name(R.entity_id)}
|
||||
</button>`)}
|
||||
@@ -331,9 +331,9 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
</button>`:f}${z.length?p`<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_off",{entity_id:z.map(R=>R.entity_id)})}>
|
||||
${this.t("panel_all_off")}
|
||||
</button>`:f}`):f}
|
||||
${g.length?this.section("panel_covers",g.map(R=>this.coverRow(R)),g.length>1&&ar(g,this.confirmEntities).length?p`<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","open_cover",{entity_id:ar(g,this.confirmEntities)})}>
|
||||
${g.length?this.section("panel_covers",g.map(R=>this.coverRow(R)),g.length>1&&lr(g,this.confirmEntities).length?p`<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","open_cover",{entity_id:lr(g,this.confirmEntities)})}>
|
||||
${this.t("panel_all_open")}</button
|
||||
><button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:ar(g,this.confirmEntities)})}>
|
||||
><button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:lr(g,this.confirmEntities)})}>
|
||||
${this.t("panel_all_close")}
|
||||
</button>`:f):f}
|
||||
${K(this.hass)?p`<nf-room-hvac .hass=${this.hass} .room=${t}></nf-room-hvac>`:f}
|
||||
@@ -342,38 +342,38 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${v.length?this.section("panel_switches",v.map(R=>this.switchRow(R))):f}
|
||||
${S.length?this.section("panel_sensors",S.map(R=>this.sensorRow(R))):f}
|
||||
${this.extraValues(t)}
|
||||
${!K(this.hass)&&Ya(this.hass)&&Za(this.hass,this.floor,t)?this.announceSection(t):f}
|
||||
${this.pluginSections(t,d)}
|
||||
${!K(this.hass)&&Xa(this.hass)&&Qa(this.hass,this.floor,t)?this.announceSection(t):f}
|
||||
${this.pluginSections(t,m)}
|
||||
${l?p`<button class="nf-btn nf-rp-small nf-rp-more" @click=${()=>this._showAll=!this._showAll}>
|
||||
${this._showAll?this.t("panel_less"):this.t("panel_more",{n:l})}
|
||||
</button>`:f}
|
||||
</div>
|
||||
</section>`}extraValues(e){if(!this.floor)return f;let t=[...this.floor.placements.filter(n=>!n.outside&&I([n.x,n.z],e.points)).map(n=>({name:n.name||L(this.hass,n.entity_id),rows:xr(this.hass,n.values)})),...this.floor.furniture.filter(n=>I([n.x,n.z],e.points)).map(n=>({name:n.name||(n.entity&&n.entity!=="none"?L(this.hass,n.entity):this.t("device")),rows:xr(this.hass,n.values)}))].filter(n=>n.rows.length);return t.length?this.section("device_values",t.map(n=>p`<div class="nf-extra-values"><b>${n.name}</b>${n.rows.map(i=>p`<div class="nf-rp-row"><span class="nf-rp-icon">${i.icon}</span><span class="nf-rp-name">${i.label}</span><b class="nf-rp-state">${i.text}${G(this.hass,[i.entity],i.label)}</b></div>`)}</div>`)):f}facts(e){let t=[],n=this.room;if(!n)return t;let i=(T,E)=>{let A=Z(this.hass,this.floor,n,T);if(A===null)return null;if(T==="temperature")return`${W(this.hass,le(this.hass,A),1)} ${re(this.hass)}`;let P=ge(this.hass,this.floor,n,T)[0],N=this.hass.states[P]?.attributes.unit_of_measurement??E;return`${W(this.hass,A,1)} ${N}`},o=e.find(T=>typeof T.attributes.current_temperature=="number"),s=i("temperature","\xB0C");s?t.push(p`${s}${G(this.hass,ge(this.hass,this.floor,n,"temperature"),"Temperatur")}`):o&&n.climate?.temperature!=="none"&&t.push(p`${W(this.hass,o.attributes.current_temperature,1)} ${re(this.hass)}${G(this.hass,[o.entity_id],"Temperatur")}`);let a=i("humidity","%");a&&t.push(p`${a}${G(this.hass,ge(this.hass,this.floor,n,"humidity"),"Luftfeuchte")}`);let l=Z(this.hass,this.floor??null,n,"illuminance");l!==null&&t.push(p`☀ ${W(this.hass,l,0)} lx${G(this.hass,ge(this.hass,this.floor,n,"illuminance"),"Helligkeit")}`);let u=Ct(this.hass,n,this.building?.floors.flatMap(T=>T.rooms)).find(T=>T.kind==="electricity"&&T.metric==="power"&&T.unit==="W"),c=!u&&this.floor&&this.building?ao(this.hass,this.building,this.floor,n):null;u?t.push(p`⚡ ${Fe(this.hass,u)}${G(this.hass,u.sources,"Leistung")}`):c!==null&&t.push(`\u26A1 ${bt(this.hass,c)}`);let d=this.floor?this.floor.openings.filter(T=>T.room_id===n.id).flatMap(T=>[T.contact,T.contact2,T.tilt,T.tilt2]).map(T=>T&&T!=="none"?this.hass.states[T]:void 0).filter(T=>T?.state==="on").map(T=>Date.parse(String(T.last_changed??""))).filter(Number.isFinite):[];d.length&&t.push(`\u{1FA9F} ${this.t("open_since",{time:uo(Date.now()-Math.min(...d))})}`);let m=U(this.hass,n).map(T=>this.hass.states[T]).filter(T=>!!T&&T.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(T.attributes.device_class)));if(m.length)if(m.some(T=>T.state==="on"))t.push(`\u{1F6B6} ${this.t("presence_now")}`);else{let T=Math.max(...m.map(E=>Date.parse(String(E.last_changed??""))||0));T>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:uo(Date.now()-T)})}`)}let h=this.building?Ll(this.hass,this.building).filter(T=>T.roomId===n.id&&T.level<Wl):[];h.length&&t.push(`\u{1FAAB} ${this.t("battery_low_n",{n:h.length,names:h.map(T=>`${this.name(T.entity)} ${Math.round(T.level)} %`).join(", ")})}`);let g=(this.building?.settings.circuits??[]).filter(T=>T.rooms.includes(n.id)).map(T=>T.name),_=this.building?.settings.room_facts_off??[];g.length&&!_.includes("circuits")&&t.push(`\u{1F50C} ${g.join(", ")}`);let{latitude:b,longitude:v,time_zone:S}=this.hass.config??{};if(this.floor&&b!==void 0&&v!==void 0&&this.building&&!_.includes("sun")){let T=Lt(this.building,this.floor,n,{latitude:b,longitude:v,zone:S});T.facing.length&&t.push(`\u2600 ${this.t("room_sun_hours",{h:W(this.hass,T.hours,1),facing:T.facing.join(", ")})}`)}let k=Z(this.hass,this.floor,n,"temperature"),M=Z(this.hass,this.floor,n,"humidity"),z=Fr(Z(this.hass,this.floor,n,"co2"),M,Ot(k,M));z&&!_.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${z}`)}`);let R=Hr(k,M,Z(this.hass,this.floor,n,"co2"),_t(new Date,this.hass.config?.latitude)),F=n.hvac?.status;return F&&F!=="none"?t.push(p`${nt(this.hass.states[F])}${G(this.hass,[F],"Raumstatus")}`):R!==null&&(k!==null||M!==null)&&!_.includes("comfort")&&t.push(`\u{1F60A} ${this.t("comfort_n",{n:R})}`),t}announceSection(e){let t=this.phrases?.length?this.phrases:[1,2,3,4,5].map(o=>this.t(`announce_phrase_${o}`)),n=o=>{let s=o.trim();s&&(clearTimeout(this.saidTimer),this.hass.callService("nextfloor","announce",{message:s,rooms:[e.id],on_screens:!1}).then(()=>this._said={text:this.t("announce_sent",{message:s}),failed:!1},a=>this._said={text:this.t("announce_failed",{error:a?.message??String(a)}),failed:!0}),this.saidTimer=setTimeout(()=>this._said=null,6e3))},i=o=>{o.preventDefault();let s=o.currentTarget.querySelector("input");n(s.value),s.value=""};return this.section("panel_announce",[p`<div class="nf-rp-scenes">${t.map(o=>p`<button class="nf-btn" @click=${()=>n(o)}>${o}</button>`)}</div>
|
||||
</section>`}extraValues(e){if(!this.floor)return f;let t=[...this.floor.placements.filter(n=>!n.outside&&H([n.x,n.z],e.points)).map(n=>({name:n.name||W(this.hass,n.entity_id),rows:kr(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:kr(this.hass,n.values)}))].filter(n=>n.rows.length);return t.length?this.section("device_values",t.map(n=>p`<div class="nf-extra-values"><b>${n.name}</b>${n.rows.map(i=>p`<div class="nf-rp-row"><span class="nf-rp-icon">${i.icon}</span><span class="nf-rp-name">${i.label}</span><b class="nf-rp-state">${i.text}${G(this.hass,[i.entity],i.label)}</b></div>`)}</div>`)):f}facts(e){let t=[],n=this.room;if(!n)return t;let i=(T,E)=>{let A=Z(this.hass,this.floor,n,T);if(A===null)return null;if(T==="temperature")return`${O(this.hass,le(this.hass,A),1)} ${re(this.hass)}`;let I=ge(this.hass,this.floor,n,T)[0],N=this.hass.states[I]?.attributes.unit_of_measurement??E;return`${O(this.hass,A,1)} ${N}`},o=e.find(T=>typeof T.attributes.current_temperature=="number"),s=i("temperature","\xB0C");s?t.push(p`${s}${G(this.hass,ge(this.hass,this.floor,n,"temperature"),"Temperatur")}`):o&&n.climate?.temperature!=="none"&&t.push(p`${O(this.hass,o.attributes.current_temperature,1)} ${re(this.hass)}${G(this.hass,[o.entity_id],"Temperatur")}`);let a=i("humidity","%");a&&t.push(p`${a}${G(this.hass,ge(this.hass,this.floor,n,"humidity"),"Luftfeuchte")}`);let l=Z(this.hass,this.floor??null,n,"illuminance");l!==null&&t.push(p`☀ ${O(this.hass,l,0)} lx${G(this.hass,ge(this.hass,this.floor,n,"illuminance"),"Helligkeit")}`);let u=Nt(this.hass,n,this.building?.floors.flatMap(T=>T.rooms)).find(T=>T.kind==="electricity"&&T.metric==="power"&&T.unit==="W"),c=!u&&this.floor&&this.building?uo(this.hass,this.building,this.floor,n):null;u?t.push(p`⚡ ${Fe(this.hass,u)}${G(this.hass,u.sources,"Leistung")}`):c!==null&&t.push(`\u26A1 ${bt(this.hass,c)}`);let m=this.floor?this.floor.openings.filter(T=>T.room_id===n.id).flatMap(T=>[T.contact,T.contact2,T.tilt,T.tilt2]).map(T=>T&&T!=="none"?this.hass.states[T]:void 0).filter(T=>T?.state==="on").map(T=>Date.parse(String(T.last_changed??""))).filter(Number.isFinite):[];m.length&&t.push(`\u{1FA9F} ${this.t("open_since",{time:ho(Date.now()-Math.min(...m))})}`);let d=U(this.hass,n).map(T=>this.hass.states[T]).filter(T=>!!T&&T.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(T.attributes.device_class)));if(d.length)if(d.some(T=>T.state==="on"))t.push(`\u{1F6B6} ${this.t("presence_now")}`);else{let T=Math.max(...d.map(E=>Date.parse(String(E.last_changed??""))||0));T>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:ho(Date.now()-T)})}`)}let h=this.building?Vl(this.hass,this.building).filter(T=>T.roomId===n.id&&T.level<Bl):[];h.length&&t.push(`\u{1FAAB} ${this.t("battery_low_n",{n:h.length,names:h.map(T=>`${this.name(T.entity)} ${Math.round(T.level)} %`).join(", ")})}`);let g=(this.building?.settings.circuits??[]).filter(T=>T.rooms.includes(n.id)).map(T=>T.name),_=this.building?.settings.room_facts_off??[];g.length&&!_.includes("circuits")&&t.push(`\u{1F50C} ${g.join(", ")}`);let{latitude:b,longitude:v,time_zone:S}=this.hass.config??{};if(this.floor&&b!==void 0&&v!==void 0&&this.building&&!_.includes("sun")){let T=Lt(this.building,this.floor,n,{latitude:b,longitude:v,zone:S});T.facing.length&&t.push(`\u2600 ${this.t("room_sun_hours",{h:O(this.hass,T.hours,1),facing:T.facing.join(", ")})}`)}let k=Z(this.hass,this.floor,n,"temperature"),M=Z(this.hass,this.floor,n,"humidity"),z=Hr(Z(this.hass,this.floor,n,"co2"),M,Bt(k,M));z&&!_.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${z}`)}`);let R=Pr(k,M,Z(this.hass,this.floor,n,"co2"),_t(new Date,this.hass.config?.latitude)),F=n.hvac?.status;return F&&F!=="none"?t.push(p`${nt(this.hass.states[F])}${G(this.hass,[F],"Raumstatus")}`):R!==null&&(k!==null||M!==null)&&!_.includes("comfort")&&t.push(`\u{1F60A} ${this.t("comfort_n",{n:R})}`),t}announceSection(e){let t=this.phrases?.length?this.phrases:[1,2,3,4,5].map(o=>this.t(`announce_phrase_${o}`)),n=o=>{let s=o.trim();s&&(clearTimeout(this.saidTimer),this.hass.callService("nextfloor","announce",{message:s,rooms:[e.id],on_screens:!1}).then(()=>this._said={text:this.t("announce_sent",{message:s}),failed:!1},a=>this._said={text:this.t("announce_failed",{error:a?.message??String(a)}),failed:!0}),this.saidTimer=setTimeout(()=>this._said=null,6e3))},i=o=>{o.preventDefault();let s=o.currentTarget.querySelector("input");n(s.value),s.value=""};return this.section("panel_announce",[p`<div class="nf-rp-scenes">${t.map(o=>p`<button class="nf-btn" @click=${()=>n(o)}>${o}</button>`)}</div>
|
||||
<form class="nf-rp-say" @submit=${i}>
|
||||
<input type="text" maxlength="500" placeholder=${this.t("announce_placeholder")} aria-label=${this.t("announce_placeholder")} />
|
||||
<button class="nf-btn nf-primary" type="submit">${this.t("announce_send")}</button>
|
||||
</form>
|
||||
${this._said?p`<p class="nf-rp-note ${this._said.failed?"nf-rp-fail":""}" role="status">${this._said.text}</p>`:f}`])}pluginSections(e,t){return Ds({hass:this.hass,room:{id:e.id,name:e.name,area_id:e.area_id??null},entities:t}).map(i=>p`<div class="nf-rp-sec nf-rp-plugin" data-plugin=${i.key}>
|
||||
${this._said?p`<p class="nf-rp-note ${this._said.failed?"nf-rp-fail":""}" role="status">${this._said.text}</p>`:f}`])}pluginSections(e,t){return Ps({hass:this.hass,room:{id:e.id,name:e.name,area_id:e.area_id??null},entities:t}).map(i=>p`<div class="nf-rp-sec nf-rp-plugin" data-plugin=${i.key}>
|
||||
<div class="nf-rp-sec-head"><h3>${i.title}</h3></div>
|
||||
${typeof i.content=="string"?p`<p class="nf-rp-note">${i.content}</p>`:i.content}
|
||||
</div>`)}section(e,t,n=f){return p`<div class="nf-rp-sec">
|
||||
<div class="nf-rp-sec-head"><h3>${this.t(e)}</h3>${n}</div>
|
||||
${t}
|
||||
</div>`}lightRow(e){let t=e.attributes,n=e.state==="on",i=t.supported_color_modes??[],o=i.some(h=>h!=="onoff"),s=i.includes("color_temp"),a=i.some(h=>["hs","rgb","rgbw","rgbww","xy"].includes(h)),l=typeof t.brightness=="number"?Math.round(t.brightness/255*100):100,u=t.min_color_temp_kelvin??2200,c=t.max_color_temp_kelvin??6500,d=e.entity_id,m=!!this.placedAs(d)?.simple;return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon ${n?"nf-rp-on":""}">${Vt("light")}</span>
|
||||
${this.nameButton(d)}
|
||||
</div>`}lightRow(e){let t=e.attributes,n=e.state==="on",i=t.supported_color_modes??[],o=i.some(h=>h!=="onoff"),s=i.includes("color_temp"),a=i.some(h=>["hs","rgb","rgbw","rgbww","xy"].includes(h)),l=typeof t.brightness=="number"?Math.round(t.brightness/255*100):100,u=t.min_color_temp_kelvin??2200,c=t.max_color_temp_kelvin??6500,m=e.entity_id,d=!!this.placedAs(m)?.simple;return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon ${n?"nf-rp-on":""}">${Kt("light")}</span>
|
||||
${this.nameButton(m)}
|
||||
<span class="nf-rp-state">${this.stateOf(e)}${G(this.hass,[e.entity_id])}</span>
|
||||
${this.toggle(e,n,()=>this.call("light","toggle",{entity_id:d}))}
|
||||
${o&&!m?p`<label class="nf-rp-slider"
|
||||
${this.toggle(e,n,()=>this.call("light","toggle",{entity_id:m}))}
|
||||
${o&&!d?p`<label class="nf-rp-slider"
|
||||
><span>${this.t("brightness")}</span>
|
||||
<input
|
||||
type="range"
|
||||
min="1"
|
||||
max="100"
|
||||
.value=${String(l)}
|
||||
@change=${h=>this.call("light","turn_on",{entity_id:d,brightness_pct:Number(h.target.value)})}
|
||||
@change=${h=>this.call("light","turn_on",{entity_id:m,brightness_pct:Number(h.target.value)})}
|
||||
/></label>`:f}
|
||||
${n&&s&&!m?p`<label class="nf-rp-slider nf-rp-ct"
|
||||
${n&&s&&!d?p`<label class="nf-rp-slider nf-rp-ct"
|
||||
><span>${this.t("color_temp")}</span>
|
||||
<input
|
||||
type="range"
|
||||
@@ -381,26 +381,26 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
max=${c}
|
||||
step="50"
|
||||
.value=${String(t.color_temp_kelvin??u)}
|
||||
@change=${h=>this.call("light","turn_on",{entity_id:d,color_temp_kelvin:Number(h.target.value)})}
|
||||
@change=${h=>this.call("light","turn_on",{entity_id:m,color_temp_kelvin:Number(h.target.value)})}
|
||||
/></label>`:f}
|
||||
${n&&a&&!m?p`<div class="nf-rp-swatches" role="group" aria-label=${this.t("color")}>
|
||||
${Fm.map(h=>p`<button
|
||||
${n&&a&&!d?p`<div class="nf-rp-swatches" role="group" aria-label=${this.t("color")}>
|
||||
${Nm.map(h=>p`<button
|
||||
class="nf-rp-swatch"
|
||||
style="--c: rgb(${h.join(",")})"
|
||||
aria-label="rgb(${h.join(", ")})"
|
||||
@click=${()=>this.call("light","turn_on",{entity_id:d,rgb_color:h})}
|
||||
@click=${()=>this.call("light","turn_on",{entity_id:m,rgb_color:h})}
|
||||
></button>`)}
|
||||
</div>`:f}
|
||||
</div>`}coverRow(e){let t=_r(this.hass,this.building?.floors??[],e.entity_id);e=br(this.hass,e,t);let n=e.attributes,i=n.supported_features??0,o=e.entity_id,s=C(e)&&!un(e);return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon">${Vt("cover")}</span>
|
||||
</div>`}coverRow(e){let t=br(this.hass,this.building?.floors??[],e.entity_id);e=vr(this.hass,e,t);let n=e.attributes,i=n.supported_features??0,o=e.entity_id,s=C(e)&&!cn(e);return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon">${Kt("cover")}</span>
|
||||
${this.nameButton(o)}
|
||||
<span class="nf-rp-state">${this.stateOf(e)}${G(this.hass,[e.entity_id])}</span>
|
||||
<div class="nf-rp-buttons">
|
||||
<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.askFor(o)&&this.call("cover","open_cover",{entity_id:o})}>${this.t("cover_open")}</button>
|
||||
${i&Dm?p`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","stop_cover",{entity_id:o})}>${this.t("cover_stop")}</button>`:f}
|
||||
${i&Cm?p`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","stop_cover",{entity_id:o})}>${this.t("cover_stop")}</button>`:f}
|
||||
<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.askFor(o)&&this.call("cover","close_cover",{entity_id:o})}>${this.t("cover_close")}</button>
|
||||
</div>
|
||||
${i&Tm&&typeof n.current_position=="number"?p`<label class="nf-rp-slider"
|
||||
${i&Im&&typeof n.current_position=="number"?p`<label class="nf-rp-slider"
|
||||
><span>${this.t("position")}</span>
|
||||
<input
|
||||
type="range"
|
||||
@@ -424,12 +424,12 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${i&32?p`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","close_cover_tilt",{entity_id:o})}>${this.t("cover_tilt_close")}</button>`:f}
|
||||
</div>`:f}
|
||||
</div>`}climateRow(e){let t=e.attributes,n=e.entity_id,i=typeof t.temperature=="number"?t.temperature:null,o=t.target_temp_step??.5,s=t.min_temp??5,a=t.max_temp??30,l=t.hvac_modes??[],u=c=>this.call("climate","set_temperature",{entity_id:n,temperature:Math.min(a,Math.max(s,Math.round(c/o)*o))});return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon ${t.hvac_action==="heating"?"nf-rp-on":""}">${Vt("climate")}</span>
|
||||
<span class="nf-rp-icon ${t.hvac_action==="heating"?"nf-rp-on":""}">${Kt("climate")}</span>
|
||||
${this.nameButton(n)}
|
||||
<span class="nf-rp-state">${this.stateOf(e)}${G(this.hass,[e.entity_id])}</span>
|
||||
${i!==null?p`<div class="nf-rp-stepper nf-rp-wide">
|
||||
<button class="nf-btn" aria-label=${this.t("temp_down")} @click=${()=>u(i-o)}>−</button>
|
||||
<span><small>${this.t("target_temp")}</small> ${W(this.hass,i,1)} ${re(this.hass)}</span>
|
||||
<span><small>${this.t("target_temp")}</small> ${O(this.hass,i,1)} ${re(this.hass)}</span>
|
||||
<button class="nf-btn" aria-label=${this.t("temp_up")} @click=${()=>u(i+o)}>+</button>
|
||||
</div>`:f}
|
||||
${l.length>1?p`<div class="nf-rp-chips">
|
||||
@@ -441,20 +441,20 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${this.stateLabel(c)}
|
||||
</button>`)}
|
||||
</div>`:f}
|
||||
</div>`}stateOf(e,t=oe(this.hass,e)){if(this.room?.no_state?.includes(e.entity_id))return"";let n=H(e.entity_id);return e.state==="unknown"&&n!=="sensor"&&n!=="binary"?"":t}stateLabel(e){let t=`state_${e}`,n=this.t(t);return n===t?e:n}mediaRow(e){let t=e.attributes,n=e.entity_id,i=C(e)||e.state==="off",o=[t.media_title,t.media_artist].filter(s=>typeof s=="string"&&s).join(" \xB7 ");return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon ${e.state==="playing"?"nf-rp-on":""}">${Vt("media")}</span>
|
||||
</div>`}stateOf(e,t=se(this.hass,e)){if(this.room?.no_state?.includes(e.entity_id))return"";let n=P(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=C(e)||e.state==="off",o=[t.media_title,t.media_artist].filter(s=>typeof s=="string"&&s).join(" \xB7 ");return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon ${e.state==="playing"?"nf-rp-on":""}">${Kt("media")}</span>
|
||||
${this.nameButton(n)}
|
||||
<span class="nf-rp-state">${this.stateOf(e,this.stateLabel(e.state))}${G(this.hass,[e.entity_id])}</span>
|
||||
${o?p`<p class="nf-rp-media nf-rp-wide">${o}</p>`:f}
|
||||
<div class="nf-rp-buttons nf-rp-wide">
|
||||
<button class="nf-btn nf-rp-small" aria-label=${this.t("previous")} ?disabled=${i} @click=${()=>this.call("media_player","media_previous_track",{entity_id:n})}>
|
||||
${co(Nr.previous)}
|
||||
${mo(Or.previous)}
|
||||
</button>
|
||||
<button class="nf-btn nf-rp-small" aria-label=${this.t("play_pause")} ?disabled=${C(e)} @click=${()=>this.call("media_player","media_play_pause",{entity_id:n})}>
|
||||
${co(e.state==="playing"?Nr.pause:Nr.play)}
|
||||
${mo(e.state==="playing"?Or.pause:Or.play)}
|
||||
</button>
|
||||
<button class="nf-btn nf-rp-small" aria-label=${this.t("next")} ?disabled=${i} @click=${()=>this.call("media_player","media_next_track",{entity_id:n})}>
|
||||
${co(Nr.next)}
|
||||
${mo(Or.next)}
|
||||
</button>
|
||||
</div>
|
||||
${typeof t.volume_level=="number"?p`<label class="nf-rp-slider"
|
||||
@@ -466,13 +466,13 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.value=${String(Math.round(t.volume_level*100))}
|
||||
@change=${s=>this.call("media_player","volume_set",{entity_id:n,volume_level:Number(s.target.value)/100})}
|
||||
/></label>`:f}
|
||||
</div>`}switchRow(e){let t=e.entity_id,n=H(t),i=t.slice(0,t.indexOf(".")),o=n==="lock"?e.state==="unlocked"||e.state==="open":te(e),s=()=>n==="lock"?this.call("lock",o?"lock":"unlock",{entity_id:t}):this.call(i,"toggle",{entity_id:t});return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon ${o?"nf-rp-on":""}">${Vt(n)}</span>
|
||||
</div>`}switchRow(e){let t=e.entity_id,n=P(t),i=t.slice(0,t.indexOf(".")),o=n==="lock"?e.state==="unlocked"||e.state==="open":te(e),s=()=>n==="lock"?this.call("lock",o?"lock":"unlock",{entity_id:t}):this.call(i,"toggle",{entity_id:t});return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon ${o?"nf-rp-on":""}">${Kt(n)}</span>
|
||||
${this.nameButton(t)}
|
||||
<span class="nf-rp-state">${this.stateOf(e)}${G(this.hass,[e.entity_id])}</span>
|
||||
${this.toggle(e,o,s)}
|
||||
</div>`}sensorRow(e){let t=H(e.entity_id),n=t==="binary"&&e.state==="on";return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon ${n?"nf-rp-on":""}">${Vt(t)}</span>
|
||||
</div>`}sensorRow(e){let t=P(e.entity_id),n=t==="binary"&&e.state==="on";return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon ${n?"nf-rp-on":""}">${Kt(t)}</span>
|
||||
${this.nameButton(e.entity_id)}
|
||||
<span class="nf-rp-state">${this.stateOf(e)}${G(this.hass,[e.entity_id])}</span>
|
||||
</div>`}fire(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))}static styles=[_e,ze,J`
|
||||
@@ -856,38 +856,38 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
outline: 2px solid var(--nf-accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
`]};customElements.get("nf-room-panel")||customElements.define("nf-room-panel",ho);function Jl(r){if(!r)return"";let e=Math.min(.8,Math.max(0,r.dim??.35)),t=r.image&&/^(https:\/\/|\/local\/|\/api\/)[^"'()\\\s]+$/.test(r.image)?r.image:null,n=r.color&&/^#[0-9a-f]{6}$/i.test(r.color)?r.color:null;return t?`;background:linear-gradient(rgba(0,0,0,${e}),rgba(0,0,0,${e})),center / cover no-repeat url("${t}")${n?` ${n}`:""}`:n?`;background:${n}`:""}var Im=[[/spotify/i,[30,215,96]],[/netflix/i,[229,9,20]],[/youtube/i,[255,0,51]],[/prime|amazon/i,[0,168,225]],[/disney/i,[17,60,207]],[/apple ?music|itunes/i,[250,45,72]],[/apple ?tv/i,[200,200,210]],[/plex/i,[229,160,13]],[/tidal/i,[0,255,255]],[/deezer/i,[162,56,255]],[/radio|tunein/i,[255,140,60]]],Ql=[34,211,238];function mo(r){return r?Im.find(([e])=>e.test(r))?.[1]??Ql:Ql}function po(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 fo=r=>r.state==="playing"||r.state==="on"&&po(r);function Xl(r,e){let t=[],n=new Set;for(let i of e){if(!i.entity.startsWith("media_player.")||n.has(i.entity))continue;n.add(i.entity);let o=r.states[i.entity];if(!o)continue;let s=o.attributes,a=c=>typeof s[c]=="string"?s[c]:"",l=a("app_name")||a("source")||a("app_id")||null,u=typeof s.volume_level=="number"?s.volume_level:null;t.push({entity:i.entity,name:i.name,at:i.at,playing:fo(o),title:a("media_title")||a("media_channel")||l||"",artist:a("media_artist")||a("media_album_name")||a("media_series_title"),picture:a("entity_picture")||null,volume:u,color:mo(l),app:l,group:Array.isArray(s.group_members)?s.group_members.filter(c=>typeof c=="string"&&c!==i.entity):[],rings:i.rings??1})}return t}function eu(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 Cm=3;function tu(r,e,t){let n=[];for(let i of e.floors)for(let o of i.furniture){if(!o.type.endsWith(":sprinkler"))continue;let s=t?.get(o.id)?.entity??null;!s||!te(r.states[s])||n.push({id:o.id,at:{floorId:i.id,x:o.x,y:ae(i,o)+o.h,z:o.z},reach:Math.min(15,Math.max(.5,o.spray??Cm))})}return n}var Wr=r=>r&&r!=="none"?r:null,nu=r=>Math.min(1,Math.max(0,r));function ru(r,e){let t=new Map;for(let n of e.settings.roof?.windows??[]){let i=We(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&&!C(s)){let l=s.attributes.current_position;a=typeof l=="number"?nu(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 Nm(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 rt=(r,e)=>typeof r[e]=="string"?r[e]:"";function iu(r,e,t){let n=[];for(let i of e.floors)for(let o of i.furniture){if(!pr(o.type))continue;let s=t?.get(o.id)?.entity??null,a=s?.startsWith("media_player.")?s:Nm(i,o),l=a?r.states[a]:void 0;if(!l||!po(l))continue;let u=l.attributes,c=rt(u,"app_name")||rt(u,"source")||null;n.push({id:o.id,furnitureId:o.id,floorId:i.id,color:mo(c),title:rt(u,"media_title")||rt(u,"media_channel")||c||"",subtitle:rt(u,"media_artist")||rt(u,"media_series_title")||rt(u,"media_album_name"),app:c,picture:rt(u,"entity_picture")||null,playing:fo(l),ambilight:o.ambilight??1})}return n}function ou(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 su(r,e){return(r===null?0:nu((r+4)/16))*(1-.45*e)}function it(r,e){return r.states["weather.nextfloor_symcon"]?"weather.nextfloor_symcon":e&&r.states[e]?e:Object.keys(r.states).filter(t=>t.startsWith("weather.")).sort()[0]??null}var Lr=new Set(["contact_lost","unlocked_night","own"]);function Wm(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 Lm=600*1e3,Om=new Set(["rainy","pouring","lightning-rainy","hail","snowy-rainy"]),Bm=new Map([["smoke","smoke"],["gas","gas"],["carbon_monoxide","co"],["moisture","water"]]),au=(r,e)=>{if(e.startsWith("binary_sensor."))return Bm.get(String(r.states[e]?.attributes.device_class))};function Vm(r,e){let t=new Set,n=[];for(let i of r.floors)for(let o of i.openings){let s=e.get(o.id);for(let a of s?[s.contact,s.contact2,s.tilt,s.tilt2]:[])!a||t.has(a)||(t.add(a),n.push({floorId:i.id,roomId:o.room_id,entity:a}))}return n}function lu(r,e,t,n){let i=[];for(let a o
Line truncated
|
||||
`]};customElements.get("nf-room-panel")||customElements.define("nf-room-panel",po);function eu(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 Lm=[[/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]]],tu=[34,211,238];function fo(r){return r?Lm.find(([e])=>e.test(r))?.[1]??tu:tu}function go(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 _o=r=>r.state==="playing"||r.state==="on"&&go(r);function nu(r,e){let t=[],n=new Set;for(let i of e){if(!i.entity.startsWith("media_player.")||n.has(i.entity))continue;n.add(i.entity);let o=r.states[i.entity];if(!o)continue;let s=o.attributes,a=c=>typeof s[c]=="string"?s[c]:"",l=a("app_name")||a("source")||a("app_id")||null,u=typeof s.volume_level=="number"?s.volume_level:null;t.push({entity:i.entity,name:i.name,at:i.at,playing:_o(o),title:a("media_title")||a("media_channel")||l||"",artist:a("media_artist")||a("media_album_name")||a("media_series_title"),picture:a("entity_picture")||null,volume:u,color:fo(l),app:l,group:Array.isArray(s.group_members)?s.group_members.filter(c=>typeof c=="string"&&c!==i.entity):[],rings:i.rings??1})}return t}function ru(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 Bm=3;function iu(r,e,t){let n=[];for(let i of e.floors)for(let o of i.furniture){if(!o.type.endsWith(":sprinkler"))continue;let s=t?.get(o.id)?.entity??null;!s||!te(r.states[s])||n.push({id:o.id,at:{floorId:i.id,x:o.x,y:oe(i,o)+o.h,z:o.z},reach:Math.min(15,Math.max(.5,o.spray??Bm))})}return n}var Wr=r=>r&&r!=="none"?r:null,ou=r=>Math.min(1,Math.max(0,r));function su(r,e){let t=new Map;for(let n of e.settings.roof?.windows??[]){let i=Oe(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&&!C(s)){let l=s.attributes.current_position;a=typeof l=="number"?ou(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 Vm(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 rt=(r,e)=>typeof r[e]=="string"?r[e]:"";function au(r,e,t){let n=[];for(let i of e.floors)for(let o of i.furniture){if(!fr(o.type))continue;let s=t?.get(o.id)?.entity??null,a=s?.startsWith("media_player.")?s:Vm(i,o),l=a?r.states[a]:void 0;if(!l||!go(l))continue;let u=l.attributes,c=rt(u,"app_name")||rt(u,"source")||null;n.push({id:o.id,furnitureId:o.id,floorId:i.id,color:fo(c),title:rt(u,"media_title")||rt(u,"media_channel")||c||"",subtitle:rt(u,"media_artist")||rt(u,"media_series_title")||rt(u,"media_album_name"),app:c,picture:rt(u,"entity_picture")||null,playing:_o(l),ambilight:o.ambilight??1})}return n}function lu(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 uu(r,e){return(r===null?0:ou((r+4)/16))*(1-.45*e)}function it(r,e){return r.states["weather.nextfloor_symcon"]?"weather.nextfloor_symcon":e&&r.states[e]?e:Object.keys(r.states).filter(t=>t.startsWith("weather.")).sort()[0]??null}var Lr=new Set(["contact_lost","unlocked_night","own"]);function Km(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 Gm=600*1e3,Um=new Set(["rainy","pouring","lightning-rainy","hail","snowy-rainy"]),jm=new Map([["smoke","smoke"],["gas","gas"],["carbon_monoxide","co"],["moisture","water"]]),cu=(r,e)=>{if(e.startsWith("binary_sensor."))return jm.get(String(r.states[e]?.attributes.device_class))};function qm(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 du(r,e,t,n){let i=[];for(let a o
Line truncated
|
||||
${ne`<circle cx="27" cy="27" r=${22} class="live-ring-bg"></circle>
|
||||
<circle cx="27" cy="27" r=${22} stroke=${e} stroke-dasharray=${`${(n*Math.max(0,Math.min(1,r))).toFixed(1)} ${n.toFixed(1)}`} transform="rotate(-90 27 27)" class="live-ring-fg"></circle>`}
|
||||
</svg>`}function ef(r,e,t,n){let i=e.summary,o=u=>$(r,u),s=e.autarky,a=n?p`<button class="live-fold" title=${o(n.folded?"live_unfold":"live_fold")} aria-label=${o(n.folded?"live_unfold":"live_fold")} aria-expanded=${!n.folded} @click=${n.toggle}>${n.folded?"+":"\u2212"}</button>`:f;if(n?.folded){let u=i.solar!==null?`\u2600 ${Ae(r,i.solar)}`:i.consumption!==null?`\u2302 ${Ae(r,i.consumption)}`:null;return p`<div class="live-card live-card-house live-folded" data-i=${t}>
|
||||
${s!==null?p`<div class="live-own">${Pn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)}%</b></div></div>`:f}
|
||||
</svg>`}function mf(r,e,t,n){let i=e.summary,o=u=>$(r,u),s=e.autarky,a=n?p`<button class="live-fold" title=${o(n.folded?"live_unfold":"live_fold")} aria-label=${o(n.folded?"live_unfold":"live_fold")} aria-expanded=${!n.folded} @click=${n.toggle}>${n.folded?"+":"\u2212"}</button>`:f;if(n?.folded){let u=i.solar!==null?`\u2600 ${Ae(r,i.solar)}`:i.consumption!==null?`\u2302 ${Ae(r,i.consumption)}`:null;return p`<div class="live-card live-card-house live-folded" data-i=${t}>
|
||||
${s!==null?p`<div class="live-own">${In(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)}%</b></div></div>`:f}
|
||||
${u?p`<b>${u}</b>`:s===null?p`<b>⌂</b>`:f}
|
||||
${a}
|
||||
</div>`}let l=[];if(i.solar!==null&&l.push(p`<div class="live-row live-solar"><span>☀ ${o("energy_solar")}</span><b>${Ae(r,i.solar)}</b></div>`),i.consumption!==null&&l.push(p`<div class="live-row live-house"><span>⌂ ${o("energy_consumption")}</span><b>${Ae(r,i.consumption)}</b></div>`),i.rest!==void 0&&i.rest!==null&&l.push(p`<div class="live-row live-house"><span>⌂ ${o("energy_rest")}</span><b>${Ae(r,i.rest)}</b></div>`),i.battery!==null||i.soc!==null){let u=i.battery===null||Math.abs(i.battery)<15?"":i.battery>0?" \u2193":" \u2191";l.push(p`<div class="live-row live-battery"><span>▮ ${o("energy_battery")}${u}</span><b>${i.soc!==null?`${Math.round(i.soc)} %`:""}${i.battery!==null&&Math.abs(i.battery)>=15?` \xB7 ${Ae(r,i.battery)}`:""}</b></div>`)}if(i.grid!==null){let u=i.grid<-15;l.push(p`<div class="live-row ${u?"live-export":"live-import"}"><span>⇄ ${o(u?"energy_grid_export":"energy_grid_import")}</span><b>${Ae(r,i.grid)}</b></div>`)}for(let u of e.meters??[])l.push(p`<div class="live-row live-meter"><span>${u.icon} ${u.label}</span><b>${u.value}</b></div>`);return p`<div class="live-card live-card-house" data-i=${t}>
|
||||
${a}
|
||||
${s!==null?p`<div class="live-own">${Pn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)} %</b><span>${o("live_autarky")}</span></div></div>`:f}
|
||||
${s!==null?p`<div class="live-own">${In(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>
|
||||
${nf(r,e.curves)} ${tf(r,e.week)}
|
||||
</div>`}function tf(r,e){if(!e)return f;let t=[...e.solar,...e.use].filter(u=>u!==null&&u>0);if(!t.length)return f;let n=Math.max(...t)*1.1||1,[i,o]=[150,30],s=i/7,a=(u,c,d)=>u===null||u<=0?f:ne`<rect x=${c.toFixed(1)} y=${(o-u/n*o).toFixed(1)} width=${(s*.36).toFixed(1)} height=${(u/n*o).toFixed(1)} class=${d}></rect>`,l=u=>u.reduce((c,d)=>c+(d??0),0);return p`<div class="live-day live-week" title=${$(r,"live_week_hint",{solar:W(r,l(e.solar),0),use:W(r,l(e.use),0)})}>
|
||||
${ff(r,e.curves)} ${pf(r,e.week)}
|
||||
</div>`}function pf(r,e){if(!e)return f;let t=[...e.solar,...e.use].filter(u=>u!==null&&u>0);if(!t.length)return f;let n=Math.max(...t)*1.1||1,[i,o]=[150,30],s=i/7,a=(u,c,m)=>u===null||u<=0?f:ne`<rect x=${c.toFixed(1)} y=${(o-u/n*o).toFixed(1)} width=${(s*.36).toFixed(1)} height=${(u/n*o).toFixed(1)} class=${m}></rect>`,l=u=>u.reduce((c,m)=>c+(m??0),0);return p`<div class="live-day live-week" title=${$(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">
|
||||
${e.days.map((u,c)=>ne`${a(e.solar[c],c*s+s*.1,"live-week-solar")}${a(e.use[c],c*s+s*.5,"live-week-use")}`)}
|
||||
</svg>
|
||||
<span>7 ${$(r,"live_days")}</span>
|
||||
</div>`}function nf(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=$n(e.solar,i,o,n),a=$n(e.use,i,o,n);return p`<div class="live-day" title=${$(r,"live_day_hint")}>
|
||||
</div>`}function ff(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=Mn(e.solar,i,o,n),a=Mn(e.use,i,o,n);return p`<div class="live-day" title=${$(r,"live_day_hint")}>
|
||||
<svg viewBox=${`0 0 ${i} ${o}`} preserveAspectRatio="none" aria-hidden="true">
|
||||
${s?ne`<path d=${`${s}L${i},${o}L0,${o}Z`} class="live-day-solar"></path>`:f}
|
||||
${a?ne`<path d=${a} class="live-day-use"></path>`:f}
|
||||
</svg>
|
||||
<span>24 h</span>
|
||||
</div>`}function rf(r,e,t,n){let i=e.car,o=(c,d)=>$(r,c,d),s=nc(i.soc),a=i.home?i.charging?`\u26A1 ${o("live_car_charging")}${i.chargingW?` \xB7 ${Ae(r,i.chargingW)}`:""}`:i.plugged?`\u{1F50C} ${o("live_car_plugged")}`:"":`${o("live_car_away")}${i.where?` \xB7 ${i.where}`:""}${i.distance!==null?` \xB7 ${W(r,i.distance,i.distance<10?1:0)} km`:""}`,l=i.entities,u=(c,d,m,h)=>p`<button class="live-btn ${c?"live-on":""}" title=${d} aria-label=${d} aria-pressed=${c??!1} @click=${g=>(g.stopPropagation(),h())}>${m}</button>`;return p`<div class="live-card live-card-car ${i.charging?"live-charging":""} ${i.home?"":"live-away"}" data-i=${t} style=${`--live-soc:${s}`}>
|
||||
</div>`}function gf(r,e,t,n){let i=e.car,o=(c,m)=>$(r,c,m),s=ac(i.soc),a=i.home?i.charging?`\u26A1 ${o("live_car_charging")}${i.chargingW?` \xB7 ${Ae(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,u=(c,m,d,h)=>p`<button class="live-btn ${c?"live-on":""}" title=${m} aria-label=${m} aria-pressed=${c??!1} @click=${g=>(g.stopPropagation(),h())}>${d}</button>`;return p`<div class="live-card live-card-car ${i.charging?"live-charging":""} ${i.home?"":"live-away"}" data-i=${t} style=${`--live-soc:${s}`}>
|
||||
<div class="live-own">
|
||||
${Pn((i.soc??0)/100,s)}
|
||||
${In((i.soc??0)/100,s)}
|
||||
<div class="live-own-text"><b>${i.soc!==null?`${Math.round(i.soc)} %`:"\u2013"}</b><span>${i.range!==null?`${Math.round(i.range)} ${i.rangeUnit}`:""}</span></div>
|
||||
</div>
|
||||
<div class="live-rows">
|
||||
<div class="live-title">${e.name}</div>
|
||||
${a?p`<div class="live-status">${a}</div>`:f}
|
||||
${i.inside!==null?p`<div class="live-status">🌡 ${W(r,i.inside,1)} °C</div>`:f}
|
||||
${i.inside!==null?p`<div class="live-status">🌡 ${O(r,i.inside,1)} °C</div>`:f}
|
||||
${i.departure?p`<div class="live-status">⏰ ${o("live_car_departure",{time:i.departure})}</div>`:f}
|
||||
${i.open.length?p`<div class="live-status live-warn">⚠ ${o("live_car_open",{parts:i.open.join(", ")})}</div>`:f}
|
||||
<div class="live-actions">
|
||||
@@ -896,7 +896,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${l.charge&&i.home?u(i.charging,o("live_car_charge"),"\u26A1",()=>n(l.charge.split(".")[0],"toggle",l.charge)):f}
|
||||
</div>
|
||||
</div>
|
||||
</div>`}function of(r,e,t,n){let i=e.media,o=l=>$(r,l),s=`rgb(${i.color.join(",")})`,a=(l,u,c)=>p`<button class="live-btn" title=${l} aria-label=${l} @click=${d=>(d.stopPropagation(),n("media_player",c,i.entity))}>${u}</button>`;return p`<div class="live-card live-card-media" data-i=${t} style=${`--live-soc:${s}`} @click=${l=>l.currentTarget.classList.toggle("live-open")}>
|
||||
</div>`}function _f(r,e,t,n){let i=e.media,o=l=>$(r,l),s=`rgb(${i.color.join(",")})`,a=(l,u,c)=>p`<button class="live-btn" title=${l} aria-label=${l} @click=${m=>(m.stopPropagation(),n("media_player",c,i.entity))}>${u}</button>`;return p`<div class="live-card live-card-media" data-i=${t} style=${`--live-soc:${s}`} @click=${l=>l.currentTarget.classList.toggle("live-open")}>
|
||||
${i.picture?p`<img class="live-cover" src=${i.picture} alt="" loading="lazy" />`:p`<div class="live-cover live-cover-none">♪</div>`}
|
||||
<div class="live-rows">
|
||||
<div class="live-title" title=${i.title}>${i.title||i.name}</div>
|
||||
@@ -915,9 +915,9 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
/>`:f}
|
||||
</div>
|
||||
</div>
|
||||
</div>`}function rc(r){let e=[...r.querySelectorAll(".live-card")].filter(o=>o.style.visibility!=="hidden"),t=[],n=e[0]?.parentElement?.clientWidth??0,i=e.map(o=>{let[s,a]=[Number(o.dataset.x),o.offsetWidth],l=n?n>a+16?Math.min(Math.max(s,a/2+8),n-a/2-8):n/2:s;return o.style.setProperty("--live-dx",`${Math.round(s-l)}px`),{el:o,x:l,y:Number(o.dataset.y),w:a,h:o.offsetHeight}}).sort((o,s)=>s.y-o.y);for(let o of i){let s=o.y;for(let l=0;l<12;l++){let u={x0:o.x-o.w/2,x1:o.x+o.w/2,y0:s-o.h,y1:s},c=t.find(d=>u.x0<d.x1+6&&u.x1>d.x0-6&&u.y0<d.y1+6&&u.y1>d.y0-6);if(!c)break;s=c.y0-8}t.push({x0:o.x-o.w/2,x1:o.x+o.w/2,y0:s-o.h,y1:s});let a=o.y-s;o.el.style.transform=`translate(${Math.round(o.x)}px, ${Math.round(s)}px) translate(-50%, -100%)`,o.el.style.setProperty("--live-thread",`${Math.round(18+a)}px`)}}function sf(r,e,t){let n=e.printer,i=(u,c)=>$(r,u,c),o=n.progress??0,s=u=>new Intl.DateTimeFormat(r?.language??navigator.language,{hour:"2-digit",minute:"2-digit"}).format(new Date(u)),a=n.remaining!==null?n.remaining>=60?`${Math.floor(n.remaining/60)} h ${Math.round(n.remaining%60)} min`:`${Math.round(n.remaining)} min`:null,l=[n.nozzle!==null?`${i("printer_nozzle")} ${Math.round(n.nozzle)}\xB0`:null,n.bed!==null?`${i("printer_bed")} ${Math.round(n.bed)}\xB0`:null].filter(Boolean).join(" \xB7 ");return p`<div class="live-card live-card-printer ${n.printing?"live-charging":""}" data-i=${t}>
|
||||
</div>`}function lc(r){let e=[...r.querySelectorAll(".live-card")].filter(s=>s.style.visibility!=="hidden"),t=[],n=e[0]?.parentElement?.clientWidth??0,i=e[0]?.parentElement?.clientHeight??0,o=e.map(s=>{let[a,l]=[Number(s.dataset.x),s.offsetWidth],u=n?n>l+16?Math.min(Math.max(a,l/2+8),n-l/2-8):n/2:a;return s.style.setProperty("--live-dx",`${Math.round(a-u)}px`),{el:s,x:u,y:Number(s.dataset.y),w:l,h:s.offsetHeight}}).sort((s,a)=>a.y-s.y);for(let s of o){let a=s.y;if(s.el.classList.contains("live-card-hydronic")&&n>s.w+16&&i>s.h+16){let u=[s.x,s.w/2+8,n-s.w/2-8,...t.flatMap(d=>[d.x0-s.w/2-8,d.x1+s.w/2+8])].filter(d=>d>=s.w/2+8&&d<=n-s.w/2-8).sort((d,h)=>Math.abs(d-s.x)-Math.abs(h-s.x)),c=[Math.max(s.h+8,Math.min(i-8,a)),...t.flatMap(d=>[d.y0-8,d.y1+s.h+8])].filter(d=>d>=s.h+8&&d<=i-8),m;for(let d of c){for(let h of u)if(!t.some(g=>h-s.w/2<g.x1+6&&h+s.w/2>g.x0-6&&d-s.h<g.y1+6&&d>g.y0-6)){m={x:h,y:d};break}if(m)break}m&&(s.x=m.x,a=m.y)}for(let u=0;u<12;u++){let c={x0:s.x-s.w/2,x1:s.x+s.w/2,y0:a-s.h,y1:a},m=t.find(d=>c.x0<d.x1+6&&c.x1>d.x0-6&&c.y0<d.y1+6&&c.y1>d.y0-6);if(!m)break;a=m.y0-8}t.push({x0:s.x-s.w/2,x1:s.x+s.w/2,y0:a-s.h,y1:a});let l=s.y-a;s.el.style.setProperty("--live-dx",`${Math.round(Number(s.el.dataset.x)-s.x)}px`),s.el.style.transform=`translate(${Math.round(s.x)}px, ${Math.round(a)}px) translate(-50%, -100%)`,s.el.style.setProperty("--live-thread",`${Math.round(18+l)}px`)}}function bf(r,e,t){let n=e.printer,i=(u,c)=>$(r,u,c),o=n.progress??0,s=u=>new Intl.DateTimeFormat(r?.language??navigator.language,{hour:"2-digit",minute:"2-digit"}).format(new Date(u)),a=n.remaining!==null?n.remaining>=60?`${Math.floor(n.remaining/60)} h ${Math.round(n.remaining%60)} min`:`${Math.round(n.remaining)} min`:null,l=[n.nozzle!==null?`${i("printer_nozzle")} ${Math.round(n.nozzle)}\xB0`:null,n.bed!==null?`${i("printer_bed")} ${Math.round(n.bed)}\xB0`:null].filter(Boolean).join(" \xB7 ");return p`<div class="live-card live-card-printer ${n.printing?"live-charging":""}" data-i=${t}>
|
||||
<div class="live-own">
|
||||
${n.picture?p`<img class="live-print-pic" src=${n.picture} alt="" />`:Pn(o/100,n.printing?"#38bdf8":"#8aa0c8")}
|
||||
${n.picture?p`<img class="live-print-pic" src=${n.picture} alt="" />`:In(o/100,n.printing?"#38bdf8":"#8aa0c8")}
|
||||
<div class="live-own-text"><b>${n.progress!==null?`${Math.round(o)} %`:"\u2013"}</b><span>${i(`printer_${n.printing?"printing":/finish|complete|fertig/.test(n.status)?"done":/pause/.test(n.status)?"paused":/error|fail/.test(n.status)?"error":"idle"}`)}</span></div>
|
||||
</div>
|
||||
<div class="live-rows">
|
||||
@@ -928,10 +928,10 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${l?p`<div class="live-status">🌡 ${l}</div>`:f}
|
||||
${n.filaments.length?p`<div class="live-filaments">${n.filaments.map(u=>p`<i style=${`background:${u}`}></i>`)}</div>`:f}
|
||||
</div>
|
||||
</div>`}function af(r,e,t){let n=e.pump,i=a=>$(r,a),o=a=>a===null?"\u2013":`${W(r,a,1)}\xB0`,s={heating:"\u{1F525}",water:"\u{1F6BF}",cooling:"\u2744",defrost:"\u{1F9CA}",idle:"\u23F8"}[n.mode];return p`<div class="live-card live-card-heatpump ${n.mode==="idle"?"":"live-charging"}" data-i=${t}>
|
||||
</div>`}function vf(r,e,t){let n=e.pump,i=a=>$(r,a),o=a=>a===null?"\u2013":`${O(r,a,1)}\xB0`,s={heating:"\u{1F525}",water:"\u{1F6BF}",cooling:"\u2744",defrost:"\u{1F9CA}",idle:"\u23F8"}[n.mode];return p`<div class="live-card live-card-heatpump ${n.mode==="idle"?"":"live-charging"}" data-i=${t}>
|
||||
<div class="live-own">
|
||||
${Pn(Math.min(1,(n.cop??0)/6),(n.cop??0)>=3.5?"#4ade80":(n.cop??0)>=2.5?"#facc15":"#fb923c")}
|
||||
<div class="live-own-text"><b>${n.cop!==null?W(r,n.cop,1):s}</b><span>${n.cop!==null?"COP":""}</span></div>
|
||||
${In(Math.min(1,(n.cop??0)/6),(n.cop??0)>=3.5?"#4ade80":(n.cop??0)>=2.5?"#facc15":"#fb923c")}
|
||||
<div class="live-own-text"><b>${n.cop!==null?O(r,n.cop,1):s}</b><span>${n.cop!==null?"COP":""}</span></div>
|
||||
</div>
|
||||
<div class="live-rows">
|
||||
<div class="live-title">${e.name}</div>
|
||||
@@ -941,16 +941,16 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${n.power!==null?p`<div class="live-row live-house"><span>${i("heatpump_power")}</span><b>${Ae(r,n.power)}</b></div>`:f}
|
||||
${n.outside!==null?p`<div class="live-status">🌡 ${i("heatpump_outside")} ${o(n.outside)}</div>`:f}
|
||||
</div>
|
||||
</div>`}function lf(r,e,t){let n=(o,s,a)=>o===null?"\u2013":`${W(r,o,s)} ${a}`,i=Object.values(e.sources??{}).some(o=>fn(r,o).length>0);return p`<div class="live-card live-card-roomclimate ${i?"live-climate-trends":""}" data-i=${t} data-room=${e.roomId} role="group" aria-label=${`${e.name||$(r,"room")} \xB7 ${$(r,"climate")}`}>
|
||||
</div>`}function yf(r,e,t){let n=(o,s,a)=>o===null?"\u2013":`${O(r,o,s)} ${a}`,i=Object.values(e.sources??{}).some(o=>gn(r,o).length>0);return p`<div class="live-card live-card-roomclimate ${i?"live-climate-trends":""}" data-i=${t} data-room=${e.roomId} role="group" aria-label=${`${e.name||$(r,"room")} \xB7 ${$(r,"climate")}`}>
|
||||
${e.showTemperature?p`<div class="live-row live-climate-temperature"><span title=${$(r,"climate_temperature")} aria-label=${$(r,"climate_temperature")}>🌡</span><b>${n(e.temperature===null?null:r?le(r,e.temperature):e.temperature,1,r?re(r):"\xB0C")}</b>${G(r,e.sources?.temperature??[],$(r,"climate_temperature"))}</div>`:f}
|
||||
${e.showHumidity?p`<div class="live-row live-climate-humidity"><span title=${$(r,"climate_humidity")} aria-label=${$(r,"climate_humidity")}>💧</span><b>${n(e.humidity,0,"%")}</b>${G(r,e.sources?.humidity??[],$(r,"climate_humidity"))}</div>`:f}
|
||||
${e.showCo2?p`<div class="live-row live-climate-co2"><span title=${$(r,"climate_co2")} aria-label=${$(r,"climate_co2")}>☁</span><b>${n(e.co2,0,"ppm")}</b>${G(r,e.sources?.co2??[],$(r,"climate_co2"))}</div>`:f}
|
||||
${e.showIlluminance?p`<div class="live-row live-climate-illuminance"><span title=${$(r,"climate_illuminance")} aria-label=${$(r,"climate_illuminance")}>☀</span><b>${n(e.illuminance,0,"lx")}</b>${G(r,e.sources?.illuminance??[],$(r,"climate_illuminance"))}</div>`:f}
|
||||
</div>`}function uf(r,e,t){let n=e.power===null?"\u2013":`${e.power<0?"\u2212":""}${Ae(r,e.power)}`;return p`<div class="live-card live-card-power" data-i=${t} data-furniture=${e.id} role="group" aria-label=${e.name}>
|
||||
</div>`}function wf(r,e,t){let n=e.power===null?"\u2013":`${e.power<0?"\u2212":""}${Ae(r,e.power)}`;return p`<div class="live-card live-card-power" data-i=${t} data-furniture=${e.id} role="group" aria-label=${e.name}>
|
||||
<div class="live-power-name">${e.name}</div><div class="live-row"><span aria-hidden="true">⚡</span><b>${n}</b>${G(r,[e.powerEntity],e.name)}</div>
|
||||
</div>`}function ic(r,e,t,n,i=!1){return e.length?p`<div class="live-cards">
|
||||
${e.map((o,s)=>o.kind==="roomclimate"?lf(r,o,s):o.kind==="power"?uf(r,o,s):i?f:o.kind==="house"?ef(r,o,s,n):o.kind==="car"?rf(r,o,s,t):o.kind==="printer"?sf(r,o,s):o.kind==="heatpump"?af(r,o,s):of(r,o,s,t))}
|
||||
</div>`:f}var oc=J`
|
||||
</div>`}function uc(r,e,t,n,i=!1){return e.length?p`<div class="live-cards">
|
||||
${e.map((o,s)=>o.kind==="roomclimate"?yf(r,o,s):o.kind==="power"?wf(r,o,s):o.kind==="hydronic"?p`<div class="live-card live-card-hydronic" data-i=${s} data-furniture=${o.item.id}><nf-hydronic-card .hass=${r} .item=${o.item} .readOnly=${o.readOnly}></nf-hydronic-card></div>`:i?f:o.kind==="house"?mf(r,o,s,n):o.kind==="car"?gf(r,o,s,t):o.kind==="printer"?bf(r,o,s):o.kind==="heatpump"?vf(r,o,s):_f(r,o,s,t))}
|
||||
</div>`:f}var cc=J`
|
||||
.live-card.live-card-power { display:grid; gap:4px; min-width:90px; max-width:220px; box-sizing:border-box; }
|
||||
.live-power-name { font-size:11px; color:var(--nf-muted); overflow:hidden; text-overflow:ellipsis; }
|
||||
.live-card-power .live-row { align-items:center; gap:6px; }
|
||||
@@ -1292,7 +1292,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
`;function Xr(r){return r.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var Io=r=>r.points.length>=3;function sc(r,e,t){return r.rooms.filter(Io).find(n=>I([e,t],n.points))}function cf(r,e,t,n){let i=[];for(let a of e.rooms.filter(Io)){let[l,u]=Ee(a.points);i.push({kind:"room",name:a.name,where:n?e.name:"",floorId:e.id,roomId:a.id,entity:null,icon:null,x:l,z:u,y:0})}let o=new Set,s=(a,l,u,c)=>{if(o.has(a)||!(a in r.states))return;o.add(a);let d=sc(e,l,u),m=[d?.name,n?e.name:void 0].filter(h=>!!h).join(" \xB7 ");i.push({kind:"device",name:L(r,a),where:m,floorId:e.id,roomId:d?.id??null,entity:a,icon:H(a),x:l,z:u,y:c})};for(let a of e.placements){let l=a.y??Tt(H(a.entity_id)??"sensor",ve(e,a.x,a.z),a.mount);s(a.entity_id,a.x,a.z,l)}for(let a of e.furniture){let l=t.get(a.id),u=l?.entity??l?.power;if(!u)continue;let c=ve(e,a.x,a.z)-.3;s(u,a.x,a.z,Math.min(c,Math.max(.5,a.h)))}for(let a of e.notes??[]){if(!a.text)continue;let l=sc(e,a.x,a.z),u=[l?.name,n?e.name:void 0].filter(c=>!!c).join(" \xB7 ");i.push({kind:"note",name:`\u270E ${a.text.length>60?`${a.text.slice(0,59)}\u2026`:a.text}`,where:u,floorId:e.id,roomId:l?.id??null,entity:null,icon:null,x:a.x,z:a.z,y:1.3})}return i}function ac(r,e){let t=ft(r,e.floors),n=e.floors.length>1,i=e.floors.flatMap(o=>cf(r,o,t,n));for(let o of e.settings.circuits??[]){let s=e.floors.flatMap(d=>d.rooms.filter(m=>o.rooms.includes(m.id)&&Io(m)).map(m=>({f:d,r:m})));if(!s.length)continue;let[{f:a,r:l}]=s,[u,c]=Ee(l.points);i.push({kind:"circuit",name:`\u{1F50C} ${o.name}`,where:s.map(d=>d.r.name).join(", "),floorId:a.id,roomId:l.id,entity:null,icon:null,x:u,z:c,y:0})}return i}function df(r,e){return(Xr(r.name).startsWith(e)?0:2)+(r.kind==="room"?0:1)}function lc(r,e,t=8){let n=Xr(e).split(/\s+/).filter(Boolean);if(n.length===0)return[];let i=Xr(e.trim());return r.filter(o=>{let s=Xr([o.name,o.where,o.entity].filter(Boolean).join(" "));return n.every(a=>s.includes(a))}).map(o=>({item:o,cost:df(o,i)})).sort((o,s)=>o.cost-s.cost||o.item.name.localeCompare(s.item.name)).slice(0,t).map(o=>o.item)}var hf=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[190,90,255],[255,95,210],[255,70,70],[120,255,150]],mf=[2200,2700,3200,4e3,5e3,6500],pf=["hs","rgb","rgbw","rgbww","xy"],ff=4,uc=16,cc=32,gf=128;function No(r){let e=r.attributes.supported_color_modes??[],t=e.some(n=>pf.includes(n));return{dim:e.some(n=>n!=="onoff"),color:t,temp:e.includes("color_temp")}}function Wo(r){return((r.attributes.supported_features??0)&ff)!==0&&typeof r.attributes.current_position=="number"}var Co=class extends Q{static properties={hass:{attribute:!1},entity:{attribute:!1},car:{attribute:!1},presets:{attribute:!1},confirmSwitch:{type:Boolean},myPosition:{attribute:!1},tiltEntity:{attribute:!1},low:{type:Boolean,reflect:!0}};t(e,t){return $(this.hass,e,t)}ask(){return!this.confirmSwitch||confirm(this.t("confirm_switch",{name:L(this.hass,this.entity)}))}call(e,t,n={}){this.hass.callService(e,t,{entity_id:this.entity,...n})}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}details(){we(this,this.entity),this.close()}ring(e){let t=e.length;return e.map((n,i)=>{let o=i/t*Math.PI*2-Math.PI/2;return p`<div class="qm-at" style="left:${50+Math.cos(o)*39}%;top:${50+Math.sin(o)*39}%">${n}</div>`})}renderLight(e){let t=No(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?hf.map(s=>p`<button class="qm-swatch" style="background:rgb(${s.join(",")})" aria-label=${`RGB ${s.join(", ")}`} @click=${()=>this.call("light","turn_on",{rgb_color:s})}></button>`):t.temp?mf.map(s=>p`<button class="qm-swatch" style="background:${_f(s)}" aria-label=${`${s} K`} @click=${()=>this.call("light","turn_on",{color_temp_kelvin:s})}></button>`):[];return p`<div class="qm-ring ${o.length?"":"qm-ring-small"}">
|
||||
`;function ti(r){return r.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var Oo=r=>r.points.length>=3;function dc(r,e,t){return r.rooms.filter(Oo).find(n=>H([e,t],n.points))}function xf(r,e,t,n){let i=[];for(let a of e.rooms.filter(Oo)){let[l,u]=Ee(a.points);i.push({kind:"room",name:a.name,where:n?e.name:"",floorId:e.id,roomId:a.id,entity:null,icon:null,x:l,z:u,y:0})}let o=new Set,s=(a,l,u,c)=>{if(o.has(a)||!(a in r.states))return;o.add(a);let m=dc(e,l,u),d=[m?.name,n?e.name:void 0].filter(h=>!!h).join(" \xB7 ");i.push({kind:"device",name:W(r,a),where:d,floorId:e.id,roomId:m?.id??null,entity:a,icon:P(a),x:l,z:u,y:c})};for(let a of e.placements){let l=a.y??Dt(P(a.entity_id)??"sensor",ve(e,a.x,a.z),a.mount);s(a.entity_id,a.x,a.z,l)}for(let a of e.furniture){let l=t.get(a.id),u=l?.entity??l?.power;if(!u)continue;let c=ve(e,a.x,a.z)-.3;s(u,a.x,a.z,Math.min(c,Math.max(.5,a.h)))}for(let a of e.notes??[]){if(!a.text)continue;let l=dc(e,a.x,a.z),u=[l?.name,n?e.name:void 0].filter(c=>!!c).join(" \xB7 ");i.push({kind:"note",name:`\u270E ${a.text.length>60?`${a.text.slice(0,59)}\u2026`:a.text}`,where:u,floorId:e.id,roomId:l?.id??null,entity:null,icon:null,x:a.x,z:a.z,y:1.3})}return i}function hc(r,e){let t=ft(r,e.floors),n=e.floors.length>1,i=e.floors.flatMap(o=>xf(r,o,t,n));for(let o of e.settings.circuits??[]){let s=e.floors.flatMap(m=>m.rooms.filter(d=>o.rooms.includes(d.id)&&Oo(d)).map(d=>({f:m,r:d})));if(!s.length)continue;let[{f:a,r:l}]=s,[u,c]=Ee(l.points);i.push({kind:"circuit",name:`\u{1F50C} ${o.name}`,where:s.map(m=>m.r.name).join(", "),floorId:a.id,roomId:l.id,entity:null,icon:null,x:u,z:c,y:0})}return i}function kf(r,e){return(ti(r.name).startsWith(e)?0:2)+(r.kind==="room"?0:1)}function mc(r,e,t=8){let n=ti(e).split(/\s+/).filter(Boolean);if(n.length===0)return[];let i=ti(e.trim());return r.filter(o=>{let s=ti([o.name,o.where,o.entity].filter(Boolean).join(" "));return n.every(a=>s.includes(a))}).map(o=>({item:o,cost:kf(o,i)})).sort((o,s)=>o.cost-s.cost||o.item.name.localeCompare(s.item.name)).slice(0,t).map(o=>o.item)}var Sf=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[190,90,255],[255,95,210],[255,70,70],[120,255,150]],$f=[2200,2700,3200,4e3,5e3,6500],Mf=["hs","rgb","rgbw","rgbww","xy"],Af=4,pc=16,fc=32,Ef=128;function Lo(r){let e=r.attributes.supported_color_modes??[],t=e.some(n=>Mf.includes(n));return{dim:e.some(n=>n!=="onoff"),color:t,temp:e.includes("color_temp")}}function Bo(r){return((r.attributes.supported_features??0)&Af)!==0&&typeof r.attributes.current_position=="number"}var Wo=class extends Q{static properties={hass:{attribute:!1},entity:{attribute:!1},car:{attribute:!1},presets:{attribute:!1},confirmSwitch:{type:Boolean},myPosition:{attribute:!1},tiltEntity:{attribute:!1},low:{type:Boolean,reflect:!0}};t(e,t){return $(this.hass,e,t)}ask(){return!this.confirmSwitch||confirm(this.t("confirm_switch",{name: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(){ye(this,this.entity),this.close()}ring(e){let t=e.length;return e.map((n,i)=>{let o=i/t*Math.PI*2-Math.PI/2;return p`<div class="qm-at" style="left:${50+Math.cos(o)*39}%;top:${50+Math.sin(o)*39}%">${n}</div>`})}renderLight(e){let t=Lo(e),n=e.state==="on",i=n&&typeof e.attributes.brightness=="number"?Math.round(e.attributes.brightness/2.55):n?100:0,o=t.color?Sf.map(s=>p`<button class="qm-swatch" style="background:rgb(${s.join(",")})" aria-label=${`RGB ${s.join(", ")}`} @click=${()=>this.call("light","turn_on",{rgb_color:s})}></button>`):t.temp?$f.map(s=>p`<button class="qm-swatch" style="background:${Rf(s)}" aria-label=${`${s} K`} @click=${()=>this.call("light","turn_on",{color_temp_kelvin:s})}></button>`):[];return p`<div class="qm-ring ${o.length?"":"qm-ring-small"}">
|
||||
${this.ring(o)}
|
||||
<button class="qm-power ${n?"qm-on":""}" aria-pressed=${n} @click=${()=>this.ask()&&this.call("light","toggle")}>
|
||||
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M12 3v8M6.3 6.8a8 8 0 1 0 11.4 0" /></svg>
|
||||
@@ -1307,7 +1307,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.value=${String(Math.max(1,i))}
|
||||
aria-label=${this.t("brightness")}
|
||||
@change=${s=>this.call("light","turn_on",{brightness_pct:Number(s.target.value)})}
|
||||
/>`:f}`}renderCover(e){e=br(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=Wo(e),o=(c,d,m,h=!1)=>p`<button class="qm-swatch qm-slot ${h?"qm-slot-on":""}" aria-label=${d} @click=${m}>${c}</button>`,s=c=>t!==null&&Math.abs(t-c)<3,a=[o("\u25B2",this.t("cover_open"),()=>this.ask()&&this.call("cover","open_cover"),s(100)),...i?[75,50].map(c=>o(`${c}`,`${c} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:c}),s(c))):[],o("\u25BC",this.t("cover_close"),()=>this.ask()&&this.call("cover","close_cover"),s(0)),...i?[25].map(c=>o(`${c}`,`${c} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:c}),s(c))):[],...Number(e.attributes.supported_features??0)&8?[o("\u25A0",this.t("cover_stop"),()=>this.call("cover","stop_cover"),n)]:[],...this.myPosition!=null&&(i||Number(e.attributes.supported_features??0)&8)?[o("My",this.t("cover_my_go",{p:this.myPosition}),()=>this.ask()&&(i?this.call("cover","set_cover_position",{position:this.myPosition}):this.call("cover","stop_cover")),s(this.myPosition))]:[]],l=t===null?e.state==="closed"?100:0:100-t,u=t!==null||n||e.state==="open"||e.state==="closed";return p`<div class="qm-ring">
|
||||
/>`:f}`}renderCover(e){e=vr(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=Bo(e),o=(c,m,d,h=!1)=>p`<button class="qm-swatch qm-slot ${h?"qm-slot-on":""}" aria-label=${m} @click=${d}>${c}</button>`,s=c=>t!==null&&Math.abs(t-c)<3,a=[o("\u25B2",this.t("cover_open"),()=>this.ask()&&this.call("cover","open_cover"),s(100)),...i?[75,50].map(c=>o(`${c}`,`${c} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:c}),s(c))):[],o("\u25BC",this.t("cover_close"),()=>this.ask()&&this.call("cover","close_cover"),s(0)),...i?[25].map(c=>o(`${c}`,`${c} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:c}),s(c))):[],...Number(e.attributes.supported_features??0)&8?[o("\u25A0",this.t("cover_stop"),()=>this.call("cover","stop_cover"),n)]:[],...this.myPosition!=null&&(i||Number(e.attributes.supported_features??0)&8)?[o("My",this.t("cover_my_go",{p:this.myPosition}),()=>this.ask()&&(i?this.call("cover","set_cover_position",{position:this.myPosition}):this.call("cover","stop_cover")),s(this.myPosition))]:[]],l=t===null?e.state==="closed"?100:0:100-t,u=t!==null||n||e.state==="open"||e.state==="closed";return p`<div class="qm-ring">
|
||||
${this.ring(a)}
|
||||
<button
|
||||
class="qm-power qm-blind ${u&&l<100?"qm-on":""}"
|
||||
@@ -1317,7 +1317,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
@click=${()=>n?this.call("cover","stop_cover"):this.ask()&&this.call("cover",l>50?"open_cover":"close_cover")}
|
||||
>
|
||||
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M4 4h16M5 4v15M19 4v15M7 8h10M7 12h10M7 16h10" /></svg>
|
||||
<b>${t!==null?`${Math.round(t)} %`:oe(this.hass,e)}</b>
|
||||
<b>${t!==null?`${Math.round(t)} %`:se(this.hass,e)}</b>
|
||||
</button>
|
||||
</div>
|
||||
${i?p`<input
|
||||
@@ -1329,7 +1329,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
aria-label=${this.t("position")}
|
||||
@change=${c=>this.call("cover","set_cover_position",{position:Number(c.target.value)})}
|
||||
/>`:f}
|
||||
${this.renderTilt(e)}`}renderTilt(e){let t=(e.attributes.supported_features??0)|0,n=typeof e.attributes.current_tilt_position=="number"?e.attributes.current_tilt_position:null;return t&gf&&n!==null?p`<label class="qm-tilt"
|
||||
${this.renderTilt(e)}`}renderTilt(e){let t=(e.attributes.supported_features??0)|0,n=typeof e.attributes.current_tilt_position=="number"?e.attributes.current_tilt_position:null;return t&Ef&&n!==null?p`<label class="qm-tilt"
|
||||
><span>${this.t("cover_tilt")} · ${Math.round(n)} %</span>
|
||||
<input
|
||||
class="qm-slider"
|
||||
@@ -1339,9 +1339,9 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.value=${String(n)}
|
||||
aria-label=${this.t("cover_tilt")}
|
||||
@change=${i=>this.call("cover","set_cover_tilt_position",{entity_id:e.attributes.nf_cover_control?this.entity:this.tiltEntity||this.entity,tilt_position:Number(i.target.value)})}
|
||||
/></label>`:t&(uc|cc)?p`<div class="qm-tilt-buttons">
|
||||
${t&uc?p`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","open_cover_tilt")}>${this.t("cover_tilt_open")}</button>`:f}
|
||||
${t&cc?p`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","close_cover_tilt")}>${this.t("cover_tilt_close")}</button>`:f}
|
||||
/></label>`:t&(pc|fc)?p`<div class="qm-tilt-buttons">
|
||||
${t&pc?p`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","open_cover_tilt")}>${this.t("cover_tilt_open")}</button>`:f}
|
||||
${t&fc?p`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","close_cover_tilt")}>${this.t("cover_tilt_close")}</button>`:f}
|
||||
</div>`:f}renderToggle(e){let t=e.state==="on"||e.state==="unlocked"||e.state==="playing",n=e.entity_id.split(".")[0];return p`<div class="qm-ring qm-ring-small">
|
||||
<button
|
||||
class="qm-power ${t?"qm-on":""}"
|
||||
@@ -1349,22 +1349,22 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
@click=${()=>this.ask()&&(n==="lock"?this.call("lock",t?"lock":"unlock"):this.call("homeassistant","toggle"))}
|
||||
>
|
||||
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M12 3v8M6.3 6.8a8 8 0 1 0 11.4 0" /></svg>
|
||||
<b>${oe(this.hass,e)}</b>
|
||||
<b>${se(this.hass,e)}</b>
|
||||
</button>
|
||||
</div>`}renderMedia(e){let t=!["off","standby","unavailable","unknown"].includes(e.state),n=e.state==="playing",i=e.attributes,o=typeof i.volume_level=="number"?Math.round(i.volume_level*100):null,s=Array.isArray(i.source_list)?i.source_list.slice(0,24):[],a=[i.media_title,i.media_artist].filter(d=>typeof d=="string"&&d).join(" \xB7 "),l=d=>p`<svg viewBox="0 0 24 24" width="18" height="18" fill="currentColor"><path d=${d} /></svg>`,u=(d,m,h,g=!1)=>p`<button class="qm-swatch qm-slot ${g?"qm-slot-on":""}" aria-label=${m} title=${m} @click=${h}>${d}</button>`,c=t?[u(l(n?"M6 5h4v14H6zM14 5h4v14h-4z":"M8 5v14l11-7z"),this.t(n?"media_pause":"media_play"),()=>this.call("media_player","media_play_pause"),n),u(l("M6 6h2v12H6zm3.5 6 8.5 6V6z"),this.t("media_previous"),()=>this.call("media_player","media_previous_track")),u(l("M16 6h2v12h-2zM6 18l8.5-6L6 6z"),this.t("media_next"),()=>this.call("media_player","media_next_track"))]:[];return p`<div class="qm-ring ${c.length?"":"qm-ring-small"}">
|
||||
</div>`}renderMedia(e){let t=!["off","standby","unavailable","unknown"].includes(e.state),n=e.state==="playing",i=e.attributes,o=typeof i.volume_level=="number"?Math.round(i.volume_level*100):null,s=Array.isArray(i.source_list)?i.source_list.slice(0,24):[],a=[i.media_title,i.media_artist].filter(m=>typeof m=="string"&&m).join(" \xB7 "),l=m=>p`<svg viewBox="0 0 24 24" width="18" height="18" fill="currentColor"><path d=${m} /></svg>`,u=(m,d,h,g=!1)=>p`<button class="qm-swatch qm-slot ${g?"qm-slot-on":""}" aria-label=${d} title=${d} @click=${h}>${m}</button>`,c=t?[u(l(n?"M6 5h4v14H6zM14 5h4v14h-4z":"M8 5v14l11-7z"),this.t(n?"media_pause":"media_play"),()=>this.call("media_player","media_play_pause"),n),u(l("M6 6h2v12H6zm3.5 6 8.5 6V6z"),this.t("media_previous"),()=>this.call("media_player","media_previous_track")),u(l("M16 6h2v12h-2zM6 18l8.5-6L6 6z"),this.t("media_next"),()=>this.call("media_player","media_next_track"))]:[];return p`<div class="qm-ring ${c.length?"":"qm-ring-small"}">
|
||||
${this.ring(c)}
|
||||
<button class="qm-power ${t?"qm-on":""}" aria-pressed=${t} @click=${()=>this.ask()&&this.call("media_player",t?"turn_off":"turn_on")}>
|
||||
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M12 3v8M6.3 6.8a8 8 0 1 0 11.4 0" /></svg>
|
||||
<b>${o!==null&&t?`${o} %`:oe(this.hass,e)}</b>
|
||||
<b>${o!==null&&t?`${o} %`:se(this.hass,e)}</b>
|
||||
</button>
|
||||
</div>
|
||||
${a?p`<div class="qm-media-title">${a}</div>`:f}
|
||||
${o!==null?p`<input class="qm-slider" type="range" min="0" max="100" .value=${String(o)} aria-label=${this.t("media_volume")} @change=${d=>this.call("media_player","volume_set",{volume_level:Number(d.target.value)/100})} />`:f}
|
||||
${o!==null?p`<input class="qm-slider" type="range" min="0" max="100" .value=${String(o)} aria-label=${this.t("media_volume")} @change=${m=>this.call("media_player","volume_set",{volume_level:Number(m.target.value)/100})} />`:f}
|
||||
${s.length?p`<div class="qm-play-head">${this.t("media_sources")}</div>
|
||||
<div class="qm-play">${s.map(d=>p`<button class="qm-chip ${i.source===d?"qm-chip-on":""}" @click=${()=>this.call("media_player","select_source",{source:d})}>${d}</button>`)}</div>`:f}
|
||||
<div class="qm-play">${s.map(m=>p`<button class="qm-chip ${i.source===m?"qm-chip-on":""}" @click=${()=>this.call("media_player","select_source",{source:m})}>${m}</button>`)}</div>`:f}
|
||||
${this.presets?.length?p`<div class="qm-play-head">${this.t("presets")}</div>
|
||||
<div class="qm-play">${this.presets.map(d=>p`<button class="qm-chip" @click=${()=>this.call("media_player","play_media",{media_content_type:d.type,media_content_id:d.content})}>${d.label}</button>`)}</div>`:f}`}render(){let e=this.hass?.states[this.entity];if(!e)return f;let t=H(this.entity),n=C(e)&&!un(e)?p`<p class="qm-note">${oe(this.hass,e)}</p>`:t==="light"?this.renderLight(e):t==="cover"?this.renderCover(e):t==="media"?this.renderMedia(e):this.renderToggle(e);return p`<div class="qm" role="dialog" aria-label=${L(this.hass,this.entity)}>
|
||||
<div class="qm-title">${L(this.hass,this.entity)}</div>
|
||||
<div class="qm-play">${this.presets.map(m=>p`<button class="qm-chip" @click=${()=>this.call("media_player","play_media",{media_content_type:m.type,media_content_id:m.content})}>${m.label}</button>`)}</div>`:f}`}render(){let e=this.hass?.states[this.entity];if(!e)return f;let t=P(this.entity),n=C(e)&&!cn(e)?p`<p class="qm-note">${se(this.hass,e)}</p>`:t==="light"?this.renderLight(e):t==="cover"?this.renderCover(e):t==="media"?this.renderMedia(e):this.renderToggle(e);return p`<div class="qm" role="dialog" aria-label=${W(this.hass,this.entity)}>
|
||||
<div class="qm-title">${W(this.hass,this.entity)}</div>
|
||||
${n}
|
||||
<button class="qm-details" @click=${()=>this.details()}>${this.t("details")} …</button>
|
||||
</div>`}static styles=[_e,J`
|
||||
@@ -1610,7 +1610,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.qm-note {
|
||||
color: var(--nf-muted);
|
||||
}
|
||||
`]};function _f(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 bf=new URL(import.meta.url),vf=new URL("./nextfloor-3d.js?v=74227cd20cc3",bf).href,dc;function hc(){return dc??=import(vf),dc}function mc(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 pc="weather.nextfloor_symcon",gc={condition:"Wetterzustand",temperature:"Au\xDFentemperatur",humidity:"Au\xDFenluftfeuchte",pressure:"Luftdruck",wind_speed:"Windgeschwindigkeit",wind_gust_speed:"Windb\xF6en",wind_bearing:"Windrichtung",cloud_coverage:"Bew\xF6lkung",precipitation:"Niederschlagsrate",precipitation_total:"Niederschlagsmenge",illuminance:"Au\xDFenhelligkeit",uv_index:"UV-Index",visibility:"Sichtweite",snow:"Schnee",fog:"Nebel",lightning:"Gewitter"},fc=new WeakMap;function wf(r){let e=r.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").trim();return["sunny","clear-night","partlycloudy","cloudy","fog","rainy","pouring","lightning-rainy","lightning","hail","snowy","snowy-rainy","windy","windy-variant"].includes(e)?e:/kein regen|trocken|wolkenlos|klar|sonnig/.test(e)?"sunny":/gewitter|blitz/.test(e)?"lightning-rainy":/schneeregen/.test(e)?"snowy-rainy":/schnee/.test(e)?"snowy":/hagel/.test(e)?"hail":/starkregen/.test(e)?"pouring":/regen|niesel/.test(e)?"rainy":/nebel/.test(e)?"fog":/teil.*wolk|heiter|leicht.*wolk/.test(e)?"partlycloudy":/wolk|bedeckt/.test(e)?"cloudy":/wind|sturm/.test(e)?"windy":null}function ei(r,e){if(!K(r))return r;let t=e.weather_variables??{};if(!e.rain_sensor&&!Object.values(t).some(h=>h&&h!=="none"))return r;let n=fc.get(r)??new WeakMap;fc.set(r,n);let i=n.get(e);if(i)return i;let o={friendly_name:"Wetter",nf_symcon_weather:!0},s=h=>t[h]&&t[h]!=="none"?r.states[t[h]]:void 0;for(let h of["temperature","humidity","pressure","cloud_coverage","precipitation","precipitation_total","illuminance","uv_index","visibility"]){let g=s(h),_=Oe(g);_!==null&&(o[h]=h==="cloud_coverage"&&g?.attributes.symcon_max===1?_*100:_),g?.attributes.unit_of_measurement&&(o[`${h}_unit`]=g.attributes.unit_of_measurement)}for(let h of["wind_speed","wind_gust_speed"]){let g=s(h),_=Oe(g);_!==null&&(o[h]=Gr(_,g?.attributes.unit_of_measurement))}o.wind_speed_unit="km/h";let a=tt(s("wind_bearing"));a!==null&&(o.wind_bearing=a);let l=wf(nt(s("condition"))),u=e.rain_sensor?r.states[e.rain_sensor]:void 0,c=se(u);c!==null&&e.rain_sensor_inverted&&(c=!c),c===null&&typeof o.precipitation=="number"&&(c=o.precipitation>0),se(s("lightning"))?l=c?"lightning-rainy":"lightning":se(s("snow"))?l=c?"snowy-rainy":"snowy":se(s("fog"))?l="fog":c===!0?l=Number(o.precipitation??0)>=8?"pouring":"rainy":c===!1&&l&&/rain|pouring/.test(l)&&(l=null),!l&&typeof o.cloud_coverage=="number"&&(l=o.cloud_coverage>70?"cloudy":o.cloud_coverage>20?"partlycloudy":"sunny"),!l&&c===!1&&(l="sunny");let d={entity_id:pc,state:l??"unknown",attributes:o},m={...r,states:{...r.states,[pc]:d}};return n.set(e,m),m}var Lo=class extends Q{static properties={hass:{attribute:!1},floors:{attribute:!1},floorId:{attribute:!1},inline:{type:Boolean,reflect:!0},compact:{type:Boolean},folded:{state:!0}};constructor(){super(),this.floors=[],this.floorId=null,this.inline=!1,this.compact=!1,this.folded=null}value(e){return e?p`<span class="value" title=${`${Nt(e)}${e.manual?" \xB7 eigener Z\xE4hler":""}`}><b>${Fe(this.hass,e)}</b>${e.period!=="total"?p`<small>${{day:"heute",month:"Monat",year:"Jahr"}[e.period]}</small>`:f}${G(this.hass,e.sources,`${Te[e.kind]} \xB7 ${Nt(e)}`)}</span>`:f}open(e,t){this.dispatchEvent(new CustomEvent("utility-open",{detail:{floorId:t?this.floorId:e,roomId:t?e:null},bubbles:!0,composed:!0}))}rows(e){return Ie.map(t=>{let n=e.filter(o=>o.kind===t&&o.metric==="power"),i=e.filter(o=>o.kind===t&&o.metric==="energy");return Array.from({length:Math.max(n.length,i.length)},(o,s)=>p`<div class="row"><span class="kind" title=${Te[t]}>${s?"":`${gn[t]} ${Te[t]}`}</span>${n[s]?this.value(n[s]):p`<span></span>`}${i[s]?this.value(i[s]):p`<span></span>`}</div>`)})}render(){if(!this.hass)return f;let e=this.floors.flatMap(s=>s.rooms),t=this.floors.find(s=>s.id===this.floorId);if(this.inline){let s=t?De(this.hass,t,e):ol(this.hass,this.floors);return p`${Ie.map(a=>{let l=s.filter(u=>u.kind===a);return l.length?p`<div class="meter" aria-label=${`${t?.name||"Gesamtgeb\xE4ude"} \xB7 ${Te[a]}`}><span class="medium" title=${t?.name||"Gesamtgeb\xE4ude"}>${gn[a]} ${Te[a]}</span><div class="values">${l.map(u=>this.value(u))}</div></div>`:f})}`}let i=(t?to(this.hass,t,e):[...this.floors].sort((s,a)=>a.elevation-s.elevation).map(s=>({id:s.id,name:s.name,path:"",readings:De(this.hass,s,e),rooms:[]}))).filter(s=>s.readings.length);if(!i.length)return f;let o=this.folded??this.compact;return p`<section class="panel" aria-label=${t?"BereichsLine truncated
|
||||
`]};function Rf(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",Wo);var zf=new URL(import.meta.url),Tf=new URL("./nextfloor-3d.js?v=b12e75cc8bb7",zf).href,gc;function _c(){return gc??=import(Tf),gc}function bc(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 vc="weather.nextfloor_symcon",wc={condition:"Wetterzustand",temperature:"Au\xDFentemperatur",humidity:"Au\xDFenluftfeuchte",pressure:"Luftdruck",wind_speed:"Windgeschwindigkeit",wind_gust_speed:"Windb\xF6en",wind_bearing:"Windrichtung",cloud_coverage:"Bew\xF6lkung",precipitation:"Niederschlagsrate",precipitation_total:"Niederschlagsmenge",illuminance:"Au\xDFenhelligkeit",uv_index:"UV-Index",visibility:"Sichtweite",snow:"Schnee",fog:"Nebel",lightning:"Gewitter"},yc=new WeakMap;function Df(r){let e=r.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").trim();return["sunny","clear-night","partlycloudy","cloudy","fog","rainy","pouring","lightning-rainy","lightning","hail","snowy","snowy-rainy","windy","windy-variant"].includes(e)?e:/kein regen|trocken|wolkenlos|klar|sonnig/.test(e)?"sunny":/gewitter|blitz/.test(e)?"lightning-rainy":/schneeregen/.test(e)?"snowy-rainy":/schnee/.test(e)?"snowy":/hagel/.test(e)?"hail":/starkregen/.test(e)?"pouring":/regen|niesel/.test(e)?"rainy":/nebel/.test(e)?"fog":/teil.*wolk|heiter|leicht.*wolk/.test(e)?"partlycloudy":/wolk|bedeckt/.test(e)?"cloudy":/wind|sturm/.test(e)?"windy":null}function ni(r,e){if(!K(r))return r;let t=e.weather_variables??{};if(!e.rain_sensor&&!Object.values(t).some(h=>h&&h!=="none"))return r;let n=yc.get(r)??new WeakMap;yc.set(r,n);let i=n.get(e);if(i)return i;let o={friendly_name:"Wetter",nf_symcon_weather:!0},s=h=>t[h]&&t[h]!=="none"?r.states[t[h]]:void 0;for(let h of["temperature","humidity","pressure","cloud_coverage","precipitation","precipitation_total","illuminance","uv_index","visibility"]){let g=s(h),_=Le(g);_!==null&&(o[h]=h==="cloud_coverage"&&g?.attributes.symcon_max===1?_*100:_),g?.attributes.unit_of_measurement&&(o[`${h}_unit`]=g.attributes.unit_of_measurement)}for(let h of["wind_speed","wind_gust_speed"]){let g=s(h),_=Le(g);_!==null&&(o[h]=jr(_,g?.attributes.unit_of_measurement))}o.wind_speed_unit="km/h";let a=tt(s("wind_bearing"));a!==null&&(o.wind_bearing=a);let l=Df(nt(s("condition"))),u=e.rain_sensor?r.states[e.rain_sensor]:void 0,c=ae(u);c!==null&&e.rain_sensor_inverted&&(c=!c),c===null&&typeof o.precipitation=="number"&&(c=o.precipitation>0),ae(s("lightning"))?l=c?"lightning-rainy":"lightning":ae(s("snow"))?l=c?"snowy-rainy":"snowy":ae(s("fog"))?l="fog":c===!0?l=Number(o.precipitation??0)>=8?"pouring":"rainy":c===!1&&l&&/rain|pouring/.test(l)&&(l=null),!l&&typeof o.cloud_coverage=="number"&&(l=o.cloud_coverage>70?"cloudy":o.cloud_coverage>20?"partlycloudy":"sunny"),!l&&c===!1&&(l="sunny");let m={entity_id:vc,state:l??"unknown",attributes:o},d={...r,states:{...r.states,[vc]:m}};return n.set(e,d),d}var Vo=class extends Q{static properties={hass:{attribute:!1},floors:{attribute:!1},floorId:{attribute:!1},inline:{type:Boolean,reflect:!0},compact:{type:Boolean},folded:{state:!0}};constructor(){super(),this.floors=[],this.floorId=null,this.inline=!1,this.compact=!1,this.folded=null}value(e){return e?p`<span class="value" title=${`${Ot(e)}${e.manual?" \xB7 eigener Z\xE4hler":""}`}><b>${Fe(this.hass,e)}</b>${e.period!=="total"?p`<small>${{day:"heute",month:"Monat",year:"Jahr"}[e.period]}</small>`:f}${G(this.hass,e.sources,`${Te[e.kind]} \xB7 ${Ot(e)}`)}</span>`:f}open(e,t){this.dispatchEvent(new CustomEvent("utility-open",{detail:{floorId:t?this.floorId:e,roomId:t?e:null},bubbles:!0,composed:!0}))}rows(e){return Ie.map(t=>{let n=e.filter(o=>o.kind===t&&o.metric==="power"),i=e.filter(o=>o.kind===t&&o.metric==="energy");return Array.from({length:Math.max(n.length,i.length)},(o,s)=>p`<div class="row"><span class="kind" title=${Te[t]}>${s?"":`${_n[t]} ${Te[t]}`}</span>${n[s]?this.value(n[s]):p`<span></span>`}${i[s]?this.value(i[s]):p`<span></span>`}</div>`)})}render(){if(!this.hass)return f;let e=this.floors.flatMap(s=>s.rooms),t=this.floors.find(s=>s.id===this.floorId);if(this.inline){let s=t?De(this.hass,t,e):ll(this.hass,this.floors);return p`${Ie.map(a=>{let l=s.filter(u=>u.kind===a);return l.length?p`<div class="meter" aria-label=${`${t?.name||"Gesamtgeb\xE4ude"} \xB7 ${Te[a]}`}><span class="medium" title=${t?.name||"Gesamtgeb\xE4ude"}>${_n[a]} ${Te[a]}</span><div class="values">${l.map(u=>this.value(u))}</div></div>`:f})}`}let i=(t?ro(this.hass,t,e):[...this.floors].sort((s,a)=>a.elevation-s.elevation).map(s=>({id:s.id,name:s.name,path:"",readings:De(this.hass,s,e),rooms:[]}))).filter(s=>s.readings.length);if(!i.length)return f;let o=this.folded??this.compact;return p`<section class="panel" aria-label=${t?"BereichsLine truncated
|
||||
<button class="heading" aria-expanded=${!o} @click=${()=>{this.folded=!o}}><span>${t?"Bereiche":"Stockwerke"}<small>${t?.name||"Gesamtgeb\xE4ude"}</small></span><span aria-hidden="true">${o?"+":"\u2212"}</span></button>
|
||||
${o?f:p`<div class="entries"><div class="columns"><span></span><span title="Leistung bzw. Durchfluss">Leistung</span><span>Energie / Verbrauch</span></div>
|
||||
${i.map(s=>p`<section class="entry" data-area=${t?s.id:f}>
|
||||
@@ -1649,9 +1649,9 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.kind { color:var(--nf-muted); font-size:10px; white-space:nowrap; }
|
||||
.row .value b { font-size:11px; font-weight:normal; }
|
||||
@media(max-width:600px) { .entries { max-height:32vh; } }
|
||||
`};customElements.get("nf-utility-overview")||customElements.define("nf-utility-overview",Lo);var _c="image:";function Oo(r,e,t){let n=(e??"").trim();if(!n)return null;if(n.startsWith(_c))return t(n.slice(_c.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 In=r=>Number(r);function Nn(r){if(Array.isArray(r)){let[o,s]=[In(r[0]),In(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]=[In(e),In(t)];return Number.isFinite(n)&&Number.isFinite(i)?[n,i]:null}function bc(r){return r?Nn(r.charger)??Nn(r.charger_position):null}function vc(r){for(let[e,t]of Object.entries(r.states))if(e.startsWith("camera.")&&(Nn(t.attributes?.vacuum_position)??bc(t.attributes)))return e;return null}var yf=r=>Array.isArray(r)?typeof r[0]=="number":!!r&&typeof r=="object",Cn=(r,e)=>e?[r[0],-r[1]]:r;function xf(r){if(!r)return null;let e=r.mirror===!0,[t,n]=Cn(r.ga,e),[i,o]=Cn(r.gb,e),[s,a]=r.a,[l,u]=r.b,[c,d]=[i-t,o-n],[m,h]=[l-s,u-a],g=Math.hypot(c,d),_=Math.hypot(m,h);if(!(g>1e-6)||!(_>1e-6))return null;let b=_/g,v=Math.atan2(h,m)-Math.atan2(d,c),[S,k]=[Math.cos(v),Math.sin(v)];return M=>{let z=Cn(M,e),[R,F]=[z[0]-t,z[1]-n];return[s+b*(R*S-F*k),a+b*(R*k+F*S)]}}function kf(r){if(!r)return null;let e=r.mirror===!0,[t,n]=Cn(r.ga,e),[i,o]=Cn(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 wc(r,e,t){if(!e)return null;let n=r.states[e]?.attributes;if(!n)return null;let i=xf(t)??(g=>g),o=kf(t)??0,s=t?.mirror===!0?-1:1,a=n.vacuum_position,l=Nn(a),u=l?(()=>{let[g,_]=i(l),b=In(a?.a)*s;if(!Number.isFinite(b))return{x:g,z:_,heading:0};let v=b*Math.PI/180+o;return{x:g,z:_,heading:Math.atan2(Math.cos(v),Math.sin(v))}})():null,c=bc(n),d=Array.isArray(n.path)?n.path:[],m=d.length>0&&yf(d[0])?[d]:d,h=[];for(let g of m){let _=[];for(let b of Array.isArray(g)?g:[]){let v=Nn(b);v&&_.push(i(v))}_.length>1&&h.push(_)}return!u&&!c&&!h.length?null:{pose:u,charger:c?i(c):null,path:h}}var yc="nextfloor.lock3d",xc=520,Vo=class extends Q{static properties={hass:{attribute:!1},building:{attribute:!1},floorId:{attribute:!1},roomId:{attribute:!1},wallMode:{attribute:!1},solidWalls:{attribute:!1},glassWalls:{attribute:!1},explode:{type:Boolean},keepRoof:{attribute:!1},markerMode:{attribute:!1},markerNames:{attribute:!1},markersOutside:{attribute:!1},tapInRoom:{type:Boolean},roomDoubleTap:{attribute:!1},heatMode:{attribute:!1},theme:{attribute:!1},accent:{attribute:!1},furnitureColors:{attribute:!1},packs:{attribute:!1},showEnergy:{attribute:!1},flows:{attribute:!1},holograms:{attribute:!1},furnish:{type:Boolean},surfaceGrab:{attribute:!1},furnishTypes:{attribute:!1},weather:{type:Boolean},weatherEntityId:{attribute:!1},weatherDensity:{attribute:!1},timeOfDay:{attribute:!1},selectedFurniture:{attribute:!1},selectedDevice:{attribute:!1},_sky:{state:!0},quality:{attribute:!1},showStats:{type:Boolean},_stats:{state:!0},_error:{state:!0},_energy:{state:!0},_flows:{state:!0},_liveEnergy:{state:!0},_liveCards:{state:!0},_liveCardOn:{state:!0},_houseFolded:{state:!0},_utilityOverviewVisible:{state:!0},_swipe:{state:!0},_menu:{state:!0},_pluginWindow:{state:!0},_plate:{state:!0},_blend:{state:!0},_wallBig:{state:!0},_find:{state:!0},_central:{state:!0},_thumbsCompact:{state:!0},_armed:{state:!0},central:{attribute:!1},centralOpen:{attribute:!1},keepCamera:{attribute:!1},plain:{attribute:!1},rightBack:{attribute:!1},templateName:{attribute:!1},readable:{type:Boolean,reflect:!0},today:{attribute:!1},_todayOpen:{state:!0},_todayItems:{state:!0},_forecast:{state:!0},zoom:{attribute:!1},buttons:{attribute:!1},_thumbs:{state:!0},floorThumbs:{attribute:!1},clean:{attribute:!1},cleanButton:{attribute:!1},clock:{attribute:!1},lockButton:{attribute:!1},walkButton:{attribute:!1},travelButton:{attribute:!1},_travel:{state:!0},_walking:{state:!0},_stick:{state:!0},_locked:{state:!0},_now:{state:!0},roomLabels:{attribute:!1},roomNamesButton:{attribute:!1},floorStack:{attribute:!1},panelOpen:{attribute:!1},alerts:{attribute:!1},alertJump:{attribute:!1},scenes:{attribute:!1},announcements:{attribute:!1},sensorBar:{attribute:!1},screenName:{attribute:!1},_announcement:{state:!0},dimmed:{attribute:!1},autoOrbit:{attribute:!1},startView:{attribute:!1},outsideOpen:{attribute:!1},_low:{state:!0},_narrowStage:{state:!0},_shortStage:{state:!0},_phoneStage:{state:!0},_alerts:{state:!0},_sceneFired:{state:!0}};stopAnnouncements=null;announceTimer;get liveCardsOn(){return this.holograms??this._liveCardOn}cloud=0;confirmSet=new Set;shownStartView;placementInfo=new Map;live=null;travelTimer;dayCurves=null;curvesAt=0;clockTimer;stopPlugins=null;pluginsDirty=!1;resizeObs=null;alertSrc=null;alertTimer;contactTimer;seenAlerts=new Set;roomFlash=null;findIndex=null;tintSig="";thumbTimer;thumbSig="";thumbsAt=0;armTimer;forecastAt=0;forecastKey
Line truncated
|
||||
`};customElements.get("nf-utility-overview")||customElements.define("nf-utility-overview",Vo);var xc="image:";function Ko(r,e,t){let n=(e??"").trim();if(!n)return null;if(n.startsWith(xc))return t(n.slice(xc.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 Cn=r=>Number(r);function On(r){if(Array.isArray(r)){let[o,s]=[Cn(r[0]),Cn(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]=[Cn(e),Cn(t)];return Number.isFinite(n)&&Number.isFinite(i)?[n,i]:null}function kc(r){return r?On(r.charger)??On(r.charger_position):null}function Sc(r){for(let[e,t]of Object.entries(r.states))if(e.startsWith("camera.")&&(On(t.attributes?.vacuum_position)??kc(t.attributes)))return e;return null}var Ff=r=>Array.isArray(r)?typeof r[0]=="number":!!r&&typeof r=="object",Nn=(r,e)=>e?[r[0],-r[1]]:r;function Hf(r){if(!r)return null;let e=r.mirror===!0,[t,n]=Nn(r.ga,e),[i,o]=Nn(r.gb,e),[s,a]=r.a,[l,u]=r.b,[c,m]=[i-t,o-n],[d,h]=[l-s,u-a],g=Math.hypot(c,m),_=Math.hypot(d,h);if(!(g>1e-6)||!(_>1e-6))return null;let b=_/g,v=Math.atan2(h,d)-Math.atan2(m,c),[S,k]=[Math.cos(v),Math.sin(v)];return M=>{let z=Nn(M,e),[R,F]=[z[0]-t,z[1]-n];return[s+b*(R*S-F*k),a+b*(R*k+F*S)]}}function Pf(r){if(!r)return null;let e=r.mirror===!0,[t,n]=Nn(r.ga,e),[i,o]=Nn(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 $c(r,e,t){if(!e)return null;let n=r.states[e]?.attributes;if(!n)return null;let i=Hf(t)??(g=>g),o=Pf(t)??0,s=t?.mirror===!0?-1:1,a=n.vacuum_position,l=On(a),u=l?(()=>{let[g,_]=i(l),b=Cn(a?.a)*s;if(!Number.isFinite(b))return{x:g,z:_,heading:0};let v=b*Math.PI/180+o;return{x:g,z:_,heading:Math.atan2(Math.cos(v),Math.sin(v))}})():null,c=kc(n),m=Array.isArray(n.path)?n.path:[],d=m.length>0&&Ff(m[0])?[m]:m,h=[];for(let g of d){let _=[];for(let b of Array.isArray(g)?g:[]){let v=On(b);v&&_.push(i(v))}_.length>1&&h.push(_)}return!u&&!c&&!h.length?null:{pose:u,charger:c?i(c):null,path:h}}var Mc="nextfloor.lock3d",Ac=520,Uo=class extends Q{static properties={hass:{attribute:!1},building:{attribute:!1},floorId:{attribute:!1},roomId:{attribute:!1},wallMode:{attribute:!1},solidWalls:{attribute:!1},glassWalls:{attribute:!1},explode:{type:Boolean},keepRoof:{attribute:!1},markerMode:{attribute:!1},markerNames:{attribute:!1},markersOutside:{attribute:!1},tapInRoom:{type:Boolean},roomDoubleTap:{attribute:!1},heatMode:{attribute:!1},theme:{attribute:!1},accent:{attribute:!1},furnitureColors:{attribute:!1},packs:{attribute:!1},showEnergy:{attribute:!1},flows:{attribute:!1},holograms:{attribute:!1},furnish:{type:Boolean},surfaceGrab:{attribute:!1},furnishTypes:{attribute:!1},weather:{type:Boolean},weatherEntityId:{attribute:!1},weatherDensity:{attribute:!1},timeOfDay:{attribute:!1},selectedFurniture:{attribute:!1},selectedDevice:{attribute:!1},_sky:{state:!0},quality:{attribute:!1},showStats:{type:Boolean},_stats:{state:!0},_error:{state:!0},_energy:{state:!0},_flows:{state:!0},_liveEnergy:{state:!0},_liveCards:{state:!0},_liveCardOn:{state:!0},_houseFolded:{state:!0},_utilityOverviewVisible:{state:!0},_swipe:{state:!0},_menu:{state:!0},_pluginWindow:{state:!0},_plate:{state:!0},_blend:{state:!0},_wallBig:{state:!0},_find:{state:!0},_central:{state:!0},_thumbsCompact:{state:!0},_armed:{state:!0},central:{attribute:!1},centralOpen:{attribute:!1},keepCamera:{attribute:!1},plain:{attribute:!1},rightBack:{attribute:!1},templateName:{attribute:!1},readable:{type:Boolean,reflect:!0},today:{attribute:!1},_todayOpen:{state:!0},_todayItems:{state:!0},_forecast:{state:!0},zoom:{attribute:!1},buttons:{attribute:!1},_thumbs:{state:!0},floorThumbs:{attribute:!1},clean:{attribute:!1},cleanButton:{attribute:!1},clock:{attribute:!1},lockButton:{attribute:!1},walkButton:{attribute:!1},travelButton:{attribute:!1},_travel:{state:!0},_walking:{state:!0},_stick:{state:!0},_locked:{state:!0},_now:{state:!0},roomLabels:{attribute:!1},roomNamesButton:{attribute:!1},floorStack:{attribute:!1},panelOpen:{attribute:!1},alerts:{attribute:!1},alertJump:{attribute:!1},scenes:{attribute:!1},announcements:{attribute:!1},sensorBar:{attribute:!1},screenName:{attribute:!1},_announcement:{state:!0},dimmed:{attribute:!1},autoOrbit:{attribute:!1},startView:{attribute:!1},outsideOpen:{attribute:!1},_low:{state:!0},_narrowStage:{state:!0},_shortStage:{state:!0},_phoneStage:{state:!0},_alerts:{state:!0},_sceneFired:{state:!0}};stopAnnouncements=null;announceTimer;get liveCardsOn(){return this.holograms??this._liveCardOn}cloud=0;confirmSet=new Set;shownStartView;placementInfo=new Map;live=null;travelTimer;dayCurves=null;curvesAt=0;clockTimer;stopPlugins=null;pluginsDirty=!1;resizeObs=null;alertSrc=null;alertTimer;contactTimer;seenAlerts=new Set;roomFlash=null;findIndex=null;tintSig="";thumbTimer;thumbSig="";thumbsAt=0;armTimer;forecastAt=0;forecastKey
Line truncated
|
||||
${e.map(t=>p`<button class="nf-chip" aria-pressed=${!this.hiddenLayers.has(t.id)} @click=${()=>this.toggleLayer(t.id)}>${this.hiddenLayers.has(t.id)?"\u25CC":"\u{1F441}"} ${t.name}</button>`)}
|
||||
</div>`}syncDevices(e){let t=this.viewer,n=this.building;if(!t||!n||!this.hass)return;let i=this._travel,o=i&&!i.loading?Bt(this.hass,i.history,i.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==o.entities)&&(this.openingLinks=Ne(o,n.floors),this.furnitureLinks=ft(o,n.floors),this.linkedRegistry=o.entities,this.findIndex=null,this.alertSrc=this.alerts?lu(o,n,this.weatherEntityId,this.openingLinks):null,this.watched=fu({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;To(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=wn(o,n),l=Wa(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 u=this.furnitureMarkers(o,n,new Set(l.map(w=>w.id)),new Set(a.map(w=>w.powerEntity)));a.push(...u.consumers);let c=yn(o,n,a,Ke(n,w=>this.furnitureLinks?.get(w.id)?.power??null)),d=new Map(a.filter(w=>w.id!==w.powerEntity).map(w=>[w.id,w.power]));this.confirmSet=gt(o,n.floors);let m=new Set(this.liveCardsOn?this._liveCards.flatMap(w=>w.kind==="media"?[w.media.entity]:w.kind==="car"?[w.spot]:[]):[]);for(let w of n.floors)for(let y of w.outdoor??[]){if(!y.area_id&&!y.temp_entity&&!y.pump_entity)continue;let B=y.temp_entity?o.states[y.temp_entity]:void 0,D=y.pump_entity?o.states[y.pump_entity]:void 0,[O,fe]=Ee(y.points),st=B&&Number.isFinite(Number(B.state))?`${W(o,le(o,ur(Number(B.state),B.attributes.unit_of_measurement)),1)} ${re(o)}`:"",xt=!!D&&te(D);l.push({id:y.area_id?`outdoor:${y.id}`:y.pump_entity??y.temp_entity,floorId:w.id,roomId:null,x:O,z:fe,y:rr(w,y,O,fe)+.7,icon:Re(y.type==="pool"?"pool":y.type==="terrace"?"table-chair":"tree-outline"),name:y.area_id&&o.areas?.[y.area_id]?.name||$(o,`out_${y.type}`),text:[st,xt?$(o,"pool_pump_on"):""].filter(Boolean).join(" \xB7 "),active:xt,unavailable:!1,glow:null,show:"always"})}let h=new Map;for(let w of n.floors){for(let y of w.placements)y.pin_offset&&h.set(`${w.id}:${y.entity_id}`,y.pin_offset);for(let y of w.furniture)y.pin_offset&&h.set(`f:${y.id}`,y.pin_offset)}let g=w=>{let y=w.lamp?void 0:(w.furnitureId?h.get(`f:${w.furnitureId}`):void 0)??h.get(`${w.floorId}:${w.id}`);return y?{...w,x:w.x+(y.x??0),z:w.z+(y.z??0),y:w.y+(y.y??0)}:w};t.setDevices([...[...l,...u.markers].map(g).map(w=>{let y=w.show==="no_power"||"energyDevice"in w&&w.energyDevice?null:d.get(w.id)??null,B={...w,power:y,powerText:y===null?void 0:de(o,y),effect:this.dimmed?void 0:w.effect,text:this.subMeterText(o,n,c,w.furnitureId)??w.text},D=w.ownName&&(w.showName||this.markerNames)?w.ownName:"",O=m.has(w.id)||!!w.furnitureId&&m.has(w.furnitureId);return{...B,pin:this.showPin(B)&&!O,full:w.show==="always",caption:D}})]),t.setPickTargets(u.targets,this.openingTargets(),this.secondBlinds()),t.setScreens(u.screens),t.setFridgeDoors(wa(o,n.floors)),t.setCovers(Ta(o,n)),t.setRobots(this.robotInfos(o,n));let _=new Map;for(let w of n.floors)for(let y of w.furniture)!X(y.type)?.pet||!y.room_sensor||y.room_sensor==="none"||_.set(y.id,Wi(o,w.rooms.filter(B=>B.points.length>=3),null,y.room_sensor)?.id??null);_.size&&t.setPetRooms(_),t.setRoofWindows(ru(o,n)),t.setParked(vo(o,n)),t.setGateStates(yu(o,n));let b=new Map(n.floors.flatMap(w=>w.openings.map(y=>[y.id,y.type]))),v=new Map([...this.openingLinks].map(([w,y])=>[w,We(o,y,b.get(w))]));t.setOpeningStates(v),this.setAlerts(this.alertSrc?go(o,n,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(o);let S=[...l,...u.markers].map(w=>`${w.id}:${w.glow?`${w.glow.level.toFixed(1)}/${w.glow.color.map(y=>y.toFixed(1)).join("/")}`:0}`).join(";")+"|"+[...v].map(([w,y])=>`${w}:${y.open}:${y.cover===null?"-":y.cover.toFixed(1)}`).join(";");if(S!==this.thumbSig){let w=this.thumbSig==="";this.thumbSig=S,w||this.scheduleThumbs(1500)}let k=Pu(o,n,a,n.energy.advanced?w=>this.furnitureLinks?.get(w.id)?.power??null:void 0),M=this.liveCars(o,n);for(let w of M){if(!w.car.home||!w.car.charging&&!w.car.plugged)continue;let y=n.floors.flatMap(O=>O.furniture.filter(fe=>fe.type==="wallbox").map(fe=>({floorId:O.id,x:fe.x,z:fe.z,y:1}))).sort((O,fe)=>Math.hypot(O.x-w.at.x,O.z-w.at.z)-Math.hypot(fe.x-w.at.x,fe.z-w.at.z))[0],B=y&&y.floorId===w.at.floorId&&Math.hypot(y.x-w.at.x,y.z-w.at.z)<9,D=y??Dn(n);!D||!w.car.charging&&!B||k.arcs.push({key:`car:${w.spot}`,from:D,to:{...w.at,y:.8},power:w.car.charging?w.car.chargingW??7e3:0,color:[80,175,255],...B?{via:[{...D,y:.35},{floorId:w.at.floorId,x:(D.x+w.at.x)/2,z:(D.z+w.at.z)/2,y:.08},{...w.at,y:.5}],cable:!0}:{}})}let z=Dn(n);for(let w of this.liveHeatPumps(n)){let y=w.pump.heat??(w.pump.mode==="heating"||w.pLine truncated
|
||||
</div>`}syncDevices(e){let t=this.viewer,n=this.building;if(!t||!n||!this.hass)return;let i=this._travel,o=i&&!i.loading?Vt(this.hass,i.history,i.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==o.entities)&&(this.openingLinks=Ne(o,n.floors),this.furnitureLinks=ft(o,n.floors),this.linkedRegistry=o.entities,this.findIndex=null,this.alertSrc=this.alerts?du(o,n,this.weatherEntityId,this.openingLinks):null,this.watched=vu({hass:o,building:n,openingLinks:this.openingLinks,furnitureLinks:this.furnitureLinks,needsRoomSensors:this.heatMode!=="none"||this.roomLabels,alertSources:this.alertSrc,weatherEntityId:this.weatherEntityId}),e=!0),!(e||this.watched.some(y=>this.shownStates.get(y)!==o.states[y])))return;Fo(o,n).join(",")!==this.shownFor?.key&&t.setBuilding(this.shownBuilding(o)),this.shownStates=new Map(this.watched.map(y=>[y,o.states[y]])),this.syncHydronics(t,n,o),this.refreshToday(n),this.refreshForecast(n);let a=wn(o,n),l=Ba(o,n.floors.some(y=>y.layer&&this.hiddenLayers.has(y.id))?this.shownBuilding(o):n);this.placementInfo=new Map(l.map(y=>[y.id,{floorId:y.floorId,roomId:y.roomId,x:y.x,z:y.z,y:y.y,rotation:y.rotation??0}]));let u=this.furnitureMarkers(o,n,new Set(l.map(y=>y.id)),new Set(a.map(y=>y.powerEntity)));a.push(...u.consumers);let c=xn(o,n,a,Ke(n,y=>this.furnitureLinks?.get(y.id)?.power??null)),m=new Map(a.filter(y=>y.id!==y.powerEntity).map(y=>[y.id,y.power]));this.confirmSet=gt(o,n.floors);let d=new Set(this.liveCardsOn?this._liveCards.flatMap(y=>y.kind==="media"?[y.media.entity]:y.kind==="car"?[y.spot]:[]):[]);for(let y of n.floors)for(let w of y.outdoor??[]){if(!w.area_id&&!w.temp_entity&&!w.pump_entity)continue;let B=w.temp_entity?o.states[w.temp_entity]:void 0,D=w.pump_entity?o.states[w.pump_entity]:void 0,[L,fe]=Ee(w.points),st=B&&Number.isFinite(Number(B.state))?`${O(o,le(o,cr(Number(B.state),B.attributes.unit_of_measurement)),1)} ${re(o)}`:"",kt=!!D&&te(D);l.push({id:w.area_id?`outdoor:${w.id}`:w.pump_entity??w.temp_entity,floorId:y.id,roomId:null,x:L,z:fe,y:ir(y,w,L,fe)+.7,icon:Re(w.type==="pool"?"pool":w.type==="terrace"?"table-chair":"tree-outline"),name:w.area_id&&o.areas?.[w.area_id]?.name||$(o,`out_${w.type}`),text:[st,kt?$(o,"pool_pump_on"):""].filter(Boolean).join(" \xB7 "),active:kt,unavailable:!1,glow:null,show:"always"})}let h=new Map;for(let y of n.floors){for(let w of y.placements)w.pin_offset&&h.set(`${y.id}:${w.entity_id}`,w.pin_offset);for(let w of y.furniture)w.pin_offset&&h.set(`f:${w.id}`,w.pin_offset)}let g=y=>{let w=y.lamp?void 0:(y.furnitureId?h.get(`f:${y.furnitureId}`):void 0)??h.get(`${y.floorId}:${y.id}`);return w?{...y,x:y.x+(w.x??0),z:y.z+(w.z??0),y:y.y+(w.y??0)}:y};t.setDevices([...[...l,...u.markers].map(g).map(y=>{let w=y.show==="no_power"||"energyDevice"in y&&y.energyDevice?null:m.get(y.id)??null,B={...y,power:w,powerText:w===null?void 0:de(o,w),effect:this.dimmed?void 0:y.effect,text:this.subMeterText(o,n,c,y.furnitureId)??y.text},D=y.ownName&&(y.showName||this.markerNames)?y.ownName:"",L=d.has(y.id)||!!y.furnitureId&&d.has(y.furnitureId);return{...B,pin:this.showPin(B)&&!L,full:y.show==="always",caption:D}})]),t.setPickTargets(u.targets,this.openingTargets(),this.secondBlinds()),t.setScreens(u.screens),t.setFridgeDoors(ka(o,n.floors)),t.setCovers(Ha(o,n)),t.setRobots(this.robotInfos(o,n));let _=new Map;for(let y of n.floors)for(let w of y.furniture)!X(w.type)?.pet||!w.room_sensor||w.room_sensor==="none"||_.set(w.id,Li(o,y.rooms.filter(B=>B.points.length>=3),null,w.room_sensor)?.id??null);_.size&&t.setPetRooms(_),t.setRoofWindows(su(o,n)),t.setParked(wo(o,n)),t.setGateStates($u(o,n));let b=new Map(n.floors.flatMap(y=>y.openings.map(w=>[w.id,w.type]))),v=new Map([...this.openingLinks].map(([y,w])=>[y,Oe(o,w,b.get(y))]));t.setOpeningStates(v),this.setAlerts(this.alertSrc?bo(o,n,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(o);let S=[...l,...u.markers].map(y=>`${y.id}:${y.glow?`${y.glow.level.toFixed(1)}/${y.glow.color.map(w=>w.toFixed(1)).join("/")}`:0}`).join(";")+"|"+[...v].map(([y,w])=>`${y}:${w.open}:${w.cover===null?"-":w.cover.toFixed(1)}`).join(";");if(S!==this.thumbSig){let y=this.thumbSig==="";this.thumbSig=S,y||this.scheduleThumbs(1500)}let k=Ou(o,n,a,n.energy.advanced?y=>this.furnitureLinks?.get(y.id)?.power??null:void 0),M=this.liveCars(o,n);for(let y of M){if(!y.car.home||!y.car.charging&&!y.car.plugged)continue;let w=n.floors.flatMap(L=>L.furniture.filter(fe=>fe.type==="wallbox").map(fe=>({floorId:L.id,x:fe.x,z:fe.z,y:1}))).sort((L,fe)=>Math.hypot(L.x-y.at.x,L.z-y.at.z)-Math.hypot(fe.x-y.at.x,fe.z-y.at.z))[0],B=w&&w.floorId===y.at.floorId&&Math.hypot(w.x-y.at.x,w.z-y.at.z)<9,D=w??Fn(n);!D||!y.car.charging&&!B||k.arcs.push({key:`car:${y.spot}`,from:D,to:{...y.at,y:.8},power:y.car.charging?y.car.chargingW??7e3:0,color:[80,175,255],...B?{via:[{...D,y:.35},{floorId:y.at.floorId,x:(D.x+y.at.x)/2,z:(D.z+y.at.z)/2,y:.08},{...y.at,y:.5}],cable:!0}:{}})}let z=Fn(n);for(let y of this.liveHeatPumps(n)){let w=y.pump.heat??(y.Line truncated
|
||||
<button class="nf-thumbs-fold" title=${$(this.hass,n?"thumbs_show":"thumbs_fold")} aria-label=${$(this.hass,n?"thumbs_show":"thumbs_fold")} @click=${i}>${n?"\u25B8":"\u25C2"}</button>
|
||||
<button class="nf-thumb nf-thumb-house" aria-pressed=${this.floorId===null} @click=${()=>this.fire("floor-tap",{floorId:null})}>
|
||||
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"><path d="M3 11l9-7 9 7M5 10v10h14V10" /></svg>
|
||||
@@ -1661,16 +1661,16 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${n?f:p`<img src=${o.url} alt="" />`}
|
||||
<span>${e.get(o.floorId)??""}</span>
|
||||
</button>`)}
|
||||
</nav>`}onDeviceHold(e,t,n){let i=H(e);i==="light"||i==="cover"||i==="switch"||i==="fan"||i==="lock"?this._menu={entity:e,x:t,y:n}:we(this,e)}onDeviceSwipe(e,t,n,i,o){let s=this.hass?.states[e];if(t==="start"){if(!s||C(s)||this.confirmSet.has(e))return!1;let l=H(e);if(l==="light"&&No(s).dim){let u=s.state==="on"?typeof s.attributes.brightness=="number"?Math.round(s.attributes.brightness/2.55):100:0;return this._swipe={entity:e,kind:"light",start:u,value:u,x:i,y:o},!0}if(l==="fan"&&typeof s.attributes.percentage_step=="number"){let u=s.state==="on"&&typeof s.attributes.percentage=="number"?s.attributes.percentage:0;return this._swipe={entity:e,kind:"fan",start:u,value:u,x:i,y:o},!0}if(l==="cover"&&Wo(s)){let u=s.attributes.current_position;return this._swipe={entity:e,kind:"cover",start:u,value:u,x:i,y:o},!0}return!1}let a=this._swipe;if(!a||a.entity!==e)return!1;if(t==="move"){let l=Math.round(Math.min(100,Math.max(0,a.start-n/220*100)));l!==a.value&&(this._swipe={...a,value:l});let u=performance.now();u-this.swipeSent>350&&(this.swipeSent=u,this.applySwipe())}else this.applySwipe(),clearTimeout(this.swipeTimer),this.swipeTimer=setTimeout(()=>this._swipe=null,700);return!0}applySwipe(){let e=this._swipe;!e||!this.hass||(e.kind==="light"?e.value<=0?this.hass.callService("light","turn_off",{entity_id:e.entity}):this.hass.callService("light","turn_on",{entity_id:e.entity,brightness_pct:e.value}):e.kind==="fan"?e.value<=0?this.hass.callService("fan","turn_off",{entity_id:e.entity}):this.hass.callService("fan","set_percentage",{entity_id:e.entity,percentage:e.value}):this.hass.callService("cover","set_cover_position",{entity_id:e.entity,position:e.value}))}openRoom(e,t){this.floorId===e&&this.roomId===t||(this.floorId!==e?(this.fire("floor-tap",{floorId:e}),setTimeout(()=>this.fire("room-tap",{floorId:e,roomId:t}),60)):this.fire("room-tap",{floorId:e,roomId:t}))}goTo(e){if(this._find=null,e.kind==="room"||e.kind==="circuit"){e.roomId&&this.openRoom(e.floorId,e.roomId);return}this.floorId!==e.floorId&&this.fire("floor-tap",{floorId:e.floorId}),setTimeout(()=>this.viewer?.focus(e.floorId,e.x,e.z,e.y,e.entity),120)}listenToAnnouncements(e){if(!e){this.stopAnnouncements?.(),this.stopAnnouncements=null,clearTimeout(this.announceTimer);return}if(this.stopAnnouncements)return;let t=!1;this.stopAnnouncements=()=>t=!0,qa(this.hass,n=>this.announce(n)).then(n=>{t?n():this.stopAnnouncements=n})}announce(e){let t=e;if(t?.reload===!0){(!t.template||t.template===this.templateName)&&setTimeout(()=>location.reload(),500+Math.random()*6e3);return}if(typeof e?.message!="string"||!e.message.trim()||!Ka(e,this.screenName)||!Ga(e))return;let n=Ua(e.message);this._announcement={message:e.message,until:Date.now()+n},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,n),ja(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?p`<button class="nf-announcement" role="alert" title=${$(this.hass,"close")} @click=${()=>this._announcement=null}>
|
||||
</nav>`}onDeviceHold(e,t,n){let i=P(e);i==="light"||i==="cover"||i==="switch"||i==="fan"||i==="lock"?this._menu={entity:e,x:t,y:n}:ye(this,e)}onDeviceSwipe(e,t,n,i,o){let s=this.hass?.states[e];if(t==="start"){if(!s||C(s)||this.confirmSet.has(e))return!1;let l=P(e);if(l==="light"&&Lo(s).dim){let u=s.state==="on"?typeof s.attributes.brightness=="number"?Math.round(s.attributes.brightness/2.55):100:0;return this._swipe={entity:e,kind:"light",start:u,value:u,x:i,y:o},!0}if(l==="fan"&&typeof s.attributes.percentage_step=="number"){let u=s.state==="on"&&typeof s.attributes.percentage=="number"?s.attributes.percentage:0;return this._swipe={entity:e,kind:"fan",start:u,value:u,x:i,y:o},!0}if(l==="cover"&&Bo(s)){let u=s.attributes.current_position;return this._swipe={entity:e,kind:"cover",start:u,value:u,x:i,y:o},!0}return!1}let a=this._swipe;if(!a||a.entity!==e)return!1;if(t==="move"){let l=Math.round(Math.min(100,Math.max(0,a.start-n/220*100)));l!==a.value&&(this._swipe={...a,value:l});let u=performance.now();u-this.swipeSent>350&&(this.swipeSent=u,this.applySwipe())}else this.applySwipe(),clearTimeout(this.swipeTimer),this.swipeTimer=setTimeout(()=>this._swipe=null,700);return!0}applySwipe(){let e=this._swipe;!e||!this.hass||(e.kind==="light"?e.value<=0?this.hass.callService("light","turn_off",{entity_id:e.entity}):this.hass.callService("light","turn_on",{entity_id:e.entity,brightness_pct:e.value}):e.kind==="fan"?e.value<=0?this.hass.callService("fan","turn_off",{entity_id:e.entity}):this.hass.callService("fan","set_percentage",{entity_id:e.entity,percentage:e.value}):this.hass.callService("cover","set_cover_position",{entity_id:e.entity,position:e.value}))}openRoom(e,t){this.floorId===e&&this.roomId===t||(this.floorId!==e?(this.fire("floor-tap",{floorId:e}),setTimeout(()=>this.fire("room-tap",{floorId:e,roomId:t}),60)):this.fire("room-tap",{floorId:e,roomId:t}))}goTo(e){if(this._find=null,e.kind==="room"||e.kind==="circuit"){e.roomId&&this.openRoom(e.floorId,e.roomId);return}this.floorId!==e.floorId&&this.fire("floor-tap",{floorId:e.floorId}),setTimeout(()=>this.viewer?.focus(e.floorId,e.x,e.z,e.y,e.entity),120)}listenToAnnouncements(e){if(!e){this.stopAnnouncements?.(),this.stopAnnouncements=null,clearTimeout(this.announceTimer);return}if(this.stopAnnouncements)return;let t=!1;this.stopAnnouncements=()=>t=!0,Ja(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()||!ja(e,this.screenName)||!qa(e))return;let n=Za(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?p`<button class="nf-announcement" role="alert" title=${$(this.hass,"close")} @click=${()=>this._announcement=null}>
|
||||
<span class="nf-announcement-icon" aria-hidden="true">📢</span><span class="nf-announcement-text">${e.message}</span>
|
||||
</button>`:f}renderAlerts(){let e=this.building;if(!this._alerts.length||!e)return f;let t=this._alerts.slice(0,3);return p`<div class="nf-alert-banner" role="alert">
|
||||
${t.map(n=>p`<button class="nf-alert nf-alert-${n.kind}" style=${n.color?`border-left-color:${n.color}`:""} title=${_o(this.hass,e,n)} @click=${()=>this.jumpTo(n)}>${_o(this.hass,e,n)}</button>`)}
|
||||
${t.map(n=>p`<button class="nf-alert nf-alert-${n.kind}" style=${n.color?`border-left-color:${n.color}`:""} title=${vo(this.hass,e,n)} @click=${()=>this.jumpTo(n)}>${vo(this.hass,e,n)}</button>`)}
|
||||
${this._alerts.length>3?p`<span class="nf-alert-more">+${this._alerts.length-3}</span>`:f}
|
||||
</div>`}renderScenes(){let e=this.building;if(!this.scenes||!this.roomId||this.panelOpen||!e||!this.hass)return f;let t=e.floors.flatMap(o=>o.rooms).find(o=>o.id===this.roomId),n=t?U(this.hass,t).filter(o=>H(o)==="scene"||H(o)==="script").slice(0,6):[];if(!n.length)return f;let i=t?.area_id?this.hass.areas?.[t.area_id]?.name:void 0;return p`<div class="nf-scenes">
|
||||
${n.map(o=>p`<button class="nf-chip" aria-pressed=${this._sceneFired===o} @click=${()=>this.runScene(o)}>${L(this.hass,o,i)}</button>`)}
|
||||
</div>`}renderScenes(){let e=this.building;if(!this.scenes||!this.roomId||this.panelOpen||!e||!this.hass)return f;let t=e.floors.flatMap(o=>o.rooms).find(o=>o.id===this.roomId),n=t?U(this.hass,t).filter(o=>P(o)==="scene"||P(o)==="script").slice(0,6):[];if(!n.length)return f;let i=t?.area_id?this.hass.areas?.[t.area_id]?.name:void 0;return p`<div class="nf-scenes">
|
||||
${n.map(o=>p`<button class="nf-chip" aria-pressed=${this._sceneFired===o} @click=${()=>this.runScene(o)}>${W(this.hass,o,i)}</button>`)}
|
||||
</div>`}renderFind(){let e=this.building;if(!e||!this.hass)return f;if(this._find===null)return p`<button class="nf-find-btn" title=${$(this.hass,"find")} aria-label=${$(this.hass,"find")} @click=${()=>this._find=""}>
|
||||
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="6.5" /><path d="M16 16l4.5 4.5" /></svg>
|
||||
</button>`;let t=lc(this.findIndex??=ac(this.hass,e),this._find);return p`<div class="nf-find">
|
||||
</button>`;let t=mc(this.findIndex??=hc(this.hass,e),this._find);return p`<div class="nf-find">
|
||||
<input
|
||||
type="search"
|
||||
placeholder=${$(this.hass,"find_placeholder")}
|
||||
@@ -1681,7 +1681,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
<button class="nf-find-close" aria-label=${$(this.hass,"close")} @click=${()=>this._find=null}>✕</button>
|
||||
${this._find.trim()?p`<div class="nf-find-list">
|
||||
${t.length?t.map(n=>p`<button @click=${()=>this.goTo(n)}>
|
||||
<span class="nf-find-icon"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d=${n.icon?yr(n.icon):"M4 10l8-6 8 6v10H4z"} /></svg></span>
|
||||
<span class="nf-find-icon"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d=${n.icon?xr(n.icon):"M4 10l8-6 8 6v10H4z"} /></svg></span>
|
||||
<span><b>${n.name}</b>${n.where?p`<small>${n.where}</small>`:f}</span>
|
||||
</button>`):p`<p>${$(this.hass,"find_none")}</p>`}
|
||||
</div>`:f}
|
||||
@@ -1693,42 +1693,42 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
@click=${()=>{this._central=!this._central,this._armed=null}}
|
||||
>
|
||||
<svg viewBox="0 0 24 24" width="19" height="19" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linejoin="round"><path d="M12 3.5l2.6 5.3 5.9.9-4.3 4.1 1 5.8L12 16.9l-5.2 2.7 1-5.8-4.3-4.1 5.9-.9z" /></svg>
|
||||
</button>`;if(!this._central)return i;let o=this.floorId?e.floors.find(b=>b.id===this.floorId):void 0,s=o?[o]:e.floors,a=s.flatMap(b=>Li(t,b).lights),l=s.flatMap(b=>Li(t,b).covers),u=a.filter(b=>t.states[b]?.state==="on").length,c=!o,d=(b,v,S,k)=>{if(k.length){if(c&&this._armed!==b){this._armed=b,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(v,S,{entity_id:k})}},m=(b,v,S,k,M)=>p`<button class="nf-btn ${this._armed===b?"nf-central-armed":""}" ?disabled=${!M.length} @click=${()=>d(b,S,k,M)}>
|
||||
</button>`;if(!this._central)return i;let o=this.floorId?e.floors.find(b=>b.id===this.floorId):void 0,s=o?[o]:e.floors,a=s.flatMap(b=>Bi(t,b).lights),l=s.flatMap(b=>Bi(t,b).covers),u=a.filter(b=>t.states[b]?.state==="on").length,c=!o,m=(b,v,S,k)=>{if(k.length){if(c&&this._armed!==b){this._armed=b,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(v,S,{entity_id:k})}},d=(b,v,S,k,M)=>p`<button class="nf-btn ${this._armed===b?"nf-central-armed":""}" ?disabled=${!M.length} @click=${()=>m(b,S,k,M)}>
|
||||
${this._armed===b?n("central_sure"):n(v)}
|
||||
</button>`,h=e.settings.favorite_floors??{},g=(e.settings.favorites??[]).filter(b=>t.states[b]&&(!h[b]||!o||h[b]===o.id)),_=this.buttons??e.settings.buttons??[];return p`${i}
|
||||
<div class="nf-central ${this.centralOpen?"nf-central-big":""}" role="dialog" aria-label=${n("central")}>
|
||||
<b>${o?o.name:n("central_house")}</b>
|
||||
<div class="nf-central-row">
|
||||
<span>${n("central_lights")}${a.length?p` <small>${u}/${a.length}</small>`:f}</span>
|
||||
${m("lights_on","central_on","light","turn_on",a.filter(b=>t.states[b]?.state==="off"))}
|
||||
${m("lights_off","central_off","light","turn_off",a.filter(b=>t.states[b]?.state==="on"))}
|
||||
${d("lights_on","central_on","light","turn_on",a.filter(b=>t.states[b]?.state==="off"))}
|
||||
${d("lights_off","central_off","light","turn_off",a.filter(b=>t.states[b]?.state==="on"))}
|
||||
</div>
|
||||
${l.length?p`<div class="nf-central-row">
|
||||
<span>${n("central_covers")} <small>${l.length}</small></span>
|
||||
${m("covers_open","central_open","cover","open_cover",l)}
|
||||
${m("covers_close","central_close","cover","close_cover",l)}
|
||||
${d("covers_open","central_open","cover","open_cover",l)}
|
||||
${d("covers_close","central_close","cover","close_cover",l)}
|
||||
</div>`:f}
|
||||
<b>${n("central_favorites")}</b>
|
||||
${g.length?p`<div class="nf-central-favs">
|
||||
${g.map(b=>{let[v,S]=$a(b),k=t.states[b],M=v==="homeassistant"&&k?.state==="on";return p`<button
|
||||
${g.map(b=>{let[v,S]=Ea(b),k=t.states[b],M=v==="homeassistant"&&k?.state==="on";return p`<button
|
||||
class="nf-chip"
|
||||
aria-pressed=${M||this._sceneFired===b}
|
||||
?disabled=${C(k)}
|
||||
@click=${()=>{t.callService(v,S,{entity_id:b}),this._sceneFired=b,setTimeout(()=>this._sceneFired=null,600)}}
|
||||
>
|
||||
${L(t,b)}
|
||||
${W(t,b)}
|
||||
</button>`})}
|
||||
</div>`:_.length?f:p`<p class="nf-central-hint">${n("central_no_favorites")}</p>`}
|
||||
${_.length?p`<div class="nf-central-favs">
|
||||
${_.map(b=>p`<button
|
||||
class="nf-chip nf-own-btn"
|
||||
aria-pressed=${Ma(t,b)}
|
||||
@click=${v=>{Oi(t,v.currentTarget,b),b.action!=="service"&&(this._central=!1)}}
|
||||
aria-pressed=${Ra(t,b)}
|
||||
@click=${v=>{Vi(t,v.currentTarget,b),b.action!=="service"&&(this._central=!1)}}
|
||||
>
|
||||
${b.icon?p`<ha-icon .icon=${b.icon.startsWith("mdi:")?b.icon:`mdi:${b.icon}`}></ha-icon>`:f}${b.label}
|
||||
</button>`)}
|
||||
</div>`:f}
|
||||
</div>`}toggleLock(){this._locked=!this._locked;try{localStorage.setItem(yc,this._locked?"1":"0")}catch{}}async openTravel(e){if(clearInterval(this.travelTimer),this.travelTimer=void 0,e===null||!this.hass){this._travel=null,this.syncDevices(!0);return}let t=Date.now(),n=t-e*36e5;this._travel={history:new Map,from:n,to:t,t:n,playing:!1,speed:e>24?3600:600,hours:e,moments:[],loading:!0};try{let i=await Sn(this.hass,jl(this.watched),n,t);if(!this._travel||this._travel.from!==n)return;this._travel={...this._travel,history:i,moments:ql(i,n,t),loading:!1}}catch{this._travel=null,this._error=$(this.hass,"travel_failed");return}this.syncDevices(!0)}travelTo(e){let t=this._travel;t&&(this._travel={...t,t:Math.min(t.to,Math.max(t.from,e))},this.syncDevices(!0))}playTravel(e){let t=this._travel;t&&(clearInterval(this.travelTimer),this.travelTimer=void 0,this._travel={...t,playing:e,t:e&&t.t>=t.to?t.from:t.t},e&&(this.travelTimer=setInterval(()=>{let n=this._travel;if(!n)return;let i=n.t+250*n.speed;i>=n.to&&this.playTravel(!1),this.travelTo(i)},250)))}renderTravel(){if(!this.hass||this.clean)return f;let e=a=>$(this.hass,a),t=this._travel;if(!t)return this.travelButton?p`<button class="nf-travel-btn" title=${e("travel")} aria-label=${e("travel")} @click=${()=>{this.openTravel(24)}}>⏪</button>`:f;let n=this.hass.language??navigator.language,i=new Intl.DateTimeFormat(n,{weekday:"short",hour:"2-digit",minute:"2-digit"}).format(new Date(t.t)),o=t.to-t.from||1,s=[[60,"travel_speed_min"],[600,"travel_speed_10min"],[3600,"travel_speed_hour"]];return p`<div class="nf-travel" role="group" aria-label=${e("travel")}>
|
||||
</div>`}toggleLock(){this._locked=!this._locked;try{localStorage.setItem(Mc,this._locked?"1":"0")}catch{}}async openTravel(e){if(clearInterval(this.travelTimer),this.travelTimer=void 0,e===null||!this.hass){this._travel=null,this.syncDevices(!0);return}let t=Date.now(),n=t-e*36e5;this._travel={history:new Map,from:n,to:t,t:n,playing:!1,speed:e>24?3600:600,hours:e,moments:[],loading:!0};try{let i=await $n(this.hass,Yl(this.watched),n,t);if(!this._travel||this._travel.from!==n)return;this._travel={...this._travel,history:i,moments:Jl(i,n,t),loading:!1}}catch{this._travel=null,this._error=$(this.hass,"travel_failed");return}this.syncDevices(!0)}travelTo(e){let t=this._travel;t&&(this._travel={...t,t:Math.min(t.to,Math.max(t.from,e))},this.syncDevices(!0))}playTravel(e){let t=this._travel;t&&(clearInterval(this.travelTimer),this.travelTimer=void 0,this._travel={...t,playing:e,t:e&&t.t>=t.to?t.from:t.t},e&&(this.travelTimer=setInterval(()=>{let n=this._travel;if(!n)return;let i=n.t+250*n.speed;i>=n.to&&this.playTravel(!1),this.travelTo(i)},250)))}renderTravel(){if(!this.hass||this.clean)return f;let e=a=>$(this.hass,a),t=this._travel;if(!t)return this.travelButton?p`<button class="nf-travel-btn" title=${e("travel")} aria-label=${e("travel")} @click=${()=>{this.openTravel(24)}}>⏪</button>`:f;let n=this.hass.language??navigator.language,i=new Intl.DateTimeFormat(n,{weekday:"short",hour:"2-digit",minute:"2-digit"}).format(new Date(t.t)),o=t.to-t.from||1,s=[[60,"travel_speed_min"],[600,"travel_speed_10min"],[3600,"travel_speed_hour"]];return p`<div class="nf-travel" role="group" aria-label=${e("travel")}>
|
||||
<button class="nf-travel-play" aria-label=${e(t.playing?"travel_pause":"travel_play")} ?disabled=${t.loading} @click=${()=>this.playTravel(!t.playing)}>${t.playing?"\u23F8":"\u25B6"}</button>
|
||||
<b class="nf-travel-when">${t.loading?e("travel_loading"):i}</b>
|
||||
<div class="nf-travel-track">
|
||||
@@ -1761,12 +1761,12 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
>
|
||||
${this.clean?ne`<svg viewBox="0 0 24 24" width="20" height="20"><path fill="currentColor" d="M12 6a9.8 9.8 0 0 1 9 6 9.8 9.8 0 0 1-9 6 9.8 9.8 0 0 1-9-6 9.8 9.8 0 0 1 9-6m0 2a4 4 0 1 0 0 8 4 4 0 0 0 0-8m0 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4" /></svg>`:ne`<svg viewBox="0 0 24 24" width="20" height="20"><path fill="currentColor" d="M2.4 3.8 3.8 2.4l17.8 17.8-1.4 1.4-3.3-3.3A10.5 10.5 0 0 1 12 19a9.8 9.8 0 0 1-9-6 10.3 10.3 0 0 1 3.6-4.3L2.4 3.8M12 7a4 4 0 0 1 4 4c0 .5-.1 1-.3 1.5l-5.2-5.2c.5-.2 1-.3 1.5-.3m-4 4a4 4 0 0 0 5.5 3.7l-5.2-5.2c-.2.5-.3 1-.3 1.5m4-7a9.8 9.8 0 0 1 9 6 10 10 0 0 1-2.6 3.6l-1.4-1.4A8 8 0 0 0 18.8 12 8 8 0 0 0 9.6 7.2L8 5.6A10.3 10.3 0 0 1 12 4" /></svg>`}
|
||||
</button>`}renderSwipe(){let e=this._swipe;if(!e||!this.hass)return f;let t=e.kind==="light"&&e.value<=0;return p`<div class="nf-swipe" style="left:${e.x}px;top:${e.y}px">
|
||||
<span>${L(this.hass,e.entity)}</span>
|
||||
<span>${W(this.hass,e.entity)}</span>
|
||||
<b>${t?$(this.hass,"swipe_off"):`${e.value} %`}</b>
|
||||
<i><em style="height:${e.value}%"></em></i>
|
||||
</div>`}tapPlate(e,t,n){let i=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),o=i?Bi(i.gang_entities,X(i.type)?.gangs??0):[];if(o.length===1)return this.onDeviceTap(o[0],t,n);o.length>1&&(this._plate={ids:o,x:t,y:n})}renderPlate(){let e=this._plate;if(!e||!this.hass)return f;let t=this.hass,n=()=>this._plate=null;return p`<div class="nf-menu-backdrop" @click=${n}></div>
|
||||
</div>`}tapPlate(e,t,n){let i=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),o=i?Ki(i.gang_entities,X(i.type)?.gangs??0):[];if(o.length===1)return this.onDeviceTap(o[0],t,n);o.length>1&&(this._plate={ids:o,x:t,y:n})}renderPlate(){let e=this._plate;if(!e||!this.hass)return f;let t=this.hass,n=()=>this._plate=null;return p`<div class="nf-menu-backdrop" @click=${n}></div>
|
||||
<div class="nf-plate-menu" style="left:${Math.max(8,e.x-110)}px;top:${Math.max(8,e.y-20-e.ids.length*46)}px" role="menu">
|
||||
${e.ids.map((i,o)=>{let s=t.states[i],a=te(s)||s?.state==="on";return p`<button role="menuitem" class=${a?"on":""} @click=${()=>{n(),this.onDeviceTap(i,e.x,e.y)}}><b>${o+1}</b><span>${L(t,i)}</span><i>${s?oe(t,s):"\u2013"}</i></button>`})}
|
||||
${e.ids.map((i,o)=>{let s=t.states[i],a=te(s)||s?.state==="on";return p`<button role="menuitem" class=${a?"on":""} @click=${()=>{n(),this.onDeviceTap(i,e.x,e.y)}}><b>${o+1}</b><span>${W(t,i)}</span><i>${s?se(t,s):"\u2013"}</i></button>`})}
|
||||
</div>`}renderMenu(){let e=this._menu;if(!e||!this.hass)return f;let t=this.renderRoot.querySelector(".nf-stage"),n=t?.clientWidth??800,i=t?.clientHeight??600,o=Math.max(8,Math.min(n-240,e.x-116)),s=Math.max(8,Math.min(i-360,e.y-170));return p`<div class="nf-menu-backdrop" @click=${()=>this._menu=null}></div>
|
||||
<nf-quick-menu
|
||||
style="left:${o}px;top:${s}px"
|
||||
@@ -1777,28 +1777,28 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.presets=${(this.building?.settings.media_presets??[]).filter(a=>!a.speakers?.length||a.speakers.includes(e.entity))}
|
||||
?confirmSwitch=${this.confirmSet.has(e.entity)}
|
||||
.myPosition=${this.myPositionOf(e.entity)}
|
||||
.tiltEntity=${_r(this.hass,this.building?.floors??[],e.entity)}
|
||||
.tiltEntity=${br(this.hass,this.building?.floors??[],e.entity)}
|
||||
@close=${()=>this._menu=null}
|
||||
></nf-quick-menu>`}myPositionOf(e){for(let t of this.building?.floors??[])for(let n of t.openings){let i=this.openingLinks?.get(n.id);if(n.my_position!=null&&(i?.cover===e||i?.cover2===e))return n.my_position}return null}onDeviceTap(e,t=0,n=0){if(e.startsWith("lamp:")||this._travel)return;let i=e.startsWith("tap:")?e.slice(4):this.tapPins.get(e);if(i){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===i);s?.tap&&Oi(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??Ke(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&we(this,a);return}let o=H(e);if(o==="cover"||o==="media"){this._menu={entity:e,x:t,y:n};return}if(o==="lock"){let s=Ci(this.hass,e),a=L(this.hass,e);confirm($(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(o&&Qs.has(o)){if(this.confirmSet.has(e)&&!confirm($(this.hass,"confirm_switch",{name:L(this.hass,e)})))return;Oa(this.hass,e)}else we(this,e)}pluginTapped(e){let t=this.hass?.states[e],n=this.placementInfo.get(e);if(!t||!n)return!1;let i=this.building?.floors.find(o=>o.id===n.floorId)?.placements.find(o=>o.entity_id===e);return Ts({hass:this.hass,entityId:e,state:t},n,i?.plugin??void 0,{showWindow:(o,s)=>{o&&"hass"in o&&(o.hass=this.hass),this._pluginWindow=o?{node:o,title:s?.title??""}:null},moreInfo:o=>we(this,o??e)})}renderPluginWindow(){let e=this._pluginWindow;return e?p`<div class="nf-plugin-window" @pointerdown=${t=>t.stopPropagation()}>
|
||||
></nf-quick-menu>`}myPositionOf(e){for(let t of this.building?.floors??[])for(let n of t.openings){let i=this.openingLinks?.get(n.id);if(n.my_position!=null&&(i?.cover===e||i?.cover2===e))return n.my_position}return null}onDeviceTap(e,t=0,n=0){if(e.startsWith("lamp:")||this._travel)return;if(e.startsWith("hydronic:")){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===e.slice(9));s&&this.hass&&Ho().then(a=>{if(this.isConnected&&this.hass)return this.hydronicModule=a,a.openHydronic(this.hass,s)}).catch(a=>{this._error=String(a)});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&&Vi(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??Ke(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&ye(this,a);return}let o=P(e);if(o==="cover"||o==="media"){this._menu={entity:e,x:t,y:n};return}if(o==="lock"){let s=Oi(this.hass,e),a=W(this.hass,e);confirm($(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(o&&ta.has(o)){if(this.confirmSet.has(e)&&!confirm($(this.hass,"confirm_switch",{name:W(this.hass,e)})))return;Ka(this.hass,e)}else ye(this,e)}pluginTapped(e){let t=this.hass?.states[e],n=this.placementInfo.get(e);if(!t||!n)return!1;let i=this.building?.floors.find(o=>o.id===n.floorId)?.placements.find(o=>o.entity_id===e);return Hs({hass:this.hass,entityId:e,state:t},n,i?.plugin??void 0,{showWindow:(o,s)=>{o&&"hass"in o&&(o.hass=this.hass),this._pluginWindow=o?{node:o,title:s?.title??""}:null},moreInfo:o=>ye(this,o??e)})}renderPluginWindow(){let e=this._pluginWindow;return e?p`<div class="nf-plugin-window" @pointerdown=${t=>t.stopPropagation()}>
|
||||
<div class="nf-pw-head"><span>${e.title}</span><button class="nf-pw-close" aria-label=${$(this.hass,"close")} @click=${()=>this._pluginWindow=null}>✕</button></div>
|
||||
<div class="nf-pw-body">${e.node}</div>
|
||||
</div>`:f}startViewOf(){return this.startView??this.building?.settings.start_view??null}currentView(){return this.viewer?.currentView()??null}resetView(){this.viewer?.resetView()}fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}toggleFlows(){this._flows=!this._flows;try{localStorage.setItem("nextfloor.flows",this._flows?"1":"0")}catch{}this.syncDevices(!0)}liveHeatPumps(e){let t=this.hass;if(!t)return[];let n=[];for(let i of e.floors)for(let o of i.furniture){if(!Yu(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=Zu(t,s?.entity??s?.power??null);a&&n.push({id:o.id,name:o.name||me(t,o.type),floorId:i.id,x:o.x,z:o.z,at:{floorId:i.id,x:o.x,z:o.z,y:ae(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(!Fo(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=Do(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||n.push({id:o.id,name:o.name||me(t,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:ae(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=tc(e,o);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=bo(e,o),l=a?pu(o,a):null,u=o.name||(a?me(e,a):me(e,o.type));n.push({spot:o.id,name:u,at:{floorId:i.id,x:o.x,z:o.z,y:ae(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||me(e,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:ae(i,o)+o.h+.15},rings:o.sound_rings})}for(let o of i.placements)o.entity_id.startsWith("media_player.")&&n.push({entity:o.entity_id,name:o.name||L(e,o.entity_id),at:{floorId:i.id,x:o.x,z:o.z,y:(o.y??1.1)+.15},rings:o.sound_rings})}return Xl(e,n)}refreshToday(e){let t=this.hass,n=e.settings.calendars??[],i=Math.max(1,Math.min(7,e.settings.today_days??1)),o=`${new Date().toDateString()}|${i}`;!t||!n.length||Date.now()-this.todayAt<9e5&&o===this.todayDay||(this.todayAt=Date.now(),this.todayDay=o,Ku(t,n,i).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,n=e.settings.forecast&&t?it(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,ju(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=Uu(this._forecast,Math.max(1,Math.min(7,i.days)));if(!o.length)return f;let s=it(n,this.weatherEntityId??t.settings.weather_entity),a=s?n.states[s]?.attributes:void 0,l=String(a?.temperature_unit??"\xB0"),u=String(a?.precipitation_unit??"mm"),c=n.language??navigator.language,d=new Intl.DateTimeFormat(c,{weekday:"short"}),m=h=>h===null?"\u2013":`${Math.round(h)}\xB0`;return p`<section class="nf-forecast" aria-label=${$(n,"forecast")}>
|
||||
</div>`:f}startViewOf(){return this.startView??this.building?.settings.start_view??null}currentView(){return this.viewer?.currentView()??null}resetView(){this.viewer?.resetView()}fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}toggleFlows(){this._flows=!this._flows;try{localStorage.setItem("nextfloor.flows",this._flows?"1":"0")}catch{}this.syncDevices(!0)}liveHeatPumps(e){let t=this.hass;if(!t)return[];let n=[];for(let i of e.floors)for(let o of i.furniture){if(!tc(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=ec(t,s?.entity??s?.power??null);a&&n.push({id:o.id,name:o.name||me(t,o.type),floorId:i.id,x:o.x,z:o.z,at:{floorId:i.id,x:o.x,z:o.z,y:oe(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(!Io(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=Po(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||n.push({id:o.id,name:o.name||me(t,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:oe(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=sc(e,o);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=yo(e,o),l=a?_u(o,a):null,u=o.name||(a?me(e,a):me(e,o.type));n.push({spot:o.id,name:u,at:{floorId:i.id,x:o.x,z:o.z,y:oe(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||me(e,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:oe(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 nu(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,Zu(t,n,i).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,n=e.settings.forecast&&t?it(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,Qu(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=Ju(this._forecast,Math.max(1,Math.min(7,i.days)));if(!o.length)return f;let s=it(n,this.weatherEntityId??t.settings.weather_entity),a=s?n.states[s]?.attributes:void 0,l=String(a?.temperature_unit??"\xB0"),u=String(a?.precipitation_unit??"mm"),c=n.language??navigator.language,m=new Intl.DateTimeFormat(c,{weekday:"short"}),d=h=>h===null?"\u2013":`${Math.round(h)}\xB0`;return p`<section class="nf-forecast" aria-label=${$(n,"forecast")}>
|
||||
<ul>
|
||||
${o.map((h,g)=>p`<li>
|
||||
<span class="nf-fc-day">${g===0?$(n,"today"):d.format(new Date(h.day))}</span>
|
||||
<span class="nf-fc-day">${g===0?$(n,"today"):m.format(new Date(h.day))}</span>
|
||||
<span class="nf-fc-icon" aria-hidden="true">${h.icon}</span>
|
||||
<span class="nf-fc-temp" title=${l}><b>${m(h.high)}</b> <small>${m(h.low)}</small></span>
|
||||
<span class="nf-fc-temp" title=${l}><b>${d(h.high)}</b> <small>${d(h.low)}</small></span>
|
||||
<span class="nf-fc-rain">${h.rain!==null&&h.rain>0?`\u{1F4A7}${h.rain.toLocaleString(c,{maximumFractionDigits:1})} ${u}`:h.chance!==null&&h.chance>0?`\u{1F4A7}${Math.round(h.chance)} %`:""}</span>
|
||||
</li>`)}
|
||||
</ul>
|
||||
</section>`}renderToday(e){let t=this.building,n=this.hass;if(!t||!n||this.clean||this.roomId||this.panelOpen)return f;let i=this.renderForecast("top_right"),o=this.today===!1?f:this.renderTodayCard(t,n);return o===f&&i===f&&e===f?f:p`<div class="nf-right-col ${e!==f?"nf-utility-right":""}" style=${this.clock==="top_right"?"top: 78px":""}>${e}${o}${i}</div>`}renderTodayCard(e,t){let n=Bu(t,e,Date.now(),{today:$(t,"care_bin_today"),tomorrow:$(t,"care_bin_tomorrow")}),i=Vu([...n,...this._todayItems??[]]);if(!i.length&&!(e.settings.calendars??[]).length)return f;let o=this._todayOpen!==!1,s=new Intl.DateTimeFormat(t.language??navigator.language,{weekday:"long",day:"numeric",month:"long"}).format(new Date),a=t.language??navigator.language,l=c=>{if(c===1)return $(t,"tomorrow");let d=new Date;return d.setDate(d.getDate()+c),new Intl.DateTimeFormat(a,{weekday:"long",day:"numeric",month:"numeric"}).format(d)},u=i.flatMap((c,d)=>[(c.day??0)>0&&(i[d-1]?.day??0)!==c.day?p`<li class="nf-today-day">${l(c.day??0)}</li>`:f,p`<li class=${c.past?"nf-today-past":""}><time>${c.kind==="bin"?"\u{1F5D1}":c.time||"\u25CF"}</time><span>${c.title}<small>${c.source}</small></span></li>`]);return p`<section class="nf-today ${o?"":"nf-today-folded"}" aria-label=${$(t,"today")}>
|
||||
</section>`}renderToday(e){let t=this.building,n=this.hass;if(!t||!n||this.clean||this.roomId||this.panelOpen)return f;let i=this.renderForecast("top_right"),o=this.today===!1?f:this.renderTodayCard(t,n);return o===f&&i===f&&e===f?f:p`<div class="nf-right-col ${e!==f?"nf-utility-right":""}" style=${this.clock==="top_right"?"top: 78px":""}>${e}${o}${i}</div>`}renderTodayCard(e,t){let n=ju(t,e,Date.now(),{today:$(t,"care_bin_today"),tomorrow:$(t,"care_bin_tomorrow")}),i=qu([...n,...this._todayItems??[]]);if(!i.length&&!(e.settings.calendars??[]).length)return f;let o=this._todayOpen!==!1,s=new Intl.DateTimeFormat(t.language??navigator.language,{weekday:"long",day:"numeric",month:"long"}).format(new Date),a=t.language??navigator.language,l=c=>{if(c===1)return $(t,"tomorrow");let m=new Date;return m.setDate(m.getDate()+c),new Intl.DateTimeFormat(a,{weekday:"long",day:"numeric",month:"numeric"}).format(m)},u=i.flatMap((c,m)=>[(c.day??0)>0&&(i[m-1]?.day??0)!==c.day?p`<li class="nf-today-day">${l(c.day??0)}</li>`:f,p`<li class=${c.past?"nf-today-past":""}><time>${c.kind==="bin"?"\u{1F5D1}":c.time||"\u25CF"}</time><span>${c.title}<small>${c.source}</small></span></li>`]);return p`<section class="nf-today ${o?"":"nf-today-folded"}" aria-label=${$(t,"today")}>
|
||||
<button class="nf-today-head" aria-expanded=${o} @click=${()=>this._todayOpen=!o}>
|
||||
<b>📅 ${$(t,"today")}</b><span>${s}</span>
|
||||
</button>
|
||||
${o?i.length?p`<ul>
|
||||
${u}
|
||||
</ul>`:p`<p class="nf-today-none">${$(t,"today_none")}</p>`:f}
|
||||
</section>`}week=null;weekAt=0;refreshWeek(e){let t=this.hass;if(!t||this._travel||Date.now()-this.weekAt<36e5)return;this.weekAt=Date.now();let n=Ke(e,s=>this.furnitureLinks?.get(s.id)?.power??null),i=e.energy,o={solar:i.solar?[i.solar]:n.solar,grid:i.grid??n.grid,gridInvert:!!i.grid_invert,battery:i.battery?[i.battery]:n.battery,batteryInvert:!!i.battery_invert,consumption:i.consumption};Hl(t,o).then(s=>{this.week=s,this.syncDevices(!0)}).catch(()=>this.week=null)}meterRows(e,t=null){let n=this.hass,i=[],o=this.floorId?e.floors.find(l=>l.id===this.floorId):void 0,s=o&&K(n)?De(n,o,e.floors.flatMap(l=>l.rooms)).find(l=>l.kind==="electricity"&&l.metric==="power"&&l.unit==="W"):void 0,a=K(n)?s?.value??null:o?.power_entity?q(n?.states[o.power_entity]):null;if(o&&(s||a!==null)){let l=!s?.incomplete&&a!==null&&t&&t>0?` \xB7 ${$(n,"floor_power_share",{n:Math.round(Math.max(0,a)/t*100)})}`:"";i.push({icon:"\u26A1",label:o.name,value:`${s?Fe(n,s):bt(n,a)}${l}`})}for(let[l,u,c]of[["gas","\u{1F525}","energy_gas_short"],["water","\u{1F4A7}","energy_water_short"]]){let d=e.energy[l],m=d?n?.states[d]:void 0;m&&!C(m)&&i.push({icon:u,label:$(n,c),value:oe(n,m)})}return i}refreshDayCurves(e){let t=this.hass;if(!t||this._travel||Date.now()-this.curvesAt<6e5)return;this.curvesAt=Date.now();let n=a=>yn(a,e,wn(a,e),Ke(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),i=Zl(t,n),o=Date.now(),s=o-24*36e5;Sn(t,i,s,o,!0).then(a=>{this.dayCurves=Yl(t,a,s,o,n),this.syncDevices(!0)}).catch(()=>this.dayCurves=null)}syncLhCards(e,t,n,i,o,s){let a=[],l=n.summary,u=l.solar!==null||l.grid!==null||l.battery!==null||l.consumption!==null,c=Dn(t),d=(this.floorId?t.floors.find(m=>m.id===this.floorId):void 0)??[...t.floors].sort((m,h)=>h.elevation-m.elevation)[0];if(this.liveCardsOn&&!this.dimmed&&!this.roomId&&u&&c&&d){let m=0,h=0,g=0;for(let _ of d.rooms)for(let[b,v]of _.points)m+=b,h+=v,g++;a.push({kind:"house",at:{floorId:d.id,x:g?m/g:c.x,z:g?h/g:c.z,y:d.height+(this.floorId?1.2:3.2)},summary:l,autarky:n.autarky,curves:this.dayCurves??void 0,week:this.week??void 0,meters:this.meterRows(t,l.consumption)}),this.refreshDayCurves(t),this.refreshWeek(t)}if(this.liveCardsOn&&!this.dimmed&&!this.roomId){for(let m of i)a.push({kind:"car",at:m.at,spot:m.spot,name:m.name,car:m.car});for(let m of this.livePrinters(t))a.push({kind:"printer",at:m.at,name:m.name,printer:m.printer});for(let m of this.liveHeatPumps(t))a.push({kind:"heatpump",at:m.at,name:m.name,pump:m.pump});for(let m of o)a.push({kind:"media",at:{...m.at,y:m.at.y+.5},media:m})}this.liveCardsOn&&!this.dimmed&&(a.push(...Iu(s,t,this.floorId,this.roomId)),a.push(...Nu(s,t,this.furnitureLinks??new Map,this.floorId,this.roomId))),JSON.stringify(a)!==JSON.stringify(this._liveCards)&&(this._liveCards=a),e.setLiveAnchors(a.map(m=>m.at),a.length?(m,h,g,_)=>this.placeLhCard(m,h,g,_):null)}placeLhCard(e,t,n,i){let o=this.renderRoot.querySelector(`.live-card[data-i="${e}"]`);o&&(o.dataset.x=String(t),o.dataset.y=String(n),o.style.visibility=i?"visible":"hidden",e===this._liveCards.length-1&&rc(this.renderRoot))}toggleHouseFold(){this._houseFolded=!this._houseFolded;try{localStorage.setItem("nextfloor.house_card_folded",this._houseFolded?"1":"0")}catch{}}toggleLhCards(){this._liveCardOn=!this._liveCardOn;try{localStorage.setItem("nextfloor.cards",this._liveCardOn?"1":"0")}catch{}this.syncDevices(!0)}renderTopLeft(){let e=this.clean?f:this.renderLhEnergy(),t=this.renderForecast("top_left");return this.clock!=="top_left"&&t===f||!this.hass?e:p`<div class="nf-topleft">${this.clock==="top_left"?this.renderClock(!0):f}${e}${t}</div>`}renderLhEnergy(){let e=this.ownSensors(),t=this._liveEnergy?.summary,n=!!t&&!this.roomId&&this.showEnergy&&!!this.hass&&!(t.consumption===null&&t.grid===null&&t.solar===null&&t.battery===null),o=this.building?.floors.some(u=>u.rooms.some(c=>c.climate_card)||u.furniture.some(c=>c.power_card))?this.renderCardToggle():f,s=this.roomNamesButton?p`<button class="nf-energy-item nf-flow-toggle nf-room-names-toggle" aria-pressed=${this.roomLabels} title=${$(this.hass,"room_names_toggle_hint")} @click=${()=>{this.roomLabels=!this.roomLabels,this.dispatchEvent(new CustomEvent("room-names-change",{detail:{value:this.roomLabels},bubbles:!0,composed:!0}))}}><span>${$(this.hass,"room_names_short")}</span><b aria-hidden="true">Aa</b></button>`:f;if(!n)return e.length||o!==f||s!==f?p`<div class="nf-energy" aria-live="off">${s}${e}${o}</div>`:f;let a=u=>$(this.hass,u),l=[];if(t.solar!==null&&l.push({cls:"solar",label:a("energy_solar"),value:de(this.hass,t.solar)}),t.consumption!==null&&l.push({cls:"total",label:a("energy_consumption"),value:de(this.hass,t.consumption)}),t.rest!==void 0&&t.rest!==null&&l.push({cls:"total",label:a("energy_rest"),value:de(this.hass,t.rest)}),t.battery!==null||t.soc!==null){let u=[t.battery!==null?de(this.hass,Math.abs(t.battery)):null,t.soc!==null?`${Math.round(t.soc)} %`:null].filter(Boolean);l.push({cls:"battery",label:a("energy_battery"),value:u.join(" \xBLine truncated
|
||||
</section>`}week=null;weekAt=0;refreshWeek(e){let t=this.hass;if(!t||this._travel||Date.now()-this.weekAt<36e5)return;this.weekAt=Date.now();let n=Ke(e,s=>this.furnitureLinks?.get(s.id)?.power??null),i=e.energy,o={solar:i.solar?[i.solar]:n.solar,grid:i.grid??n.grid,gridInvert:!!i.grid_invert,battery:i.battery?[i.battery]:n.battery,batteryInvert:!!i.battery_invert,consumption:i.consumption};Cl(t,o).then(s=>{this.week=s,this.syncDevices(!0)}).catch(()=>this.week=null)}meterRows(e,t=null){let n=this.hass,i=[],o=this.floorId?e.floors.find(l=>l.id===this.floorId):void 0,s=o&&K(n)?De(n,o,e.floors.flatMap(l=>l.rooms)).find(l=>l.kind==="electricity"&&l.metric==="power"&&l.unit==="W"):void 0,a=K(n)?s?.value??null:o?.power_entity?q(n?.states[o.power_entity]):null;if(o&&(s||a!==null)){let l=!s?.incomplete&&a!==null&&t&&t>0?` \xB7 ${$(n,"floor_power_share",{n:Math.round(Math.max(0,a)/t*100)})}`:"";i.push({icon:"\u26A1",label:o.name,value:`${s?Fe(n,s):bt(n,a)}${l}`})}for(let[l,u,c]of[["gas","\u{1F525}","energy_gas_short"],["water","\u{1F4A7}","energy_water_short"]]){let m=e.energy[l],d=m?n?.states[m]:void 0;d&&!C(d)&&i.push({icon:u,label:$(n,c),value:se(n,d)})}return i}refreshDayCurves(e){let t=this.hass;if(!t||this._travel||Date.now()-this.curvesAt<6e5)return;this.curvesAt=Date.now();let n=a=>xn(a,e,wn(a,e),Ke(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),i=Ql(t,n),o=Date.now(),s=o-24*36e5;$n(t,i,s,o,!0).then(a=>{this.dayCurves=Xl(t,a,s,o,n),this.syncDevices(!0)}).catch(()=>this.dayCurves=null)}syncHydronics(e,t,n){let i=++this.hydronicGeneration,o=this.shownBuilding(n).floors.filter(s=>!this.floorId||s.id===this.floorId).flatMap(s=>s.furniture.filter(a=>Gt(a.type)).map(a=>({floor:s,item:a})));if(!o.length){e.setHydronics([]),this.hydronicModule?.refreshHydronic(n,t,!!this._travel);return}Ho().then(s=>{i!==this.hydronicGeneration||this.viewer!==e||!this.isConnected||(this.hydronicModule=s,e.setHydronics(o.map(({floor:a,item:l})=>({...s.hydronicVisual(n,l,a.id,oe(a,l)),animate:!this.dimmed&&!this._travel}))),s.refreshHydronic(n,t,!!this._travel))}).catch(s=>{this._error=String(s)})}syncLhCards(e,t,n,i,o,s){let a=[],l=n.summary,u=l.solar!==null||l.grid!==null||l.battery!==null||l.consumption!==null,c=Fn(t),m=(this.floorId?t.floors.find(d=>d.id===this.floorId):void 0)??[...t.floors].sort((d,h)=>h.elevation-d.elevation)[0];if(this.liveCardsOn&&!this.dimmed&&!this.roomId&&u&&c&&m){let d=0,h=0,g=0;for(let _ of m.rooms)for(let[b,v]of _.points)d+=b,h+=v,g++;a.push({kind:"house",at:{floorId:m.id,x:g?d/g:c.x,z:g?h/g:c.z,y:m.height+(this.floorId?1.2:3.2)},summary:l,autarky:n.autarky,curves:this.dayCurves??void 0,week:this.week??void 0,meters:this.meterRows(t,l.consumption)}),this.refreshDayCurves(t),this.refreshWeek(t)}if(this.liveCardsOn&&!this.dimmed&&!this.roomId){for(let d of i)a.push({kind:"car",at:d.at,spot:d.spot,name:d.name,car:d.car});for(let d of this.livePrinters(t))a.push({kind:"printer",at:d.at,name:d.name,printer:d.printer});for(let d of this.liveHeatPumps(t))a.push({kind:"heatpump",at:d.at,name:d.name,pump:d.pump});for(let d of o)a.push({kind:"media",at:{...d.at,y:d.at.y+.5},media:d})}if(this.liveCardsOn&&!this.dimmed){a.push(...Wu(s,t,this.floorId,this.roomId)),a.push(...Bu(s,t,this.furnitureLinks??new Map,this.floorId,this.roomId));for(let d of t.floors)for(let h of d.furniture){if(!Gt(h.type)||h.hydronic?.card===!1||this.floorId&&d.id!==this.floorId||!wt(s,h))continue;let g=this.roomId?d.rooms.find(_=>_.id===this.roomId):null;this.roomId&&(!g||!H([h.x,h.z],g.points))||a.push({kind:"hydronic",item:h,readOnly:!!this._travel,at:{floorId:d.id,x:h.x+(h.pin_offset?.x??0),z:h.z+(h.pin_offset?.z??0),y:oe(d,h)+h.h+.3+(h.pin_offset?.y??0)}})}}JSON.stringify(a)!==JSON.stringify(this._liveCards)&&(this._liveCards=a),e.setLiveAnchors(a.map(d=>d.at),a.length?(d,h,g,_)=>this.placeLhCard(d,h,g,_):null)}placeLhCard(e,t,n,i){let o=this.renderRoot.querySelector(`.live-card[data-i="${e}"]`);o&&(o.dataset.x=String(t),o.dataset.y=String(n),o.style.visibility=i?"visible":"hidden",e===this._liveCards.length-1&&lc(this.renderRoot))}toggleHouseFold(){this._houseFolded=!this._houseFolded;try{localStorage.setItem("nextfloor.house_card_folded",this._houseFolded?"1":"0")}catch{}}toggleLhCards(){this._liveCardOn=!this._liveCardOn;try{localStorage.setItem("nextfloor.cards",this._liveCardOn?"1":"0")}catch{}this.syncDevices(!0)}renderTopLeft(){let e=this.clean?f:this.renderLhEnergy(),t=this.renderForecast("top_left");return this.clock!=="top_left"&&t===f||!this.hass?e:p`<div class="nf-topleft">${this.clock==="top_left"?this.renderClock(!0):f}${e}${t}</div>`}renderLhEnergy(){let e=this.ownSensors(),t=this._liveEnergy?.summary,n=!!t&&!this.roomId&&this.showEnergy&&!!this.hass&&!(t.consumption===null&&t.grid===null&&t.solar===null&&t.battery===null),o=this.building?.floors.some(u=>u.rooms.some(c=>c.climate_card)||u.furniture.some(c=>c.power_card||Gt(c.type)&&c.hydronic?.card!==!1))?this.renderCardToggle():f,s=this.roomNamesButton?p`<buttoLine truncated
|
||||
${s}
|
||||
${this.liveCardsOn&&this._liveCards.some(u=>u.kind==="house")?f:l.map(u=>p`<div class="nf-energy-item nf-energy-${u.cls}"><span>${u.label}</span><b>${u.value}</b></div>`)}
|
||||
${this.flows!==null?f:p`<button class="nf-energy-item nf-flow-toggle" aria-pressed=${this._flows} title=${a("flows_hint")} aria-label=${a("flows")} @click=${()=>this.toggleFlows()}>
|
||||
@@ -1809,35 +1809,35 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
</div>`}renderCardToggle(){return this.holograms!==null?f:p`<button class="nf-energy-item nf-flow-toggle nf-card-toggle" aria-pressed=${this._liveCardOn} title=${$(this.hass,"holos_hint")} aria-label=${$(this.hass,"holos")} @click=${()=>this.toggleLhCards()}>
|
||||
<span>${$(this.hass,"holos")}</span><b>◫</b>
|
||||
</button>`}utilityOverview(e){let t=this.building;if(!t||!K(this.hass)||!this.showEnergy||this.clean||this.roomId||this.panelOpen||!e&&!this._utilityOverviewVisible)return f;let n=t.floors.flatMap(o=>o.rooms);return(this.floorId?t.floors.filter(o=>o.id===this.floorId):t.floors).some(o=>De(this.hass,o,n).length)?p`<nf-utility-overview ?inline=${e} .hass=${this.hass} .floors=${t.floors} .floorId=${this.floorId} .compact=${this._narrowStage}
|
||||
@utility-open=${o=>{o.stopPropagation(),o.detail.roomId?this.openRoom(o.detail.floorId,o.detail.roomId):this.fire("floor-tap",{floorId:o.detail.floorId})}}></nf-utility-overview>`:f}ownSensors(){let e=this.utilityOverview(!0),t=e===f?f:p`<button class="nf-energy-item nf-flow-toggle nf-utility-overview-toggle" aria-label="Rechte Übersicht" aria-pressed=${this._utilityOverviewVisible} title=${this._utilityOverviewVisible?"Rechte \xDCbersicht ausblenden":"Rechte \xDCbersicht einblenden"} @click=${()=>{this._utilityOverviewVisible=!this._utilityOverviewVisible;try{localStorage.setItem("nextfloor.utility_overview",this._utilityOverviewVisible?"1":"0")}catch{}}}><span>Übersicht</span><b aria-hidden="true"><svg width="18" height="16" viewBox="0 0 20 16" fill="none" stroke="currentColor" stroke-width="1.3"><rect x="1" y="1" width="18" height="14" rx="2"/><path d="M12 1v14m2-10h3m-3 3h3m-3 3h3"/></svg></b></button>`,n=this.sensorBar&&this.hass?this.building?.settings.status_entities??[]:[],i=K(this.hass)?(this.building?.presence??[]).filter(u=>Ja(this.hass,u.person,[0])).map(u=>p`<div class="nf-energy-item nf-presence-state"><span>${u.name||L(this.hass,u.person)}</span><b>${se(this.hass.states[u.person])===null?"\u2013":se(this.hass.states[u.person])?"Anwesend":"Abwesend"}${G(this.hass,[u.person],u.name||"Anwesenheit")}</b></div>`):[],o=K(this.hass)?Object.entries(this.building?.settings.weather_variables??{}).filter(u=>!!u[1]&&u[1]!=="none").map(([u,c])=>[gc[u]||u,c]):[];K(this.hass)&&this.building?.settings.rain_sensor&&this.building.settings.rain_sensor!=="none"&&o.push(["Regensensor",this.building.settings.rain_sensor]);let s=o.length?p`<button class="nf-energy-item nf-flow-toggle nf-weather-values" aria-label="Wetterwerte anzeigen" title="Wetterwerte anzeigen" aria-haspopup="dialog" @click=${()=>this.renderRoot.querySelector(".nf-weather-dialog")?.showModal()}><span>Wetter</span><b aria-hidden="true">⛅</b></button>
|
||||
@utility-open=${o=>{o.stopPropagation(),o.detail.roomId?this.openRoom(o.detail.floorId,o.detail.roomId):this.fire("floor-tap",{floorId:o.detail.floorId})}}></nf-utility-overview>`:f}ownSensors(){let e=this.utilityOverview(!0),t=e===f?f:p`<button class="nf-energy-item nf-flow-toggle nf-utility-overview-toggle" aria-label="Rechte Übersicht" aria-pressed=${this._utilityOverviewVisible} title=${this._utilityOverviewVisible?"Rechte \xDCbersicht ausblenden":"Rechte \xDCbersicht einblenden"} @click=${()=>{this._utilityOverviewVisible=!this._utilityOverviewVisible;try{localStorage.setItem("nextfloor.utility_overview",this._utilityOverviewVisible?"1":"0")}catch{}}}><span>Übersicht</span><b aria-hidden="true"><svg width="18" height="16" viewBox="0 0 20 16" fill="none" stroke="currentColor" stroke-width="1.3"><rect x="1" y="1" width="18" height="14" rx="2"/><path d="M12 1v14m2-10h3m-3 3h3m-3 3h3"/></svg></b></button>`,n=this.sensorBar&&this.hass?this.building?.settings.status_entities??[]:[],i=K(this.hass)?(this.building?.presence??[]).filter(u=>el(this.hass,u.person,[0])).map(u=>p`<div class="nf-energy-item nf-presence-state"><span>${u.name||W(this.hass,u.person)}</span><b>${ae(this.hass.states[u.person])===null?"\u2013":ae(this.hass.states[u.person])?"Anwesend":"Abwesend"}${G(this.hass,[u.person],u.name||"Anwesenheit")}</b></div>`):[],o=K(this.hass)?Object.entries(this.building?.settings.weather_variables??{}).filter(u=>!!u[1]&&u[1]!=="none").map(([u,c])=>[wc[u]||u,c]):[];K(this.hass)&&this.building?.settings.rain_sensor&&this.building.settings.rain_sensor!=="none"&&o.push(["Regensensor",this.building.settings.rain_sensor]);let s=o.length?p`<button class="nf-energy-item nf-flow-toggle nf-weather-values" aria-label="Wetterwerte anzeigen" title="Wetterwerte anzeigen" aria-haspopup="dialog" @click=${()=>this.renderRoot.querySelector(".nf-weather-dialog")?.showModal()}><span>Wetter</span><b aria-hidden="true">⛅</b></button>
|
||||
<dialog class="nf-weather-dialog" aria-label="Wetterwerte" @keydown=${u=>u.stopPropagation()}><header><b>Wetter</b><button type="button" class="nf-chip" aria-label="Schließen" @click=${()=>this.renderRoot.querySelector(".nf-weather-dialog")?.close()}>×</button></header>${o.map(([u,c])=>p`<p><span>${u}</span><b>${nt(this.hass.states[c])}${G(this.hass,[c],u)}</b></p>`)}</dialog>`:f,a=K(this.hass)?(this.building?.floors??[]).filter(u=>!this.floorId||u.id===this.floorId).map(u=>({floor:u,readings:De(this.hass,u,this.building?.floors.flatMap(c=>c.rooms))})).filter(u=>u.readings.length):[],l=a.length?p`<button class="nf-energy-item nf-flow-toggle nf-utility-toggle" aria-label="Stockwerkszähler anzeigen" title="Stockwerkszähler anzeigen" aria-haspopup="dialog" @click=${()=>this.renderRoot.querySelector(".nf-utility-dialog")?.showModal()}><span>Stockwerkszähler</span><b aria-hidden="true">⚡ 💧</b></button>
|
||||
<dialog class="nf-weather-dialog nf-utility-dialog" aria-label="Stockwerkszähler" @keydown=${u=>u.stopPropagation()}><header><b>Stockwerkszähler</b><button type="button" class="nf-chip" aria-label="Schließen" @click=${()=>this.renderRoot.querySelector(".nf-utility-dialog")?.close()}>×</button></header>${a.map(({floor:u,readings:c})=>p`<h3>${u.name}</h3><nf-utility-report .hass=${this.hass} .readings=${c}></nf-utility-report>`)}</dialog>`:f;return[t,e,...i,s,l,...n.filter(u=>this.hass.states[u]).map(u=>p`<button class="nf-energy-item nf-own-sensor" title=${L(this.hass,u)} @click=${()=>we(this,u)}>
|
||||
<span>${L(this.hass,u)}</span><b>${oe(this.hass,this.hass.states[u])}</b>
|
||||
</button>${G(this.hass,[u],L(this.hass,u))}`)]}renderMapCredit(){let e=this.building?.settings.map;return wu(e)?p`<a class="nf-map-credit" href=${yo(e).href} target="_blank" rel="noopener">${yo(e).text}</a>`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=_t(new Date,this.hass?.config?.latitude??50),t=Pr(this.heatMode,e),n=this.heatMode==="temperature",i=n?le(this.hass,t.stops[0][0]):t.stops[0][0],o=n?le(this.hass,t.stops[t.stops.length-1][0]):t.stops[t.stops.length-1][0],s=n?re(this.hass):t.unit,a=l=>$(this.hass,l);return p`<div class="nf-legend">
|
||||
<dialog class="nf-weather-dialog nf-utility-dialog" aria-label="Stockwerkszähler" @keydown=${u=>u.stopPropagation()}><header><b>Stockwerkszähler</b><button type="button" class="nf-chip" aria-label="Schließen" @click=${()=>this.renderRoot.querySelector(".nf-utility-dialog")?.close()}>×</button></header>${a.map(({floor:u,readings:c})=>p`<h3>${u.name}</h3><nf-utility-report .hass=${this.hass} .readings=${c}></nf-utility-report>`)}</dialog>`:f;return[t,e,...i,s,l,...n.filter(u=>this.hass.states[u]).map(u=>p`<button class="nf-energy-item nf-own-sensor" title=${W(this.hass,u)} @click=${()=>ye(this,u)}>
|
||||
<span>${W(this.hass,u)}</span><b>${se(this.hass,this.hass.states[u])}</b>
|
||||
</button>${G(this.hass,[u],W(this.hass,u))}`)]}renderMapCredit(){let e=this.building?.settings.map;return Su(e)?p`<a class="nf-map-credit" href=${ko(e).href} target="_blank" rel="noopener">${ko(e).text}</a>`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=_t(new Date,this.hass?.config?.latitude??50),t=Ir(this.heatMode,e),n=this.heatMode==="temperature",i=n?le(this.hass,t.stops[0][0]):t.stops[0][0],o=n?le(this.hass,t.stops[t.stops.length-1][0]):t.stops[t.stops.length-1][0],s=n?re(this.hass):t.unit,a=l=>$(this.hass,l);return p`<div class="nf-legend">
|
||||
<b>${a(`heat_${this.heatMode}`)}${this.heatMode==="temperature"?p` <small>${a(e?"heat_summer":"heat_winter")}</small>`:f}</b>
|
||||
<span class="nf-legend-bar" style="background:${Fl(this.heatMode,e)}"></span>
|
||||
<span class="nf-legend-range"><span>${W(this.hass,i,0)} ${s}</span><span>${W(this.hass,o,0)} ${s}</span></span>
|
||||
<span class="nf-legend-bar" style="background:${Il(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>
|
||||
${this.heatValues.size?f:p`<span class="nf-legend-none">${a("heat_none_found")}</span>`}
|
||||
</div>`}renderWifiLegend(){let e=this.hass,t=this.building;if(!e||!t)return f;let n=(u,c)=>$(e,u,c),i=t.floors.flatMap(u=>u.furniture.filter(c=>Ho(c.type)).map(c=>Po(e,this.furnitureLinks?.get(c.id)?.entity??this.furnitureLinks?.get(c.id)?.power??null))),s=i.filter(u=>!!u).reduce((u,c)=>u+(c.clients??0),0),a=t.floors.flatMap(u=>u.placements.map(c=>e.states[c.entity_id])),l=Xu(a);return p`<div class="nf-legend">
|
||||
</div>`}renderWifiLegend(){let e=this.hass,t=this.building;if(!e||!t)return f;let n=(u,c)=>$(e,u,c),i=t.floors.flatMap(u=>u.furniture.filter(c=>Co(c.type)).map(c=>No(e,this.furnitureLinks?.get(c.id)?.entity??this.furnitureLinks?.get(c.id)?.power??null))),s=i.filter(u=>!!u).reduce((u,c)=>u+(c.clients??0),0),a=t.floors.flatMap(u=>u.placements.map(c=>e.states[c.entity_id])),l=ic(a);return p`<div class="nf-legend">
|
||||
<b>📶 ${n("heat_wifi")}</b>
|
||||
<span>${n("wifi_aps",{n:i.length,clients:s})}</span>
|
||||
${l.online+l.offline.length?p`<span>${n("wifi_network",{online:l.online,offline:l.offline.length})}</span>`:f}
|
||||
${l.offline.length?p`<span class="nf-legend-none">${l.offline.slice(0,4).join(", ")}</span>`:f}
|
||||
${i.length?f:p`<span class="nf-legend-none">${n("wifi_none")}</span>`}
|
||||
</div>`}skyColor(){let e=Mn[this.theme]??Mn.neon,t=this._sky;return e.night[0].map((n,i)=>Math.round(n+(e.day[0][i]-n)*t))}render(){let e=this.utilityOverview(!1),t=this._sky,n=(s,a)=>`rgb(${s.map((l,u)=>Math.round(l+(a[u]-l)*t)).join(",")})`,i=Mn[this.theme]??Mn.neon,o=`--nf-sky:${n(i.night[0],i.day[0])};--nf-ground:${n(i.night[1],i.day[1])}`+Jl(this.building?.settings.backdrop);return p`<div
|
||||
</div>`}skyColor(){let e=An[this.theme]??An.neon,t=this._sky;return e.night[0].map((n,i)=>Math.round(n+(e.day[0][i]-n)*t))}render(){let e=this.utilityOverview(!1),t=this._sky,n=(s,a)=>`rgb(${s.map((l,u)=>Math.round(l+(a[u]-l)*t)).join(",")})`,i=An[this.theme]??An.neon,o=`--nf-sky:${n(i.night[0],i.day[0])};--nf-ground:${n(i.night[1],i.day[1])}`+eu(this.building?.settings.backdrop);return p`<div
|
||||
class="nf-stage ${this.roomLabels?"":"nf-no-room-names"} ${this._low?"nf-low":""} ${this.panelOpen?"nf-panel-open":""} ${this._alerts.length?"nf-has-alerts":""} ${this._narrowStage?"nf-narrow":""} ${e!==f?"nf-has-utility-overview":""}"
|
||||
style=${o}
|
||||
>
|
||||
${this._error?p`<p class="nf-error">${this._error}</p>`:f} ${this.renderTopLeft()} ${ic(this.hass,this._liveCards,(s,a,l,u)=>this.hass?.callService(s,a,{entity_id:l,...u}),{folded:this._houseFolded,toggle:()=>this.toggleHouseFold()},!!this.roomId||this.panelOpen)} ${this.clean?f:this.renderLegend()} ${this.renderMapCredit()}
|
||||
${this._error?p`<p class="nf-error">${this._error}</p>`:f} ${this.renderTopLeft()} ${uc(this.hass,this._liveCards,(s,a,l,u)=>this.hass?.callService(s,a,{entity_id:l,...u}),{folded:this._houseFolded,toggle:()=>this.toggleHouseFold()},!!this.roomId||this.panelOpen)} ${this.clean?f:this.renderLegend()} ${this.renderMapCredit()}
|
||||
${this.renderAlerts()} ${this.renderAnnouncement()} ${this.clean?f:p`${this.renderThumbs()} ${this.renderScenes()} ${this.renderFind()} ${this.renderCentral()}`} ${this.renderSwipe()}
|
||||
${this.renderMenu()} ${this.renderPlate()} ${this.renderEye()} ${this.renderLock()} ${this.renderWalk()} ${this.renderTravel()} ${this.renderClock()} ${this.renderToday(e)} ${this.renderLayers()} ${this.renderPluginWindow()}
|
||||
${this.showStats&&this._stats?p`<span class="nf-stats"
|
||||
><b>${this._stats.fps?$(this.hass,"stats_fps",{fps:this._stats.fps,ms:this._stats.worstMs}):$(this.hass,"stats_idle")}</b>
|
||||
${this._stats.busy.length?p`(${this._stats.busy.map(s=>$(this.hass,`stats_busy_${s}`)).join(", ")})`:f} ·
|
||||
${$(this.hass,"stats",{calls:this._stats.calls,tris:this._stats.triangles.toLocaleString()})} ·
|
||||
${$(this.hass,this._stats.low?"stats_low":"stats_full",{r:W(this.hass,this._stats.pixelRatio,2)})}</span
|
||||
${$(this.hass,this._stats.low?"stats_low":"stats_full",{r:O(this.hass,this._stats.pixelRatio,2)})}</span
|
||||
>`:f}
|
||||
</div>`}static styles=[_e,ze,oc,J`
|
||||
</div>`}static styles=[_e,ze,cc,J`
|
||||
:host {
|
||||
display: block;
|
||||
position: relative;
|
||||
@@ -3438,26 +3438,26 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
inset: auto 16px 16px;
|
||||
color: var(--nf-danger);
|
||||
}
|
||||
`]};customElements.get("nf-view3d")||customElements.define("nf-view3d",Vo);function de(r,e){return Math.abs(e)>=1e3?`${W(r,e/1e3,1)} kW`:`${Math.round(e)} W`}function Bo(r){return r.type==="tv_board"?r.h+.9:r.type==="tv_wall"||r.type==="kitchen_wall"?r.h+.25:r.h+.35}function $f(r,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:oe(r,e)}var kc;function Sc(){let r=new URL("./nextfloor-editor.js?v=5e2c8c8bd6e5",new URL(import.meta.url)).href;return kc??=import(r),kc}var Mf=.25,$c=r=>Math.round(r*1e3)/1e3,Mc=(r,e,t)=>r.rooms.find(n=>n.points.length>=3&&I([e,t],n.points));function Go(r,e,t,n,i){let o=Mc(r,e,t);if(!o)return[n,i];let s=(a,l)=>I([a,l],o.points);return s(n,i)?[n,i]:s(n,t)?[n,t]:s(e,i)?[e,i]:[e,t]}function Af(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(ue(ee(o,t),n))<.02&&Math.abs(ue(ee(a,t),n))<.02}))}var Ko=(r,e)=>Math.abs((r-e+540)%360-180);function Ac(r,e,t,n=Mf){let i=Mc(r,e.x,e.z);if(!i)return null;let o=i.points,s=mt(o)>=0?1:-1,a=null;return o.forEach((l,u)=>{let c=o[(u+1)%o.length],d=Ve(ee(c,l));if(d<.3)return;let m=[(c[0]-l[0])/d,(c[1]-l[1])/d],h=[-m[1]*s,m[0]*s],g=ue(ee([e.x,e.z],l),m);if(g<0||g>d)return;let _=Af(r,i,l,h)?t/2:0,b=ue(ee([e.x,e.z],l),h)-_,v=Math.atan2(-h[0],h[1])*180/Math.PI,k=[{rotation:v,extent:e.d/2},{rotation:v+90,extent:e.w/2},{rotation:v-90,extent:e.w/2}].reduce((z,R)=>Ko(e.rotation,R.rotation)<Ko(e.rotation,z.rotation)?R:z);if(Ko(e.rotation,k.rotation)>50)return;let M=b-k.extent;Math.abs(M)>n||a&&Math.abs(M)>=Math.abs(a.gap)||(a={x:$c(e.x-h[0]*M),z:$c(e.z-h[1]*M),rotation:(Math.round(k.rotation)%360+360)%360,gap:M})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function ti(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 ni(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 Ec(r,e){let t=structuredClone(r);for(let n of t.floors)n.furniture=n.furniture.filter(i=>i.id!==e);return t}function Rc(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 zc(r,e,t,n){return ni(r,e,(i,o)=>{[i.x,i.z]=Go(o,i.x,i.z,t,n)})}function Tc(r,e,t,n){let i=r.settings.wall_interior??.12;return ti(r,e,(o,s)=>{[o.x,o.z]=Go(s,o.x,o.z,t,n);let a=Ac(s,o,i);a&&Object.assign(o,a)})}var Uo=(r,e)=>((r+e)%360+360)%360,Dc=r=>Number.parseFloat(r.replace(",",".")),Wn=(r,e)=>Math.round(r*10**e)/10**e;function jo(r){let{min:e,max:t,accepts:n=()=>!0}=r,i=o=>{let s=Dc(o.target.value);!Number.isFinite(s)||!n(s)||r.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return p`<label class="nf-size" title=${r.title}
|
||||
`]};customElements.get("nf-view3d")||customElements.define("nf-view3d",Uo);function de(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 Cf(r,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:se(r,e)}var Ec;function Rc(){let r=new URL("./nextfloor-editor.js?v=8c6363de7c20",new URL(import.meta.url)).href;return Ec??=import(r),Ec}var Nf=.25,zc=r=>Math.round(r*1e3)/1e3,Tc=(r,e,t)=>r.rooms.find(n=>n.points.length>=3&&H([e,t],n.points));function qo(r,e,t,n,i){let o=Tc(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 Of(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(ue(ee(o,t),n))<.02&&Math.abs(ue(ee(a,t),n))<.02}))}var jo=(r,e)=>Math.abs((r-e+540)%360-180);function Dc(r,e,t,n=Nf){let i=Tc(r,e.x,e.z);if(!i)return null;let o=i.points,s=mt(o)>=0?1:-1,a=null;return o.forEach((l,u)=>{let c=o[(u+1)%o.length],m=Ve(ee(c,l));if(m<.3)return;let d=[(c[0]-l[0])/m,(c[1]-l[1])/m],h=[-d[1]*s,d[0]*s],g=ue(ee([e.x,e.z],l),d);if(g<0||g>m)return;let _=Of(r,i,l,h)?t/2:0,b=ue(ee([e.x,e.z],l),h)-_,v=Math.atan2(-h[0],h[1])*180/Math.PI,k=[{rotation:v,extent:e.d/2},{rotation:v+90,extent:e.w/2},{rotation:v-90,extent:e.w/2}].reduce((z,R)=>jo(e.rotation,R.rotation)<jo(e.rotation,z.rotation)?R:z);if(jo(e.rotation,k.rotation)>50)return;let M=b-k.extent;Math.abs(M)>n||a&&Math.abs(M)>=Math.abs(a.gap)||(a={x:zc(e.x-h[0]*M),z:zc(e.z-h[1]*M),rotation:(Math.round(k.rotation)%360+360)%360,gap:M})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function ri(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 ii(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 Fc(r,e){let t=structuredClone(r);for(let n of t.floors)n.furniture=n.furniture.filter(i=>i.id!==e);return t}function Hc(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 Pc(r,e,t,n){return ii(r,e,(i,o)=>{[i.x,i.z]=qo(o,i.x,i.z,t,n)})}function Ic(r,e,t,n){let i=r.settings.wall_interior??.12;return ri(r,e,(o,s)=>{[o.x,o.z]=qo(s,o.x,o.z,t,n);let a=Dc(s,o,i);a&&Object.assign(o,a)})}var Zo=(r,e)=>((r+e)%360+360)%360,Cc=r=>Number.parseFloat(r.replace(",",".")),Wn=(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=Cc(o.target.value);!Number.isFinite(s)||!n(s)||r.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return p`<label class="nf-size" title=${r.title}
|
||||
>${r.label}
|
||||
<input type="number" inputmode="decimal" step=${r.step} min=${e} max=${t??f} .value=${String(Wn(r.value,2))} @change=${i} />
|
||||
</label>`}var Hc=(r,e)=>p`<button class="nf-chip" @click=${e}>${r.t("height_auto")}</button>`,Fc=(r,e)=>p`<button class="nf-chip" @click=${()=>e(-r)}>↺ ${r}°</button><button class="nf-chip" @click=${()=>e(r)}>↻ ${r}°</button>`;function Ef(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)=>jo({label:r.t(a),title:r.t(`size_${s}`),value:n[s],step:.05,min:.05,accepts:l=>l>0,apply:l=>r.editFurniture(e,u=>u[s]=Wn(l,3))}),o=js(n)?p`${jo({label:"\u2195",title:r.t("mount_height"),value:n.mount_y??ae(t,n),step:.05,min:0,accepts:s=>s>=0,apply:s=>r.editFurniture(e,a=>a.mount_y=Wn(s,3))})}
|
||||
${n.mount_y!=null?Hc(r,()=>r.editFurniture(e,s=>s.mount_y=null)):f}`:f;return p`${i("w","size_short_w")}${i("d","size_short_d")}${i("h","size_short_h")} ${o}`}function Rf(r,e){let t=r.building.floors.find(l=>l.placements.some(u=>u.entity_id===e)),n=t?.placements.find(l=>l.entity_id===e);if(!t||!n)return f;let i=H(e),o=(l,u,c)=>p`<select class="nf-size-select" title=${r.t(l)} @change=${d=>r.editDevice(e,m=>Object.assign(m,{mount:d.target.value,y:null}))}>
|
||||
${u.map(([d,m])=>p`<option value=${d} ?selected=${d===c}>${m}</option>`)}
|
||||
</select>`,s=["ceiling","floor","table","wall"].map(l=>[l,r.t(`lamp_${l}`)]),a=i?Tt(i,ve(t,n.x,n.z),i==="light"?n.mount??"ceiling":null):1;return p`${i==="light"?o("lamp_mount",s,n.mount??"ceiling"):f}
|
||||
${jo({label:r.t("size_short_h"),title:r.t("marker_height"),value:n.y??a,step:.05,min:0,accepts:l=>l>=0,apply:l=>r.editDevice(e,u=>u.y=Wn(l,3))})}
|
||||
${n.y!==null?Hc(r,()=>r.editDevice(e,l=>l.y=null)):f}`}function Pc(r,e,t){let n=r.t,i;if(e){let o=r.building.floors.flatMap(s=>s.furniture).find(s=>s.id===e)?.type;i=p`<span>${o?me(r.hass,o):""}</span>
|
||||
${Ef(r,e)} ${Fc(45,s=>r.turnFurniture(e,s))}
|
||||
</label>`}var Oc=(r,e)=>p`<button class="nf-chip" @click=${e}>${r.t("height_auto")}</button>`,Nc=(r,e)=>p`<button class="nf-chip" @click=${()=>e(-r)}>↺ ${r}°</button><button class="nf-chip" @click=${()=>e(r)}>↻ ${r}°</button>`;function Wf(r,e){let t=r.building.floors.find(s=>s.furniture.some(a=>a.id===e)),n=t?.furniture.find(s=>s.id===e);if(!t||!n)return f;let i=(s,a)=>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,u=>u[s]=Wn(l,3))}),o=Ys(n)?p`${Yo({label:"\u2195",title:r.t("mount_height"),value:n.mount_y??oe(t,n),step:.05,min:0,accepts:s=>s>=0,apply:s=>r.editFurniture(e,a=>a.mount_y=Wn(s,3))})}
|
||||
${n.mount_y!=null?Oc(r,()=>r.editFurniture(e,s=>s.mount_y=null)):f}`:f;return p`${i("w","size_short_w")}${i("d","size_short_d")}${i("h","size_short_h")} ${o}`}function Lf(r,e){let t=r.building.floors.find(l=>l.placements.some(u=>u.entity_id===e)),n=t?.placements.find(l=>l.entity_id===e);if(!t||!n)return f;let i=P(e),o=(l,u,c)=>p`<select class="nf-size-select" title=${r.t(l)} @change=${m=>r.editDevice(e,d=>Object.assign(d,{mount:m.target.value,y:null}))}>
|
||||
${u.map(([m,d])=>p`<option value=${m} ?selected=${m===c}>${d}</option>`)}
|
||||
</select>`,s=["ceiling","floor","table","wall"].map(l=>[l,r.t(`lamp_${l}`)]),a=i?Dt(i,ve(t,n.x,n.z),i==="light"?n.mount??"ceiling":null):1;return p`${i==="light"?o("lamp_mount",s,n.mount??"ceiling"):f}
|
||||
${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,u=>u.y=Wn(l,3))})}
|
||||
${n.y!==null?Oc(r,()=>r.editDevice(e,l=>l.y=null)):f}`}function Wc(r,e,t){let n=r.t,i;if(e){let o=r.building.floors.flatMap(s=>s.furniture).find(s=>s.id===e)?.type;i=p`<span>${o?me(r.hass,o):""}</span>
|
||||
${Wf(r,e)} ${Nc(45,s=>r.turnFurniture(e,s))}
|
||||
<button class="nf-chip" title=${n("furn_mirror_hint")} @click=${()=>r.editFurniture(e,s=>s.mirror=!s.mirror)}>⇋ ${n("furn_mirror")}</button>
|
||||
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeFurniture(e)}>${n("delete")}</button>`}else t?i=p`<span>${L(r.hass,t)}</span>
|
||||
${Rf(r,t)} ${Fc(45,o=>r.turnDevice(t,o))}
|
||||
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeDevice(t)}>${n("delete")}</button>`:i=p`<span>${n("furnish_hint")}</span>`;return p`<div class="nf-furnish-bar">${i}<button class="nf-chip nf-chip-on" @click=${()=>r.finish()}>${n("done")}</button></div>`}var Ic=ne`<svg class="nf-mark" viewBox="60 40 392 420" aria-hidden="true">
|
||||
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeFurniture(e)}>${n("delete")}</button>`}else t?i=p`<span>${W(r.hass,t)}</span>
|
||||
${Lf(r,t)} ${Nc(45,o=>r.turnDevice(t,o))}
|
||||
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeDevice(t)}>${n("delete")}</button>`:i=p`<span>${n("furnish_hint")}</span>`;return p`<div class="nf-furnish-bar">${i}<button class="nf-chip nf-chip-on" @click=${()=>r.finish()}>${n("done")}</button></div>`}var Lc=ne`<svg class="nf-mark" viewBox="60 40 392 420" aria-hidden="true">
|
||||
<polygon points="106,150 256,66 406,150 256,234" fill="none" stroke="currentColor" stroke-opacity=".55" stroke-width="12" stroke-dasharray="6 22" stroke-linecap="round"/>
|
||||
<polygon points="106,382 256,466 256,488 106,404" fill="#34507d"/><polygon points="406,382 256,466 256,488 406,404" fill="#2a4068"/><polygon points="106,382 256,298 406,382 256,466" fill="#5f7fb6"/>
|
||||
<polygon points="106,310 256,394 256,416 106,332" fill="#4a72b8"/><polygon points="406,310 256,394 256,416 406,332" fill="#3b5c98"/><polygon points="106,310 256,226 406,310 256,394" fill="#8ab6f5"/>
|
||||
<polygon points="106,238 256,322 256,344 106,260" fill="#2a74d8"/><polygon points="406,238 256,322 256,344 406,260" fill="#2161b8"/><polygon points="106,238 256,154 406,238 256,322" fill="#4fb6ff"/>
|
||||
<circle cx="256" cy="236" r="16" fill="#ffe08a"/>
|
||||
</svg>`;var he=(r,e)=>({name:r,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),Yt=(r,e,t)=>({name:r,fallback:t,read:n=>e.find(i=>i===n)??t,write:n=>n}),qo={explode:he("explode",!0),keepRoof:he("roof",!1),solidWalls:he("solid_walls",!1),quality:Yt("quality",["auto","low","high"],"auto"),stats:he("stats",!1),markers:Yt("markers",["none","important","all"],"important"),heat:Yt("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:Yt("theme",Br,"neon"),clock:Yt("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:Yt("floor_stack",["dim","stacked","single"],"dim"),roomNames:he("room_names",!0),clean:he("clean",!1),navWrap:he("nav_wrap",!1),weather:he("weather",!0),timeSlider:he("time_slider",!1),menuOpen:he("menu_open",!1),keepCamera:he("keep_camera",!1),readable:he("readable",!1),plain:he("plain",!1),rightBack:he("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:he("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 Cc(r=ii()){try{return r?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function Nc(r=ii()){try{return r?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function ii(){try{return localStorage}catch{return null}}var ri=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(qo)){let i=qo[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=qo[e];try{this.storage?.setItem(`nextfloor.${n.name}`,n.write(t))}catch{}}};var Wc=J`
|
||||
</svg>`;var he=(r,e)=>({name:r,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),Jt=(r,e,t)=>({name:r,fallback:t,read:n=>e.find(i=>i===n)??t,write:n=>n}),Jo={explode:he("explode",!0),keepRoof:he("roof",!1),solidWalls:he("solid_walls",!1),quality:Jt("quality",["auto","low","high"],"auto"),stats:he("stats",!1),markers:Jt("markers",["none","important","all"],"important"),heat:Jt("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:Jt("theme",Kr,"neon"),clock:Jt("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:Jt("floor_stack",["dim","stacked","single"],"dim"),roomNames:he("room_names",!0),clean:he("clean",!1),navWrap:he("nav_wrap",!1),weather:he("weather",!0),timeSlider:he("time_slider",!1),menuOpen:he("menu_open",!1),keepCamera:he("keep_camera",!1),readable:he("readable",!1),plain:he("plain",!1),rightBack:he("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:he("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 Bc(r=si()){try{return r?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function Vc(r=si()){try{return r?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function si(){try{return localStorage}catch{return null}}var oi=class{storage;constructor(e){this.storage=e}raw(e){try{return this.storage?.getItem(`nextfloor.${e}`)??null}catch{return null}}load(e=""){let t={};for(let n of Object.keys(Jo)){let i=Jo[n],o=this.raw(i.name);t[n]=o===null?i.fallback:i.read(o)}return new URLSearchParams(e).has("nf_stats")&&(t.stats=!0),t}save(e,t){let n=Jo[e];try{this.storage?.setItem(`nextfloor.${n.name}`,n.write(t))}catch{}}};var Kc=J`
|
||||
.nf-dot {
|
||||
display: inline-block;
|
||||
width: 8px;
|
||||
@@ -3949,11 +3949,11 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
gap: 12px;
|
||||
margin: auto;
|
||||
}
|
||||
`;var Lc=new WeakMap,Oc=new WeakMap;function yt(r,e){let t=Oc.get(r)??r,n=Lc.get(t)??new WeakMap;Lc.set(t,n);let i=n.get(e);if(i)return i;let o=new Map;for(let l of e)for(let u of l.placements)u.entity_id.startsWith("cover.")&&o.set(u.entity_id,{tilt:u.cover_tilt==="none"?null:u.cover_tilt,position:u.position});for(let l of Ne(t,e).values())l.cover&&!o.has(l.cover)&&o.set(l.cover,{tilt:l.coverTilt,position:l.position}),l.cover2&&!o.has(l.cover2)&&o.set(l.cover2,{tilt:l.cover2Tilt});let s={...t.states};for(let[l,u]of o){let c=t.states[l];if(!c)continue;let d={...c.attributes,nf_cover_control:!0},m=Dt(t,u.position);m===null&&(m=typeof c.attributes.current_position=="number"?c.attributes.current_position:null),m!==null&&(d.current_position=m);let h=u.tilt?t.states[u.tilt]:c,g=typeof h?.attributes.current_tilt_position=="number"?h.attributes.current_tilt_position:u.tilt?Dt(t,u.tilt):null;g!==null&&(d.current_tilt_position=g,d.supported_features=Number(d.supported_features??0)|128);let _=c.state;typeof d.current_position=="number"&&_!=="unavailable"&&_!=="unknown"&&_!=="opening"&&_!=="closing"&&(_=d.current_position>0?"open":"closed"),s[l]={...c,state:_,attributes:d}}let a={...t,states:s,callService:async(l,u,c={})=>{if(l!=="cover")return t.callService(l,u,c);let d=Array.isArray(c.entity_id)?c.entity_id:[c.entity_id],m=async h=>{let g=typeof h=="string"?o.get(h):void 0;if(!g)return t.callService(l,u,{...c,entity_id:h});let _={...c,entity_id:h},b=u;(b==="toggle"||b==="toggle_cover")&&(b=s[String(h)]?.state==="closed"?"open_cover":"close_cover");let v=b.includes("tilt");v&&g.tilt&&(_.entity_id=g.tilt);let S=g.tilt?t.states[g.tilt]:void 0;return v&&g.tilt&&!S?.attributes.symcon_id&&typeof S?.attributes.current_tilt_position!="number"&&(b==="set_cover_tilt_position"?(b="set_cover_position",_.position=_.tilt_position,delete _.tilt_position):b==="open_cover_tilt"?b="open_cover":b==="close_cover_tilt"&&(b="close_cover")),t.callService(l,b,_)};return Array.isArray(c.entity_id)?Promise.all(d.map(m)):m(d[0])}};return Oc.set(a,t),n.set(e,a),a}var Zo=class extends Q{static properties={hass:{attribute:!1},narrow:{type:Boolean},route:{attribute:!1},panel:{attribute:!1},_mode:{state:!0},_editorReady:{state:!0},_floorId:{state:!0},_roomId:{state:!0},_wallMode:{state:!0},_prefs:{state:!0},_furnish:{state:!0},_selFurniture:{state:!0},_selDevice:{state:!0},_optsOpen:{state:!0},_switchesOpen:{state:!0},_timeOfDay:{state:!0},_outside:{state:!0},_timeDrag:{state:!0},_floorUndo:{state:!0},_variablesLoading:{state:!0},_variablesNotice:{state:!0},_variablesError:{state:!0}};outsideMemo=null;floorUndoTimer;data=new zt(this);store=new ri(ii());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:ht($t(this._timeOfDay,e.time_zone),e.latitude,e.longitude).elevation>0?"above_horizon":"below_horizon"}renderTimeOfDay(){let e=this.t;if(this.hass?.config?.latitude===void 0)return f;let t=this._timeDrag??this._timeOfDay,n=o=>`${String(Math.floor(o)).padStart(2,"0")}:${String(Math.round(o%1*60)).padStart(2,"0")}`,i=()=>{let o=new Date;return Math.round((o.getHours()+o.getMinutes()/60)*4)/4};return p`<button class="nf-chip" aria-pressed=${t!==null} title=${e("time_of_day_hint")} @click=${()=>(this._timeDrag=null,this._timeOfDay=t===null?i():null)}>☀ ${t===null?e("time_of_day"):n(t)}</button>
|
||||
`;var Gc=new WeakMap,Uc=new WeakMap;function xt(r,e){let t=Uc.get(r)??r,n=Gc.get(t)??new WeakMap;Gc.set(t,n);let i=n.get(e);if(i)return i;let o=new Map;for(let l of e)for(let u of l.placements)u.entity_id.startsWith("cover.")&&o.set(u.entity_id,{tilt:u.cover_tilt==="none"?null:u.cover_tilt,position:u.position});for(let l of Ne(t,e).values())l.cover&&!o.has(l.cover)&&o.set(l.cover,{tilt:l.coverTilt,position:l.position}),l.cover2&&!o.has(l.cover2)&&o.set(l.cover2,{tilt:l.cover2Tilt});let s={...t.states};for(let[l,u]of o){let c=t.states[l];if(!c)continue;let m={...c.attributes,nf_cover_control:!0},d=Ft(t,u.position);d===null&&(d=typeof c.attributes.current_position=="number"?c.attributes.current_position:null),d!==null&&(m.current_position=d);let h=u.tilt?t.states[u.tilt]:c,g=typeof h?.attributes.current_tilt_position=="number"?h.attributes.current_tilt_position:u.tilt?Ft(t,u.tilt):null;g!==null&&(m.current_tilt_position=g,m.supported_features=Number(m.supported_features??0)|128);let _=c.state;typeof m.current_position=="number"&&_!=="unavailable"&&_!=="unknown"&&_!=="opening"&&_!=="closing"&&(_=m.current_position>0?"open":"closed"),s[l]={...c,state:_,attributes:m}}let a={...t,states:s,callService:async(l,u,c={})=>{if(l!=="cover")return t.callService(l,u,c);let m=Array.isArray(c.entity_id)?c.entity_id:[c.entity_id],d=async h=>{let g=typeof h=="string"?o.get(h):void 0;if(!g)return t.callService(l,u,{...c,entity_id:h});let _={...c,entity_id:h},b=u;(b==="toggle"||b==="toggle_cover")&&(b=s[String(h)]?.state==="closed"?"open_cover":"close_cover");let v=b.includes("tilt");v&&g.tilt&&(_.entity_id=g.tilt);let S=g.tilt?t.states[g.tilt]:void 0;return v&&g.tilt&&!S?.attributes.symcon_id&&typeof S?.attributes.current_tilt_position!="number"&&(b==="set_cover_tilt_position"?(b="set_cover_position",_.position=_.tilt_position,delete _.tilt_position):b==="open_cover_tilt"?b="open_cover":b==="close_cover_tilt"&&(b="close_cover")),t.callService(l,b,_)};return Array.isArray(c.entity_id)?Promise.all(m.map(d)):d(m[0])}};return Uc.set(a,t),n.set(e,a),a}var Qo=class extends Q{static properties={hass:{attribute:!1},narrow:{type:Boolean},route:{attribute:!1},panel:{attribute:!1},_mode:{state:!0},_editorReady:{state:!0},_floorId:{state:!0},_roomId:{state:!0},_wallMode:{state:!0},_prefs:{state:!0},_furnish:{state:!0},_selFurniture:{state:!0},_selDevice:{state:!0},_optsOpen:{state:!0},_switchesOpen:{state:!0},_timeOfDay:{state:!0},_outside:{state:!0},_timeDrag:{state:!0},_floorUndo:{state:!0},_variablesLoading:{state:!0},_variablesNotice:{state:!0},_variablesError:{state:!0}};outsideMemo=null;floorUndoTimer;data=new Tt(this);store=new oi(si());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:ht(Mt(this._timeOfDay,e.time_zone),e.latitude,e.longitude).elevation>0?"above_horizon":"below_horizon"}renderTimeOfDay(){let e=this.t;if(this.hass?.config?.latitude===void 0)return f;let t=this._timeDrag??this._timeOfDay,n=o=>`${String(Math.floor(o)).padStart(2,"0")}:${String(Math.round(o%1*60)).padStart(2,"0")}`,i=()=>{let o=new Date;return Math.round((o.getHours()+o.getMinutes()/60)*4)/4};return p`<button class="nf-chip" aria-pressed=${t!==null} title=${e("time_of_day_hint")} @click=${()=>(this._timeDrag=null,this._timeOfDay=t===null?i():null)}>☀ ${t===null?e("time_of_day"):n(t)}</button>
|
||||
${t!==null?p`<label class="nf-chip nf-time-slider"
|
||||
><input type="range" min="0" max="23.75" step="0.25" .value=${String(t)} aria-label=${e("time_of_day")} @input=${o=>this._timeDrag=Number(o.target.value)}
|
||||
@change=${o=>(this._timeDrag=null,this._timeOfDay=Number(o.target.value))}
|
||||
/></label>`:f}`}t=(e,t)=>$(this.hass,e,t);setPref(e,t){this._prefs={...this._prefs,[e]:t},this.store.save(e,t)}willUpdate(e){this.toggleAttribute("readable",!!this._prefs?.readable),e.has("hass")&&this.hass&&(this.style.colorScheme=Mr(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=hn(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=>ti(n,e,t)),editDevice:(e,t)=>this.applyEdit(n=>ni(n,e,t)),turnFurniture:(e,t)=>this.applyEdit(n=>ti(n,e,i=>i.rotation=Uo(i.rotation,t))),turnDevice:(e,t)=>this.applyEdit(n=>ni(n,e,i=>i.rotation=Uo(i.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>Ec(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>Rc(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&&wr(this.hass,this))return f;let e=this.data.building,t=this._prefs.clean&&this._mode==="view",n=f;return e&&(this._mode==="editor"&&this.isAdmin?n=this.renderEditor(e):this._mode==="extensions"&&this.isAdmin?n=this.renderExtensions():n=this.renderView(e)),p`<div class="nf-app ${t?"nf-clean":""}" style=${this._prefs.accent?`--nf-accent:${this._prefs.accent}`:""}>
|
||||
/></label>`:f}`}t=(e,t)=>$(this.hass,e,t);setPref(e,t){this._prefs={...this._prefs,[e]:t},this.store.save(e,t)}willUpdate(e){this.toggleAttribute("readable",!!this._prefs?.readable),e.has("hass")&&this.hass&&(this.style.colorScheme=Ar(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=mn(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=>ri(n,e,t)),editDevice:(e,t)=>this.applyEdit(n=>ii(n,e,t)),turnFurniture:(e,t)=>this.applyEdit(n=>ri(n,e,i=>i.rotation=Zo(i.rotation,t))),turnDevice:(e,t)=>this.applyEdit(n=>ii(n,e,i=>i.rotation=Zo(i.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>Fc(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>Hc(t,e)),this._selDevice=null},finish:()=>{this._furnish=!1,this._selFurniture=null,this._selDevice=null}};saveMoods(e,t){this.applyEdit(n=>({...n,floors:n.floors.map(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&&wr(this.hass,this))return f;let e=this.data.building,t=this._prefs.clean&&this._mode==="view",n=f;return e&&(this._mode==="editor"&&this.isAdmin?n=this.renderEditor(e):this._mode==="extensions"&&this.isAdmin?n=this.renderExtensions():n=this.renderView(e)),p`<div class="nf-app ${t?"nf-clean":""}" style=${this._prefs.accent?`--nf-accent:${this._prefs.accent}`:""}>
|
||||
${t?f:p`${this.renderHeader(e)}${this.renderNotices()}`}
|
||||
${this.data.error&&!e?p`<p class="nf-message">${this.t("load_error")}: ${this.data.error}</p>`:f}
|
||||
${!e&&!this.data.error?p`<p class="nf-message">${this.t("loading")}</p>`:f}
|
||||
@@ -3966,7 +3966,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
</label>`}renderViewOptions(){let e=this._prefs;return p`<button class="nf-opts-btn" aria-expanded=${this._optsOpen} title=${this.t("view_options")} aria-label=${this.t("view_options")} @click=${()=>this._optsOpen=!this._optsOpen}>⚙</button>
|
||||
<div class="nf-view-opts ${this._optsOpen?"nf-opts-open":""}">
|
||||
${this.choiceRow("quality",["auto","low","high"],e.quality,t=>this.t(`quality_${t}`),t=>this.setPref("quality",t))}
|
||||
${this.choiceRow("theme",Br,e.theme,t=>this.t(`theme_${t}`),t=>this.setPref("theme",t),this.accentPicker())}
|
||||
${this.choiceRow("theme",Kr,e.theme,t=>this.t(`theme_${t}`),t=>this.setPref("theme",t),this.accentPicker())}
|
||||
${this.choiceRow("markers",["none","important","all"],e.markers,t=>this.t(`markers_${t}`),t=>this.setPref("markers",t))}
|
||||
<label class="nf-seg nf-clock-pick" title=${this.t("clock")}
|
||||
>🕒
|
||||
@@ -4005,7 +4005,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
</div>
|
||||
</div>`}async reloadVariables(){if(!(this._variablesLoading||!this.hass.symconRefresh)){this._variablesLoading=!0,this._variablesNotice="",this._variablesError=!1;try{await this.hass.symconRefresh(),this._variablesNotice=this.t("symcon_variables_loaded")}catch(e){this._variablesError=!0,this._variablesNotice=this.t("symcon_variables_error",{error:e instanceof Error?e.message:String(e)})}finally{this._variablesLoading=!1}}}renderHeader(e){let t=this.hass?.symconTitle?.trim()||"NextFloor",n=this.data.saveState,i=(s,a,l="")=>p`<button role="tab" class=${l} aria-pressed=${this._mode===s} @click=${()=>this.setMode(s)}>${a}</button>`,o=n==="saving"?"saving":n==="saved"?"saved":"save_error";return p`<header class="nf-header">
|
||||
<ha-menu-button .hass=${this.hass} .narrow=${this.narrow}></ha-menu-button>
|
||||
<h1 title=${t}>${Ic}<span class="nf-view-title">${t}</span></h1>
|
||||
<h1 title=${t}>${Lc}<span class="nf-view-title">${t}</span></h1>
|
||||
${this.isAdmin?p`<div class="nf-seg" role="tablist">${i("view",this.t("view"))}${i("editor",this.t("editor"))}${i("extensions",`\u2726 ${this.t("ext_tab")}`,"nf-tab-ext")}</div>`:f}
|
||||
<span class="nf-grow"></span>
|
||||
${this._mode==="view"&&e?.floors.some(s=>s.rooms.length)?p`<button class="nf-chip nf-room-names-toggle" aria-pressed=${this._prefs.roomNames} title=${this.t("room_names_toggle_hint")} @click=${()=>this.setPref("roomNames",!this._prefs.roomNames)}>${this.t("room_names_short")}</button>`:f}
|
||||
@@ -4020,7 +4020,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
<span>${this.t("draft_found",{time:n})}</span>
|
||||
<button class="nf-btn nf-primary" @click=${()=>e.restoreDraft()}>${this.t("draft_restore")}</button>
|
||||
<button class="nf-btn" @click=${()=>e.discardDraft()}>${this.t("draft_discard")}</button>
|
||||
</div>`)}return t.length>0?p`<div class="nf-notices">${t}</div>`:f}whenEditorLoaded(e){return this._editorReady?e():(Sc().then(()=>this._editorReady=!0,t=>this.data.error=String(t)),p`<div class="nf-empty"><p>${this.t("loading")}</p></div>`)}renderExtensions(){return this.whenEditorLoaded(()=>p`<nf-extensions class="nf-body" .hass=${this.hass} .packs=${this.data.packs} .plugins=${this.data.building?.settings.plugins??[]}
|
||||
</div>`)}return t.length>0?p`<div class="nf-notices">${t}</div>`:f}whenEditorLoaded(e){return this._editorReady?e():(Rc().then(()=>this._editorReady=!0,t=>this.data.error=String(t)),p`<div class="nf-empty"><p>${this.t("loading")}</p></div>`)}renderExtensions(){return this.whenEditorLoaded(()=>p`<nf-extensions class="nf-body" .hass=${this.hass} .packs=${this.data.packs} .plugins=${this.data.building?.settings.plugins??[]}
|
||||
@packs-changed=${()=>{this.data.reloadPacks()}}
|
||||
@plugins-changed=${e=>this.applyEdit(t=>({...t,settings:{...t.settings,plugins:e.detail}}))}></nf-extensions>`)}renderEditor(e){return this.whenEditorLoaded(()=>p`<nf-editor
|
||||
class="nf-body"
|
||||
@@ -4030,10 +4030,10 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.roomLabels=${this._prefs.roomNames}
|
||||
@room-names-change=${t=>this.setPref("roomNames",t.detail.value)}
|
||||
.packs=${this.data.packs}
|
||||
.loadCardEditor=${Gn}
|
||||
.loadCardEditor=${Un}
|
||||
@packs-changed=${()=>{this.data.reloadPacks()}}
|
||||
@building-changed=${t=>this.data.edit(t.detail.building)}
|
||||
></nf-editor>`)}onNavWheel=e=>{if(this._prefs.navWrap||!e.deltaY||e.deltaX)return;let t=e.currentTarget;t.scrollWidth<=t.clientWidth||(t.scrollLeft+=e.deltaY,e.preventDefault())};allOffChip(e){let t=this._floorId?e.floors.find(i=>i.id===this._floorId):e.floors.length===1?e.floors[0]:void 0;if(!t||!this.hass)return f;if(this._floorUndo){let i=this._floorUndo;return p`<button class="nf-chip" aria-pressed="true" @click=${()=>{for(let o of i)this.hass.callService(o.domain,o.service,o.data);this._floorUndo=null,clearTimeout(this.floorUndoTimer)}}>↶ ${this.t("all_off_undo")}</button>`}let n=kn(Ul(t).map(i=>this.hass.states[i]));return n.count<2?f:p`<button class="nf-chip" title=${this.t("all_off_floor",{floor:t.name,n:n.count})} @click=${()=>{for(let i of n.off)this.hass.callService(i.domain,i.service,i.data);this._floorUndo=n.undo,clearTimeout(this.floorUndoTimer),this.floorUndoTimer=setTimeout(()=>this._floorUndo=null,1e4)}}>⏻ ${n.count}</button>`}renderNav(e){let t=e.floors.filter(u=>!this._floorId||u.id===this._floorId),n=e.floors.length>1,i=this._prefs.navWrap,o=this.outsideIds(e).length?p`<button class="nf-chip" aria-pressed=${this._outside} title=${this.t("outside_area_hint")} @click=${()=>this.openOutside()}>🌳 ${this.t("outside_area")}</button>`:f,s=n?p`<button class="nf-chip" aria-pressed=${this._floorId===null} @click=${()=>this.openFloor(null)}>${this.t("all_floors")}</button>
|
||||
></nf-editor>`)}onNavWheel=e=>{if(this._prefs.navWrap||!e.deltaY||e.deltaX)return;let t=e.currentTarget;t.scrollWidth<=t.clientWidth||(t.scrollLeft+=e.deltaY,e.preventDefault())};allOffChip(e){let t=this._floorId?e.floors.find(i=>i.id===this._floorId):e.floors.length===1?e.floors[0]:void 0;if(!t||!this.hass)return f;if(this._floorUndo){let i=this._floorUndo;return p`<button class="nf-chip" aria-pressed="true" @click=${()=>{for(let o of i)this.hass.callService(o.domain,o.service,o.data);this._floorUndo=null,clearTimeout(this.floorUndoTimer)}}>↶ ${this.t("all_off_undo")}</button>`}let n=Sn(Zl(t).map(i=>this.hass.states[i]));return n.count<2?f:p`<button class="nf-chip" title=${this.t("all_off_floor",{floor:t.name,n:n.count})} @click=${()=>{for(let i of n.off)this.hass.callService(i.domain,i.service,i.data);this._floorUndo=n.undo,clearTimeout(this.floorUndoTimer),this.floorUndoTimer=setTimeout(()=>this._floorUndo=null,1e4)}}>⏻ ${n.count}</button>`}renderNav(e){let t=e.floors.filter(u=>!this._floorId||u.id===this._floorId),n=e.floors.length>1,i=this._prefs.navWrap,o=this.outsideIds(e).length?p`<button class="nf-chip" aria-pressed=${this._outside} title=${this.t("outside_area_hint")} @click=${()=>this.openOutside()}>🌳 ${this.t("outside_area")}</button>`:f,s=n?p`<button class="nf-chip" aria-pressed=${this._floorId===null} @click=${()=>this.openFloor(null)}>${this.t("all_floors")}</button>
|
||||
${[...e.floors].reverse().map(u=>p`<button class="nf-chip" aria-pressed=${u.id===this._floorId} @click=${()=>this.openFloor(u.id)}>${u.name}</button>`)}
|
||||
${o} ${this.allOffChip(e)}
|
||||
<span class="nf-sep"></span>`:p`${o} ${this.allOffChip(e)}`,a=t.flatMap(u=>[t.length>1&&u.rooms.length?p`<span class="nf-nav-floor">${u.name}</span>`:f,...u.rooms.map(c=>p`<button
|
||||
@@ -4045,7 +4045,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
</button>`)]),l=this.t(i?"nav_row":"nav_wrap");return p`<nav class="nf-nav ${i?"nf-nav-wrap":""}" @wheel=${this.onNavWheel}>
|
||||
${s}${a}
|
||||
<button class="nf-chip nf-nav-toggle" title=${l} aria-label=${l} aria-pressed=${i} @click=${()=>this.setPref("navWrap",!i)}>${i?"\u2194":"\u2261"}</button>
|
||||
</nav>`}toggleChip(e,t,n){return p`<button class="nf-chip" aria-pressed=${this._prefs[e]} title=${n?this.t(n):f} @click=${()=>this.setPref(e,!this._prefs[e])}>${this.t(t)}</button>`}renderOverlay(e){let t=this._prefs,n=this.t,i=(c,d)=>p`<div class="nf-seg">${[c,d].map(([m,h,g])=>p`<button aria-pressed=${m} @click=${h}>${g}</button>`)}</div>`,o=["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],s=["dim","stacked","single"],a=e.floors.length>1,l=this._roomId||this._floorId&&a?p`<button class="nf-chip" @click=${()=>this.back()}>${n("back")}</button>`:f,u=p`<button class="nf-chip" aria-haspopup="true" aria-expanded=${this._switchesOpen} @click=${()=>this._switchesOpen=!this._switchesOpen}>☰ ${n("bars_unfold")} <span class="nf-caret">${this._switchesOpen?"\u25BE":"\u25B4"}</span></button>`;return this._switchesOpen?p`<div class="nf-overlay">
|
||||
</nav>`}toggleChip(e,t,n){return p`<button class="nf-chip" aria-pressed=${this._prefs[e]} title=${n?this.t(n):f} @click=${()=>this.setPref(e,!this._prefs[e])}>${this.t(t)}</button>`}renderOverlay(e){let t=this._prefs,n=this.t,i=(c,m)=>p`<div class="nf-seg">${[c,m].map(([d,h,g])=>p`<button aria-pressed=${d} @click=${h}>${g}</button>`)}</div>`,o=["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],s=["dim","stacked","single"],a=e.floors.length>1,l=this._roomId||this._floorId&&a?p`<button class="nf-chip" @click=${()=>this.back()}>${n("back")}</button>`:f,u=p`<button class="nf-chip" aria-haspopup="true" aria-expanded=${this._switchesOpen} @click=${()=>this._switchesOpen=!this._switchesOpen}>☰ ${n("bars_unfold")} <span class="nf-caret">${this._switchesOpen?"\u25BE":"\u25B4"}</span></button>`;return this._switchesOpen?p`<div class="nf-overlay">
|
||||
<div class="nf-switches-veil" @click=${()=>this._switchesOpen=!1}></div>
|
||||
<div class="nf-switches" role="group" aria-label=${n("bars_unfold")} @keydown=${c=>c.key==="Escape"&&(this._switchesOpen=!1)}>
|
||||
<div class="nf-seg">
|
||||
@@ -4074,7 +4074,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
<div class="nf-stage-wrap ${this._roomId?"nf-room-open":""}">
|
||||
<nf-view3d
|
||||
class="nf-body"
|
||||
.hass=${ei(yt(this.hass,e.floors),e.settings)}
|
||||
.hass=${ni(xt(this.hass,e.floors),e.settings)}
|
||||
.building=${e}
|
||||
.packs=${this.data.packs}
|
||||
.floorStack=${t.floorStack}
|
||||
@@ -4093,7 +4093,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.keepRoof=${t.keepRoof}
|
||||
.markerMode=${t.markers}
|
||||
.heatMode=${t.heat}
|
||||
.theme=${Vr(t.theme,this.sunState())}
|
||||
.theme=${Gr(t.theme,this.sunState())}
|
||||
.timeOfDay=${this._timeOfDay}
|
||||
.clock=${t.clock==="none"?null:t.clock}
|
||||
.announcements=${!K(this.hass)&&!t.announceMuted}
|
||||
@@ -4112,9 +4112,9 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
?furnish=${this._furnish}
|
||||
.selectedFurniture=${this._selFurniture}
|
||||
@furniture-select=${i=>this._selFurniture=i.detail.id}
|
||||
@furniture-move=${i=>this.applyEdit(o=>Tc(o,i.detail.id,i.detail.x,i.detail.z))}
|
||||
@furniture-move=${i=>this.applyEdit(o=>Ic(o,i.detail.id,i.detail.x,i.detail.z))}
|
||||
@device-select=${i=>this._selDevice=i.detail.id}
|
||||
@device-move=${i=>this.applyEdit(o=>zc(o,i.detail.id,i.detail.x,i.detail.z))}
|
||||
@device-move=${i=>this.applyEdit(o=>Pc(o,i.detail.id,i.detail.x,i.detail.z))}
|
||||
.quality=${t.quality}
|
||||
?showStats=${t.stats}
|
||||
@room-tap=${this.onRoomTap}
|
||||
@@ -4124,7 +4124,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${n?p`<nf-room-panel
|
||||
.building=${this.data.building??null}
|
||||
class="nf-room-panel"
|
||||
.hass=${yt(this.hass,e.floors)}
|
||||
.hass=${xt(this.hass,e.floors)}
|
||||
.room=${n}
|
||||
.floor=${e.floors.find(i=>i.rooms.some(o=>o.id===this._roomId))??null}
|
||||
.confirmEntities=${gt(this.hass,e.floors)}
|
||||
@@ -4135,7 +4135,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
></nf-room-panel>`:this._outside?p`<nf-room-panel
|
||||
.building=${this.data.building??null}
|
||||
class="nf-room-panel"
|
||||
.hass=${yt(this.hass,e.floors)}
|
||||
.hass=${xt(this.hass,e.floors)}
|
||||
.room=${null}
|
||||
.outside=${this.outsideIds(e)}
|
||||
.confirmEntities=${gt(this.hass,e.floors)}
|
||||
@@ -4143,9 +4143,9 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
@close=${()=>this._outside=!1}
|
||||
></nf-room-panel>`:f}
|
||||
${t.clean?f:this.renderOverlay(e)}
|
||||
${this._furnish?Pc(this.furnishHost,this._selFurniture,this._selDevice):f}
|
||||
${this._furnish?Wc(this.furnishHost,this._selFurniture,this._selDevice):f}
|
||||
</div>
|
||||
`}static styles=[_e,ze,Wc,$r]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",Zo);var zf=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,Bc=(r,e)=>Number(r)*60+Number(e);function Ln(r,e,t=new Date){if(!r||r==="off")return!1;if(r==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let n=zf.exec(r.trim());if(!n)return!1;let i=Bc(n[1],n[2]),o=Bc(n[3],n[4]),s=t.getHours()*60+t.getMinutes();return i>o?s>=i||s<o:s>=i&&s<o}var oi=class{host;cleanTimer;idleTimer;nightTimer;constructor(e){this.host=e}armClean(e=!1){clearTimeout(this.cleanTimer);let t=this.host.config()?.controls_hide_after??0;t>0&&(e&&this.host.isClean()&&this.host.setClean(!1),this.cleanTimer=setTimeout(()=>this.host.setClean(!0),t*1e3))}stopClean(){clearTimeout(this.cleanTimer)}armIdle(){clearTimeout(this.idleTimer);let e=this.host.config()?.idle_return??0;e>0&&(this.idleTimer=setTimeout(()=>this.host.goHome(),e*1e3))}touched(){this.host.isOrbit()&&this.host.setOrbit(!1),this.armIdle(),this.armClean(!0)}start(){this.armIdle(),this.nightTimer=setInterval(()=>this.host.setNight(Ln(this.host.config()?.night,this.host.hass())),6e4)}stop(){clearTimeout(this.cleanTimer),clearTimeout(this.idleTimer),clearInterval(this.nightTimer)}};function Vc(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 Kc=J`
|
||||
`}static styles=[_e,ze,Kc,Mr]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",Qo);var Bf=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,jc=(r,e)=>Number(r)*60+Number(e);function Ln(r,e,t=new Date){if(!r||r==="off")return!1;if(r==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let n=Bf.exec(r.trim());if(!n)return!1;let i=jc(n[1],n[2]),o=jc(n[3],n[4]),s=t.getHours()*60+t.getMinutes();return i>o?s>=i||s<o:s>=i&&s<o}var ai=class{host;cleanTimer;idleTimer;nightTimer;constructor(e){this.host=e}armClean(e=!1){clearTimeout(this.cleanTimer);let t=this.host.config()?.controls_hide_after??0;t>0&&(e&&this.host.isClean()&&this.host.setClean(!1),this.cleanTimer=setTimeout(()=>this.host.setClean(!0),t*1e3))}stopClean(){clearTimeout(this.cleanTimer)}armIdle(){clearTimeout(this.idleTimer);let e=this.host.config()?.idle_return??0;e>0&&(this.idleTimer=setTimeout(()=>this.host.goHome(),e*1e3))}touched(){this.host.isOrbit()&&this.host.setOrbit(!1),this.armIdle(),this.armClean(!0)}start(){this.armIdle(),this.nightTimer=setInterval(()=>this.host.setNight(Ln(this.host.config()?.night,this.host.hass())),6e4)}stop(){clearTimeout(this.cleanTimer),clearTimeout(this.idleTimer),clearInterval(this.nightTimer)}};function qc(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 Zc=J`
|
||||
ha-card {
|
||||
overflow: hidden;
|
||||
background: var(--nf-bg);
|
||||
@@ -4269,26 +4269,26 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
`;function Yo(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 Gc(r,e){let t=new Set(e),n=[];for(let o of r.floors){let s=o.rooms.filter(u=>t.has(u.id));if(!s.length)continue;let a=(u,c)=>s.some(d=>d.points.length>=3&&I([u,c],d.points)),l=new Set(s.map(u=>u.id));n.push({...o,rooms:s,openings:o.openings.filter(u=>l.has(u.room_id)),furniture:o.furniture.filter(u=>a(u.x,u.z)),placements:o.placements.filter(u=>a(u.x,u.z)),walls:(o.walls??[]).filter(u=>a((u.a[0]+u.b[0])/2,(u.a[1]+u.b[1])/2)),outdoor:[]})}let i={...r.settings.roof,type:"none",sections:[],solar:[]};return{...r,floors:n,settings:{...r.settings,roof:i}}}var Jt="nf-outside",Jo=class extends Q{static properties={hass:{attribute:!1},_config:{state:!0},_roomId:{state:!0},_floorId:{state:!0},_walls:{state:!0},_heat:{state:!0},_explode:{state:!0},_fullscreen:{state:!0},_clean:{state:!0},_night:{state:!0},_orbit:{state:!0},_roomNames:{state:!0}};_own=null;templatesSeen;roomApplied=!1;data=new zt(this);kiosk=new oi({config:()=>this._config,hass:()=>this.hass,setClean:e=>this._clean=e,isClean:()=>this._clean,setOrbit:e=>this._orbit=e,isOrbit:()=>this._orbit,setNight:e=>this._night=e,goHome:()=>this.returnHome()});constructor(){super(),this._roomId=null,this._floorId=void 0,this._walls=null,this._heat=null,this._explode=null,this._fullscreen=!1,this._clean=!1,this._night=!1,this._orbit=!1,this._roomNames=null}view3d(){return this.shadowRoot?.querySelector("nf-view3d")}returnHome(){this._roomId=this._config?.room??null,this._floorId=void 0,this.view3d()?.resetView(),this._config?.idle_orbit&&(this._orbit=!0)}openDashboard(e){history.pushState(null,"",e),window.dispatchEvent(new CustomEvent("location-changed",{bubbles:!0,composed:!0,detail:{replace:!1}}))}onFullscreen=()=>this._fullscreen=!!document.fullscreenElement&&this.shadowRoot?.contains(document.fullscreenElement)===!0;connectedCallback(){super.connectedCallback(),document.addEventListener("fullscreenchange",this.onFullscreen),this.kiosk.start()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("fullscreenchange",this.onFullscreen),this.kiosk.stop()}toggleFullscreen(){document.fullscreenElement?document.exitFullscreen():this.shadowRoot?.querySelector("ha-card")?.requestFullscreen?.()}static async getConfigElement(){return await Gn(),document.createElement("nextfloor-card-editor")}static getStubConfig(){return{type:"custom:nextfloor-card"}}setConfig(e){if(e.height!==void 0&&!(e.height>100))throw new Error("height must be a number of pixels above 100");this._roomNames=null,this._own=e,this._config=Yo(e,this.data.building?.settings.card_templates),this._floorId=void 0,this._walls=null,this._heat=null,this._explode=null,this._orbit=!1,this._night=Ln(e.night,this.hass),this._clean=e.controls_hidden===!0,this.kiosk.armClean(),this.kiosk.armIdle()}getCardSize(){return Math.ceil((this._config?.height??420)/50)}getGridOptions(){return{columns:"full",rows:this._config?.fill?12:Math.ceil((this._config?.height??420)/56),min_rows:4}}willUpdate(e){let t=this.data.building?.settings.card_templates;if(this._own?.template&&t!==this.templatesSeen&&(this.templatesSeen=t,this._config=Yo(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=Mr(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let n=Ln(this._config?.night,this.hass);n!==this._night&&(this._night=n)}get canSwitch(){return!this._config?.floor||this.thumbs}get thumbs(){return this._config?.floor_thumbs??!this._config?.floor}back(){this._roomId?this._roomId=null:this.canSwitch&&(this._floorId=null)}roomsMemo=null;plan(){let e=this.data.building??null,t=this._config?.rooms;if(!e||!t?.length)return e;let n=t.join(",");return(!this.roomsMemo||this.roomsMemo.source!==e||this.roomsMemo.ids!==n)&&(this.roomsMemo={source:e,ids:n,result:Gc(e,t)}),this.roomsMemo.result}t=e=>$(this.hass,e);stage(){let e=this.plan(),t=this._config,n=this._floorId===void 0?t?.floor??null:this._floorId,i=e&&e.floors.length===1?e.floors[0].id:e?.floors.some(a=>a.id===n)?n:null,o=!!this._roomId&&t?.room_panel!==!1,s=!!this._roomId&&t?.room_panel===!1||!this.thumbs&&this.canSwitch&&!this._roomId&&!!i&&(e?.floors.length??0)>1;return{floorId:i,walls:this._walls??t?.walls??"auto",heat:this._heat??t?.heatmap??"none",explode:this._explode??t?.explode??!0,canGoBack:s,showBar:!!e&&!this._clean&&(s||!!t?.controls&&!o)}}shows(e){let t=this._config?.controls;return t===!0||Array.isArray(t)&&t.includes(e)}renderBar(e){let t=this.plan(),n=this.t,i=["temperature","humidity","co2"].filter(s=>this.shows(s)),o=(s,a)=>p`<div class="nf-seg" role=${s?"group":f} aria-label=${s??f}>${a.map(([l,u,c])=>p`<button aria-pressed=${l} @click=${u}>${c}</button>`)}</div>`;return p`<div class="nf-card-controls">
|
||||
`;function Xo(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 Yc(r,e){let t=new Set(e),n=[];for(let o of r.floors){let s=o.rooms.filter(u=>t.has(u.id));if(!s.length)continue;let a=(u,c)=>s.some(m=>m.points.length>=3&&H([u,c],m.points)),l=new Set(s.map(u=>u.id));n.push({...o,rooms:s,openings:o.openings.filter(u=>l.has(u.room_id)),furniture:o.furniture.filter(u=>a(u.x,u.z)),placements:o.placements.filter(u=>a(u.x,u.z)),walls:(o.walls??[]).filter(u=>a((u.a[0]+u.b[0])/2,(u.a[1]+u.b[1])/2)),outdoor:[]})}let i={...r.settings.roof,type:"none",sections:[],solar:[]};return{...r,floors:n,settings:{...r.settings,roof:i}}}var Qt="nf-outside",es=class extends Q{static properties={hass:{attribute:!1},_config:{state:!0},_roomId:{state:!0},_floorId:{state:!0},_walls:{state:!0},_heat:{state:!0},_explode:{state:!0},_fullscreen:{state:!0},_clean:{state:!0},_night:{state:!0},_orbit:{state:!0},_roomNames:{state:!0}};_own=null;templatesSeen;roomApplied=!1;data=new Tt(this);kiosk=new ai({config:()=>this._config,hass:()=>this.hass,setClean:e=>this._clean=e,isClean:()=>this._clean,setOrbit:e=>this._orbit=e,isOrbit:()=>this._orbit,setNight:e=>this._night=e,goHome:()=>this.returnHome()});constructor(){super(),this._roomId=null,this._floorId=void 0,this._walls=null,this._heat=null,this._explode=null,this._fullscreen=!1,this._clean=!1,this._night=!1,this._orbit=!1,this._roomNames=null}view3d(){return this.shadowRoot?.querySelector("nf-view3d")}returnHome(){this._roomId=this._config?.room??null,this._floorId=void 0,this.view3d()?.resetView(),this._config?.idle_orbit&&(this._orbit=!0)}openDashboard(e){history.pushState(null,"",e),window.dispatchEvent(new CustomEvent("location-changed",{bubbles:!0,composed:!0,detail:{replace:!1}}))}onFullscreen=()=>this._fullscreen=!!document.fullscreenElement&&this.shadowRoot?.contains(document.fullscreenElement)===!0;connectedCallback(){super.connectedCallback(),document.addEventListener("fullscreenchange",this.onFullscreen),this.kiosk.start()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("fullscreenchange",this.onFullscreen),this.kiosk.stop()}toggleFullscreen(){document.fullscreenElement?document.exitFullscreen():this.shadowRoot?.querySelector("ha-card")?.requestFullscreen?.()}static async getConfigElement(){return await Un(),document.createElement("nextfloor-card-editor")}static getStubConfig(){return{type:"custom:nextfloor-card"}}setConfig(e){if(e.height!==void 0&&!(e.height>100))throw new Error("height must be a number of pixels above 100");this._roomNames=null,this._own=e,this._config=Xo(e,this.data.building?.settings.card_templates),this._floorId=void 0,this._walls=null,this._heat=null,this._explode=null,this._orbit=!1,this._night=Ln(e.night,this.hass),this._clean=e.controls_hidden===!0,this.kiosk.armClean(),this.kiosk.armIdle()}getCardSize(){return Math.ceil((this._config?.height??420)/50)}getGridOptions(){return{columns:"full",rows:this._config?.fill?12:Math.ceil((this._config?.height??420)/56),min_rows:4}}willUpdate(e){let t=this.data.building?.settings.card_templates;if(this._own?.template&&t!==this.templatesSeen&&(this.templatesSeen=t,this._config=Xo(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=Ar(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let n=Ln(this._config?.night,this.hass);n!==this._night&&(this._night=n)}get canSwitch(){return!this._config?.floor||this.thumbs}get thumbs(){return this._config?.floor_thumbs??!this._config?.floor}back(){this._roomId?this._roomId=null:this.canSwitch&&(this._floorId=null)}roomsMemo=null;plan(){let e=this.data.building??null,t=this._config?.rooms;if(!e||!t?.length)return e;let n=t.join(",");return(!this.roomsMemo||this.roomsMemo.source!==e||this.roomsMemo.ids!==n)&&(this.roomsMemo={source:e,ids:n,result:Yc(e,t)}),this.roomsMemo.result}t=e=>$(this.hass,e);stage(){let e=this.plan(),t=this._config,n=this._floorId===void 0?t?.floor??null:this._floorId,i=e&&e.floors.length===1?e.floors[0].id:e?.floors.some(a=>a.id===n)?n:null,o=!!this._roomId&&t?.room_panel!==!1,s=!!this._roomId&&t?.room_panel===!1||!this.thumbs&&this.canSwitch&&!this._roomId&&!!i&&(e?.floors.length??0)>1;return{floorId:i,walls:this._walls??t?.walls??"auto",heat:this._heat??t?.heatmap??"none",explode:this._explode??t?.explode??!0,canGoBack:s,showBar:!!e&&!this._clean&&(s||!!t?.controls&&!o)}}shows(e){let t=this._config?.controls;return t===!0||Array.isArray(t)&&t.includes(e)}renderBar(e){let t=this.plan(),n=this.t,i=["temperature","humidity","co2"].filter(s=>this.shows(s)),o=(s,a)=>p`<div class="nf-seg" role=${s?"group":f} aria-label=${s??f}>${a.map(([l,u,c])=>p`<button aria-pressed=${l} @click=${u}>${c}</button>`)}</div>`;return p`<div class="nf-card-controls">
|
||||
${e.canGoBack?p`<button class="nf-chip" @click=${()=>this.back()}>${n("back")}</button>`:f}
|
||||
${this.shows("walls")?o(void 0,[[e.walls==="auto",()=>this._walls="auto",n("walls_auto")],[e.walls==="cut",()=>this._walls="cut",n("walls_cut")],[e.walls==="slope",()=>this._walls="slope",n("walls_slope")]]):f}
|
||||
${this.shows("floors")&&t.floors.length>1&&!e.floorId?o(void 0,[[e.explode,()=>this._explode=!0,n("floors_apart")],[!e.explode,()=>this._explode=!1,n("floors_stacked")]]):f}
|
||||
${i.length>0?o(n("heatmap"),["none",...i].map(s=>[e.heat===s,()=>this._heat=s,n(s==="none"?"heat_off":`heat_short_${s}`)])):f}
|
||||
</div>`}renderRoomButtons(e){let t=this.plan();if(!this._config?.room_buttons||!t||this._clean)return f;let n=Vc(t,e.floorId);if(!n.length)return f;let i=n.length>1,o=(l,u)=>{this.canSwitch&&l!==e.floorId&&(this._floorId=l),this._roomId=u===this._roomId?null:u},s=hn(this.hass,t.floors).length>0,a=()=>{this.canSwitch&&(this._floorId=null),this._roomId=this._roomId===Jt?null:Jt};return p`<div class="nf-card-rooms ${this._roomId&&this._config?.room_panel!==!1?"nf-card-rooms-beside":""}" role="group" aria-label=${this.t("card_room_buttons")}>
|
||||
</div>`}renderRoomButtons(e){let t=this.plan();if(!this._config?.room_buttons||!t||this._clean)return f;let n=qc(t,e.floorId);if(!n.length)return f;let i=n.length>1,o=(l,u)=>{this.canSwitch&&l!==e.floorId&&(this._floorId=l),this._roomId=u===this._roomId?null:u},s=mn(this.hass,t.floors).length>0,a=()=>{this.canSwitch&&(this._floorId=null),this._roomId=this._roomId===Qt?null:Qt};return p`<div class="nf-card-rooms ${this._roomId&&this._config?.room_panel!==!1?"nf-card-rooms-beside":""}" role="group" aria-label=${this.t("card_room_buttons")}>
|
||||
${n.map(l=>p`${i?p`<span class="nf-card-rooms-floor">${l.floorName}</span>`:f}${l.rooms.map(u=>p`<button class="nf-chip" aria-pressed=${u.id===this._roomId} @click=${()=>o(l.floorId,u.id)}>${u.name}</button>`)}`)}
|
||||
${s?p`<button class="nf-chip" aria-pressed=${this._roomId===Jt} title=${this.t("outside_area_hint")} @click=${a}>🌳 ${this.t("outside_area")}</button>`:f}
|
||||
${s?p`<button class="nf-chip" aria-pressed=${this._roomId===Qt} title=${this.t("outside_area_hint")} @click=${a}>🌳 ${this.t("outside_area")}</button>`:f}
|
||||
</div>`}renderCorners(){let e=this._config,t=this.t,n=this._clean||!!this._roomId&&e?.room_panel!==!1;return p`${e?.fullscreen_button&&!n?p`<button class="nf-card-full" title=${t(this._fullscreen?"fullscreen_exit":"fullscreen")} aria-label=${t(this._fullscreen?"fullscreen_exit":"fullscreen")} @click=${()=>this.toggleFullscreen()}>
|
||||
${this._fullscreen?"\u2715":"\u26F6"}
|
||||
</button>`:f}
|
||||
${e?.dashboard&&!n?p`<button class="nf-card-full nf-card-dash ${e.fullscreen_button?"nf-card-dash-2":""}" title=${e.dashboard_label||e.dashboard} aria-label=${e.dashboard_label||e.dashboard} @click=${()=>this.openDashboard(e.dashboard)}>
|
||||
${e.dashboard_label?p`<span>${e.dashboard_label}</span>`:"\u2302"}
|
||||
</button>`:f}`}renderStage(e){let t=this.plan(),n=this._config,i=()=>{this._clean=!this._clean,this._clean?this.kiosk.stopClean():this.kiosk.armClean()},o=n?.controls_hidden!==void 0||(n?.controls_hide_after??0)>0;return p`<nf-view3d
|
||||
.hass=${ei(yt(this.hass,t.floors),t.settings)}
|
||||
.hass=${ni(xt(this.hass,t.floors),t.settings)}
|
||||
.building=${t}
|
||||
.packs=${this.data.packs}
|
||||
.floorId=${e.floorId}
|
||||
.roomId=${this._roomId===Jt?null:this._roomId}
|
||||
.outsideOpen=${this._roomId===Jt}
|
||||
.roomId=${this._roomId===Qt?null:this._roomId}
|
||||
.outsideOpen=${this._roomId===Qt}
|
||||
.wallMode=${e.walls}
|
||||
.solidWalls=${n?.solid_walls===!0}
|
||||
.explode=${e.explode}
|
||||
@@ -4311,7 +4311,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.zoom=${typeof n?.zoom=="number"?n.zoom:1}
|
||||
.buttons=${n?.buttons?.map((s,a)=>({id:`card_${a}`,...s}))??null}
|
||||
.heatMode=${e.heat}
|
||||
.theme=${Vr(n?.theme,this.hass?.states["sun.sun"]?.state)}
|
||||
.theme=${Gr(n?.theme,this.hass?.states["sun.sun"]?.state)}
|
||||
.clock=${n?.clock&&n.clock!=="none"?n.clock:null}
|
||||
.lockButton=${n?.lock_button!==!1}
|
||||
.walkButton=${n?.walk_button!==!1}
|
||||
@@ -4329,10 +4329,10 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.panelOpen=${!!this._roomId&&n?.room_panel!==!1}
|
||||
.alerts=${n?.alerts!==!1}
|
||||
.alertJump=${!!n?.alert_jump}
|
||||
.announcements=${!K(this.hass)&&n?.announcements!==!1&&!Nc()}
|
||||
.announcements=${!K(this.hass)&&n?.announcements!==!1&&!Vc()}
|
||||
.sensorBar=${n?.sensor_bar!==!1}
|
||||
.glassWalls=${typeof n?.glass_walls=="number"?Math.min(100,Math.max(0,n.glass_walls)):null}
|
||||
.screenName=${n?.screen_name??Cc()}
|
||||
.screenName=${n?.screen_name??Bc()}
|
||||
.scenes=${n?.scenes!==!1}
|
||||
.clean=${this._clean}
|
||||
.cleanButton=${o}
|
||||
@@ -4350,10 +4350,10 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
></nf-view3d>`}renderRoomPanel(){let e=this.plan();return p`<nf-room-panel
|
||||
.building=${this.plan()??null}
|
||||
class="nf-card-panel"
|
||||
.hass=${yt(this.hass,e.floors)}
|
||||
.hass=${xt(this.hass,e.floors)}
|
||||
.room=${e.floors.flatMap(t=>t.rooms).find(t=>t.id===this._roomId)??null}
|
||||
.floor=${e.floors.find(t=>t.rooms.some(n=>n.id===this._roomId))??null}
|
||||
.outside=${this._roomId===Jt?hn(this.hass,e.floors):null}
|
||||
.outside=${this._roomId===Qt?mn(this.hass,e.floors):null}
|
||||
.confirmEntities=${gt(this.hass,e.floors)}
|
||||
.phrases=${e.settings.announce_phrases??null}
|
||||
@close=${()=>this._roomId=null}
|
||||
@@ -4365,7 +4365,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${n.showBar&&e?this.renderBar(n):f}
|
||||
${this.renderCorners()}
|
||||
</div>
|
||||
</ha-card>`}static styles=[_e,ze,Kc,$r]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",Jo);let r=window;r.customCards=r.customCards??[],r.customCards.push({type:"nextfloor-card",name:$(void 0,"card_name"),description:$(void 0,"card_description"),preview:!1})}Si();
|
||||
</ha-card>`}static styles=[_e,ze,Zc,Mr]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",es);let r=window;r.customCards=r.customCards??[],r.customCards.push({type:"nextfloor-card",name:$(void 0,"card_name"),description:$(void 0,"card_description"),preview:!1})}Mi();
|
||||
/*! Bundled license information:
|
||||
|
||||
@lit/reactive-element/css-tag.js:
|
||||
|
||||
@@ -353,6 +353,45 @@ _PIN_OFFSET = vol.Any(
|
||||
vol.Schema({vol.Optional(k): vol.All(vol.Coerce(float), vol.Range(min=-5, max=5)) for k in ("x", "y", "z")}),
|
||||
)
|
||||
|
||||
_HYDRONIC_CONTROL = {
|
||||
vol.Optional("command"): _ENTITY_REF,
|
||||
vol.Optional("feedback"): _ENTITY_REF,
|
||||
vol.Optional("inverted"): bool,
|
||||
}
|
||||
_HYDRONIC = {
|
||||
vol.Optional("card"): bool,
|
||||
vol.Optional("circuits"): vol.All(
|
||||
[
|
||||
{
|
||||
vol.Required("id"): _ID,
|
||||
vol.Required("name"): vol.All(str, vol.Length(max=100)),
|
||||
vol.Required("kind"): vol.In(["heating", "cooling", "changeover", "pump"]),
|
||||
vol.Optional("has_pump"): bool,
|
||||
vol.Optional("has_valve"): bool,
|
||||
vol.Optional("pump"): _HYDRONIC_CONTROL,
|
||||
vol.Optional("valve"): _HYDRONIC_CONTROL,
|
||||
**{vol.Optional(key): _ENTITY_REF for key in ("flow", "return", "power", "mode_entity")},
|
||||
vol.Optional("cooling_value"): vol.All(vol.Coerce(int), vol.Range(min=-2147483648, max=2147483647)),
|
||||
}
|
||||
],
|
||||
vol.Length(max=32),
|
||||
),
|
||||
vol.Optional("sensors"): vol.All(
|
||||
[
|
||||
{
|
||||
vol.Required("id"): _ID,
|
||||
vol.Required("name"): vol.All(str, vol.Length(max=100)),
|
||||
vol.Required("entity"): _ENTITY_REF,
|
||||
vol.Required("level"): vol.All(vol.Coerce(float), vol.Range(min=0, max=1)),
|
||||
}
|
||||
],
|
||||
vol.Length(max=64),
|
||||
),
|
||||
**{vol.Optional(key): _ENTITY_REF for key in ("flow", "return", "circulation_temperature", "hot_water")},
|
||||
vol.Optional("pump"): _HYDRONIC_CONTROL,
|
||||
vol.Optional("circulation"): _HYDRONIC_CONTROL,
|
||||
}
|
||||
|
||||
FURNITURE_SCHEMA = vol.Schema(
|
||||
{
|
||||
vol.Required("id"): _ID,
|
||||
@@ -391,6 +430,7 @@ FURNITURE_SCHEMA = vol.Schema(
|
||||
vol.Optional("entity", default=None): vol.Any(None, vol.All(str, vol.Length(max=255))),
|
||||
vol.Optional("power", default=None): vol.Any(None, vol.All(str, vol.Length(max=255))),
|
||||
vol.Optional("power_card"): bool,
|
||||
vol.Optional("hydronic"): vol.Any(None, _HYDRONIC),
|
||||
# smart fridge: door sensors of the left and the right door
|
||||
vol.Optional("door_left", default=None): vol.Any(None, vol.All(str, vol.Length(max=255))),
|
||||
vol.Optional("door_right", default=None): vol.Any(None, vol.All(str, vol.Length(max=255))),
|
||||
|
||||
+9
-2
@@ -22,7 +22,7 @@ const common = {
|
||||
legalComments: "eof",
|
||||
banner: { js: "/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */" },
|
||||
logLevel: "info",
|
||||
define: { __NF_TREND_HASH__: JSON.stringify("dev") },
|
||||
define: { __NF_TREND_HASH__: JSON.stringify("dev"), __NF_HYDRONIC_HASH__: JSON.stringify("dev") },
|
||||
};
|
||||
|
||||
const hashOf = (file) => createHash("sha256").update(readFileSync(file)).digest("hex").slice(0, 12);
|
||||
@@ -34,6 +34,7 @@ const langs = JSON.stringify(Object.fromEntries(langFiles.map((f) => [f.slice(0,
|
||||
|
||||
const viewerConfig = { ...common, entryPoints: ["src/viewer/viewer3d.ts"], outfile: `${out}/nextfloor-3d.js` };
|
||||
const trendConfig = { ...common, entryPoints: ["src/components/trend-dialog.ts"], outfile: `${out}/nextfloor-trend.js` };
|
||||
const hydronicConfig = { ...common, entryPoints: ["src/components/hydronic-card.ts"], outfile: `${out}/nextfloor-hydronics.js` };
|
||||
// the card's visual editor only loads in the dashboard's card dialog
|
||||
const cardEditorConfig = { ...common, entryPoints: ["src/card-editor.ts"], outfile: `${out}/nextfloor-card-editor.js`, define: { __NF_LANGS__: langs, "globalThis.__NF_SHARED_TEXTS__": "true" } };
|
||||
// the editor is only needed by admins who open it, so it is a bundle of its own as well
|
||||
@@ -111,7 +112,8 @@ function copySymconAssets() {
|
||||
// Size budgets, small enough for old wall tablets. The editor bundles only load for admins and the card's settings, so they
|
||||
// may grow more than the view; German and English texts ride in every bundle.
|
||||
// Native utility discovery/reports plus the building/floor overview need about 14 KB in the shared runtime.
|
||||
const BUDGET = { "nextfloor.js": 668 * 1024, "nextfloor-3d.js": 1000 * 1024, "nextfloor-editor.js": 720 * 1024, "nextfloor-card-editor.js": 240 * 1024, "nextfloor-trend.js": 100 * 1024 };
|
||||
// Hydronic geometry/readouts load separately; only model references, anchors and the loader join the host.
|
||||
const BUDGET = { "nextfloor.js": 672 * 1024, "nextfloor-3d.js": 1000 * 1024, "nextfloor-editor.js": 720 * 1024, "nextfloor-card-editor.js": 240 * 1024, "nextfloor-trend.js": 100 * 1024, "nextfloor-hydronics.js": 100 * 1024 };
|
||||
|
||||
copyAssets();
|
||||
copySymconAssets();
|
||||
@@ -120,6 +122,8 @@ if (watch) {
|
||||
for (const c of [
|
||||
viewerConfig,
|
||||
trendConfig,
|
||||
hydronicConfig,
|
||||
{ ...hydronicConfig, outfile: `${symconOut}/nextfloor-hydronics.js` },
|
||||
{ ...trendConfig, outfile: `${symconOut}/nextfloor-trend.js` },
|
||||
editorConfig("dev"),
|
||||
cardEditorConfig,
|
||||
@@ -134,6 +138,9 @@ if (watch) {
|
||||
await build(trendConfig);
|
||||
copyFileSync(trendConfig.outfile, `${symconOut}/nextfloor-trend.js`);
|
||||
common.define.__NF_TREND_HASH__ = JSON.stringify(hashOf(trendConfig.outfile));
|
||||
await build(hydronicConfig);
|
||||
copyFileSync(hydronicConfig.outfile, `${symconOut}/nextfloor-hydronics.js`);
|
||||
common.define.__NF_HYDRONIC_HASH__ = JSON.stringify(hashOf(hydronicConfig.outfile));
|
||||
await build(viewerConfig);
|
||||
const editor = editorConfig(hashOf(viewerConfig.outfile));
|
||||
await build(editor);
|
||||
|
||||
@@ -17,6 +17,8 @@ import { dataField, TARGET_EXAMPLES } from "./house.ts";
|
||||
import { parkingForm } from "./parking.ts";
|
||||
import { stairForm } from "./stairs.ts";
|
||||
import { DEFAULT_STAIR } from "../../../geometry/stairs.ts";
|
||||
import { isHydronic } from "../../../hydronic-model.ts";
|
||||
import { renderHydronicForm } from "./hydronic.ts";
|
||||
|
||||
export interface FurnitureActions extends FurnitureLinkActions {
|
||||
rotate(delta: number): void;
|
||||
@@ -239,7 +241,7 @@ export function renderFurnitureForm(host: EditorHost, item: Furniture, actions:
|
||||
<div class="nf-h3row"><h3>${item.name || host.t("furniture")}</h3>${actions.lockButton}</div>
|
||||
<div class="nf-form">${nameFields(host, item, actions)} ${kindField(host, item, actions.packs, actions)} ${geometryFields(host, item, actions)}</div>
|
||||
${typeNotes(host, item, actions)} ${item.type === "stairs" && item.stair ? stairForm(host, item, actions) : nothing} ${variantField(host, item, actions)} ${paintField(host, item, actions)}
|
||||
${links} ${item.type.endsWith(":sprinkler") ? html`<div class="nf-form">${numberField(host, host.t("spray_reach"), item.spray ?? 3, (v) => actions.update({ spray: Math.min(15, Math.max(0.5, v)) }), 0.5, 0.5)}${hint(host.t("spray_hint"), "nf-wide")}</div>` : nothing}
|
||||
${isHydronic(item.type) ? renderHydronicForm(host, item, (patch) => actions.update(patch)) : links} ${item.type.endsWith(":sprinkler") ? html`<div class="nf-form">${numberField(host, host.t("spray_reach"), item.spray ?? 3, (v) => actions.update({ spray: Math.min(15, Math.max(0.5, v)) }), 0.5, 0.5)}${hint(host.t("spray_hint"), "nf-wide")}</div>` : nothing}
|
||||
${hasPicture(item.type) ? pictureFields(host, item, actions) : nothing}
|
||||
${packItem(item.type)?.pet
|
||||
? html`<div class="nf-form nf-links">${entityField(host, host.t("pet_room_sensor"), item.room_sensor ?? null, undefined, entityOptions(host.hass, (id) => /^(sensor|device_tracker|input_select|select)\./.test(id)), (v) => actions.update({ room_sensor: v && v !== "none" ? v : null }))}${hint(host.t("pet_room_hint"), "nf-wide")}</div>`
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
import { html, nothing } from "lit";
|
||||
import { repeat } from "lit/directives/repeat.js";
|
||||
import { uid, type Furniture } from "../../../model.ts";
|
||||
import { hasPump, hasValve, hydronicConfig, newCircuit, type HydronicConfig, type HydronicControl, type HydronicCircuit } from "../../../hydronic-model.ts";
|
||||
import { entityOptions } from "../entities.ts";
|
||||
import { checkField, entityField, hint, numberField, pinShiftField, selectField, textField } from "../fields.ts";
|
||||
import { renderDeviceValues } from "../device-values.ts";
|
||||
import type { EditorHost } from "../host.ts";
|
||||
|
||||
export function renderHydronicForm(host: EditorHost, item: Furniture, update: (patch: Partial<Furniture>) => void) {
|
||||
const h = hydronicConfig(item), options = entityOptions(host.hass, () => true);
|
||||
const set = (patch: Partial<HydronicConfig>) => update({ hydronic: { ...h, ...patch } });
|
||||
const ref = (label: string, value: string | null | undefined, types: number[], save: (id: string | null) => void) => entityField(host, label, value ?? null, undefined, options, (v) => save(v === "none" ? null : v), { types });
|
||||
const numeric = (label: string, value: string | null | undefined, save: (id: string | null) => void) => ref(label, value, [1, 2], save);
|
||||
const control = (label: string, value: HydronicControl | undefined, save: (c: HydronicControl) => void, valve = false) => html`<details class="nf-wide nf-hydronic-control"><summary>${label}</summary><div class="nf-form">
|
||||
${ref("Rückmeldung / Istwert", value?.feedback, [0, 1, 2], (feedback) => save({ ...value, feedback }))}
|
||||
${ref("Befehl / Sollwert (optional)", value?.command, [0, 1, 2], (command) => save({ ...value, command }))}
|
||||
${valve ? checkField(host, "Ventil nur in 3D umkehren", !!value?.inverted, (inverted) => save({ ...value, inverted })) : nothing}
|
||||
${hint("Eine zugewiesene Rückmeldung bestimmt die 3D-Anzeige, auch wenn sie gerade nicht verfügbar ist. Ohne Rückmeldung wird der verknüpfte Sollwert verwendet. Befehle werden über die Symcon-Schaltaktion in ihrem nativen Wertebereich gesendet. Die 3D-Umkehrung verändert weder Anzeige- noch Schreibwerte.", "nf-wide")}
|
||||
</div></details>`;
|
||||
const temperatures = html`${numeric("Vorlauf", h.flow, (flow) => set({ flow }))}${numeric("Rücklauf", h.return, (back) => set({ return: back }))}`;
|
||||
const circuit = (c: HydronicCircuit, i: number) => {
|
||||
const patch = (p: Partial<HydronicCircuit>) => set({ circuits: (h.circuits ?? []).map((old) => old.id === c.id ? { ...old, ...p } : old) });
|
||||
return html`<details class="nf-hydronic-circuit" data-circuit=${c.id} ?open=${i === 0}><summary>${c.name || `Kreis ${i + 1}`}</summary><div class="nf-form">
|
||||
${textField(host, "Name", c.name, (name) => patch({ name }), { wide: true, maxlength: 100 })}
|
||||
${selectField(host, "Kreisart", c.kind, [["heating", "Heizkreis"], ["cooling", "Kühlkreis"], ["changeover", "Heizen / Kühlen"], ["pump", "Einspeise- / Vorschubpumpe (ohne Ventil)"]], (kind) => patch({ kind, ...(kind === "pump" ? { has_pump: true, has_valve: false } : {}) }), { wide: true })}
|
||||
${c.kind !== "pump" ? html`${checkField(host, "Pumpe vorhanden", hasPump(c), (has_pump) => patch({ has_pump }))}${checkField(host, "Ventil vorhanden", hasValve(c), (has_valve) => patch({ has_valve }))}` : nothing}
|
||||
${hasPump(c) ? control("Pumpe", c.pump, (pump) => patch({ pump })) : nothing}
|
||||
${hasValve(c) ? control("Ventil", c.valve, (valve) => patch({ valve }), true) : nothing}
|
||||
${numeric("Vorlauf", c.flow, (flow) => patch({ flow }))}${numeric("Rücklauf", c.return, (back) => patch({ return: back }))}
|
||||
${hasPump(c) ? numeric("Pumpenleistung (optional)", c.power, (power) => patch({ power })) : nothing}
|
||||
${c.kind === "changeover" ? html`${ref("Umschaltung Heizen / Kühlen", c.mode_entity, [0, 1], (mode_entity) => patch({ mode_entity }))}${numberField(host, "Kühlbetrieb bei Wert", c.cooling_value ?? 1, (cooling_value) => patch({ cooling_value: Math.round(cooling_value) }), 1)}` : nothing}
|
||||
<button class="nf-link nf-wide nf-hydronic-remove" ?disabled=${!host.admin} @click=${() => set({ circuits: (h.circuits ?? []).filter((old) => old.id !== c.id) })}>× Kreis entfernen</button>
|
||||
</div></details>`;
|
||||
};
|
||||
return html`<section class="nf-hydronic-form">
|
||||
<div class="nf-form">${checkField(host, "Schwebende 3D-Kachel", h.card !== false, (card) => set({ card }))}${pinShiftField(host, item.pin_offset, (pin_offset) => update({ pin_offset }))}${hint("Verknüpfe jeden Datenpunkt über den Objektbaum. Namen und Pfade schränken die Auswahl nicht ein. Nicht verknüpfte Werte bleiben in der 3D-Kachel ausgeblendet. Das Bauteil öffnet beim Antippen seine Werte und Bedienung.", "nf-wide")}</div>
|
||||
${item.type === "heating_manifold" ? html`${repeat(h.circuits ?? [], (c) => c.id, circuit)}<button class="nf-btn nf-hydronic-add" title="Bis zu 32 Kreise" ?disabled=${!host.admin || (h.circuits?.length ?? 0) >= 32} @click=${() => set({ circuits: [...(h.circuits ?? []), newCircuit(uid("circuit"), `Kreis ${(h.circuits?.length ?? 0) + 1}`)] })}>+ Kreis hinzufügen</button>` : nothing}
|
||||
${item.type === "buffer_tank" ? html`<div class="nf-form">${temperatures}${hint("Die sieben Startplätze liegen von oben nach unten. Höhe 100 % liegt oben, 0 % unten. Fühlerplätze können ergänzt, entfernt und frei in der Höhe positioniert werden; die Anzeige sortiert sie von oben nach unten.", "nf-wide")}</div>
|
||||
${repeat([...(h.sensors ?? [])].sort((a, b) => b.level - a.level), (probe) => probe.id, (probe) => {
|
||||
const patch = (change: Partial<typeof probe>) => set({ sensors: (h.sensors ?? []).map((s) => s.id === probe.id ? { ...s, ...change } : s) });
|
||||
return html`<details class="nf-hydronic-probe" data-probe=${probe.id}><summary>${probe.name || "Fühler"} · ${Math.round(probe.level * 100)} %</summary><div class="nf-form">
|
||||
${textField(host, "Bezeichnung", probe.name, (name) => patch({ name }), { wide: true, maxlength: 100 })}${numeric("Temperatur", probe.entity, (entity) => patch({ entity }))}
|
||||
${numberField(host, "Höhe (%) · 100 = oben", Math.round(probe.level * 1000) / 10, (v) => patch({ level: Math.max(0, Math.min(1, v / 100)) }), .1, 0)}
|
||||
<button class="nf-link nf-wide" ?disabled=${!host.admin} @click=${() => set({ sensors: (h.sensors ?? []).filter((s) => s.id !== probe.id) })}>× Fühlerplatz entfernen</button>
|
||||
</div></details>`;
|
||||
})}<button class="nf-btn nf-hydronic-add-probe" title="Bis zu 64 Fühlerplätze" ?disabled=${!host.admin || (h.sensors?.length ?? 0) >= 64} @click=${() => set({ sensors: [...(h.sensors ?? []), { id: uid("probe"), name: `Fühler ${(h.sensors?.length ?? 0) + 1}`, entity: null, level: .5 }] })}>+ Fühlerplatz hinzufügen</button>` : nothing}
|
||||
${item.type === "freshwater_station" ? html`<div class="nf-form">${temperatures}${numeric("Zirkulationstemperatur", h.circulation_temperature, (circulation_temperature) => set({ circulation_temperature }))}${numeric("Trinkwarmwasser", h.hot_water, (hot_water) => set({ hot_water }))}${control("Ladepumpe", h.pump, (pump) => set({ pump }))}${control("Zirkulationspumpe", h.circulation, (circulation) => set({ circulation }))}</div>` : nothing}
|
||||
${renderDeviceValues(host, item.values, (values) => update({ values }))}
|
||||
</section>`;
|
||||
}
|
||||
@@ -25,6 +25,7 @@ import {
|
||||
type Vec2,
|
||||
} from "../../../model.ts";
|
||||
import { furnitureSize } from "../../../packs.ts";
|
||||
import { defaultHydronic, isHydronic } from "../../../hydronic-model.ts";
|
||||
|
||||
const thousandths = (v: number) => Math.round(v * 1000) / 1000;
|
||||
const quarterTurns = (degrees: number, by: number) => (((degrees + by) % 360) + 360) % 360;
|
||||
@@ -74,6 +75,7 @@ export function newFurniture(type: string, doc: Building, floor: Floor, at: Vec2
|
||||
const above = doc.floors.filter((f) => f.elevation > floor.elevation).sort((p, q) => p.elevation - q.elevation)[0];
|
||||
const h = type === "stairs" ? thousandths(above ? above.elevation - floor.elevation : floor.height + 0.25) : height;
|
||||
const item: Furniture = { id: uid("furniture"), type, x: thousandths(at[0]), z: thousandths(at[1]), rotation: 0, w, d, h, variant: null };
|
||||
if (isHydronic(type)) item.hydronic = defaultHydronic(type);
|
||||
// new stairs are shaped stairs: shape, turn and steps are set in the form, and they open only the floor they need
|
||||
if (type === "stairs") item.stair = { ...DEFAULT_STAIR };
|
||||
return item;
|
||||
|
||||
@@ -2003,4 +2003,8 @@ export const editorStyles = css`
|
||||
font-size: 12.5px;
|
||||
color: var(--nf-warm);
|
||||
}
|
||||
.nf-hydronic-form>details { border:1px solid var(--nf-line); border-radius:10px; padding:10px; margin:8px 0; }
|
||||
.nf-hydronic-form summary { cursor:pointer; font-weight:500; }
|
||||
.nf-hydronic-form details[open]>.nf-form { margin-top:9px; }
|
||||
.nf-hydronic-control { border-top:1px solid var(--nf-line); padding-top:7px; }
|
||||
`;
|
||||
@@ -0,0 +1,113 @@
|
||||
import { css, html, LitElement, nothing } from "lit";
|
||||
import type { Building, Furniture } from "../model.ts";
|
||||
import type { HomeAssistant } from "../types.ts";
|
||||
import { hasPump, hasValve, hydronicConfig, isHydronic, realRef, type HydronicCircuit, type HydronicControl } from "../hydronic-model.ts";
|
||||
import { hydronicReading, readControl, temperatureC, type HydronicReading } from "../hydronic-values.ts";
|
||||
import { nativeBool, nativeNumber, nativeText, nativeValue } from "../entities/symcon-values.ts";
|
||||
import { tokens } from "../styles.ts";
|
||||
import { trendButton } from "./trend-button.ts";
|
||||
export { hydronicVisual } from "../hydronic-values.ts";
|
||||
|
||||
const names: Record<string, string> = { heating_manifold: "Heiz-/Kühlkreisverteiler", buffer_tank: "Pufferspeicher", freshwater_station: "Frischwasserstation" };
|
||||
const nameOf = (item: Furniture) => item.name || names[item.type];
|
||||
const titleOf = (c: HydronicCircuit) => c.name || ({ heating: "Heizkreis", cooling: "Kühlkreis", changeover: "Heizen / Kühlen", pump: "Vorschubpumpe" })[c.kind];
|
||||
const modeOf = (hass: HomeAssistant, c: HydronicCircuit) => c.kind === "pump" ? "Pumpenkreis" : c.kind === "cooling" ? "Kühlen" : c.kind === "heating" ? "Heizen"
|
||||
: realRef(c.mode_entity) && nativeValue(hass.states[c.mode_entity]) === null ? "Betriebsart –" : Number(realRef(c.mode_entity) ? nativeValue(hass.states[c.mode_entity]) : 0) === (c.cooling_value ?? 1) ? "Kühlen" : "Heizen";
|
||||
const parts = (hass: HomeAssistant, flow?: string | null, back?: string | null): HydronicReading[] => [hydronicReading(hass, "Vorlauf", flow), hydronicReading(hass, "Rücklauf", back)].filter((r): r is HydronicReading => r !== null);
|
||||
const delta = (hass: HomeAssistant, flow?: string | null, back?: string | null) => {
|
||||
const a = temperatureC(hass, flow), b = temperatureC(hass, back);
|
||||
return a === null || b === null ? nothing : html`<div class="reading delta"><span>ΔT · VL − RL</span><b>${(a - b).toLocaleString(hass.language, { maximumFractionDigits: 1 })} K</b></div>`;
|
||||
};
|
||||
function rootRows(hass: HomeAssistant, item: Furniture): HydronicReading[] {
|
||||
const h = hydronicConfig(item), rows = parts(hass, h.flow, h.return);
|
||||
if (item.type === "buffer_tank") rows.unshift(...[...(h.sensors ?? [])].sort((a, b) => b.level - a.level).flatMap((s) => { const row = hydronicReading(hass, s.name || "Fühler", s.entity); return row ? [row] : []; }));
|
||||
if (item.type === "freshwater_station") for (const [label, id] of [["Zirkulation", h.circulation_temperature], ["Trinkwarmwasser", h.hot_water]] as const) { const row = hydronicReading(hass, label, id); if (row) rows.push(row); }
|
||||
for (const v of item.values ?? []) { const row = hydronicReading(hass, v.label || String(v.entity && hass.states[v.entity]?.attributes.friendly_name || "Wert"), v.entity); if (row) rows.push({ ...row, icon: v.icon }); }
|
||||
return rows;
|
||||
}
|
||||
const rowTemplate = (hass: HomeAssistant, row: HydronicReading) => html`<div class="reading" data-source=${row.id}><span>${row.icon?.startsWith("mdi:") ? html`<ha-icon icon=${row.icon}></ha-icon>` : row.icon || nothing} ${row.label}</span><b>${row.text}${trendButton(hass, [row.id], row.label)}</b></div>`;
|
||||
function controlRow(hass: HomeAssistant, label: string, binding?: HydronicControl) {
|
||||
const state = readControl(hass, binding);
|
||||
return state.id ? html`<div class="reading" data-source=${state.id}><span>${label}<small>${state.feedback ? "Ist" : "Soll"}</small></span><b><i class="lamp" style=${`background:${state.running === null ? "#888" : state.running ? "#6fe1a2" : "#465361"}`}></i>${nativeText(hass.states[state.id])}${trendButton(hass, [state.id], label)}</b></div>` : nothing;
|
||||
}
|
||||
|
||||
const styles = css`
|
||||
:host{display:block;color:var(--nf-text);font:12px/1.4 system-ui,sans-serif;min-width:170px;max-width:300px}
|
||||
button{font:inherit;color:inherit;background:var(--nf-fill,#ffffff10);border:1px solid var(--nf-line);border-radius:7px;padding:5px 8px;cursor:pointer}button:disabled,input:disabled{opacity:.45;cursor:default}button:focus-visible,input:focus-visible{outline:2px solid var(--nf-accent);outline-offset:2px}
|
||||
.title{display:block;width:100%;padding:0 0 5px;border:0;background:none;font-weight:600;text-align:left;white-space:normal}.content{max-height:250px;overflow:auto;overscroll-behavior:contain}.circuit{border-top:1px solid var(--nf-line);padding:5px 0}.circuit-name{font-size:11px;font-weight:600;margin-bottom:3px}.reading{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;align-items:center;min-height:22px}.reading>span{color:var(--nf-muted);white-space:normal}.reading b{display:flex;align-items:center;justify-content:flex-end;white-space:nowrap;font-variant-numeric:tabular-nums;font-weight:500}.reading small{font-size:9px;margin-left:5px;opacity:.75}.delta{font-size:10px}.lamp{display:inline-block;flex:none;width:6px;height:6px;border-radius:50%;margin-right:5px}.empty{color:var(--nf-muted);font-size:11px;white-space:normal;margin:5px 0}nf-trend-button{margin-left:3px}
|
||||
.circuit-name small,h3 small{font-size:10px;color:var(--nf-muted);font-weight:normal;margin-left:5px}
|
||||
ha-icon{--mdc-icon-size:13px;width:13px;height:13px;vertical-align:middle}
|
||||
dialog{box-sizing:border-box;width:min(620px,calc(100vw - 24px));max-width:none;max-height:calc(100dvh - 24px);padding:0;color:var(--nf-text);background:var(--nf-chrome-solid,#1c1c1c);border:1px solid var(--nf-line);border-radius:14px;box-shadow:0 20px 70px #0008;font:13px/1.4 system-ui,sans-serif}dialog::backdrop{background:#050b16a6;backdrop-filter:blur(3px)}header{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 18px;border-bottom:1px solid var(--nf-line)}h2{font-size:17px;margin:0}.body{padding:12px 18px;max-height:calc(100dvh - 120px);overflow:auto;overscroll-behavior:contain}h3{font-size:13px;margin:12px 0 7px}fieldset{min-width:0;margin:8px 0;padding:10px;border:1px solid var(--nf-line);border-radius:9px}legend{font-size:12px;color:var(--nf-muted)}.command{display:flex;align-items:center;gap:12px;margin-top:8px}.command input[type=range]{flex:1;min-width:0;accent-color:var(--nf-accent)}.command input[type=number]{width:90px;box-sizing:border-box;background:var(--nf-fill,#ffffff10);border:1px solid var(--nf-line);border-radius:6px;color:inherit;padding:5px}.command output{font-variant-numeric:tabular-nums;min-width:45px;text-align:right}.error{color:#ff9b9b}.readonly{color:var(--nf-muted);font-size:11px;margin:4px 0}.body .reading{padding:4px 0}.body .circuit{padding-bottom:12px}
|
||||
`;
|
||||
|
||||
class HydronicCard extends LitElement {
|
||||
static properties = { hass: { attribute: false }, item: { attribute: false }, readOnly: { type: Boolean } };
|
||||
declare hass: HomeAssistant; declare item: Furniture; declare readOnly: boolean;
|
||||
render() {
|
||||
if (!this.hass || !this.item) return nothing;
|
||||
const h = hydronicConfig(this.item), rows = rootRows(this.hass, this.item);
|
||||
return html`<button class="title" @click=${() => openHydronic(this.hass, this.item, this.readOnly)} aria-haspopup="dialog">${nameOf(this.item)} ⚙</button><div class="content">
|
||||
${this.item.type === "heating_manifold" ? (h.circuits ?? []).map((c) => html`<section class="circuit"><div class="circuit-name">${titleOf(c)} <small>${modeOf(this.hass, c)}</small></div>${hasPump(c) ? controlRow(this.hass, "Pumpe", c.pump) : nothing}${hasValve(c) ? controlRow(this.hass, "Ventil", c.valve) : nothing}${parts(this.hass, c.flow, c.return).map((r) => rowTemplate(this.hass, r))}${hydronicReading(this.hass, "Leistung", c.power) ? rowTemplate(this.hass, hydronicReading(this.hass, "Leistung", c.power)!) : nothing}</section>`) : nothing}
|
||||
${rows.map((r) => rowTemplate(this.hass, r))}${this.item.type === "freshwater_station" ? html`${controlRow(this.hass, "Ladepumpe", h.pump)}${controlRow(this.hass, "Zirkulationspumpe", h.circulation)}` : nothing}
|
||||
${this.item.type !== "heating_manifold" && !rows.length ? html`<p class="empty">Noch keine Fühler verknüpft</p>` : nothing}
|
||||
</div>`;
|
||||
}
|
||||
static styles = [tokens, styles];
|
||||
}
|
||||
|
||||
class HydronicDialog extends LitElement {
|
||||
static properties = { hass: { attribute: false }, item: { attribute: false }, readOnly: { type: Boolean }, pending: { state: true }, error: { state: true } };
|
||||
declare hass: HomeAssistant; declare item: Furniture; declare readOnly: boolean;
|
||||
private declare pending: Set<string>; private declare error: string;
|
||||
constructor() { super(); this.pending = new Set(); this.error = ""; this.readOnly = false; }
|
||||
async show() { await this.updateComplete; this.shadowRoot!.querySelector("dialog")!.showModal(); }
|
||||
private async send(id: string, value: number | boolean) {
|
||||
const st = this.hass.states[id];
|
||||
if (this.readOnly || !st?.attributes.symcon_has_action || nativeValue(st) === null || this.pending.has(id)) return;
|
||||
this.pending = new Set([...this.pending, id]); this.error = "";
|
||||
try { await this.hass.callService("symcon", "set_value", { entity_id: id, value }); }
|
||||
catch (error) { this.error = error instanceof Error ? error.message : String(error); }
|
||||
finally { this.pending = new Set([...this.pending].filter((v) => v !== id)); }
|
||||
}
|
||||
private control(label: string, binding?: HydronicControl) {
|
||||
if (!realRef(binding?.command) && !realRef(binding?.feedback)) return nothing;
|
||||
const id = realRef(binding?.command) ? binding.command : null, st = id ? this.hass.states[id] : undefined;
|
||||
const a = st?.attributes, value = nativeValue(st), writable = !!id && !!a?.symcon_has_action && value !== null && !this.readOnly && !this.pending.has(id);
|
||||
const min = Number(a?.symcon_min ?? 0), max = Number(a?.symcon_max ?? 100), step = Number(a?.symcon_step || (a?.symcon_variable_type === 1 ? 1 : .1));
|
||||
const number = nativeNumber(st);
|
||||
const writeNumber = (event: Event) => { const input = event.target as HTMLInputElement; if (id && input.value.trim() && input.checkValidity() && Number.isFinite(input.valueAsNumber)) void this.send(id, input.valueAsNumber); };
|
||||
return html`<fieldset data-control=${label}><legend>${label}</legend>${controlRow(this.hass, label, binding)}
|
||||
${id ? html`<div class="reading"><span>Befehl / Sollwert</span><b>${nativeText(st)}${trendButton(this.hass, [id], `${label} · Sollwert`)}</b></div>
|
||||
${a?.symcon_variable_type === 0 ? html`<div class="command"><button data-command=${id} ?disabled=${!writable} @click=${() => void this.send(id, !nativeBool(st))}>${nativeBool(st) ? "Ausschalten / Schließen" : "Einschalten / Öffnen"}</button></div>`
|
||||
: [1, 2].includes(Number(a?.symcon_variable_type)) ? html`<div class="command"><input type="range" aria-label=${`${label} Sollwert`} data-command=${id} min=${min} max=${max} step=${step} .value=${String(number ?? min)} ?disabled=${!writable} @change=${writeNumber}/><input type="number" aria-label=${`${label} nativer Sollwert`} min=${min} max=${max} step=${step} .value=${number === null ? "" : String(number)} ?disabled=${!writable} @change=${writeNumber}/></div>` : nothing}
|
||||
${this.readOnly ? html`<p class="readonly">Historische Ansicht · nur Anzeige</p>` : !a?.symcon_has_action ? html`<p class="readonly">Nur Anzeige · keine Symcon-Schaltaktion hinterlegt</p>` : nothing}` : nothing}
|
||||
</fieldset>`;
|
||||
}
|
||||
render() {
|
||||
if (!this.hass || !this.item) return nothing;
|
||||
const h = hydronicConfig(this.item), rows = rootRows(this.hass, this.item);
|
||||
return html`<dialog @close=${() => { this.remove(); if (activeDialog === this) activeDialog = null; }} @keydown=${(e: Event) => e.stopPropagation()}><header><h2>${nameOf(this.item)}</h2><button aria-label="Schließen" @click=${() => this.shadowRoot!.querySelector("dialog")!.close()}>×</button></header><div class="body">
|
||||
${this.item.type === "heating_manifold" ? (h.circuits ?? []).map((c) => html`<section class="circuit" data-circuit=${c.id}><h3>${titleOf(c)} <small>${modeOf(this.hass, c)}</small></h3>${hasPump(c) ? this.control("Pumpe", c.pump) : nothing}${hasValve(c) ? this.control("Ventil", c.valve) : nothing}${parts(this.hass, c.flow, c.return).map((r) => rowTemplate(this.hass, r))}${delta(this.hass, c.flow, c.return)}${hydronicReading(this.hass, "Pumpenleistung", c.power) ? rowTemplate(this.hass, hydronicReading(this.hass, "Pumpenleistung", c.power)!) : nothing}</section>`) : nothing}
|
||||
${rows.map((r) => rowTemplate(this.hass, r))}${this.item.type !== "heating_manifold" ? delta(this.hass, h.flow, h.return) : nothing}
|
||||
${this.item.type === "freshwater_station" ? html`${this.control("Ladepumpe", h.pump)}${this.control("Zirkulationspumpe", h.circulation)}` : nothing}
|
||||
${!rows.length && this.item.type !== "heating_manifold" ? html`<p class="empty">Die Fühler lassen sich im Editor über den Objektbaum zuweisen.</p>` : nothing}
|
||||
${this.error ? html`<p class="error" role="alert">${this.error}</p>` : nothing}
|
||||
</div></dialog>`;
|
||||
}
|
||||
static styles = [tokens, styles, css`:host{max-width:none;min-width:0}`];
|
||||
}
|
||||
let activeDialog: HydronicDialog | null = null;
|
||||
export function closeHydronic() { activeDialog?.remove(); activeDialog = null; }
|
||||
export async function openHydronic(hass: HomeAssistant, item: Furniture, readOnly = false): Promise<void> {
|
||||
activeDialog?.remove();
|
||||
const dialog = document.createElement("nf-hydronic-dialog") as HydronicDialog;
|
||||
activeDialog = dialog; Object.assign(dialog, { hass, item, readOnly }); document.body.append(dialog); await dialog.show();
|
||||
}
|
||||
export function refreshHydronic(hass: HomeAssistant, building: Building, readOnly = false): void {
|
||||
if (!activeDialog) return;
|
||||
const item = building.floors.flatMap((f) => f.furniture).find((f) => f.id === activeDialog!.item.id);
|
||||
if (!item || !isHydronic(item.type)) { activeDialog.remove(); activeDialog = null; return; }
|
||||
Object.assign(activeDialog, { hass, item, readOnly });
|
||||
}
|
||||
if (!customElements.get("nf-hydronic-card")) customElements.define("nf-hydronic-card", HydronicCard);
|
||||
if (!customElements.get("nf-hydronic-dialog")) customElements.define("nf-hydronic-dialog", HydronicDialog);
|
||||
@@ -32,6 +32,8 @@ import { chosenEffects, readSkyWeather, withDensity } from "../live/sky-weather.
|
||||
import { energyPicture, houseHub, type EnergyPicture } from "../live/energy-flow.ts";
|
||||
import { roomClimateCards } from "../live/room-climate-card.ts";
|
||||
import { furniturePowerCards } from "../live/furniture-power-card.ts";
|
||||
import { isHydronic } from "../hydronic-model.ts";
|
||||
import { loadHydronics } from "../load-hydronics.ts";
|
||||
import { loadWeek, type WeekBars } from "../live/week-bars.ts";
|
||||
import { binsDue, loadToday, sortDay, type TodayItem } from "../live/today.ts";
|
||||
import { forecastDays, loadForecast } from "../live/forecast.ts";
|
||||
@@ -413,6 +415,8 @@ export class NfView3d extends LitElement {
|
||||
private declare _utilityOverviewVisible: boolean;
|
||||
|
||||
private viewer: NextFloorViewer | null = null;
|
||||
private hydronicModule: Awaited<ReturnType<typeof loadHydronics>> | null = null;
|
||||
private hydronicGeneration = 0;
|
||||
private starting = false;
|
||||
/** States of the placed entities as last sent to the viewer. */
|
||||
private shownStates = new Map<string, HassEntity | undefined>();
|
||||
@@ -549,6 +553,7 @@ export class NfView3d extends LitElement {
|
||||
|
||||
disconnectedCallback(): void {
|
||||
super.disconnectedCallback();
|
||||
this.hydronicGeneration++; this.hydronicModule?.closeHydronic();
|
||||
this.stopPlugins?.();
|
||||
this.stopPlugins = null;
|
||||
this.listenToAnnouncements(false);
|
||||
@@ -859,6 +864,7 @@ export class NfView3d extends LitElement {
|
||||
// a piece shown only while a helper is on (seasonal decoration) comes and goes with it
|
||||
if (hiddenFurniture(hass, b).join(",") !== this.shownFor?.key) v.setBuilding(this.shownBuilding(hass));
|
||||
this.shownStates = new Map(this.watched.map((id) => [id, hass.states[id]]));
|
||||
this.syncHydronics(v, b, hass);
|
||||
this.refreshToday(b);
|
||||
this.refreshForecast(b);
|
||||
|
||||
@@ -1380,6 +1386,7 @@ export class NfView3d extends LitElement {
|
||||
}
|
||||
// an item with its own tap action shows what it shows as usual; a tap on it or on its pin runs the action
|
||||
const own = ownTaps(b, markers);
|
||||
for (const f of b.floors.flatMap((fl) => fl.furniture)) if (isHydronic(f.type)) targets.set(f.id, `hydronic:${f.id}`);
|
||||
this.tapPins = own.pins;
|
||||
for (const f of b.floors.flatMap((fl) => fl.furniture)) if (f.tap?.action) targets.set(f.id, `tap:${f.id}`);
|
||||
// one without a pin of its own gets one above it, like a device's, that does the same
|
||||
@@ -2323,6 +2330,11 @@ export class NfView3d extends LitElement {
|
||||
if (entityId.startsWith("lamp:")) return;
|
||||
// in the past nothing is switched
|
||||
if (this._travel) return;
|
||||
if (entityId.startsWith("hydronic:")) {
|
||||
const item = this.building?.floors.flatMap((f) => f.furniture).find((f) => f.id === entityId.slice(9));
|
||||
if (item && this.hass) void loadHydronics().then((mod) => { if (this.isConnected && this.hass) { this.hydronicModule = mod; return mod.openHydronic(this.hass, item); } }).catch((err) => { this._error = String(err); });
|
||||
return;
|
||||
}
|
||||
const ownTap = entityId.startsWith("tap:") ? entityId.slice(4) : this.tapPins.get(entityId);
|
||||
if (ownTap) {
|
||||
const f = this.building?.floors.flatMap((fl) => fl.furniture).find((it) => it.id === ownTap);
|
||||
@@ -2639,6 +2651,18 @@ export class NfView3d extends LitElement {
|
||||
.catch(() => (this.dayCurves = null));
|
||||
}
|
||||
|
||||
private syncHydronics(v: NextFloorViewer, b: Building, hass: HomeAssistant): void {
|
||||
const generation = ++this.hydronicGeneration;
|
||||
const items = this.shownBuilding(hass).floors.filter((floor) => !this.floorId || floor.id === this.floorId).flatMap((floor) => floor.furniture.filter((item) => isHydronic(item.type)).map((item) => ({ floor, item })));
|
||||
if (!items.length) { v.setHydronics([]); this.hydronicModule?.refreshHydronic(hass, b, !!this._travel); return; }
|
||||
void loadHydronics().then((mod) => {
|
||||
if (generation !== this.hydronicGeneration || this.viewer !== v || !this.isConnected) return;
|
||||
this.hydronicModule = mod;
|
||||
v.setHydronics(items.map(({ floor, item }) => ({ ...mod.hydronicVisual(hass, item, floor.id, mountBase(floor, item)), animate: !this.dimmed && !this._travel })));
|
||||
mod.refreshHydronic(hass, b, !!this._travel);
|
||||
}).catch((err) => { this._error = String(err); });
|
||||
}
|
||||
|
||||
private syncLhCards(v: NextFloorViewer, b: Building, pic: EnergyPicture, cars: ReturnType<NfView3d["liveCars"]>, media: MediaNow[], hass: HomeAssistant): void {
|
||||
const cards: LiveCard[] = [];
|
||||
const s = pic.summary;
|
||||
@@ -2663,6 +2687,12 @@ export class NfView3d extends LitElement {
|
||||
if (this.liveCardsOn && !this.dimmed) {
|
||||
cards.push(...roomClimateCards(hass, b, this.floorId, this.roomId));
|
||||
cards.push(...furniturePowerCards(hass, b, this.furnitureLinks ?? new Map(), this.floorId, this.roomId));
|
||||
for (const floor of b.floors) for (const item of floor.furniture) {
|
||||
if (!isHydronic(item.type) || item.hydronic?.card === false || (this.floorId && floor.id !== this.floorId) || !furnitureShown(hass, item)) continue;
|
||||
const room = this.roomId ? floor.rooms.find((r) => r.id === this.roomId) : null;
|
||||
if (this.roomId && (!room || !pointInPolygon([item.x, item.z], room.points))) continue;
|
||||
cards.push({ kind: "hydronic", item, readOnly: !!this._travel, at: { floorId: floor.id, x: item.x + (item.pin_offset?.x ?? 0), z: item.z + (item.pin_offset?.z ?? 0), y: mountBase(floor, item) + item.h + .3 + (item.pin_offset?.y ?? 0) } });
|
||||
}
|
||||
}
|
||||
if (JSON.stringify(cards) !== JSON.stringify(this._liveCards)) this._liveCards = cards;
|
||||
v.setLiveAnchors(
|
||||
@@ -2714,7 +2744,7 @@ export class NfView3d extends LitElement {
|
||||
const own = this.ownSensors();
|
||||
const e = this._liveEnergy?.summary;
|
||||
const energy = !!e && !this.roomId && this.showEnergy && !!this.hass && !(e.consumption === null && e.grid === null && e.solar === null && e.battery === null);
|
||||
const climate = this.building?.floors.some((f) => f.rooms.some((r) => r.climate_card) || f.furniture.some((m) => m.power_card));
|
||||
const climate = this.building?.floors.some((f) => f.rooms.some((r) => r.climate_card) || f.furniture.some((m) => m.power_card || (isHydronic(m.type) && m.hydronic?.card !== false)));
|
||||
const climateToggle = climate ? this.renderCardToggle() : nothing;
|
||||
const roomNames = this.roomNamesButton ? html`<button class="nf-energy-item nf-flow-toggle nf-room-names-toggle" aria-pressed=${this.roomLabels} title=${translate(this.hass, "room_names_toggle_hint")} @click=${() => {
|
||||
this.roomLabels = !this.roomLabels;
|
||||
|
||||
@@ -11,6 +11,7 @@ import { pluginWatched } from "../../plugins/registry.ts";
|
||||
import type { HomeAssistant } from "../../types.ts";
|
||||
import { weatherEntity } from "../../weather.ts";
|
||||
import { utilityWatched } from "../../utilities.ts";
|
||||
import { hydronicRefs } from "../../hydronic-model.ts";
|
||||
|
||||
export interface WatchInputs {
|
||||
hass: HomeAssistant;
|
||||
@@ -44,6 +45,7 @@ function furnitureIds(inputs: WatchInputs): MaybeId[] {
|
||||
// a washer's, dryer's or dishwasher's time left comes from a sensor next to its switch
|
||||
...pieces.filter((m) => m.type === "washer" || m.type === "dryer" || m.type === "dishwasher").flatMap((m) => deviceSiblings(hass, furnitureLinks.get(m.id)?.entity ?? furnitureLinks.get(m.id)?.power).filter((id) => id.startsWith("sensor."))),
|
||||
...pieces.flatMap((m) => [m.door_left, m.door_right, m.soc, m.status, m.charge, m.export, m.temp_entity, m.temp_entity2, ...(m.values ?? []).map((v) => v.entity)]),
|
||||
...pieces.flatMap(hydronicRefs),
|
||||
...pieces.filter((m) => m.type === "robot_vacuum").map((m) => robotRoomSensor(hass, furnitureLinks.get(m.id)?.entity ?? null, m.room_sensor)),
|
||||
...pieces.flatMap((m) => (m.pictures ?? []).flatMap((rule) => [rule.entity, ...(rule.image.startsWith("camera:") ? [rule.image.slice("camera:".length)] : [])])),
|
||||
];
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
import type { EntityRef, Furniture } from "./model.ts";
|
||||
|
||||
export const HYDRONIC_TYPES = ["heating_manifold", "buffer_tank", "freshwater_station"] as const;
|
||||
export const isHydronic = (type: string): boolean => (HYDRONIC_TYPES as readonly string[]).includes(type);
|
||||
export interface HydronicControl { command?: EntityRef; feedback?: EntityRef; inverted?: boolean }
|
||||
export interface HydronicCircuit {
|
||||
id: string; name: string; kind: "heating" | "cooling" | "changeover" | "pump";
|
||||
has_pump?: boolean; has_valve?: boolean;
|
||||
pump?: HydronicControl; valve?: HydronicControl;
|
||||
flow?: EntityRef; return?: EntityRef; power?: EntityRef;
|
||||
mode_entity?: EntityRef; cooling_value?: number;
|
||||
}
|
||||
export interface HydronicProbe { id: string; name: string; entity: EntityRef; level: number }
|
||||
export interface HydronicConfig {
|
||||
card?: boolean;
|
||||
circuits?: HydronicCircuit[];
|
||||
sensors?: HydronicProbe[];
|
||||
flow?: EntityRef; return?: EntityRef;
|
||||
pump?: HydronicControl; circulation?: HydronicControl;
|
||||
circulation_temperature?: EntityRef; hot_water?: EntityRef;
|
||||
}
|
||||
|
||||
export const newCircuit = (id: string, name = "Heizkreis"): HydronicCircuit => ({ id, name, kind: "heating", has_pump: true, has_valve: true });
|
||||
export function defaultHydronic(type: string): HydronicConfig {
|
||||
return { card: true, ...(type === "heating_manifold" ? { circuits: [newCircuit("c1", "Heizkreis 1")] } : {}),
|
||||
...(type === "buffer_tank" ? { sensors: Array.from({ length: 7 }, (_, i) => ({ id: `s${i + 1}`, name: `Fühler ${i + 1}`, entity: null, level: 1 - i / 6 })) } : {}) };
|
||||
}
|
||||
export function hydronicConfig(item: Pick<Furniture, "type" | "hydronic">): HydronicConfig { return { ...defaultHydronic(item.type), ...item.hydronic }; }
|
||||
export const hasPump = (c: HydronicCircuit): boolean => c.has_pump !== false;
|
||||
export const hasValve = (c: HydronicCircuit): boolean => c.kind !== "pump" && c.has_valve !== false;
|
||||
export const circuitX = (i: number, count: number): number => -.4 + .8 * (i + .5) / Math.max(1, count);
|
||||
export const realRef = (id: EntityRef | undefined): id is string => !!id && id !== "none";
|
||||
const controlRefs = (c: HydronicControl | undefined) => [c?.command, c?.feedback];
|
||||
export function hydronicRefs(item: Pick<Furniture, "type" | "hydronic">): string[] {
|
||||
if (!isHydronic(item.type)) return [];
|
||||
const h = hydronicConfig(item);
|
||||
return [...new Set([h.flow, h.return,
|
||||
...(item.type === "heating_manifold" ? (h.circuits ?? []).flatMap((c) => [c.flow, c.return, c.power, c.mode_entity, ...(hasPump(c) ? controlRefs(c.pump) : []), ...(hasValve(c) ? controlRefs(c.valve) : [])]) : []),
|
||||
...(item.type === "buffer_tank" ? (h.sensors ?? []).map((s) => s.entity) : []),
|
||||
...(item.type === "freshwater_station" ? [h.circulation_temperature, h.hot_water, ...controlRefs(h.pump), ...controlRefs(h.circulation)] : []),
|
||||
].filter(realRef))];
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { test } from "node:test";
|
||||
import { entity, floorWith, hassOf } from "./entities/fixtures.ts";
|
||||
import { emptyBuilding, FURNITURE_SIZE, normalizeBuilding, type Furniture } from "./model.ts";
|
||||
import { defaultHydronic, hasValve, hydronicConfig, hydronicRefs, isHydronic, newCircuit } from "./hydronic-model.ts";
|
||||
import { hydronicReading, hydronicVisual, readControl, temperatureC } from "./hydronic-values.ts";
|
||||
import { watchedEntities } from "./components/view3d/watch-list.ts";
|
||||
|
||||
const piece = (type: string, extra: Partial<Furniture> = {}): Furniture => { const [w,d,h] = FURNITURE_SIZE[type as keyof typeof FURNITURE_SIZE]; return { id: "hyd", type, x: 0, z: 0, w,d,h,rotation:0,variant:null, ...extra }; };
|
||||
const native = (id: string, value: number | boolean, extra: Record<string, unknown> = {}) => entity(id, "open", { symcon_id: 123, symcon_variable_type: typeof value === "boolean" ? 0 : 2, symcon_value: value, symcon_min: 0, symcon_max: 100, ...extra });
|
||||
|
||||
test("a buffer starts with seven unique probes from top to bottom and remains freely configurable after persistence", () => {
|
||||
const item = piece("buffer_tank", { hydronic: defaultHydronic("buffer_tank") });
|
||||
item.hydronic!.sensors!.forEach((s, i) => assert.ok(Math.abs(s.level - (6 - i) / 6) < 1e-10));
|
||||
assert.equal(new Set(item.hydronic!.sensors!.map((s) => s.id)).size, 7);
|
||||
item.hydronic!.sensors!.push({ id:"extra",name:"Frei",level:.73,entity:"cover.temperature" });
|
||||
const b = { ...emptyBuilding(), floors: [floorWith([], { furniture:[item] })] };
|
||||
assert.equal(hydronicConfig(normalizeBuilding(JSON.parse(JSON.stringify(b))).floors[0].furniture[0]).sensors!.at(-1)!.level, .73);
|
||||
assert.equal(hydronicConfig(piece("buffer_tank", { hydronic: { sensors: [] } })).sensors!.length, 0, "an explicitly empty list is not replaced by the defaults");
|
||||
});
|
||||
|
||||
test("feedback wins even at zero or offline; the command is used only when no feedback is assigned", () => {
|
||||
const h = hassOf([native("cover.cmd", true), native("lock.feedback", false)]);
|
||||
assert.equal(readControl(h, { command:"cover.cmd",feedback:"lock.feedback" }).running, false);
|
||||
h.states["lock.feedback"] = { ...h.states["lock.feedback"],state:"unavailable" };
|
||||
assert.equal(readControl(h, { command:"cover.cmd",feedback:"lock.feedback" }).running, null);
|
||||
assert.equal(readControl(h, { command:"cover.cmd" }).running, true);
|
||||
assert.equal(readControl(h, { command:"cover.cmd", feedback:"none" }).running, true);
|
||||
assert.equal(readControl(h, {}).id, null);
|
||||
});
|
||||
|
||||
test("native integer and float ranges drive visuals, while inversion leaves raw readings untouched", () => {
|
||||
const h = hassOf([native("climate.valve",128,{symcon_variable_type:1,symcon_max:255,symcon_formatted:"128"})]);
|
||||
const valve = { feedback:"climate.valve",inverted:true };
|
||||
const item = piece("heating_manifold",{hydronic:{circuits:[{...newCircuit("c"),valve}]}});
|
||||
const raw = readControl(h,valve), visual = hydronicVisual(h,item,"floor",0);
|
||||
assert.equal(raw.value,128); assert.equal(raw.percent,128/255*100);
|
||||
assert.equal(visual.circuits[0].valve,100-128/255*100);
|
||||
assert.equal(hydronicReading(h,"Ventil","climate.valve")!.text,"128");
|
||||
h.states["climate.valve"] = native("climate.valve",.4,{symcon_max:1});
|
||||
assert.equal(readControl(h,valve).percent,40);
|
||||
});
|
||||
|
||||
test("a pure feed pump has no valve, and changing operating mode uses raw Boolean/Integer values without name guesses", () => {
|
||||
const h = hassOf([native("cover.Garage",true),native("lock.mode",false)]);
|
||||
const c = { ...newCircuit("feed"),kind:"pump" as const,pump:{feedback:"cover.Garage"},valve:{feedback:"unused"} };
|
||||
const switched = { ...newCircuit("mixed"),kind:"changeover" as const,mode_entity:"lock.mode",cooling_value:0 };
|
||||
const item=piece("heating_manifold",{hydronic:{circuits:[c,switched]}});
|
||||
assert.equal(hasValve(c),false); assert.ok(!hydronicRefs(item).includes("unused"));
|
||||
assert.equal(hydronicVisual(h,item,"floor",0).circuits[0].valve,null);
|
||||
assert.equal(hydronicVisual(h,item,"floor",0).circuits[1].cooling,true);
|
||||
h.states["lock.mode"] = native("lock.mode",7,{symcon_variable_type:1}); switched.cooling_value=7;
|
||||
assert.equal(hydronicVisual(h,item,"floor",0).circuits[1].cooling,true);
|
||||
});
|
||||
|
||||
test("zero/negative temperatures and units are retained, and missing values never turn into fake readings", () => {
|
||||
const h=hassOf([native("cover.c",0,{unit_of_measurement:"°C"}),native("sensor.f",32,{unit_of_measurement:"°F"}),native("sensor.k",273.15,{unit_of_measurement:"K"}),native("sensor.neg",-5,{unit_of_measurement:"°C"})]);
|
||||
assert.equal(temperatureC(h,"cover.c"),0); assert.equal(temperatureC(h,"sensor.f"),0); assert.equal(temperatureC(h,"sensor.k"),0);
|
||||
assert.equal(temperatureC(h,"sensor.neg"),-5); assert.equal(hydronicReading(h,"VL","sensor.neg")!.text,"-5 °C");
|
||||
assert.equal(hydronicReading(h,"RL","none"),null); assert.equal(hydronicReading(h,"RL","missing")!.text,"–");
|
||||
h.states["sensor.neg"] = {...h.states["sensor.neg"],state:"unavailable"}; assert.equal(temperatureC(h,"sensor.neg"),null);
|
||||
});
|
||||
|
||||
test("the view watches every circuit, buffer probe and fresh-water datapoint, independent of climate cards or heatmaps", () => {
|
||||
const manifold=piece("heating_manifold",{hydronic:{circuits:[{...newCircuit("c"),flow:"a",return:"b",power:"c",pump:{command:"d",feedback:"e"},valve:{command:"f",feedback:"g"},mode_entity:"h"}]}});
|
||||
const buffer=piece("buffer_tank",{id:"buffer",hydronic:{flow:"i",return:"j",sensors:[{id:"s",name:"s",entity:"k",level:.7}]}});
|
||||
const fresh=piece("freshwater_station",{id:"fresh",hydronic:{flow:"l",return:"m",hot_water:"n",circulation_temperature:"o",pump:{feedback:"p",command:"q"},circulation:{command:"r",feedback:"s"}}});
|
||||
const b={...emptyBuilding(),floors:[floorWith([],{furniture:[manifold,buffer,fresh]})]};
|
||||
const ids=watchedEntities({hass:hassOf([]),building:b,openingLinks:new Map(),furnitureLinks:new Map(),needsRoomSensors:false,alertSources:null,weatherEntityId:null});
|
||||
for(const id of "abcdefghijklmnopqrs") assert.ok(ids.includes(id),id);
|
||||
assert.equal(isHydronic("buffer_tank"),true); assert.equal(isHydronic("radiator"),false);
|
||||
});
|
||||
@@ -0,0 +1,55 @@
|
||||
import type { Furniture } from "./model.ts";
|
||||
import type { HomeAssistant } from "./types.ts";
|
||||
import { nativeBool, nativeNumber, nativeText, nativeValue } from "./entities/symcon-values.ts";
|
||||
import { hasPump, hasValve, hydronicConfig, realRef, type HydronicControl } from "./hydronic-model.ts";
|
||||
|
||||
export interface HydronicReading { id: string; label: string; text: string; value: number | null; icon?: string | null }
|
||||
export interface ControlState { id: string | null; value: number | boolean | null; percent: number | null; running: boolean | null; feedback: boolean }
|
||||
export interface HydronicVisual {
|
||||
id: string; floorId: string; item: Furniture; base: number;
|
||||
circuits: { id: string; pump: boolean | null; valve: number | null; cooling: boolean; flow: number | null; return: number | null }[];
|
||||
probes: { level: number; value: number | null }[];
|
||||
temperatures: (number | null)[];
|
||||
animate?: boolean;
|
||||
pump: boolean | null; circulation: boolean | null;
|
||||
}
|
||||
|
||||
/** Readback always wins, including an unavailable readback; never substitute the command in that case. */
|
||||
export function readControl(hass: HomeAssistant, binding: HydronicControl | undefined): ControlState {
|
||||
const feedback = realRef(binding?.feedback), id = feedback ? binding!.feedback! : realRef(binding?.command) ? binding!.command! : null;
|
||||
const st = id ? hass.states[id] : undefined, raw = nativeValue(st);
|
||||
if (!st || raw === null) return { id, value: null, percent: null, running: null, feedback };
|
||||
if (st.attributes.symcon_variable_type === 0 || typeof raw === "boolean") {
|
||||
const value = nativeBool(st);
|
||||
return { id, value, percent: value === null ? null : value ? 100 : 0, running: value, feedback };
|
||||
}
|
||||
const value = nativeNumber(st), min = Number(st.attributes.symcon_min ?? 0), max = Number(st.attributes.symcon_max ?? 100);
|
||||
const percent = value === null ? null : Math.max(0, Math.min(100, 100 * (value - min) / (max > min ? max - min : 100)));
|
||||
return { id, value, percent, running: percent === null ? null : percent > 0, feedback };
|
||||
}
|
||||
export function temperatureC(hass: HomeAssistant, id: string | null | undefined): number | null {
|
||||
if (!realRef(id)) return null;
|
||||
const st = hass.states[id], n = nativeNumber(st);
|
||||
if (n === null) return null;
|
||||
const unit = String(st?.attributes.unit_of_measurement ?? "°C").trim();
|
||||
return unit === "°F" || unit === "℉" ? (n - 32) * 5 / 9 : unit === "K" ? n - 273.15 : n;
|
||||
}
|
||||
export function hydronicReading(hass: HomeAssistant, label: string, id: string | null | undefined): HydronicReading | null {
|
||||
if (!realRef(id)) return null;
|
||||
const st = hass.states[id], value = nativeNumber(st), text = nativeText(st), unit = st?.attributes.unit_of_measurement;
|
||||
return { id, label, value, text: value !== null && unit && typeof st?.attributes.symcon_formatted !== "string" ? `${text} ${unit}` : text };
|
||||
}
|
||||
export function hydronicVisual(hass: HomeAssistant, item: Furniture, floorId: string, base: number): HydronicVisual {
|
||||
const h = hydronicConfig(item);
|
||||
return { id: item.id, floorId, item, base,
|
||||
circuits: (h.circuits ?? []).map((c) => {
|
||||
const valve = hasValve(c) ? readControl(hass, c.valve).percent : null;
|
||||
const mode = realRef(c.mode_entity) ? nativeValue(hass.states[c.mode_entity]) : null;
|
||||
return { id: c.id, pump: hasPump(c) ? readControl(hass, c.pump).running : null, valve: valve === null ? null : c.valve?.inverted ? 100 - valve : valve,
|
||||
cooling: c.kind === "cooling" || (c.kind === "changeover" && mode !== null && Number(mode) === (c.cooling_value ?? 1)), flow: temperatureC(hass, c.flow), return: temperatureC(hass, c.return) };
|
||||
}),
|
||||
probes: (h.sensors ?? []).map((s) => ({ level: s.level, value: temperatureC(hass, s.entity) })),
|
||||
temperatures: [h.flow, h.return, h.circulation_temperature, h.hot_water].map((id) => temperatureC(hass, id)),
|
||||
pump: readControl(hass, h.pump).running, circulation: readControl(hass, h.circulation).running,
|
||||
};
|
||||
}
|
||||
@@ -1834,6 +1834,9 @@ const DE = {
|
||||
furn_inverter: "Wechselrichter",
|
||||
furn_home_battery: "Stromspeicher",
|
||||
furn_wallbox: "Wallbox",
|
||||
furn_heating_manifold: "Heiz-/Kühlkreisverteiler",
|
||||
furn_buffer_tank: "Pufferspeicher",
|
||||
furn_freshwater_station: "Frischwasserstation",
|
||||
furn_entity: "Gerät (Schalter, Steckdose …)",
|
||||
furn_state_entity: "Zustand von (optional)",
|
||||
furn_state_entity2: "Zweiter Zustand (andere Hälfte)",
|
||||
@@ -3875,6 +3878,9 @@ const EN: Record<Key, string> = {
|
||||
furn_inverter: "Solar inverter",
|
||||
furn_home_battery: "Home battery",
|
||||
furn_wallbox: "Wallbox",
|
||||
furn_heating_manifold: "Heating/cooling manifold",
|
||||
furn_buffer_tank: "Buffer tank",
|
||||
furn_freshwater_station: "Fresh water station",
|
||||
furn_group_kitchen: "Kitchen",
|
||||
furn_group_sleeping: "Sleeping",
|
||||
furn_group_bath: "Bath & laundry",
|
||||
|
||||
@@ -164,7 +164,7 @@ test("one shared effect timer stops for no participants, hidden views/document,
|
||||
assert.equal(lamps, 2);
|
||||
viewer.scheduleEffects();
|
||||
const noop = { dispose() {}, disconnect() {}, remove() {} };
|
||||
for (const key of ["weatherLayer", "mapLayer", "energyLayer", "soundLayer", "screenLayer", "pictureLayer", "waterLayer", "resizeObserver", "controls", "patternTexture", "blindTexture", "haloTexture", "labels"]) viewer[key] = noop;
|
||||
for (const key of ["weatherLayer", "mapLayer", "energyLayer", "soundLayer", "screenLayer", "pictureLayer", "waterLayer", "hydronicLayer", "resizeObserver", "controls", "patternTexture", "blindTexture", "haloTexture", "labels"]) viewer[key] = noop;
|
||||
viewer.ground = { geometry: noop, material: noop }; viewer.robots = new Map(); viewer.robotTrails = new Map(); viewer.trailTimers = new Map(); viewer.clear = () => {}; viewer.buildRoofMesh = () => {};
|
||||
viewer.renderer = { dispose() {}, forceContextLoss() {}, domElement: noop };
|
||||
const previousCancel = globalThis.cancelAnimationFrame;
|
||||
|
||||
@@ -23,6 +23,7 @@ import { fromCelsius, tempUnit } from "../devices.ts";
|
||||
import { trendButton } from "../components/trend-button.ts";
|
||||
import { loggedEntities } from "../trend-data.ts";
|
||||
import type { FurniturePowerCard } from "./furniture-power-card.ts";
|
||||
import type { Furniture } from "../model.ts";
|
||||
|
||||
export interface HouseCard {
|
||||
kind: "house";
|
||||
@@ -65,7 +66,8 @@ export interface HeatPumpCard {
|
||||
pump: HeatPumpInfo;
|
||||
}
|
||||
|
||||
export type LiveCard = HouseCard | CarCard | MediaCard | PrinterCard | HeatPumpCard | RoomClimateCard | FurniturePowerCard;
|
||||
export interface HydronicCard { kind: "hydronic"; item: Furniture; readOnly: boolean; at: PlanPoint }
|
||||
export type LiveCard = HouseCard | CarCard | MediaCard | PrinterCard | HeatPumpCard | RoomClimateCard | FurniturePowerCard | HydronicCard;
|
||||
|
||||
/** A button on a card was pressed: the 3D view calls the service (with extra data such as the volume). */
|
||||
export type LiveCardAction = (domain: string, service: string, entity: string, data?: Record<string, unknown>) => void;
|
||||
@@ -248,6 +250,7 @@ export function unstackLhCards(root: ParentNode): void {
|
||||
const placed: { x0: number; x1: number; y0: number; y1: number }[] = [];
|
||||
// a card near the edge slides back into the view (on a phone it was cut off); its thread still points home
|
||||
const width = cards[0]?.parentElement?.clientWidth ?? 0;
|
||||
const height = cards[0]?.parentElement?.clientHeight ?? 0;
|
||||
const items = cards
|
||||
.map((el) => {
|
||||
const [anchor, w] = [Number(el.dataset.x), el.offsetWidth];
|
||||
@@ -258,6 +261,17 @@ export function unstackLhCards(root: ParentNode): void {
|
||||
.sort((a, b) => b.y - a.y);
|
||||
for (const it of items) {
|
||||
let bottom = it.y;
|
||||
// Hydraulic cards contain several readings: use nearby free columns before stacking them out of view.
|
||||
if (it.el.classList.contains("live-card-hydronic") && width > it.w + 16 && height > it.h + 16) {
|
||||
const xs = [it.x, it.w / 2 + 8, width - it.w / 2 - 8, ...placed.flatMap((p) => [p.x0 - it.w / 2 - 8, p.x1 + it.w / 2 + 8])]
|
||||
.filter((x) => x >= it.w / 2 + 8 && x <= width - it.w / 2 - 8).sort((a, b) => Math.abs(a - it.x) - Math.abs(b - it.x));
|
||||
const ys = [Math.max(it.h + 8, Math.min(height - 8, bottom)), ...placed.flatMap((p) => [p.y0 - 8, p.y1 + it.h + 8])].filter((y) => y >= it.h + 8 && y <= height - 8);
|
||||
let position: { x: number; y: number } | undefined;
|
||||
for (const y of ys) { for (const x of xs) {
|
||||
if (!placed.some((p) => x - it.w / 2 < p.x1 + 6 && x + it.w / 2 > p.x0 - 6 && y - it.h < p.y1 + 6 && y > p.y0 - 6)) { position = { x, y }; break; }
|
||||
} if (position) break; }
|
||||
if (position) { it.x = position.x; bottom = position.y; }
|
||||
}
|
||||
for (let guard = 0; guard < 12; guard++) {
|
||||
const r = { x0: it.x - it.w / 2, x1: it.x + it.w / 2, y0: bottom - it.h, y1: bottom };
|
||||
const hit = placed.find((p) => r.x0 < p.x1 + 6 && r.x1 > p.x0 - 6 && r.y0 < p.y1 + 6 && r.y1 > p.y0 - 6);
|
||||
@@ -266,6 +280,7 @@ export function unstackLhCards(root: ParentNode): void {
|
||||
}
|
||||
placed.push({ x0: it.x - it.w / 2, x1: it.x + it.w / 2, y0: bottom - it.h, y1: bottom });
|
||||
const lift = it.y - bottom;
|
||||
it.el.style.setProperty("--live-dx", `${Math.round(Number(it.el.dataset.x) - it.x)}px`);
|
||||
it.el.style.transform = `translate(${Math.round(it.x)}px, ${Math.round(bottom)}px) translate(-50%, -100%)`;
|
||||
it.el.style.setProperty("--live-thread", `${Math.round(18 + lift)}px`);
|
||||
}
|
||||
@@ -338,7 +353,7 @@ function furniturePowerCard(hass: HomeAssistant | undefined, c: FurniturePowerCa
|
||||
export function renderLhCards(hass: HomeAssistant | undefined, cards: readonly LiveCard[], act: LiveCardAction, fold?: LiveCardFold, climateOnly = false): TemplateResult | typeof nothing {
|
||||
if (!cards.length) return nothing;
|
||||
return html`<div class="live-cards">
|
||||
${cards.map((c, i) => (c.kind === "roomclimate" ? roomClimateCard(hass, c, i) : c.kind === "power" ? furniturePowerCard(hass, c, i) : climateOnly ? nothing : c.kind === "house" ? houseCard(hass, c, i, fold) : c.kind === "car" ? carCard(hass, c, i, act) : c.kind === "printer" ? printerCard(hass, c, i) : c.kind === "heatpump" ? heatPumpCard(hass, c, i) : mediaCard(hass, c, i, act)))}
|
||||
${cards.map((c, i) => (c.kind === "roomclimate" ? roomClimateCard(hass, c, i) : c.kind === "power" ? furniturePowerCard(hass, c, i) : c.kind === "hydronic" ? html`<div class="live-card live-card-hydronic" data-i=${i} data-furniture=${c.item.id}><nf-hydronic-card .hass=${hass} .item=${c.item} .readOnly=${c.readOnly}></nf-hydronic-card></div>` : climateOnly ? nothing : c.kind === "house" ? houseCard(hass, c, i, fold) : c.kind === "car" ? carCard(hass, c, i, act) : c.kind === "printer" ? printerCard(hass, c, i) : c.kind === "heatpump" ? heatPumpCard(hass, c, i) : mediaCard(hass, c, i, act)))}
|
||||
</div>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
declare const __NF_HYDRONIC_HASH__: string;
|
||||
let loaded: Promise<typeof import("./components/hydronic-card.ts")> | undefined;
|
||||
export function loadHydronics() {
|
||||
const url = new URL(`./nextfloor-hydronics.js?v=${__NF_HYDRONIC_HASH__}`, import.meta.url).href;
|
||||
return loaded ??= import(/* @vite-ignore */ url).catch((error) => { loaded = undefined; throw error; });
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import type { StairConfig } from "./geometry/stairs.ts";
|
||||
import type { LampModel } from "./viewer/viewer3d.ts";
|
||||
import type { FurnitureColors } from "./furniture-colors.ts";
|
||||
import type { ShowWhen } from "./entities/visibility.ts";
|
||||
import type { HydronicConfig } from "./hydronic-model.ts";
|
||||
|
||||
export type Vec2 = [number, number];
|
||||
|
||||
@@ -229,6 +230,7 @@ export interface ScreenPicture {
|
||||
}
|
||||
|
||||
export interface Furniture extends LightEffectConfig {
|
||||
hydronic?: HydronicConfig | null;
|
||||
/** A tap on the item runs this own action (open a path, an entity's details, a service, a browser_mod popup); null = the item's usual tap. */
|
||||
tap?: Pick<CustomButton, "action" | "target" | "data"> | null;
|
||||
/** Fixed against moving by accident. */
|
||||
@@ -1256,6 +1258,9 @@ export const FURNITURE_TYPES = [
|
||||
"grid_point",
|
||||
"parking",
|
||||
"fridge_smart",
|
||||
"heating_manifold",
|
||||
"buffer_tank",
|
||||
"freshwater_station",
|
||||
"stairwell",
|
||||
] as const;
|
||||
|
||||
@@ -1267,7 +1272,7 @@ export const FURNITURE_GROUPS: Record<string, FurnitureType[]> = {
|
||||
kitchen: ["kitchen", "kitchen_wall", "kitchen_tall", "island", "worktop", "sink", "stove", "dishwasher", "fridge"],
|
||||
sleeping: ["bed", "bunk_bed", "nightstand", "wardrobe", "dresser"],
|
||||
bath: ["bathtub", "shower", "wc", "washbasin", "washer", "dryer"],
|
||||
work: ["desk", "worktop", "office_chair", "tall_cabinet", "coat_rack", "radiator", "stairs", "robot_vacuum"],
|
||||
work: ["desk", "worktop", "office_chair", "tall_cabinet", "coat_rack", "radiator", "stairs", "robot_vacuum", "heating_manifold", "buffer_tank", "freshwater_station"],
|
||||
vehicles: ["parking"],
|
||||
};
|
||||
|
||||
@@ -1459,6 +1464,9 @@ export const FURNITURE_SIZE: Record<FurnitureType, [number, number, number]> = {
|
||||
inverter: [0.5, 0.2, 0.65],
|
||||
home_battery: [0.6, 0.25, 1.1],
|
||||
wallbox: [0.3, 0.15, 0.42],
|
||||
heating_manifold: [1.5, 0.35, 1.1],
|
||||
buffer_tank: [0.85, 0.85, 1.85],
|
||||
freshwater_station: [0.65, 0.28, 0.9],
|
||||
// the meter cabinet hangs on the wall as well
|
||||
meter: [0.55, 0.21, 1.1],
|
||||
// the grid connection: a small street cabinet at the edge of the plot
|
||||
|
||||
@@ -15,6 +15,7 @@ import { packModel, placement } from "./packs.ts";
|
||||
import { shapedStairs } from "./stairs.ts";
|
||||
import { cabinet } from "./parts.ts";
|
||||
import { EDGE_FAINT, EDGE_FURN, M } from "./palette.ts";
|
||||
import { hydronicModel } from "./hydronic.ts";
|
||||
|
||||
/** What a model returns to say whether it casts a contact shadow on the floor. */
|
||||
type Shadow = "yes" | "no";
|
||||
@@ -22,6 +23,11 @@ type Shadow = "yes" | "no";
|
||||
/** Draws one built-in model. Returns "no" for items that hang on a wall or lie flat, "yes" for those standing on the floor. */
|
||||
function drawBuiltIn(b: Builder, f: Furniture, w: number, d: number, h: number, base: number): Shadow {
|
||||
switch (f.type) {
|
||||
case "heating_manifold":
|
||||
case "buffer_tank":
|
||||
case "freshwater_station":
|
||||
hydronicModel(b, f, w, d, h);
|
||||
return "yes";
|
||||
case "sofa":
|
||||
if (f.variant === "l" || f.variant === "u") shapedSofa(b, w, d, h, f.variant);
|
||||
else sofa(b, w, d, h, Math.max(1, Math.round((w - 0.4) / 0.62)));
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
import type { Furniture } from "../../model.ts";
|
||||
import { circuitX, hasPump, hasValve, hydronicConfig } from "../../hydronic-model.ts";
|
||||
import { Builder } from "./builder.ts";
|
||||
import { EDGE_FAINT, EDGE_FURN, M, material } from "./palette.ts";
|
||||
|
||||
const hot = material(0x9d413e, 0xc86b56), cold = material(0x285f85, 0x4e99bd), brass = material(0x92724b, 0xc9a56a);
|
||||
export function hydronicModel(b: Builder, f: Furniture, w: number, d: number, h: number): void {
|
||||
const cfg = hydronicConfig(f), z = d * .3;
|
||||
const pipe = (x: number, y0: number, y1: number, r: number, m = hot) => b.cylinder(x, z, r, y0, y1, m, 10, EDGE_FAINT);
|
||||
const face = (x: number, y: number, r: number, m = M.dark) => b.lyingCylinder("z", x, z, y - r, y + r, d * .5, r * 2, m, 16, EDGE_FURN);
|
||||
if (f.type === "buffer_tank") {
|
||||
const r = Math.min(w, d) * .46;
|
||||
b.cylinder(0, 0, r, h * .06, h * .94, M.darkBody, 24, EDGE_FURN);
|
||||
b.cylinder(0, 0, r * .96, h * .94, h * .99, M.metal, 24, EDGE_FAINT);
|
||||
b.cylinder(0, 0, r * .98, h * .035, h * .06, M.metal, 24, EDGE_FAINT);
|
||||
for (const y of [.12, .88]) b.lyingCylinder("x", r * .95, 0, h * y - .025, h * y + .025, w * .14, .05, y > .5 ? hot : cold, 12, EDGE_FURN);
|
||||
for (const s of cfg.sensors ?? []) {
|
||||
const y = h * (.1 + .8 * s.level);
|
||||
b.lyingCylinder("z", 0, r, y - .018, y + .018, .035, .036, brass, 10, EDGE_FAINT);
|
||||
b.ring(0, y, .025, r + .022, 12, EDGE_FAINT);
|
||||
}
|
||||
for (const x of [-1, 1]) for (const zz of [-1, 1]) b.cylinder(x * r * .52, zz * r * .52, .025, 0, h * .05, M.metal);
|
||||
return;
|
||||
}
|
||||
b.block({ x: [-w * .49, w * .49], y: [h * .02, h * .98], z: [-d * .48, -d * .35] }, M.darkBody, EDGE_FURN);
|
||||
if (f.type === "heating_manifold") {
|
||||
for (const [y, m] of [[.83, hot], [.18, cold]] as const) b.lyingCylinder("x", 0, z, h * y - .027, h * y + .027, w * .92, .054, m, 12, EDGE_FURN);
|
||||
const circuits = cfg.circuits ?? [], column = w * .8 / Math.max(1, circuits.length);
|
||||
circuits.forEach((c, i) => {
|
||||
const x = w * circuitX(i, circuits.length), r = Math.min(column * .35, h * .075);
|
||||
pipe(x - column * .22, h * .18, h * .83, Math.min(.018, column * .09));
|
||||
pipe(x + column * .22, h * .18, h * .83, Math.min(.018, column * .09), cold);
|
||||
if (hasPump(c)) face(x, h * .6, r, M.dark);
|
||||
if (hasValve(c)) {
|
||||
b.block({ x: [x - r * .7, x + r * .7], y: [h * .38, h * .48], z: [0, d * .57] }, brass, EDGE_FAINT);
|
||||
face(x, h * .43, r * .65, M.white);
|
||||
}
|
||||
for (const [y, xx] of [[.76, x - column * .22], [.25, x + column * .22]]) face(xx, h * y, Math.min(r * .4, .025), M.white);
|
||||
});
|
||||
} else {
|
||||
b.block({ x: [-w * .24, w * .24], y: [h * .35, h * .84], z: [-d * .2, d * .12] }, brass, EDGE_FURN);
|
||||
for (let i = 0; i < 9; i++) b.seg(-w * .22 + i * w * .055, h * .38, d * .13, -w * .22 + i * w * .055, h * .81, d * .13, EDGE_FAINT);
|
||||
for (const [i, x] of [-.36, -.12, .12, .36].entries()) {
|
||||
pipe(w * x, 0, h * (i < 2 ? .9 : .35), .018, i === 1 ? cold : hot);
|
||||
face(w * x, h * .28, .028, M.white);
|
||||
}
|
||||
face(-w * .3, h * .55, Math.min(w, h) * .085, M.dark);
|
||||
face(w * .3, h * .55, Math.min(w, h) * .085, M.dark);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { test } from "node:test";
|
||||
import { Scene } from "three";
|
||||
import type { Furniture } from "../model.ts";
|
||||
import { newCircuit } from "../hydronic-model.ts";
|
||||
import { hydronicVisual } from "../hydronic-values.ts";
|
||||
import { entity, hassOf } from "../entities/fixtures.ts";
|
||||
import { HydronicLayer } from "./live-hydronics.ts";
|
||||
|
||||
test("live pumps animate reported operation, valve pointers follow visual inversion and floor/mount transforms stay attached", () => {
|
||||
let visible=true;
|
||||
const scene=new Scene(),layer=new HydronicLayer(scene,()=>({y:3,dy:0,visible}));
|
||||
const h=hassOf([entity("sensor.pump","on",{symcon_id:1,symcon_variable_type:0,symcon_value:true}),entity("sensor.valve","25",{symcon_id:2,symcon_variable_type:1,symcon_value:25,symcon_min:0,symcon_max:100})]);
|
||||
const item: Furniture={id:"test",type:"heating_manifold",x:2,z:4,w:1.5,d:.35,h:1.1,rotation:90,variant:null,hydronic:{circuits:[{...newCircuit("c"),pump:{feedback:"sensor.pump"},valve:{feedback:"sensor.valve",inverted:true}}]}};
|
||||
const spot=hydronicVisual(h,item,"f",.9); layer.set([spot]);
|
||||
assert.equal(layer.step(350),true);
|
||||
const group=layer.group.getObjectByName("hydronic-test")!,rotor=group.getObjectByName("hydronic-pump-0")!,valve=group.getObjectByName("hydronic-valve-0")!;
|
||||
assert.deepEqual(group.position.toArray(),[2,3.9,4]); assert.equal(rotor.rotation.z,1); assert.equal(valve.rotation.z,.75*Math.PI/2);
|
||||
visible=false; assert.equal(layer.step(700),false); assert.equal(group.visible,false);
|
||||
visible=true; layer.set([{...spot,animate:false}]); assert.equal(layer.step(1050),false); assert.equal(rotor.rotation.z,0);
|
||||
layer.set([]); assert.equal(layer.group.children.length,0); layer.dispose(); assert.equal(scene.children.length,0);
|
||||
});
|
||||
@@ -0,0 +1,82 @@
|
||||
import { BoxGeometry, Color, Group, Mesh, MeshBasicMaterial, SphereGeometry, type Scene } from "three";
|
||||
import { circuitX, hasPump, hasValve, hydronicConfig } from "../hydronic-model.ts";
|
||||
import type { HydronicVisual } from "../hydronic-values.ts";
|
||||
import type { FloorLift } from "./live-energy.ts";
|
||||
|
||||
interface Part { mesh: Mesh<BoxGeometry | SphereGeometry, MeshBasicMaterial>; kind: "pump" | "valve" | "temperature"; circuit?: number; probe?: number; temp?: number; circulation?: boolean }
|
||||
interface View { spot: HydronicVisual; group: Group; parts: Part[] }
|
||||
const heatColor = (value: number | null) => value === null ? new Color(0x69717c) : new Color().setHSL((1 - Math.max(0, Math.min(1, value / 85))) * .62, .8, .55);
|
||||
|
||||
/** Moving pump faces, valve pointers and actual probe colours, independent of the static furniture mesh. */
|
||||
export class HydronicLayer {
|
||||
readonly group = new Group();
|
||||
private views = new Map<string, View>();
|
||||
private readonly scene: Scene;
|
||||
private readonly lift: FloorLift;
|
||||
constructor(scene: Scene, lift: FloorLift) { this.scene = scene; this.lift = lift; this.group.name = "live-hydronics"; scene.add(this.group); }
|
||||
private remove(view: View) {
|
||||
view.group.traverse((o) => { if (o instanceof Mesh) { o.geometry.dispose(); (o.material as MeshBasicMaterial).dispose(); } });
|
||||
this.group.remove(view.group);
|
||||
}
|
||||
set(spots: HydronicVisual[]) {
|
||||
const keep = new Set(spots.map((s) => s.id));
|
||||
for (const [id, v] of this.views) if (!keep.has(id)) { this.remove(v); this.views.delete(id); }
|
||||
for (const spot of spots) {
|
||||
let view = this.views.get(spot.id);
|
||||
if (view?.spot.item !== spot.item) { if (view) this.remove(view); view = this.build(spot); this.views.set(spot.id, view); }
|
||||
view.spot = spot;
|
||||
}
|
||||
}
|
||||
private build(spot: HydronicVisual): View {
|
||||
const group = new Group(), parts: Part[] = [], f = spot.item, h = hydronicConfig(f);
|
||||
const add = (x: number, y: number, z: number, r: number, kind: Part["kind"], data: Partial<Part> = {}) => {
|
||||
const mesh = new Mesh(kind === "temperature" ? new SphereGeometry(r, 10, 6) : new BoxGeometry(r * 1.6, r * .3, .012), new MeshBasicMaterial({ color: 0x69717c, depthWrite: true }));
|
||||
mesh.name = `hydronic-${kind}-${data.circulation ? "circulation" : data.circuit ?? data.probe ?? data.temp ?? 0}`;
|
||||
mesh.position.set(x, y, z); group.add(mesh); parts.push({ mesh, kind, ...data });
|
||||
};
|
||||
if (f.type === "heating_manifold") {
|
||||
const circuits = h.circuits ?? [], column = f.w * .8 / Math.max(1, circuits.length), r = Math.min(column * .35, f.h * .075);
|
||||
circuits.forEach((c, i) => {
|
||||
const x = f.w * circuitX(i, circuits.length);
|
||||
if (hasPump(c)) { add(x, f.h * .6, f.d * .565, r * .8, "pump", { circuit: i }); add(x, f.h * .6, f.d * .57, r * .8, "pump", { circuit: i }); parts.at(-1)!.mesh.userData.angle = Math.PI / 2; }
|
||||
if (hasValve(c)) add(x, f.h * .43, f.d * .58, r * .65, "valve", { circuit: i });
|
||||
add(x - column * .22, f.h * .76, f.d * .57, Math.min(r * .32, .018), "temperature", { circuit: i, temp: 0 });
|
||||
add(x + column * .22, f.h * .25, f.d * .57, Math.min(r * .32, .018), "temperature", { circuit: i, temp: 1 });
|
||||
});
|
||||
} else if (f.type === "buffer_tank") {
|
||||
(h.sensors ?? []).forEach((s, i) => add(0, f.h * (.1 + .8 * s.level), Math.min(f.w, f.d) * .46 + .025, .021, "temperature", { probe: i }));
|
||||
} else {
|
||||
for (const [i, x] of [-.36, -.12, .12, .36].entries()) add(x * f.w, f.h * .28, f.d * .57, .02, "temperature", { temp: i });
|
||||
for (const [i, x] of [-.3, .3].entries()) {
|
||||
for (const angle of [0, Math.PI / 2]) { add(x * f.w, f.h * .55, f.d * .57, Math.min(f.w, f.h) * .065, "pump", { circulation: i === 1 }); parts.at(-1)!.mesh.userData.angle = angle; }
|
||||
}
|
||||
}
|
||||
group.rotation.set((f.tilt_x ?? 0) * Math.PI / 180, -f.rotation * Math.PI / 180, (f.tilt_z ?? 0) * Math.PI / 180, "YZX");
|
||||
group.scale.x = f.mirror ? -1 : 1;
|
||||
group.name = `hydronic-${f.id}`; this.group.add(group); return { spot, group, parts };
|
||||
}
|
||||
step(now: number): boolean {
|
||||
let moving = false;
|
||||
for (const v of this.views.values()) {
|
||||
const { spot } = v, l = this.lift(spot.floorId);
|
||||
v.group.visible = l.visible; v.group.position.set(spot.item.x, l.y + spot.base, spot.item.z);
|
||||
for (const p of v.parts) {
|
||||
const c = p.circuit === undefined ? undefined : spot.circuits[p.circuit];
|
||||
if (p.kind === "temperature") {
|
||||
const value = p.probe !== undefined ? spot.probes[p.probe]?.value : c ? p.temp === 0 ? c.flow : c.return : spot.temperatures[p.temp ?? 0];
|
||||
p.mesh.material.color.copy(heatColor(value ?? null));
|
||||
} else if (p.kind === "pump") {
|
||||
const running = c ? c.pump : p.circulation ? spot.circulation : spot.pump;
|
||||
p.mesh.material.color.set(running === null ? 0x89909a : running ? c?.cooling ? 0x50b8ff : 0x6fe1a2 : 0x465361);
|
||||
p.mesh.rotation.z = Number(p.mesh.userData.angle ?? 0) + (running && spot.animate !== false ? now / 350 : 0);
|
||||
moving ||= l.visible && running === true && spot.animate !== false;
|
||||
} else {
|
||||
p.mesh.rotation.z = c?.valve === null || c?.valve === undefined ? 0 : c.valve / 100 * Math.PI / 2;
|
||||
p.mesh.material.color.set(c?.valve === null ? 0x89909a : c?.cooling ? 0x50b8ff : 0xf6b35b);
|
||||
}
|
||||
}
|
||||
}
|
||||
return moving;
|
||||
}
|
||||
dispose() { for (const v of this.views.values()) this.remove(v); this.views.clear(); this.scene.remove(this.group); }
|
||||
}
|
||||
@@ -84,6 +84,8 @@ import { WeatherLayer, type SkyView } from "./live-weather.ts";
|
||||
import { EnergyLayer, type EnergyArc, type PlanPoint, type SparkField } from "./live-energy.ts";
|
||||
import { SoundLayer, type SoundSpot } from "./live-sound.ts";
|
||||
import { WaterLayer, type SpraySpot } from "./live-water.ts";
|
||||
import { HydronicLayer } from "./live-hydronics.ts";
|
||||
import type { HydronicVisual } from "../hydronic-values.ts";
|
||||
import { ScreenLayer, type LiveScreen } from "./live-screens.ts";
|
||||
import { PictureLayer, type LivePicture } from "./live-pictures.ts";
|
||||
import { addMeshLighting, applyEnvironment, disposeMeshInstance, instantiateMesh, loadMesh } from "./meshes.ts";
|
||||
@@ -585,6 +587,7 @@ export class NextFloorViewer {
|
||||
/** Sound rings around playing speakers and multiroom threads (live-sound.ts). */
|
||||
private readonly soundLayer: SoundLayer;
|
||||
private readonly waterLayer: WaterLayer;
|
||||
private readonly hydronicLayer: HydronicLayer;
|
||||
/** How opaque the glass walls are, shared by every floor's materials (0.2: faint glass). */
|
||||
private readonly glassAlpha = { value: 0.2 };
|
||||
/** Pictures on TVs that play, with an ambilight behind (live-screens.ts). */
|
||||
@@ -624,6 +627,7 @@ export class NextFloorViewer {
|
||||
this.energyLayer = new EnergyLayer(this.scene, this.liftOf);
|
||||
this.soundLayer = new SoundLayer(this.scene, this.liftOf);
|
||||
this.waterLayer = new WaterLayer(this.scene, this.liftOf);
|
||||
this.hydronicLayer = new HydronicLayer(this.scene, this.liftOf);
|
||||
this.screenLayer = new ScreenLayer(this.scene, this.liftOf);
|
||||
this.screenLayer.onChange = () => this.invalidate();
|
||||
this.pictureLayer = new PictureLayer(this.scene, this.liftOf);
|
||||
@@ -1229,6 +1233,8 @@ export class NextFloorViewer {
|
||||
this.invalidate();
|
||||
}
|
||||
|
||||
setHydronics(spots: HydronicVisual[]): void { this.hydronicLayer.set(spots); this.invalidate(); }
|
||||
|
||||
/** TVs and monitors that play: their picture and the ambilight behind them. */
|
||||
setLiveScreens(list: LiveScreenInput[]): void {
|
||||
const out: LiveScreen[] = [];
|
||||
@@ -1484,6 +1490,7 @@ export class NextFloorViewer {
|
||||
this.energyLayer.dispose();
|
||||
this.soundLayer.dispose();
|
||||
this.waterLayer.dispose();
|
||||
this.hydronicLayer.dispose();
|
||||
this.screenLayer.dispose();
|
||||
this.pictureLayer.dispose();
|
||||
this.resizeObserver.disconnect();
|
||||
@@ -3307,7 +3314,7 @@ export class NextFloorViewer {
|
||||
const robotsMoving = this.stepRobots(now);
|
||||
// NextFloor's layers: each one steps every frame (no short-circuit), any of them moving keeps the frames coming
|
||||
this.pictureLayer.step();
|
||||
const liveMoving = [this.weatherLayer, this.energyLayer, this.soundLayer, this.screenLayer, this.waterLayer].map((l) => l.step(now));
|
||||
const liveMoving = [this.weatherLayer, this.energyLayer, this.soundLayer, this.screenLayer, this.waterLayer, this.hydronicLayer].map((l) => l.step(now));
|
||||
const weatherMoving = liveMoving.some(Boolean);
|
||||
const moving = cameraMoving || floorsMoving || openingsMoving || flashing || roofMoving;
|
||||
const busy: string[] = [];
|
||||
|
||||
@@ -0,0 +1,190 @@
|
||||
// Real designer object-tree bindings, lazy hydraulic cards, native commands and live 3D feedback.
|
||||
import assert from "node:assert/strict";
|
||||
import { createServer } from "node:http";
|
||||
import { existsSync, mkdirSync, readFileSync } from "node:fs";
|
||||
import { extname, join, relative, resolve } from "node:path";
|
||||
import { build } from "esbuild";
|
||||
import puppeteer from "puppeteer-core";
|
||||
|
||||
const root = resolve(import.meta.dirname, "..");
|
||||
const server = createServer((req, res) => {
|
||||
const file = resolve(root, `.${decodeURIComponent(new URL(req.url, "http://localhost").pathname)}`);
|
||||
if (relative(root, file).startsWith("..") || !existsSync(file)) return res.writeHead(404).end();
|
||||
res.writeHead(200, { "content-type": ({ ".html": "text/html", ".js": "text/javascript", ".json": "application/json" })[extname(file)] ?? "application/octet-stream" }).end(readFileSync(file));
|
||||
});
|
||||
await new Promise((done) => server.listen(0, "127.0.0.1", done));
|
||||
let browser;
|
||||
try {
|
||||
const executablePath = [process.env.CHROME_PATH, "C:/Program Files/Google/Chrome/Application/chrome.exe", "C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"].find((p) => p && existsSync(p));
|
||||
browser = await puppeteer.launch({ executablePath, headless: true, args: ["--use-angle=swiftshader", "--enable-unsafe-swiftshader"] });
|
||||
const page = await browser.newPage(), errors = [], requests = [];
|
||||
page.on("pageerror", (e) => errors.push(String(e)));
|
||||
page.on("request", (r) => requests.push(r.url()));
|
||||
await page.setViewport({ width: 1440, height: 1000 });
|
||||
await page.evaluateOnNewDocument(() => { localStorage.setItem("nextfloor.cards", "1"); });
|
||||
await page.goto(`http://127.0.0.1:${server.address().port}/preview/index.html?noshowcase`, { waitUntil: "networkidle0" });
|
||||
await page.waitForFunction(() => window.nfPanel?.data.building?.floors.length);
|
||||
assert.ok(!requests.some((r) => r.includes("nextfloor-hydronics.js")), "hydraulics stay lazy in ordinary plans");
|
||||
const adapter = await build({ stdin: { contents: 'export { newFurniture } from "./components/editor/ops/items.ts";', resolveDir: join(root, "frontend/src") }, bundle: true, write: false, format: "iife", globalName: "HydronicFixture", logLevel: "silent" });
|
||||
await page.addScriptTag({ content: adapter.outputFiles[0].text });
|
||||
await page.evaluate(async () => {
|
||||
const p = window.nfPanel, b = structuredClone(p.data.building), f = b.floors[0];
|
||||
b.floors = [f]; f.rooms = [{ ...f.rooms[0], id:"plant-room",name:"Heizzentrale",area_id:null,climate:null,climate_card:false,points:[[-4,-3],[4,-3],[4,3],[-4,3]] }];
|
||||
Object.assign(f, { openings:[],furniture:[],placements:[],outdoor:[],walls:[],background:null,power_entity:null,utility_meters:null,start_view:null });
|
||||
b.settings.roof.type="none"; b.settings.start_view=null; for(const k of Object.keys(b.energy)) b.energy[k]=null;
|
||||
const states={},objects=[{object_id:100,parent_id:0,name:"Heizung",path:"Heizung",object_type:0,hidden:true,position:0,icon:""}];
|
||||
const variable=(id,name,value,domain="sensor",extra={})=>{
|
||||
const entity_id=`${domain}.${id}`;
|
||||
states[entity_id]={entity_id,state:"on",attributes:{friendly_name:name,symcon_id:id,symcon_variable_type:typeof value==="boolean"?0:2,symcon_value:value,symcon_min:0,symcon_max:100,symcon_has_action:false,symcon_path:`Heizung / ${name}`,...extra}};
|
||||
objects.push({object_id:id,parent_id:100,name,path:`Heizung / ${name}`,object_type:2,entity_id,hidden:false,position:id,icon:""});
|
||||
};
|
||||
variable(601,"Garagenwert Pumpenbefehl",false,"cover",{symcon_has_action:true}); variable(602,"Rückmeldung Vorschub",true,"lock");
|
||||
variable(603,"Ventil Soll",128,"light",{symcon_variable_type:1,symcon_max:255,symcon_step:1,symcon_has_action:true}); variable(604,"Ventil Ist",32,"climate",{unit_of_measurement:"%",symcon_formatted:"32 %"});
|
||||
variable(605,"Vorlauf beliebiger Name",42.3,"cover",{unit_of_measurement:"°C",symcon_archive:{id:999,counter:false}}); variable(606,"Rücklauf",34.1,"light",{unit_of_measurement:"°C"});
|
||||
for(let i=0;i<8;i++) variable(701+i,`Speicherfühler ${i+1}`,60-i*5,i%2?"climate":"cover",{unit_of_measurement:"°C"});
|
||||
for(const [id,name,value] of [[801,"Frischwasser Vorlauf",70],[802,"Frischwasser Rücklauf",35],[803,"Zirkulationstemperatur",45],[804,"Trinkwarmwasser",52]]) variable(id,name,value,"sensor",{unit_of_measurement:"°C"});
|
||||
variable(805,"Zirkulationsbefehl",false,"switch",{symcon_has_action:true}); variable(806,"Zirkulationsrückmeldung",true,"cover");
|
||||
variable(807,"Nur Anzeige",25,"sensor",{symcon_variable_type:1});
|
||||
for(const [id,type,x] of [["manifold","heating_manifold",-2.2],["buffer","buffer_tank",0],["fresh","freshwater_station",2]]) {
|
||||
const item=window.HydronicFixture.newFurniture(type,b,f,[x,0]); item.id=id; item.name=({manifold:"Verteiler",buffer:"Puffer",fresh:"Frischwasser"})[id]; if(id!=="buffer") item.mount_y=.7; f.furniture.push(item);
|
||||
}
|
||||
window.nativeCalls=[]; p.data.edit(b);
|
||||
p.hass={...p.hass,language:"de",states,symconObjects:objects,callService:async(domain,service,data)=>{window.nativeCalls.push({domain,service,data}); if(window.failHydronicAction) throw new Error("Testaktion fehlgeschlagen");}};
|
||||
await p.updateComplete; [...p.shadowRoot.querySelectorAll("[role=tab]")].find((b)=>b.textContent.includes("Editor")).click();
|
||||
});
|
||||
await page.waitForFunction(()=>window.nfPanel.shadowRoot.querySelector("nf-editor")?.shadowRoot);
|
||||
await page.evaluate(async()=>{
|
||||
const e=window.nfPanel.shadowRoot.querySelector("nf-editor"); window.hydEditor=e; e._floorId=e._doc.floors[0].id; e.selectItem("furniture","manifold"); await e.updateComplete;
|
||||
e._tool="furniture";await e.updateComplete;
|
||||
for(const label of["Heiz-/Kühlkreisverteiler","Pufferspeicher","Frischwasserstation"]){
|
||||
const search=e.shadowRoot.querySelector('input.nf-search');if(!search)throw new Error('Furniture library search missing');
|
||||
search.value=label;search.dispatchEvent(new Event('input',{bubbles:true}));await e.updateComplete;
|
||||
if(![...e.shadowRoot.querySelectorAll('.nf-card-main')].some((b)=>b.textContent.includes(label)))throw new Error(`New asset is missing from the library: ${label}`);
|
||||
}
|
||||
e._tool="select";await e.updateComplete;
|
||||
const kinds=[...e.shadowRoot.querySelectorAll("select option")].map((o)=>o.value);
|
||||
for(const type of ["heating_manifold","buffer_tank","freshwater_station"]) if(!kinds.includes(type)) throw new Error(`Missing furniture kind ${type}`);
|
||||
window.editorSettle=async()=>{await e.updateComplete;await window.nfPanel.updateComplete;await e.updateComplete;};
|
||||
window.pickHydronic=async(container,label,id,search)=>{
|
||||
const field=[...container.querySelectorAll("label.nf-field")].find((l)=>l.textContent.trim().startsWith(label));
|
||||
if(!field) throw new Error(`Missing field ${label}`);
|
||||
const picker=field.querySelector("nf-entity-picker");await picker.updateComplete;
|
||||
const native=picker.shadowRoot.querySelector("nf-symcon-object-picker");await native.updateComplete;native.shadowRoot.querySelector(".trigger").click();await native.updateComplete;
|
||||
const input=native.shadowRoot.querySelector(".search");input.value=search;input.dispatchEvent(new Event("input",{bubbles:true}));await native.updateComplete;
|
||||
const row=native.shadowRoot.querySelector(`#object-${id}`);if(!row?.classList.contains("selectable"))throw new Error(`${search} was incorrectly excluded`);
|
||||
row.click();await native.updateComplete;native.shadowRoot.querySelector(".apply").click();await window.editorSettle();
|
||||
};
|
||||
const circuit=()=>e.shadowRoot.querySelector('.nf-hydronic-circuit[data-circuit="c1"]');
|
||||
const pumpToggle=[...circuit().querySelectorAll("label.nf-check")].find((l)=>l.textContent.includes("Pumpe vorhanden"));pumpToggle.querySelector("input").click();await window.editorSettle();
|
||||
const valve=()=>circuit().querySelector(".nf-hydronic-control");valve().open=true;
|
||||
await window.pickHydronic(valve(),"Rückmeldung",604,"Ventil Ist");await window.pickHydronic(valve(),"Befehl",603,"Ventil Soll");
|
||||
[...valve().querySelectorAll("label.nf-check")].find((l)=>l.textContent.includes("3D umkehren")).querySelector("input").click();await window.editorSettle();
|
||||
await window.pickHydronic(circuit(),"Vorlauf",605,"Vorlauf beliebiger Name");await window.pickHydronic(circuit(),"Rücklauf",606,"Rücklauf");
|
||||
e.shadowRoot.querySelector(".nf-hydronic-add").click();await window.editorSettle();
|
||||
const second=e.shadowRoot.querySelectorAll(".nf-hydronic-circuit")[1];second.open=true;window.feedCircuit=second.dataset.circuit;
|
||||
const select=second.querySelector("select");select.value="pump";select.dispatchEvent(new Event("change",{bubbles:true}));await window.editorSettle();
|
||||
const feed=()=>e.shadowRoot.querySelector(`[data-circuit="${window.feedCircuit}"]`);
|
||||
if([...feed().querySelectorAll("summary")].some((s)=>s.textContent==="Ventil"))throw new Error("A feed pump must not offer a valve");
|
||||
feed().querySelector(".nf-hydronic-control").open=true;
|
||||
await window.pickHydronic(feed(),"Rückmeldung",602,"Rückmeldung Vorschub");await window.pickHydronic(feed(),"Befehl",601,"Garagenwert Pumpenbefehl");
|
||||
e.shadowRoot.querySelector(".nf-hydronic-add").click();await window.editorSettle();
|
||||
const third=e.shadowRoot.querySelectorAll(".nf-hydronic-circuit")[2];window.coolCircuit=third.dataset.circuit;third.open=true;
|
||||
const mode=third.querySelector("select");mode.value="cooling";mode.dispatchEvent(new Event("change",{bubbles:true}));await window.editorSettle();
|
||||
const cool=()=>e.shadowRoot.querySelector(`[data-circuit="${window.coolCircuit}"]`);
|
||||
[...cool().querySelectorAll("label.nf-check")].find((l)=>l.textContent.includes("Pumpe vorhanden")).querySelector("input").click();await window.editorSettle();
|
||||
cool().querySelector(".nf-hydronic-control").open=true;await window.pickHydronic(cool(),"Befehl",807,"Nur Anzeige");
|
||||
});
|
||||
const out=join(root,"preview/screenshots");mkdirSync(out,{recursive:true});
|
||||
await page.evaluate(()=>window.hydEditor.shadowRoot.querySelector(".nf-hydronic-form").scrollIntoView({block:"start"}));
|
||||
await page.screenshot({path:join(out,"symcon-hydronic-editor.png")});
|
||||
await page.evaluate(async()=>{
|
||||
const e=window.hydEditor;e.selectItem("furniture","buffer");await window.editorSettle();
|
||||
if(e.shadowRoot.querySelectorAll(".nf-hydronic-probe").length!==7)throw new Error("Buffer must start with seven probe placeholders");
|
||||
for(let i=0;i<6;i++){
|
||||
const probe=e.shadowRoot.querySelector(`[data-probe="s${i+1}"]`);probe.open=true;
|
||||
await window.pickHydronic(probe,"Temperatur",701+i,`Speicherfühler ${i+1}`);
|
||||
}
|
||||
e.shadowRoot.querySelector(".nf-hydronic-add-probe").click();await window.editorSettle();
|
||||
const probe=e.shadowRoot.querySelectorAll(".nf-hydronic-probe")[3];
|
||||
window.extraProbe=e._doc.floors[0].furniture.find((f)=>f.id==="buffer").hydronic.sensors.at(-1).id;
|
||||
const extra=e.shadowRoot.querySelector(`[data-probe="${window.extraProbe}"]`);extra.open=true;
|
||||
await window.pickHydronic(extra,"Temperatur",708,"Speicherfühler 8");
|
||||
const height=[...extra.querySelectorAll("label.nf-field")].find((l)=>l.textContent.includes("Höhe (%)")).querySelector("input");height.value="73";height.dispatchEvent(new Event("change",{bubbles:true}));await window.editorSettle();
|
||||
await window.pickHydronic(e.shadowRoot.querySelector(".nf-hydronic-form"),"Vorlauf",801,"Frischwasser Vorlauf");await window.pickHydronic(e.shadowRoot.querySelector(".nf-hydronic-form"),"Rücklauf",802,"Frischwasser Rücklauf");
|
||||
e.selectItem("furniture","fresh");await window.editorSettle();
|
||||
for(const [label,id,search]of[["Vorlauf",801,"Frischwasser Vorlauf"],["Rücklauf",802,"Frischwasser Rücklauf"],["Zirkulationstemperatur",803,"Zirkulationstemperatur"],["Trinkwarmwasser",804,"Trinkwarmwasser"]])await window.pickHydronic(e.shadowRoot.querySelector(".nf-hydronic-form"),label,id,search);
|
||||
const circulation=[...e.shadowRoot.querySelectorAll(".nf-hydronic-control")].find((d)=>d.querySelector("summary").textContent==="Zirkulationspumpe");circulation.open=true;
|
||||
await window.pickHydronic(circulation,"Rückmeldung",806,"Zirkulationsrückmeldung");await window.pickHydronic(circulation,"Befehl",805,"Zirkulationsbefehl");
|
||||
[...window.nfPanel.shadowRoot.querySelectorAll("[role=tab]")].find((b)=>b.textContent.trim()==="3D").click();
|
||||
});
|
||||
await page.waitForFunction(()=>window.nfPanel.shadowRoot.querySelector("nf-view3d")?.shadowRoot.querySelectorAll("nf-hydronic-card").length===3);
|
||||
await page.evaluate(()=>window.hydView=window.nfPanel.shadowRoot.querySelector("nf-view3d"));
|
||||
await page.waitForFunction(()=>[...window.hydView.shadowRoot.querySelectorAll("nf-hydronic-card")].every((c)=>c.shadowRoot?.querySelector(".title")));
|
||||
assert.ok(requests.some((r)=>/nextfloor-hydronics\.js\?v=[a-f0-9]{12}/.test(r)),"the lazy chunk has a content hash");
|
||||
assert.equal(await page.evaluate(()=>window.nfPanel.data.building.floors[0].furniture.find((f)=>f.id==="buffer").hydronic.sensors.length),8);
|
||||
await page.waitForFunction(()=>window.hydView.viewer?.hydronicLayer.group.children.length===3);
|
||||
assert.ok(await page.evaluate(()=>{
|
||||
const g=window.hydView.viewer.hydronicLayer.group.getObjectByName("hydronic-manifold");
|
||||
return !!g.getObjectByName("hydronic-pump-1")&&!g.getObjectByName("hydronic-pump-0")&&!g.getObjectByName("hydronic-valve-1")&&!!g.getObjectByName("hydronic-valve-0");
|
||||
}),"a shared feed pump and separate valve-only circuits have the correct 3D parts");
|
||||
await page.evaluate(()=>window.hydView.resetView());
|
||||
await page.evaluate(()=>new Promise((done)=>setTimeout(done,850)));
|
||||
const boxes=await page.evaluate(()=>[...window.hydView.shadowRoot.querySelectorAll('.live-card-hydronic')].map((c)=>({name:c.dataset.furniture,box:c.getBoundingClientRect().toJSON(),bounds:c.parentElement.getBoundingClientRect().toJSON()})));
|
||||
assert.ok(boxes.every(({box,bounds})=>box.top>=bounds.top&&box.bottom<=bounds.bottom&&box.left>=bounds.left&&box.right<=bounds.right),JSON.stringify(boxes));
|
||||
for(let i=0;i<boxes.length;i++)for(let j=i+1;j<boxes.length;j++){const a=boxes[i].box,b=boxes[j].box;assert.ok(a.right<=b.left||a.left>=b.right||a.bottom<=b.top||a.top>=b.bottom,'Hydraulic cards must not cover each other');}
|
||||
await page.screenshot({path:join(out,"symcon-hydronic-3d.png")});
|
||||
const openAsset=async(id)=>{
|
||||
await page.evaluate((id)=>window.hydView.onDeviceTap(`hydronic:${id}`),id);
|
||||
await page.waitForFunction(()=>document.querySelector("nf-hydronic-dialog")?.shadowRoot.querySelector("dialog")?.open);
|
||||
};
|
||||
const closeDialog=async()=>{await page.evaluate(()=>document.querySelector("nf-hydronic-dialog").shadowRoot.querySelector('button[aria-label="Schließen"]').click());await page.waitForFunction(()=>!document.querySelector("nf-hydronic-dialog"));};
|
||||
await openAsset("manifold");
|
||||
assert.match(await page.evaluate(()=>document.querySelector("nf-hydronic-dialog").shadowRoot.textContent),/32 %/);
|
||||
await page.evaluate(()=>{
|
||||
const root=document.querySelector("nf-hydronic-dialog").shadowRoot;
|
||||
root.querySelector('[data-command="cover.601"]').click();
|
||||
const slider=root.querySelector('[data-command="light.603"]');slider.value="0";slider.dispatchEvent(new Event("change",{bubbles:true}));
|
||||
});
|
||||
await page.waitForFunction(()=>window.nativeCalls.length===2);
|
||||
assert.deepEqual(await page.evaluate(()=>window.nativeCalls),[{domain:"symcon",service:"set_value",data:{entity_id:"cover.601",value:true}},{domain:"symcon",service:"set_value",data:{entity_id:"light.603",value:0}}],"native Boolean and integer zero commands stay unchanged by visual reversal");
|
||||
assert.equal(await page.evaluate(()=>document.querySelector("nf-hydronic-dialog").shadowRoot.querySelector('[data-command="sensor.807"]').disabled),true,"read-only variables remain read-only");
|
||||
await page.screenshot({path:join(out,"symcon-hydronic-controls.png")});
|
||||
await page.evaluate(async()=>{
|
||||
const p=window.nfPanel,states={...p.hass.states};states["climate.604"]={...states["climate.604"],attributes:{...states["climate.604"].attributes,symcon_value:0,symcon_formatted:"0 %"}};states["lock.602"]={...states["lock.602"],state:"unavailable"};p.hass={...p.hass,states};await p.updateComplete;
|
||||
});
|
||||
await page.waitForFunction(()=>document.querySelector("nf-hydronic-dialog").shadowRoot.querySelector('[data-source="climate.604"]').textContent.includes("0 %"));
|
||||
await page.waitForFunction(()=>Math.abs(window.hydView.viewer.hydronicLayer.group.getObjectByName("hydronic-manifold").getObjectByName("hydronic-valve-0").rotation.z-Math.PI/2)<.001);
|
||||
assert.match(await page.evaluate(()=>document.querySelector("nf-hydronic-dialog").shadowRoot.querySelector('[data-source="lock.602"]').textContent),/–/);
|
||||
assert.equal(await page.evaluate(()=>window.nativeCalls.some((c)=>["lock.602","climate.604"].includes(c.data.entity_id))),false,"feedback is never written");
|
||||
await closeDialog();await openAsset("buffer");
|
||||
assert.deepEqual(await page.evaluate(()=>[...document.querySelector("nf-hydronic-dialog").shadowRoot.querySelectorAll('.reading[data-source]')].slice(0,7).map((r)=>r.dataset.source)),["cover.701","climate.702","climate.708","cover.703","climate.704","cover.705","climate.706"],"probe rows follow physical height; an unlinked placeholder is hidden");
|
||||
assert.match(await page.evaluate(()=>document.querySelector("nf-hydronic-dialog").shadowRoot.textContent),/35 K/);
|
||||
await page.setViewport({width:390,height:844});await page.screenshot({path:join(out,"symcon-buffer-mobile.png")});
|
||||
assert.ok(await page.evaluate(()=>{const r=document.querySelector("nf-hydronic-dialog").shadowRoot.querySelector("dialog").getBoundingClientRect();return r.left>=0&&r.right<=innerWidth&&r.top>=0&&r.bottom<=innerHeight;}),"buffer dialog fits mobile");
|
||||
await closeDialog();await openAsset("fresh");
|
||||
const text=await page.evaluate(()=>document.querySelector("nf-hydronic-dialog").shadowRoot.textContent);
|
||||
for(const label of["Vorlauf","Rücklauf","Zirkulation","Trinkwarmwasser","52 °C"])assert.ok(text.includes(label),label);
|
||||
await page.evaluate(()=>document.querySelector("nf-hydronic-dialog").shadowRoot.querySelector('[data-command="switch.805"]').click());
|
||||
await page.waitForFunction(()=>window.nativeCalls.length===3);
|
||||
assert.equal(await page.evaluate(()=>window.nativeCalls.at(-1).data.entity_id),"switch.805");
|
||||
await page.screenshot({path:join(out,"symcon-freshwater-mobile.png")});
|
||||
await page.evaluate(()=>{window.failHydronicAction=true;document.querySelector("nf-hydronic-dialog").shadowRoot.querySelector('[data-command="switch.805"]').click();});
|
||||
await page.waitForFunction(()=>document.querySelector("nf-hydronic-dialog").shadowRoot.querySelector('[role=alert]')?.textContent.includes("Testaktion fehlgeschlagen"));
|
||||
await page.evaluate(()=>{window.failHydronicAction=false;document.querySelector("nf-hydronic-dialog").shadowRoot.querySelector('[data-command="switch.805"]').click();});
|
||||
await page.waitForFunction(()=>!document.querySelector("nf-hydronic-dialog").shadowRoot.querySelector('[role=alert]'));
|
||||
await closeDialog();
|
||||
const beforeHistory=await page.evaluate(()=>window.nativeCalls.length);
|
||||
await page.evaluate(()=>window.hydView.hydronicModule.openHydronic(window.nfPanel.hass,window.nfPanel.data.building.floors[0].furniture.find((f)=>f.id==="manifold"),true));
|
||||
await page.waitForFunction(()=>document.querySelector("nf-hydronic-dialog")?.shadowRoot.querySelector("dialog")?.open);
|
||||
assert.ok(await page.evaluate(()=>[...document.querySelector("nf-hydronic-dialog").shadowRoot.querySelectorAll('[data-command]')].every((c)=>c.disabled)),"historical controls are read-only");
|
||||
assert.equal(await page.evaluate(()=>window.nativeCalls.length),beforeHistory);await closeDialog();
|
||||
await page.evaluate(()=>window.hydView.shadowRoot.querySelector('.nf-card-toggle').click());
|
||||
await page.waitForFunction(()=>!window.hydView.shadowRoot.querySelector('nf-hydronic-card'));
|
||||
assert.equal(await page.evaluate(()=>window.hydView.viewer.hydronicLayer.group.children.length),3,"hiding floating cards keeps the live equipment in 3D");
|
||||
await openAsset("buffer");
|
||||
await page.evaluate(async()=>{const p=window.nfPanel,b=structuredClone(p.data.building);b.floors[0].furniture=b.floors[0].furniture.filter((f)=>f.id!=="buffer");p.data.edit(b);await p.updateComplete;});
|
||||
await page.waitForFunction(()=>!document.querySelector('nf-hydronic-dialog')&&window.hydView.viewer.hydronicLayer.group.children.length===2);
|
||||
assert.equal(await page.evaluate(()=>window.hydView.watched.includes('cover.701')),false,"deleted equipment releases its dialog, live geometry and subscriptions");
|
||||
assert.deepEqual(errors,[]);
|
||||
console.log("OK: real object-tree selection; configurable manifold/pump-only circuits; 7+ movable buffer probes; freshwater temperatures/circulation; lazy cards, live geometry, feedback-only visuals, raw native commands, read-only guards and mobile dialogs");
|
||||
} finally {await browser?.close();await new Promise((done)=>server.close(done));}
|
||||
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 */
|
||||
var w={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 Bn=globalThis,Vn=Bn.ShadowRoot&&(Bn.ShadyCSS===void 0||Bn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,li=Symbol(),ns=new WeakMap,Xt=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==li)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(Vn&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=ns.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&ns.set(t,e))}return e}toString(){return this.cssText}},rs=r=>new Xt(typeof r=="string"?r:r+"",void 0,li),J=(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 Xt(t,r,li)},is=(r,e)=>{if(Vn)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),i=Bn.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},ci=Vn?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return rs(t)})(r):r;var{is:Ju,defineProperty:Qu,getOwnPropertyDescriptor:Xu,getOwnPropertyNames:ed,getOwnPropertySymbols:td,getPrototypeOf:nd}=Object,Kn=globalThis,os=Kn.trustedTypes,rd=os?os.emptyScript:"",id=Kn.reactiveElementPolyfillSupport,en=(r,e)=>r,ui={toAttribute(r,e){switch(e){case Boolean:r=r?rd: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}},as=(r,e)=>!Ju(r,e),ss={attribute:!0,type:String,converter:ui,reflect:!1,useDefault:!1,hasChanged:as};Symbol.metadata??=Symbol("metadata"),Kn.litPropertyMetadata??=new WeakMap;var Pe=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=ss){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&&Qu(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){let{get:i,set:o}=Xu(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)??ss}static _$Ei(){if(this.hasOwnProperty(en("elementProperties")))return;let e=nd(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(en("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(en("properties"))){let t=this.properties,n=[...ed(t),...td(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(ci(i))}else e!==void 0&&t.push(ci(e));return t}static _$Eu(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadLine truncated
|
||||
\f\r]`,tn=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,us=/-->/g,ds=/>/g,at=RegExp(`>|${di}(?:([^\\s"'>=/]+)(${di}*=${di}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),hs=/'/g,ms=/"/g,_s=/^(?:script|style|textarea|title)$/i,vi=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),p=vi(1),ne=vi(2),jf=vi(3),ut=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),ps=new WeakMap,lt=ct.createTreeWalker(ct,129);function bs(r,e){if(!bi(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return cs!==void 0?cs.createHTML(e):e}var ad=(r,e)=>{let t=r.length-1,n=[],i,o=e===2?"<svg>":e===3?"<math>":"",s=tn;for(let a=0;a<t;a++){let l=r[a],c,u,d=-1,m=0;for(;m<l.length&&(s.lastIndex=m,u=s.exec(l),u!==null);)m=s.lastIndex,s===tn?u[1]==="!--"?s=us:u[1]!==void 0?s=ds:u[2]!==void 0?(_s.test(u[2])&&(i=RegExp("</"+u[2],"g")),s=at):u[3]!==void 0&&(s=at):s===at?u[0]===">"?(s=i??tn,d=-1):u[1]===void 0?d=-2:(d=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?at:u[3]==='"'?ms:hs):s===ms||s===hs?s=at:s===us||s===ds?s=tn:(s=at,i=void 0);let h=s===at&&r[a+1].startsWith("/>")?" ":"";o+=s===tn?l+od:d>=0?(n.push(c),l.slice(0,d)+fs+l.slice(d)+Je+h):l+Je+(d===-2?a:h)}return[bs(r,o+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},on=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]=ad(e,t);if(this.el=r.createElement(c,n),lt.currentNode=this.el.content,t===2||t===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(i=lt.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let d of i.getAttributeNames())if(d.endsWith(fs)){let m=u[s++],h=i.getAttribute(d).split(Je),g=/([.?@])?(.*)/.exec(m);l.push({type:1,index:o,name:g[2],strings:h,ctor:g[1]==="."?mi:g[1]==="?"?pi:g[1]==="@"?fi:St}),i.removeAttribute(d)}else d.startsWith(Je)&&(l.push({type:6,index:o}),i.removeAttribute(d));if(_s.test(i.tagName)){let d=i.textContent.split(Je),m=d.length-1;if(m>0){i.textContent=Gn?Gn.emptyScript:"";for(let h=0;h<m;h++)i.append(d[h],nn()),lt.nextNode(),l.push({type:2,index:++o});i.append(d[m],nn())}}}else if(i.nodeType===8)if(i.data===gs)l.push({type:2,index:o});else{let d=-1;for(;(d=i.data.indexOf(Je,d+1))!==-1;)l.push({type:7,index:o}),d+=Je.length-1}o++}}static createElement(e,t){let n=ct.createElement("template");return n.innerHTML=e,n}};function kt(r,e,t=r,n){if(e===ut)return e;let i=n!==void 0?t._$Co?.[n]:t._$Cl,o=rn(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=kt(r,i._$AS(r,e.values),i,n)),e}var hi=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,i=(e?.creationScope??ct).importNode(t,!0);lt.currentNode=i;let o=lt.nextNode(),s=0,a=0,l=n[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new sn(o,o.nextSibling,this,e):l.type===1?c=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(c=new gi(o,this,e)),this._$AV.push(c),l=n[++a]}s!==l?.index&&(o=lt.nextNode(),s++)}return lt.currentNode=ct,i}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},sn=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=kt(this,e,t),rn(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==ut&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):sd(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&&rn(this._$AH)?this._$AA.nextSibling.data=e:this.T(ct.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,i=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=on.createElement(bs(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{let o=new hi(i,this),s=o.u(this.options);o.p(t),this.T(s),this._$AH=o}}_$AC(e){let t=ps.get(e.strings);return t===void 0&&ps.set(e.strings,t=new on(e)),t}k(e){bi(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(nn()),this.O(nn()),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=ls(e).nextSibling;ls(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},St=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,o){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=o,n.length>2||n[0]!==""||n[1]!==""?(this.Line truncated
|
||||
var w={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 Vn=globalThis,Kn=Vn.ShadowRoot&&(Vn.ShadyCSS===void 0||Vn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ui=Symbol(),os=new WeakMap,en=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==ui)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Kn&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=os.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&os.set(t,e))}return e}toString(){return this.cssText}},ss=r=>new en(typeof r=="string"?r:r+"",void 0,ui),J=(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 en(t,r,ui)},as=(r,e)=>{if(Kn)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),i=Vn.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},di=Kn?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return ss(t)})(r):r;var{is:nd,defineProperty:rd,getOwnPropertyDescriptor:id,getOwnPropertyNames:od,getOwnPropertySymbols:sd,getPrototypeOf:ad}=Object,Gn=globalThis,ls=Gn.trustedTypes,ld=ls?ls.emptyScript:"",cd=Gn.reactiveElementPolyfillSupport,tn=(r,e)=>r,hi={toAttribute(r,e){switch(e){case Boolean:r=r?ld: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}},us=(r,e)=>!nd(r,e),cs={attribute:!0,type:String,converter:hi,reflect:!1,useDefault:!1,hasChanged:us};Symbol.metadata??=Symbol("metadata"),Gn.litPropertyMetadata??=new WeakMap;var Pe=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=cs){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&&rd(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){let{get:i,set:o}=id(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)??cs}static _$Ei(){if(this.hasOwnProperty(tn("elementProperties")))return;let e=ad(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(tn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(tn("properties"))){let t=this.properties,n=[...od(t),...sd(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(di(i))}else e!==void 0&&t.push(di(e));return t}static _$Eu(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadLine truncated
|
||||
\f\r]`,nn=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ms=/-->/g,ps=/>/g,at=RegExp(`>|${mi}(?:([^\\s"'>=/]+)(${mi}*=${mi}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),fs=/'/g,gs=/"/g,ys=/^(?:script|style|textarea|title)$/i,wi=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),p=wi(1),ne=wi(2),og=wi(3),ut=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),_s=new WeakMap,lt=ct.createTreeWalker(ct,129);function ws(r,e){if(!yi(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return hs!==void 0?hs.createHTML(e):e}var hd=(r,e)=>{let t=r.length-1,n=[],i,o=e===2?"<svg>":e===3?"<math>":"",s=nn;for(let a=0;a<t;a++){let l=r[a],c,u,m=-1,d=0;for(;d<l.length&&(s.lastIndex=d,u=s.exec(l),u!==null);)d=s.lastIndex,s===nn?u[1]==="!--"?s=ms:u[1]!==void 0?s=ps:u[2]!==void 0?(ys.test(u[2])&&(i=RegExp("</"+u[2],"g")),s=at):u[3]!==void 0&&(s=at):s===at?u[0]===">"?(s=i??nn,m=-1):u[1]===void 0?m=-2:(m=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?at:u[3]==='"'?gs:fs):s===gs||s===fs?s=at:s===ms||s===ps?s=nn:(s=at,i=void 0);let h=s===at&&r[a+1].startsWith("/>")?" ":"";o+=s===nn?l+ud:m>=0?(n.push(c),l.slice(0,m)+bs+l.slice(m)+Je+h):l+Je+(m===-2?a:h)}return[ws(r,o+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},sn=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]=hd(e,t);if(this.el=r.createElement(c,n),lt.currentNode=this.el.content,t===2||t===3){let m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(i=lt.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let m of i.getAttributeNames())if(m.endsWith(bs)){let d=u[s++],h=i.getAttribute(m).split(Je),g=/([.?@])?(.*)/.exec(d);l.push({type:1,index:o,name:g[2],strings:h,ctor:g[1]==="."?fi:g[1]==="?"?gi:g[1]==="@"?_i:$t}),i.removeAttribute(m)}else m.startsWith(Je)&&(l.push({type:6,index:o}),i.removeAttribute(m));if(ys.test(i.tagName)){let m=i.textContent.split(Je),d=m.length-1;if(d>0){i.textContent=Un?Un.emptyScript:"";for(let h=0;h<d;h++)i.append(m[h],rn()),lt.nextNode(),l.push({type:2,index:++o});i.append(m[d],rn())}}}else if(i.nodeType===8)if(i.data===vs)l.push({type:2,index:o});else{let m=-1;for(;(m=i.data.indexOf(Je,m+1))!==-1;)l.push({type:7,index:o}),m+=Je.length-1}o++}}static createElement(e,t){let n=ct.createElement("template");return n.innerHTML=e,n}};function St(r,e,t=r,n){if(e===ut)return e;let i=n!==void 0?t._$Co?.[n]:t._$Cl,o=on(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(r),i._$AT(r,t,n)),n!==void 0?(t._$Co??=[])[n]=i:t._$Cl=i),i!==void 0&&(e=St(r,i._$AS(r,e.values),i,n)),e}var pi=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,i=(e?.creationScope??ct).importNode(t,!0);lt.currentNode=i;let o=lt.nextNode(),s=0,a=0,l=n[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new an(o,o.nextSibling,this,e):l.type===1?c=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(c=new bi(o,this,e)),this._$AV.push(c),l=n[++a]}s!==l?.index&&(o=lt.nextNode(),s++)}return lt.currentNode=ct,i}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},an=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=St(this,e,t),on(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==ut&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):dd(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&&on(this._$AH)?this._$AA.nextSibling.data=e:this.T(ct.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,i=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=sn.createElement(ws(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{let o=new pi(i,this),s=o.u(this.options);o.p(t),this.T(s),this._$AH=o}}_$AC(e){let t=_s.get(e.strings);return t===void 0&&_s.set(e.strings,t=new sn(e)),t}k(e){yi(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(rn()),this.O(rn()),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=ds(e).nextSibling;ds(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},$t=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,o){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=o,n.length>2||n[0]!==""||n[1]!==""?(this.Line truncated
|
||||
|
||||
Ein Plugin l\xE4uft mit denselben Rechten wie NextFloor in deinem Browser. Die Datei wurde gepr\xFCft, ihr Inhalt ist festgelegt:
|
||||
{url}`,manual:"Anleitung",manual_more:"Mehr erfahren",feature_text_energy:"Energieteilchen fliegen in B\xF6gen von den Solarfeldern zum Wechselrichter, zwischen Haus, Akku, Netz und Verbrauchern \u2013 schneller und dichter, je mehr Strom flie\xDFt. Die Module funkeln mit ihrer Produktion, eine Glaskarte \xFCber dem Dach zeigt die Bilanz und wie autark das Haus gerade ist.",live_autarky:"autark",live_fold:"Karte verkleinern",live_unfold:"Karte aufklappen",live_day_hint:"Die letzten 24 Stunden: Solar (Fl\xE4che) und Verbrauch (Linie)",live_week_hint:"Die letzten 7 Tage: Sonne {solar} kWh, Verbrauch {use} kWh (gelb: Sonne, hell: Verbrauch)",live_days:"Tage",live_car_away:"Unterwegs",live_car_charging:"L\xE4dt",live_car_plugged:"Eingesteckt",live_car_lock:"Verriegeln",live_car_unlock:"Entriegeln",live_car_unlock_confirm:"{name} wirklich entriegeln?",live_car_climate:"Klimatisierung",live_car_charge:"Laden starten/stoppen",live_media_prev:"Zur\xFCck",live_media_playpause:"Abspielen/Pause",live_media_next:"Weiter",live_media_volume:"Lautst\xE4rke",live_car_device:"Auto (eine Entit\xE4t des Autos)",live_car_device_hint:"Ladestand, Reichweite, Laden, Stecker, Schloss und Klima findet NextFloor selbst am Ger\xE4t des Autos. Ohne Angabe nimmt es den Anwesenheitssensor des Stellplatzes.",live_car_departure_entity:"Abfahrtszeit (optional)",live_car_departure:"Abfahrt {time}",live_car_open:"Offen: {parts}",printer_printing:"druckt",printer_done:"fertig",printer_paused:"pausiert",printer_error:"Fehler",printer_idle:"bereit",printer_done_at:"fertig um {time}",printer_layer:"Schicht",printer_nozzle:"D\xFCse",printer_bed:"Bett",heatpump_heating:"heizt",heatpump_water:"macht Warmwasser",heatpump_cooling:"k\xFChlt",heatpump_defrost:"taut ab",heatpump_idle:"in Ruhe",heatpump_flow_return:"Vor- \u2192 R\xFCcklauf",heatpump_heat:"W\xE4rme",heatpump_power:"Strom",heatpump_outside:"au\xDFen",pack_missing_item:"M\xF6bel aus entferntem Pack",back_to_room:"Zur\xFCck zu {room}",back_to_floor:"Zur\xFCck zur Etage",hint_furniture:"Raum antippen, dann rechts ein M\xF6belst\xFCck w\xE4hlen \xB7 M\xF6bel ziehen, an den Ecken die Gr\xF6\xDFe \xE4ndern",furniture_into:"Neue M\xF6bel kommen in die Mitte von \u201E{room}\u201C.",furniture_pick_room:"Tipp: Erst einen Raum antippen \u2013 dann landen neue M\xF6bel in seiner Mitte.",flows:"Stromfluss",flows_hint:"Energieb\xF6gen zwischen Solarfeldern, Wechselrichter, Akku, Netz und Verbrauchern ein- oder ausblenden",chk_title:"Einrichtung",chk_hint:"Was der Energiefluss braucht. Antippen springt an die Stelle.",chk_solar:"Solarfeld angelegt",chk_solar_add:"Ein Solarfeld aufs Dach legen",chk_meter:"Stromz\xE4hler mit Netzsensor",chk_meter_sensor:"Stromz\xE4hler: Netzsensor (W) fehlt",chk_meter_add:"Stromz\xE4hler anlegen",chk_inverter:"Wechselrichter mit Leistungssensor",chk_inverter_sensor:"Wechselrichter: Leistungssensor fehlt",chk_inverter_add:"Wechselrichter anlegen",chk_battery:"Stromspeicher mit Leistung und Ladestand",chk_battery_sensor:"Stromspeicher: Leistung oder Ladestand fehlt",chk_battery_opt:"Stromspeicher (optional)",chk_grid:"Netzanschluss gesetzt",chk_grid_opt:"Netzanschluss (optional, sonst automatisch)",energy_sign_grid:"Das Haus zeigt Einspeisung, obwohl die Sonne nichts liefert. Der Netzsensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_battery:"Der Speicher l\xE4dt ohne Sonne und ohne Netzbezug. Sein Sensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_flip:"Vorzeichen umkehren",help_title:"Hilfe und R\xFCckmeldung",help_hint:"Fehler bitte als Issue auf GitHub, W\xFCnsche als Diskussion \u2013 so geht nichts verloren, und alle sehen den Stand.",help_issue:"Problem melden",help_idea:"Idee vorschlagen",furn_name:"Name (optional)",furn_mirror:"Spiegeln",furn_mirror_hint:"Links und rechts vertauschen \u2013 das L-Sofa andersherum, der Schrank mit der T\xFCr auf der anderen Seite, die K\xFCchenzeile gespiegelt.",hint_opening:"Auf eine Wand tippen, um eine T\xFCr oder ein Fenster einzusetzen \u2013 die Art w\xE4hlst du danach rechts",preset_door:"T\xFCr",preset_door_double:"Doppelt\xFCr",preset_window:"Fenster",preset_window_double:"Fenster 2-fl\xFCgelig",preset_terrace:"Terrassent\xFCr",preset_terrace_double:"Terrassent\xFCr 2-fl\xFCgelig",preset_lift_slide:"Hebe-Schiebet\xFCr",preset_garage:"Garagentor",preset_front:"Haust\xFCr",opening_style:"Stil",sidelight_auto:"automatisch",sidelight_hinge:"Seitenteil an der Anschlagseite",sidelight_hinge_hint:"Das Seitenteil sitzt sonst gegen\xFCber dem Anschlag; mit Haken neben den B\xE4ndern.",sidelight_width:"Breite Seitenteil (m)",sidelight_width_left:"Seitenteil links (m)",sidelight_width_right:"Seitenteil rechts (m)",style_auto:"Automatisch ({style})",style_interior:"Zimmert\xFCr",style_front:"Haust\xFCr",style_front_glass:"Haust\xFCr mit Glasausschnitt",style_sidelight:"Haust\xFCr mit Seitenteil",style_sidelights:"Haust\xFCr mit 2 Seitenteilen",style_glass:"Glast\xFCr",style_sliding:"Schiebet\xFCr",style_p
Line truncated
|
||||
{url}`,manual:"Anleitung",manual_more:"Mehr erfahren",feature_text_energy:"Energieteilchen fliegen in B\xF6gen von den Solarfeldern zum Wechselrichter, zwischen Haus, Akku, Netz und Verbrauchern \u2013 schneller und dichter, je mehr Strom flie\xDFt. Die Module funkeln mit ihrer Produktion, eine Glaskarte \xFCber dem Dach zeigt die Bilanz und wie autark das Haus gerade ist.",live_autarky:"autark",live_fold:"Karte verkleinern",live_unfold:"Karte aufklappen",live_day_hint:"Die letzten 24 Stunden: Solar (Fl\xE4che) und Verbrauch (Linie)",live_week_hint:"Die letzten 7 Tage: Sonne {solar} kWh, Verbrauch {use} kWh (gelb: Sonne, hell: Verbrauch)",live_days:"Tage",live_car_away:"Unterwegs",live_car_charging:"L\xE4dt",live_car_plugged:"Eingesteckt",live_car_lock:"Verriegeln",live_car_unlock:"Entriegeln",live_car_unlock_confirm:"{name} wirklich entriegeln?",live_car_climate:"Klimatisierung",live_car_charge:"Laden starten/stoppen",live_media_prev:"Zur\xFCck",live_media_playpause:"Abspielen/Pause",live_media_next:"Weiter",live_media_volume:"Lautst\xE4rke",live_car_device:"Auto (eine Entit\xE4t des Autos)",live_car_device_hint:"Ladestand, Reichweite, Laden, Stecker, Schloss und Klima findet NextFloor selbst am Ger\xE4t des Autos. Ohne Angabe nimmt es den Anwesenheitssensor des Stellplatzes.",live_car_departure_entity:"Abfahrtszeit (optional)",live_car_departure:"Abfahrt {time}",live_car_open:"Offen: {parts}",printer_printing:"druckt",printer_done:"fertig",printer_paused:"pausiert",printer_error:"Fehler",printer_idle:"bereit",printer_done_at:"fertig um {time}",printer_layer:"Schicht",printer_nozzle:"D\xFCse",printer_bed:"Bett",heatpump_heating:"heizt",heatpump_water:"macht Warmwasser",heatpump_cooling:"k\xFChlt",heatpump_defrost:"taut ab",heatpump_idle:"in Ruhe",heatpump_flow_return:"Vor- \u2192 R\xFCcklauf",heatpump_heat:"W\xE4rme",heatpump_power:"Strom",heatpump_outside:"au\xDFen",pack_missing_item:"M\xF6bel aus entferntem Pack",back_to_room:"Zur\xFCck zu {room}",back_to_floor:"Zur\xFCck zur Etage",hint_furniture:"Raum antippen, dann rechts ein M\xF6belst\xFCck w\xE4hlen \xB7 M\xF6bel ziehen, an den Ecken die Gr\xF6\xDFe \xE4ndern",furniture_into:"Neue M\xF6bel kommen in die Mitte von \u201E{room}\u201C.",furniture_pick_room:"Tipp: Erst einen Raum antippen \u2013 dann landen neue M\xF6bel in seiner Mitte.",flows:"Stromfluss",flows_hint:"Energieb\xF6gen zwischen Solarfeldern, Wechselrichter, Akku, Netz und Verbrauchern ein- oder ausblenden",chk_title:"Einrichtung",chk_hint:"Was der Energiefluss braucht. Antippen springt an die Stelle.",chk_solar:"Solarfeld angelegt",chk_solar_add:"Ein Solarfeld aufs Dach legen",chk_meter:"Stromz\xE4hler mit Netzsensor",chk_meter_sensor:"Stromz\xE4hler: Netzsensor (W) fehlt",chk_meter_add:"Stromz\xE4hler anlegen",chk_inverter:"Wechselrichter mit Leistungssensor",chk_inverter_sensor:"Wechselrichter: Leistungssensor fehlt",chk_inverter_add:"Wechselrichter anlegen",chk_battery:"Stromspeicher mit Leistung und Ladestand",chk_battery_sensor:"Stromspeicher: Leistung oder Ladestand fehlt",chk_battery_opt:"Stromspeicher (optional)",chk_grid:"Netzanschluss gesetzt",chk_grid_opt:"Netzanschluss (optional, sonst automatisch)",energy_sign_grid:"Das Haus zeigt Einspeisung, obwohl die Sonne nichts liefert. Der Netzsensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_battery:"Der Speicher l\xE4dt ohne Sonne und ohne Netzbezug. Sein Sensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_flip:"Vorzeichen umkehren",help_title:"Hilfe und R\xFCckmeldung",help_hint:"Fehler bitte als Issue auf GitHub, W\xFCnsche als Diskussion \u2013 so geht nichts verloren, und alle sehen den Stand.",help_issue:"Problem melden",help_idea:"Idee vorschlagen",furn_name:"Name (optional)",furn_mirror:"Spiegeln",furn_mirror_hint:"Links und rechts vertauschen \u2013 das L-Sofa andersherum, der Schrank mit der T\xFCr auf der anderen Seite, die K\xFCchenzeile gespiegelt.",hint_opening:"Auf eine Wand tippen, um eine T\xFCr oder ein Fenster einzusetzen \u2013 die Art w\xE4hlst du danach rechts",preset_door:"T\xFCr",preset_door_double:"Doppelt\xFCr",preset_window:"Fenster",preset_window_double:"Fenster 2-fl\xFCgelig",preset_terrace:"Terrassent\xFCr",preset_terrace_double:"Terrassent\xFCr 2-fl\xFCgelig",preset_lift_slide:"Hebe-Schiebet\xFCr",preset_garage:"Garagentor",preset_front:"Haust\xFCr",opening_style:"Stil",sidelight_auto:"automatisch",sidelight_hinge:"Seitenteil an der Anschlagseite",sidelight_hinge_hint:"Das Seitenteil sitzt sonst gegen\xFCber dem Anschlag; mit Haken neben den B\xE4ndern.",sidelight_width:"Breite Seitenteil (m)",sidelight_width_left:"Seitenteil links (m)",sidelight_width_right:"Seitenteil rechts (m)",style_auto:"Automatisch ({style})",style_interior:"Zimmert\xFCr",style_front:"Haust\xFCr",style_front_glass:"Haust\xFCr mit Glasausschnitt",style_sidelight:"Haust\xFCr mit Seitenteil",style_sidelights:"Haust\xFCr mit 2 Seitenteilen",style_glass:"Glast\xFCr",style_sliding:"Schiebet\xFCr",style_p
Line truncated
|
||||
|
||||
A plugin runs with the same rights as NextFloor in your browser. The file has been reviewed and its content is fixed:
|
||||
{url}`,manual:"Manual",manual_more:"Learn more",feature_text_energy:"Energy particles fly in arcs from the solar fields to the inverter, between house, battery, grid and consumers \u2013 faster and denser the more power flows. The modules sparkle with their production, a glass card over the roof shows the balance and how self-sufficient the house is right now.",live_autarky:"self-sufficient",live_fold:"Make the card small",live_unfold:"Open the card",live_day_hint:"The last 24 hours: solar (area) and consumption (line)",live_week_hint:"The last 7 days: sun {solar} kWh, use {use} kWh (yellow: sun, light: use)",live_days:"days",live_car_away:"On the road",live_car_charging:"Charging",live_car_plugged:"Plugged in",live_car_lock:"Lock",live_car_unlock:"Unlock",live_car_unlock_confirm:"Really unlock {name}?",live_car_climate:"Climate",live_car_charge:"Start/stop charging",live_media_prev:"Previous",live_media_playpause:"Play/pause",live_media_next:"Next",live_media_volume:"Volume",live_car_device:"Car (any entity of the car)",live_car_device_hint:"Charge, range, charging, plug, lock and climate are found by NextFloor on the car's device. Without one it takes the spot's presence sensor.",live_car_departure_entity:"Departure time (optional)",live_car_departure:"Departs {time}",live_car_open:"Open: {parts}",printer_printing:"printing",printer_done:"done",printer_paused:"paused",printer_error:"error",printer_idle:"idle",printer_done_at:"done at {time}",printer_layer:"Layer",printer_nozzle:"Nozzle",printer_bed:"Bed",heatpump_heating:"heating",heatpump_water:"making hot water",heatpump_cooling:"cooling",heatpump_defrost:"defrosting",heatpump_idle:"resting",heatpump_flow_return:"Flow \u2192 return",heatpump_heat:"Heat",heatpump_power:"Power",heatpump_outside:"outside",pack_missing_item:"Furniture of a removed pack",back_to_room:"Back to {room}",back_to_floor:"Back to the floor",hint_furniture:"Tap a room, then pick an item on the right \xB7 drag items, resize them by their corners",furniture_into:"New items go into the middle of \u201C{room}\u201D.",furniture_pick_room:"Tip: tap a room first \u2013 new items then land in its middle.",flows:"Power flow",flows_hint:"Show or hide the energy arcs between solar fields, inverter, battery, grid and consumers",chk_title:"Setup",chk_hint:"What the energy flow needs. Tap a row to jump there.",chk_solar:"Solar field in place",chk_solar_add:"Put a solar field on the roof",chk_meter:"Meter with grid sensor",chk_meter_sensor:"Meter: grid sensor (W) missing",chk_meter_add:"Add the meter",chk_inverter:"Inverter with power sensor",chk_inverter_sensor:"Inverter: power sensor missing",chk_inverter_add:"Add an inverter",chk_battery:"Home battery with power and charge",chk_battery_sensor:"Home battery: power or charge missing",chk_battery_opt:"Home battery (optional)",chk_grid:"Grid connection set",chk_grid_opt:"Grid connection (optional, else automatic)",energy_sign_grid:"The house shows export while the sun produces nothing. The grid sensor probably has its sign reversed.",energy_sign_battery:"The battery charges with no sun and no grid draw. Its sensor probably has its sign reversed.",energy_sign_flip:"Flip the sign",help_title:"Help and feedback",help_hint:"Please report problems as a GitHub issue and wishes as a discussion \u2013 nothing gets lost, and everyone sees the state.",help_issue:"Report a problem",help_idea:"Propose an idea",furn_name:"Name (optional)",furn_mirror:"Mirror",furn_mirror_hint:"Swap left and right \u2013 the L-sofa the other way round, the cabinet with its door on the other side, the kitchen run mirrored.",hint_opening:"Tap a wall to add a door or window \u2013 choose its kind on the right afterwards",preset_door:"Door",preset_door_double:"Double door",preset_window:"Window",preset_window_double:"Double window",preset_terrace:"Terrace door",preset_terrace_double:"French doors",preset_lift_slide:"Lift-and-slide door",preset_garage:"Garage door",preset_front:"Front door",opening_style:"Style",sidelight_auto:"automatic",sidelight_hinge:"Sidelight on the hinge side",sidelight_hinge_hint:"The sidelight sits opposite the hinge otherwise; ticked, it sits next to the hinges.",sidelight_width:"Sidelight width (m)",sidelight_width_left:"Left sidelight (m)",sidelight_width_right:"Right sidelight (m)",style_auto:"Automatic ({style})",style_interior:"Room door",style_front:"Front door",style_front_glass:"Front door with glass",style_sidelight:"Front door with sidelight",style_sidelights:"Front door with two sidelights",style_glass:"Glass door",style_sliding:"Sliding door",style_passage:"Opening (no door)",style_standard:"Standard",style_bars:"With glazing bars",style_glass_wall:"Glass wall (fixed)",preset_glass_wall:"Glass wall",glass_panes:"Panes",glass_panes_auto:"automatic (about 0.9 m)",glass_panes_hint:"0 = one single pane without mullions, empty = about every 0.9 m",flip_hinge:"Swap hinge side",flip_main_leaf:"Swap main leaf",flip_hinge_hint:"Hinges to the other side"
Line truncated
|
||||
{url}`,manual:"Manual",manual_more:"Learn more",feature_text_energy:"Energy particles fly in arcs from the solar fields to the inverter, between house, battery, grid and consumers \u2013 faster and denser the more power flows. The modules sparkle with their production, a glass card over the roof shows the balance and how self-sufficient the house is right now.",live_autarky:"self-sufficient",live_fold:"Make the card small",live_unfold:"Open the card",live_day_hint:"The last 24 hours: solar (area) and consumption (line)",live_week_hint:"The last 7 days: sun {solar} kWh, use {use} kWh (yellow: sun, light: use)",live_days:"days",live_car_away:"On the road",live_car_charging:"Charging",live_car_plugged:"Plugged in",live_car_lock:"Lock",live_car_unlock:"Unlock",live_car_unlock_confirm:"Really unlock {name}?",live_car_climate:"Climate",live_car_charge:"Start/stop charging",live_media_prev:"Previous",live_media_playpause:"Play/pause",live_media_next:"Next",live_media_volume:"Volume",live_car_device:"Car (any entity of the car)",live_car_device_hint:"Charge, range, charging, plug, lock and climate are found by NextFloor on the car's device. Without one it takes the spot's presence sensor.",live_car_departure_entity:"Departure time (optional)",live_car_departure:"Departs {time}",live_car_open:"Open: {parts}",printer_printing:"printing",printer_done:"done",printer_paused:"paused",printer_error:"error",printer_idle:"idle",printer_done_at:"done at {time}",printer_layer:"Layer",printer_nozzle:"Nozzle",printer_bed:"Bed",heatpump_heating:"heating",heatpump_water:"making hot water",heatpump_cooling:"cooling",heatpump_defrost:"defrosting",heatpump_idle:"resting",heatpump_flow_return:"Flow \u2192 return",heatpump_heat:"Heat",heatpump_power:"Power",heatpump_outside:"outside",pack_missing_item:"Furniture of a removed pack",back_to_room:"Back to {room}",back_to_floor:"Back to the floor",hint_furniture:"Tap a room, then pick an item on the right \xB7 drag items, resize them by their corners",furniture_into:"New items go into the middle of \u201C{room}\u201D.",furniture_pick_room:"Tip: tap a room first \u2013 new items then land in its middle.",flows:"Power flow",flows_hint:"Show or hide the energy arcs between solar fields, inverter, battery, grid and consumers",chk_title:"Setup",chk_hint:"What the energy flow needs. Tap a row to jump there.",chk_solar:"Solar field in place",chk_solar_add:"Put a solar field on the roof",chk_meter:"Meter with grid sensor",chk_meter_sensor:"Meter: grid sensor (W) missing",chk_meter_add:"Add the meter",chk_inverter:"Inverter with power sensor",chk_inverter_sensor:"Inverter: power sensor missing",chk_inverter_add:"Add an inverter",chk_battery:"Home battery with power and charge",chk_battery_sensor:"Home battery: power or charge missing",chk_battery_opt:"Home battery (optional)",chk_grid:"Grid connection set",chk_grid_opt:"Grid connection (optional, else automatic)",energy_sign_grid:"The house shows export while the sun produces nothing. The grid sensor probably has its sign reversed.",energy_sign_battery:"The battery charges with no sun and no grid draw. Its sensor probably has its sign reversed.",energy_sign_flip:"Flip the sign",help_title:"Help and feedback",help_hint:"Please report problems as a GitHub issue and wishes as a discussion \u2013 nothing gets lost, and everyone sees the state.",help_issue:"Report a problem",help_idea:"Propose an idea",furn_name:"Name (optional)",furn_mirror:"Mirror",furn_mirror_hint:"Swap left and right \u2013 the L-sofa the other way round, the cabinet with its door on the other side, the kitchen run mirrored.",hint_opening:"Tap a wall to add a door or window \u2013 choose its kind on the right afterwards",preset_door:"Door",preset_door_double:"Double door",preset_window:"Window",preset_window_double:"Double window",preset_terrace:"Terrace door",preset_terrace_double:"French doors",preset_lift_slide:"Lift-and-slide door",preset_garage:"Garage door",preset_front:"Front door",opening_style:"Style",sidelight_auto:"automatic",sidelight_hinge:"Sidelight on the hinge side",sidelight_hinge_hint:"The sidelight sits opposite the hinge otherwise; ticked, it sits next to the hinges.",sidelight_width:"Sidelight width (m)",sidelight_width_left:"Left sidelight (m)",sidelight_width_right:"Right sidelight (m)",style_auto:"Automatic ({style})",style_interior:"Room door",style_front:"Front door",style_front_glass:"Front door with glass",style_sidelight:"Front door with sidelight",style_sidelights:"Front door with two sidelights",style_glass:"Glass door",style_sliding:"Sliding door",style_passage:"Opening (no door)",style_standard:"Standard",style_bars:"With glazing bars",style_glass_wall:"Glass wall (fixed)",preset_glass_wall:"Glass wall",glass_panes:"Panes",glass_panes_auto:"automatic (about 0.9 m)",glass_panes_hint:"0 = one single pane without mullions, empty = about every 0.9 m",flip_hinge:"Swap hinge side",flip_main_leaf:"Swap main leaf",flip_hinge_hint:"Hinges to the other side"
Line truncated
|
||||
:host {
|
||||
--nf-text: var(--primary-text-color, #e1e1e1);
|
||||
--nf-muted: var(--secondary-text-color, #9b9b9b);
|
||||
@@ -35,7 +35,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
font-family: var(--nf-font);
|
||||
color: var(--nf-text);
|
||||
}
|
||||
`,Mr=J`
|
||||
`,Ar=J`
|
||||
:host([readable]) {
|
||||
--secondary-text-color: var(--primary-text-color, #e1e1e1);
|
||||
--divider-color: color-mix(in srgb, var(--primary-text-color, #e1e1e1) 40%, transparent);
|
||||
@@ -209,18 +209,18 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
min-height: 40px;
|
||||
}
|
||||
}
|
||||
`;function Ar(r){return r?.themes?.darkMode===!1?"light":"dark"}function gn(r,e){let t=new Set;return e.flatMap(n=>{let i=String(r?.states[n]?.attributes.symcon_source_entity||n),o=r?.states[i]?.attributes,s=Number(o?.symcon_id);return!s||!o?.symcon_archive||t.has(s)?[]:(t.add(s),[i])})}var rl,Xi=class extends Q{static properties={hass:{attribute:!1},ids:{attribute:!1},label:{attribute:!1},busy:{state:!0},error:{state:!0}};constructor(){super(),this.ids=[],this.label="",this.busy=!1,this.error=""}async open(e){e.stopPropagation(),this.busy=!0,this.error="";try{let t=new URL("./nextfloor-trend.js?v=84417e0b2573",import.meta.url).href;await(await(rl??=import(t).catch(i=>{throw rl=void 0,i}))).openTrend(this.hass,this.ids,this.label)}catch(t){this.error=t instanceof Error?t.message:String(t)}finally{this.busy=!1}}render(){if(!gn(this.hass,this.ids).length)return f;let e=this.label?`Trend anzeigen: ${this.label}`:"Trend anzeigen";return p`<button type="button" title=${e} aria-label=${e} aria-haspopup="dialog" ?disabled=${this.busy} @pointerdown=${t=>t.stopPropagation()} @click=${t=>{this.open(t)}}>
|
||||
`;function Er(r){return r?.themes?.darkMode===!1?"light":"dark"}function _n(r,e){let t=new Set;return e.flatMap(n=>{let i=String(r?.states[n]?.attributes.symcon_source_entity||n),o=r?.states[i]?.attributes,s=Number(o?.symcon_id);return!s||!o?.symcon_archive||t.has(s)?[]:(t.add(s),[i])})}var sl,to=class extends Q{static properties={hass:{attribute:!1},ids:{attribute:!1},label:{attribute:!1},busy:{state:!0},error:{state:!0}};constructor(){super(),this.ids=[],this.label="",this.busy=!1,this.error=""}async open(e){e.stopPropagation(),this.busy=!0,this.error="";try{let t=new URL("./nextfloor-trend.js?v=84417e0b2573",import.meta.url).href;await(await(sl??=import(t).catch(i=>{throw sl=void 0,i}))).openTrend(this.hass,this.ids,this.label)}catch(t){this.error=t instanceof Error?t.message:String(t)}finally{this.busy=!1}}render(){if(!_n(this.hass,this.ids).length)return f;let e=this.label?`Trend anzeigen: ${this.label}`:"Trend anzeigen";return p`<button type="button" title=${e} aria-label=${e} aria-haspopup="dialog" ?disabled=${this.busy} @pointerdown=${t=>t.stopPropagation()} @click=${t=>{this.open(t)}}>
|
||||
<svg width="12" height="12" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M3 2v15h15M5 13l4-5 4 2 4-6"/></svg>
|
||||
</button>${this.error?p`<span role="alert">${this.error}</span>`:f}`}static styles=J`:host{position:relative;display:inline-flex;flex:0 0 18px;width:18px;height:18px;vertical-align:middle;margin-left:3px;font-weight:normal;line-height:0}button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:18px;height:18px;padding:2px;border:0;border-radius:3px;background:transparent;color:var(--nf-accent,#40c8ff);opacity:.8;cursor:pointer}svg{display:block;flex-shrink:0}button:hover,button:focus-visible{opacity:1;background:#40c8ff18}button:focus-visible{outline:1px solid currentColor;outline-offset:1px}button:disabled{opacity:.4}span{position:absolute;right:0;top:22px;z-index:10;box-sizing:border-box;width:200px;padding:8px;border:1px solid #ff9b9b50;border-radius:6px;background:var(--nf-chrome-solid,#1c1c1c);font:12px/1.4 system-ui;color:#ff9b9b;white-space:normal}`};customElements.get("nf-trend-button")||customElements.define("nf-trend-button",Xi);function G(r,e,t=""){let n=gn(r,e);return n.length?p`<nf-trend-button .hass=${r} .ids=${n} .label=${t}></nf-trend-button>`:f}var eo=class extends Q{static properties={hass:{attribute:!1},room:{attribute:!1},_pending:{state:!0},_error:{state:!0}};constructor(){super(),this._pending=new Set,this._error=""}async send(e,t,n,i){this._pending=new Set([...this._pending,e]),this._error="";try{await this.hass.callService(t,n,{entity_id:e,...i})}catch(o){this._error=o instanceof Error?o.message:String(o)}finally{this._pending=new Set([...this._pending].filter(o=>o!==e))}}value(e,t,n){let i=this.hass.states[t],o=tt(i),s=i?.attributes,a=n&&!!s?.symcon_has_action&&o!==null&&!this._pending.has(t);return p`<div class="value"><span>${e}</span><b>${nt(i)}${G(this.hass,[t],e)}</b>
|
||||
${n&&s?.symcon_has_action&&s.symcon_variable_type===0?p`<button class="nf-chip" aria-pressed=${se(i)===!0} ?disabled=${!a} @click=${()=>{this.send(t,"symcon","set_value",{value:!se(i)})}}>${se(i)?"Ein":"Aus"}</button>`:n&&s?.symcon_has_action&&[1,2].includes(Number(s.symcon_variable_type))?p`<input type="number" aria-label=${e} .value=${String(We(i)??"")} min=${String(s.symcon_min??0)} max=${String(s.symcon_max??100)} step=${String(s.symcon_step||(s.symcon_variable_type===1?1:.1))} ?disabled=${!a}
|
||||
</button>${this.error?p`<span role="alert">${this.error}</span>`:f}`}static styles=J`:host{position:relative;display:inline-flex;flex:0 0 18px;width:18px;height:18px;vertical-align:middle;margin-left:3px;font-weight:normal;line-height:0}button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:18px;height:18px;padding:2px;border:0;border-radius:3px;background:transparent;color:var(--nf-accent,#40c8ff);opacity:.8;cursor:pointer}svg{display:block;flex-shrink:0}button:hover,button:focus-visible{opacity:1;background:#40c8ff18}button:focus-visible{outline:1px solid currentColor;outline-offset:1px}button:disabled{opacity:.4}span{position:absolute;right:0;top:22px;z-index:10;box-sizing:border-box;width:200px;padding:8px;border:1px solid #ff9b9b50;border-radius:6px;background:var(--nf-chrome-solid,#1c1c1c);font:12px/1.4 system-ui;color:#ff9b9b;white-space:normal}`};customElements.get("nf-trend-button")||customElements.define("nf-trend-button",to);function G(r,e,t=""){let n=_n(r,e);return n.length?p`<nf-trend-button .hass=${r} .ids=${n} .label=${t}></nf-trend-button>`:f}var no=class extends Q{static properties={hass:{attribute:!1},room:{attribute:!1},_pending:{state:!0},_error:{state:!0}};constructor(){super(),this._pending=new Set,this._error=""}async send(e,t,n,i){this._pending=new Set([...this._pending,e]),this._error="";try{await this.hass.callService(t,n,{entity_id:e,...i})}catch(o){this._error=o instanceof Error?o.message:String(o)}finally{this._pending=new Set([...this._pending].filter(o=>o!==e))}}value(e,t,n){let i=this.hass.states[t],o=tt(i),s=i?.attributes,a=n&&!!s?.symcon_has_action&&o!==null&&!this._pending.has(t);return p`<div class="value"><span>${e}</span><b>${nt(i)}${G(this.hass,[t],e)}</b>
|
||||
${n&&s?.symcon_has_action&&s.symcon_variable_type===0?p`<button class="nf-chip" aria-pressed=${ae(i)===!0} ?disabled=${!a} @click=${()=>{this.send(t,"symcon","set_value",{value:!ae(i)})}}>${ae(i)?"Ein":"Aus"}</button>`:n&&s?.symcon_has_action&&[1,2].includes(Number(s.symcon_variable_type))?p`<input type="number" aria-label=${e} .value=${String(We(i)??"")} min=${String(s.symcon_min??0)} max=${String(s.symcon_max??100)} step=${String(s.symcon_step||(s.symcon_variable_type===1?1:.1))} ?disabled=${!a}
|
||||
@change=${l=>{let c=l.target;c.value.trim()&&c.checkValidity()&&this.send(t,"symcon","set_value",{value:Number(c.value)})}} />`:f}
|
||||
</div>`}schedule(e){let t=this.hass.states[e];if(!t?.attributes.symcon_schedule)return p`<p class="missing">Schaltuhr nicht verfügbar</p>`;let n=t.attributes.actions??[],i=t.attributes.groups??[],o=Number(t.attributes.next_run??0),s=n.find(c=>c.id===t.attributes.next_action),a=["Mo","Di","Mi","Do","Fr","Sa","So"],l=c=>`${String(c.hour).padStart(2,"0")}:${String(c.minute).padStart(2,"0")}${c.second?`:${String(c.second).padStart(2,"0")}`:""}`;return p`<details class="schedule"><summary>${String(t.attributes.friendly_name??"Schaltuhr")}</summary>
|
||||
<label class="nf-check"><input type="checkbox" .checked=${t.state==="on"} ?disabled=${this._pending.has(e)} @change=${c=>{this.send(e,"schedule","set_active",{active:c.target.checked})}} /> Aktiv</label>
|
||||
${o>0?p`<p class="next">Nächster Schaltpunkt: ${new Date(o*1e3).toLocaleString(this.hass.language)}${s?` \xB7 ${s.name}`:""}</p>`:f}
|
||||
${i.length?i.map(c=>p`<div class="schedule-group"><b>${a.filter((u,d)=>c.days&1<<d).join(" \xB7 ")}</b><div class="points">
|
||||
${[...c.points].sort((u,d)=>u.hour*3600+u.minute*60+u.second-(d.hour*3600+d.minute*60+d.second)).map(u=>{let d=n.find(m=>m.id===u.action);return p`<span class="point"><time>${l(u)}</time><span class="dot" style=${`background:#${Number(d?.color??8885929).toString(16).padStart(6,"0").slice(-6)}`}></span>${d?.name||"Aktion"}</span>`})}
|
||||
${i.length?i.map(c=>p`<div class="schedule-group"><b>${a.filter((u,m)=>c.days&1<<m).join(" \xB7 ")}</b><div class="points">
|
||||
${[...c.points].sort((u,m)=>u.hour*3600+u.minute*60+u.second-(m.hour*3600+m.minute*60+m.second)).map(u=>{let m=n.find(d=>d.id===u.action);return p`<span class="point"><time>${l(u)}</time><span class="dot" style=${`background:#${Number(m?.color??8885929).toString(16).padStart(6,"0").slice(-6)}`}></span>${m?.name||"Aktion"}</span>`})}
|
||||
</div></div>`):p`<p class="missing">Keine Schaltpunkte vorhanden.</p>`}
|
||||
</details>`}render(){if(!this.hass||!this.room)return f;let e=nl.filter(i=>i.key!=="status"&&this.room.hvac?.[i.key]&&this.room.hvac[i.key]!=="none"),t=this.room.hvac?.schedules??[],n=this.room.floor_heating&&this.room.floor_heating!=="none"?this.room.floor_heating:null;return p`${n||e.length?p`<section><h3>Raumklima</h3>${n?this.value("Fu\xDFbodenheizung",n,!0):f}${e.map(i=>this.value(i.label,this.room.hvac[i.key],!!i.control))}</section>`:f}
|
||||
</details>`}render(){if(!this.hass||!this.room)return f;let e=ol.filter(i=>i.key!=="status"&&this.room.hvac?.[i.key]&&this.room.hvac[i.key]!=="none"),t=this.room.hvac?.schedules??[],n=this.room.floor_heating&&this.room.floor_heating!=="none"?this.room.floor_heating:null;return p`${n||e.length?p`<section><h3>Raumklima</h3>${n?this.value("Fu\xDFbodenheizung",n,!0):f}${e.map(i=>this.value(i.label,this.room.hvac[i.key],!!i.control))}</section>`:f}
|
||||
${t.length?p`<section><h3>Schaltuhren</h3>${t.map(i=>this.schedule(i))}</section>`:f}
|
||||
${this._error?p`<p role="alert" class="error">${this._error}</p>`:f}`}static styles=[_e,ze,J`
|
||||
:host { display:block; }
|
||||
@@ -240,12 +240,12 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
||||
.point time { font-variant-numeric:tabular-nums; }
|
||||
.dot { width:8px; height:8px; border-radius:50%; }
|
||||
.error { color:var(--nf-danger,#ff6b7a); font-size:12px; }
|
||||
`]};customElements.get("nf-room-hvac")||customElements.define("nf-room-hvac",eo);var Te={electricity:"Strom",water:"Wasser",gas:"Gas",heating:"Heizen",cooling:"K\xFChlen"},_n={electricity:"\u26A1",water:"\u{1F4A7}",gas:"\u{1F525}",heating:"\u2668",cooling:"\u2744"},zr=r=>r.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/ß/g,"ss").replace(/[^a-z0-9]+/g," ").trim(),Vh="{485D0419-BE97-4548-AA9C-C083EB82E61E}",Kh=r=>r.object_type!==0&&!(r.object_type===1&&r.module_id?.toUpperCase()===Vh)?null:{elektro:"electricity",strom:"electricity","elektro strom":"electricity","strom elektro":"electricity",wasser:"water",gas:"gas",heizen:"heating",heizung:"heating",warme:"heating",waerme:"heating",kuhlen:"cooling",kuehlen:"cooling",kuhlung:"cooling",kuehlung:"cooling",kalte:"cooling",kaelte:"cooling"}[zr(r.name)]??null,Er=r=>/^symcon-category-(\d+)$/.exec(r??"")?.[1],no=r=>/\b(heute|tag|tagesverbrauch|today|daily)\b/.test(r)?"day":/monat|month/.test(r)?"month":/jahr|year/.test(r)?"year":"total",Tr=(r,e)=>String(r.states[e]?.attributes.symcon_source_entity||e);function sl(r){let e=String(r?.attributes.unit_of_measurement??"").trim(),t=e.replace(/[³]/g,"3").replace(/[²]/g,"2").replace(/\s+/g,"").toLowerCase();return["w","kw","mw"].includes(t)?{metric:"power",unit:"W",factor:e==="mW"?.001:t==="kw"?1e3:t==="mw"?1e6:1}:["wh","kwh","mwh","j","kj","mj","gj"].includes(t)?{metric:"energy",unit:"kWh",factor:{wh:.001,kwh:1,mwh:1e3,j:1/36e5,kj:1/3600,mj:1/3.6,gj:1e3/3.6}[t]}:["m3/h","m3h","m3/min","m3/s","l/h","l/min","l/s","liter/h","liter/min"].includes(t)?{metric:"power",unit:"m\xB3/h",factor:{"m3/h":1,m3h:1,"m3/min":60,"m3/s":3600,"l/h":.001,"l/min":.06,"l/s":3.6,"liter/h":.001,"liter/min":.06}[t]}:["m3","l","liter"].includes(t)?{metric:"energy",unit:"m\xB3",factor:t==="m3"?1:.001}:null}function Gh(r,e){if(!e.entity_id||e.object_type!==2&&e.object_type!==6)return null;let t=Tr(r,e.entity_id),n=r.states[t];if(!n||![1,2].includes(Number(n.attributes.symcon_variable_type)))return null;let i=zr(e.name),o=sl(n),s=/^(leistung|wirkleistung|gesamtleistung|aktuelle leistung|durchfluss|volumenstrom)(\b|$)/.test(i),a=/^(verbrauch|energie|energieverbrauch|gesamtverbrauch|gesamtenergie|zahlerstand|zaehlerstand|arbeit)(\b|$)/.test(i),l=o?.metric??(s?"power":a?"energy":null);if(!l)return null;let c=l==="power"?/^(leistung|wirkleistung|gesamtleistung|durchfluss|volumenstrom)$/.test(i):/^(verbrauch|energie|energieverbrauch|gesamtverbrauch|gesamtenergie|zahlerstand|zaehlerstand|arbeit)$/.test(i),u=l==="energy"?no(i):"total";return{metric:l,source:t,period:u,group:`${l}|${o?.unit??String(n.attributes.unit_of_measurement??"")}|${u}`,score:/^gesamt(leistung|verbrauch|energie)$/.test(i)?110:c?100:(l==="power"?s:a)?70:20}}var il=new WeakMap,ol=new WeakMap;function al(r){let e=il.get(r);if(e)return e;let t={nodes:new Map(r.map(n=>[n.object_id,n])),children:new Map};for(let n of r){let i=t.children.get(n.parent_id)??[];i.push(n),t.children.set(n.parent_id,i)}return il.set(r,t),t}function ro(r,e,t){if(!K(r))return[];let n=[e.area_id,...e.sub_areas??[]].map(Er).filter(m=>!!m);if(!n.length)return[];let i=new Set(t.filter(m=>m.id!==e.id).flatMap(m=>[m.area_id,...m.sub_areas??[]]).map(Er).filter(m=>!!m&&!n.includes(m))),o=`${n.join(",")}|${[...i].sort().join(",")}`,s=ol.get(r)??new Map;ol.set(r,s);let a=s.get(o);if(a)return a;let l=al(r.symconObjects),c=[],u=new Set,d=(m,h,g)=>{if(u.has(m)||i.has(String(m)))return;u.add(m);let _=l.nodes.get(m);if(!_)return;let b=Kh(_),v=b??h,S=new Set(b&&b!==h?[]:g),k=l.children.get(m)??[];if(v){let M=k.map(z=>Gh(r,z)).filter(z=>z!==null);for(let z of new Set(M.map(R=>R.group))){if(S.has(z))continue;let R=M.filter(E=>E.group===z),F=Math.max(...R.map(E=>E.score)),T=R.filter(E=>E.score===F);for(let E of F>=100?T.slice(0,1):T)c.push({kind:v,metric:E.metric,id:E.source,period:E.period});S.add(z)}}for(let M of k)(M.object_type===0||M.object_type===1)&&d(M.object_id,v,S)};for(let m of n)d(Number(m),null,new Set);return s.set(o,c),c}function It(r,e,t=!1){let n=new Map,i=new Set;for(let o of e){let s=Tr(r,o.id),a=`${o.kind}|${o.metric}|${s}`;if(i.has(a))continue;i.add(a);let l=r.states[s],c=sl(l),u=c?.metric===o.metric?c.unit:String(l?.attributes.unit_of_measurement??"").trim(),d=`${o.kind}|${o.metric}|${u}|${o.period}`,m=n.get(d)??{kind:o.kind,metric:o.metric,unit:u,value:null,period:o.period,sources:[],manual:t,incomplete:!1},h=We(l);h===null?m.incomplete=!0:m.value=(m.value??0)+h*(c?.metric===o.metric?c.factor:1),m.sources.push(s),n.set(d,m)}return[...n.values()]}function Rr(r,e){return Ie.flatMap(t=>["power","energy"].flatMap(n=>{let i=e.utility_meters?.[t]?.[n];if(!i||i==="none")return[];let o=Tr(r,i);return[{kind:t,metric:n,id:o,period:n==="energy"?no(zr(String(r.states[o]?.attributes.friendly_name??""))):"total"}]}))}function ll(r,e){return K(r)?It(r,Rr(r,e),!0):[]}function Ct(r,e,t=[]){let n=ll(r,e);return n.length?n:It(r,ro(r,e,t))}function io(r,e,t=e.rooms){if(!K(r))return[];let n=new Map;for(let
Line truncated
|
||||
<h4>${_n[e]} ${Te[e]}</h4>
|
||||
`]};customElements.get("nf-room-hvac")||customElements.define("nf-room-hvac",no);var Te={electricity:"Strom",water:"Wasser",gas:"Gas",heating:"Heizen",cooling:"K\xFChlen"},bn={electricity:"\u26A1",water:"\u{1F4A7}",gas:"\u{1F525}",heating:"\u2668",cooling:"\u2744"},Tr=r=>r.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/ß/g,"ss").replace(/[^a-z0-9]+/g," ").trim(),qh="{485D0419-BE97-4548-AA9C-C083EB82E61E}",Zh=r=>r.object_type!==0&&!(r.object_type===1&&r.module_id?.toUpperCase()===qh)?null:{elektro:"electricity",strom:"electricity","elektro strom":"electricity","strom elektro":"electricity",wasser:"water",gas:"gas",heizen:"heating",heizung:"heating",warme:"heating",waerme:"heating",kuhlen:"cooling",kuehlen:"cooling",kuhlung:"cooling",kuehlung:"cooling",kalte:"cooling",kaelte:"cooling"}[Tr(r.name)]??null,Rr=r=>/^symcon-category-(\d+)$/.exec(r??"")?.[1],io=r=>/\b(heute|tag|tagesverbrauch|today|daily)\b/.test(r)?"day":/monat|month/.test(r)?"month":/jahr|year/.test(r)?"year":"total",Dr=(r,e)=>String(r.states[e]?.attributes.symcon_source_entity||e);function cl(r){let e=String(r?.attributes.unit_of_measurement??"").trim(),t=e.replace(/[³]/g,"3").replace(/[²]/g,"2").replace(/\s+/g,"").toLowerCase();return["w","kw","mw"].includes(t)?{metric:"power",unit:"W",factor:e==="mW"?.001:t==="kw"?1e3:t==="mw"?1e6:1}:["wh","kwh","mwh","j","kj","mj","gj"].includes(t)?{metric:"energy",unit:"kWh",factor:{wh:.001,kwh:1,mwh:1e3,j:1/36e5,kj:1/3600,mj:1/3.6,gj:1e3/3.6}[t]}:["m3/h","m3h","m3/min","m3/s","l/h","l/min","l/s","liter/h","liter/min"].includes(t)?{metric:"power",unit:"m\xB3/h",factor:{"m3/h":1,m3h:1,"m3/min":60,"m3/s":3600,"l/h":.001,"l/min":.06,"l/s":3.6,"liter/h":.001,"liter/min":.06}[t]}:["m3","l","liter"].includes(t)?{metric:"energy",unit:"m\xB3",factor:t==="m3"?1:.001}:null}function Yh(r,e){if(!e.entity_id||e.object_type!==2&&e.object_type!==6)return null;let t=Dr(r,e.entity_id),n=r.states[t];if(!n||![1,2].includes(Number(n.attributes.symcon_variable_type)))return null;let i=Tr(e.name),o=cl(n),s=/^(leistung|wirkleistung|gesamtleistung|aktuelle leistung|durchfluss|volumenstrom)(\b|$)/.test(i),a=/^(verbrauch|energie|energieverbrauch|gesamtverbrauch|gesamtenergie|zahlerstand|zaehlerstand|arbeit)(\b|$)/.test(i),l=o?.metric??(s?"power":a?"energy":null);if(!l)return null;let c=l==="power"?/^(leistung|wirkleistung|gesamtleistung|durchfluss|volumenstrom)$/.test(i):/^(verbrauch|energie|energieverbrauch|gesamtverbrauch|gesamtenergie|zahlerstand|zaehlerstand|arbeit)$/.test(i),u=l==="energy"?io(i):"total";return{metric:l,source:t,period:u,group:`${l}|${o?.unit??String(n.attributes.unit_of_measurement??"")}|${u}`,score:/^gesamt(leistung|verbrauch|energie)$/.test(i)?110:c?100:(l==="power"?s:a)?70:20}}var al=new WeakMap,ll=new WeakMap;function ul(r){let e=al.get(r);if(e)return e;let t={nodes:new Map(r.map(n=>[n.object_id,n])),children:new Map};for(let n of r){let i=t.children.get(n.parent_id)??[];i.push(n),t.children.set(n.parent_id,i)}return al.set(r,t),t}function oo(r,e,t){if(!K(r))return[];let n=[e.area_id,...e.sub_areas??[]].map(Rr).filter(d=>!!d);if(!n.length)return[];let i=new Set(t.filter(d=>d.id!==e.id).flatMap(d=>[d.area_id,...d.sub_areas??[]]).map(Rr).filter(d=>!!d&&!n.includes(d))),o=`${n.join(",")}|${[...i].sort().join(",")}`,s=ll.get(r)??new Map;ll.set(r,s);let a=s.get(o);if(a)return a;let l=ul(r.symconObjects),c=[],u=new Set,m=(d,h,g)=>{if(u.has(d)||i.has(String(d)))return;u.add(d);let _=l.nodes.get(d);if(!_)return;let b=Zh(_),v=b??h,S=new Set(b&&b!==h?[]:g),k=l.children.get(d)??[];if(v){let M=k.map(z=>Yh(r,z)).filter(z=>z!==null);for(let z of new Set(M.map(R=>R.group))){if(S.has(z))continue;let R=M.filter(E=>E.group===z),F=Math.max(...R.map(E=>E.score)),T=R.filter(E=>E.score===F);for(let E of F>=100?T.slice(0,1):T)c.push({kind:v,metric:E.metric,id:E.source,period:E.period});S.add(z)}}for(let M of k)(M.object_type===0||M.object_type===1)&&m(M.object_id,v,S)};for(let d of n)m(Number(d),null,new Set);return s.set(o,c),c}function Ct(r,e,t=!1){let n=new Map,i=new Set;for(let o of e){let s=Dr(r,o.id),a=`${o.kind}|${o.metric}|${s}`;if(i.has(a))continue;i.add(a);let l=r.states[s],c=cl(l),u=c?.metric===o.metric?c.unit:String(l?.attributes.unit_of_measurement??"").trim(),m=`${o.kind}|${o.metric}|${u}|${o.period}`,d=n.get(m)??{kind:o.kind,metric:o.metric,unit:u,value:null,period:o.period,sources:[],manual:t,incomplete:!1},h=We(l);h===null?d.incomplete=!0:d.value=(d.value??0)+h*(c?.metric===o.metric?c.factor:1),d.sources.push(s),n.set(m,d)}return[...n.values()]}function zr(r,e){return Ie.flatMap(t=>["power","energy"].flatMap(n=>{let i=e.utility_meters?.[t]?.[n];if(!i||i==="none")return[];let o=Dr(r,i);return[{kind:t,metric:n,id:o,period:n==="energy"?io(Tr(String(r.states[o]?.attributes.friendly_name??""))):"total"}]}))}function dl(r,e){return K(r)?Ct(r,zr(r,e),!0):[]}function Nt(r,e,t=[]){let n=dl(r,e);return n.length?n:Ct(r,oo(r,e,t))}function so(r,e,t=e.rooms){if(!K(r))return[];let n=new Map;for(let
Line truncated
|
||||
<h4>${bn[e]} ${Te[e]}</h4>
|
||||
${this.readings.filter(t=>t.kind===e).map(t=>p`<div class="reading" title=${`${t.manual?"Eigener Z\xE4hler":"Bereichsz\xE4hler"}${t.incomplete?" \xB7 Err: Mindestens ein Wert fehlt; angezeigt wird die Summe der verf\xFCgbaren Werte.":""}
|
||||
${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states[n]?.attributes.friendly_name||n).join(`
|
||||
`)}`}>
|
||||
<span>${Nt(t)}${t.manual?p` <small>· Zähler</small>`:""}</span><b>${Fe(this.hass,t)}${G(this.hass,t.sources,`${Te[t.kind]} \xB7 ${Nt(t)}`)}</b>
|
||||
<span>${Ot(t)}${t.manual?p` <small>· Zähler</small>`:""}</span><b>${Fe(this.hass,t)}${G(this.hass,t.sources,`${Te[t.kind]} \xB7 ${Ot(t)}`)}</b>
|
||||
</div>`)}
|
||||
</section>`)}`}static styles=J`
|
||||
:host { display:block; color:var(--nf-text); font:inherit; }
|
||||
@@ -256,12 +256,12 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.reading span { color:var(--nf-muted,#aaa); }
|
||||
b { white-space:nowrap; font-variant-numeric:tabular-nums; }
|
||||
small { font-size:.85em; }
|
||||
`};customElements.get("nf-utility-report")||customElements.define("nf-utility-report",oo);var ee=(r,e)=>[r[0]-e[0],r[1]-e[1]],He=(r,e)=>[r[0]+e[0],r[1]+e[1]],we=(r,e)=>[r[0]*e,r[1]*e],ce=(r,e)=>r[0]*e[0]+r[1]*e[1],Be=(r,e)=>r[0]*e[1]-r[1]*e[0],Ve=r=>Math.hypot(r[0],r[1]),xe=r=>{let e=Ve(r)||1;return[r[0]/e,r[1]/e]},so=r=>[-r[1],r[0]],ao=r=>[r[1],-r[0]];function dl(r){let e=r.heightEnd!==void 0;return{...r,a:r.b,b:r.a,left:r.right,right:r.left,roomLeft:r.roomRight,roomRight:r.roomLeft,height:e?r.heightEnd:r.height,heightEnd:e?r.height:void 0}}function Uh(r,e){let t=r.map(n=>({...n}));for(let n of e){let i=t.find(o=>o.room_id===n.room_id&&o.edge===n.edge&&(Math.abs(o.t1-n.t0)<1e-6||Math.abs(n.t1-o.t0)<1e-6));i?(i.t0=Math.min(i.t0,n.t0),i.t1=Math.max(i.t1,n.t1)):t.push({...n})}return t}function jh(r,e,t){if(r.a===e.b)return!1;let n=xe(ee(t[r.b],t[r.a])),i=xe(ee(t[e.b],t[e.a]));return Math.abs(Be(n,i))>1e-6||ce(n,i)<=0||r.free||e.free||r.heightEnd!==void 0||e.heightEnd!==void 0?!1:r.height===e.height&&r.exterior===e.exterior&&r.roomLeft===e.roomLeft&&r.roomRight===e.roomRight&&Math.abs(r.left-e.left)<=1e-9&&Math.abs(r.right-e.right)<=1e-9}function hl(r,e,t=new Set){let n=r.slice();for(;;){let i=new Map;n.forEach((s,a)=>{for(let l of[s.a,s.b])i.set(l,[...i.get(l)??[],a])});let o=null;for(let[s,a]of i){if(a.length!==2||t.has(s))continue;let l=n[a[0]].b===s?n[a[0]]:dl(n[a[0]]),c=n[a[1]].a===s?n[a[1]]:dl(n[a[1]]);if(!jh(l,c,e))continue;let u={...l,b:c.b,sources:Uh(l.sources,c.sources)};o=[...n.filter((d,m)=>m!==a[0]&&m!==a[1]),u];break}if(!o)return n;n=o}}function ml(r,e){let t=new Map;r.forEach((i,o)=>{let s=xe(ee(e[i.b],e[i.a])),a=[[i.a,{key:`${o}:a`,d:s,left:i.left,right:i.right,angle:Math.atan2(s[1],s[0])}],[i.b,{key:`${o}:b`,d:we(s,-1),left:i.right,right:i.left,angle:Math.atan2(-s[1],-s[0])}]];for(let[l,c]of a)t.set(l,[...t.get(l)??[],c])});let n=new Map;for(let[i,o]of t){let s=e[i];o.sort((l,c)=>l.angle-c.angle);for(let l of o)n.set(l.key,{left:He(s,we(so(l.d),l.left)),right:He(s,we(ao(l.d),l.right))});if(o.length<2)continue;let a=4*Math.max(...o.map(l=>Math.max(l.left,l.right)))+1e-9;o.forEach((l,c)=>{let u=o[(c+1)%o.length],d=He(s,we(so(l.d),l.left)),m=He(s,we(ao(u.d),u.right)),h=Be(l.d,u.d);if(Math.abs(h)<1e-4)return;let g=He(d,we(l.d,Be(ee(m,d),u.d)/h));Ve(ee(g,s))>a||(n.get(l.key).left=g,n.get(u.key).right=g)})}return n}function pl(r,e){let t=r.filter((n,i)=>Ve(ee(n,r[(i+1)%r.length]))>e);for(;;){if(t.length<=3)return t;let n=t.findIndex((i,o)=>{let s=t[(o+t.length-1)%t.length],a=t[(o+1)%t.length],[l,c]=[ee(i,s),ee(a,i)];return Math.abs(Be(xe(l),xe(c)))<1e-7&&ce(l,c)>0});if(n===-1)return t;t=t.filter((i,o)=>o!==n)}}function qh(r){let e=[];return{points:e,idOf(t){let n=e.findIndex(i=>Math.abs(i[0]-t[0])<=r&&Math.abs(i[1]-t[1])<=r);return n>=0?n:(e.push([t[0],t[1]]),e.length-1)}}}function Zh(r,e){let t=[];for(let n of r){let i=n.points;if(i.length<3||Math.abs(mt(i))<1e-6)continue;let o=mt(i)>0,s=i.map(a=>e.idOf(a));s.forEach((a,l)=>{let c=s[(l+1)%s.length];a!==c&&t.push(o?{u:a,v:c,room:n.id,edge:l,forward:!0}:{u:c,v:a,room:n.id,edge:l,forward:!1})})}return t}function Yh(r,e,t){let n=[];for(let i of r){let[o,s]=[e[i.u],e[i.v]],a=ee(s,o),l=Ve(a),c=we(a,1/l),u=e.map((m,h)=>({id:h,rel:ee(m,o)})).filter(({id:m,rel:h})=>m!==i.u&&m!==i.v&&ce(h,c)>t&&ce(h,c)<l-t&&Math.abs(Be(c,h))<=t).map(({id:m,rel:h})=>({t:ce(h,c),id:m})).sort((m,h)=>m.t-h.t),d=[{t:0,id:i.u},...u,{t:l,id:i.v}];for(let m=0;m+1<d.length;m++){let[h,g]=[d[m],d[m+1]];n.push({u:h.id,v:g.id,room:i.room,edge:i.edge,t0:i.forward?h.t:l-g.t,t1:i.forward?g.t:l-h.t,forward:i.forward})}}return n}var fl=r=>({room_id:r.room,edge:r.edge,t0:r.t0,t1:r.t1});function Jh(r,e){let t=new Map(r.map(a=>[a.id,a])),n=new Map;for(let a of e){let l=`${a.room}:${a.edge}`;n.set(l,[...n.get(l)??[],a.t0].sort((c,u)=>c-u))}let i=a=>{let l=t.get(a.room)?.wall_heights?.[a.edge];return Array.isArray(l)?l[(n.get(`${a.room}:${a.edge}`)??[]).indexOf(a.t0)]??null:l},o=a=>{let l=t.get(a.room),[c,u]=[l?.wall_heights?.[a.edge],l?.wall_slopes?.[a.edge]];if(!l||typeof c!="number"||typeof u!="number"||c<=0||u<=0)return null;let[d,m]=[l.points[a.edge],l.points[(a.edge+1)%l.points.length]];return{from:c,to:u,length:Math.hypot(m[0]-d[0],m[1]-d[1])}},s=a=>{let l=o(a);if(!l||l.length<1e-9){let u=i(a);return typeof u=="number"&&u>0?[u,u]:[null,null]}let c=u=>l.from+(l.to-l.from)*u/l.length;return a.forward?[c(a.t0),c(a.t1)]:[c(a.t1),c(a.t0)]};return{heightsOf(a){let[l,c]=[1/0,1/0];for(let d of a){let[m,h]=s(d),[g,_]=d===a[0]?[m,h]:[h,m];g!==null&&(l=Math.min(l,g)),_!==null&&(c=Math.min(c,_))}let u=a.map(d=>t.get(d.room)?.ceiling);if(u.every(d=>typeof d=="number"&&d>0)){let d=Math.max(...u);l===1/0&&(l=d),c===1/0&&(c=d)}return{...l<1/0?{a:l}:{},...c<1/0?{b:c}:{}}},thicknessOf(a){let l=a.map(c=>{let u=t.get(c.room)?.wall_thickness?.[c.edge];return Array.isArray(u)?u[(n.get(`${c.room}:${c.edge}`)??[]).indexOf(c.t0)]:u}).filter(c=>typeof c=="number"&&c>0);return l.length?Math.max(...l):void 0},hasNo
Line truncated
|
||||
<path d=${xr(r)} />
|
||||
</svg>`,Lr={previous:"M6 6h2v12H6zM20 6v12l-10-6z",play:"M8 5v14l11-7z",pause:"M7 5h4v14H7zM13 5h4v14h-4z",next:"M16 6h2v12h-2zM4 6v12l10-6z"},po=r=>p`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d=${r} /></svg>`,Nm=24,Lm=10,fo=class extends Q{static properties={hass:{attribute:!1},room:{attribute:!1},floor:{attribute:!1},confirmEntities:{attribute:!1},phrases:{attribute:!1},outside:{attribute:!1},_showAll:{state:!0},_said:{state:!0},_folded:{state:!0},_curve:{state:!0},_moodName:{state:!0},_undo:{state:!0},_energy:{state:!0},_sunYear:{state:!0},rooms:{attribute:!1},building:{attribute:!1}};saidTimer;memo=null;curveFor="";undoTimer;constructor(){super(),this.room=null,this.floor=null,this.phrases=null,this.outside=null,this._said=null,this._showAll=!1,this._folded=!1,this._curve=null,this._moodName=null,this._undo=null,this._energy=null,this._sunYear=!1,this.rooms=null,this.building=null}fireMoods(e,t){this.dispatchEvent(new CustomEvent("mood-change",{detail:{roomId:e.id,moods:t},bubbles:!0,composed:!0}))}runMood(e){for(let t of Nr(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=>U(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(Cr)}]),this._moodName=null};return p`<div class="nf-rp-moods">
|
||||
`};customElements.get("nf-utility-report")||customElements.define("nf-utility-report",ao);var ee=(r,e)=>[r[0]-e[0],r[1]-e[1]],He=(r,e)=>[r[0]+e[0],r[1]+e[1]],we=(r,e)=>[r[0]*e,r[1]*e],ce=(r,e)=>r[0]*e[0]+r[1]*e[1],Be=(r,e)=>r[0]*e[1]-r[1]*e[0],Ve=r=>Math.hypot(r[0],r[1]),xe=r=>{let e=Ve(r)||1;return[r[0]/e,r[1]/e]},lo=r=>[-r[1],r[0]],co=r=>[r[1],-r[0]];function pl(r){let e=r.heightEnd!==void 0;return{...r,a:r.b,b:r.a,left:r.right,right:r.left,roomLeft:r.roomRight,roomRight:r.roomLeft,height:e?r.heightEnd:r.height,heightEnd:e?r.height:void 0}}function Jh(r,e){let t=r.map(n=>({...n}));for(let n of e){let i=t.find(o=>o.room_id===n.room_id&&o.edge===n.edge&&(Math.abs(o.t1-n.t0)<1e-6||Math.abs(n.t1-o.t0)<1e-6));i?(i.t0=Math.min(i.t0,n.t0),i.t1=Math.max(i.t1,n.t1)):t.push({...n})}return t}function Qh(r,e,t){if(r.a===e.b)return!1;let n=xe(ee(t[r.b],t[r.a])),i=xe(ee(t[e.b],t[e.a]));return Math.abs(Be(n,i))>1e-6||ce(n,i)<=0||r.free||e.free||r.heightEnd!==void 0||e.heightEnd!==void 0?!1:r.height===e.height&&r.exterior===e.exterior&&r.roomLeft===e.roomLeft&&r.roomRight===e.roomRight&&Math.abs(r.left-e.left)<=1e-9&&Math.abs(r.right-e.right)<=1e-9}function fl(r,e,t=new Set){let n=r.slice();for(;;){let i=new Map;n.forEach((s,a)=>{for(let l of[s.a,s.b])i.set(l,[...i.get(l)??[],a])});let o=null;for(let[s,a]of i){if(a.length!==2||t.has(s))continue;let l=n[a[0]].b===s?n[a[0]]:pl(n[a[0]]),c=n[a[1]].a===s?n[a[1]]:pl(n[a[1]]);if(!Qh(l,c,e))continue;let u={...l,b:c.b,sources:Jh(l.sources,c.sources)};o=[...n.filter((m,d)=>d!==a[0]&&d!==a[1]),u];break}if(!o)return n;n=o}}function gl(r,e){let t=new Map;r.forEach((i,o)=>{let s=xe(ee(e[i.b],e[i.a])),a=[[i.a,{key:`${o}:a`,d:s,left:i.left,right:i.right,angle:Math.atan2(s[1],s[0])}],[i.b,{key:`${o}:b`,d:we(s,-1),left:i.right,right:i.left,angle:Math.atan2(-s[1],-s[0])}]];for(let[l,c]of a)t.set(l,[...t.get(l)??[],c])});let n=new Map;for(let[i,o]of t){let s=e[i];o.sort((l,c)=>l.angle-c.angle);for(let l of o)n.set(l.key,{left:He(s,we(lo(l.d),l.left)),right:He(s,we(co(l.d),l.right))});if(o.length<2)continue;let a=4*Math.max(...o.map(l=>Math.max(l.left,l.right)))+1e-9;o.forEach((l,c)=>{let u=o[(c+1)%o.length],m=He(s,we(lo(l.d),l.left)),d=He(s,we(co(u.d),u.right)),h=Be(l.d,u.d);if(Math.abs(h)<1e-4)return;let g=He(m,we(l.d,Be(ee(d,m),u.d)/h));Ve(ee(g,s))>a||(n.get(l.key).left=g,n.get(u.key).right=g)})}return n}function _l(r,e){let t=r.filter((n,i)=>Ve(ee(n,r[(i+1)%r.length]))>e);for(;;){if(t.length<=3)return t;let n=t.findIndex((i,o)=>{let s=t[(o+t.length-1)%t.length],a=t[(o+1)%t.length],[l,c]=[ee(i,s),ee(a,i)];return Math.abs(Be(xe(l),xe(c)))<1e-7&&ce(l,c)>0});if(n===-1)return t;t=t.filter((i,o)=>o!==n)}}function Xh(r){let e=[];return{points:e,idOf(t){let n=e.findIndex(i=>Math.abs(i[0]-t[0])<=r&&Math.abs(i[1]-t[1])<=r);return n>=0?n:(e.push([t[0],t[1]]),e.length-1)}}}function em(r,e){let t=[];for(let n of r){let i=n.points;if(i.length<3||Math.abs(mt(i))<1e-6)continue;let o=mt(i)>0,s=i.map(a=>e.idOf(a));s.forEach((a,l)=>{let c=s[(l+1)%s.length];a!==c&&t.push(o?{u:a,v:c,room:n.id,edge:l,forward:!0}:{u:c,v:a,room:n.id,edge:l,forward:!1})})}return t}function tm(r,e,t){let n=[];for(let i of r){let[o,s]=[e[i.u],e[i.v]],a=ee(s,o),l=Ve(a),c=we(a,1/l),u=e.map((d,h)=>({id:h,rel:ee(d,o)})).filter(({id:d,rel:h})=>d!==i.u&&d!==i.v&&ce(h,c)>t&&ce(h,c)<l-t&&Math.abs(Be(c,h))<=t).map(({id:d,rel:h})=>({t:ce(h,c),id:d})).sort((d,h)=>d.t-h.t),m=[{t:0,id:i.u},...u,{t:l,id:i.v}];for(let d=0;d+1<m.length;d++){let[h,g]=[m[d],m[d+1]];n.push({u:h.id,v:g.id,room:i.room,edge:i.edge,t0:i.forward?h.t:l-g.t,t1:i.forward?g.t:l-h.t,forward:i.forward})}}return n}var bl=r=>({room_id:r.room,edge:r.edge,t0:r.t0,t1:r.t1});function nm(r,e){let t=new Map(r.map(a=>[a.id,a])),n=new Map;for(let a of e){let l=`${a.room}:${a.edge}`;n.set(l,[...n.get(l)??[],a.t0].sort((c,u)=>c-u))}let i=a=>{let l=t.get(a.room)?.wall_heights?.[a.edge];return Array.isArray(l)?l[(n.get(`${a.room}:${a.edge}`)??[]).indexOf(a.t0)]??null:l},o=a=>{let l=t.get(a.room),[c,u]=[l?.wall_heights?.[a.edge],l?.wall_slopes?.[a.edge]];if(!l||typeof c!="number"||typeof u!="number"||c<=0||u<=0)return null;let[m,d]=[l.points[a.edge],l.points[(a.edge+1)%l.points.length]];return{from:c,to:u,length:Math.hypot(d[0]-m[0],d[1]-m[1])}},s=a=>{let l=o(a);if(!l||l.length<1e-9){let u=i(a);return typeof u=="number"&&u>0?[u,u]:[null,null]}let c=u=>l.from+(l.to-l.from)*u/l.length;return a.forward?[c(a.t0),c(a.t1)]:[c(a.t1),c(a.t0)]};return{heightsOf(a){let[l,c]=[1/0,1/0];for(let m of a){let[d,h]=s(m),[g,_]=m===a[0]?[d,h]:[h,d];g!==null&&(l=Math.min(l,g)),_!==null&&(c=Math.min(c,_))}let u=a.map(m=>t.get(m.room)?.ceiling);if(u.every(m=>typeof m=="number"&&m>0)){let m=Math.max(...u);l===1/0&&(l=m),c===1/0&&(c=m)}return{...l<1/0?{a:l}:{},...c<1/0?{b:c}:{}}},thicknessOf(a){let l=a.map(c=>{let u=t.get(c.room)?.wall_thickness?.[c.edge];return Array.isArray(u)?u[(n.get(`${c.room}:${c.edge}`)??[]).indexOf(c.t0)]:u}).filter(c=>typeof c=="number"&&c>0);return l.length?Math.max(...l):void 0},hasNo
Line truncated
|
||||
<path d=${kr(r)} />
|
||||
</svg>`,Lr={previous:"M6 6h2v12H6zM20 6v12l-10-6z",play:"M8 5v14l11-7z",pause:"M7 5h4v14H7zM13 5h4v14h-4z",next:"M16 6h2v12h-2zM4 6v12l10-6z"},go=r=>p`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d=${r} /></svg>`,Vm=24,Km=10,_o=class extends Q{static properties={hass:{attribute:!1},room:{attribute:!1},floor:{attribute:!1},confirmEntities:{attribute:!1},phrases:{attribute:!1},outside:{attribute:!1},_showAll:{state:!0},_said:{state:!0},_folded:{state:!0},_curve:{state:!0},_moodName:{state:!0},_undo:{state:!0},_energy:{state:!0},_sunYear:{state:!0},rooms:{attribute:!1},building:{attribute:!1}};saidTimer;memo=null;curveFor="";undoTimer;constructor(){super(),this.room=null,this.floor=null,this.phrases=null,this.outside=null,this._said=null,this._showAll=!1,this._folded=!1,this._curve=null,this._moodName=null,this._undo=null,this._energy=null,this._sunYear=!1,this.rooms=null,this.building=null}fireMoods(e,t){this.dispatchEvent(new CustomEvent("mood-change",{detail:{roomId:e.id,moods:t},bubbles:!0,composed:!0}))}runMood(e){for(let t of Or(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=>U(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(Nr)}]),this._moodName=null};return p`<div class="nf-rp-moods">
|
||||
${n.map(l=>p`<span class="nf-rp-mood">
|
||||
<button class="nf-btn" title=${this.t("mood_set")} @click=${()=>this.runMood(l.lights)}>✨ ${l.name}</button>
|
||||
${o.length?p`<select class="nf-rp-mood-to" aria-label=${this.t("mood_carry")} title=${this.t("mood_carry")} @change=${c=>{let u=c.target,d=o.find(m=>m.id===u.value);u.value="",d&&this.runMood(Zl(l,s(d)))}}>
|
||||
${o.length?p`<select class="nf-rp-mood-to" aria-label=${this.t("mood_carry")} title=${this.t("mood_carry")} @change=${c=>{let u=c.target,m=o.find(d=>d.id===u.value);u.value="",m&&this.runMood(Ql(l,s(m)))}}>
|
||||
<option value="">→</option>
|
||||
${o.map(c=>p`<option value=${c.id}>${c.name}</option>`)}
|
||||
</select>`:f}
|
||||
@@ -271,33 +271,33 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
><input type="text" maxlength="40" placeholder=${this.t("mood_new")} .value=${this._moodName} @input=${l=>this._moodName=l.target.value} @keydown=${l=>l.key==="Enter"&&a()} />
|
||||
<button class="nf-btn" @click=${a}>${this.t("mood_save")}</button></span
|
||||
>`:f}
|
||||
</div>`}async loadCurve(e){let t=ge(this.hass,this.floor,e,"temperature"),n=t.length?t:U(this.hass,e).filter(s=>s.startsWith("climate."));if(!n.length)return;let i=Date.now(),o=i-24*36e5;try{let s=await $n(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=Bt(this.hass,s,o+(i-o)*l/96),u=n.map(d=>d.startsWith("climate.")?Number(c.states[d]?.attributes.current_temperature):Number(c.states[d]?.state)).filter(Number.isFinite);a.push(u.length?u.reduce((d,m)=>d+m,0)/u.length:null)}this._curve=a.some(l=>l!==null)?a:null}catch{this._curve=null}}async loadEnergy(e){if(!this.floor||!this.building)return;if(K(this.hass)){this._energy=null;return}let t=ho(this.hass,this.building,this.floor,e);try{let n=await Ol(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=U(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<Lm?f:p`<div class="nf-rp-shade">
|
||||
</div>`}async loadCurve(e){let t=ge(this.hass,this.floor,e,"temperature"),n=t.length?t:U(this.hass,e).filter(s=>s.startsWith("climate."));if(!n.length)return;let i=Date.now(),o=i-24*36e5;try{let s=await Mn(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=Vt(this.hass,s,o+(i-o)*l/96),u=n.map(m=>m.startsWith("climate.")?Number(c.states[m]?.attributes.current_temperature):Number(c.states[m]?.state)).filter(Number.isFinite);a.push(u.length?u.reduce((m,d)=>m+d,0)/u.length:null)}this._curve=a.some(l=>l!==null)?a:null}catch{this._curve=null}}async loadEnergy(e){if(!this.floor||!this.building)return;if(K(this.hass)){this._energy=null;return}let t=po(this.hass,this.building,this.floor,e);try{let n=await Vl(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=U(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<Km?f:p`<div class="nf-rp-shade">
|
||||
<span>💡 ${this.t("empty_lights_hint",{n:t.length,min:o})}</span>
|
||||
<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_off",{entity_id:t.map(s=>s.entity_id)})}>${this.t("empty_lights_off")}</button>
|
||||
</div>`}renderOpenWhileHeating(e){let t=this.room;if(!t||!this.floor)return f;let n=e.filter(a=>a.attributes.hvac_action==="heating"||a.state==="heat"&&a.attributes.hvac_action===void 0);if(!n.length)return f;let i=a=>!!a&&a!=="none"&&this.hass.states[a]?.state==="on",o=this.floor.openings.filter(a=>a.room_id===t.id&&[a.contact,a.contact2,a.tilt,a.tilt2].some(i));if(!o.length)return f;let s=()=>{for(let a of n)(a.attributes.hvac_modes??[]).includes("off")?this.call("climate","set_hvac_mode",{entity_id:a.entity_id,hvac_mode:"off"}):typeof a.attributes.min_temp=="number"&&this.call("climate","set_temperature",{entity_id:a.entity_id,temperature:a.attributes.min_temp})};return p`<div class="nf-rp-shade nf-rp-open-heat">
|
||||
<span>🪟 ${this.t("open_heating_hint",{n:o.length})}</span>
|
||||
<button class="nf-btn nf-rp-small" @click=${s}>${this.t("open_heating_off")}</button>
|
||||
</div>`}renderShade(){let e=this.room,{latitude:t,longitude:n}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||n===void 0)return f;let i=Z(this.hass,this.floor,e,"temperature");if(i===null||i<Nm)return f;let o=a=>{let l=a&&a!=="none"?this.hass.states[a]:void 0;if(!l||C(l))return!1;let c=l.attributes.current_position;return typeof c=="number"?c>30:l.state==="open"},s=[...new Set(Fl(this.building,this.floor,e,{latitude:t,longitude:n}).flatMap(a=>[a.cover,a.cover2].filter(o)))];return s.length?p`<div class="nf-rp-shade">
|
||||
<span>☀ ${this.t("shade_hint",{n:s.length,temp:`${L(this.hass,le(this.hass,i),1)} ${re(this.hass)}`})}</span>
|
||||
</div>`}renderShade(){let e=this.room,{latitude:t,longitude:n}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||n===void 0)return f;let i=Z(this.hass,this.floor,e,"temperature");if(i===null||i<Vm)return f;let o=a=>{let l=a&&a!=="none"?this.hass.states[a]:void 0;if(!l||C(l))return!1;let c=l.attributes.current_position;return typeof c=="number"?c>30:l.state==="open"},s=[...new Set(Il(this.building,this.floor,e,{latitude:t,longitude:n}).flatMap(a=>[a.cover,a.cover2].filter(o)))];return s.length?p`<div class="nf-rp-shade">
|
||||
<span>☀ ${this.t("shade_hint",{n:s.length,temp:`${O(this.hass,le(this.hass,i),1)} ${re(this.hass)}`})}</span>
|
||||
<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:s})}>${this.t("shade_close")}</button>
|
||||
</div>`:f}renderSunYear(){let e=this.room,{latitude:t,longitude:n}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||n===void 0)return f;let i={latitude:t,longitude:n};if(!Ot(this.building,this.floor,e,{...i,zone:this.hass.config?.time_zone}).facing.length)return f;let s=p`<button class="nf-rp-sun-year" aria-expanded=${this._sunYear} title=${this.t("room_sun_year_hint")} @click=${()=>this._sunYear=!this._sunYear}>
|
||||
</div>`:f}renderSunYear(){let e=this.room,{latitude:t,longitude:n}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||n===void 0)return f;let i={latitude:t,longitude:n};if(!Wt(this.building,this.floor,e,{...i,zone:this.hass.config?.time_zone}).facing.length)return f;let s=p`<button class="nf-rp-sun-year" aria-expanded=${this._sunYear} title=${this.t("room_sun_year_hint")} @click=${()=>this._sunYear=!this._sunYear}>
|
||||
☀ ${this.t("room_sun_year")}
|
||||
</button>`;if(!this._sunYear)return s;let a=Dl(this.building,this.floor,e,i),l=Math.max(1,...a),c=Array.from({length:12},(u,d)=>new Date(2026,d,15).toLocaleDateString(this.hass.language,{month:"narrow"}));return p`${s}
|
||||
<div class="nf-rp-sun-bars" role="img" aria-label=${a.map((u,d)=>`${c[d]} ${L(this.hass,u,1)} h`).join(", ")}>
|
||||
${a.map((u,d)=>p`<span title=${`${L(this.hass,u,1)} h`}><i style=${`height:${Math.round(u/l*100)}%`}></i><b>${c[d]}</b></span>`)}
|
||||
</div>`}renderEnergy(){let e=this._energy;if(!e||e.month<=0)return f;let t=this.building?.energy.tariff,n=t?this.hass.states[t]:void 0,i=n?{value:Number(n.state),unit:String(n.attributes.unit_of_measurement??"")}:null,o=Wl(e.month,i),s=a=>`${L(this.hass,a,a<10?2:1)} kWh`;return p`<p class="nf-rp-facts nf-rp-energy" title=${this.t("room_energy_hint")}>
|
||||
⚡ ${this.t("room_energy",{today:s(e.today),month:s(e.month)})}${o?` \xB7 ${L(this.hass,o.value,2)} ${o.currency}`:""}
|
||||
</p>`}renderCurve(){let e=this._curve;if(!e)return f;let t=e.filter(c=>c!==null),n=Math.min(...t),i=Math.max(...t),o=Math.max(1,i-n),s=e.map(c=>c===null?null:c-n+o*.1),a=Mn(s,220,36,o*1.2),l=c=>`${L(this.hass,le(this.hass,c),1)}\xB0`;return p`<div class="nf-rp-curve" title=${this.t("room_curve_hint")}>
|
||||
</button>`;if(!this._sunYear)return s;let a=Pl(this.building,this.floor,e,i),l=Math.max(1,...a),c=Array.from({length:12},(u,m)=>new Date(2026,m,15).toLocaleDateString(this.hass.language,{month:"narrow"}));return p`${s}
|
||||
<div class="nf-rp-sun-bars" role="img" aria-label=${a.map((u,m)=>`${c[m]} ${O(this.hass,u,1)} h`).join(", ")}>
|
||||
${a.map((u,m)=>p`<span title=${`${O(this.hass,u,1)} h`}><i style=${`height:${Math.round(u/l*100)}%`}></i><b>${c[m]}</b></span>`)}
|
||||
</div>`}renderEnergy(){let e=this._energy;if(!e||e.month<=0)return f;let t=this.building?.energy.tariff,n=t?this.hass.states[t]:void 0,i=n?{value:Number(n.state),unit:String(n.attributes.unit_of_measurement??"")}:null,o=Kl(e.month,i),s=a=>`${O(this.hass,a,a<10?2:1)} kWh`;return p`<p class="nf-rp-facts nf-rp-energy" title=${this.t("room_energy_hint")}>
|
||||
⚡ ${this.t("room_energy",{today:s(e.today),month:s(e.month)})}${o?` \xB7 ${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=An(s,220,36,o*1.2),l=c=>`${O(this.hass,le(this.hass,c),1)}\xB0`;return p`<div class="nf-rp-curve" title=${this.t("room_curve_hint")}>
|
||||
<svg viewBox="0 0 220 36" preserveAspectRatio="none" aria-hidden="true">${ne`<path d=${a}></path>`}</svg>
|
||||
<span>24 h · ${l(n)} – ${l(i)}</span>
|
||||
</div>`}willUpdate(e){let t=e.get("room");e.has("room")&&t?.id!==this.room?.id&&(this._folded=!1,this._undo=null),this.room&&this.hass&&this.curveFor!==this.room.id&&(this.curveFor=this.room.id,this._curve=null,this._energy=null,this.loadCurve(this.room),this.loadEnergy(this.room))}updated(e){e.has("_folded")&&this.toggleAttribute("folded",this._folded)}t(e,t){return $(this.hass,e,t)}call(e,t,n){this.hass.callService(e,t,n)}renderClean(e){let t=e.clean_entity,n=t?this.hass.states[t]:void 0;if(!t||!n)return f;let i=t.slice(0,t.indexOf(".")),o=()=>i==="script"?this.call("script","turn_on",{entity_id:t}):this.call(i,"press",{entity_id:t});return p`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" ?disabled=${C(n)} title=${this.t("room_clean_run_hint")} @click=${o}>🧹 ${this.t("room_clean_run")}</button></div>`}allOff(e){let t=Sn(e);for(let n of t.off)this.call(n.domain,n.service,n.data);this._undo=t.undo,clearTimeout(this.undoTimer),this.undoTimer=setTimeout(()=>this._undo=null,1e4)}undoAllOff(){for(let e of this._undo??[])this.call(e.domain,e.service,e.data);this._undo=null,clearTimeout(this.undoTimer)}renderAllOff(e){if(this._undo)return p`<div class="nf-rp-alloff"><span>${this.t("all_off_done")}</span><button class="nf-btn nf-rp-small" @click=${()=>this.undoAllOff()}>↶ ${this.t("all_off_undo")}</button></div>`;let{count:t}=Sn(e);return t<2?f:p`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" title=${this.t("all_off_hint")} @click=${()=>this.allOff(e)}>⏻ ${this.t("all_off_n",{n:t})}</button></div>`}get areaName(){return this.room?.area_id?this.hass.areas?.[this.room.area_id]?.name:void 0}placedAs(e){for(let t of this.building?.floors??[])for(let n of t.placements)if(n.entity_id===e)return n}name(e){return this.placedAs(e)?.name?.trim()||O(this.hass,e,this.areaName)}nameButton(e){return p`<button class="nf-rp-name" title=${this.t("details")} @click=${()=>ye(this,e)}>${this.name(e)}</button>`}askFor(e){return!this.confirmEntities?.has(e)||confirm(this.t("confirm_switch",{name:this.name(e)}))}toggle(e,t,n){let i=()=>{this.confirmEntities?.has(e.entity_id)&&!confirm(this.t("confirm_switch",{name:this.name(e.entity_id)}))||n()};return p`<button
|
||||
</div>`}willUpdate(e){let t=e.get("room");e.has("room")&&t?.id!==this.room?.id&&(this._folded=!1,this._undo=null),this.room&&this.hass&&this.curveFor!==this.room.id&&(this.curveFor=this.room.id,this._curve=null,this._energy=null,this.loadCurve(this.room),this.loadEnergy(this.room))}updated(e){e.has("_folded")&&this.toggleAttribute("folded",this._folded)}t(e,t){return $(this.hass,e,t)}call(e,t,n){this.hass.callService(e,t,n)}renderClean(e){let t=e.clean_entity,n=t?this.hass.states[t]:void 0;if(!t||!n)return f;let i=t.slice(0,t.indexOf(".")),o=()=>i==="script"?this.call("script","turn_on",{entity_id:t}):this.call(i,"press",{entity_id:t});return p`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" ?disabled=${C(n)} title=${this.t("room_clean_run_hint")} @click=${o}>🧹 ${this.t("room_clean_run")}</button></div>`}allOff(e){let t=$n(e);for(let n of t.off)this.call(n.domain,n.service,n.data);this._undo=t.undo,clearTimeout(this.undoTimer),this.undoTimer=setTimeout(()=>this._undo=null,1e4)}undoAllOff(){for(let e of this._undo??[])this.call(e.domain,e.service,e.data);this._undo=null,clearTimeout(this.undoTimer)}renderAllOff(e){if(this._undo)return p`<div class="nf-rp-alloff"><span>${this.t("all_off_done")}</span><button class="nf-btn nf-rp-small" @click=${()=>this.undoAllOff()}>↶ ${this.t("all_off_undo")}</button></div>`;let{count:t}=$n(e);return t<2?f:p`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" title=${this.t("all_off_hint")} @click=${()=>this.allOff(e)}>⏻ ${this.t("all_off_n",{n:t})}</button></div>`}get areaName(){return this.room?.area_id?this.hass.areas?.[this.room.area_id]?.name:void 0}placedAs(e){for(let t of this.building?.floors??[])for(let n of t.placements)if(n.entity_id===e)return n}name(e){return this.placedAs(e)?.name?.trim()||L(this.hass,e,this.areaName)}nameButton(e){return p`<button class="nf-rp-name" title=${this.t("details")} @click=${()=>ye(this,e)}>${this.name(e)}</button>`}askFor(e){return!this.confirmEntities?.has(e)||confirm(this.t("confirm_switch",{name:this.name(e)}))}toggle(e,t,n){let i=()=>{this.confirmEntities?.has(e.entity_id)&&!confirm(this.t("confirm_switch",{name:this.name(e.entity_id)}))||n()};return p`<button
|
||||
class="nf-switch"
|
||||
role="switch"
|
||||
aria-checked=${t?"true":"false"}
|
||||
aria-label=${this.name(e.entity_id)}
|
||||
?disabled=${C(e)}
|
||||
@click=${i}
|
||||
></button>`}outsideRoom=null;render(){let e=!this.room&&this.outside?this.outside:null;e&&!this.outsideRoom&&(this.outsideRoom={id:"nf-outside",name:this.t("outside_area"),area_id:null,points:[],floor_material:"grass"});let t=this.room??(e?this.outsideRoom:null);if(!t||!this.hass)return f;let n=e??U(this.hass,t),i=this.memo,{shown:o,more:s}=e?{shown:e,more:[]}:i&&i.entities===this.hass.entities&&i.floor===this.floor&&i.room===t?i:this.memo={entities:this.hass.entities,floor:this.floor,room:t,...this.floor?$a(this.hass,this.floor,t):{shown:n,more:[]}},a=Ni(this.hass,s).map(R=>R.primary),l=a.length,c=[t.floor_heating,...Object.values(t.hvac??{}).flat()].filter(R=>!!R&&R!=="none"),u=new Set(c.map(R=>this.hass.states[R]?.attributes.symcon_id).filter(Boolean)),d=(this._showAll?[...o,...a]:o).filter(R=>!K(this.hass)||!u.has(this.hass.states[R]?.attributes.symcon_id)),m=R=>d.filter(F=>R.includes(H(F))).map(F=>this.hass.states[F]),h=m(["light"]),g=m(["cover"]),_=m(["climate"]),b=m(["media"]),v=m(["switch","fan","lock"]),S=m(["sensor","binary"]),k=m(["scene","script"]),M=this.facts(_),z=h.filter(R=>R.state==="on");return p`<section class="nf-rp" aria-label=${t.name}>
|
||||
></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??U(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?Ea(this.hass,this.floor,t):{shown:n,more:[]}},a=Li(this.hass,s).map(R=>R.primary),l=a.length,c=[t.floor_heating,...Object.values(t.hvac??{}).flat()].filter(R=>!!R&&R!=="none"),u=new Set(c.map(R=>this.hass.states[R]?.attributes.symcon_id).filter(Boolean)),m=(this._showAll?[...o,...a]:o).filter(R=>!K(this.hass)||!u.has(this.hass.states[R]?.attributes.symcon_id)),d=R=>m.filter(F=>R.includes(P(F))).map(F=>this.hass.states[F]),h=d(["light"]),g=d(["cover"]),_=d(["climate"]),b=d(["media"]),v=d(["switch","fan","lock"]),S=d(["sensor","binary"]),k=d(["scene","script"]),M=this.facts(_),z=h.filter(R=>R.state==="on");return p`<section class="nf-rp" aria-label=${t.name}>
|
||||
<header class="nf-rp-head">
|
||||
<div>
|
||||
<h2>${t.name}</h2>
|
||||
@@ -313,15 +313,15 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
</button>
|
||||
</header>
|
||||
<div class="nf-rp-body" ?hidden=${this._folded}>
|
||||
<nf-utility-report .hass=${this.hass} .readings=${Ct(this.hass,t,this.building?.floors.flatMap(R=>R.rooms))}></nf-utility-report>
|
||||
<nf-utility-report .hass=${this.hass} .readings=${Nt(this.hass,t,this.building?.floors.flatMap(R=>R.rooms))}></nf-utility-report>
|
||||
${this.renderAllOff([...h,...b,...v])}
|
||||
${this.renderClean(t)}
|
||||
${!t.area_id&&!e&&!(K(this.hass)&&c.length)?p`<p class="nf-rp-note">${this.t("panel_no_area")}</p>`:!d.length&&!(K(this.hass)&&c.length)?p`<p class="nf-rp-note">${this.t("panel_empty")}</p>`:f}
|
||||
${!t.area_id&&!e&&!(K(this.hass)&&c.length)?p`<p class="nf-rp-note">${this.t("panel_no_area")}</p>`:!m.length&&!(K(this.hass)&&c.length)?p`<p class="nf-rp-note">${this.t("panel_empty")}</p>`:f}
|
||||
${k.length?this.section("panel_scenes",[p`<div class="nf-rp-scenes">
|
||||
${k.map(R=>p`<button
|
||||
class="nf-btn"
|
||||
?disabled=${C(R)}
|
||||
@click=${()=>this.call(H(R.entity_id)==="scene"?"scene":"script","turn_on",{entity_id:R.entity_id})}
|
||||
@click=${()=>this.call(P(R.entity_id)==="scene"?"scene":"script","turn_on",{entity_id:R.entity_id})}
|
||||
>
|
||||
${this.name(R.entity_id)}
|
||||
</button>`)}
|
||||
@@ -331,9 +331,9 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
</button>`:f}${z.length?p`<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_off",{entity_id:z.map(R=>R.entity_id)})}>
|
||||
${this.t("panel_all_off")}
|
||||
</button>`:f}`):f}
|
||||
${g.length?this.section("panel_covers",g.map(R=>this.coverRow(R)),g.length>1&&lr(g,this.confirmEntities).length?p`<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","open_cover",{entity_id:lr(g,this.confirmEntities)})}>
|
||||
${g.length?this.section("panel_covers",g.map(R=>this.coverRow(R)),g.length>1&&cr(g,this.confirmEntities).length?p`<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","open_cover",{entity_id:cr(g,this.confirmEntities)})}>
|
||||
${this.t("panel_all_open")}</button
|
||||
><button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:lr(g,this.confirmEntities)})}>
|
||||
><button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:cr(g,this.confirmEntities)})}>
|
||||
${this.t("panel_all_close")}
|
||||
</button>`:f):f}
|
||||
${K(this.hass)?p`<nf-room-hvac .hass=${this.hass} .room=${t}></nf-room-hvac>`:f}
|
||||
@@ -342,38 +342,38 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${v.length?this.section("panel_switches",v.map(R=>this.switchRow(R))):f}
|
||||
${S.length?this.section("panel_sensors",S.map(R=>this.sensorRow(R))):f}
|
||||
${this.extraValues(t)}
|
||||
${!K(this.hass)&&el(this.hass)&&Xa(this.hass,this.floor,t)?this.announceSection(t):f}
|
||||
${this.pluginSections(t,d)}
|
||||
${!K(this.hass)&&rl(this.hass)&&nl(this.hass,this.floor,t)?this.announceSection(t):f}
|
||||
${this.pluginSections(t,m)}
|
||||
${l?p`<button class="nf-btn nf-rp-small nf-rp-more" @click=${()=>this._showAll=!this._showAll}>
|
||||
${this._showAll?this.t("panel_less"):this.t("panel_more",{n:l})}
|
||||
</button>`:f}
|
||||
</div>
|
||||
</section>`}extraValues(e){if(!this.floor)return f;let t=[...this.floor.placements.filter(n=>!n.outside&&I([n.x,n.z],e.points)).map(n=>({name:n.name||O(this.hass,n.entity_id),rows:kr(this.hass,n.values)})),...this.floor.furniture.filter(n=>I([n.x,n.z],e.points)).map(n=>({name:n.name||(n.entity&&n.entity!=="none"?O(this.hass,n.entity):this.t("device")),rows:kr(this.hass,n.values)}))].filter(n=>n.rows.length);return t.length?this.section("device_values",t.map(n=>p`<div class="nf-extra-values"><b>${n.name}</b>${n.rows.map(i=>p`<div class="nf-rp-row"><span class="nf-rp-icon">${i.icon}</span><span class="nf-rp-name">${i.label}</span><b class="nf-rp-state">${i.text}${G(this.hass,[i.entity],i.label)}</b></div>`)}</div>`)):f}facts(e){let t=[],n=this.room;if(!n)return t;let i=(T,E)=>{let A=Z(this.hass,this.floor,n,T);if(A===null)return null;if(T==="temperature")return`${L(this.hass,le(this.hass,A),1)} ${re(this.hass)}`;let P=ge(this.hass,this.floor,n,T)[0],N=this.hass.states[P]?.attributes.unit_of_measurement??E;return`${L(this.hass,A,1)} ${N}`},o=e.find(T=>typeof T.attributes.current_temperature=="number"),s=i("temperature","\xB0C");s?t.push(p`${s}${G(this.hass,ge(this.hass,this.floor,n,"temperature"),"Temperatur")}`):o&&n.climate?.temperature!=="none"&&t.push(p`${L(this.hass,o.attributes.current_temperature,1)} ${re(this.hass)}${G(this.hass,[o.entity_id],"Temperatur")}`);let a=i("humidity","%");a&&t.push(p`${a}${G(this.hass,ge(this.hass,this.floor,n,"humidity"),"Luftfeuchte")}`);let l=Z(this.hass,this.floor??null,n,"illuminance");l!==null&&t.push(p`☀ ${L(this.hass,l,0)} lx${G(this.hass,ge(this.hass,this.floor,n,"illuminance"),"Helligkeit")}`);let c=Ct(this.hass,n,this.building?.floors.flatMap(T=>T.rooms)).find(T=>T.kind==="electricity"&&T.metric==="power"&&T.unit==="W"),u=!c&&this.floor&&this.building?uo(this.hass,this.building,this.floor,n):null;c?t.push(p`⚡ ${Fe(this.hass,c)}${G(this.hass,c.sources,"Leistung")}`):u!==null&&t.push(`\u26A1 ${bt(this.hass,u)}`);let d=this.floor?this.floor.openings.filter(T=>T.room_id===n.id).flatMap(T=>[T.contact,T.contact2,T.tilt,T.tilt2]).map(T=>T&&T!=="none"?this.hass.states[T]:void 0).filter(T=>T?.state==="on").map(T=>Date.parse(String(T.last_changed??""))).filter(Number.isFinite):[];d.length&&t.push(`\u{1FA9F} ${this.t("open_since",{time:mo(Date.now()-Math.min(...d))})}`);let m=U(this.hass,n).map(T=>this.hass.states[T]).filter(T=>!!T&&T.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(T.attributes.device_class)));if(m.length)if(m.some(T=>T.state==="on"))t.push(`\u{1F6B6} ${this.t("presence_now")}`);else{let T=Math.max(...m.map(E=>Date.parse(String(E.last_changed??""))||0));T>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:mo(Date.now()-T)})}`)}let h=this.building?Kl(this.hass,this.building).filter(T=>T.roomId===n.id&&T.level<Vl):[];h.length&&t.push(`\u{1FAAB} ${this.t("battery_low_n",{n:h.length,names:h.map(T=>`${this.name(T.entity)} ${Math.round(T.level)} %`).join(", ")})}`);let g=(this.building?.settings.circuits??[]).filter(T=>T.rooms.includes(n.id)).map(T=>T.name),_=this.building?.settings.room_facts_off??[];g.length&&!_.includes("circuits")&&t.push(`\u{1F50C} ${g.join(", ")}`);let{latitude:b,longitude:v,time_zone:S}=this.hass.config??{};if(this.floor&&b!==void 0&&v!==void 0&&this.building&&!_.includes("sun")){let T=Ot(this.building,this.floor,n,{latitude:b,longitude:v,zone:S});T.facing.length&&t.push(`\u2600 ${this.t("room_sun_hours",{h:L(this.hass,T.hours,1),facing:T.facing.join(", ")})}`)}let k=Z(this.hass,this.floor,n,"temperature"),M=Z(this.hass,this.floor,n,"humidity"),z=Hr(Z(this.hass,this.floor,n,"co2"),M,Wt(k,M));z&&!_.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${z}`)}`);let R=Pr(k,M,Z(this.hass,this.floor,n,"co2"),_t(new Date,this.hass.config?.latitude)),F=n.hvac?.status;return F&&F!=="none"?t.push(p`${nt(this.hass.states[F])}${G(this.hass,[F],"Raumstatus")}`):R!==null&&(k!==null||M!==null)&&!_.includes("comfort")&&t.push(`\u{1F60A} ${this.t("comfort_n",{n:R})}`),t}announceSection(e){let t=this.phrases?.length?this.phrases:[1,2,3,4,5].map(o=>this.t(`announce_phrase_${o}`)),n=o=>{let s=o.trim();s&&(clearTimeout(this.saidTimer),this.hass.callService("nextfloor","announce",{message:s,rooms:[e.id],on_screens:!1}).then(()=>this._said={text:this.t("announce_sent",{message:s}),failed:!1},a=>this._said={text:this.t("announce_failed",{error:a?.message??String(a)}),failed:!0}),this.saidTimer=setTimeout(()=>this._said=null,6e3))},i=o=>{o.preventDefault();let s=o.currentTarget.querySelector("input");n(s.value),s.value=""};return this.section("panel_announce",[p`<div class="nf-rp-scenes">${t.map(o=>p`<button class="nf-btn" @click=${()=>n(o)}>${o}</button>`)}</div>
|
||||
</section>`}extraValues(e){if(!this.floor)return f;let t=[...this.floor.placements.filter(n=>!n.outside&&H([n.x,n.z],e.points)).map(n=>({name:n.name||L(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"?L(this.hass,n.entity):this.t("device")),rows:Sr(this.hass,n.values)}))].filter(n=>n.rows.length);return t.length?this.section("device_values",t.map(n=>p`<div class="nf-extra-values"><b>${n.name}</b>${n.rows.map(i=>p`<div class="nf-rp-row"><span class="nf-rp-icon">${i.icon}</span><span class="nf-rp-name">${i.label}</span><b class="nf-rp-state">${i.text}${G(this.hass,[i.entity],i.label)}</b></div>`)}</div>`)):f}facts(e){let t=[],n=this.room;if(!n)return t;let i=(T,E)=>{let A=Z(this.hass,this.floor,n,T);if(A===null)return null;if(T==="temperature")return`${O(this.hass,le(this.hass,A),1)} ${re(this.hass)}`;let I=ge(this.hass,this.floor,n,T)[0],N=this.hass.states[I]?.attributes.unit_of_measurement??E;return`${O(this.hass,A,1)} ${N}`},o=e.find(T=>typeof T.attributes.current_temperature=="number"),s=i("temperature","\xB0C");s?t.push(p`${s}${G(this.hass,ge(this.hass,this.floor,n,"temperature"),"Temperatur")}`):o&&n.climate?.temperature!=="none"&&t.push(p`${O(this.hass,o.attributes.current_temperature,1)} ${re(this.hass)}${G(this.hass,[o.entity_id],"Temperatur")}`);let a=i("humidity","%");a&&t.push(p`${a}${G(this.hass,ge(this.hass,this.floor,n,"humidity"),"Luftfeuchte")}`);let l=Z(this.hass,this.floor??null,n,"illuminance");l!==null&&t.push(p`☀ ${O(this.hass,l,0)} lx${G(this.hass,ge(this.hass,this.floor,n,"illuminance"),"Helligkeit")}`);let c=Nt(this.hass,n,this.building?.floors.flatMap(T=>T.rooms)).find(T=>T.kind==="electricity"&&T.metric==="power"&&T.unit==="W"),u=!c&&this.floor&&this.building?mo(this.hass,this.building,this.floor,n):null;c?t.push(p`⚡ ${Fe(this.hass,c)}${G(this.hass,c.sources,"Leistung")}`):u!==null&&t.push(`\u26A1 ${bt(this.hass,u)}`);let m=this.floor?this.floor.openings.filter(T=>T.room_id===n.id).flatMap(T=>[T.contact,T.contact2,T.tilt,T.tilt2]).map(T=>T&&T!=="none"?this.hass.states[T]:void 0).filter(T=>T?.state==="on").map(T=>Date.parse(String(T.last_changed??""))).filter(Number.isFinite):[];m.length&&t.push(`\u{1FA9F} ${this.t("open_since",{time:fo(Date.now()-Math.min(...m))})}`);let d=U(this.hass,n).map(T=>this.hass.states[T]).filter(T=>!!T&&T.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(T.attributes.device_class)));if(d.length)if(d.some(T=>T.state==="on"))t.push(`\u{1F6B6} ${this.t("presence_now")}`);else{let T=Math.max(...d.map(E=>Date.parse(String(E.last_changed??""))||0));T>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:fo(Date.now()-T)})}`)}let h=this.building?jl(this.hass,this.building).filter(T=>T.roomId===n.id&&T.level<Ul):[];h.length&&t.push(`\u{1FAAB} ${this.t("battery_low_n",{n:h.length,names:h.map(T=>`${this.name(T.entity)} ${Math.round(T.level)} %`).join(", ")})}`);let g=(this.building?.settings.circuits??[]).filter(T=>T.rooms.includes(n.id)).map(T=>T.name),_=this.building?.settings.room_facts_off??[];g.length&&!_.includes("circuits")&&t.push(`\u{1F50C} ${g.join(", ")}`);let{latitude:b,longitude:v,time_zone:S}=this.hass.config??{};if(this.floor&&b!==void 0&&v!==void 0&&this.building&&!_.includes("sun")){let T=Wt(this.building,this.floor,n,{latitude:b,longitude:v,zone:S});T.facing.length&&t.push(`\u2600 ${this.t("room_sun_hours",{h:O(this.hass,T.hours,1),facing:T.facing.join(", ")})}`)}let k=Z(this.hass,this.floor,n,"temperature"),M=Z(this.hass,this.floor,n,"humidity"),z=Pr(Z(this.hass,this.floor,n,"co2"),M,Bt(k,M));z&&!_.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${z}`)}`);let R=Ir(k,M,Z(this.hass,this.floor,n,"co2"),_t(new Date,this.hass.config?.latitude)),F=n.hvac?.status;return F&&F!=="none"?t.push(p`${nt(this.hass.states[F])}${G(this.hass,[F],"Raumstatus")}`):R!==null&&(k!==null||M!==null)&&!_.includes("comfort")&&t.push(`\u{1F60A} ${this.t("comfort_n",{n:R})}`),t}announceSection(e){let t=this.phrases?.length?this.phrases:[1,2,3,4,5].map(o=>this.t(`announce_phrase_${o}`)),n=o=>{let s=o.trim();s&&(clearTimeout(this.saidTimer),this.hass.callService("nextfloor","announce",{message:s,rooms:[e.id],on_screens:!1}).then(()=>this._said={text:this.t("announce_sent",{message:s}),failed:!1},a=>this._said={text:this.t("announce_failed",{error:a?.message??String(a)}),failed:!0}),this.saidTimer=setTimeout(()=>this._said=null,6e3))},i=o=>{o.preventDefault();let s=o.currentTarget.querySelector("input");n(s.value),s.value=""};return this.section("panel_announce",[p`<div class="nf-rp-scenes">${t.map(o=>p`<button class="nf-btn" @click=${()=>n(o)}>${o}</button>`)}</div>
|
||||
<form class="nf-rp-say" @submit=${i}>
|
||||
<input type="text" maxlength="500" placeholder=${this.t("announce_placeholder")} aria-label=${this.t("announce_placeholder")} />
|
||||
<button class="nf-btn nf-primary" type="submit">${this.t("announce_send")}</button>
|
||||
</form>
|
||||
${this._said?p`<p class="nf-rp-note ${this._said.failed?"nf-rp-fail":""}" role="status">${this._said.text}</p>`:f}`])}pluginSections(e,t){return Is({hass:this.hass,room:{id:e.id,name:e.name,area_id:e.area_id??null},entities:t}).map(i=>p`<div class="nf-rp-sec nf-rp-plugin" data-plugin=${i.key}>
|
||||
${this._said?p`<p class="nf-rp-note ${this._said.failed?"nf-rp-fail":""}" role="status">${this._said.text}</p>`:f}`])}pluginSections(e,t){return Os({hass:this.hass,room:{id:e.id,name:e.name,area_id:e.area_id??null},entities:t}).map(i=>p`<div class="nf-rp-sec nf-rp-plugin" data-plugin=${i.key}>
|
||||
<div class="nf-rp-sec-head"><h3>${i.title}</h3></div>
|
||||
${typeof i.content=="string"?p`<p class="nf-rp-note">${i.content}</p>`:i.content}
|
||||
</div>`)}section(e,t,n=f){return p`<div class="nf-rp-sec">
|
||||
<div class="nf-rp-sec-head"><h3>${this.t(e)}</h3>${n}</div>
|
||||
${t}
|
||||
</div>`}lightRow(e){let t=e.attributes,n=e.state==="on",i=t.supported_color_modes??[],o=i.some(h=>h!=="onoff"),s=i.includes("color_temp"),a=i.some(h=>["hs","rgb","rgbw","rgbww","xy"].includes(h)),l=typeof t.brightness=="number"?Math.round(t.brightness/255*100):100,c=t.min_color_temp_kelvin??2200,u=t.max_color_temp_kelvin??6500,d=e.entity_id,m=!!this.placedAs(d)?.simple;return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon ${n?"nf-rp-on":""}">${Vt("light")}</span>
|
||||
${this.nameButton(d)}
|
||||
</div>`}lightRow(e){let t=e.attributes,n=e.state==="on",i=t.supported_color_modes??[],o=i.some(h=>h!=="onoff"),s=i.includes("color_temp"),a=i.some(h=>["hs","rgb","rgbw","rgbww","xy"].includes(h)),l=typeof t.brightness=="number"?Math.round(t.brightness/255*100):100,c=t.min_color_temp_kelvin??2200,u=t.max_color_temp_kelvin??6500,m=e.entity_id,d=!!this.placedAs(m)?.simple;return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon ${n?"nf-rp-on":""}">${Kt("light")}</span>
|
||||
${this.nameButton(m)}
|
||||
<span class="nf-rp-state">${this.stateOf(e)}${G(this.hass,[e.entity_id])}</span>
|
||||
${this.toggle(e,n,()=>this.call("light","toggle",{entity_id:d}))}
|
||||
${o&&!m?p`<label class="nf-rp-slider"
|
||||
${this.toggle(e,n,()=>this.call("light","toggle",{entity_id:m}))}
|
||||
${o&&!d?p`<label class="nf-rp-slider"
|
||||
><span>${this.t("brightness")}</span>
|
||||
<input
|
||||
type="range"
|
||||
min="1"
|
||||
max="100"
|
||||
.value=${String(l)}
|
||||
@change=${h=>this.call("light","turn_on",{entity_id:d,brightness_pct:Number(h.target.value)})}
|
||||
@change=${h=>this.call("light","turn_on",{entity_id:m,brightness_pct:Number(h.target.value)})}
|
||||
/></label>`:f}
|
||||
${n&&s&&!m?p`<label class="nf-rp-slider nf-rp-ct"
|
||||
${n&&s&&!d?p`<label class="nf-rp-slider nf-rp-ct"
|
||||
><span>${this.t("color_temp")}</span>
|
||||
<input
|
||||
type="range"
|
||||
@@ -381,26 +381,26 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
max=${u}
|
||||
step="50"
|
||||
.value=${String(t.color_temp_kelvin??c)}
|
||||
@change=${h=>this.call("light","turn_on",{entity_id:d,color_temp_kelvin:Number(h.target.value)})}
|
||||
@change=${h=>this.call("light","turn_on",{entity_id:m,color_temp_kelvin:Number(h.target.value)})}
|
||||
/></label>`:f}
|
||||
${n&&a&&!m?p`<div class="nf-rp-swatches" role="group" aria-label=${this.t("color")}>
|
||||
${Cm.map(h=>p`<button
|
||||
${n&&a&&!d?p`<div class="nf-rp-swatches" role="group" aria-label=${this.t("color")}>
|
||||
${Bm.map(h=>p`<button
|
||||
class="nf-rp-swatch"
|
||||
style="--c: rgb(${h.join(",")})"
|
||||
aria-label="rgb(${h.join(", ")})"
|
||||
@click=${()=>this.call("light","turn_on",{entity_id:d,rgb_color:h})}
|
||||
@click=${()=>this.call("light","turn_on",{entity_id:m,rgb_color:h})}
|
||||
></button>`)}
|
||||
</div>`:f}
|
||||
</div>`}coverRow(e){let t=br(this.hass,this.building?.floors??[],e.entity_id);e=vr(this.hass,e,t);let n=e.attributes,i=n.supported_features??0,o=e.entity_id,s=C(e)&&!un(e);return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon">${Vt("cover")}</span>
|
||||
</div>`}coverRow(e){let t=vr(this.hass,this.building?.floors??[],e.entity_id);e=yr(this.hass,e,t);let n=e.attributes,i=n.supported_features??0,o=e.entity_id,s=C(e)&&!dn(e);return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon">${Kt("cover")}</span>
|
||||
${this.nameButton(o)}
|
||||
<span class="nf-rp-state">${this.stateOf(e)}${G(this.hass,[e.entity_id])}</span>
|
||||
<div class="nf-rp-buttons">
|
||||
<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.askFor(o)&&this.call("cover","open_cover",{entity_id:o})}>${this.t("cover_open")}</button>
|
||||
${i&Im?p`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","stop_cover",{entity_id:o})}>${this.t("cover_stop")}</button>`:f}
|
||||
${i&Wm?p`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","stop_cover",{entity_id:o})}>${this.t("cover_stop")}</button>`:f}
|
||||
<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.askFor(o)&&this.call("cover","close_cover",{entity_id:o})}>${this.t("cover_close")}</button>
|
||||
</div>
|
||||
${i&Pm&&typeof n.current_position=="number"?p`<label class="nf-rp-slider"
|
||||
${i&Lm&&typeof n.current_position=="number"?p`<label class="nf-rp-slider"
|
||||
><span>${this.t("position")}</span>
|
||||
<input
|
||||
type="range"
|
||||
@@ -424,12 +424,12 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${i&32?p`<button class="nf-btn nf-rp-small" ?disabled=${s} @click=${()=>this.call("cover","close_cover_tilt",{entity_id:o})}>${this.t("cover_tilt_close")}</button>`:f}
|
||||
</div>`:f}
|
||||
</div>`}climateRow(e){let t=e.attributes,n=e.entity_id,i=typeof t.temperature=="number"?t.temperature:null,o=t.target_temp_step??.5,s=t.min_temp??5,a=t.max_temp??30,l=t.hvac_modes??[],c=u=>this.call("climate","set_temperature",{entity_id:n,temperature:Math.min(a,Math.max(s,Math.round(u/o)*o))});return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon ${t.hvac_action==="heating"?"nf-rp-on":""}">${Vt("climate")}</span>
|
||||
<span class="nf-rp-icon ${t.hvac_action==="heating"?"nf-rp-on":""}">${Kt("climate")}</span>
|
||||
${this.nameButton(n)}
|
||||
<span class="nf-rp-state">${this.stateOf(e)}${G(this.hass,[e.entity_id])}</span>
|
||||
${i!==null?p`<div class="nf-rp-stepper nf-rp-wide">
|
||||
<button class="nf-btn" aria-label=${this.t("temp_down")} @click=${()=>c(i-o)}>−</button>
|
||||
<span><small>${this.t("target_temp")}</small> ${L(this.hass,i,1)} ${re(this.hass)}</span>
|
||||
<span><small>${this.t("target_temp")}</small> ${O(this.hass,i,1)} ${re(this.hass)}</span>
|
||||
<button class="nf-btn" aria-label=${this.t("temp_up")} @click=${()=>c(i+o)}>+</button>
|
||||
</div>`:f}
|
||||
${l.length>1?p`<div class="nf-rp-chips">
|
||||
@@ -441,20 +441,20 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${this.stateLabel(u)}
|
||||
</button>`)}
|
||||
</div>`:f}
|
||||
</div>`}stateOf(e,t=oe(this.hass,e)){if(this.room?.no_state?.includes(e.entity_id))return"";let n=H(e.entity_id);return e.state==="unknown"&&n!=="sensor"&&n!=="binary"?"":t}stateLabel(e){let t=`state_${e}`,n=this.t(t);return n===t?e:n}mediaRow(e){let t=e.attributes,n=e.entity_id,i=C(e)||e.state==="off",o=[t.media_title,t.media_artist].filter(s=>typeof s=="string"&&s).join(" \xB7 ");return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon ${e.state==="playing"?"nf-rp-on":""}">${Vt("media")}</span>
|
||||
</div>`}stateOf(e,t=se(this.hass,e)){if(this.room?.no_state?.includes(e.entity_id))return"";let n=P(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=C(e)||e.state==="off",o=[t.media_title,t.media_artist].filter(s=>typeof s=="string"&&s).join(" \xB7 ");return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon ${e.state==="playing"?"nf-rp-on":""}">${Kt("media")}</span>
|
||||
${this.nameButton(n)}
|
||||
<span class="nf-rp-state">${this.stateOf(e,this.stateLabel(e.state))}${G(this.hass,[e.entity_id])}</span>
|
||||
${o?p`<p class="nf-rp-media nf-rp-wide">${o}</p>`:f}
|
||||
<div class="nf-rp-buttons nf-rp-wide">
|
||||
<button class="nf-btn nf-rp-small" aria-label=${this.t("previous")} ?disabled=${i} @click=${()=>this.call("media_player","media_previous_track",{entity_id:n})}>
|
||||
${po(Lr.previous)}
|
||||
${go(Lr.previous)}
|
||||
</button>
|
||||
<button class="nf-btn nf-rp-small" aria-label=${this.t("play_pause")} ?disabled=${C(e)} @click=${()=>this.call("media_player","media_play_pause",{entity_id:n})}>
|
||||
${po(e.state==="playing"?Lr.pause:Lr.play)}
|
||||
${go(e.state==="playing"?Lr.pause:Lr.play)}
|
||||
</button>
|
||||
<button class="nf-btn nf-rp-small" aria-label=${this.t("next")} ?disabled=${i} @click=${()=>this.call("media_player","media_next_track",{entity_id:n})}>
|
||||
${po(Lr.next)}
|
||||
${go(Lr.next)}
|
||||
</button>
|
||||
</div>
|
||||
${typeof t.volume_level=="number"?p`<label class="nf-rp-slider"
|
||||
@@ -466,13 +466,13 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.value=${String(Math.round(t.volume_level*100))}
|
||||
@change=${s=>this.call("media_player","volume_set",{entity_id:n,volume_level:Number(s.target.value)/100})}
|
||||
/></label>`:f}
|
||||
</div>`}switchRow(e){let t=e.entity_id,n=H(t),i=t.slice(0,t.indexOf(".")),o=n==="lock"?e.state==="unlocked"||e.state==="open":te(e),s=()=>n==="lock"?this.call("lock",o?"lock":"unlock",{entity_id:t}):this.call(i,"toggle",{entity_id:t});return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon ${o?"nf-rp-on":""}">${Vt(n)}</span>
|
||||
</div>`}switchRow(e){let t=e.entity_id,n=P(t),i=t.slice(0,t.indexOf(".")),o=n==="lock"?e.state==="unlocked"||e.state==="open":te(e),s=()=>n==="lock"?this.call("lock",o?"lock":"unlock",{entity_id:t}):this.call(i,"toggle",{entity_id:t});return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon ${o?"nf-rp-on":""}">${Kt(n)}</span>
|
||||
${this.nameButton(t)}
|
||||
<span class="nf-rp-state">${this.stateOf(e)}${G(this.hass,[e.entity_id])}</span>
|
||||
${this.toggle(e,o,s)}
|
||||
</div>`}sensorRow(e){let t=H(e.entity_id),n=t==="binary"&&e.state==="on";return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon ${n?"nf-rp-on":""}">${Vt(t)}</span>
|
||||
</div>`}sensorRow(e){let t=P(e.entity_id),n=t==="binary"&&e.state==="on";return p`<div class="nf-rp-row">
|
||||
<span class="nf-rp-icon ${n?"nf-rp-on":""}">${Kt(t)}</span>
|
||||
${this.nameButton(e.entity_id)}
|
||||
<span class="nf-rp-state">${this.stateOf(e)}${G(this.hass,[e.entity_id])}</span>
|
||||
</div>`}fire(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))}static styles=[_e,ze,J`
|
||||
@@ -856,38 +856,38 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
outline: 2px solid var(--nf-accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
`]};customElements.get("nf-room-panel")||customElements.define("nf-room-panel",fo);function tc(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 Om=[[/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]]],nc=[34,211,238];function go(r){return r?Om.find(([e])=>e.test(r))?.[1]??nc:nc}function _o(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"&&_o(r);function rc(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:bo(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:go(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 ic(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 Wm=3;function oc(r,e,t){let n=[];for(let i of e.floors)for(let o of i.furniture){if(!o.type.endsWith(":sprinkler"))continue;let s=t?.get(o.id)?.entity??null;!s||!te(r.states[s])||n.push({id:o.id,at:{floorId:i.id,x:o.x,y:ae(i,o)+o.h,z:o.z},reach:Math.min(15,Math.max(.5,o.spray??Wm))})}return n}var Or=r=>r&&r!=="none"?r:null,sc=r=>Math.min(1,Math.max(0,r));function ac(r,e){let t=new Map;for(let n of e.settings.roof?.windows??[]){let i=Le(r,{cover:Or(n.cover),contact:Or(n.contact),tilt:Or(n.tilt)},"window"),o=Or(n.window),s=o?r.states[o]:void 0,a=i.open;if(s&&!C(s)){let l=s.attributes.current_position;a=typeof l=="number"?sc(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 Bm(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 rt=(r,e)=>typeof r[e]=="string"?r[e]:"";function lc(r,e,t){let n=[];for(let i of e.floors)for(let o of i.furniture){if(!fr(o.type))continue;let s=t?.get(o.id)?.entity??null,a=s?.startsWith("media_player.")?s:Bm(i,o),l=a?r.states[a]:void 0;if(!l||!_o(l))continue;let c=l.attributes,u=rt(c,"app_name")||rt(c,"source")||null;n.push({id:o.id,furnitureId:o.id,floorId:i.id,color:go(u),title:rt(c,"media_title")||rt(c,"media_channel")||u||"",subtitle:rt(c,"media_artist")||rt(c,"media_series_title")||rt(c,"media_album_name"),app:u,picture:rt(c,"entity_picture")||null,playing:bo(l),ambilight:o.ambilight??1})}return n}function cc(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 uc(r,e){return(r===null?0:sc((r+4)/16))*(1-.45*e)}function it(r,e){return r.states["weather.nextfloor_symcon"]?"weather.nextfloor_symcon":e&&r.states[e]?e:Object.keys(r.states).filter(t=>t.startsWith("weather.")).sort()[0]??null}var Wr=new Set(["contact_lost","unlocked_night","own"]);function Vm(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 Km=600*1e3,Gm=new Set(["rainy","pouring","lightning-rainy","hail","snowy-rainy"]),Um=new Map([["smoke","smoke"],["gas","gas"],["carbon_monoxide","co"],["moisture","water"]]),dc=(r,e)=>{if(e.startsWith("binary_sensor."))return Um.get(String(r.states[e]?.attributes.device_class))};function jm(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 hc(r,e,t,n){let i=[];for(let a o
Line truncated
|
||||
`]};customElements.get("nf-room-panel")||customElements.define("nf-room-panel",_o);function ic(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 Gm=[[/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]]],oc=[34,211,238];function bo(r){return r?Gm.find(([e])=>e.test(r))?.[1]??oc:oc}function vo(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 yo=r=>r.state==="playing"||r.state==="on"&&vo(r);function sc(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:yo(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:bo(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 ac(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 Um=3;function lc(r,e,t){let n=[];for(let i of e.floors)for(let o of i.furniture){if(!o.type.endsWith(":sprinkler"))continue;let s=t?.get(o.id)?.entity??null;!s||!te(r.states[s])||n.push({id:o.id,at:{floorId:i.id,x:o.x,y:oe(i,o)+o.h,z:o.z},reach:Math.min(15,Math.max(.5,o.spray??Um))})}return n}var Wr=r=>r&&r!=="none"?r:null,cc=r=>Math.min(1,Math.max(0,r));function uc(r,e){let t=new Map;for(let n of e.settings.roof?.windows??[]){let i=Oe(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&&!C(s)){let l=s.attributes.current_position;a=typeof l=="number"?cc(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 jm(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 rt=(r,e)=>typeof r[e]=="string"?r[e]:"";function dc(r,e,t){let n=[];for(let i of e.floors)for(let o of i.furniture){if(!gr(o.type))continue;let s=t?.get(o.id)?.entity??null,a=s?.startsWith("media_player.")?s:jm(i,o),l=a?r.states[a]:void 0;if(!l||!vo(l))continue;let c=l.attributes,u=rt(c,"app_name")||rt(c,"source")||null;n.push({id:o.id,furnitureId:o.id,floorId:i.id,color:bo(u),title:rt(c,"media_title")||rt(c,"media_channel")||u||"",subtitle:rt(c,"media_artist")||rt(c,"media_series_title")||rt(c,"media_album_name"),app:u,picture:rt(c,"entity_picture")||null,playing:yo(l),ambilight:o.ambilight??1})}return n}function hc(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 mc(r,e){return(r===null?0:cc((r+4)/16))*(1-.45*e)}function it(r,e){return r.states["weather.nextfloor_symcon"]?"weather.nextfloor_symcon":e&&r.states[e]?e:Object.keys(r.states).filter(t=>t.startsWith("weather.")).sort()[0]??null}var Br=new Set(["contact_lost","unlocked_night","own"]);function qm(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 Zm=600*1e3,Ym=new Set(["rainy","pouring","lightning-rainy","hail","snowy-rainy"]),Jm=new Map([["smoke","smoke"],["gas","gas"],["carbon_monoxide","co"],["moisture","water"]]),pc=(r,e)=>{if(e.startsWith("binary_sensor."))return Jm.get(String(r.states[e]?.attributes.device_class))};function Qm(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 fc(r,e,t,n){let i=[];for(let a o
Line truncated
|
||||
${ne`<circle cx="27" cy="27" r=${22} class="live-ring-bg"></circle>
|
||||
<circle cx="27" cy="27" r=${22} stroke=${e} stroke-dasharray=${`${(n*Math.max(0,Math.min(1,r))).toFixed(1)} ${n.toFixed(1)}`} transform="rotate(-90 27 27)" class="live-ring-fg"></circle>`}
|
||||
</svg>`}function of(r,e,t,n){let i=e.summary,o=c=>$(r,c),s=e.autarky,a=n?p`<button class="live-fold" title=${o(n.folded?"live_unfold":"live_fold")} aria-label=${o(n.folded?"live_unfold":"live_fold")} aria-expanded=${!n.folded} @click=${n.toggle}>${n.folded?"+":"\u2212"}</button>`:f;if(n?.folded){let c=i.solar!==null?`\u2600 ${Ae(r,i.solar)}`:i.consumption!==null?`\u2302 ${Ae(r,i.consumption)}`:null;return p`<div class="live-card live-card-house live-folded" data-i=${t}>
|
||||
${s!==null?p`<div class="live-own">${In(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)}%</b></div></div>`:f}
|
||||
</svg>`}function _f(r,e,t,n){let i=e.summary,o=c=>$(r,c),s=e.autarky,a=n?p`<button class="live-fold" title=${o(n.folded?"live_unfold":"live_fold")} aria-label=${o(n.folded?"live_unfold":"live_fold")} aria-expanded=${!n.folded} @click=${n.toggle}>${n.folded?"+":"\u2212"}</button>`:f;if(n?.folded){let c=i.solar!==null?`\u2600 ${Ae(r,i.solar)}`:i.consumption!==null?`\u2302 ${Ae(r,i.consumption)}`:null;return p`<div class="live-card live-card-house live-folded" data-i=${t}>
|
||||
${s!==null?p`<div class="live-own">${Cn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)}%</b></div></div>`:f}
|
||||
${c?p`<b>${c}</b>`:s===null?p`<b>⌂</b>`:f}
|
||||
${a}
|
||||
</div>`}let l=[];if(i.solar!==null&&l.push(p`<div class="live-row live-solar"><span>☀ ${o("energy_solar")}</span><b>${Ae(r,i.solar)}</b></div>`),i.consumption!==null&&l.push(p`<div class="live-row live-house"><span>⌂ ${o("energy_consumption")}</span><b>${Ae(r,i.consumption)}</b></div>`),i.rest!==void 0&&i.rest!==null&&l.push(p`<div class="live-row live-house"><span>⌂ ${o("energy_rest")}</span><b>${Ae(r,i.rest)}</b></div>`),i.battery!==null||i.soc!==null){let c=i.battery===null||Math.abs(i.battery)<15?"":i.battery>0?" \u2193":" \u2191";l.push(p`<div class="live-row live-battery"><span>▮ ${o("energy_battery")}${c}</span><b>${i.soc!==null?`${Math.round(i.soc)} %`:""}${i.battery!==null&&Math.abs(i.battery)>=15?` \xB7 ${Ae(r,i.battery)}`:""}</b></div>`)}if(i.grid!==null){let c=i.grid<-15;l.push(p`<div class="live-row ${c?"live-export":"live-import"}"><span>⇄ ${o(c?"energy_grid_export":"energy_grid_import")}</span><b>${Ae(r,i.grid)}</b></div>`)}for(let c of e.meters??[])l.push(p`<div class="live-row live-meter"><span>${c.icon} ${c.label}</span><b>${c.value}</b></div>`);return p`<div class="live-card live-card-house" data-i=${t}>
|
||||
${a}
|
||||
${s!==null?p`<div class="live-own">${In(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)} %</b><span>${o("live_autarky")}</span></div></div>`:f}
|
||||
${s!==null?p`<div class="live-own">${Cn(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>
|
||||
${af(r,e.curves)} ${sf(r,e.week)}
|
||||
</div>`}function sf(r,e){if(!e)return f;let t=[...e.solar,...e.use].filter(c=>c!==null&&c>0);if(!t.length)return f;let n=Math.max(...t)*1.1||1,[i,o]=[150,30],s=i/7,a=(c,u,d)=>c===null||c<=0?f:ne`<rect x=${u.toFixed(1)} y=${(o-c/n*o).toFixed(1)} width=${(s*.36).toFixed(1)} height=${(c/n*o).toFixed(1)} class=${d}></rect>`,l=c=>c.reduce((u,d)=>u+(d??0),0);return p`<div class="live-day live-week" title=${$(r,"live_week_hint",{solar:L(r,l(e.solar),0),use:L(r,l(e.use),0)})}>
|
||||
${vf(r,e.curves)} ${bf(r,e.week)}
|
||||
</div>`}function bf(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,m)=>c===null||c<=0?f:ne`<rect x=${u.toFixed(1)} y=${(o-c/n*o).toFixed(1)} width=${(s*.36).toFixed(1)} height=${(c/n*o).toFixed(1)} class=${m}></rect>`,l=c=>c.reduce((u,m)=>u+(m??0),0);return p`<div class="live-day live-week" title=${$(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">
|
||||
${e.days.map((c,u)=>ne`${a(e.solar[u],u*s+s*.1,"live-week-solar")}${a(e.use[u],u*s+s*.5,"live-week-use")}`)}
|
||||
</svg>
|
||||
<span>7 ${$(r,"live_days")}</span>
|
||||
</div>`}function af(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=Mn(e.solar,i,o,n),a=Mn(e.use,i,o,n);return p`<div class="live-day" title=${$(r,"live_day_hint")}>
|
||||
</div>`}function vf(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=An(e.solar,i,o,n),a=An(e.use,i,o,n);return p`<div class="live-day" title=${$(r,"live_day_hint")}>
|
||||
<svg viewBox=${`0 0 ${i} ${o}`} preserveAspectRatio="none" aria-hidden="true">
|
||||
${s?ne`<path d=${`${s}L${i},${o}L0,${o}Z`} class="live-day-solar"></path>`:f}
|
||||
${a?ne`<path d=${a} class="live-day-use"></path>`:f}
|
||||
</svg>
|
||||
<span>24 h</span>
|
||||
</div>`}function lf(r,e,t,n){let i=e.car,o=(u,d)=>$(r,u,d),s=su(i.soc),a=i.home?i.charging?`\u26A1 ${o("live_car_charging")}${i.chargingW?` \xB7 ${Ae(r,i.chargingW)}`:""}`:i.plugged?`\u{1F50C} ${o("live_car_plugged")}`:"":`${o("live_car_away")}${i.where?` \xB7 ${i.where}`:""}${i.distance!==null?` \xB7 ${L(r,i.distance,i.distance<10?1:0)} km`:""}`,l=i.entities,c=(u,d,m,h)=>p`<button class="live-btn ${u?"live-on":""}" title=${d} aria-label=${d} aria-pressed=${u??!1} @click=${g=>(g.stopPropagation(),h())}>${m}</button>`;return p`<div class="live-card live-card-car ${i.charging?"live-charging":""} ${i.home?"":"live-away"}" data-i=${t} style=${`--live-soc:${s}`}>
|
||||
</div>`}function yf(r,e,t,n){let i=e.car,o=(u,m)=>$(r,u,m),s=du(i.soc),a=i.home?i.charging?`\u26A1 ${o("live_car_charging")}${i.chargingW?` \xB7 ${Ae(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,m,d,h)=>p`<button class="live-btn ${u?"live-on":""}" title=${m} aria-label=${m} aria-pressed=${u??!1} @click=${g=>(g.stopPropagation(),h())}>${d}</button>`;return p`<div class="live-card live-card-car ${i.charging?"live-charging":""} ${i.home?"":"live-away"}" data-i=${t} style=${`--live-soc:${s}`}>
|
||||
<div class="live-own">
|
||||
${In((i.soc??0)/100,s)}
|
||||
${Cn((i.soc??0)/100,s)}
|
||||
<div class="live-own-text"><b>${i.soc!==null?`${Math.round(i.soc)} %`:"\u2013"}</b><span>${i.range!==null?`${Math.round(i.range)} ${i.rangeUnit}`:""}</span></div>
|
||||
</div>
|
||||
<div class="live-rows">
|
||||
<div class="live-title">${e.name}</div>
|
||||
${a?p`<div class="live-status">${a}</div>`:f}
|
||||
${i.inside!==null?p`<div class="live-status">🌡 ${L(r,i.inside,1)} °C</div>`:f}
|
||||
${i.inside!==null?p`<div class="live-status">🌡 ${O(r,i.inside,1)} °C</div>`:f}
|
||||
${i.departure?p`<div class="live-status">⏰ ${o("live_car_departure",{time:i.departure})}</div>`:f}
|
||||
${i.open.length?p`<div class="live-status live-warn">⚠ ${o("live_car_open",{parts:i.open.join(", ")})}</div>`:f}
|
||||
<div class="live-actions">
|
||||
@@ -896,7 +896,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${l.charge&&i.home?c(i.charging,o("live_car_charge"),"\u26A1",()=>n(l.charge.split(".")[0],"toggle",l.charge)):f}
|
||||
</div>
|
||||
</div>
|
||||
</div>`}function cf(r,e,t,n){let i=e.media,o=l=>$(r,l),s=`rgb(${i.color.join(",")})`,a=(l,c,u)=>p`<button class="live-btn" title=${l} aria-label=${l} @click=${d=>(d.stopPropagation(),n("media_player",u,i.entity))}>${c}</button>`;return p`<div class="live-card live-card-media" data-i=${t} style=${`--live-soc:${s}`} @click=${l=>l.currentTarget.classList.toggle("live-open")}>
|
||||
</div>`}function wf(r,e,t,n){let i=e.media,o=l=>$(r,l),s=`rgb(${i.color.join(",")})`,a=(l,c,u)=>p`<button class="live-btn" title=${l} aria-label=${l} @click=${m=>(m.stopPropagation(),n("media_player",u,i.entity))}>${c}</button>`;return p`<div class="live-card live-card-media" data-i=${t} style=${`--live-soc:${s}`} @click=${l=>l.currentTarget.classList.toggle("live-open")}>
|
||||
${i.picture?p`<img class="live-cover" src=${i.picture} alt="" loading="lazy" />`:p`<div class="live-cover live-cover-none">♪</div>`}
|
||||
<div class="live-rows">
|
||||
<div class="live-title" title=${i.title}>${i.title||i.name}</div>
|
||||
@@ -915,9 +915,9 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
/>`:f}
|
||||
</div>
|
||||
</div>
|
||||
</div>`}function au(r){let e=[...r.querySelectorAll(".live-card")].filter(o=>o.style.visibility!=="hidden"),t=[],n=e[0]?.parentElement?.clientWidth??0,i=e.map(o=>{let[s,a]=[Number(o.dataset.x),o.offsetWidth],l=n?n>a+16?Math.min(Math.max(s,a/2+8),n-a/2-8):n/2:s;return o.style.setProperty("--live-dx",`${Math.round(s-l)}px`),{el:o,x:l,y:Number(o.dataset.y),w:a,h:o.offsetHeight}}).sort((o,s)=>s.y-o.y);for(let o of i){let s=o.y;for(let l=0;l<12;l++){let c={x0:o.x-o.w/2,x1:o.x+o.w/2,y0:s-o.h,y1:s},u=t.find(d=>c.x0<d.x1+6&&c.x1>d.x0-6&&c.y0<d.y1+6&&c.y1>d.y0-6);if(!u)break;s=u.y0-8}t.push({x0:o.x-o.w/2,x1:o.x+o.w/2,y0:s-o.h,y1:s});let a=o.y-s;o.el.style.transform=`translate(${Math.round(o.x)}px, ${Math.round(s)}px) translate(-50%, -100%)`,o.el.style.setProperty("--live-thread",`${Math.round(18+a)}px`)}}function uf(r,e,t){let n=e.printer,i=(c,u)=>$(r,c,u),o=n.progress??0,s=c=>new Intl.DateTimeFormat(r?.language??navigator.language,{hour:"2-digit",minute:"2-digit"}).format(new Date(c)),a=n.remaining!==null?n.remaining>=60?`${Math.floor(n.remaining/60)} h ${Math.round(n.remaining%60)} min`:`${Math.round(n.remaining)} min`:null,l=[n.nozzle!==null?`${i("printer_nozzle")} ${Math.round(n.nozzle)}\xB0`:null,n.bed!==null?`${i("printer_bed")} ${Math.round(n.bed)}\xB0`:null].filter(Boolean).join(" \xB7 ");return p`<div class="live-card live-card-printer ${n.printing?"live-charging":""}" data-i=${t}>
|
||||
</div>`}function hu(r){let e=[...r.querySelectorAll(".live-card")].filter(s=>s.style.visibility!=="hidden"),t=[],n=e[0]?.parentElement?.clientWidth??0,i=e[0]?.parentElement?.clientHeight??0,o=e.map(s=>{let[a,l]=[Number(s.dataset.x),s.offsetWidth],c=n?n>l+16?Math.min(Math.max(a,l/2+8),n-l/2-8):n/2:a;return s.style.setProperty("--live-dx",`${Math.round(a-c)}px`),{el:s,x:c,y:Number(s.dataset.y),w:l,h:s.offsetHeight}}).sort((s,a)=>a.y-s.y);for(let s of o){let a=s.y;if(s.el.classList.contains("live-card-hydronic")&&n>s.w+16&&i>s.h+16){let c=[s.x,s.w/2+8,n-s.w/2-8,...t.flatMap(d=>[d.x0-s.w/2-8,d.x1+s.w/2+8])].filter(d=>d>=s.w/2+8&&d<=n-s.w/2-8).sort((d,h)=>Math.abs(d-s.x)-Math.abs(h-s.x)),u=[Math.max(s.h+8,Math.min(i-8,a)),...t.flatMap(d=>[d.y0-8,d.y1+s.h+8])].filter(d=>d>=s.h+8&&d<=i-8),m;for(let d of u){for(let h of c)if(!t.some(g=>h-s.w/2<g.x1+6&&h+s.w/2>g.x0-6&&d-s.h<g.y1+6&&d>g.y0-6)){m={x:h,y:d};break}if(m)break}m&&(s.x=m.x,a=m.y)}for(let c=0;c<12;c++){let u={x0:s.x-s.w/2,x1:s.x+s.w/2,y0:a-s.h,y1:a},m=t.find(d=>u.x0<d.x1+6&&u.x1>d.x0-6&&u.y0<d.y1+6&&u.y1>d.y0-6);if(!m)break;a=m.y0-8}t.push({x0:s.x-s.w/2,x1:s.x+s.w/2,y0:a-s.h,y1:a});let l=s.y-a;s.el.style.setProperty("--live-dx",`${Math.round(Number(s.el.dataset.x)-s.x)}px`),s.el.style.transform=`translate(${Math.round(s.x)}px, ${Math.round(a)}px) translate(-50%, -100%)`,s.el.style.setProperty("--live-thread",`${Math.round(18+l)}px`)}}function xf(r,e,t){let n=e.printer,i=(c,u)=>$(r,c,u),o=n.progress??0,s=c=>new Intl.DateTimeFormat(r?.language??navigator.language,{hour:"2-digit",minute:"2-digit"}).format(new Date(c)),a=n.remaining!==null?n.remaining>=60?`${Math.floor(n.remaining/60)} h ${Math.round(n.remaining%60)} min`:`${Math.round(n.remaining)} min`:null,l=[n.nozzle!==null?`${i("printer_nozzle")} ${Math.round(n.nozzle)}\xB0`:null,n.bed!==null?`${i("printer_bed")} ${Math.round(n.bed)}\xB0`:null].filter(Boolean).join(" \xB7 ");return p`<div class="live-card live-card-printer ${n.printing?"live-charging":""}" data-i=${t}>
|
||||
<div class="live-own">
|
||||
${n.picture?p`<img class="live-print-pic" src=${n.picture} alt="" />`:In(o/100,n.printing?"#38bdf8":"#8aa0c8")}
|
||||
${n.picture?p`<img class="live-print-pic" src=${n.picture} alt="" />`:Cn(o/100,n.printing?"#38bdf8":"#8aa0c8")}
|
||||
<div class="live-own-text"><b>${n.progress!==null?`${Math.round(o)} %`:"\u2013"}</b><span>${i(`printer_${n.printing?"printing":/finish|complete|fertig/.test(n.status)?"done":/pause/.test(n.status)?"paused":/error|fail/.test(n.status)?"error":"idle"}`)}</span></div>
|
||||
</div>
|
||||
<div class="live-rows">
|
||||
@@ -928,10 +928,10 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${l?p`<div class="live-status">🌡 ${l}</div>`:f}
|
||||
${n.filaments.length?p`<div class="live-filaments">${n.filaments.map(c=>p`<i style=${`background:${c}`}></i>`)}</div>`:f}
|
||||
</div>
|
||||
</div>`}function df(r,e,t){let n=e.pump,i=a=>$(r,a),o=a=>a===null?"\u2013":`${L(r,a,1)}\xB0`,s={heating:"\u{1F525}",water:"\u{1F6BF}",cooling:"\u2744",defrost:"\u{1F9CA}",idle:"\u23F8"}[n.mode];return p`<div class="live-card live-card-heatpump ${n.mode==="idle"?"":"live-charging"}" data-i=${t}>
|
||||
</div>`}function kf(r,e,t){let n=e.pump,i=a=>$(r,a),o=a=>a===null?"\u2013":`${O(r,a,1)}\xB0`,s={heating:"\u{1F525}",water:"\u{1F6BF}",cooling:"\u2744",defrost:"\u{1F9CA}",idle:"\u23F8"}[n.mode];return p`<div class="live-card live-card-heatpump ${n.mode==="idle"?"":"live-charging"}" data-i=${t}>
|
||||
<div class="live-own">
|
||||
${In(Math.min(1,(n.cop??0)/6),(n.cop??0)>=3.5?"#4ade80":(n.cop??0)>=2.5?"#facc15":"#fb923c")}
|
||||
<div class="live-own-text"><b>${n.cop!==null?L(r,n.cop,1):s}</b><span>${n.cop!==null?"COP":""}</span></div>
|
||||
${Cn(Math.min(1,(n.cop??0)/6),(n.cop??0)>=3.5?"#4ade80":(n.cop??0)>=2.5?"#facc15":"#fb923c")}
|
||||
<div class="live-own-text"><b>${n.cop!==null?O(r,n.cop,1):s}</b><span>${n.cop!==null?"COP":""}</span></div>
|
||||
</div>
|
||||
<div class="live-rows">
|
||||
<div class="live-title">${e.name}</div>
|
||||
@@ -941,16 +941,16 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${n.power!==null?p`<div class="live-row live-house"><span>${i("heatpump_power")}</span><b>${Ae(r,n.power)}</b></div>`:f}
|
||||
${n.outside!==null?p`<div class="live-status">🌡 ${i("heatpump_outside")} ${o(n.outside)}</div>`:f}
|
||||
</div>
|
||||
</div>`}function hf(r,e,t){let n=(o,s,a)=>o===null?"\u2013":`${L(r,o,s)} ${a}`,i=Object.values(e.sources??{}).some(o=>gn(r,o).length>0);return p`<div class="live-card live-card-roomclimate ${i?"live-climate-trends":""}" data-i=${t} data-room=${e.roomId} role="group" aria-label=${`${e.name||$(r,"room")} \xB7 ${$(r,"climate")}`}>
|
||||
</div>`}function Sf(r,e,t){let n=(o,s,a)=>o===null?"\u2013":`${O(r,o,s)} ${a}`,i=Object.values(e.sources??{}).some(o=>_n(r,o).length>0);return p`<div class="live-card live-card-roomclimate ${i?"live-climate-trends":""}" data-i=${t} data-room=${e.roomId} role="group" aria-label=${`${e.name||$(r,"room")} \xB7 ${$(r,"climate")}`}>
|
||||
${e.showTemperature?p`<div class="live-row live-climate-temperature"><span title=${$(r,"climate_temperature")} aria-label=${$(r,"climate_temperature")}>🌡</span><b>${n(e.temperature===null?null:r?le(r,e.temperature):e.temperature,1,r?re(r):"\xB0C")}</b>${G(r,e.sources?.temperature??[],$(r,"climate_temperature"))}</div>`:f}
|
||||
${e.showHumidity?p`<div class="live-row live-climate-humidity"><span title=${$(r,"climate_humidity")} aria-label=${$(r,"climate_humidity")}>💧</span><b>${n(e.humidity,0,"%")}</b>${G(r,e.sources?.humidity??[],$(r,"climate_humidity"))}</div>`:f}
|
||||
${e.showCo2?p`<div class="live-row live-climate-co2"><span title=${$(r,"climate_co2")} aria-label=${$(r,"climate_co2")}>☁</span><b>${n(e.co2,0,"ppm")}</b>${G(r,e.sources?.co2??[],$(r,"climate_co2"))}</div>`:f}
|
||||
${e.showIlluminance?p`<div class="live-row live-climate-illuminance"><span title=${$(r,"climate_illuminance")} aria-label=${$(r,"climate_illuminance")}>☀</span><b>${n(e.illuminance,0,"lx")}</b>${G(r,e.sources?.illuminance??[],$(r,"climate_illuminance"))}</div>`:f}
|
||||
</div>`}function mf(r,e,t){let n=e.power===null?"\u2013":`${e.power<0?"\u2212":""}${Ae(r,e.power)}`;return p`<div class="live-card live-card-power" data-i=${t} data-furniture=${e.id} role="group" aria-label=${e.name}>
|
||||
</div>`}function $f(r,e,t){let n=e.power===null?"\u2013":`${e.power<0?"\u2212":""}${Ae(r,e.power)}`;return p`<div class="live-card live-card-power" data-i=${t} data-furniture=${e.id} role="group" aria-label=${e.name}>
|
||||
<div class="live-power-name">${e.name}</div><div class="live-row"><span aria-hidden="true">⚡</span><b>${n}</b>${G(r,[e.powerEntity],e.name)}</div>
|
||||
</div>`}function lu(r,e,t,n,i=!1){return e.length?p`<div class="live-cards">
|
||||
${e.map((o,s)=>o.kind==="roomclimate"?hf(r,o,s):o.kind==="power"?mf(r,o,s):i?f:o.kind==="house"?of(r,o,s,n):o.kind==="car"?lf(r,o,s,t):o.kind==="printer"?uf(r,o,s):o.kind==="heatpump"?df(r,o,s):cf(r,o,s,t))}
|
||||
</div>`:f}var cu=J`
|
||||
</div>`}function mu(r,e,t,n,i=!1){return e.length?p`<div class="live-cards">
|
||||
${e.map((o,s)=>o.kind==="roomclimate"?Sf(r,o,s):o.kind==="power"?$f(r,o,s):o.kind==="hydronic"?p`<div class="live-card live-card-hydronic" data-i=${s} data-furniture=${o.item.id}><nf-hydronic-card .hass=${r} .item=${o.item} .readOnly=${o.readOnly}></nf-hydronic-card></div>`:i?f:o.kind==="house"?_f(r,o,s,n):o.kind==="car"?yf(r,o,s,t):o.kind==="printer"?xf(r,o,s):o.kind==="heatpump"?kf(r,o,s):wf(r,o,s,t))}
|
||||
</div>`:f}var pu=J`
|
||||
.live-card.live-card-power { display:grid; gap:4px; min-width:90px; max-width:220px; box-sizing:border-box; }
|
||||
.live-power-name { font-size:11px; color:var(--nf-muted); overflow:hidden; text-overflow:ellipsis; }
|
||||
.live-card-power .live-row { align-items:center; gap:6px; }
|
||||
@@ -1292,7 +1292,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
`;function ei(r){return r.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var Lo=r=>r.points.length>=3;function uu(r,e,t){return r.rooms.filter(Lo).find(n=>I([e,t],n.points))}function pf(r,e,t,n){let i=[];for(let a of e.rooms.filter(Lo)){let[l,c]=Ee(a.points);i.push({kind:"room",name:a.name,where:n?e.name:"",floorId:e.id,roomId:a.id,entity:null,icon:null,x:l,z:c,y:0})}let o=new Set,s=(a,l,c,u)=>{if(o.has(a)||!(a in r.states))return;o.add(a);let d=uu(e,l,c),m=[d?.name,n?e.name:void 0].filter(h=>!!h).join(" \xB7 ");i.push({kind:"device",name:O(r,a),where:m,floorId:e.id,roomId:d?.id??null,entity:a,icon:H(a),x:l,z:c,y:u})};for(let a of e.placements){let l=a.y??Tt(H(a.entity_id)??"sensor",ve(e,a.x,a.z),a.mount);s(a.entity_id,a.x,a.z,l)}for(let a of e.furniture){let l=t.get(a.id),c=l?.entity??l?.power;if(!c)continue;let u=ve(e,a.x,a.z)-.3;s(c,a.x,a.z,Math.min(u,Math.max(.5,a.h)))}for(let a of e.notes??[]){if(!a.text)continue;let l=uu(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 du(r,e){let t=ft(r,e.floors),n=e.floors.length>1,i=e.floors.flatMap(o=>pf(r,o,t,n));for(let o of e.settings.circuits??[]){let s=e.floors.flatMap(d=>d.rooms.filter(m=>o.rooms.includes(m.id)&&Lo(m)).map(m=>({f:d,r:m})));if(!s.length)continue;let[{f:a,r:l}]=s,[c,u]=Ee(l.points);i.push({kind:"circuit",name:`\u{1F50C} ${o.name}`,where:s.map(d=>d.r.name).join(", "),floorId:a.id,roomId:l.id,entity:null,icon:null,x:c,z:u,y:0})}return i}function ff(r,e){return(ei(r.name).startsWith(e)?0:2)+(r.kind==="room"?0:1)}function hu(r,e,t=8){let n=ei(e).split(/\s+/).filter(Boolean);if(n.length===0)return[];let i=ei(e.trim());return r.filter(o=>{let s=ei([o.name,o.where,o.entity].filter(Boolean).join(" "));return n.every(a=>s.includes(a))}).map(o=>({item:o,cost:ff(o,i)})).sort((o,s)=>o.cost-s.cost||o.item.name.localeCompare(s.item.name)).slice(0,t).map(o=>o.item)}var gf=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[190,90,255],[255,95,210],[255,70,70],[120,255,150]],_f=[2200,2700,3200,4e3,5e3,6500],bf=["hs","rgb","rgbw","rgbww","xy"],vf=4,mu=16,pu=32,yf=128;function Wo(r){let e=r.attributes.supported_color_modes??[],t=e.some(n=>bf.includes(n));return{dim:e.some(n=>n!=="onoff"),color:t,temp:e.includes("color_temp")}}function Bo(r){return((r.attributes.supported_features??0)&vf)!==0&&typeof r.attributes.current_position=="number"}var Oo=class extends Q{static properties={hass:{attribute:!1},entity:{attribute:!1},car:{attribute:!1},presets:{attribute:!1},confirmSwitch:{type:Boolean},myPosition:{attribute:!1},tiltEntity:{attribute:!1},low:{type:Boolean,reflect:!0}};t(e,t){return $(this.hass,e,t)}ask(){return!this.confirmSwitch||confirm(this.t("confirm_switch",{name:O(this.hass,this.entity)}))}call(e,t,n={}){this.hass.callService(e,t,{entity_id:this.entity,...n})}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}details(){ye(this,this.entity),this.close()}ring(e){let t=e.length;return e.map((n,i)=>{let o=i/t*Math.PI*2-Math.PI/2;return p`<div class="qm-at" style="left:${50+Math.cos(o)*39}%;top:${50+Math.sin(o)*39}%">${n}</div>`})}renderLight(e){let t=Wo(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?gf.map(s=>p`<button class="qm-swatch" style="background:rgb(${s.join(",")})" aria-label=${`RGB ${s.join(", ")}`} @click=${()=>this.call("light","turn_on",{rgb_color:s})}></button>`):t.temp?_f.map(s=>p`<button class="qm-swatch" style="background:${wf(s)}" aria-label=${`${s} K`} @click=${()=>this.call("light","turn_on",{color_temp_kelvin:s})}></button>`):[];return p`<div class="qm-ring ${o.length?"":"qm-ring-small"}">
|
||||
`;function ni(r){return r.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var Bo=r=>r.points.length>=3;function fu(r,e,t){return r.rooms.filter(Bo).find(n=>H([e,t],n.points))}function Mf(r,e,t,n){let i=[];for(let a of e.rooms.filter(Bo)){let[l,c]=Ee(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 m=fu(e,l,c),d=[m?.name,n?e.name:void 0].filter(h=>!!h).join(" \xB7 ");i.push({kind:"device",name:L(r,a),where:d,floorId:e.id,roomId:m?.id??null,entity:a,icon:P(a),x:l,z:c,y:u})};for(let a of e.placements){let l=a.y??Dt(P(a.entity_id)??"sensor",ve(e,a.x,a.z),a.mount);s(a.entity_id,a.x,a.z,l)}for(let a of e.furniture){let l=t.get(a.id),c=l?.entity??l?.power;if(!c)continue;let u=ve(e,a.x,a.z)-.3;s(c,a.x,a.z,Math.min(u,Math.max(.5,a.h)))}for(let a of e.notes??[]){if(!a.text)continue;let l=fu(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 gu(r,e){let t=ft(r,e.floors),n=e.floors.length>1,i=e.floors.flatMap(o=>Mf(r,o,t,n));for(let o of e.settings.circuits??[]){let s=e.floors.flatMap(m=>m.rooms.filter(d=>o.rooms.includes(d.id)&&Bo(d)).map(d=>({f:m,r:d})));if(!s.length)continue;let[{f:a,r:l}]=s,[c,u]=Ee(l.points);i.push({kind:"circuit",name:`\u{1F50C} ${o.name}`,where:s.map(m=>m.r.name).join(", "),floorId:a.id,roomId:l.id,entity:null,icon:null,x:c,z:u,y:0})}return i}function Af(r,e){return(ni(r.name).startsWith(e)?0:2)+(r.kind==="room"?0:1)}function _u(r,e,t=8){let n=ni(e).split(/\s+/).filter(Boolean);if(n.length===0)return[];let i=ni(e.trim());return r.filter(o=>{let s=ni([o.name,o.where,o.entity].filter(Boolean).join(" "));return n.every(a=>s.includes(a))}).map(o=>({item:o,cost:Af(o,i)})).sort((o,s)=>o.cost-s.cost||o.item.name.localeCompare(s.item.name)).slice(0,t).map(o=>o.item)}var Ef=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[190,90,255],[255,95,210],[255,70,70],[120,255,150]],Rf=[2200,2700,3200,4e3,5e3,6500],zf=["hs","rgb","rgbw","rgbww","xy"],Tf=4,bu=16,vu=32,Df=128;function Ko(r){let e=r.attributes.supported_color_modes??[],t=e.some(n=>zf.includes(n));return{dim:e.some(n=>n!=="onoff"),color:t,temp:e.includes("color_temp")}}function Go(r){return((r.attributes.supported_features??0)&Tf)!==0&&typeof r.attributes.current_position=="number"}var Vo=class extends Q{static properties={hass:{attribute:!1},entity:{attribute:!1},car:{attribute:!1},presets:{attribute:!1},confirmSwitch:{type:Boolean},myPosition:{attribute:!1},tiltEntity:{attribute:!1},low:{type:Boolean,reflect:!0}};t(e,t){return $(this.hass,e,t)}ask(){return!this.confirmSwitch||confirm(this.t("confirm_switch",{name:L(this.hass,this.entity)}))}call(e,t,n={}){this.hass.callService(e,t,{entity_id:this.entity,...n})}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}details(){ye(this,this.entity),this.close()}ring(e){let t=e.length;return e.map((n,i)=>{let o=i/t*Math.PI*2-Math.PI/2;return p`<div class="qm-at" style="left:${50+Math.cos(o)*39}%;top:${50+Math.sin(o)*39}%">${n}</div>`})}renderLight(e){let t=Ko(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?Ef.map(s=>p`<button class="qm-swatch" style="background:rgb(${s.join(",")})" aria-label=${`RGB ${s.join(", ")}`} @click=${()=>this.call("light","turn_on",{rgb_color:s})}></button>`):t.temp?Rf.map(s=>p`<button class="qm-swatch" style="background:${Ff(s)}" aria-label=${`${s} K`} @click=${()=>this.call("light","turn_on",{color_temp_kelvin:s})}></button>`):[];return p`<div class="qm-ring ${o.length?"":"qm-ring-small"}">
|
||||
${this.ring(o)}
|
||||
<button class="qm-power ${n?"qm-on":""}" aria-pressed=${n} @click=${()=>this.ask()&&this.call("light","toggle")}>
|
||||
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M12 3v8M6.3 6.8a8 8 0 1 0 11.4 0" /></svg>
|
||||
@@ -1307,7 +1307,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.value=${String(Math.max(1,i))}
|
||||
aria-label=${this.t("brightness")}
|
||||
@change=${s=>this.call("light","turn_on",{brightness_pct:Number(s.target.value)})}
|
||||
/>`:f}`}renderCover(e){e=vr(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=Bo(e),o=(u,d,m,h=!1)=>p`<button class="qm-swatch qm-slot ${h?"qm-slot-on":""}" aria-label=${d} @click=${m}>${u}</button>`,s=u=>t!==null&&Math.abs(t-u)<3,a=[o("\u25B2",this.t("cover_open"),()=>this.ask()&&this.call("cover","open_cover"),s(100)),...i?[75,50].map(u=>o(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],o("\u25BC",this.t("cover_close"),()=>this.ask()&&this.call("cover","close_cover"),s(0)),...i?[25].map(u=>o(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],...Number(e.attributes.supported_features??0)&8?[o("\u25A0",this.t("cover_stop"),()=>this.call("cover","stop_cover"),n)]:[],...this.myPosition!=null&&(i||Number(e.attributes.supported_features??0)&8)?[o("My",this.t("cover_my_go",{p:this.myPosition}),()=>this.ask()&&(i?this.call("cover","set_cover_position",{position:this.myPosition}):this.call("cover","stop_cover")),s(this.myPosition))]:[]],l=t===null?e.state==="closed"?100:0:100-t,c=t!==null||n||e.state==="open"||e.state==="closed";return p`<div class="qm-ring">
|
||||
/>`:f}`}renderCover(e){e=yr(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=Go(e),o=(u,m,d,h=!1)=>p`<button class="qm-swatch qm-slot ${h?"qm-slot-on":""}" aria-label=${m} @click=${d}>${u}</button>`,s=u=>t!==null&&Math.abs(t-u)<3,a=[o("\u25B2",this.t("cover_open"),()=>this.ask()&&this.call("cover","open_cover"),s(100)),...i?[75,50].map(u=>o(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],o("\u25BC",this.t("cover_close"),()=>this.ask()&&this.call("cover","close_cover"),s(0)),...i?[25].map(u=>o(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],...Number(e.attributes.supported_features??0)&8?[o("\u25A0",this.t("cover_stop"),()=>this.call("cover","stop_cover"),n)]:[],...this.myPosition!=null&&(i||Number(e.attributes.supported_features??0)&8)?[o("My",this.t("cover_my_go",{p:this.myPosition}),()=>this.ask()&&(i?this.call("cover","set_cover_position",{position:this.myPosition}):this.call("cover","stop_cover")),s(this.myPosition))]:[]],l=t===null?e.state==="closed"?100:0:100-t,c=t!==null||n||e.state==="open"||e.state==="closed";return p`<div class="qm-ring">
|
||||
${this.ring(a)}
|
||||
<button
|
||||
class="qm-power qm-blind ${c&&l<100?"qm-on":""}"
|
||||
@@ -1317,7 +1317,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
@click=${()=>n?this.call("cover","stop_cover"):this.ask()&&this.call("cover",l>50?"open_cover":"close_cover")}
|
||||
>
|
||||
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M4 4h16M5 4v15M19 4v15M7 8h10M7 12h10M7 16h10" /></svg>
|
||||
<b>${t!==null?`${Math.round(t)} %`:oe(this.hass,e)}</b>
|
||||
<b>${t!==null?`${Math.round(t)} %`:se(this.hass,e)}</b>
|
||||
</button>
|
||||
</div>
|
||||
${i?p`<input
|
||||
@@ -1329,7 +1329,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
aria-label=${this.t("position")}
|
||||
@change=${u=>this.call("cover","set_cover_position",{position:Number(u.target.value)})}
|
||||
/>`:f}
|
||||
${this.renderTilt(e)}`}renderTilt(e){let t=(e.attributes.supported_features??0)|0,n=typeof e.attributes.current_tilt_position=="number"?e.attributes.current_tilt_position:null;return t&yf&&n!==null?p`<label class="qm-tilt"
|
||||
${this.renderTilt(e)}`}renderTilt(e){let t=(e.attributes.supported_features??0)|0,n=typeof e.attributes.current_tilt_position=="number"?e.attributes.current_tilt_position:null;return t&Df&&n!==null?p`<label class="qm-tilt"
|
||||
><span>${this.t("cover_tilt")} · ${Math.round(n)} %</span>
|
||||
<input
|
||||
class="qm-slider"
|
||||
@@ -1339,9 +1339,9 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.value=${String(n)}
|
||||
aria-label=${this.t("cover_tilt")}
|
||||
@change=${i=>this.call("cover","set_cover_tilt_position",{entity_id:e.attributes.nf_cover_control?this.entity:this.tiltEntity||this.entity,tilt_position:Number(i.target.value)})}
|
||||
/></label>`:t&(mu|pu)?p`<div class="qm-tilt-buttons">
|
||||
${t&mu?p`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","open_cover_tilt")}>${this.t("cover_tilt_open")}</button>`:f}
|
||||
${t&pu?p`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","close_cover_tilt")}>${this.t("cover_tilt_close")}</button>`:f}
|
||||
/></label>`:t&(bu|vu)?p`<div class="qm-tilt-buttons">
|
||||
${t&bu?p`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","open_cover_tilt")}>${this.t("cover_tilt_open")}</button>`:f}
|
||||
${t&vu?p`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","close_cover_tilt")}>${this.t("cover_tilt_close")}</button>`:f}
|
||||
</div>`:f}renderToggle(e){let t=e.state==="on"||e.state==="unlocked"||e.state==="playing",n=e.entity_id.split(".")[0];return p`<div class="qm-ring qm-ring-small">
|
||||
<button
|
||||
class="qm-power ${t?"qm-on":""}"
|
||||
@@ -1349,22 +1349,22 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
@click=${()=>this.ask()&&(n==="lock"?this.call("lock",t?"lock":"unlock"):this.call("homeassistant","toggle"))}
|
||||
>
|
||||
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M12 3v8M6.3 6.8a8 8 0 1 0 11.4 0" /></svg>
|
||||
<b>${oe(this.hass,e)}</b>
|
||||
<b>${se(this.hass,e)}</b>
|
||||
</button>
|
||||
</div>`}renderMedia(e){let t=!["off","standby","unavailable","unknown"].includes(e.state),n=e.state==="playing",i=e.attributes,o=typeof i.volume_level=="number"?Math.round(i.volume_level*100):null,s=Array.isArray(i.source_list)?i.source_list.slice(0,24):[],a=[i.media_title,i.media_artist].filter(d=>typeof d=="string"&&d).join(" \xB7 "),l=d=>p`<svg viewBox="0 0 24 24" width="18" height="18" fill="currentColor"><path d=${d} /></svg>`,c=(d,m,h,g=!1)=>p`<button class="qm-swatch qm-slot ${g?"qm-slot-on":""}" aria-label=${m} title=${m} @click=${h}>${d}</button>`,u=t?[c(l(n?"M6 5h4v14H6zM14 5h4v14h-4z":"M8 5v14l11-7z"),this.t(n?"media_pause":"media_play"),()=>this.call("media_player","media_play_pause"),n),c(l("M6 6h2v12H6zm3.5 6 8.5 6V6z"),this.t("media_previous"),()=>this.call("media_player","media_previous_track")),c(l("M16 6h2v12h-2zM6 18l8.5-6L6 6z"),this.t("media_next"),()=>this.call("media_player","media_next_track"))]:[];return p`<div class="qm-ring ${u.length?"":"qm-ring-small"}">
|
||||
</div>`}renderMedia(e){let t=!["off","standby","unavailable","unknown"].includes(e.state),n=e.state==="playing",i=e.attributes,o=typeof i.volume_level=="number"?Math.round(i.volume_level*100):null,s=Array.isArray(i.source_list)?i.source_list.slice(0,24):[],a=[i.media_title,i.media_artist].filter(m=>typeof m=="string"&&m).join(" \xB7 "),l=m=>p`<svg viewBox="0 0 24 24" width="18" height="18" fill="currentColor"><path d=${m} /></svg>`,c=(m,d,h,g=!1)=>p`<button class="qm-swatch qm-slot ${g?"qm-slot-on":""}" aria-label=${d} title=${d} @click=${h}>${m}</button>`,u=t?[c(l(n?"M6 5h4v14H6zM14 5h4v14h-4z":"M8 5v14l11-7z"),this.t(n?"media_pause":"media_play"),()=>this.call("media_player","media_play_pause"),n),c(l("M6 6h2v12H6zm3.5 6 8.5 6V6z"),this.t("media_previous"),()=>this.call("media_player","media_previous_track")),c(l("M16 6h2v12h-2zM6 18l8.5-6L6 6z"),this.t("media_next"),()=>this.call("media_player","media_next_track"))]:[];return p`<div class="qm-ring ${u.length?"":"qm-ring-small"}">
|
||||
${this.ring(u)}
|
||||
<button class="qm-power ${t?"qm-on":""}" aria-pressed=${t} @click=${()=>this.ask()&&this.call("media_player",t?"turn_off":"turn_on")}>
|
||||
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M12 3v8M6.3 6.8a8 8 0 1 0 11.4 0" /></svg>
|
||||
<b>${o!==null&&t?`${o} %`:oe(this.hass,e)}</b>
|
||||
<b>${o!==null&&t?`${o} %`:se(this.hass,e)}</b>
|
||||
</button>
|
||||
</div>
|
||||
${a?p`<div class="qm-media-title">${a}</div>`:f}
|
||||
${o!==null?p`<input class="qm-slider" type="range" min="0" max="100" .value=${String(o)} aria-label=${this.t("media_volume")} @change=${d=>this.call("media_player","volume_set",{volume_level:Number(d.target.value)/100})} />`:f}
|
||||
${o!==null?p`<input class="qm-slider" type="range" min="0" max="100" .value=${String(o)} aria-label=${this.t("media_volume")} @change=${m=>this.call("media_player","volume_set",{volume_level:Number(m.target.value)/100})} />`:f}
|
||||
${s.length?p`<div class="qm-play-head">${this.t("media_sources")}</div>
|
||||
<div class="qm-play">${s.map(d=>p`<button class="qm-chip ${i.source===d?"qm-chip-on":""}" @click=${()=>this.call("media_player","select_source",{source:d})}>${d}</button>`)}</div>`:f}
|
||||
<div class="qm-play">${s.map(m=>p`<button class="qm-chip ${i.source===m?"qm-chip-on":""}" @click=${()=>this.call("media_player","select_source",{source:m})}>${m}</button>`)}</div>`:f}
|
||||
${this.presets?.length?p`<div class="qm-play-head">${this.t("presets")}</div>
|
||||
<div class="qm-play">${this.presets.map(d=>p`<button class="qm-chip" @click=${()=>this.call("media_player","play_media",{media_content_type:d.type,media_content_id:d.content})}>${d.label}</button>`)}</div>`:f}`}render(){let e=this.hass?.states[this.entity];if(!e)return f;let t=H(this.entity),n=C(e)&&!un(e)?p`<p class="qm-note">${oe(this.hass,e)}</p>`:t==="light"?this.renderLight(e):t==="cover"?this.renderCover(e):t==="media"?this.renderMedia(e):this.renderToggle(e);return p`<div class="qm" role="dialog" aria-label=${O(this.hass,this.entity)}>
|
||||
<div class="qm-title">${O(this.hass,this.entity)}</div>
|
||||
<div class="qm-play">${this.presets.map(m=>p`<button class="qm-chip" @click=${()=>this.call("media_player","play_media",{media_content_type:m.type,media_content_id:m.content})}>${m.label}</button>`)}</div>`:f}`}render(){let e=this.hass?.states[this.entity];if(!e)return f;let t=P(this.entity),n=C(e)&&!dn(e)?p`<p class="qm-note">${se(this.hass,e)}</p>`:t==="light"?this.renderLight(e):t==="cover"?this.renderCover(e):t==="media"?this.renderMedia(e):this.renderToggle(e);return p`<div class="qm" role="dialog" aria-label=${L(this.hass,this.entity)}>
|
||||
<div class="qm-title">${L(this.hass,this.entity)}</div>
|
||||
${n}
|
||||
<button class="qm-details" @click=${()=>this.details()}>${this.t("details")} …</button>
|
||||
</div>`}static styles=[_e,J`
|
||||
@@ -1610,7 +1610,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.qm-note {
|
||||
color: var(--nf-muted);
|
||||
}
|
||||
`]};function wf(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",Oo);var xf=new URL(import.meta.url),kf=new URL("./nextfloor-3d.js?v=74227cd20cc3",xf).href,fu;function gu(){return fu??=import(kf),fu}function _u(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 bu="weather.nextfloor_symcon",yu={condition:"Wetterzustand",temperature:"Au\xDFentemperatur",humidity:"Au\xDFenluftfeuchte",pressure:"Luftdruck",wind_speed:"Windgeschwindigkeit",wind_gust_speed:"Windb\xF6en",wind_bearing:"Windrichtung",cloud_coverage:"Bew\xF6lkung",precipitation:"Niederschlagsrate",precipitation_total:"Niederschlagsmenge",illuminance:"Au\xDFenhelligkeit",uv_index:"UV-Index",visibility:"Sichtweite",snow:"Schnee",fog:"Nebel",lightning:"Gewitter"},vu=new WeakMap;function Sf(r){let e=r.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").trim();return["sunny","clear-night","partlycloudy","cloudy","fog","rainy","pouring","lightning-rainy","lightning","hail","snowy","snowy-rainy","windy","windy-variant"].includes(e)?e:/kein regen|trocken|wolkenlos|klar|sonnig/.test(e)?"sunny":/gewitter|blitz/.test(e)?"lightning-rainy":/schneeregen/.test(e)?"snowy-rainy":/schnee/.test(e)?"snowy":/hagel/.test(e)?"hail":/starkregen/.test(e)?"pouring":/regen|niesel/.test(e)?"rainy":/nebel/.test(e)?"fog":/teil.*wolk|heiter|leicht.*wolk/.test(e)?"partlycloudy":/wolk|bedeckt/.test(e)?"cloudy":/wind|sturm/.test(e)?"windy":null}function ti(r,e){if(!K(r))return r;let t=e.weather_variables??{};if(!e.rain_sensor&&!Object.values(t).some(h=>h&&h!=="none"))return r;let n=vu.get(r)??new WeakMap;vu.set(r,n);let i=n.get(e);if(i)return i;let o={friendly_name:"Wetter",nf_symcon_weather:!0},s=h=>t[h]&&t[h]!=="none"?r.states[t[h]]:void 0;for(let h of["temperature","humidity","pressure","cloud_coverage","precipitation","precipitation_total","illuminance","uv_index","visibility"]){let g=s(h),_=We(g);_!==null&&(o[h]=h==="cloud_coverage"&&g?.attributes.symcon_max===1?_*100:_),g?.attributes.unit_of_measurement&&(o[`${h}_unit`]=g.attributes.unit_of_measurement)}for(let h of["wind_speed","wind_gust_speed"]){let g=s(h),_=We(g);_!==null&&(o[h]=Ur(_,g?.attributes.unit_of_measurement))}o.wind_speed_unit="km/h";let a=tt(s("wind_bearing"));a!==null&&(o.wind_bearing=a);let l=Sf(nt(s("condition"))),c=e.rain_sensor?r.states[e.rain_sensor]:void 0,u=se(c);u!==null&&e.rain_sensor_inverted&&(u=!u),u===null&&typeof o.precipitation=="number"&&(u=o.precipitation>0),se(s("lightning"))?l=u?"lightning-rainy":"lightning":se(s("snow"))?l=u?"snowy-rainy":"snowy":se(s("fog"))?l="fog":u===!0?l=Number(o.precipitation??0)>=8?"pouring":"rainy":u===!1&&l&&/rain|pouring/.test(l)&&(l=null),!l&&typeof o.cloud_coverage=="number"&&(l=o.cloud_coverage>70?"cloudy":o.cloud_coverage>20?"partlycloudy":"sunny"),!l&&u===!1&&(l="sunny");let d={entity_id:bu,state:l??"unknown",attributes:o},m={...r,states:{...r.states,[bu]:d}};return n.set(e,m),m}var Vo=class extends Q{static properties={hass:{attribute:!1},floors:{attribute:!1},floorId:{attribute:!1},inline:{type:Boolean,reflect:!0},compact:{type:Boolean},folded:{state:!0}};constructor(){super(),this.floors=[],this.floorId=null,this.inline=!1,this.compact=!1,this.folded=null}value(e){return e?p`<span class="value" title=${`${Nt(e)}${e.manual?" \xB7 eigener Z\xE4hler":""}`}><b>${Fe(this.hass,e)}</b>${e.period!=="total"?p`<small>${{day:"heute",month:"Monat",year:"Jahr"}[e.period]}</small>`:f}${G(this.hass,e.sources,`${Te[e.kind]} \xB7 ${Nt(e)}`)}</span>`:f}open(e,t){this.dispatchEvent(new CustomEvent("utility-open",{detail:{floorId:t?this.floorId:e,roomId:t?e:null},bubbles:!0,composed:!0}))}rows(e){return Ie.map(t=>{let n=e.filter(o=>o.kind===t&&o.metric==="power"),i=e.filter(o=>o.kind===t&&o.metric==="energy");return Array.from({length:Math.max(n.length,i.length)},(o,s)=>p`<div class="row"><span class="kind" title=${Te[t]}>${s?"":`${_n[t]} ${Te[t]}`}</span>${n[s]?this.value(n[s]):p`<span></span>`}${i[s]?this.value(i[s]):p`<span></span>`}</div>`)})}render(){if(!this.hass)return f;let e=this.floors.flatMap(s=>s.rooms),t=this.floors.find(s=>s.id===this.floorId);if(this.inline){let s=t?De(this.hass,t,e):cl(this.hass,this.floors);return p`${Ie.map(a=>{let l=s.filter(c=>c.kind===a);return l.length?p`<div class="meter" aria-label=${`${t?.name||"Gesamtgeb\xE4ude"} \xB7 ${Te[a]}`}><span class="medium" title=${t?.name||"Gesamtgeb\xE4ude"}>${_n[a]} ${Te[a]}</span><div class="values">${l.map(c=>this.value(c))}</div></div>`:f})}`}let i=(t?io(this.hass,t,e):[...this.floors].sort((s,a)=>a.elevation-s.elevation).map(s=>({id:s.id,name:s.name,path:"",readings:De(this.hass,s,e),rooms:[]}))).filter(s=>s.readings.length);if(!i.length)return f;let o=this.folded??this.compact;return p`<section class="panel" aria-label=${t?"BereichsLine truncated
|
||||
`]};function Ff(r){let e=Math.min(1,Math.max(0,(r-2200)/4300)),t=(n,i)=>Math.round(n+(i-n)*e);return`rgb(${t(255,200)},${t(170,225)},${t(80,255)})`}customElements.get("nf-quick-menu")||customElements.define("nf-quick-menu",Vo);var Hf=new URL(import.meta.url),Pf=new URL("./nextfloor-3d.js?v=b12e75cc8bb7",Hf).href,yu;function wu(){return yu??=import(Pf),yu}function xu(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 ku="weather.nextfloor_symcon",$u={condition:"Wetterzustand",temperature:"Au\xDFentemperatur",humidity:"Au\xDFenluftfeuchte",pressure:"Luftdruck",wind_speed:"Windgeschwindigkeit",wind_gust_speed:"Windb\xF6en",wind_bearing:"Windrichtung",cloud_coverage:"Bew\xF6lkung",precipitation:"Niederschlagsrate",precipitation_total:"Niederschlagsmenge",illuminance:"Au\xDFenhelligkeit",uv_index:"UV-Index",visibility:"Sichtweite",snow:"Schnee",fog:"Nebel",lightning:"Gewitter"},Su=new WeakMap;function If(r){let e=r.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").trim();return["sunny","clear-night","partlycloudy","cloudy","fog","rainy","pouring","lightning-rainy","lightning","hail","snowy","snowy-rainy","windy","windy-variant"].includes(e)?e:/kein regen|trocken|wolkenlos|klar|sonnig/.test(e)?"sunny":/gewitter|blitz/.test(e)?"lightning-rainy":/schneeregen/.test(e)?"snowy-rainy":/schnee/.test(e)?"snowy":/hagel/.test(e)?"hail":/starkregen/.test(e)?"pouring":/regen|niesel/.test(e)?"rainy":/nebel/.test(e)?"fog":/teil.*wolk|heiter|leicht.*wolk/.test(e)?"partlycloudy":/wolk|bedeckt/.test(e)?"cloudy":/wind|sturm/.test(e)?"windy":null}function ri(r,e){if(!K(r))return r;let t=e.weather_variables??{};if(!e.rain_sensor&&!Object.values(t).some(h=>h&&h!=="none"))return r;let n=Su.get(r)??new WeakMap;Su.set(r,n);let i=n.get(e);if(i)return i;let o={friendly_name:"Wetter",nf_symcon_weather:!0},s=h=>t[h]&&t[h]!=="none"?r.states[t[h]]:void 0;for(let h of["temperature","humidity","pressure","cloud_coverage","precipitation","precipitation_total","illuminance","uv_index","visibility"]){let g=s(h),_=We(g);_!==null&&(o[h]=h==="cloud_coverage"&&g?.attributes.symcon_max===1?_*100:_),g?.attributes.unit_of_measurement&&(o[`${h}_unit`]=g.attributes.unit_of_measurement)}for(let h of["wind_speed","wind_gust_speed"]){let g=s(h),_=We(g);_!==null&&(o[h]=qr(_,g?.attributes.unit_of_measurement))}o.wind_speed_unit="km/h";let a=tt(s("wind_bearing"));a!==null&&(o.wind_bearing=a);let l=If(nt(s("condition"))),c=e.rain_sensor?r.states[e.rain_sensor]:void 0,u=ae(c);u!==null&&e.rain_sensor_inverted&&(u=!u),u===null&&typeof o.precipitation=="number"&&(u=o.precipitation>0),ae(s("lightning"))?l=u?"lightning-rainy":"lightning":ae(s("snow"))?l=u?"snowy-rainy":"snowy":ae(s("fog"))?l="fog":u===!0?l=Number(o.precipitation??0)>=8?"pouring":"rainy":u===!1&&l&&/rain|pouring/.test(l)&&(l=null),!l&&typeof o.cloud_coverage=="number"&&(l=o.cloud_coverage>70?"cloudy":o.cloud_coverage>20?"partlycloudy":"sunny"),!l&&u===!1&&(l="sunny");let m={entity_id:ku,state:l??"unknown",attributes:o},d={...r,states:{...r.states,[ku]:m}};return n.set(e,d),d}var Uo=class extends Q{static properties={hass:{attribute:!1},floors:{attribute:!1},floorId:{attribute:!1},inline:{type:Boolean,reflect:!0},compact:{type:Boolean},folded:{state:!0}};constructor(){super(),this.floors=[],this.floorId=null,this.inline=!1,this.compact=!1,this.folded=null}value(e){return e?p`<span class="value" title=${`${Ot(e)}${e.manual?" \xB7 eigener Z\xE4hler":""}`}><b>${Fe(this.hass,e)}</b>${e.period!=="total"?p`<small>${{day:"heute",month:"Monat",year:"Jahr"}[e.period]}</small>`:f}${G(this.hass,e.sources,`${Te[e.kind]} \xB7 ${Ot(e)}`)}</span>`:f}open(e,t){this.dispatchEvent(new CustomEvent("utility-open",{detail:{floorId:t?this.floorId:e,roomId:t?e:null},bubbles:!0,composed:!0}))}rows(e){return Ie.map(t=>{let n=e.filter(o=>o.kind===t&&o.metric==="power"),i=e.filter(o=>o.kind===t&&o.metric==="energy");return Array.from({length:Math.max(n.length,i.length)},(o,s)=>p`<div class="row"><span class="kind" title=${Te[t]}>${s?"":`${bn[t]} ${Te[t]}`}</span>${n[s]?this.value(n[s]):p`<span></span>`}${i[s]?this.value(i[s]):p`<span></span>`}</div>`)})}render(){if(!this.hass)return f;let e=this.floors.flatMap(s=>s.rooms),t=this.floors.find(s=>s.id===this.floorId);if(this.inline){let s=t?De(this.hass,t,e):hl(this.hass,this.floors);return p`${Ie.map(a=>{let l=s.filter(c=>c.kind===a);return l.length?p`<div class="meter" aria-label=${`${t?.name||"Gesamtgeb\xE4ude"} \xB7 ${Te[a]}`}><span class="medium" title=${t?.name||"Gesamtgeb\xE4ude"}>${bn[a]} ${Te[a]}</span><div class="values">${l.map(c=>this.value(c))}</div></div>`:f})}`}let i=(t?so(this.hass,t,e):[...this.floors].sort((s,a)=>a.elevation-s.elevation).map(s=>({id:s.id,name:s.name,path:"",readings:De(this.hass,s,e),rooms:[]}))).filter(s=>s.readings.length);if(!i.length)return f;let o=this.folded??this.compact;return p`<section class="panel" aria-label=${t?"BereichsLine truncated
|
||||
<button class="heading" aria-expanded=${!o} @click=${()=>{this.folded=!o}}><span>${t?"Bereiche":"Stockwerke"}<small>${t?.name||"Gesamtgeb\xE4ude"}</small></span><span aria-hidden="true">${o?"+":"\u2212"}</span></button>
|
||||
${o?f:p`<div class="entries"><div class="columns"><span></span><span title="Leistung bzw. Durchfluss">Leistung</span><span>Energie / Verbrauch</span></div>
|
||||
${i.map(s=>p`<section class="entry" data-area=${t?s.id:f}>
|
||||
@@ -1649,9 +1649,9 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.kind { color:var(--nf-muted); font-size:10px; white-space:nowrap; }
|
||||
.row .value b { font-size:11px; font-weight:normal; }
|
||||
@media(max-width:600px) { .entries { max-height:32vh; } }
|
||||
`};customElements.get("nf-utility-overview")||customElements.define("nf-utility-overview",Vo);var wu="image:";function Ko(r,e,t){let n=(e??"").trim();if(!n)return null;if(n.startsWith(wu))return t(n.slice(wu.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 Cn=r=>Number(r);function Ln(r){if(Array.isArray(r)){let[o,s]=[Cn(r[0]),Cn(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]=[Cn(e),Cn(t)];return Number.isFinite(n)&&Number.isFinite(i)?[n,i]:null}function xu(r){return r?Ln(r.charger)??Ln(r.charger_position):null}function ku(r){for(let[e,t]of Object.entries(r.states))if(e.startsWith("camera.")&&(Ln(t.attributes?.vacuum_position)??xu(t.attributes)))return e;return null}var $f=r=>Array.isArray(r)?typeof r[0]=="number":!!r&&typeof r=="object",Nn=(r,e)=>e?[r[0],-r[1]]:r;function Mf(r){if(!r)return null;let e=r.mirror===!0,[t,n]=Nn(r.ga,e),[i,o]=Nn(r.gb,e),[s,a]=r.a,[l,c]=r.b,[u,d]=[i-t,o-n],[m,h]=[l-s,c-a],g=Math.hypot(u,d),_=Math.hypot(m,h);if(!(g>1e-6)||!(_>1e-6))return null;let b=_/g,v=Math.atan2(h,m)-Math.atan2(d,u),[S,k]=[Math.cos(v),Math.sin(v)];return M=>{let z=Nn(M,e),[R,F]=[z[0]-t,z[1]-n];return[s+b*(R*S-F*k),a+b*(R*k+F*S)]}}function Af(r){if(!r)return null;let e=r.mirror===!0,[t,n]=Nn(r.ga,e),[i,o]=Nn(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 Su(r,e,t){if(!e)return null;let n=r.states[e]?.attributes;if(!n)return null;let i=Mf(t)??(g=>g),o=Af(t)??0,s=t?.mirror===!0?-1:1,a=n.vacuum_position,l=Ln(a),c=l?(()=>{let[g,_]=i(l),b=Cn(a?.a)*s;if(!Number.isFinite(b))return{x:g,z:_,heading:0};let v=b*Math.PI/180+o;return{x:g,z:_,heading:Math.atan2(Math.cos(v),Math.sin(v))}})():null,u=xu(n),d=Array.isArray(n.path)?n.path:[],m=d.length>0&&$f(d[0])?[d]:d,h=[];for(let g of m){let _=[];for(let b of Array.isArray(g)?g:[]){let v=Ln(b);v&&_.push(i(v))}_.length>1&&h.push(_)}return!c&&!u&&!h.length?null:{pose:c,charger:u?i(u):null,path:h}}var $u="nextfloor.lock3d",Mu=520,Uo=class extends Q{static properties={hass:{attribute:!1},building:{attribute:!1},floorId:{attribute:!1},roomId:{attribute:!1},wallMode:{attribute:!1},solidWalls:{attribute:!1},glassWalls:{attribute:!1},explode:{type:Boolean},keepRoof:{attribute:!1},markerMode:{attribute:!1},markerNames:{attribute:!1},markersOutside:{attribute:!1},tapInRoom:{type:Boolean},roomDoubleTap:{attribute:!1},heatMode:{attribute:!1},theme:{attribute:!1},accent:{attribute:!1},furnitureColors:{attribute:!1},packs:{attribute:!1},showEnergy:{attribute:!1},flows:{attribute:!1},holograms:{attribute:!1},furnish:{type:Boolean},surfaceGrab:{attribute:!1},furnishTypes:{attribute:!1},weather:{type:Boolean},weatherEntityId:{attribute:!1},weatherDensity:{attribute:!1},timeOfDay:{attribute:!1},selectedFurniture:{attribute:!1},selectedDevice:{attribute:!1},_sky:{state:!0},quality:{attribute:!1},showStats:{type:Boolean},_stats:{state:!0},_error:{state:!0},_energy:{state:!0},_flows:{state:!0},_liveEnergy:{state:!0},_liveCards:{state:!0},_liveCardOn:{state:!0},_houseFolded:{state:!0},_utilityOverviewVisible:{state:!0},_swipe:{state:!0},_menu:{state:!0},_pluginWindow:{state:!0},_plate:{state:!0},_blend:{state:!0},_wallBig:{state:!0},_find:{state:!0},_central:{state:!0},_thumbsCompact:{state:!0},_armed:{state:!0},central:{attribute:!1},centralOpen:{attribute:!1},keepCamera:{attribute:!1},plain:{attribute:!1},rightBack:{attribute:!1},templateName:{attribute:!1},readable:{type:Boolean,reflect:!0},today:{attribute:!1},_todayOpen:{state:!0},_todayItems:{state:!0},_forecast:{state:!0},zoom:{attribute:!1},buttons:{attribute:!1},_thumbs:{state:!0},floorThumbs:{attribute:!1},clean:{attribute:!1},cleanButton:{attribute:!1},clock:{attribute:!1},lockButton:{attribute:!1},walkButton:{attribute:!1},travelButton:{attribute:!1},_travel:{state:!0},_walking:{state:!0},_stick:{state:!0},_locked:{state:!0},_now:{state:!0},roomLabels:{attribute:!1},roomNamesButton:{attribute:!1},floorStack:{attribute:!1},panelOpen:{attribute:!1},alerts:{attribute:!1},alertJump:{attribute:!1},scenes:{attribute:!1},announcements:{attribute:!1},sensorBar:{attribute:!1},screenName:{attribute:!1},_announcement:{state:!0},dimmed:{attribute:!1},autoOrbit:{attribute:!1},startView:{attribute:!1},outsideOpen:{attribute:!1},_low:{state:!0},_narrowStage:{state:!0},_shortStage:{state:!0},_phoneStage:{state:!0},_alerts:{state:!0},_sceneFired:{state:!0}};stopAnnouncements=null;announceTimer;get liveCardsOn(){return this.holograms??this._liveCardOn}cloud=0;confirmSet=new Set;shownStartView;placementInfo=new Map;live=null;travelTimer;dayCurves=null;curvesAt=0;clockTimer;stopPlugins=null;pluginsDirty=!1;resizeObs=null;alertSrc=null;alertTimer;contactTimer;seenAlerts=new Set;roomFlash=null;findIndex=null;tintSig="";thumbTimer;thumbSig="";thumbsAt=0;armTimer;forecastAt=0;forecastKey
Line truncated
|
||||
`};customElements.get("nf-utility-overview")||customElements.define("nf-utility-overview",Uo);var Mu="image:";function jo(r,e,t){let n=(e??"").trim();if(!n)return null;if(n.startsWith(Mu))return t(n.slice(Mu.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 Nn=r=>Number(r);function Ln(r){if(Array.isArray(r)){let[o,s]=[Nn(r[0]),Nn(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]=[Nn(e),Nn(t)];return Number.isFinite(n)&&Number.isFinite(i)?[n,i]:null}function Au(r){return r?Ln(r.charger)??Ln(r.charger_position):null}function Eu(r){for(let[e,t]of Object.entries(r.states))if(e.startsWith("camera.")&&(Ln(t.attributes?.vacuum_position)??Au(t.attributes)))return e;return null}var Cf=r=>Array.isArray(r)?typeof r[0]=="number":!!r&&typeof r=="object",On=(r,e)=>e?[r[0],-r[1]]:r;function Nf(r){if(!r)return null;let e=r.mirror===!0,[t,n]=On(r.ga,e),[i,o]=On(r.gb,e),[s,a]=r.a,[l,c]=r.b,[u,m]=[i-t,o-n],[d,h]=[l-s,c-a],g=Math.hypot(u,m),_=Math.hypot(d,h);if(!(g>1e-6)||!(_>1e-6))return null;let b=_/g,v=Math.atan2(h,d)-Math.atan2(m,u),[S,k]=[Math.cos(v),Math.sin(v)];return M=>{let z=On(M,e),[R,F]=[z[0]-t,z[1]-n];return[s+b*(R*S-F*k),a+b*(R*k+F*S)]}}function Of(r){if(!r)return null;let e=r.mirror===!0,[t,n]=On(r.ga,e),[i,o]=On(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 Ru(r,e,t){if(!e)return null;let n=r.states[e]?.attributes;if(!n)return null;let i=Nf(t)??(g=>g),o=Of(t)??0,s=t?.mirror===!0?-1:1,a=n.vacuum_position,l=Ln(a),c=l?(()=>{let[g,_]=i(l),b=Nn(a?.a)*s;if(!Number.isFinite(b))return{x:g,z:_,heading:0};let v=b*Math.PI/180+o;return{x:g,z:_,heading:Math.atan2(Math.cos(v),Math.sin(v))}})():null,u=Au(n),m=Array.isArray(n.path)?n.path:[],d=m.length>0&&Cf(m[0])?[m]:m,h=[];for(let g of d){let _=[];for(let b of Array.isArray(g)?g:[]){let v=Ln(b);v&&_.push(i(v))}_.length>1&&h.push(_)}return!c&&!u&&!h.length?null:{pose:c,charger:u?i(u):null,path:h}}var zu="nextfloor.lock3d",Tu=520,Zo=class extends Q{static properties={hass:{attribute:!1},building:{attribute:!1},floorId:{attribute:!1},roomId:{attribute:!1},wallMode:{attribute:!1},solidWalls:{attribute:!1},glassWalls:{attribute:!1},explode:{type:Boolean},keepRoof:{attribute:!1},markerMode:{attribute:!1},markerNames:{attribute:!1},markersOutside:{attribute:!1},tapInRoom:{type:Boolean},roomDoubleTap:{attribute:!1},heatMode:{attribute:!1},theme:{attribute:!1},accent:{attribute:!1},furnitureColors:{attribute:!1},packs:{attribute:!1},showEnergy:{attribute:!1},flows:{attribute:!1},holograms:{attribute:!1},furnish:{type:Boolean},surfaceGrab:{attribute:!1},furnishTypes:{attribute:!1},weather:{type:Boolean},weatherEntityId:{attribute:!1},weatherDensity:{attribute:!1},timeOfDay:{attribute:!1},selectedFurniture:{attribute:!1},selectedDevice:{attribute:!1},_sky:{state:!0},quality:{attribute:!1},showStats:{type:Boolean},_stats:{state:!0},_error:{state:!0},_energy:{state:!0},_flows:{state:!0},_liveEnergy:{state:!0},_liveCards:{state:!0},_liveCardOn:{state:!0},_houseFolded:{state:!0},_utilityOverviewVisible:{state:!0},_swipe:{state:!0},_menu:{state:!0},_pluginWindow:{state:!0},_plate:{state:!0},_blend:{state:!0},_wallBig:{state:!0},_find:{state:!0},_central:{state:!0},_thumbsCompact:{state:!0},_armed:{state:!0},central:{attribute:!1},centralOpen:{attribute:!1},keepCamera:{attribute:!1},plain:{attribute:!1},rightBack:{attribute:!1},templateName:{attribute:!1},readable:{type:Boolean,reflect:!0},today:{attribute:!1},_todayOpen:{state:!0},_todayItems:{state:!0},_forecast:{state:!0},zoom:{attribute:!1},buttons:{attribute:!1},_thumbs:{state:!0},floorThumbs:{attribute:!1},clean:{attribute:!1},cleanButton:{attribute:!1},clock:{attribute:!1},lockButton:{attribute:!1},walkButton:{attribute:!1},travelButton:{attribute:!1},_travel:{state:!0},_walking:{state:!0},_stick:{state:!0},_locked:{state:!0},_now:{state:!0},roomLabels:{attribute:!1},roomNamesButton:{attribute:!1},floorStack:{attribute:!1},panelOpen:{attribute:!1},alerts:{attribute:!1},alertJump:{attribute:!1},scenes:{attribute:!1},announcements:{attribute:!1},sensorBar:{attribute:!1},screenName:{attribute:!1},_announcement:{state:!0},dimmed:{attribute:!1},autoOrbit:{attribute:!1},startView:{attribute:!1},outsideOpen:{attribute:!1},_low:{state:!0},_narrowStage:{state:!0},_shortStage:{state:!0},_phoneStage:{state:!0},_alerts:{state:!0},_sceneFired:{state:!0}};stopAnnouncements=null;announceTimer;get liveCardsOn(){return this.holograms??this._liveCardOn}cloud=0;confirmSet=new Set;shownStartView;placementInfo=new Map;live=null;travelTimer;dayCurves=null;curvesAt=0;clockTimer;stopPlugins=null;pluginsDirty=!1;resizeObs=null;alertSrc=null;alertTimer;contactTimer;seenAlerts=new Set;roomFlash=null;findIndex=null;tintSig="";thumbTimer;thumbSig="";thumbsAt=0;armTimer;forecastAt=0;forecastKey
Line truncated
|
||||
${e.map(t=>p`<button class="nf-chip" aria-pressed=${!this.hiddenLayers.has(t.id)} @click=${()=>this.toggleLayer(t.id)}>${this.hiddenLayers.has(t.id)?"\u25CC":"\u{1F441}"} ${t.name}</button>`)}
|
||||
</div>`}syncDevices(e){let t=this.viewer,n=this.building;if(!t||!n||!this.hass)return;let i=this._travel,o=i&&!i.loading?Bt(this.hass,i.history,i.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==o.entities)&&(this.openingLinks=Ne(o,n.floors),this.furnitureLinks=ft(o,n.floors),this.linkedRegistry=o.entities,this.findIndex=null,this.alertSrc=this.alerts?hc(o,n,this.weatherEntityId,this.openingLinks):null,this.watched=vc({hass:o,building:n,openingLinks:this.openingLinks,furnitureLinks:this.furnitureLinks,needsRoomSensors:this.heatMode!=="none"||this.roomLabels,alertSources:this.alertSrc,weatherEntityId:this.weatherEntityId}),e=!0),!(e||this.watched.some(y=>this.shownStates.get(y)!==o.states[y])))return;Ho(o,n).join(",")!==this.shownFor?.key&&t.setBuilding(this.shownBuilding(o)),this.shownStates=new Map(this.watched.map(y=>[y,o.states[y]])),this.refreshToday(n),this.refreshForecast(n);let a=wn(o,n),l=Va(o,n.floors.some(y=>y.layer&&this.hiddenLayers.has(y.id))?this.shownBuilding(o):n);this.placementInfo=new Map(l.map(y=>[y.id,{floorId:y.floorId,roomId:y.roomId,x:y.x,z:y.z,y:y.y,rotation:y.rotation??0}]));let c=this.furnitureMarkers(o,n,new Set(l.map(y=>y.id)),new Set(a.map(y=>y.powerEntity)));a.push(...c.consumers);let u=xn(o,n,a,Ke(n,y=>this.furnitureLinks?.get(y.id)?.power??null)),d=new Map(a.filter(y=>y.id!==y.powerEntity).map(y=>[y.id,y.power]));this.confirmSet=gt(o,n.floors);let m=new Set(this.liveCardsOn?this._liveCards.flatMap(y=>y.kind==="media"?[y.media.entity]:y.kind==="car"?[y.spot]:[]):[]);for(let y of n.floors)for(let x of y.outdoor??[]){if(!x.area_id&&!x.temp_entity&&!x.pump_entity)continue;let B=x.temp_entity?o.states[x.temp_entity]:void 0,D=x.pump_entity?o.states[x.pump_entity]:void 0,[W,fe]=Ee(x.points),st=B&&Number.isFinite(Number(B.state))?`${L(o,le(o,ur(Number(B.state),B.attributes.unit_of_measurement)),1)} ${re(o)}`:"",xt=!!D&&te(D);l.push({id:x.area_id?`outdoor:${x.id}`:x.pump_entity??x.temp_entity,floorId:y.id,roomId:null,x:W,z:fe,y:ir(y,x,W,fe)+.7,icon:Re(x.type==="pool"?"pool":x.type==="terrace"?"table-chair":"tree-outline"),name:x.area_id&&o.areas?.[x.area_id]?.name||$(o,`out_${x.type}`),text:[st,xt?$(o,"pool_pump_on"):""].filter(Boolean).join(" \xB7 "),active:xt,unavailable:!1,glow:null,show:"always"})}let h=new Map;for(let y of n.floors){for(let x of y.placements)x.pin_offset&&h.set(`${y.id}:${x.entity_id}`,x.pin_offset);for(let x of y.furniture)x.pin_offset&&h.set(`f:${x.id}`,x.pin_offset)}let g=y=>{let x=y.lamp?void 0:(y.furnitureId?h.get(`f:${y.furnitureId}`):void 0)??h.get(`${y.floorId}:${y.id}`);return x?{...y,x:y.x+(x.x??0),z:y.z+(x.z??0),y:y.y+(x.y??0)}:y};t.setDevices([...[...l,...c.markers].map(g).map(y=>{let x=y.show==="no_power"||"energyDevice"in y&&y.energyDevice?null:d.get(y.id)??null,B={...y,power:x,powerText:x===null?void 0:de(o,x),effect:this.dimmed?void 0:y.effect,text:this.subMeterText(o,n,u,y.furnitureId)??y.text},D=y.ownName&&(y.showName||this.markerNames)?y.ownName:"",W=m.has(y.id)||!!y.furnitureId&&m.has(y.furnitureId);return{...B,pin:this.showPin(B)&&!W,full:y.show==="always",caption:D}})]),t.setPickTargets(c.targets,this.openingTargets(),this.secondBlinds()),t.setScreens(c.screens),t.setFridgeDoors(Sa(o,n.floors)),t.setCovers(Pa(o,n)),t.setRobots(this.robotInfos(o,n));let _=new Map;for(let y of n.floors)for(let x of y.furniture)!X(x.type)?.pet||!x.room_sensor||x.room_sensor==="none"||_.set(x.id,Bi(o,y.rooms.filter(B=>B.points.length>=3),null,x.room_sensor)?.id??null);_.size&&t.setPetRooms(_),t.setRoofWindows(ac(o,n)),t.setParked(xo(o,n)),t.setGateStates($c(o,n));let b=new Map(n.floors.flatMap(y=>y.openings.map(x=>[x.id,x.type]))),v=new Map([...this.openingLinks].map(([y,x])=>[y,Le(o,x,b.get(y))]));t.setOpeningStates(v),this.setAlerts(this.alertSrc?vo(o,n,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(o);let S=[...l,...c.markers].map(y=>`${y.id}:${y.glow?`${y.glow.level.toFixed(1)}/${y.glow.color.map(x=>x.toFixed(1)).join("/")}`:0}`).join(";")+"|"+[...v].map(([y,x])=>`${y}:${x.open}:${x.cover===null?"-":x.cover.toFixed(1)}`).join(";");if(S!==this.thumbSig){let y=this.thumbSig==="";this.thumbSig=S,y||this.scheduleThumbs(1500)}let k=Lc(o,n,a,n.energy.advanced?y=>this.furnitureLinks?.get(y.id)?.power??null:void 0),M=this.liveCars(o,n);for(let y of M){if(!y.car.home||!y.car.charging&&!y.car.plugged)continue;let x=n.floors.flatMap(W=>W.furniture.filter(fe=>fe.type==="wallbox").map(fe=>({floorId:W.id,x:fe.x,z:fe.z,y:1}))).sort((W,fe)=>Math.hypot(W.x-y.at.x,W.z-y.at.z)-Math.hypot(fe.x-y.at.x,fe.z-y.at.z))[0],B=x&&x.floorId===y.at.floorId&&Math.hypot(x.x-y.at.x,x.z-y.at.z)<9,D=x??Fn(n);!D||!y.car.charging&&!B||k.arcs.push({key:`car:${y.spot}`,from:D,to:{...y.at,y:.8},power:y.car.charging?y.car.chargingW??7e3:0,color:[80,175,255],...B?{via:[{...D,y:.35},{floorId:y.at.floorId,x:(D.x+y.at.x)/2,z:(D.z+y.at.z)/2,y:.08},{...y.at,y:.5}],cable:!0}:{}})}let z=Fn(n);for(let y of this.liveHeatPumps(n)){let x=y.pump.heat??(y.pump.mode==="heating"||y.pLine truncated
|
||||
</div>`}syncDevices(e){let t=this.viewer,n=this.building;if(!t||!n||!this.hass)return;let i=this._travel,o=i&&!i.loading?Vt(this.hass,i.history,i.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==o.entities)&&(this.openingLinks=Ne(o,n.floors),this.furnitureLinks=ft(o,n.floors),this.linkedRegistry=o.entities,this.findIndex=null,this.alertSrc=this.alerts?fc(o,n,this.weatherEntityId,this.openingLinks):null,this.watched=kc({hass:o,building:n,openingLinks:this.openingLinks,furnitureLinks:this.furnitureLinks,needsRoomSensors:this.heatMode!=="none"||this.roomLabels,alertSources:this.alertSrc,weatherEntityId:this.weatherEntityId}),e=!0),!(e||this.watched.some(y=>this.shownStates.get(y)!==o.states[y])))return;Io(o,n).join(",")!==this.shownFor?.key&&t.setBuilding(this.shownBuilding(o)),this.shownStates=new Map(this.watched.map(y=>[y,o.states[y]])),this.syncHydronics(t,n,o),this.refreshToday(n),this.refreshForecast(n);let a=xn(o,n),l=Ua(o,n.floors.some(y=>y.layer&&this.hiddenLayers.has(y.id))?this.shownBuilding(o):n);this.placementInfo=new Map(l.map(y=>[y.id,{floorId:y.floorId,roomId:y.roomId,x:y.x,z:y.z,y:y.y,rotation:y.rotation??0}]));let c=this.furnitureMarkers(o,n,new Set(l.map(y=>y.id)),new Set(a.map(y=>y.powerEntity)));a.push(...c.consumers);let u=kn(o,n,a,Ke(n,y=>this.furnitureLinks?.get(y.id)?.power??null)),m=new Map(a.filter(y=>y.id!==y.powerEntity).map(y=>[y.id,y.power]));this.confirmSet=gt(o,n.floors);let d=new Set(this.liveCardsOn?this._liveCards.flatMap(y=>y.kind==="media"?[y.media.entity]:y.kind==="car"?[y.spot]:[]):[]);for(let y of n.floors)for(let x of y.outdoor??[]){if(!x.area_id&&!x.temp_entity&&!x.pump_entity)continue;let B=x.temp_entity?o.states[x.temp_entity]:void 0,D=x.pump_entity?o.states[x.pump_entity]:void 0,[W,fe]=Ee(x.points),st=B&&Number.isFinite(Number(B.state))?`${O(o,le(o,dr(Number(B.state),B.attributes.unit_of_measurement)),1)} ${re(o)}`:"",kt=!!D&&te(D);l.push({id:x.area_id?`outdoor:${x.id}`:x.pump_entity??x.temp_entity,floorId:y.id,roomId:null,x:W,z:fe,y:or(y,x,W,fe)+.7,icon:Re(x.type==="pool"?"pool":x.type==="terrace"?"table-chair":"tree-outline"),name:x.area_id&&o.areas?.[x.area_id]?.name||$(o,`out_${x.type}`),text:[st,kt?$(o,"pool_pump_on"):""].filter(Boolean).join(" \xB7 "),active:kt,unavailable:!1,glow:null,show:"always"})}let h=new Map;for(let y of n.floors){for(let x of y.placements)x.pin_offset&&h.set(`${y.id}:${x.entity_id}`,x.pin_offset);for(let x of y.furniture)x.pin_offset&&h.set(`f:${x.id}`,x.pin_offset)}let g=y=>{let x=y.lamp?void 0:(y.furnitureId?h.get(`f:${y.furnitureId}`):void 0)??h.get(`${y.floorId}:${y.id}`);return x?{...y,x:y.x+(x.x??0),z:y.z+(x.z??0),y:y.y+(x.y??0)}:y};t.setDevices([...[...l,...c.markers].map(g).map(y=>{let x=y.show==="no_power"||"energyDevice"in y&&y.energyDevice?null:m.get(y.id)??null,B={...y,power:x,powerText:x===null?void 0:de(o,x),effect:this.dimmed?void 0:y.effect,text:this.subMeterText(o,n,u,y.furnitureId)??y.text},D=y.ownName&&(y.showName||this.markerNames)?y.ownName:"",W=d.has(y.id)||!!y.furnitureId&&d.has(y.furnitureId);return{...B,pin:this.showPin(B)&&!W,full:y.show==="always",caption:D}})]),t.setPickTargets(c.targets,this.openingTargets(),this.secondBlinds()),t.setScreens(c.screens),t.setFridgeDoors(Aa(o,n.floors)),t.setCovers(Na(o,n)),t.setRobots(this.robotInfos(o,n));let _=new Map;for(let y of n.floors)for(let x of y.furniture)!X(x.type)?.pet||!x.room_sensor||x.room_sensor==="none"||_.set(x.id,Ki(o,y.rooms.filter(B=>B.points.length>=3),null,x.room_sensor)?.id??null);_.size&&t.setPetRooms(_),t.setRoofWindows(uc(o,n)),t.setParked(So(o,n)),t.setGateStates(Rc(o,n));let b=new Map(n.floors.flatMap(y=>y.openings.map(x=>[x.id,x.type]))),v=new Map([...this.openingLinks].map(([y,x])=>[y,Oe(o,x,b.get(y))]));t.setOpeningStates(v),this.setAlerts(this.alertSrc?wo(o,n,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(o);let S=[...l,...c.markers].map(y=>`${y.id}:${y.glow?`${y.glow.level.toFixed(1)}/${y.glow.color.map(x=>x.toFixed(1)).join("/")}`:0}`).join(";")+"|"+[...v].map(([y,x])=>`${y}:${x.open}:${x.cover===null?"-":x.cover.toFixed(1)}`).join(";");if(S!==this.thumbSig){let y=this.thumbSig==="";this.thumbSig=S,y||this.scheduleThumbs(1500)}let k=Vc(o,n,a,n.energy.advanced?y=>this.furnitureLinks?.get(y.id)?.power??null:void 0),M=this.liveCars(o,n);for(let y of M){if(!y.car.home||!y.car.charging&&!y.car.plugged)continue;let x=n.floors.flatMap(W=>W.furniture.filter(fe=>fe.type==="wallbox").map(fe=>({floorId:W.id,x:fe.x,z:fe.z,y:1}))).sort((W,fe)=>Math.hypot(W.x-y.at.x,W.z-y.at.z)-Math.hypot(fe.x-y.at.x,fe.z-y.at.z))[0],B=x&&x.floorId===y.at.floorId&&Math.hypot(x.x-y.at.x,x.z-y.at.z)<9,D=x??Hn(n);!D||!y.car.charging&&!B||k.arcs.push({key:`car:${y.spot}`,from:D,to:{...y.at,y:.8},power:y.car.charging?y.car.chargingW??7e3:0,color:[80,175,255],...B?{via:[{...D,y:.35},{floorId:y.at.floorId,x:(D.x+y.at.x)/2,z:(D.z+y.at.z)/2,y:.08},{...y.at,y:.5}],cable:!0}:{}})}let z=Hn(n);for(let y of this.liveHeatPumps(n)){let x=y.pump.heat??(y.Line truncated
|
||||
<button class="nf-thumbs-fold" title=${$(this.hass,n?"thumbs_show":"thumbs_fold")} aria-label=${$(this.hass,n?"thumbs_show":"thumbs_fold")} @click=${i}>${n?"\u25B8":"\u25C2"}</button>
|
||||
<button class="nf-thumb nf-thumb-house" aria-pressed=${this.floorId===null} @click=${()=>this.fire("floor-tap",{floorId:null})}>
|
||||
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"><path d="M3 11l9-7 9 7M5 10v10h14V10" /></svg>
|
||||
@@ -1661,16 +1661,16 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${n?f:p`<img src=${o.url} alt="" />`}
|
||||
<span>${e.get(o.floorId)??""}</span>
|
||||
</button>`)}
|
||||
</nav>`}onDeviceHold(e,t,n){let i=H(e);i==="light"||i==="cover"||i==="switch"||i==="fan"||i==="lock"?this._menu={entity:e,x:t,y:n}:ye(this,e)}onDeviceSwipe(e,t,n,i,o){let s=this.hass?.states[e];if(t==="start"){if(!s||C(s)||this.confirmSet.has(e))return!1;let l=H(e);if(l==="light"&&Wo(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"&&Bo(s)){let c=s.attributes.current_position;return this._swipe={entity:e,kind:"cover",start:c,value:c,x:i,y:o},!0}return!1}let a=this._swipe;if(!a||a.entity!==e)return!1;if(t==="move"){let l=Math.round(Math.min(100,Math.max(0,a.start-n/220*100)));l!==a.value&&(this._swipe={...a,value:l});let c=performance.now();c-this.swipeSent>350&&(this.swipeSent=c,this.applySwipe())}else this.applySwipe(),clearTimeout(this.swipeTimer),this.swipeTimer=setTimeout(()=>this._swipe=null,700);return!0}applySwipe(){let e=this._swipe;!e||!this.hass||(e.kind==="light"?e.value<=0?this.hass.callService("light","turn_off",{entity_id:e.entity}):this.hass.callService("light","turn_on",{entity_id:e.entity,brightness_pct:e.value}):e.kind==="fan"?e.value<=0?this.hass.callService("fan","turn_off",{entity_id:e.entity}):this.hass.callService("fan","set_percentage",{entity_id:e.entity,percentage:e.value}):this.hass.callService("cover","set_cover_position",{entity_id:e.entity,position:e.value}))}openRoom(e,t){this.floorId===e&&this.roomId===t||(this.floorId!==e?(this.fire("floor-tap",{floorId:e}),setTimeout(()=>this.fire("room-tap",{floorId:e,roomId:t}),60)):this.fire("room-tap",{floorId:e,roomId:t}))}goTo(e){if(this._find=null,e.kind==="room"||e.kind==="circuit"){e.roomId&&this.openRoom(e.floorId,e.roomId);return}this.floorId!==e.floorId&&this.fire("floor-tap",{floorId:e.floorId}),setTimeout(()=>this.viewer?.focus(e.floorId,e.x,e.z,e.y,e.entity),120)}listenToAnnouncements(e){if(!e){this.stopAnnouncements?.(),this.stopAnnouncements=null,clearTimeout(this.announceTimer);return}if(this.stopAnnouncements)return;let t=!1;this.stopAnnouncements=()=>t=!0,Qa(this.hass,n=>this.announce(n)).then(n=>{t?n():this.stopAnnouncements=n})}announce(e){let t=e;if(t?.reload===!0){(!t.template||t.template===this.templateName)&&setTimeout(()=>location.reload(),500+Math.random()*6e3);return}if(typeof e?.message!="string"||!e.message.trim()||!qa(e,this.screenName)||!Za(e))return;let n=Ya(e.message);this._announcement={message:e.message,until:Date.now()+n},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,n),Ja(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?p`<button class="nf-announcement" role="alert" title=${$(this.hass,"close")} @click=${()=>this._announcement=null}>
|
||||
</nav>`}onDeviceHold(e,t,n){let i=P(e);i==="light"||i==="cover"||i==="switch"||i==="fan"||i==="lock"?this._menu={entity:e,x:t,y:n}:ye(this,e)}onDeviceSwipe(e,t,n,i,o){let s=this.hass?.states[e];if(t==="start"){if(!s||C(s)||this.confirmSet.has(e))return!1;let l=P(e);if(l==="light"&&Ko(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"&&Go(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,tl(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()||!Ja(e,this.screenName)||!Qa(e))return;let n=Xa(e.message);this._announcement={message:e.message,until:Date.now()+n},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,n),el(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?p`<button class="nf-announcement" role="alert" title=${$(this.hass,"close")} @click=${()=>this._announcement=null}>
|
||||
<span class="nf-announcement-icon" aria-hidden="true">📢</span><span class="nf-announcement-text">${e.message}</span>
|
||||
</button>`:f}renderAlerts(){let e=this.building;if(!this._alerts.length||!e)return f;let t=this._alerts.slice(0,3);return p`<div class="nf-alert-banner" role="alert">
|
||||
${t.map(n=>p`<button class="nf-alert nf-alert-${n.kind}" style=${n.color?`border-left-color:${n.color}`:""} title=${yo(this.hass,e,n)} @click=${()=>this.jumpTo(n)}>${yo(this.hass,e,n)}</button>`)}
|
||||
${t.map(n=>p`<button class="nf-alert nf-alert-${n.kind}" style=${n.color?`border-left-color:${n.color}`:""} title=${xo(this.hass,e,n)} @click=${()=>this.jumpTo(n)}>${xo(this.hass,e,n)}</button>`)}
|
||||
${this._alerts.length>3?p`<span class="nf-alert-more">+${this._alerts.length-3}</span>`:f}
|
||||
</div>`}renderScenes(){let e=this.building;if(!this.scenes||!this.roomId||this.panelOpen||!e||!this.hass)return f;let t=e.floors.flatMap(o=>o.rooms).find(o=>o.id===this.roomId),n=t?U(this.hass,t).filter(o=>H(o)==="scene"||H(o)==="script").slice(0,6):[];if(!n.length)return f;let i=t?.area_id?this.hass.areas?.[t.area_id]?.name:void 0;return p`<div class="nf-scenes">
|
||||
${n.map(o=>p`<button class="nf-chip" aria-pressed=${this._sceneFired===o} @click=${()=>this.runScene(o)}>${O(this.hass,o,i)}</button>`)}
|
||||
</div>`}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?U(this.hass,t).filter(o=>P(o)==="scene"||P(o)==="script").slice(0,6):[];if(!n.length)return f;let i=t?.area_id?this.hass.areas?.[t.area_id]?.name:void 0;return p`<div class="nf-scenes">
|
||||
${n.map(o=>p`<button class="nf-chip" aria-pressed=${this._sceneFired===o} @click=${()=>this.runScene(o)}>${L(this.hass,o,i)}</button>`)}
|
||||
</div>`}renderFind(){let e=this.building;if(!e||!this.hass)return f;if(this._find===null)return p`<button class="nf-find-btn" title=${$(this.hass,"find")} aria-label=${$(this.hass,"find")} @click=${()=>this._find=""}>
|
||||
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="6.5" /><path d="M16 16l4.5 4.5" /></svg>
|
||||
</button>`;let t=hu(this.findIndex??=du(this.hass,e),this._find);return p`<div class="nf-find">
|
||||
</button>`;let t=_u(this.findIndex??=gu(this.hass,e),this._find);return p`<div class="nf-find">
|
||||
<input
|
||||
type="search"
|
||||
placeholder=${$(this.hass,"find_placeholder")}
|
||||
@@ -1681,7 +1681,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
<button class="nf-find-close" aria-label=${$(this.hass,"close")} @click=${()=>this._find=null}>✕</button>
|
||||
${this._find.trim()?p`<div class="nf-find-list">
|
||||
${t.length?t.map(n=>p`<button @click=${()=>this.goTo(n)}>
|
||||
<span class="nf-find-icon"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d=${n.icon?xr(n.icon):"M4 10l8-6 8 6v10H4z"} /></svg></span>
|
||||
<span class="nf-find-icon"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d=${n.icon?kr(n.icon):"M4 10l8-6 8 6v10H4z"} /></svg></span>
|
||||
<span><b>${n.name}</b>${n.where?p`<small>${n.where}</small>`:f}</span>
|
||||
</button>`):p`<p>${$(this.hass,"find_none")}</p>`}
|
||||
</div>`:f}
|
||||
@@ -1693,42 +1693,42 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
@click=${()=>{this._central=!this._central,this._armed=null}}
|
||||
>
|
||||
<svg viewBox="0 0 24 24" width="19" height="19" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linejoin="round"><path d="M12 3.5l2.6 5.3 5.9.9-4.3 4.1 1 5.8L12 16.9l-5.2 2.7 1-5.8-4.3-4.1 5.9-.9z" /></svg>
|
||||
</button>`;if(!this._central)return i;let o=this.floorId?e.floors.find(b=>b.id===this.floorId):void 0,s=o?[o]:e.floors,a=s.flatMap(b=>Vi(t,b).lights),l=s.flatMap(b=>Vi(t,b).covers),c=a.filter(b=>t.states[b]?.state==="on").length,u=!o,d=(b,v,S,k)=>{if(k.length){if(u&&this._armed!==b){this._armed=b,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(v,S,{entity_id:k})}},m=(b,v,S,k,M)=>p`<button class="nf-btn ${this._armed===b?"nf-central-armed":""}" ?disabled=${!M.length} @click=${()=>d(b,S,k,M)}>
|
||||
</button>`;if(!this._central)return i;let o=this.floorId?e.floors.find(b=>b.id===this.floorId):void 0,s=o?[o]:e.floors,a=s.flatMap(b=>Gi(t,b).lights),l=s.flatMap(b=>Gi(t,b).covers),c=a.filter(b=>t.states[b]?.state==="on").length,u=!o,m=(b,v,S,k)=>{if(k.length){if(u&&this._armed!==b){this._armed=b,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(v,S,{entity_id:k})}},d=(b,v,S,k,M)=>p`<button class="nf-btn ${this._armed===b?"nf-central-armed":""}" ?disabled=${!M.length} @click=${()=>m(b,S,k,M)}>
|
||||
${this._armed===b?n("central_sure"):n(v)}
|
||||
</button>`,h=e.settings.favorite_floors??{},g=(e.settings.favorites??[]).filter(b=>t.states[b]&&(!h[b]||!o||h[b]===o.id)),_=this.buttons??e.settings.buttons??[];return p`${i}
|
||||
<div class="nf-central ${this.centralOpen?"nf-central-big":""}" role="dialog" aria-label=${n("central")}>
|
||||
<b>${o?o.name:n("central_house")}</b>
|
||||
<div class="nf-central-row">
|
||||
<span>${n("central_lights")}${a.length?p` <small>${c}/${a.length}</small>`:f}</span>
|
||||
${m("lights_on","central_on","light","turn_on",a.filter(b=>t.states[b]?.state==="off"))}
|
||||
${m("lights_off","central_off","light","turn_off",a.filter(b=>t.states[b]?.state==="on"))}
|
||||
${d("lights_on","central_on","light","turn_on",a.filter(b=>t.states[b]?.state==="off"))}
|
||||
${d("lights_off","central_off","light","turn_off",a.filter(b=>t.states[b]?.state==="on"))}
|
||||
</div>
|
||||
${l.length?p`<div class="nf-central-row">
|
||||
<span>${n("central_covers")} <small>${l.length}</small></span>
|
||||
${m("covers_open","central_open","cover","open_cover",l)}
|
||||
${m("covers_close","central_close","cover","close_cover",l)}
|
||||
${d("covers_open","central_open","cover","open_cover",l)}
|
||||
${d("covers_close","central_close","cover","close_cover",l)}
|
||||
</div>`:f}
|
||||
<b>${n("central_favorites")}</b>
|
||||
${g.length?p`<div class="nf-central-favs">
|
||||
${g.map(b=>{let[v,S]=Ra(b),k=t.states[b],M=v==="homeassistant"&&k?.state==="on";return p`<button
|
||||
${g.map(b=>{let[v,S]=Da(b),k=t.states[b],M=v==="homeassistant"&&k?.state==="on";return p`<button
|
||||
class="nf-chip"
|
||||
aria-pressed=${M||this._sceneFired===b}
|
||||
?disabled=${C(k)}
|
||||
@click=${()=>{t.callService(v,S,{entity_id:b}),this._sceneFired=b,setTimeout(()=>this._sceneFired=null,600)}}
|
||||
>
|
||||
${O(t,b)}
|
||||
${L(t,b)}
|
||||
</button>`})}
|
||||
</div>`:_.length?f:p`<p class="nf-central-hint">${n("central_no_favorites")}</p>`}
|
||||
${_.length?p`<div class="nf-central-favs">
|
||||
${_.map(b=>p`<button
|
||||
class="nf-chip nf-own-btn"
|
||||
aria-pressed=${za(t,b)}
|
||||
@click=${v=>{Ki(t,v.currentTarget,b),b.action!=="service"&&(this._central=!1)}}
|
||||
aria-pressed=${Fa(t,b)}
|
||||
@click=${v=>{Ui(t,v.currentTarget,b),b.action!=="service"&&(this._central=!1)}}
|
||||
>
|
||||
${b.icon?p`<ha-icon .icon=${b.icon.startsWith("mdi:")?b.icon:`mdi:${b.icon}`}></ha-icon>`:f}${b.label}
|
||||
</button>`)}
|
||||
</div>`:f}
|
||||
</div>`}toggleLock(){this._locked=!this._locked;try{localStorage.setItem($u,this._locked?"1":"0")}catch{}}async openTravel(e){if(clearInterval(this.travelTimer),this.travelTimer=void 0,e===null||!this.hass){this._travel=null,this.syncDevices(!0);return}let t=Date.now(),n=t-e*36e5;this._travel={history:new Map,from:n,to:t,t:n,playing:!1,speed:e>24?3600:600,hours:e,moments:[],loading:!0};try{let i=await $n(this.hass,Jl(this.watched),n,t);if(!this._travel||this._travel.from!==n)return;this._travel={...this._travel,history:i,moments:Ql(i,n,t),loading:!1}}catch{this._travel=null,this._error=$(this.hass,"travel_failed");return}this.syncDevices(!0)}travelTo(e){let t=this._travel;t&&(this._travel={...t,t:Math.min(t.to,Math.max(t.from,e))},this.syncDevices(!0))}playTravel(e){let t=this._travel;t&&(clearInterval(this.travelTimer),this.travelTimer=void 0,this._travel={...t,playing:e,t:e&&t.t>=t.to?t.from:t.t},e&&(this.travelTimer=setInterval(()=>{let n=this._travel;if(!n)return;let i=n.t+250*n.speed;i>=n.to&&this.playTravel(!1),this.travelTo(i)},250)))}renderTravel(){if(!this.hass||this.clean)return f;let e=a=>$(this.hass,a),t=this._travel;if(!t)return this.travelButton?p`<button class="nf-travel-btn" title=${e("travel")} aria-label=${e("travel")} @click=${()=>{this.openTravel(24)}}>⏪</button>`:f;let n=this.hass.language??navigator.language,i=new Intl.DateTimeFormat(n,{weekday:"short",hour:"2-digit",minute:"2-digit"}).format(new Date(t.t)),o=t.to-t.from||1,s=[[60,"travel_speed_min"],[600,"travel_speed_10min"],[3600,"travel_speed_hour"]];return p`<div class="nf-travel" role="group" aria-label=${e("travel")}>
|
||||
</div>`}toggleLock(){this._locked=!this._locked;try{localStorage.setItem(zu,this._locked?"1":"0")}catch{}}async openTravel(e){if(clearInterval(this.travelTimer),this.travelTimer=void 0,e===null||!this.hass){this._travel=null,this.syncDevices(!0);return}let t=Date.now(),n=t-e*36e5;this._travel={history:new Map,from:n,to:t,t:n,playing:!1,speed:e>24?3600:600,hours:e,moments:[],loading:!0};try{let i=await Mn(this.hass,ec(this.watched),n,t);if(!this._travel||this._travel.from!==n)return;this._travel={...this._travel,history:i,moments:tc(i,n,t),loading:!1}}catch{this._travel=null,this._error=$(this.hass,"travel_failed");return}this.syncDevices(!0)}travelTo(e){let t=this._travel;t&&(this._travel={...t,t:Math.min(t.to,Math.max(t.from,e))},this.syncDevices(!0))}playTravel(e){let t=this._travel;t&&(clearInterval(this.travelTimer),this.travelTimer=void 0,this._travel={...t,playing:e,t:e&&t.t>=t.to?t.from:t.t},e&&(this.travelTimer=setInterval(()=>{let n=this._travel;if(!n)return;let i=n.t+250*n.speed;i>=n.to&&this.playTravel(!1),this.travelTo(i)},250)))}renderTravel(){if(!this.hass||this.clean)return f;let e=a=>$(this.hass,a),t=this._travel;if(!t)return this.travelButton?p`<button class="nf-travel-btn" title=${e("travel")} aria-label=${e("travel")} @click=${()=>{this.openTravel(24)}}>⏪</button>`:f;let n=this.hass.language??navigator.language,i=new Intl.DateTimeFormat(n,{weekday:"short",hour:"2-digit",minute:"2-digit"}).format(new Date(t.t)),o=t.to-t.from||1,s=[[60,"travel_speed_min"],[600,"travel_speed_10min"],[3600,"travel_speed_hour"]];return p`<div class="nf-travel" role="group" aria-label=${e("travel")}>
|
||||
<button class="nf-travel-play" aria-label=${e(t.playing?"travel_pause":"travel_play")} ?disabled=${t.loading} @click=${()=>this.playTravel(!t.playing)}>${t.playing?"\u23F8":"\u25B6"}</button>
|
||||
<b class="nf-travel-when">${t.loading?e("travel_loading"):i}</b>
|
||||
<div class="nf-travel-track">
|
||||
@@ -1761,12 +1761,12 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
>
|
||||
${this.clean?ne`<svg viewBox="0 0 24 24" width="20" height="20"><path fill="currentColor" d="M12 6a9.8 9.8 0 0 1 9 6 9.8 9.8 0 0 1-9 6 9.8 9.8 0 0 1-9-6 9.8 9.8 0 0 1 9-6m0 2a4 4 0 1 0 0 8 4 4 0 0 0 0-8m0 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4" /></svg>`:ne`<svg viewBox="0 0 24 24" width="20" height="20"><path fill="currentColor" d="M2.4 3.8 3.8 2.4l17.8 17.8-1.4 1.4-3.3-3.3A10.5 10.5 0 0 1 12 19a9.8 9.8 0 0 1-9-6 10.3 10.3 0 0 1 3.6-4.3L2.4 3.8M12 7a4 4 0 0 1 4 4c0 .5-.1 1-.3 1.5l-5.2-5.2c.5-.2 1-.3 1.5-.3m-4 4a4 4 0 0 0 5.5 3.7l-5.2-5.2c-.2.5-.3 1-.3 1.5m4-7a9.8 9.8 0 0 1 9 6 10 10 0 0 1-2.6 3.6l-1.4-1.4A8 8 0 0 0 18.8 12 8 8 0 0 0 9.6 7.2L8 5.6A10.3 10.3 0 0 1 12 4" /></svg>`}
|
||||
</button>`}renderSwipe(){let e=this._swipe;if(!e||!this.hass)return f;let t=e.kind==="light"&&e.value<=0;return p`<div class="nf-swipe" style="left:${e.x}px;top:${e.y}px">
|
||||
<span>${O(this.hass,e.entity)}</span>
|
||||
<span>${L(this.hass,e.entity)}</span>
|
||||
<b>${t?$(this.hass,"swipe_off"):`${e.value} %`}</b>
|
||||
<i><em style="height:${e.value}%"></em></i>
|
||||
</div>`}tapPlate(e,t,n){let i=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),o=i?Gi(i.gang_entities,X(i.type)?.gangs??0):[];if(o.length===1)return this.onDeviceTap(o[0],t,n);o.length>1&&(this._plate={ids:o,x:t,y:n})}renderPlate(){let e=this._plate;if(!e||!this.hass)return f;let t=this.hass,n=()=>this._plate=null;return p`<div class="nf-menu-backdrop" @click=${n}></div>
|
||||
</div>`}tapPlate(e,t,n){let i=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),o=i?ji(i.gang_entities,X(i.type)?.gangs??0):[];if(o.length===1)return this.onDeviceTap(o[0],t,n);o.length>1&&(this._plate={ids:o,x:t,y:n})}renderPlate(){let e=this._plate;if(!e||!this.hass)return f;let t=this.hass,n=()=>this._plate=null;return p`<div class="nf-menu-backdrop" @click=${n}></div>
|
||||
<div class="nf-plate-menu" style="left:${Math.max(8,e.x-110)}px;top:${Math.max(8,e.y-20-e.ids.length*46)}px" role="menu">
|
||||
${e.ids.map((i,o)=>{let s=t.states[i],a=te(s)||s?.state==="on";return p`<button role="menuitem" class=${a?"on":""} @click=${()=>{n(),this.onDeviceTap(i,e.x,e.y)}}><b>${o+1}</b><span>${O(t,i)}</span><i>${s?oe(t,s):"\u2013"}</i></button>`})}
|
||||
${e.ids.map((i,o)=>{let s=t.states[i],a=te(s)||s?.state==="on";return p`<button role="menuitem" class=${a?"on":""} @click=${()=>{n(),this.onDeviceTap(i,e.x,e.y)}}><b>${o+1}</b><span>${L(t,i)}</span><i>${s?se(t,s):"\u2013"}</i></button>`})}
|
||||
</div>`}renderMenu(){let e=this._menu;if(!e||!this.hass)return f;let t=this.renderRoot.querySelector(".nf-stage"),n=t?.clientWidth??800,i=t?.clientHeight??600,o=Math.max(8,Math.min(n-240,e.x-116)),s=Math.max(8,Math.min(i-360,e.y-170));return p`<div class="nf-menu-backdrop" @click=${()=>this._menu=null}></div>
|
||||
<nf-quick-menu
|
||||
style="left:${o}px;top:${s}px"
|
||||
@@ -1777,28 +1777,28 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.presets=${(this.building?.settings.media_presets??[]).filter(a=>!a.speakers?.length||a.speakers.includes(e.entity))}
|
||||
?confirmSwitch=${this.confirmSet.has(e.entity)}
|
||||
.myPosition=${this.myPositionOf(e.entity)}
|
||||
.tiltEntity=${br(this.hass,this.building?.floors??[],e.entity)}
|
||||
.tiltEntity=${vr(this.hass,this.building?.floors??[],e.entity)}
|
||||
@close=${()=>this._menu=null}
|
||||
></nf-quick-menu>`}myPositionOf(e){for(let t of this.building?.floors??[])for(let n of t.openings){let i=this.openingLinks?.get(n.id);if(n.my_position!=null&&(i?.cover===e||i?.cover2===e))return n.my_position}return null}onDeviceTap(e,t=0,n=0){if(e.startsWith("lamp:")||this._travel)return;let i=e.startsWith("tap:")?e.slice(4):this.tapPins.get(e);if(i){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===i);s?.tap&&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??Ke(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&ye(this,a);return}let o=H(e);if(o==="cover"||o==="media"){this._menu={entity:e,x:t,y:n};return}if(o==="lock"){let s=Oi(this.hass,e),a=O(this.hass,e);confirm($(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(o&&na.has(o)){if(this.confirmSet.has(e)&&!confirm($(this.hass,"confirm_switch",{name:O(this.hass,e)})))return;Ga(this.hass,e)}else ye(this,e)}pluginTapped(e){let t=this.hass?.states[e],n=this.placementInfo.get(e);if(!t||!n)return!1;let i=this.building?.floors.find(o=>o.id===n.floorId)?.placements.find(o=>o.entity_id===e);return Ps({hass:this.hass,entityId:e,state:t},n,i?.plugin??void 0,{showWindow:(o,s)=>{o&&"hass"in o&&(o.hass=this.hass),this._pluginWindow=o?{node:o,title:s?.title??""}:null},moreInfo:o=>ye(this,o??e)})}renderPluginWindow(){let e=this._pluginWindow;return e?p`<div class="nf-plugin-window" @pointerdown=${t=>t.stopPropagation()}>
|
||||
></nf-quick-menu>`}myPositionOf(e){for(let t of this.building?.floors??[])for(let n of t.openings){let i=this.openingLinks?.get(n.id);if(n.my_position!=null&&(i?.cover===e||i?.cover2===e))return n.my_position}return null}onDeviceTap(e,t=0,n=0){if(e.startsWith("lamp:")||this._travel)return;if(e.startsWith("hydronic:")){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===e.slice(9));s&&this.hass&&Co().then(a=>{if(this.isConnected&&this.hass)return this.hydronicModule=a,a.openHydronic(this.hass,s)}).catch(a=>{this._error=String(a)});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&&Ui(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??Ke(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&ye(this,a);return}let o=P(e);if(o==="cover"||o==="media"){this._menu={entity:e,x:t,y:n};return}if(o==="lock"){let s=Bi(this.hass,e),a=L(this.hass,e);confirm($(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(o&&oa.has(o)){if(this.confirmSet.has(e)&&!confirm($(this.hass,"confirm_switch",{name:L(this.hass,e)})))return;qa(this.hass,e)}else ye(this,e)}pluginTapped(e){let t=this.hass?.states[e],n=this.placementInfo.get(e);if(!t||!n)return!1;let i=this.building?.floors.find(o=>o.id===n.floorId)?.placements.find(o=>o.entity_id===e);return Ns({hass:this.hass,entityId:e,state:t},n,i?.plugin??void 0,{showWindow:(o,s)=>{o&&"hass"in o&&(o.hass=this.hass),this._pluginWindow=o?{node:o,title:s?.title??""}:null},moreInfo:o=>ye(this,o??e)})}renderPluginWindow(){let e=this._pluginWindow;return e?p`<div class="nf-plugin-window" @pointerdown=${t=>t.stopPropagation()}>
|
||||
<div class="nf-pw-head"><span>${e.title}</span><button class="nf-pw-close" aria-label=${$(this.hass,"close")} @click=${()=>this._pluginWindow=null}>✕</button></div>
|
||||
<div class="nf-pw-body">${e.node}</div>
|
||||
</div>`:f}startViewOf(){return this.startView??this.building?.settings.start_view??null}currentView(){return this.viewer?.currentView()??null}resetView(){this.viewer?.resetView()}fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}toggleFlows(){this._flows=!this._flows;try{localStorage.setItem("nextfloor.flows",this._flows?"1":"0")}catch{}this.syncDevices(!0)}liveHeatPumps(e){let t=this.hass;if(!t)return[];let n=[];for(let i of e.floors)for(let o of i.furniture){if(!eu(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=Xc(t,s?.entity??s?.power??null);a&&n.push({id:o.id,name:o.name||me(t,o.type),floorId:i.id,x:o.x,z:o.z,at:{floorId:i.id,x:o.x,z:o.z,y:ae(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(!Io(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=Po(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||n.push({id:o.id,name:o.name||me(t,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:ae(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=ou(e,o);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=wo(e,o),l=a?bc(o,a):null,c=o.name||(a?me(e,a):me(e,o.type));n.push({spot:o.id,name:c,at:{floorId:i.id,x:o.x,z:o.z,y:ae(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||me(e,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:ae(i,o)+o.h+.15},rings:o.sound_rings})}for(let o of i.placements)o.entity_id.startsWith("media_player.")&&n.push({entity:o.entity_id,name:o.name||O(e,o.entity_id),at:{floorId:i.id,x:o.x,z:o.z,y:(o.y??1.1)+.15},rings:o.sound_rings})}return rc(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,qc(t,n,i).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,n=e.settings.forecast&&t?it(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,Jc(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=Yc(this._forecast,Math.max(1,Math.min(7,i.days)));if(!o.length)return f;let s=it(n,this.weatherEntityId??t.settings.weather_entity),a=s?n.states[s]?.attributes:void 0,l=String(a?.temperature_unit??"\xB0"),c=String(a?.precipitation_unit??"mm"),u=n.language??navigator.language,d=new Intl.DateTimeFormat(u,{weekday:"short"}),m=h=>h===null?"\u2013":`${Math.round(h)}\xB0`;return p`<section class="nf-forecast" aria-label=${$(n,"forecast")}>
|
||||
</div>`:f}startViewOf(){return this.startView??this.building?.settings.start_view??null}currentView(){return this.viewer?.currentView()??null}resetView(){this.viewer?.resetView()}fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}toggleFlows(){this._flows=!this._flows;try{localStorage.setItem("nextfloor.flows",this._flows?"1":"0")}catch{}this.syncDevices(!0)}liveHeatPumps(e){let t=this.hass;if(!t)return[];let n=[];for(let i of e.floors)for(let o of i.furniture){if(!ou(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=iu(t,s?.entity??s?.power??null);a&&n.push({id:o.id,name:o.name||me(t,o.type),floorId:i.id,x:o.x,z:o.z,at:{floorId:i.id,x:o.x,z:o.z,y:oe(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=No(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||n.push({id:o.id,name:o.name||me(t,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:oe(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=uu(e,o);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=ko(e,o),l=a?wc(o,a):null,c=o.name||(a?me(e,a):me(e,o.type));n.push({spot:o.id,name:c,at:{floorId:i.id,x:o.x,z:o.z,y:oe(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||me(e,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.15},rings:o.sound_rings})}for(let o of i.placements)o.entity_id.startsWith("media_player.")&&n.push({entity:o.entity_id,name:o.name||L(e,o.entity_id),at:{floorId:i.id,x:o.x,z:o.z,y:(o.y??1.1)+.15},rings:o.sound_rings})}return sc(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,Xc(t,n,i).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,n=e.settings.forecast&&t?it(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,nu(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=tu(this._forecast,Math.max(1,Math.min(7,i.days)));if(!o.length)return f;let s=it(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,m=new Intl.DateTimeFormat(u,{weekday:"short"}),d=h=>h===null?"\u2013":`${Math.round(h)}\xB0`;return p`<section class="nf-forecast" aria-label=${$(n,"forecast")}>
|
||||
<ul>
|
||||
${o.map((h,g)=>p`<li>
|
||||
<span class="nf-fc-day">${g===0?$(n,"today"):d.format(new Date(h.day))}</span>
|
||||
<span class="nf-fc-day">${g===0?$(n,"today"):m.format(new Date(h.day))}</span>
|
||||
<span class="nf-fc-icon" aria-hidden="true">${h.icon}</span>
|
||||
<span class="nf-fc-temp" title=${l}><b>${m(h.high)}</b> <small>${m(h.low)}</small></span>
|
||||
<span class="nf-fc-temp" title=${l}><b>${d(h.high)}</b> <small>${d(h.low)}</small></span>
|
||||
<span class="nf-fc-rain">${h.rain!==null&&h.rain>0?`\u{1F4A7}${h.rain.toLocaleString(u,{maximumFractionDigits:1})} ${c}`:h.chance!==null&&h.chance>0?`\u{1F4A7}${Math.round(h.chance)} %`:""}</span>
|
||||
</li>`)}
|
||||
</ul>
|
||||
</section>`}renderToday(e){let t=this.building,n=this.hass;if(!t||!n||this.clean||this.roomId||this.panelOpen)return f;let i=this.renderForecast("top_right"),o=this.today===!1?f:this.renderTodayCard(t,n);return o===f&&i===f&&e===f?f:p`<div class="nf-right-col ${e!==f?"nf-utility-right":""}" style=${this.clock==="top_right"?"top: 78px":""}>${e}${o}${i}</div>`}renderTodayCard(e,t){let n=Uc(t,e,Date.now(),{today:$(t,"care_bin_today"),tomorrow:$(t,"care_bin_tomorrow")}),i=jc([...n,...this._todayItems??[]]);if(!i.length&&!(e.settings.calendars??[]).length)return f;let o=this._todayOpen!==!1,s=new Intl.DateTimeFormat(t.language??navigator.language,{weekday:"long",day:"numeric",month:"long"}).format(new Date),a=t.language??navigator.language,l=u=>{if(u===1)return $(t,"tomorrow");let d=new Date;return d.setDate(d.getDate()+u),new Intl.DateTimeFormat(a,{weekday:"long",day:"numeric",month:"numeric"}).format(d)},c=i.flatMap((u,d)=>[(u.day??0)>0&&(i[d-1]?.day??0)!==u.day?p`<li class="nf-today-day">${l(u.day??0)}</li>`:f,p`<li class=${u.past?"nf-today-past":""}><time>${u.kind==="bin"?"\u{1F5D1}":u.time||"\u25CF"}</time><span>${u.title}<small>${u.source}</small></span></li>`]);return p`<section class="nf-today ${o?"":"nf-today-folded"}" aria-label=${$(t,"today")}>
|
||||
</section>`}renderToday(e){let t=this.building,n=this.hass;if(!t||!n||this.clean||this.roomId||this.panelOpen)return f;let i=this.renderForecast("top_right"),o=this.today===!1?f:this.renderTodayCard(t,n);return o===f&&i===f&&e===f?f:p`<div class="nf-right-col ${e!==f?"nf-utility-right":""}" style=${this.clock==="top_right"?"top: 78px":""}>${e}${o}${i}</div>`}renderTodayCard(e,t){let n=Jc(t,e,Date.now(),{today:$(t,"care_bin_today"),tomorrow:$(t,"care_bin_tomorrow")}),i=Qc([...n,...this._todayItems??[]]);if(!i.length&&!(e.settings.calendars??[]).length)return f;let o=this._todayOpen!==!1,s=new Intl.DateTimeFormat(t.language??navigator.language,{weekday:"long",day:"numeric",month:"long"}).format(new Date),a=t.language??navigator.language,l=u=>{if(u===1)return $(t,"tomorrow");let m=new Date;return m.setDate(m.getDate()+u),new Intl.DateTimeFormat(a,{weekday:"long",day:"numeric",month:"numeric"}).format(m)},c=i.flatMap((u,m)=>[(u.day??0)>0&&(i[m-1]?.day??0)!==u.day?p`<li class="nf-today-day">${l(u.day??0)}</li>`:f,p`<li class=${u.past?"nf-today-past":""}><time>${u.kind==="bin"?"\u{1F5D1}":u.time||"\u25CF"}</time><span>${u.title}<small>${u.source}</small></span></li>`]);return p`<section class="nf-today ${o?"":"nf-today-folded"}" aria-label=${$(t,"today")}>
|
||||
<button class="nf-today-head" aria-expanded=${o} @click=${()=>this._todayOpen=!o}>
|
||||
<b>📅 ${$(t,"today")}</b><span>${s}</span>
|
||||
</button>
|
||||
${o?i.length?p`<ul>
|
||||
${c}
|
||||
</ul>`:p`<p class="nf-today-none">${$(t,"today_none")}</p>`:f}
|
||||
</section>`}week=null;weekAt=0;refreshWeek(e){let t=this.hass;if(!t||this._travel||Date.now()-this.weekAt<36e5)return;this.weekAt=Date.now();let n=Ke(e,s=>this.furnitureLinks?.get(s.id)?.power??null),i=e.energy,o={solar:i.solar?[i.solar]:n.solar,grid:i.grid??n.grid,gridInvert:!!i.grid_invert,battery:i.battery?[i.battery]:n.battery,batteryInvert:!!i.battery_invert,consumption:i.consumption};Nl(t,o).then(s=>{this.week=s,this.syncDevices(!0)}).catch(()=>this.week=null)}meterRows(e,t=null){let n=this.hass,i=[],o=this.floorId?e.floors.find(l=>l.id===this.floorId):void 0,s=o&&K(n)?De(n,o,e.floors.flatMap(l=>l.rooms)).find(l=>l.kind==="electricity"&&l.metric==="power"&&l.unit==="W"):void 0,a=K(n)?s?.value??null:o?.power_entity?q(n?.states[o.power_entity]):null;if(o&&(s||a!==null)){let l=!s?.incomplete&&a!==null&&t&&t>0?` \xB7 ${$(n,"floor_power_share",{n:Math.round(Math.max(0,a)/t*100)})}`:"";i.push({icon:"\u26A1",label:o.name,value:`${s?Fe(n,s):bt(n,a)}${l}`})}for(let[l,c,u]of[["gas","\u{1F525}","energy_gas_short"],["water","\u{1F4A7}","energy_water_short"]]){let d=e.energy[l],m=d?n?.states[d]:void 0;m&&!C(m)&&i.push({icon:c,label:$(n,u),value:oe(n,m)})}return i}refreshDayCurves(e){let t=this.hass;if(!t||this._travel||Date.now()-this.curvesAt<6e5)return;this.curvesAt=Date.now();let n=a=>xn(a,e,wn(a,e),Ke(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),i=Xl(t,n),o=Date.now(),s=o-24*36e5;$n(t,i,s,o,!0).then(a=>{this.dayCurves=ec(t,a,s,o,n),this.syncDevices(!0)}).catch(()=>this.dayCurves=null)}syncLhCards(e,t,n,i,o,s){let a=[],l=n.summary,c=l.solar!==null||l.grid!==null||l.battery!==null||l.consumption!==null,u=Fn(t),d=(this.floorId?t.floors.find(m=>m.id===this.floorId):void 0)??[...t.floors].sort((m,h)=>h.elevation-m.elevation)[0];if(this.liveCardsOn&&!this.dimmed&&!this.roomId&&c&&u&&d){let m=0,h=0,g=0;for(let _ of d.rooms)for(let[b,v]of _.points)m+=b,h+=v,g++;a.push({kind:"house",at:{floorId:d.id,x:g?m/g:u.x,z:g?h/g:u.z,y:d.height+(this.floorId?1.2:3.2)},summary:l,autarky:n.autarky,curves:this.dayCurves??void 0,week:this.week??void 0,meters:this.meterRows(t,l.consumption)}),this.refreshDayCurves(t),this.refreshWeek(t)}if(this.liveCardsOn&&!this.dimmed&&!this.roomId){for(let m of i)a.push({kind:"car",at:m.at,spot:m.spot,name:m.name,car:m.car});for(let m of this.livePrinters(t))a.push({kind:"printer",at:m.at,name:m.name,printer:m.printer});for(let m of this.liveHeatPumps(t))a.push({kind:"heatpump",at:m.at,name:m.name,pump:m.pump});for(let m of o)a.push({kind:"media",at:{...m.at,y:m.at.y+.5},media:m})}this.liveCardsOn&&!this.dimmed&&(a.push(...Oc(s,t,this.floorId,this.roomId)),a.push(...Bc(s,t,this.furnitureLinks??new Map,this.floorId,this.roomId))),JSON.stringify(a)!==JSON.stringify(this._liveCards)&&(this._liveCards=a),e.setLiveAnchors(a.map(m=>m.at),a.length?(m,h,g,_)=>this.placeLhCard(m,h,g,_):null)}placeLhCard(e,t,n,i){let o=this.renderRoot.querySelector(`.live-card[data-i="${e}"]`);o&&(o.dataset.x=String(t),o.dataset.y=String(n),o.style.visibility=i?"visible":"hidden",e===this._liveCards.length-1&&au(this.renderRoot))}toggleHouseFold(){this._houseFolded=!this._houseFolded;try{localStorage.setItem("nextfloor.house_card_folded",this._houseFolded?"1":"0")}catch{}}toggleLhCards(){this._liveCardOn=!this._liveCardOn;try{localStorage.setItem("nextfloor.cards",this._liveCardOn?"1":"0")}catch{}this.syncDevices(!0)}renderTopLeft(){let e=this.clean?f:this.renderLhEnergy(),t=this.renderForecast("top_left");return this.clock!=="top_left"&&t===f||!this.hass?e:p`<div class="nf-topleft">${this.clock==="top_left"?this.renderClock(!0):f}${e}${t}</div>`}renderLhEnergy(){let e=this.ownSensors(),t=this._liveEnergy?.summary,n=!!t&&!this.roomId&&this.showEnergy&&!!this.hass&&!(t.consumption===null&&t.grid===null&&t.solar===null&&t.battery===null),o=this.building?.floors.some(c=>c.rooms.some(u=>u.climate_card)||c.furniture.some(u=>u.power_card))?this.renderCardToggle():f,s=this.roomNamesButton?p`<button class="nf-energy-item nf-flow-toggle nf-room-names-toggle" aria-pressed=${this.roomLabels} title=${$(this.hass,"room_names_toggle_hint")} @click=${()=>{this.roomLabels=!this.roomLabels,this.dispatchEvent(new CustomEvent("room-names-change",{detail:{value:this.roomLabels},bubbles:!0,composed:!0}))}}><span>${$(this.hass,"room_names_short")}</span><b aria-hidden="true">Aa</b></button>`:f;if(!n)return e.length||o!==f||s!==f?p`<div class="nf-energy" aria-live="off">${s}${e}${o}</div>`:f;let a=c=>$(this.hass,c),l=[];if(t.solar!==null&&l.push({cls:"solar",label:a("energy_solar"),value:de(this.hass,t.solar)}),t.consumption!==null&&l.push({cls:"total",label:a("energy_consumption"),value:de(this.hass,t.consumption)}),t.rest!==void 0&&t.rest!==null&&l.push({cls:"total",label:a("energy_rest"),value:de(this.hass,t.rest)}),t.battery!==null||t.soc!==null){let c=[t.battery!==null?de(this.hass,Math.abs(t.battery)):null,t.soc!==null?`${Math.round(t.soc)} %`:null].filter(Boolean);l.push({cls:"battery",label:a("energy_battery"),value:c.join(" \xBLine truncated
|
||||
</section>`}week=null;weekAt=0;refreshWeek(e){let t=this.hass;if(!t||this._travel||Date.now()-this.weekAt<36e5)return;this.weekAt=Date.now();let n=Ke(e,s=>this.furnitureLinks?.get(s.id)?.power??null),i=e.energy,o={solar:i.solar?[i.solar]:n.solar,grid:i.grid??n.grid,gridInvert:!!i.grid_invert,battery:i.battery?[i.battery]:n.battery,batteryInvert:!!i.battery_invert,consumption:i.consumption};Wl(t,o).then(s=>{this.week=s,this.syncDevices(!0)}).catch(()=>this.week=null)}meterRows(e,t=null){let n=this.hass,i=[],o=this.floorId?e.floors.find(l=>l.id===this.floorId):void 0,s=o&&K(n)?De(n,o,e.floors.flatMap(l=>l.rooms)).find(l=>l.kind==="electricity"&&l.metric==="power"&&l.unit==="W"):void 0,a=K(n)?s?.value??null:o?.power_entity?q(n?.states[o.power_entity]):null;if(o&&(s||a!==null)){let l=!s?.incomplete&&a!==null&&t&&t>0?` \xB7 ${$(n,"floor_power_share",{n:Math.round(Math.max(0,a)/t*100)})}`:"";i.push({icon:"\u26A1",label:o.name,value:`${s?Fe(n,s):bt(n,a)}${l}`})}for(let[l,c,u]of[["gas","\u{1F525}","energy_gas_short"],["water","\u{1F4A7}","energy_water_short"]]){let m=e.energy[l],d=m?n?.states[m]:void 0;d&&!C(d)&&i.push({icon:c,label:$(n,u),value:se(n,d)})}return i}refreshDayCurves(e){let t=this.hass;if(!t||this._travel||Date.now()-this.curvesAt<6e5)return;this.curvesAt=Date.now();let n=a=>kn(a,e,xn(a,e),Ke(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),i=nc(t,n),o=Date.now(),s=o-24*36e5;Mn(t,i,s,o,!0).then(a=>{this.dayCurves=rc(t,a,s,o,n),this.syncDevices(!0)}).catch(()=>this.dayCurves=null)}syncHydronics(e,t,n){let i=++this.hydronicGeneration,o=this.shownBuilding(n).floors.filter(s=>!this.floorId||s.id===this.floorId).flatMap(s=>s.furniture.filter(a=>Gt(a.type)).map(a=>({floor:s,item:a})));if(!o.length){e.setHydronics([]),this.hydronicModule?.refreshHydronic(n,t,!!this._travel);return}Co().then(s=>{i!==this.hydronicGeneration||this.viewer!==e||!this.isConnected||(this.hydronicModule=s,e.setHydronics(o.map(({floor:a,item:l})=>({...s.hydronicVisual(n,l,a.id,oe(a,l)),animate:!this.dimmed&&!this._travel}))),s.refreshHydronic(n,t,!!this._travel))}).catch(s=>{this._error=String(s)})}syncLhCards(e,t,n,i,o,s){let a=[],l=n.summary,c=l.solar!==null||l.grid!==null||l.battery!==null||l.consumption!==null,u=Hn(t),m=(this.floorId?t.floors.find(d=>d.id===this.floorId):void 0)??[...t.floors].sort((d,h)=>h.elevation-d.elevation)[0];if(this.liveCardsOn&&!this.dimmed&&!this.roomId&&c&&u&&m){let d=0,h=0,g=0;for(let _ of m.rooms)for(let[b,v]of _.points)d+=b,h+=v,g++;a.push({kind:"house",at:{floorId:m.id,x:g?d/g:u.x,z:g?h/g:u.z,y:m.height+(this.floorId?1.2:3.2)},summary:l,autarky:n.autarky,curves:this.dayCurves??void 0,week:this.week??void 0,meters:this.meterRows(t,l.consumption)}),this.refreshDayCurves(t),this.refreshWeek(t)}if(this.liveCardsOn&&!this.dimmed&&!this.roomId){for(let d of i)a.push({kind:"car",at:d.at,spot:d.spot,name:d.name,car:d.car});for(let d of this.livePrinters(t))a.push({kind:"printer",at:d.at,name:d.name,printer:d.printer});for(let d of this.liveHeatPumps(t))a.push({kind:"heatpump",at:d.at,name:d.name,pump:d.pump});for(let d of o)a.push({kind:"media",at:{...d.at,y:d.at.y+.5},media:d})}if(this.liveCardsOn&&!this.dimmed){a.push(...Kc(s,t,this.floorId,this.roomId)),a.push(...Uc(s,t,this.furnitureLinks??new Map,this.floorId,this.roomId));for(let d of t.floors)for(let h of d.furniture){if(!Gt(h.type)||h.hydronic?.card===!1||this.floorId&&d.id!==this.floorId||!wt(s,h))continue;let g=this.roomId?d.rooms.find(_=>_.id===this.roomId):null;this.roomId&&(!g||!H([h.x,h.z],g.points))||a.push({kind:"hydronic",item:h,readOnly:!!this._travel,at:{floorId:d.id,x:h.x+(h.pin_offset?.x??0),z:h.z+(h.pin_offset?.z??0),y:oe(d,h)+h.h+.3+(h.pin_offset?.y??0)}})}}JSON.stringify(a)!==JSON.stringify(this._liveCards)&&(this._liveCards=a),e.setLiveAnchors(a.map(d=>d.at),a.length?(d,h,g,_)=>this.placeLhCard(d,h,g,_):null)}placeLhCard(e,t,n,i){let o=this.renderRoot.querySelector(`.live-card[data-i="${e}"]`);o&&(o.dataset.x=String(t),o.dataset.y=String(n),o.style.visibility=i?"visible":"hidden",e===this._liveCards.length-1&&hu(this.renderRoot))}toggleHouseFold(){this._houseFolded=!this._houseFolded;try{localStorage.setItem("nextfloor.house_card_folded",this._houseFolded?"1":"0")}catch{}}toggleLhCards(){this._liveCardOn=!this._liveCardOn;try{localStorage.setItem("nextfloor.cards",this._liveCardOn?"1":"0")}catch{}this.syncDevices(!0)}renderTopLeft(){let e=this.clean?f:this.renderLhEnergy(),t=this.renderForecast("top_left");return this.clock!=="top_left"&&t===f||!this.hass?e:p`<div class="nf-topleft">${this.clock==="top_left"?this.renderClock(!0):f}${e}${t}</div>`}renderLhEnergy(){let e=this.ownSensors(),t=this._liveEnergy?.summary,n=!!t&&!this.roomId&&this.showEnergy&&!!this.hass&&!(t.consumption===null&&t.grid===null&&t.solar===null&&t.battery===null),o=this.building?.floors.some(c=>c.rooms.some(u=>u.climate_card)||c.furniture.some(u=>u.power_card||Gt(u.type)&&u.hydronic?.card!==!1))?this.renderCardToggle():f,s=this.roomNamesButton?p`<buttoLine truncated
|
||||
${s}
|
||||
${this.liveCardsOn&&this._liveCards.some(c=>c.kind==="house")?f:l.map(c=>p`<div class="nf-energy-item nf-energy-${c.cls}"><span>${c.label}</span><b>${c.value}</b></div>`)}
|
||||
${this.flows!==null?f:p`<button class="nf-energy-item nf-flow-toggle" aria-pressed=${this._flows} title=${a("flows_hint")} aria-label=${a("flows")} @click=${()=>this.toggleFlows()}>
|
||||
@@ -1809,35 +1809,35 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
</div>`}renderCardToggle(){return this.holograms!==null?f:p`<button class="nf-energy-item nf-flow-toggle nf-card-toggle" aria-pressed=${this._liveCardOn} title=${$(this.hass,"holos_hint")} aria-label=${$(this.hass,"holos")} @click=${()=>this.toggleLhCards()}>
|
||||
<span>${$(this.hass,"holos")}</span><b>◫</b>
|
||||
</button>`}utilityOverview(e){let t=this.building;if(!t||!K(this.hass)||!this.showEnergy||this.clean||this.roomId||this.panelOpen||!e&&!this._utilityOverviewVisible)return f;let n=t.floors.flatMap(o=>o.rooms);return(this.floorId?t.floors.filter(o=>o.id===this.floorId):t.floors).some(o=>De(this.hass,o,n).length)?p`<nf-utility-overview ?inline=${e} .hass=${this.hass} .floors=${t.floors} .floorId=${this.floorId} .compact=${this._narrowStage}
|
||||
@utility-open=${o=>{o.stopPropagation(),o.detail.roomId?this.openRoom(o.detail.floorId,o.detail.roomId):this.fire("floor-tap",{floorId:o.detail.floorId})}}></nf-utility-overview>`:f}ownSensors(){let e=this.utilityOverview(!0),t=e===f?f:p`<button class="nf-energy-item nf-flow-toggle nf-utility-overview-toggle" aria-label="Rechte Übersicht" aria-pressed=${this._utilityOverviewVisible} title=${this._utilityOverviewVisible?"Rechte \xDCbersicht ausblenden":"Rechte \xDCbersicht einblenden"} @click=${()=>{this._utilityOverviewVisible=!this._utilityOverviewVisible;try{localStorage.setItem("nextfloor.utility_overview",this._utilityOverviewVisible?"1":"0")}catch{}}}><span>Übersicht</span><b aria-hidden="true"><svg width="18" height="16" viewBox="0 0 20 16" fill="none" stroke="currentColor" stroke-width="1.3"><rect x="1" y="1" width="18" height="14" rx="2"/><path d="M12 1v14m2-10h3m-3 3h3m-3 3h3"/></svg></b></button>`,n=this.sensorBar&&this.hass?this.building?.settings.status_entities??[]:[],i=K(this.hass)?(this.building?.presence??[]).filter(c=>tl(this.hass,c.person,[0])).map(c=>p`<div class="nf-energy-item nf-presence-state"><span>${c.name||O(this.hass,c.person)}</span><b>${se(this.hass.states[c.person])===null?"\u2013":se(this.hass.states[c.person])?"Anwesend":"Abwesend"}${G(this.hass,[c.person],c.name||"Anwesenheit")}</b></div>`):[],o=K(this.hass)?Object.entries(this.building?.settings.weather_variables??{}).filter(c=>!!c[1]&&c[1]!=="none").map(([c,u])=>[yu[c]||c,u]):[];K(this.hass)&&this.building?.settings.rain_sensor&&this.building.settings.rain_sensor!=="none"&&o.push(["Regensensor",this.building.settings.rain_sensor]);let s=o.length?p`<button class="nf-energy-item nf-flow-toggle nf-weather-values" aria-label="Wetterwerte anzeigen" title="Wetterwerte anzeigen" aria-haspopup="dialog" @click=${()=>this.renderRoot.querySelector(".nf-weather-dialog")?.showModal()}><span>Wetter</span><b aria-hidden="true">⛅</b></button>
|
||||
@utility-open=${o=>{o.stopPropagation(),o.detail.roomId?this.openRoom(o.detail.floorId,o.detail.roomId):this.fire("floor-tap",{floorId:o.detail.floorId})}}></nf-utility-overview>`:f}ownSensors(){let e=this.utilityOverview(!0),t=e===f?f:p`<button class="nf-energy-item nf-flow-toggle nf-utility-overview-toggle" aria-label="Rechte Übersicht" aria-pressed=${this._utilityOverviewVisible} title=${this._utilityOverviewVisible?"Rechte \xDCbersicht ausblenden":"Rechte \xDCbersicht einblenden"} @click=${()=>{this._utilityOverviewVisible=!this._utilityOverviewVisible;try{localStorage.setItem("nextfloor.utility_overview",this._utilityOverviewVisible?"1":"0")}catch{}}}><span>Übersicht</span><b aria-hidden="true"><svg width="18" height="16" viewBox="0 0 20 16" fill="none" stroke="currentColor" stroke-width="1.3"><rect x="1" y="1" width="18" height="14" rx="2"/><path d="M12 1v14m2-10h3m-3 3h3m-3 3h3"/></svg></b></button>`,n=this.sensorBar&&this.hass?this.building?.settings.status_entities??[]:[],i=K(this.hass)?(this.building?.presence??[]).filter(c=>il(this.hass,c.person,[0])).map(c=>p`<div class="nf-energy-item nf-presence-state"><span>${c.name||L(this.hass,c.person)}</span><b>${ae(this.hass.states[c.person])===null?"\u2013":ae(this.hass.states[c.person])?"Anwesend":"Abwesend"}${G(this.hass,[c.person],c.name||"Anwesenheit")}</b></div>`):[],o=K(this.hass)?Object.entries(this.building?.settings.weather_variables??{}).filter(c=>!!c[1]&&c[1]!=="none").map(([c,u])=>[$u[c]||c,u]):[];K(this.hass)&&this.building?.settings.rain_sensor&&this.building.settings.rain_sensor!=="none"&&o.push(["Regensensor",this.building.settings.rain_sensor]);let s=o.length?p`<button class="nf-energy-item nf-flow-toggle nf-weather-values" aria-label="Wetterwerte anzeigen" title="Wetterwerte anzeigen" aria-haspopup="dialog" @click=${()=>this.renderRoot.querySelector(".nf-weather-dialog")?.showModal()}><span>Wetter</span><b aria-hidden="true">⛅</b></button>
|
||||
<dialog class="nf-weather-dialog" aria-label="Wetterwerte" @keydown=${c=>c.stopPropagation()}><header><b>Wetter</b><button type="button" class="nf-chip" aria-label="Schließen" @click=${()=>this.renderRoot.querySelector(".nf-weather-dialog")?.close()}>×</button></header>${o.map(([c,u])=>p`<p><span>${c}</span><b>${nt(this.hass.states[u])}${G(this.hass,[u],c)}</b></p>`)}</dialog>`:f,a=K(this.hass)?(this.building?.floors??[]).filter(c=>!this.floorId||c.id===this.floorId).map(c=>({floor:c,readings:De(this.hass,c,this.building?.floors.flatMap(u=>u.rooms))})).filter(c=>c.readings.length):[],l=a.length?p`<button class="nf-energy-item nf-flow-toggle nf-utility-toggle" aria-label="Stockwerkszähler anzeigen" title="Stockwerkszähler anzeigen" aria-haspopup="dialog" @click=${()=>this.renderRoot.querySelector(".nf-utility-dialog")?.showModal()}><span>Stockwerkszähler</span><b aria-hidden="true">⚡ 💧</b></button>
|
||||
<dialog class="nf-weather-dialog nf-utility-dialog" aria-label="Stockwerkszähler" @keydown=${c=>c.stopPropagation()}><header><b>Stockwerkszähler</b><button type="button" class="nf-chip" aria-label="Schließen" @click=${()=>this.renderRoot.querySelector(".nf-utility-dialog")?.close()}>×</button></header>${a.map(({floor:c,readings:u})=>p`<h3>${c.name}</h3><nf-utility-report .hass=${this.hass} .readings=${u}></nf-utility-report>`)}</dialog>`:f;return[t,e,...i,s,l,...n.filter(c=>this.hass.states[c]).map(c=>p`<button class="nf-energy-item nf-own-sensor" title=${O(this.hass,c)} @click=${()=>ye(this,c)}>
|
||||
<span>${O(this.hass,c)}</span><b>${oe(this.hass,this.hass.states[c])}</b>
|
||||
</button>${G(this.hass,[c],O(this.hass,c))}`)]}renderMapCredit(){let e=this.building?.settings.map;return Sc(e)?p`<a class="nf-map-credit" href=${So(e).href} target="_blank" rel="noopener">${So(e).text}</a>`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=_t(new Date,this.hass?.config?.latitude??50),t=Ir(this.heatMode,e),n=this.heatMode==="temperature",i=n?le(this.hass,t.stops[0][0]):t.stops[0][0],o=n?le(this.hass,t.stops[t.stops.length-1][0]):t.stops[t.stops.length-1][0],s=n?re(this.hass):t.unit,a=l=>$(this.hass,l);return p`<div class="nf-legend">
|
||||
<dialog class="nf-weather-dialog nf-utility-dialog" aria-label="Stockwerkszähler" @keydown=${c=>c.stopPropagation()}><header><b>Stockwerkszähler</b><button type="button" class="nf-chip" aria-label="Schließen" @click=${()=>this.renderRoot.querySelector(".nf-utility-dialog")?.close()}>×</button></header>${a.map(({floor:c,readings:u})=>p`<h3>${c.name}</h3><nf-utility-report .hass=${this.hass} .readings=${u}></nf-utility-report>`)}</dialog>`:f;return[t,e,...i,s,l,...n.filter(c=>this.hass.states[c]).map(c=>p`<button class="nf-energy-item nf-own-sensor" title=${L(this.hass,c)} @click=${()=>ye(this,c)}>
|
||||
<span>${L(this.hass,c)}</span><b>${se(this.hass,this.hass.states[c])}</b>
|
||||
</button>${G(this.hass,[c],L(this.hass,c))}`)]}renderMapCredit(){let e=this.building?.settings.map;return Ec(e)?p`<a class="nf-map-credit" href=${Mo(e).href} target="_blank" rel="noopener">${Mo(e).text}</a>`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=_t(new Date,this.hass?.config?.latitude??50),t=Cr(this.heatMode,e),n=this.heatMode==="temperature",i=n?le(this.hass,t.stops[0][0]):t.stops[0][0],o=n?le(this.hass,t.stops[t.stops.length-1][0]):t.stops[t.stops.length-1][0],s=n?re(this.hass):t.unit,a=l=>$(this.hass,l);return p`<div class="nf-legend">
|
||||
<b>${a(`heat_${this.heatMode}`)}${this.heatMode==="temperature"?p` <small>${a(e?"heat_summer":"heat_winter")}</small>`:f}</b>
|
||||
<span class="nf-legend-bar" style="background:${Cl(this.heatMode,e)}"></span>
|
||||
<span class="nf-legend-range"><span>${L(this.hass,i,0)} ${s}</span><span>${L(this.hass,o,0)} ${s}</span></span>
|
||||
<span class="nf-legend-bar" style="background:${Ll(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>
|
||||
${this.heatValues.size?f:p`<span class="nf-legend-none">${a("heat_none_found")}</span>`}
|
||||
</div>`}renderWifiLegend(){let e=this.hass,t=this.building;if(!e||!t)return f;let n=(c,u)=>$(e,c,u),i=t.floors.flatMap(c=>c.furniture.filter(u=>Co(u.type)).map(u=>No(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=ru(a);return p`<div class="nf-legend">
|
||||
</div>`}renderWifiLegend(){let e=this.hass,t=this.building;if(!e||!t)return f;let n=(c,u)=>$(e,c,u),i=t.floors.flatMap(c=>c.furniture.filter(u=>Lo(u.type)).map(u=>Wo(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=lu(a);return p`<div class="nf-legend">
|
||||
<b>📶 ${n("heat_wifi")}</b>
|
||||
<span>${n("wifi_aps",{n:i.length,clients:s})}</span>
|
||||
${l.online+l.offline.length?p`<span>${n("wifi_network",{online:l.online,offline:l.offline.length})}</span>`:f}
|
||||
${l.offline.length?p`<span class="nf-legend-none">${l.offline.slice(0,4).join(", ")}</span>`:f}
|
||||
${i.length?f:p`<span class="nf-legend-none">${n("wifi_none")}</span>`}
|
||||
</div>`}skyColor(){let e=An[this.theme]??An.neon,t=this._sky;return e.night[0].map((n,i)=>Math.round(n+(e.day[0][i]-n)*t))}render(){let e=this.utilityOverview(!1),t=this._sky,n=(s,a)=>`rgb(${s.map((l,c)=>Math.round(l+(a[c]-l)*t)).join(",")})`,i=An[this.theme]??An.neon,o=`--nf-sky:${n(i.night[0],i.day[0])};--nf-ground:${n(i.night[1],i.day[1])}`+tc(this.building?.settings.backdrop);return p`<div
|
||||
</div>`}skyColor(){let e=En[this.theme]??En.neon,t=this._sky;return e.night[0].map((n,i)=>Math.round(n+(e.day[0][i]-n)*t))}render(){let e=this.utilityOverview(!1),t=this._sky,n=(s,a)=>`rgb(${s.map((l,c)=>Math.round(l+(a[c]-l)*t)).join(",")})`,i=En[this.theme]??En.neon,o=`--nf-sky:${n(i.night[0],i.day[0])};--nf-ground:${n(i.night[1],i.day[1])}`+ic(this.building?.settings.backdrop);return p`<div
|
||||
class="nf-stage ${this.roomLabels?"":"nf-no-room-names"} ${this._low?"nf-low":""} ${this.panelOpen?"nf-panel-open":""} ${this._alerts.length?"nf-has-alerts":""} ${this._narrowStage?"nf-narrow":""} ${e!==f?"nf-has-utility-overview":""}"
|
||||
style=${o}
|
||||
>
|
||||
${this._error?p`<p class="nf-error">${this._error}</p>`:f} ${this.renderTopLeft()} ${lu(this.hass,this._liveCards,(s,a,l,c)=>this.hass?.callService(s,a,{entity_id:l,...c}),{folded:this._houseFolded,toggle:()=>this.toggleHouseFold()},!!this.roomId||this.panelOpen)} ${this.clean?f:this.renderLegend()} ${this.renderMapCredit()}
|
||||
${this._error?p`<p class="nf-error">${this._error}</p>`:f} ${this.renderTopLeft()} ${mu(this.hass,this._liveCards,(s,a,l,c)=>this.hass?.callService(s,a,{entity_id:l,...c}),{folded:this._houseFolded,toggle:()=>this.toggleHouseFold()},!!this.roomId||this.panelOpen)} ${this.clean?f:this.renderLegend()} ${this.renderMapCredit()}
|
||||
${this.renderAlerts()} ${this.renderAnnouncement()} ${this.clean?f:p`${this.renderThumbs()} ${this.renderScenes()} ${this.renderFind()} ${this.renderCentral()}`} ${this.renderSwipe()}
|
||||
${this.renderMenu()} ${this.renderPlate()} ${this.renderEye()} ${this.renderLock()} ${this.renderWalk()} ${this.renderTravel()} ${this.renderClock()} ${this.renderToday(e)} ${this.renderLayers()} ${this.renderPluginWindow()}
|
||||
${this.showStats&&this._stats?p`<span class="nf-stats"
|
||||
><b>${this._stats.fps?$(this.hass,"stats_fps",{fps:this._stats.fps,ms:this._stats.worstMs}):$(this.hass,"stats_idle")}</b>
|
||||
${this._stats.busy.length?p`(${this._stats.busy.map(s=>$(this.hass,`stats_busy_${s}`)).join(", ")})`:f} ·
|
||||
${$(this.hass,"stats",{calls:this._stats.calls,tris:this._stats.triangles.toLocaleString()})} ·
|
||||
${$(this.hass,this._stats.low?"stats_low":"stats_full",{r:L(this.hass,this._stats.pixelRatio,2)})}</span
|
||||
${$(this.hass,this._stats.low?"stats_low":"stats_full",{r:O(this.hass,this._stats.pixelRatio,2)})}</span
|
||||
>`:f}
|
||||
</div>`}static styles=[_e,ze,cu,J`
|
||||
</div>`}static styles=[_e,ze,pu,J`
|
||||
:host {
|
||||
display: block;
|
||||
position: relative;
|
||||
@@ -3438,26 +3438,26 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
inset: auto 16px 16px;
|
||||
color: var(--nf-danger);
|
||||
}
|
||||
`]};customElements.get("nf-view3d")||customElements.define("nf-view3d",Uo);function de(r,e){return Math.abs(e)>=1e3?`${L(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 Rf(r,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:oe(r,e)}var Au;function Eu(){let r=new URL("./nextfloor-editor.js?v=5e2c8c8bd6e5",new URL(import.meta.url)).href;return Au??=import(r),Au}var zf=.25,Ru=r=>Math.round(r*1e3)/1e3,zu=(r,e,t)=>r.rooms.find(n=>n.points.length>=3&&I([e,t],n.points));function qo(r,e,t,n,i){let o=zu(r,e,t);if(!o)return[n,i];let s=(a,l)=>I([a,l],o.points);return s(n,i)?[n,i]:s(n,t)?[n,t]:s(e,i)?[e,i]:[e,t]}function Tf(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(ce(ee(o,t),n))<.02&&Math.abs(ce(ee(a,t),n))<.02}))}var jo=(r,e)=>Math.abs((r-e+540)%360-180);function Tu(r,e,t,n=zf){let i=zu(r,e.x,e.z);if(!i)return null;let o=i.points,s=mt(o)>=0?1:-1,a=null;return o.forEach((l,c)=>{let u=o[(c+1)%o.length],d=Ve(ee(u,l));if(d<.3)return;let m=[(u[0]-l[0])/d,(u[1]-l[1])/d],h=[-m[1]*s,m[0]*s],g=ce(ee([e.x,e.z],l),m);if(g<0||g>d)return;let _=Tf(r,i,l,h)?t/2:0,b=ce(ee([e.x,e.z],l),h)-_,v=Math.atan2(-h[0],h[1])*180/Math.PI,k=[{rotation:v,extent:e.d/2},{rotation:v+90,extent:e.w/2},{rotation:v-90,extent:e.w/2}].reduce((z,R)=>jo(e.rotation,R.rotation)<jo(e.rotation,z.rotation)?R:z);if(jo(e.rotation,k.rotation)>50)return;let M=b-k.extent;Math.abs(M)>n||a&&Math.abs(M)>=Math.abs(a.gap)||(a={x:Ru(e.x-h[0]*M),z:Ru(e.z-h[1]*M),rotation:(Math.round(k.rotation)%360+360)%360,gap:M})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function ni(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 ri(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 Du(r,e){let t=structuredClone(r);for(let n of t.floors)n.furniture=n.furniture.filter(i=>i.id!==e);return t}function Fu(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 Hu(r,e,t,n){return ri(r,e,(i,o)=>{[i.x,i.z]=qo(o,i.x,i.z,t,n)})}function Pu(r,e,t,n){let i=r.settings.wall_interior??.12;return ni(r,e,(o,s)=>{[o.x,o.z]=qo(s,o.x,o.z,t,n);let a=Tu(s,o,i);a&&Object.assign(o,a)})}var Zo=(r,e)=>((r+e)%360+360)%360,Iu=r=>Number.parseFloat(r.replace(",",".")),On=(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=Iu(o.target.value);!Number.isFinite(s)||!n(s)||r.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return p`<label class="nf-size" title=${r.title}
|
||||
`]};customElements.get("nf-view3d")||customElements.define("nf-view3d",Zo);function de(r,e){return Math.abs(e)>=1e3?`${O(r,e/1e3,1)} kW`:`${Math.round(e)} W`}function qo(r){return r.type==="tv_board"?r.h+.9:r.type==="tv_wall"||r.type==="kitchen_wall"?r.h+.25:r.h+.35}function Wf(r,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:se(r,e)}var Du;function Fu(){let r=new URL("./nextfloor-editor.js?v=8c6363de7c20",new URL(import.meta.url)).href;return Du??=import(r),Du}var Bf=.25,Hu=r=>Math.round(r*1e3)/1e3,Pu=(r,e,t)=>r.rooms.find(n=>n.points.length>=3&&H([e,t],n.points));function Jo(r,e,t,n,i){let o=Pu(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 Vf(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(ce(ee(o,t),n))<.02&&Math.abs(ce(ee(a,t),n))<.02}))}var Yo=(r,e)=>Math.abs((r-e+540)%360-180);function Iu(r,e,t,n=Bf){let i=Pu(r,e.x,e.z);if(!i)return null;let o=i.points,s=mt(o)>=0?1:-1,a=null;return o.forEach((l,c)=>{let u=o[(c+1)%o.length],m=Ve(ee(u,l));if(m<.3)return;let d=[(u[0]-l[0])/m,(u[1]-l[1])/m],h=[-d[1]*s,d[0]*s],g=ce(ee([e.x,e.z],l),d);if(g<0||g>m)return;let _=Vf(r,i,l,h)?t/2:0,b=ce(ee([e.x,e.z],l),h)-_,v=Math.atan2(-h[0],h[1])*180/Math.PI,k=[{rotation:v,extent:e.d/2},{rotation:v+90,extent:e.w/2},{rotation:v-90,extent:e.w/2}].reduce((z,R)=>Yo(e.rotation,R.rotation)<Yo(e.rotation,z.rotation)?R:z);if(Yo(e.rotation,k.rotation)>50)return;let M=b-k.extent;Math.abs(M)>n||a&&Math.abs(M)>=Math.abs(a.gap)||(a={x:Hu(e.x-h[0]*M),z:Hu(e.z-h[1]*M),rotation:(Math.round(k.rotation)%360+360)%360,gap:M})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function ii(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 oi(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 Cu(r,e){let t=structuredClone(r);for(let n of t.floors)n.furniture=n.furniture.filter(i=>i.id!==e);return t}function Nu(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 Ou(r,e,t,n){return oi(r,e,(i,o)=>{[i.x,i.z]=Jo(o,i.x,i.z,t,n)})}function Lu(r,e,t,n){let i=r.settings.wall_interior??.12;return ii(r,e,(o,s)=>{[o.x,o.z]=Jo(s,o.x,o.z,t,n);let a=Iu(s,o,i);a&&Object.assign(o,a)})}var Qo=(r,e)=>((r+e)%360+360)%360,Wu=r=>Number.parseFloat(r.replace(",",".")),Wn=(r,e)=>Math.round(r*10**e)/10**e;function Xo(r){let{min:e,max:t,accepts:n=()=>!0}=r,i=o=>{let s=Wu(o.target.value);!Number.isFinite(s)||!n(s)||r.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return p`<label class="nf-size" title=${r.title}
|
||||
>${r.label}
|
||||
<input type="number" inputmode="decimal" step=${r.step} min=${e} max=${t??f} .value=${String(On(r.value,2))} @change=${i} />
|
||||
</label>`}var Nu=(r,e)=>p`<button class="nf-chip" @click=${e}>${r.t("height_auto")}</button>`,Cu=(r,e)=>p`<button class="nf-chip" @click=${()=>e(-r)}>↺ ${r}°</button><button class="nf-chip" @click=${()=>e(r)}>↻ ${r}°</button>`;function Df(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]=On(l,3))}),o=Js(n)?p`${Yo({label:"\u2195",title:r.t("mount_height"),value:n.mount_y??ae(t,n),step:.05,min:0,accepts:s=>s>=0,apply:s=>r.editFurniture(e,a=>a.mount_y=On(s,3))})}
|
||||
${n.mount_y!=null?Nu(r,()=>r.editFurniture(e,s=>s.mount_y=null)):f}`:f;return p`${i("w","size_short_w")}${i("d","size_short_d")}${i("h","size_short_h")} ${o}`}function Ff(r,e){let t=r.building.floors.find(l=>l.placements.some(c=>c.entity_id===e)),n=t?.placements.find(l=>l.entity_id===e);if(!t||!n)return f;let i=H(e),o=(l,c,u)=>p`<select class="nf-size-select" title=${r.t(l)} @change=${d=>r.editDevice(e,m=>Object.assign(m,{mount:d.target.value,y:null}))}>
|
||||
${c.map(([d,m])=>p`<option value=${d} ?selected=${d===u}>${m}</option>`)}
|
||||
</select>`,s=["ceiling","floor","table","wall"].map(l=>[l,r.t(`lamp_${l}`)]),a=i?Tt(i,ve(t,n.x,n.z),i==="light"?n.mount??"ceiling":null):1;return p`${i==="light"?o("lamp_mount",s,n.mount??"ceiling"):f}
|
||||
${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=On(l,3))})}
|
||||
${n.y!==null?Nu(r,()=>r.editDevice(e,l=>l.y=null)):f}`}function Lu(r,e,t){let n=r.t,i;if(e){let o=r.building.floors.flatMap(s=>s.furniture).find(s=>s.id===e)?.type;i=p`<span>${o?me(r.hass,o):""}</span>
|
||||
${Df(r,e)} ${Cu(45,s=>r.turnFurniture(e,s))}
|
||||
<input type="number" inputmode="decimal" step=${r.step} min=${e} max=${t??f} .value=${String(Wn(r.value,2))} @change=${i} />
|
||||
</label>`}var Vu=(r,e)=>p`<button class="nf-chip" @click=${e}>${r.t("height_auto")}</button>`,Bu=(r,e)=>p`<button class="nf-chip" @click=${()=>e(-r)}>↺ ${r}°</button><button class="nf-chip" @click=${()=>e(r)}>↻ ${r}°</button>`;function Kf(r,e){let t=r.building.floors.find(s=>s.furniture.some(a=>a.id===e)),n=t?.furniture.find(s=>s.id===e);if(!t||!n)return f;let i=(s,a)=>Xo({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]=Wn(l,3))}),o=ea(n)?p`${Xo({label:"\u2195",title:r.t("mount_height"),value:n.mount_y??oe(t,n),step:.05,min:0,accepts:s=>s>=0,apply:s=>r.editFurniture(e,a=>a.mount_y=Wn(s,3))})}
|
||||
${n.mount_y!=null?Vu(r,()=>r.editFurniture(e,s=>s.mount_y=null)):f}`:f;return p`${i("w","size_short_w")}${i("d","size_short_d")}${i("h","size_short_h")} ${o}`}function Gf(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=P(e),o=(l,c,u)=>p`<select class="nf-size-select" title=${r.t(l)} @change=${m=>r.editDevice(e,d=>Object.assign(d,{mount:m.target.value,y:null}))}>
|
||||
${c.map(([m,d])=>p`<option value=${m} ?selected=${m===u}>${d}</option>`)}
|
||||
</select>`,s=["ceiling","floor","table","wall"].map(l=>[l,r.t(`lamp_${l}`)]),a=i?Dt(i,ve(t,n.x,n.z),i==="light"?n.mount??"ceiling":null):1;return p`${i==="light"?o("lamp_mount",s,n.mount??"ceiling"):f}
|
||||
${Xo({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=Wn(l,3))})}
|
||||
${n.y!==null?Vu(r,()=>r.editDevice(e,l=>l.y=null)):f}`}function Ku(r,e,t){let n=r.t,i;if(e){let o=r.building.floors.flatMap(s=>s.furniture).find(s=>s.id===e)?.type;i=p`<span>${o?me(r.hass,o):""}</span>
|
||||
${Kf(r,e)} ${Bu(45,s=>r.turnFurniture(e,s))}
|
||||
<button class="nf-chip" title=${n("furn_mirror_hint")} @click=${()=>r.editFurniture(e,s=>s.mirror=!s.mirror)}>⇋ ${n("furn_mirror")}</button>
|
||||
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeFurniture(e)}>${n("delete")}</button>`}else t?i=p`<span>${O(r.hass,t)}</span>
|
||||
${Ff(r,t)} ${Cu(45,o=>r.turnDevice(t,o))}
|
||||
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeDevice(t)}>${n("delete")}</button>`:i=p`<span>${n("furnish_hint")}</span>`;return p`<div class="nf-furnish-bar">${i}<button class="nf-chip nf-chip-on" @click=${()=>r.finish()}>${n("done")}</button></div>`}var Ou=ne`<svg class="nf-mark" viewBox="60 40 392 420" aria-hidden="true">
|
||||
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeFurniture(e)}>${n("delete")}</button>`}else t?i=p`<span>${L(r.hass,t)}</span>
|
||||
${Gf(r,t)} ${Bu(45,o=>r.turnDevice(t,o))}
|
||||
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeDevice(t)}>${n("delete")}</button>`:i=p`<span>${n("furnish_hint")}</span>`;return p`<div class="nf-furnish-bar">${i}<button class="nf-chip nf-chip-on" @click=${()=>r.finish()}>${n("done")}</button></div>`}var Gu=ne`<svg class="nf-mark" viewBox="60 40 392 420" aria-hidden="true">
|
||||
<polygon points="106,150 256,66 406,150 256,234" fill="none" stroke="currentColor" stroke-opacity=".55" stroke-width="12" stroke-dasharray="6 22" stroke-linecap="round"/>
|
||||
<polygon points="106,382 256,466 256,488 106,404" fill="#34507d"/><polygon points="406,382 256,466 256,488 406,404" fill="#2a4068"/><polygon points="106,382 256,298 406,382 256,466" fill="#5f7fb6"/>
|
||||
<polygon points="106,310 256,394 256,416 106,332" fill="#4a72b8"/><polygon points="406,310 256,394 256,416 406,332" fill="#3b5c98"/><polygon points="106,310 256,226 406,310 256,394" fill="#8ab6f5"/>
|
||||
<polygon points="106,238 256,322 256,344 106,260" fill="#2a74d8"/><polygon points="406,238 256,322 256,344 406,260" fill="#2161b8"/><polygon points="106,238 256,154 406,238 256,322" fill="#4fb6ff"/>
|
||||
<circle cx="256" cy="236" r="16" fill="#ffe08a"/>
|
||||
</svg>`;var he=(r,e)=>({name:r,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),Yt=(r,e,t)=>({name:r,fallback:t,read:n=>e.find(i=>i===n)??t,write:n=>n}),Jo={explode:he("explode",!0),keepRoof:he("roof",!1),solidWalls:he("solid_walls",!1),quality:Yt("quality",["auto","low","high"],"auto"),stats:he("stats",!1),markers:Yt("markers",["none","important","all"],"important"),heat:Yt("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:Yt("theme",Vr,"neon"),clock:Yt("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:Yt("floor_stack",["dim","stacked","single"],"dim"),roomNames:he("room_names",!0),clean:he("clean",!1),navWrap:he("nav_wrap",!1),weather:he("weather",!0),timeSlider:he("time_slider",!1),menuOpen:he("menu_open",!1),keepCamera:he("keep_camera",!1),readable:he("readable",!1),plain:he("plain",!1),rightBack:he("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:he("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 Wu(r=oi()){try{return r?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function Bu(r=oi()){try{return r?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function oi(){try{return localStorage}catch{return null}}var ii=class{storage;constructor(e){this.storage=e}raw(e){try{return this.storage?.getItem(`nextfloor.${e}`)??null}catch{return null}}load(e=""){let t={};for(let n of Object.keys(Jo)){let i=Jo[n],o=this.raw(i.name);t[n]=o===null?i.fallback:i.read(o)}return new URLSearchParams(e).has("nf_stats")&&(t.stats=!0),t}save(e,t){let n=Jo[e];try{this.storage?.setItem(`nextfloor.${n.name}`,n.write(t))}catch{}}};var Vu=J`
|
||||
</svg>`;var he=(r,e)=>({name:r,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),Jt=(r,e,t)=>({name:r,fallback:t,read:n=>e.find(i=>i===n)??t,write:n=>n}),es={explode:he("explode",!0),keepRoof:he("roof",!1),solidWalls:he("solid_walls",!1),quality:Jt("quality",["auto","low","high"],"auto"),stats:he("stats",!1),markers:Jt("markers",["none","important","all"],"important"),heat:Jt("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:Jt("theme",Gr,"neon"),clock:Jt("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:Jt("floor_stack",["dim","stacked","single"],"dim"),roomNames:he("room_names",!0),clean:he("clean",!1),navWrap:he("nav_wrap",!1),weather:he("weather",!0),timeSlider:he("time_slider",!1),menuOpen:he("menu_open",!1),keepCamera:he("keep_camera",!1),readable:he("readable",!1),plain:he("plain",!1),rightBack:he("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:he("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 Uu(r=ai()){try{return r?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function ju(r=ai()){try{return r?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function ai(){try{return localStorage}catch{return null}}var si=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(es)){let i=es[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=es[e];try{this.storage?.setItem(`nextfloor.${n.name}`,n.write(t))}catch{}}};var qu=J`
|
||||
.nf-dot {
|
||||
display: inline-block;
|
||||
width: 8px;
|
||||
@@ -3949,11 +3949,11 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
gap: 12px;
|
||||
margin: auto;
|
||||
}
|
||||
`;var Ku=new WeakMap,Gu=new WeakMap;function wt(r,e){let t=Gu.get(r)??r,n=Ku.get(t)??new WeakMap;Ku.set(t,n);let i=n.get(e);if(i)return i;let o=new Map;for(let l of e)for(let c of l.placements)c.entity_id.startsWith("cover.")&&o.set(c.entity_id,{tilt:c.cover_tilt==="none"?null:c.cover_tilt,position:c.position});for(let l of Ne(t,e).values())l.cover&&!o.has(l.cover)&&o.set(l.cover,{tilt:l.coverTilt,position:l.position}),l.cover2&&!o.has(l.cover2)&&o.set(l.cover2,{tilt:l.cover2Tilt});let s={...t.states};for(let[l,c]of o){let u=t.states[l];if(!u)continue;let d={...u.attributes,nf_cover_control:!0},m=Dt(t,c.position);m===null&&(m=typeof u.attributes.current_position=="number"?u.attributes.current_position:null),m!==null&&(d.current_position=m);let h=c.tilt?t.states[c.tilt]:u,g=typeof h?.attributes.current_tilt_position=="number"?h.attributes.current_tilt_position:c.tilt?Dt(t,c.tilt):null;g!==null&&(d.current_tilt_position=g,d.supported_features=Number(d.supported_features??0)|128);let _=u.state;typeof d.current_position=="number"&&_!=="unavailable"&&_!=="unknown"&&_!=="opening"&&_!=="closing"&&(_=d.current_position>0?"open":"closed"),s[l]={...u,state:_,attributes:d}}let a={...t,states:s,callService:async(l,c,u={})=>{if(l!=="cover")return t.callService(l,c,u);let d=Array.isArray(u.entity_id)?u.entity_id:[u.entity_id],m=async h=>{let g=typeof h=="string"?o.get(h):void 0;if(!g)return t.callService(l,c,{...u,entity_id:h});let _={...u,entity_id:h},b=c;(b==="toggle"||b==="toggle_cover")&&(b=s[String(h)]?.state==="closed"?"open_cover":"close_cover");let v=b.includes("tilt");v&&g.tilt&&(_.entity_id=g.tilt);let S=g.tilt?t.states[g.tilt]:void 0;return v&&g.tilt&&!S?.attributes.symcon_id&&typeof S?.attributes.current_tilt_position!="number"&&(b==="set_cover_tilt_position"?(b="set_cover_position",_.position=_.tilt_position,delete _.tilt_position):b==="open_cover_tilt"?b="open_cover":b==="close_cover_tilt"&&(b="close_cover")),t.callService(l,b,_)};return Array.isArray(u.entity_id)?Promise.all(d.map(m)):m(d[0])}};return Gu.set(a,t),n.set(e,a),a}var Qo=class extends Q{static properties={hass:{attribute:!1},narrow:{type:Boolean},route:{attribute:!1},panel:{attribute:!1},_mode:{state:!0},_editorReady:{state:!0},_floorId:{state:!0},_roomId:{state:!0},_wallMode:{state:!0},_prefs:{state:!0},_furnish:{state:!0},_selFurniture:{state:!0},_selDevice:{state:!0},_optsOpen:{state:!0},_switchesOpen:{state:!0},_timeOfDay:{state:!0},_outside:{state:!0},_timeDrag:{state:!0},_floorUndo:{state:!0},_variablesLoading:{state:!0},_variablesNotice:{state:!0},_variablesError:{state:!0}};outsideMemo=null;floorUndoTimer;data=new zt(this);store=new ii(oi());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:ht($t(this._timeOfDay,e.time_zone),e.latitude,e.longitude).elevation>0?"above_horizon":"below_horizon"}renderTimeOfDay(){let e=this.t;if(this.hass?.config?.latitude===void 0)return f;let t=this._timeDrag??this._timeOfDay,n=o=>`${String(Math.floor(o)).padStart(2,"0")}:${String(Math.round(o%1*60)).padStart(2,"0")}`,i=()=>{let o=new Date;return Math.round((o.getHours()+o.getMinutes()/60)*4)/4};return p`<button class="nf-chip" aria-pressed=${t!==null} title=${e("time_of_day_hint")} @click=${()=>(this._timeDrag=null,this._timeOfDay=t===null?i():null)}>☀ ${t===null?e("time_of_day"):n(t)}</button>
|
||||
`;var Zu=new WeakMap,Yu=new WeakMap;function xt(r,e){let t=Yu.get(r)??r,n=Zu.get(t)??new WeakMap;Zu.set(t,n);let i=n.get(e);if(i)return i;let o=new Map;for(let l of e)for(let c of l.placements)c.entity_id.startsWith("cover.")&&o.set(c.entity_id,{tilt:c.cover_tilt==="none"?null:c.cover_tilt,position:c.position});for(let l of Ne(t,e).values())l.cover&&!o.has(l.cover)&&o.set(l.cover,{tilt:l.coverTilt,position:l.position}),l.cover2&&!o.has(l.cover2)&&o.set(l.cover2,{tilt:l.cover2Tilt});let s={...t.states};for(let[l,c]of o){let u=t.states[l];if(!u)continue;let m={...u.attributes,nf_cover_control:!0},d=Ft(t,c.position);d===null&&(d=typeof u.attributes.current_position=="number"?u.attributes.current_position:null),d!==null&&(m.current_position=d);let h=c.tilt?t.states[c.tilt]:u,g=typeof h?.attributes.current_tilt_position=="number"?h.attributes.current_tilt_position:c.tilt?Ft(t,c.tilt):null;g!==null&&(m.current_tilt_position=g,m.supported_features=Number(m.supported_features??0)|128);let _=u.state;typeof m.current_position=="number"&&_!=="unavailable"&&_!=="unknown"&&_!=="opening"&&_!=="closing"&&(_=m.current_position>0?"open":"closed"),s[l]={...u,state:_,attributes:m}}let a={...t,states:s,callService:async(l,c,u={})=>{if(l!=="cover")return t.callService(l,c,u);let m=Array.isArray(u.entity_id)?u.entity_id:[u.entity_id],d=async h=>{let g=typeof h=="string"?o.get(h):void 0;if(!g)return t.callService(l,c,{...u,entity_id:h});let _={...u,entity_id:h},b=c;(b==="toggle"||b==="toggle_cover")&&(b=s[String(h)]?.state==="closed"?"open_cover":"close_cover");let v=b.includes("tilt");v&&g.tilt&&(_.entity_id=g.tilt);let S=g.tilt?t.states[g.tilt]:void 0;return v&&g.tilt&&!S?.attributes.symcon_id&&typeof S?.attributes.current_tilt_position!="number"&&(b==="set_cover_tilt_position"?(b="set_cover_position",_.position=_.tilt_position,delete _.tilt_position):b==="open_cover_tilt"?b="open_cover":b==="close_cover_tilt"&&(b="close_cover")),t.callService(l,b,_)};return Array.isArray(u.entity_id)?Promise.all(m.map(d)):d(m[0])}};return Yu.set(a,t),n.set(e,a),a}var ts=class extends Q{static properties={hass:{attribute:!1},narrow:{type:Boolean},route:{attribute:!1},panel:{attribute:!1},_mode:{state:!0},_editorReady:{state:!0},_floorId:{state:!0},_roomId:{state:!0},_wallMode:{state:!0},_prefs:{state:!0},_furnish:{state:!0},_selFurniture:{state:!0},_selDevice:{state:!0},_optsOpen:{state:!0},_switchesOpen:{state:!0},_timeOfDay:{state:!0},_outside:{state:!0},_timeDrag:{state:!0},_floorUndo:{state:!0},_variablesLoading:{state:!0},_variablesNotice:{state:!0},_variablesError:{state:!0}};outsideMemo=null;floorUndoTimer;data=new Tt(this);store=new si(ai());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:ht(Mt(this._timeOfDay,e.time_zone),e.latitude,e.longitude).elevation>0?"above_horizon":"below_horizon"}renderTimeOfDay(){let e=this.t;if(this.hass?.config?.latitude===void 0)return f;let t=this._timeDrag??this._timeOfDay,n=o=>`${String(Math.floor(o)).padStart(2,"0")}:${String(Math.round(o%1*60)).padStart(2,"0")}`,i=()=>{let o=new Date;return Math.round((o.getHours()+o.getMinutes()/60)*4)/4};return p`<button class="nf-chip" aria-pressed=${t!==null} title=${e("time_of_day_hint")} @click=${()=>(this._timeDrag=null,this._timeOfDay=t===null?i():null)}>☀ ${t===null?e("time_of_day"):n(t)}</button>
|
||||
${t!==null?p`<label class="nf-chip nf-time-slider"
|
||||
><input type="range" min="0" max="23.75" step="0.25" .value=${String(t)} aria-label=${e("time_of_day")} @input=${o=>this._timeDrag=Number(o.target.value)}
|
||||
@change=${o=>(this._timeDrag=null,this._timeOfDay=Number(o.target.value))}
|
||||
/></label>`:f}`}t=(e,t)=>$(this.hass,e,t);setPref(e,t){this._prefs={...this._prefs,[e]:t},this.store.save(e,t)}willUpdate(e){this.toggleAttribute("readable",!!this._prefs?.readable),e.has("hass")&&this.hass&&(this.style.colorScheme=Ar(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=mn(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=>ni(n,e,t)),editDevice:(e,t)=>this.applyEdit(n=>ri(n,e,t)),turnFurniture:(e,t)=>this.applyEdit(n=>ni(n,e,i=>i.rotation=Zo(i.rotation,t))),turnDevice:(e,t)=>this.applyEdit(n=>ri(n,e,i=>i.rotation=Zo(i.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>Du(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>Fu(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&&wr(this.hass,this))return f;let e=this.data.building,t=this._prefs.clean&&this._mode==="view",n=f;return e&&(this._mode==="editor"&&this.isAdmin?n=this.renderEditor(e):this._mode==="extensions"&&this.isAdmin?n=this.renderExtensions():n=this.renderView(e)),p`<div class="nf-app ${t?"nf-clean":""}" style=${this._prefs.accent?`--nf-accent:${this._prefs.accent}`:""}>
|
||||
/></label>`:f}`}t=(e,t)=>$(this.hass,e,t);setPref(e,t){this._prefs={...this._prefs,[e]:t},this.store.save(e,t)}willUpdate(e){this.toggleAttribute("readable",!!this._prefs?.readable),e.has("hass")&&this.hass&&(this.style.colorScheme=Er(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=pn(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=>ii(n,e,t)),editDevice:(e,t)=>this.applyEdit(n=>oi(n,e,t)),turnFurniture:(e,t)=>this.applyEdit(n=>ii(n,e,i=>i.rotation=Qo(i.rotation,t))),turnDevice:(e,t)=>this.applyEdit(n=>oi(n,e,i=>i.rotation=Qo(i.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>Cu(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>Nu(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&&xr(this.hass,this))return f;let e=this.data.building,t=this._prefs.clean&&this._mode==="view",n=f;return e&&(this._mode==="editor"&&this.isAdmin?n=this.renderEditor(e):this._mode==="extensions"&&this.isAdmin?n=this.renderExtensions():n=this.renderView(e)),p`<div class="nf-app ${t?"nf-clean":""}" style=${this._prefs.accent?`--nf-accent:${this._prefs.accent}`:""}>
|
||||
${t?f:p`${this.renderHeader(e)}${this.renderNotices()}`}
|
||||
${this.data.error&&!e?p`<p class="nf-message">${this.t("load_error")}: ${this.data.error}</p>`:f}
|
||||
${!e&&!this.data.error?p`<p class="nf-message">${this.t("loading")}</p>`:f}
|
||||
@@ -3966,7 +3966,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
</label>`}renderViewOptions(){let e=this._prefs;return p`<button class="nf-opts-btn" aria-expanded=${this._optsOpen} title=${this.t("view_options")} aria-label=${this.t("view_options")} @click=${()=>this._optsOpen=!this._optsOpen}>⚙</button>
|
||||
<div class="nf-view-opts ${this._optsOpen?"nf-opts-open":""}">
|
||||
${this.choiceRow("quality",["auto","low","high"],e.quality,t=>this.t(`quality_${t}`),t=>this.setPref("quality",t))}
|
||||
${this.choiceRow("theme",Vr,e.theme,t=>this.t(`theme_${t}`),t=>this.setPref("theme",t),this.accentPicker())}
|
||||
${this.choiceRow("theme",Gr,e.theme,t=>this.t(`theme_${t}`),t=>this.setPref("theme",t),this.accentPicker())}
|
||||
${this.choiceRow("markers",["none","important","all"],e.markers,t=>this.t(`markers_${t}`),t=>this.setPref("markers",t))}
|
||||
<label class="nf-seg nf-clock-pick" title=${this.t("clock")}
|
||||
>🕒
|
||||
@@ -4005,7 +4005,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
</div>
|
||||
</div>`}async reloadVariables(){if(!(this._variablesLoading||!this.hass.symconRefresh)){this._variablesLoading=!0,this._variablesNotice="",this._variablesError=!1;try{await this.hass.symconRefresh(),this._variablesNotice=this.t("symcon_variables_loaded")}catch(e){this._variablesError=!0,this._variablesNotice=this.t("symcon_variables_error",{error:e instanceof Error?e.message:String(e)})}finally{this._variablesLoading=!1}}}renderHeader(e){let t=this.hass?.symconTitle?.trim()||"NextFloor",n=this.data.saveState,i=(s,a,l="")=>p`<button role="tab" class=${l} aria-pressed=${this._mode===s} @click=${()=>this.setMode(s)}>${a}</button>`,o=n==="saving"?"saving":n==="saved"?"saved":"save_error";return p`<header class="nf-header">
|
||||
<ha-menu-button .hass=${this.hass} .narrow=${this.narrow}></ha-menu-button>
|
||||
<h1 title=${t}>${Ou}<span class="nf-view-title">${t}</span></h1>
|
||||
<h1 title=${t}>${Gu}<span class="nf-view-title">${t}</span></h1>
|
||||
${this.isAdmin?p`<div class="nf-seg" role="tablist">${i("view",this.t("view"))}${i("editor",this.t("editor"))}${i("extensions",`\u2726 ${this.t("ext_tab")}`,"nf-tab-ext")}</div>`:f}
|
||||
<span class="nf-grow"></span>
|
||||
${this._mode==="view"&&e?.floors.some(s=>s.rooms.length)?p`<button class="nf-chip nf-room-names-toggle" aria-pressed=${this._prefs.roomNames} title=${this.t("room_names_toggle_hint")} @click=${()=>this.setPref("roomNames",!this._prefs.roomNames)}>${this.t("room_names_short")}</button>`:f}
|
||||
@@ -4020,7 +4020,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
<span>${this.t("draft_found",{time:n})}</span>
|
||||
<button class="nf-btn nf-primary" @click=${()=>e.restoreDraft()}>${this.t("draft_restore")}</button>
|
||||
<button class="nf-btn" @click=${()=>e.discardDraft()}>${this.t("draft_discard")}</button>
|
||||
</div>`)}return t.length>0?p`<div class="nf-notices">${t}</div>`:f}whenEditorLoaded(e){return this._editorReady?e():(Eu().then(()=>this._editorReady=!0,t=>this.data.error=String(t)),p`<div class="nf-empty"><p>${this.t("loading")}</p></div>`)}renderExtensions(){return this.whenEditorLoaded(()=>p`<nf-extensions class="nf-body" .hass=${this.hass} .packs=${this.data.packs} .plugins=${this.data.building?.settings.plugins??[]}
|
||||
</div>`)}return t.length>0?p`<div class="nf-notices">${t}</div>`:f}whenEditorLoaded(e){return this._editorReady?e():(Fu().then(()=>this._editorReady=!0,t=>this.data.error=String(t)),p`<div class="nf-empty"><p>${this.t("loading")}</p></div>`)}renderExtensions(){return this.whenEditorLoaded(()=>p`<nf-extensions class="nf-body" .hass=${this.hass} .packs=${this.data.packs} .plugins=${this.data.building?.settings.plugins??[]}
|
||||
@packs-changed=${()=>{this.data.reloadPacks()}}
|
||||
@plugins-changed=${e=>this.applyEdit(t=>({...t,settings:{...t.settings,plugins:e.detail}}))}></nf-extensions>`)}renderEditor(e){return this.whenEditorLoaded(()=>p`<nf-editor
|
||||
class="nf-body"
|
||||
@@ -4030,10 +4030,10 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.roomLabels=${this._prefs.roomNames}
|
||||
@room-names-change=${t=>this.setPref("roomNames",t.detail.value)}
|
||||
.packs=${this.data.packs}
|
||||
.loadCardEditor=${Un}
|
||||
.loadCardEditor=${jn}
|
||||
@packs-changed=${()=>{this.data.reloadPacks()}}
|
||||
@building-changed=${t=>this.data.edit(t.detail.building)}
|
||||
></nf-editor>`)}onNavWheel=e=>{if(this._prefs.navWrap||!e.deltaY||e.deltaX)return;let t=e.currentTarget;t.scrollWidth<=t.clientWidth||(t.scrollLeft+=e.deltaY,e.preventDefault())};allOffChip(e){let t=this._floorId?e.floors.find(i=>i.id===this._floorId):e.floors.length===1?e.floors[0]:void 0;if(!t||!this.hass)return f;if(this._floorUndo){let i=this._floorUndo;return p`<button class="nf-chip" aria-pressed="true" @click=${()=>{for(let o of i)this.hass.callService(o.domain,o.service,o.data);this._floorUndo=null,clearTimeout(this.floorUndoTimer)}}>↶ ${this.t("all_off_undo")}</button>`}let n=Sn(Yl(t).map(i=>this.hass.states[i]));return n.count<2?f:p`<button class="nf-chip" title=${this.t("all_off_floor",{floor:t.name,n:n.count})} @click=${()=>{for(let i of n.off)this.hass.callService(i.domain,i.service,i.data);this._floorUndo=n.undo,clearTimeout(this.floorUndoTimer),this.floorUndoTimer=setTimeout(()=>this._floorUndo=null,1e4)}}>⏻ ${n.count}</button>`}renderNav(e){let t=e.floors.filter(c=>!this._floorId||c.id===this._floorId),n=e.floors.length>1,i=this._prefs.navWrap,o=this.outsideIds(e).length?p`<button class="nf-chip" aria-pressed=${this._outside} title=${this.t("outside_area_hint")} @click=${()=>this.openOutside()}>🌳 ${this.t("outside_area")}</button>`:f,s=n?p`<button class="nf-chip" aria-pressed=${this._floorId===null} @click=${()=>this.openFloor(null)}>${this.t("all_floors")}</button>
|
||||
></nf-editor>`)}onNavWheel=e=>{if(this._prefs.navWrap||!e.deltaY||e.deltaX)return;let t=e.currentTarget;t.scrollWidth<=t.clientWidth||(t.scrollLeft+=e.deltaY,e.preventDefault())};allOffChip(e){let t=this._floorId?e.floors.find(i=>i.id===this._floorId):e.floors.length===1?e.floors[0]:void 0;if(!t||!this.hass)return f;if(this._floorUndo){let i=this._floorUndo;return p`<button class="nf-chip" aria-pressed="true" @click=${()=>{for(let o of i)this.hass.callService(o.domain,o.service,o.data);this._floorUndo=null,clearTimeout(this.floorUndoTimer)}}>↶ ${this.t("all_off_undo")}</button>`}let n=$n(Xl(t).map(i=>this.hass.states[i]));return n.count<2?f:p`<button class="nf-chip" title=${this.t("all_off_floor",{floor:t.name,n:n.count})} @click=${()=>{for(let i of n.off)this.hass.callService(i.domain,i.service,i.data);this._floorUndo=n.undo,clearTimeout(this.floorUndoTimer),this.floorUndoTimer=setTimeout(()=>this._floorUndo=null,1e4)}}>⏻ ${n.count}</button>`}renderNav(e){let t=e.floors.filter(c=>!this._floorId||c.id===this._floorId),n=e.floors.length>1,i=this._prefs.navWrap,o=this.outsideIds(e).length?p`<button class="nf-chip" aria-pressed=${this._outside} title=${this.t("outside_area_hint")} @click=${()=>this.openOutside()}>🌳 ${this.t("outside_area")}</button>`:f,s=n?p`<button class="nf-chip" aria-pressed=${this._floorId===null} @click=${()=>this.openFloor(null)}>${this.t("all_floors")}</button>
|
||||
${[...e.floors].reverse().map(c=>p`<button class="nf-chip" aria-pressed=${c.id===this._floorId} @click=${()=>this.openFloor(c.id)}>${c.name}</button>`)}
|
||||
${o} ${this.allOffChip(e)}
|
||||
<span class="nf-sep"></span>`:p`${o} ${this.allOffChip(e)}`,a=t.flatMap(c=>[t.length>1&&c.rooms.length?p`<span class="nf-nav-floor">${c.name}</span>`:f,...c.rooms.map(u=>p`<button
|
||||
@@ -4045,7 +4045,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
</button>`)]),l=this.t(i?"nav_row":"nav_wrap");return p`<nav class="nf-nav ${i?"nf-nav-wrap":""}" @wheel=${this.onNavWheel}>
|
||||
${s}${a}
|
||||
<button class="nf-chip nf-nav-toggle" title=${l} aria-label=${l} aria-pressed=${i} @click=${()=>this.setPref("navWrap",!i)}>${i?"\u2194":"\u2261"}</button>
|
||||
</nav>`}toggleChip(e,t,n){return p`<button class="nf-chip" aria-pressed=${this._prefs[e]} title=${n?this.t(n):f} @click=${()=>this.setPref(e,!this._prefs[e])}>${this.t(t)}</button>`}renderOverlay(e){let t=this._prefs,n=this.t,i=(u,d)=>p`<div class="nf-seg">${[u,d].map(([m,h,g])=>p`<button aria-pressed=${m} @click=${h}>${g}</button>`)}</div>`,o=["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],s=["dim","stacked","single"],a=e.floors.length>1,l=this._roomId||this._floorId&&a?p`<button class="nf-chip" @click=${()=>this.back()}>${n("back")}</button>`:f,c=p`<button class="nf-chip" aria-haspopup="true" aria-expanded=${this._switchesOpen} @click=${()=>this._switchesOpen=!this._switchesOpen}>☰ ${n("bars_unfold")} <span class="nf-caret">${this._switchesOpen?"\u25BE":"\u25B4"}</span></button>`;return this._switchesOpen?p`<div class="nf-overlay">
|
||||
</nav>`}toggleChip(e,t,n){return p`<button class="nf-chip" aria-pressed=${this._prefs[e]} title=${n?this.t(n):f} @click=${()=>this.setPref(e,!this._prefs[e])}>${this.t(t)}</button>`}renderOverlay(e){let t=this._prefs,n=this.t,i=(u,m)=>p`<div class="nf-seg">${[u,m].map(([d,h,g])=>p`<button aria-pressed=${d} @click=${h}>${g}</button>`)}</div>`,o=["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],s=["dim","stacked","single"],a=e.floors.length>1,l=this._roomId||this._floorId&&a?p`<button class="nf-chip" @click=${()=>this.back()}>${n("back")}</button>`:f,c=p`<button class="nf-chip" aria-haspopup="true" aria-expanded=${this._switchesOpen} @click=${()=>this._switchesOpen=!this._switchesOpen}>☰ ${n("bars_unfold")} <span class="nf-caret">${this._switchesOpen?"\u25BE":"\u25B4"}</span></button>`;return this._switchesOpen?p`<div class="nf-overlay">
|
||||
<div class="nf-switches-veil" @click=${()=>this._switchesOpen=!1}></div>
|
||||
<div class="nf-switches" role="group" aria-label=${n("bars_unfold")} @keydown=${u=>u.key==="Escape"&&(this._switchesOpen=!1)}>
|
||||
<div class="nf-seg">
|
||||
@@ -4074,7 +4074,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
<div class="nf-stage-wrap ${this._roomId?"nf-room-open":""}">
|
||||
<nf-view3d
|
||||
class="nf-body"
|
||||
.hass=${ti(wt(this.hass,e.floors),e.settings)}
|
||||
.hass=${ri(xt(this.hass,e.floors),e.settings)}
|
||||
.building=${e}
|
||||
.packs=${this.data.packs}
|
||||
.floorStack=${t.floorStack}
|
||||
@@ -4093,7 +4093,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.keepRoof=${t.keepRoof}
|
||||
.markerMode=${t.markers}
|
||||
.heatMode=${t.heat}
|
||||
.theme=${Kr(t.theme,this.sunState())}
|
||||
.theme=${Ur(t.theme,this.sunState())}
|
||||
.timeOfDay=${this._timeOfDay}
|
||||
.clock=${t.clock==="none"?null:t.clock}
|
||||
.announcements=${!K(this.hass)&&!t.announceMuted}
|
||||
@@ -4112,9 +4112,9 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
?furnish=${this._furnish}
|
||||
.selectedFurniture=${this._selFurniture}
|
||||
@furniture-select=${i=>this._selFurniture=i.detail.id}
|
||||
@furniture-move=${i=>this.applyEdit(o=>Pu(o,i.detail.id,i.detail.x,i.detail.z))}
|
||||
@furniture-move=${i=>this.applyEdit(o=>Lu(o,i.detail.id,i.detail.x,i.detail.z))}
|
||||
@device-select=${i=>this._selDevice=i.detail.id}
|
||||
@device-move=${i=>this.applyEdit(o=>Hu(o,i.detail.id,i.detail.x,i.detail.z))}
|
||||
@device-move=${i=>this.applyEdit(o=>Ou(o,i.detail.id,i.detail.x,i.detail.z))}
|
||||
.quality=${t.quality}
|
||||
?showStats=${t.stats}
|
||||
@room-tap=${this.onRoomTap}
|
||||
@@ -4124,7 +4124,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${n?p`<nf-room-panel
|
||||
.building=${this.data.building??null}
|
||||
class="nf-room-panel"
|
||||
.hass=${wt(this.hass,e.floors)}
|
||||
.hass=${xt(this.hass,e.floors)}
|
||||
.room=${n}
|
||||
.floor=${e.floors.find(i=>i.rooms.some(o=>o.id===this._roomId))??null}
|
||||
.confirmEntities=${gt(this.hass,e.floors)}
|
||||
@@ -4135,7 +4135,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
></nf-room-panel>`:this._outside?p`<nf-room-panel
|
||||
.building=${this.data.building??null}
|
||||
class="nf-room-panel"
|
||||
.hass=${wt(this.hass,e.floors)}
|
||||
.hass=${xt(this.hass,e.floors)}
|
||||
.room=${null}
|
||||
.outside=${this.outsideIds(e)}
|
||||
.confirmEntities=${gt(this.hass,e.floors)}
|
||||
@@ -4143,9 +4143,9 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
@close=${()=>this._outside=!1}
|
||||
></nf-room-panel>`:f}
|
||||
${t.clean?f:this.renderOverlay(e)}
|
||||
${this._furnish?Lu(this.furnishHost,this._selFurniture,this._selDevice):f}
|
||||
${this._furnish?Ku(this.furnishHost,this._selFurniture,this._selDevice):f}
|
||||
</div>
|
||||
`}static styles=[_e,ze,Vu,Mr]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",Qo);var Hf=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,Uu=(r,e)=>Number(r)*60+Number(e);function Wn(r,e,t=new Date){if(!r||r==="off")return!1;if(r==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let n=Hf.exec(r.trim());if(!n)return!1;let i=Uu(n[1],n[2]),o=Uu(n[3],n[4]),s=t.getHours()*60+t.getMinutes();return i>o?s>=i||s<o:s>=i&&s<o}var si=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(Wn(this.host.config()?.night,this.host.hass())),6e4)}stop(){clearTimeout(this.cleanTimer),clearTimeout(this.idleTimer),clearInterval(this.nightTimer)}};function ju(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 qu=J`
|
||||
`}static styles=[_e,ze,qu,Ar]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",ts);var Uf=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,Ju=(r,e)=>Number(r)*60+Number(e);function Bn(r,e,t=new Date){if(!r||r==="off")return!1;if(r==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let n=Uf.exec(r.trim());if(!n)return!1;let i=Ju(n[1],n[2]),o=Ju(n[3],n[4]),s=t.getHours()*60+t.getMinutes();return i>o?s>=i||s<o:s>=i&&s<o}var li=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(Bn(this.host.config()?.night,this.host.hass())),6e4)}stop(){clearTimeout(this.cleanTimer),clearTimeout(this.idleTimer),clearInterval(this.nightTimer)}};function Qu(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 Xu=J`
|
||||
ha-card {
|
||||
overflow: hidden;
|
||||
background: var(--nf-bg);
|
||||
@@ -4269,26 +4269,26 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
`;function Xo(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 Zu(r,e){let t=new Set(e),n=[];for(let o of r.floors){let s=o.rooms.filter(c=>t.has(c.id));if(!s.length)continue;let a=(c,u)=>s.some(d=>d.points.length>=3&&I([c,u],d.points)),l=new Set(s.map(c=>c.id));n.push({...o,rooms:s,openings:o.openings.filter(c=>l.has(c.room_id)),furniture:o.furniture.filter(c=>a(c.x,c.z)),placements:o.placements.filter(c=>a(c.x,c.z)),walls:(o.walls??[]).filter(c=>a((c.a[0]+c.b[0])/2,(c.a[1]+c.b[1])/2)),outdoor:[]})}let i={...r.settings.roof,type:"none",sections:[],solar:[]};return{...r,floors:n,settings:{...r.settings,roof:i}}}var Jt="nf-outside",es=class extends Q{static properties={hass:{attribute:!1},_config:{state:!0},_roomId:{state:!0},_floorId:{state:!0},_walls:{state:!0},_heat:{state:!0},_explode:{state:!0},_fullscreen:{state:!0},_clean:{state:!0},_night:{state:!0},_orbit:{state:!0},_roomNames:{state:!0}};_own=null;templatesSeen;roomApplied=!1;data=new zt(this);kiosk=new si({config:()=>this._config,hass:()=>this.hass,setClean:e=>this._clean=e,isClean:()=>this._clean,setOrbit:e=>this._orbit=e,isOrbit:()=>this._orbit,setNight:e=>this._night=e,goHome:()=>this.returnHome()});constructor(){super(),this._roomId=null,this._floorId=void 0,this._walls=null,this._heat=null,this._explode=null,this._fullscreen=!1,this._clean=!1,this._night=!1,this._orbit=!1,this._roomNames=null}view3d(){return this.shadowRoot?.querySelector("nf-view3d")}returnHome(){this._roomId=this._config?.room??null,this._floorId=void 0,this.view3d()?.resetView(),this._config?.idle_orbit&&(this._orbit=!0)}openDashboard(e){history.pushState(null,"",e),window.dispatchEvent(new CustomEvent("location-changed",{bubbles:!0,composed:!0,detail:{replace:!1}}))}onFullscreen=()=>this._fullscreen=!!document.fullscreenElement&&this.shadowRoot?.contains(document.fullscreenElement)===!0;connectedCallback(){super.connectedCallback(),document.addEventListener("fullscreenchange",this.onFullscreen),this.kiosk.start()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("fullscreenchange",this.onFullscreen),this.kiosk.stop()}toggleFullscreen(){document.fullscreenElement?document.exitFullscreen():this.shadowRoot?.querySelector("ha-card")?.requestFullscreen?.()}static async getConfigElement(){return await Un(),document.createElement("nextfloor-card-editor")}static getStubConfig(){return{type:"custom:nextfloor-card"}}setConfig(e){if(e.height!==void 0&&!(e.height>100))throw new Error("height must be a number of pixels above 100");this._roomNames=null,this._own=e,this._config=Xo(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=Wn(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=Xo(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=Ar(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let n=Wn(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:Zu(e,t)}),this.roomsMemo.result}t=e=>$(this.hass,e);stage(){let e=this.plan(),t=this._config,n=this._floorId===void 0?t?.floor??null:this._floorId,i=e&&e.floors.length===1?e.floors[0].id:e?.floors.some(a=>a.id===n)?n:null,o=!!this._roomId&&t?.room_panel!==!1,s=!!this._roomId&&t?.room_panel===!1||!this.thumbs&&this.canSwitch&&!this._roomId&&!!i&&(e?.floors.length??0)>1;return{floorId:i,walls:this._walls??t?.walls??"auto",heat:this._heat??t?.heatmap??"none",explode:this._explode??t?.explode??!0,canGoBack:s,showBar:!!e&&!this._clean&&(s||!!t?.controls&&!o)}}shows(e){let t=this._config?.controls;return t===!0||Array.isArray(t)&&t.includes(e)}renderBar(e){let t=this.plan(),n=this.t,i=["temperature","humidity","co2"].filter(s=>this.shows(s)),o=(s,a)=>p`<div class="nf-seg" role=${s?"group":f} aria-label=${s??f}>${a.map(([l,c,u])=>p`<button aria-pressed=${l} @click=${c}>${u}</button>`)}</div>`;return p`<div class="nf-card-controls">
|
||||
`;function ns(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 ed(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(m=>m.points.length>=3&&H([c,u],m.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 Qt="nf-outside",rs=class extends Q{static properties={hass:{attribute:!1},_config:{state:!0},_roomId:{state:!0},_floorId:{state:!0},_walls:{state:!0},_heat:{state:!0},_explode:{state:!0},_fullscreen:{state:!0},_clean:{state:!0},_night:{state:!0},_orbit:{state:!0},_roomNames:{state:!0}};_own=null;templatesSeen;roomApplied=!1;data=new Tt(this);kiosk=new li({config:()=>this._config,hass:()=>this.hass,setClean:e=>this._clean=e,isClean:()=>this._clean,setOrbit:e=>this._orbit=e,isOrbit:()=>this._orbit,setNight:e=>this._night=e,goHome:()=>this.returnHome()});constructor(){super(),this._roomId=null,this._floorId=void 0,this._walls=null,this._heat=null,this._explode=null,this._fullscreen=!1,this._clean=!1,this._night=!1,this._orbit=!1,this._roomNames=null}view3d(){return this.shadowRoot?.querySelector("nf-view3d")}returnHome(){this._roomId=this._config?.room??null,this._floorId=void 0,this.view3d()?.resetView(),this._config?.idle_orbit&&(this._orbit=!0)}openDashboard(e){history.pushState(null,"",e),window.dispatchEvent(new CustomEvent("location-changed",{bubbles:!0,composed:!0,detail:{replace:!1}}))}onFullscreen=()=>this._fullscreen=!!document.fullscreenElement&&this.shadowRoot?.contains(document.fullscreenElement)===!0;connectedCallback(){super.connectedCallback(),document.addEventListener("fullscreenchange",this.onFullscreen),this.kiosk.start()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("fullscreenchange",this.onFullscreen),this.kiosk.stop()}toggleFullscreen(){document.fullscreenElement?document.exitFullscreen():this.shadowRoot?.querySelector("ha-card")?.requestFullscreen?.()}static async getConfigElement(){return await jn(),document.createElement("nextfloor-card-editor")}static getStubConfig(){return{type:"custom:nextfloor-card"}}setConfig(e){if(e.height!==void 0&&!(e.height>100))throw new Error("height must be a number of pixels above 100");this._roomNames=null,this._own=e,this._config=ns(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=Bn(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=ns(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=Er(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let n=Bn(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:ed(e,t)}),this.roomsMemo.result}t=e=>$(this.hass,e);stage(){let e=this.plan(),t=this._config,n=this._floorId===void 0?t?.floor??null:this._floorId,i=e&&e.floors.length===1?e.floors[0].id:e?.floors.some(a=>a.id===n)?n:null,o=!!this._roomId&&t?.room_panel!==!1,s=!!this._roomId&&t?.room_panel===!1||!this.thumbs&&this.canSwitch&&!this._roomId&&!!i&&(e?.floors.length??0)>1;return{floorId:i,walls:this._walls??t?.walls??"auto",heat:this._heat??t?.heatmap??"none",explode:this._explode??t?.explode??!0,canGoBack:s,showBar:!!e&&!this._clean&&(s||!!t?.controls&&!o)}}shows(e){let t=this._config?.controls;return t===!0||Array.isArray(t)&&t.includes(e)}renderBar(e){let t=this.plan(),n=this.t,i=["temperature","humidity","co2"].filter(s=>this.shows(s)),o=(s,a)=>p`<div class="nf-seg" role=${s?"group":f} aria-label=${s??f}>${a.map(([l,c,u])=>p`<button aria-pressed=${l} @click=${c}>${u}</button>`)}</div>`;return p`<div class="nf-card-controls">
|
||||
${e.canGoBack?p`<button class="nf-chip" @click=${()=>this.back()}>${n("back")}</button>`:f}
|
||||
${this.shows("walls")?o(void 0,[[e.walls==="auto",()=>this._walls="auto",n("walls_auto")],[e.walls==="cut",()=>this._walls="cut",n("walls_cut")],[e.walls==="slope",()=>this._walls="slope",n("walls_slope")]]):f}
|
||||
${this.shows("floors")&&t.floors.length>1&&!e.floorId?o(void 0,[[e.explode,()=>this._explode=!0,n("floors_apart")],[!e.explode,()=>this._explode=!1,n("floors_stacked")]]):f}
|
||||
${i.length>0?o(n("heatmap"),["none",...i].map(s=>[e.heat===s,()=>this._heat=s,n(s==="none"?"heat_off":`heat_short_${s}`)])):f}
|
||||
</div>`}renderRoomButtons(e){let t=this.plan();if(!this._config?.room_buttons||!t||this._clean)return f;let n=ju(t,e.floorId);if(!n.length)return f;let i=n.length>1,o=(l,c)=>{this.canSwitch&&l!==e.floorId&&(this._floorId=l),this._roomId=c===this._roomId?null:c},s=mn(this.hass,t.floors).length>0,a=()=>{this.canSwitch&&(this._floorId=null),this._roomId=this._roomId===Jt?null:Jt};return p`<div class="nf-card-rooms ${this._roomId&&this._config?.room_panel!==!1?"nf-card-rooms-beside":""}" role="group" aria-label=${this.t("card_room_buttons")}>
|
||||
</div>`}renderRoomButtons(e){let t=this.plan();if(!this._config?.room_buttons||!t||this._clean)return f;let n=Qu(t,e.floorId);if(!n.length)return f;let i=n.length>1,o=(l,c)=>{this.canSwitch&&l!==e.floorId&&(this._floorId=l),this._roomId=c===this._roomId?null:c},s=pn(this.hass,t.floors).length>0,a=()=>{this.canSwitch&&(this._floorId=null),this._roomId=this._roomId===Qt?null:Qt};return p`<div class="nf-card-rooms ${this._roomId&&this._config?.room_panel!==!1?"nf-card-rooms-beside":""}" role="group" aria-label=${this.t("card_room_buttons")}>
|
||||
${n.map(l=>p`${i?p`<span class="nf-card-rooms-floor">${l.floorName}</span>`:f}${l.rooms.map(c=>p`<button class="nf-chip" aria-pressed=${c.id===this._roomId} @click=${()=>o(l.floorId,c.id)}>${c.name}</button>`)}`)}
|
||||
${s?p`<button class="nf-chip" aria-pressed=${this._roomId===Jt} title=${this.t("outside_area_hint")} @click=${a}>🌳 ${this.t("outside_area")}</button>`:f}
|
||||
${s?p`<button class="nf-chip" aria-pressed=${this._roomId===Qt} title=${this.t("outside_area_hint")} @click=${a}>🌳 ${this.t("outside_area")}</button>`:f}
|
||||
</div>`}renderCorners(){let e=this._config,t=this.t,n=this._clean||!!this._roomId&&e?.room_panel!==!1;return p`${e?.fullscreen_button&&!n?p`<button class="nf-card-full" title=${t(this._fullscreen?"fullscreen_exit":"fullscreen")} aria-label=${t(this._fullscreen?"fullscreen_exit":"fullscreen")} @click=${()=>this.toggleFullscreen()}>
|
||||
${this._fullscreen?"\u2715":"\u26F6"}
|
||||
</button>`:f}
|
||||
${e?.dashboard&&!n?p`<button class="nf-card-full nf-card-dash ${e.fullscreen_button?"nf-card-dash-2":""}" title=${e.dashboard_label||e.dashboard} aria-label=${e.dashboard_label||e.dashboard} @click=${()=>this.openDashboard(e.dashboard)}>
|
||||
${e.dashboard_label?p`<span>${e.dashboard_label}</span>`:"\u2302"}
|
||||
</button>`:f}`}renderStage(e){let t=this.plan(),n=this._config,i=()=>{this._clean=!this._clean,this._clean?this.kiosk.stopClean():this.kiosk.armClean()},o=n?.controls_hidden!==void 0||(n?.controls_hide_after??0)>0;return p`<nf-view3d
|
||||
.hass=${ti(wt(this.hass,t.floors),t.settings)}
|
||||
.hass=${ri(xt(this.hass,t.floors),t.settings)}
|
||||
.building=${t}
|
||||
.packs=${this.data.packs}
|
||||
.floorId=${e.floorId}
|
||||
.roomId=${this._roomId===Jt?null:this._roomId}
|
||||
.outsideOpen=${this._roomId===Jt}
|
||||
.roomId=${this._roomId===Qt?null:this._roomId}
|
||||
.outsideOpen=${this._roomId===Qt}
|
||||
.wallMode=${e.walls}
|
||||
.solidWalls=${n?.solid_walls===!0}
|
||||
.explode=${e.explode}
|
||||
@@ -4311,7 +4311,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.zoom=${typeof n?.zoom=="number"?n.zoom:1}
|
||||
.buttons=${n?.buttons?.map((s,a)=>({id:`card_${a}`,...s}))??null}
|
||||
.heatMode=${e.heat}
|
||||
.theme=${Kr(n?.theme,this.hass?.states["sun.sun"]?.state)}
|
||||
.theme=${Ur(n?.theme,this.hass?.states["sun.sun"]?.state)}
|
||||
.clock=${n?.clock&&n.clock!=="none"?n.clock:null}
|
||||
.lockButton=${n?.lock_button!==!1}
|
||||
.walkButton=${n?.walk_button!==!1}
|
||||
@@ -4329,10 +4329,10 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
.panelOpen=${!!this._roomId&&n?.room_panel!==!1}
|
||||
.alerts=${n?.alerts!==!1}
|
||||
.alertJump=${!!n?.alert_jump}
|
||||
.announcements=${!K(this.hass)&&n?.announcements!==!1&&!Bu()}
|
||||
.announcements=${!K(this.hass)&&n?.announcements!==!1&&!ju()}
|
||||
.sensorBar=${n?.sensor_bar!==!1}
|
||||
.glassWalls=${typeof n?.glass_walls=="number"?Math.min(100,Math.max(0,n.glass_walls)):null}
|
||||
.screenName=${n?.screen_name??Wu()}
|
||||
.screenName=${n?.screen_name??Uu()}
|
||||
.scenes=${n?.scenes!==!1}
|
||||
.clean=${this._clean}
|
||||
.cleanButton=${o}
|
||||
@@ -4350,14 +4350,14 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
></nf-view3d>`}renderRoomPanel(){let e=this.plan();return p`<nf-room-panel
|
||||
.building=${this.plan()??null}
|
||||
class="nf-card-panel"
|
||||
.hass=${wt(this.hass,e.floors)}
|
||||
.hass=${xt(this.hass,e.floors)}
|
||||
.room=${e.floors.flatMap(t=>t.rooms).find(t=>t.id===this._roomId)??null}
|
||||
.floor=${e.floors.find(t=>t.rooms.some(n=>n.id===this._roomId))??null}
|
||||
.outside=${this._roomId===Jt?mn(this.hass,e.floors):null}
|
||||
.outside=${this._roomId===Qt?pn(this.hass,e.floors):null}
|
||||
.confirmEntities=${gt(this.hass,e.floors)}
|
||||
.phrases=${e.settings.announce_phrases??null}
|
||||
@close=${()=>this._roomId=null}
|
||||
></nf-room-panel>`}render(){if(this.hass&&wr(this.hass,this))return f;let e=this.plan(),t=this._config;!this.roomApplied&&e&&t?.room&&(this.roomApplied=!0,e.floors.some(a=>a.rooms.some(l=>l.id===t.room))&&(this._roomId=t.room));let n=this.stage(),i=this._fullscreen?"100vh":t?.fill?"calc(100vh - var(--header-height, 56px) - 16px)":`${t?.height??420}px`,o=/^#[0-9a-f]{6}$/i.test(t?.accent??"")?t.accent:null,s=()=>this.kiosk.touched();return p`<ha-card class=${this._night?"nf-night":""} style=${o?`--nf-accent:${o}`:""} @pointerdown=${s} @keydown=${s} @wheel=${s}>
|
||||
></nf-room-panel>`}render(){if(this.hass&&xr(this.hass,this))return f;let e=this.plan(),t=this._config;!this.roomApplied&&e&&t?.room&&(this.roomApplied=!0,e.floors.some(a=>a.rooms.some(l=>l.id===t.room))&&(this._roomId=t.room));let n=this.stage(),i=this._fullscreen?"100vh":t?.fill?"calc(100vh - var(--header-height, 56px) - 16px)":`${t?.height??420}px`,o=/^#[0-9a-f]{6}$/i.test(t?.accent??"")?t.accent:null,s=()=>this.kiosk.touched();return p`<ha-card class=${this._night?"nf-night":""} style=${o?`--nf-accent:${o}`:""} @pointerdown=${s} @keydown=${s} @wheel=${s}>
|
||||
<div class="nf-card-body" style="height:${i}">
|
||||
${e&&e.floors.some(a=>a.rooms.length)?this.renderStage(n):p`<p class="nf-card-msg">${this.data.error??(e?$(this.hass,"no_building"):$(this.hass,"loading"))}</p>`}
|
||||
${this._roomId&&e&&t?.room_panel!==!1?this.renderRoomPanel():f}
|
||||
@@ -4365,7 +4365,7 @@ ${t.sources.map(n=>this.hass.states[n]?.attributes.symcon_path||this.hass.states
|
||||
${n.showBar&&e?this.renderBar(n):f}
|
||||
${this.renderCorners()}
|
||||
</div>
|
||||
</ha-card>`}static styles=[_e,ze,qu,Mr]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",es);let r=window;r.customCards=r.customCards??[],r.customCards.push({type:"nextfloor-card",name:$(void 0,"card_name"),description:$(void 0,"card_description"),preview:!1})}Mi();var Pf="nextfloor-chunks-v1";async function ts(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:Pf})}),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 Qt(r,e,t={}){let n=await ts(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 ts(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 ts(r,"transport/release",{transfer_id:i.id}).catch(()=>{})}}function If(){let r=window.__NEXTFLOOR_SYMCON__;if(!r?.endpoint||!r.token)throw new Error("NextFloor Symcon host configuration is missing");return r}var ai=class{settings=If();changeListeners=new Set;buildingListeners=new Set;timer;stateRevision=-1;buildingRevision=-1;objectsSignature="";refreshTask;states={};entities={};areas={};facade={language:this.settings.language||navigator.language||"de",user:{is_admin:!0,name:this.settings.title||"IP-Symcon"},states:this.states,entities:this.entities,areas:this.areas,symconObjects:[],symconTitle:this.settings.title?.trim()||"NextFloor",symconRefresh:()=>this.refresh(!0),config:{unit_system:{temperature:"\xB0C"}},themes:{darkMode:window.matchMedia?.("(prefers-color-scheme: dark)").matches??!0},services:{},connection:{subscribeMessage:async(e,t)=>{if(t.type==="nextfloor/building/subscribe"){let n=i=>e({revision:i});return this.buildingListeners.add(n),async()=>{this.buildingListeners.delete(n)}}return async()=>{}}},callWS:e=>this.callWS(e),callService:(e,t,n)=>this.callService(e,t,n),fetchWithAuth:(e,t)=>this.fetchWithToken(e,t),hassUrl:(e="")=>new URL(e,window.location.origin).href};async start(){let e=await Qt(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 Qt(this.settings,"bootstrap"):await Qt(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=ca(t,n);!i||i.entity_id===t.entity_id||this.states[i.entity_id]||(this.staLine truncated
|
||||
</ha-card>`}static styles=[_e,ze,Xu,Ar]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",rs);let r=window;r.customCards=r.customCards??[],r.customCards.push({type:"nextfloor-card",name:$(void 0,"card_name"),description:$(void 0,"card_description"),preview:!1})}Ei();var jf="nextfloor-chunks-v1";async function is(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:jf})}),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 Xt(r,e,t={}){let n=await is(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 is(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 is(r,"transport/release",{transfer_id:i.id}).catch(()=>{})}}function qf(){let r=window.__NEXTFLOOR_SYMCON__;if(!r?.endpoint||!r.token)throw new Error("NextFloor Symcon host configuration is missing");return r}var ci=class{settings=qf();changeListeners=new Set;buildingListeners=new Set;timer;stateRevision=-1;buildingRevision=-1;objectsSignature="";refreshTask;states={};entities={};areas={};facade={language:this.settings.language||navigator.language||"de",user:{is_admin:!0,name:this.settings.title||"IP-Symcon"},states:this.states,entities:this.entities,areas:this.areas,symconObjects:[],symconTitle:this.settings.title?.trim()||"NextFloor",symconRefresh:()=>this.refresh(!0),config:{unit_system:{temperature:"\xB0C"}},themes:{darkMode:window.matchMedia?.("(prefers-color-scheme: dark)").matches??!0},services:{},connection:{subscribeMessage:async(e,t)=>{if(t.type==="nextfloor/building/subscribe"){let n=i=>e({revision:i});return this.buildingListeners.add(n),async()=>{this.buildingListeners.delete(n)}}return async()=>{}}},callWS:e=>this.callWS(e),callService:(e,t,n)=>this.callService(e,t,n),fetchWithAuth:(e,t)=>this.fetchWithToken(e,t),hassUrl:(e="")=>new URL(e,window.location.origin).href};async start(){let e=await Xt(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 Xt(this.settings,"bootstrap"):await Xt(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=ha(t,n);!i||i.entity_id===t.entity_id||this.states[i.entity_id]||(this.staLine truncated
|
||||
/*! Bundled license information:
|
||||
|
||||
@lit/reactive-element/css-tag.js:
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,254 @@
|
||||
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
|
||||
var Z=globalThis,J=Z.ShadowRoot&&(Z.ShadyCSS===void 0||Z.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Q=Symbol(),yt=new WeakMap,U=class{constructor(t,n,e){if(this._$cssResult$=!0,e!==Q)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=n}get styleSheet(){let t=this.o,n=this.t;if(J&&t===void 0){let e=n!==void 0&&n.length===1;e&&(t=yt.get(n)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&yt.set(n,t))}return t}toString(){return this.cssText}},vt=i=>new U(typeof i=="string"?i:i+"",void 0,Q),x=(i,...t)=>{let n=i.length===1?i[0]:t.reduce((e,r,s)=>e+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+i[s+1],i[0]);return new U(n,i,Q)},xt=(i,t)=>{if(J)i.adoptedStyleSheets=t.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(let n of t){let e=document.createElement("style"),r=Z.litNonce;r!==void 0&&e.setAttribute("nonce",r),e.textContent=n.cssText,i.appendChild(e)}},tt=J?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let n="";for(let e of t.cssRules)n+=e.cssText;return vt(n)})(i):i;var{is:It,defineProperty:Wt,getOwnPropertyDescriptor:Kt,getOwnPropertyNames:qt,getOwnPropertySymbols:Zt,getPrototypeOf:Jt}=Object,Y=globalThis,$t=Y.trustedTypes,Yt=$t?$t.emptyScript:"",Xt=Y.reactiveElementPolyfillSupport,z=(i,t)=>i,et={toAttribute(i,t){switch(t){case Boolean:i=i?Yt:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let n=i;switch(t){case Boolean:n=i!==null;break;case Number:n=i===null?null:Number(i);break;case Object:case Array:try{n=JSON.parse(i)}catch{n=null}}return n}},wt=(i,t)=>!It(i,t),_t={attribute:!0,type:String,converter:et,reflect:!1,useDefault:!1,hasChanged:wt};Symbol.metadata??=Symbol("metadata"),Y.litPropertyMetadata??=new WeakMap;var w=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,n=_t){if(n.state&&(n.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((n=Object.create(n)).wrapped=!0),this.elementProperties.set(t,n),!n.noAccessor){let e=Symbol(),r=this.getPropertyDescriptor(t,e,n);r!==void 0&&Wt(this.prototype,t,r)}}static getPropertyDescriptor(t,n,e){let{get:r,set:s}=Kt(this.prototype,t)??{get(){return this[n]},set(o){this[n]=o}};return{get:r,set(o){let c=r?.call(this);s?.call(this,o),this.requestUpdate(t,c,e)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??_t}static _$Ei(){if(this.hasOwnProperty(z("elementProperties")))return;let t=Jt(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(z("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(z("properties"))){let n=this.properties,e=[...qt(n),...Zt(n)];for(let r of e)this.createProperty(r,n[r])}let t=this[Symbol.metadata];if(t!==null){let n=litPropertyMetadata.get(t);if(n!==void 0)for(let[e,r]of n)this.elementProperties.set(e,r)}this._$Eh=new Map;for(let[n,e]of this.elementProperties){let r=this._$Eu(n,e);r!==void 0&&this._$Eh.set(r,n)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let n=[];if(Array.isArray(t)){let e=new Set(t.flat(1/0).reverse());for(let r of e)n.unshift(tt(r))}else t!==void 0&&n.push(tt(t));return n}static _$Eu(t,n){let e=n.attribute;return e===!1?void 0:typeof e=="string"?e:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,n=this.constructor.elementProperties;for(let e of n.keys())this.hasOwnProperty(e)&&(t.set(e,this[e]),delete this[e]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return xt(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,n,e){this._$AK(t,e)}_$ET(t,n){let e=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,e);if(r!==void 0&&e.reflect===!0){let s=(e.converter?.toAttribute!==void 0?e.converter:et).toAttribute(n,e.type);this._$Em=t,s==null?this.removeAttribute(r):this.setAttributeLine truncated
|
||||
\f\r]`,L=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Et=/-->/g,kt=/>/g,S=RegExp(`>|${nt}(?:([^\\s"'>=/]+)(${nt}*=${nt}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ht=/'/g,Ct=/"/g,Mt=/^(?:script|style|textarea|title)$/i,dt=i=>(t,...n)=>({_$litType$:i,strings:t,values:n}),p=dt(1),pe=dt(2),fe=dt(3),H=Symbol.for("lit-noChange"),a=Symbol.for("lit-nothing"),Rt=new WeakMap,E=k.createTreeWalker(k,129);function Ot(i,t){if(!ct(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return St!==void 0?St.createHTML(t):t}var te=(i,t)=>{let n=i.length-1,e=[],r,s=t===2?"<svg>":t===3?"<math>":"",o=L;for(let c=0;c<n;c++){let l=i[c],u,h,d=-1,f=0;for(;f<l.length&&(o.lastIndex=f,h=o.exec(l),h!==null);)f=o.lastIndex,o===L?h[1]==="!--"?o=Et:h[1]!==void 0?o=kt:h[2]!==void 0?(Mt.test(h[2])&&(r=RegExp("</"+h[2],"g")),o=S):h[3]!==void 0&&(o=S):o===S?h[0]===">"?(o=r??L,d=-1):h[1]===void 0?d=-2:(d=o.lastIndex-h[2].length,u=h[1],o=h[3]===void 0?S:h[3]==='"'?Ct:Ht):o===Ct||o===Ht?o=S:o===Et||o===kt?o=L:(o=S,r=void 0);let v=o===S&&i[c+1].startsWith("/>")?" ":"";s+=o===L?l+Gt:d>=0?(e.push(u),l.slice(0,d)+Pt+l.slice(d)+A+v):l+A+(d===-2?c:v)}return[Ot(i,s+(i[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),e]},j=class i{constructor({strings:t,_$litType$:n},e){let r;this.parts=[];let s=0,o=0,c=t.length-1,l=this.parts,[u,h]=te(t,n);if(this.el=i.createElement(u,e),E.currentNode=this.el.content,n===2||n===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(r=E.nextNode())!==null&&l.length<c;){if(r.nodeType===1){if(r.hasAttributes())for(let d of r.getAttributeNames())if(d.endsWith(Pt)){let f=h[o++],v=r.getAttribute(d).split(A),_=/([.?@])?(.*)/.exec(f);l.push({type:1,index:s,name:_[2],strings:v,ctor:_[1]==="."?rt:_[1]==="?"?st:_[1]==="@"?ot:P}),r.removeAttribute(d)}else d.startsWith(A)&&(l.push({type:6,index:s}),r.removeAttribute(d));if(Mt.test(r.tagName)){let d=r.textContent.split(A),f=d.length-1;if(f>0){r.textContent=X?X.emptyScript:"";for(let v=0;v<f;v++)r.append(d[v],D()),E.nextNode(),l.push({type:2,index:++s});r.append(d[f],D())}}}else if(r.nodeType===8)if(r.data===Nt)l.push({type:2,index:s});else{let d=-1;for(;(d=r.data.indexOf(A,d+1))!==-1;)l.push({type:7,index:s}),d+=A.length-1}s++}}static createElement(t,n){let e=k.createElement("template");return e.innerHTML=t,e}};function R(i,t,n=i,e){if(t===H)return t;let r=e!==void 0?n._$Co?.[e]:n._$Cl,s=F(t)?void 0:t._$litDirective$;return r?.constructor!==s&&(r?._$AO?.(!1),s===void 0?r=void 0:(r=new s(i),r._$AT(i,n,e)),e!==void 0?(n._$Co??=[])[e]=r:n._$Cl=r),r!==void 0&&(t=R(i,r._$AS(i,t.values),r,e)),t}var it=class{constructor(t,n){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:n},parts:e}=this._$AD,r=(t?.creationScope??k).importNode(n,!0);E.currentNode=r;let s=E.nextNode(),o=0,c=0,l=e[0];for(;l!==void 0;){if(o===l.index){let u;l.type===2?u=new V(s,s.nextSibling,this,t):l.type===1?u=new l.ctor(s,l.name,l.strings,this,t):l.type===6&&(u=new at(s,this,t)),this._$AV.push(u),l=e[++c]}o!==l?.index&&(s=E.nextNode(),o++)}return E.currentNode=k,r}p(t){let n=0;for(let e of this._$AV)e!==void 0&&(e.strings!==void 0?(e._$AI(t,e,n),n+=e.strings.length-2):e._$AI(t[n])),n++}},V=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,n,e,r){this.type=2,this._$AH=a,this._$AN=void 0,this._$AA=t,this._$AB=n,this._$AM=e,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,n=this._$AM;return n!==void 0&&t?.nodeType===11&&(t=n.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,n=this){t=R(this,t,n),F(t)?t===a||t==null||t===""?(this._$AH!==a&&this._$AR(),this._$AH=a):t!==this._$AH&&t!==H&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Qt(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==a&&F(this._$AH)?this._$AA.nextSibling.data=t:this.T(k.createTextNode(t)),this._$AH=t}$(t){let{values:n,_$litType$:e}=t,r=typeof e=="number"?this._$AC(t):(e.el===void 0&&(e.el=j.createElement(Ot(e.h,e.h[0]),this.options)),e);if(this._$AH?._$AD===r)this._$AH.p(n);else{let s=new it(r,this),o=s.u(this.options);s.p(n),this.T(o),this._$AH=s}}_$AC(t){let n=Rt.get(t.strings);return n===void 0&&Rt.set(t.strings,n=new j(t)),n}k(t){ct(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,e,r=0;for(let s of t)r===n.length?n.push(e=new i(this.O(D()),this.O(D()),this,this.options)):e=n[r],e._$AI(s),r++;r<n.length&&(this._$AR(e&&e._$AB.nextSibling,r),n.length=r)}_$AR(t=this._$AA.nextSibling,n){for(this._$AP?.(!1,!0,n);t!==this._$AB;){let e=At(t).nextSibling;At(t).remove(),t=e}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},P=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,n,e,r,s){this.type=1,this._$AH=a,this._$AN=void 0,this.element=t,this.name=n,this._$AM=r,this.options=s,e.length>2||e[0]!==""||e[1]!==""?(this._$AH=Array(e.length-1).fill(new String),this.strings=e)Line truncated
|
||||
:host {
|
||||
--nf-text: var(--primary-text-color, #e1e1e1);
|
||||
--nf-muted: var(--secondary-text-color, #9b9b9b);
|
||||
--nf-accent: var(--primary-color, #03a9f4);
|
||||
--nf-accent-text: var(--text-primary-color, #ffffff);
|
||||
--nf-surface: var(--ha-card-background, var(--card-background-color, #1c1c1c));
|
||||
--nf-bg: var(--primary-background-color, #111111);
|
||||
--nf-bg2: var(--secondary-background-color, #1c1c1c);
|
||||
/* floating bars and cards over the 3D view: the card colour, a little see-through */
|
||||
--nf-chrome: color-mix(in srgb, var(--nf-surface) var(--nf-chrome-mix, 84%), transparent);
|
||||
--nf-chrome-solid: var(--nf-surface);
|
||||
--nf-line: var(--divider-color, rgba(255, 255, 255, 0.12));
|
||||
/* quiet fills for buttons and fields, and the tonal accent of an active control */
|
||||
--nf-fill: color-mix(in srgb, var(--nf-text) 7%, transparent);
|
||||
--nf-fill-strong: color-mix(in srgb, var(--nf-text) 13%, transparent);
|
||||
--nf-tonal: color-mix(in srgb, var(--nf-accent) 20%, transparent);
|
||||
--nf-soft: var(--info-color, #4a90e2);
|
||||
--nf-warm: var(--state-light-active-color, #ffa726);
|
||||
--nf-danger: var(--error-color, #db4437);
|
||||
--nf-good: var(--success-color, #43a047);
|
||||
--nf-radius: var(--ha-card-border-radius, 12px);
|
||||
--nf-shadow: var(--ha-card-box-shadow, 0 1px 2px rgba(0, 0, 0, 0.18), 0 6px 20px rgba(0, 0, 0, 0.2));
|
||||
--nf-font: var(--primary-font-family, Roboto, "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif);
|
||||
--nf-title-font: var(--nf-font);
|
||||
font-family: var(--nf-font);
|
||||
color: var(--nf-text);
|
||||
}
|
||||
`,Me=x`
|
||||
:host([readable]) {
|
||||
--secondary-text-color: var(--primary-text-color, #e1e1e1);
|
||||
--divider-color: color-mix(in srgb, var(--primary-text-color, #e1e1e1) 40%, transparent);
|
||||
--nf-chrome-mix: 97%;
|
||||
}
|
||||
:host([readable]) nf-room-panel,
|
||||
:host([readable]) .nf-nav,
|
||||
:host([readable]) .nf-overlay {
|
||||
zoom: 1.2;
|
||||
}
|
||||
`,Oe=x`
|
||||
/* a group of switches: one rounded pill, the active one tinted with the accent */
|
||||
.nf-seg {
|
||||
display: inline-flex;
|
||||
padding: 4px;
|
||||
gap: 2px;
|
||||
border-radius: 999px;
|
||||
background: var(--nf-chrome);
|
||||
box-shadow: var(--nf-shadow);
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
.nf-seg button,
|
||||
.nf-chip {
|
||||
font: inherit;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
border: none;
|
||||
background: none;
|
||||
color: var(--nf-muted);
|
||||
padding: 7px 14px;
|
||||
border-radius: 999px;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
min-height: 36px;
|
||||
transition:
|
||||
background 0.15s,
|
||||
color 0.15s;
|
||||
}
|
||||
.nf-seg button:hover:not(:disabled),
|
||||
.nf-chip:hover {
|
||||
background: var(--nf-fill);
|
||||
color: var(--nf-text);
|
||||
}
|
||||
/* on a small stage (a small window, a zoomed browser, a dashboard column) the switches at the bottom take less room */
|
||||
@container nf ((max-width: 1360px) or (max-height: 640px)) {
|
||||
:is(.nf-overlay, .nf-card-controls) .nf-seg {
|
||||
padding: 3px;
|
||||
}
|
||||
:is(.nf-overlay, .nf-card-controls) :is(.nf-seg button, .nf-chip) {
|
||||
font-size: 12.5px;
|
||||
padding: 5px 10px;
|
||||
}
|
||||
}
|
||||
.nf-time-slider {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 4px 10px;
|
||||
}
|
||||
.nf-time-slider input {
|
||||
width: 160px;
|
||||
accent-color: var(--nf-accent);
|
||||
}
|
||||
.nf-seg button[aria-pressed="true"],
|
||||
.nf-chip[aria-pressed="true"] {
|
||||
background: color-mix(in srgb, var(--nf-accent) 24%, var(--nf-chrome-solid));
|
||||
color: var(--nf-accent);
|
||||
font-weight: 600;
|
||||
}
|
||||
.nf-seg button:disabled {
|
||||
opacity: 0.4;
|
||||
cursor: default;
|
||||
}
|
||||
/* a single pill, like the chips of the Mushroom cards */
|
||||
.nf-chip {
|
||||
background: var(--nf-chrome);
|
||||
color: var(--nf-text);
|
||||
box-shadow: var(--nf-shadow);
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
button:focus-visible,
|
||||
input:focus-visible,
|
||||
select:focus-visible {
|
||||
outline: 2px solid var(--nf-accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
/* the round icon badge every row and card starts with */
|
||||
.nf-ico {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex: none;
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
border-radius: 50%;
|
||||
background: var(--nf-tonal);
|
||||
color: var(--nf-accent);
|
||||
--mdc-icon-size: 20px;
|
||||
}
|
||||
.nf-ico.nf-warm {
|
||||
background: color-mix(in srgb, var(--nf-warm) 22%, transparent);
|
||||
color: var(--nf-warm);
|
||||
}
|
||||
.nf-ico.nf-off {
|
||||
background: var(--nf-fill);
|
||||
color: var(--nf-muted);
|
||||
}
|
||||
.nf-btn {
|
||||
font: inherit;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
border: none;
|
||||
background: var(--nf-fill);
|
||||
color: var(--nf-text);
|
||||
border-radius: var(--nf-radius);
|
||||
padding: 7px 14px;
|
||||
cursor: pointer;
|
||||
min-height: 36px;
|
||||
transition: background 0.15s;
|
||||
}
|
||||
.nf-btn:hover {
|
||||
background: var(--nf-fill-strong);
|
||||
}
|
||||
.nf-btn.nf-danger {
|
||||
color: var(--nf-danger);
|
||||
}
|
||||
.nf-btn.nf-primary {
|
||||
background: var(--nf-accent);
|
||||
color: var(--nf-accent-text);
|
||||
}
|
||||
.nf-btn.nf-primary:hover {
|
||||
background: color-mix(in srgb, var(--nf-accent) 88%, var(--nf-text));
|
||||
}
|
||||
.nf-field {
|
||||
display: grid;
|
||||
gap: 4px;
|
||||
font-size: 12px;
|
||||
color: var(--nf-muted);
|
||||
}
|
||||
.nf-field input,
|
||||
.nf-field select,
|
||||
.nf-field textarea {
|
||||
font: inherit;
|
||||
font-size: 14px;
|
||||
color: var(--nf-text);
|
||||
background: var(--nf-fill);
|
||||
border: none;
|
||||
border-bottom: 1px solid var(--nf-line);
|
||||
border-radius: 10px 10px 4px 4px;
|
||||
padding: 8px 10px;
|
||||
min-width: 0;
|
||||
}
|
||||
.nf-field input:focus,
|
||||
.nf-field select:focus,
|
||||
.nf-field textarea:focus {
|
||||
border-bottom-color: var(--nf-accent);
|
||||
}
|
||||
.nf-field input[type="range"] {
|
||||
padding: 0;
|
||||
accent-color: var(--nf-accent);
|
||||
}
|
||||
.nf-field select option {
|
||||
background: var(--nf-chrome-solid);
|
||||
color: var(--nf-text);
|
||||
}
|
||||
/* fingers need 40 px */
|
||||
@media (pointer: coarse) {
|
||||
.nf-seg button,
|
||||
.nf-chip,
|
||||
.nf-btn {
|
||||
min-height: 40px;
|
||||
}
|
||||
}
|
||||
`;function pt(i,t){let n=new Set;return t.flatMap(e=>{let r=String(i?.states[e]?.attributes.symcon_source_entity||e),s=i?.states[r]?.attributes,o=Number(s?.symcon_id);return!o||!s?.symcon_archive||n.has(o)?[]:(n.add(o),[r])})}var zt,ft=class extends b{static properties={hass:{attribute:!1},ids:{attribute:!1},label:{attribute:!1},busy:{state:!0},error:{state:!0}};constructor(){super(),this.ids=[],this.label="",this.busy=!1,this.error=""}async open(t){t.stopPropagation(),this.busy=!0,this.error="";try{let n=new URL("./nextfloor-trend.js?v=84417e0b2573",import.meta.url).href;await(await(zt??=import(n).catch(r=>{throw zt=void 0,r}))).openTrend(this.hass,this.ids,this.label)}catch(n){this.error=n instanceof Error?n.message:String(n)}finally{this.busy=!1}}render(){if(!pt(this.hass,this.ids).length)return a;let t=this.label?`Trend anzeigen: ${this.label}`:"Trend anzeigen";return p`<button type="button" title=${t} aria-label=${t} aria-haspopup="dialog" ?disabled=${this.busy} @pointerdown=${n=>n.stopPropagation()} @click=${n=>{this.open(n)}}>
|
||||
<svg width="12" height="12" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M3 2v15h15M5 13l4-5 4 2 4-6"/></svg>
|
||||
</button>${this.error?p`<span role="alert">${this.error}</span>`:a}`}static styles=x`:host{position:relative;display:inline-flex;flex:0 0 18px;width:18px;height:18px;vertical-align:middle;margin-left:3px;font-weight:normal;line-height:0}button{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:18px;height:18px;padding:2px;border:0;border-radius:3px;background:transparent;color:var(--nf-accent,#40c8ff);opacity:.8;cursor:pointer}svg{display:block;flex-shrink:0}button:hover,button:focus-visible{opacity:1;background:#40c8ff18}button:focus-visible{outline:1px solid currentColor;outline-offset:1px}button:disabled{opacity:.4}span{position:absolute;right:0;top:22px;z-index:10;box-sizing:border-box;width:200px;padding:8px;border:1px solid #ff9b9b50;border-radius:6px;background:var(--nf-chrome-solid,#1c1c1c);font:12px/1.4 system-ui;color:#ff9b9b;white-space:normal}`};customElements.get("nf-trend-button")||customElements.define("nf-trend-button",ft);function G(i,t,n=""){let e=pt(i,t);return e.length?p`<nf-trend-button .hass=${i} .ids=${e} .label=${n}></nf-trend-button>`:a}var ae={heating_manifold:"Heiz-/K\xFChlkreisverteiler",buffer_tank:"Pufferspeicher",freshwater_station:"Frischwasserstation"},Dt=i=>i.name||ae[i.type],Ft=i=>i.name||{heating:"Heizkreis",cooling:"K\xFChlkreis",changeover:"Heizen / K\xFChlen",pump:"Vorschubpumpe"}[i.kind],jt=(i,t)=>t.kind==="pump"?"Pumpenkreis":t.kind==="cooling"?"K\xFChlen":t.kind==="heating"?"Heizen":m(t.mode_entity)&&g(i.states[t.mode_entity])===null?"Betriebsart \u2013":Number(m(t.mode_entity)?g(i.states[t.mode_entity]):0)===(t.cooling_value??1)?"K\xFChlen":"Heizen",bt=(i,t,n)=>[$(i,"Vorlauf",t),$(i,"R\xFCcklauf",n)].filter(e=>e!==null),Lt=(i,t,n)=>{let e=C(i,t),r=C(i,n);return e===null||r===null?a:p`<div class="reading delta"><span>ΔT · VL − RL</span><b>${(e-r).toLocaleString(i.language,{maximumFractionDigits:1})} K</b></div>`};function Vt(i,t){let n=N(t),e=bt(i,n.flow,n.return);if(t.type==="buffer_tank"&&e.unshift(...[...n.sensors??[]].sort((r,s)=>s.level-r.level).flatMap(r=>{let s=$(i,r.name||"F\xFChler",r.entity);return s?[s]:[]})),t.type==="freshwater_station")for(let[r,s]of[["Zirkulation",n.circulation_temperature],["Trinkwarmwasser",n.hot_water]]){let o=$(i,r,s);o&&e.push(o)}for(let r of t.values??[]){let s=$(i,r.label||String(r.entity&&i.states[r.entity]?.attributes.friendly_name||"Wert"),r.entity);s&&e.push({...s,icon:r.icon})}return e}var T=(i,t)=>p`<div class="reading" data-source=${t.id}><span>${t.icon?.startsWith("mdi:")?p`<ha-icon icon=${t.icon}></ha-icon>`:t.icon||a} ${t.label}</span><b>${t.text}${G(i,[t.id],t.label)}</b></div>`;function q(i,t,n){let e=O(i,n);return e.id?p`<div class="reading" data-source=${e.id}><span>${t}<small>${e.feedback?"Ist":"Soll"}</small></span><b><i class="lamp" style=${`background:${e.running===null?"#888":e.running?"#6fe1a2":"#465361"}`}></i>${K(i.states[e.id])}${G(i,[e.id],t)}</b></div>`:a}var Bt=x`
|
||||
:host{display:block;color:var(--nf-text);font:12px/1.4 system-ui,sans-serif;min-width:170px;max-width:300px}
|
||||
button{font:inherit;color:inherit;background:var(--nf-fill,#ffffff10);border:1px solid var(--nf-line);border-radius:7px;padding:5px 8px;cursor:pointer}button:disabled,input:disabled{opacity:.45;cursor:default}button:focus-visible,input:focus-visible{outline:2px solid var(--nf-accent);outline-offset:2px}
|
||||
.title{display:block;width:100%;padding:0 0 5px;border:0;background:none;font-weight:600;text-align:left;white-space:normal}.content{max-height:250px;overflow:auto;overscroll-behavior:contain}.circuit{border-top:1px solid var(--nf-line);padding:5px 0}.circuit-name{font-size:11px;font-weight:600;margin-bottom:3px}.reading{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;align-items:center;min-height:22px}.reading>span{color:var(--nf-muted);white-space:normal}.reading b{display:flex;align-items:center;justify-content:flex-end;white-space:nowrap;font-variant-numeric:tabular-nums;font-weight:500}.reading small{font-size:9px;margin-left:5px;opacity:.75}.delta{font-size:10px}.lamp{display:inline-block;flex:none;width:6px;height:6px;border-radius:50%;margin-right:5px}.empty{color:var(--nf-muted);font-size:11px;white-space:normal;margin:5px 0}nf-trend-button{margin-left:3px}
|
||||
.circuit-name small,h3 small{font-size:10px;color:var(--nf-muted);font-weight:normal;margin-left:5px}
|
||||
ha-icon{--mdc-icon-size:13px;width:13px;height:13px;vertical-align:middle}
|
||||
dialog{box-sizing:border-box;width:min(620px,calc(100vw - 24px));max-width:none;max-height:calc(100dvh - 24px);padding:0;color:var(--nf-text);background:var(--nf-chrome-solid,#1c1c1c);border:1px solid var(--nf-line);border-radius:14px;box-shadow:0 20px 70px #0008;font:13px/1.4 system-ui,sans-serif}dialog::backdrop{background:#050b16a6;backdrop-filter:blur(3px)}header{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 18px;border-bottom:1px solid var(--nf-line)}h2{font-size:17px;margin:0}.body{padding:12px 18px;max-height:calc(100dvh - 120px);overflow:auto;overscroll-behavior:contain}h3{font-size:13px;margin:12px 0 7px}fieldset{min-width:0;margin:8px 0;padding:10px;border:1px solid var(--nf-line);border-radius:9px}legend{font-size:12px;color:var(--nf-muted)}.command{display:flex;align-items:center;gap:12px;margin-top:8px}.command input[type=range]{flex:1;min-width:0;accent-color:var(--nf-accent)}.command input[type=number]{width:90px;box-sizing:border-box;background:var(--nf-fill,#ffffff10);border:1px solid var(--nf-line);border-radius:6px;color:inherit;padding:5px}.command output{font-variant-numeric:tabular-nums;min-width:45px;text-align:right}.error{color:#ff9b9b}.readonly{color:var(--nf-muted);font-size:11px;margin:4px 0}.body .reading{padding:4px 0}.body .circuit{padding-bottom:12px}
|
||||
`,mt=class extends b{static properties={hass:{attribute:!1},item:{attribute:!1},readOnly:{type:Boolean}};render(){if(!this.hass||!this.item)return a;let t=N(this.item),n=Vt(this.hass,this.item);return p`<button class="title" @click=${()=>le(this.hass,this.item,this.readOnly)} aria-haspopup="dialog">${Dt(this.item)} ⚙</button><div class="content">
|
||||
${this.item.type==="heating_manifold"?(t.circuits??[]).map(e=>p`<section class="circuit"><div class="circuit-name">${Ft(e)} <small>${jt(this.hass,e)}</small></div>${B(e)?q(this.hass,"Pumpe",e.pump):a}${I(e)?q(this.hass,"Ventil",e.valve):a}${bt(this.hass,e.flow,e.return).map(r=>T(this.hass,r))}${$(this.hass,"Leistung",e.power)?T(this.hass,$(this.hass,"Leistung",e.power)):a}</section>`):a}
|
||||
${n.map(e=>T(this.hass,e))}${this.item.type==="freshwater_station"?p`${q(this.hass,"Ladepumpe",t.pump)}${q(this.hass,"Zirkulationspumpe",t.circulation)}`:a}
|
||||
${this.item.type!=="heating_manifold"&&!n.length?p`<p class="empty">Noch keine Fühler verknüpft</p>`:a}
|
||||
</div>`}static styles=[ht,Bt]},gt=class extends b{static properties={hass:{attribute:!1},item:{attribute:!1},readOnly:{type:Boolean},pending:{state:!0},error:{state:!0}};constructor(){super(),this.pending=new Set,this.error="",this.readOnly=!1}async show(){await this.updateComplete,this.shadowRoot.querySelector("dialog").showModal()}async send(t,n){let e=this.hass.states[t];if(!(this.readOnly||!e?.attributes.symcon_has_action||g(e)===null||this.pending.has(t))){this.pending=new Set([...this.pending,t]),this.error="";try{await this.hass.callService("symcon","set_value",{entity_id:t,value:n})}catch(r){this.error=r instanceof Error?r.message:String(r)}finally{this.pending=new Set([...this.pending].filter(r=>r!==t))}}}control(t,n){if(!m(n?.command)&&!m(n?.feedback))return a;let e=m(n?.command)?n.command:null,r=e?this.hass.states[e]:void 0,s=r?.attributes,o=g(r),c=!!e&&!!s?.symcon_has_action&&o!==null&&!this.readOnly&&!this.pending.has(e),l=Number(s?.symcon_min??0),u=Number(s?.symcon_max??100),h=Number(s?.symcon_step||(s?.symcon_variable_type===1?1:.1)),d=M(r),f=v=>{let _=v.target;e&&_.value.trim()&&_.checkValidity()&&Number.isFinite(_.valueAsNumber)&&this.send(e,_.valueAsNumber)};return p`<fieldset data-control=${t}><legend>${t}</legend>${q(this.hass,t,n)}
|
||||
${e?p`<div class="reading"><span>Befehl / Sollwert</span><b>${K(r)}${G(this.hass,[e],`${t} \xB7 Sollwert`)}</b></div>
|
||||
${s?.symcon_variable_type===0?p`<div class="command"><button data-command=${e} ?disabled=${!c} @click=${()=>{this.send(e,!W(r))}}>${W(r)?"Ausschalten / Schlie\xDFen":"Einschalten / \xD6ffnen"}</button></div>`:[1,2].includes(Number(s?.symcon_variable_type))?p`<div class="command"><input type="range" aria-label=${`${t} Sollwert`} data-command=${e} min=${l} max=${u} step=${h} .value=${String(d??l)} ?disabled=${!c} @change=${f}/><input type="number" aria-label=${`${t} nativer Sollwert`} min=${l} max=${u} step=${h} .value=${d===null?"":String(d)} ?disabled=${!c} @change=${f}/></div>`:a}
|
||||
${this.readOnly?p`<p class="readonly">Historische Ansicht · nur Anzeige</p>`:s?.symcon_has_action?a:p`<p class="readonly">Nur Anzeige · keine Symcon-Schaltaktion hinterlegt</p>`}`:a}
|
||||
</fieldset>`}render(){if(!this.hass||!this.item)return a;let t=N(this.item),n=Vt(this.hass,this.item);return p`<dialog @close=${()=>{this.remove(),y===this&&(y=null)}} @keydown=${e=>e.stopPropagation()}><header><h2>${Dt(this.item)}</h2><button aria-label="Schließen" @click=${()=>this.shadowRoot.querySelector("dialog").close()}>×</button></header><div class="body">
|
||||
${this.item.type==="heating_manifold"?(t.circuits??[]).map(e=>p`<section class="circuit" data-circuit=${e.id}><h3>${Ft(e)} <small>${jt(this.hass,e)}</small></h3>${B(e)?this.control("Pumpe",e.pump):a}${I(e)?this.control("Ventil",e.valve):a}${bt(this.hass,e.flow,e.return).map(r=>T(this.hass,r))}${Lt(this.hass,e.flow,e.return)}${$(this.hass,"Pumpenleistung",e.power)?T(this.hass,$(this.hass,"Pumpenleistung",e.power)):a}</section>`):a}
|
||||
${n.map(e=>T(this.hass,e))}${this.item.type!=="heating_manifold"?Lt(this.hass,t.flow,t.return):a}
|
||||
${this.item.type==="freshwater_station"?p`${this.control("Ladepumpe",t.pump)}${this.control("Zirkulationspumpe",t.circulation)}`:a}
|
||||
${!n.length&&this.item.type!=="heating_manifold"?p`<p class="empty">Die Fühler lassen sich im Editor über den Objektbaum zuweisen.</p>`:a}
|
||||
${this.error?p`<p class="error" role="alert">${this.error}</p>`:a}
|
||||
</div></dialog>`}static styles=[ht,Bt,x`:host{max-width:none;min-width:0}`]},y=null;function Ke(){y?.remove(),y=null}async function le(i,t,n=!1){y?.remove();let e=document.createElement("nf-hydronic-dialog");y=e,Object.assign(e,{hass:i,item:t,readOnly:n}),document.body.append(e),await e.show()}function qe(i,t,n=!1){if(!y)return;let e=t.floors.flatMap(r=>r.furniture).find(r=>r.id===y.item.id);if(!e||!Ut(e.type)){y.remove(),y=null;return}Object.assign(y,{hass:i,item:e,readOnly:n})}customElements.get("nf-hydronic-card")||customElements.define("nf-hydronic-card",mt);customElements.get("nf-hydronic-dialog")||customElements.define("nf-hydronic-dialog",gt);export{Ke as closeHydronic,oe as hydronicVisual,le as openHydronic,qe as refreshHydronic};
|
||||
/*! Bundled license information:
|
||||
|
||||
@lit/reactive-element/css-tag.js:
|
||||
(**
|
||||
* @license
|
||||
* Copyright 2019 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*)
|
||||
|
||||
@lit/reactive-element/reactive-element.js:
|
||||
lit-html/lit-html.js:
|
||||
lit-element/lit-element.js:
|
||||
(**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*)
|
||||
|
||||
lit-html/is-server.js:
|
||||
(**
|
||||
* @license
|
||||
* Copyright 2022 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*)
|
||||
*/
|
||||
@@ -282,7 +282,7 @@ class NextFloor extends IPSModuleStrict
|
||||
private function sendAsset(string $asset): void
|
||||
{
|
||||
// Only build artifacts are public through the authenticated hook. No request can escape the module folder.
|
||||
if (!preg_match('#^(?:nextfloor-(?:designer|3d|editor|card-editor|trend)\\.js|lang/[a-z]{2}\\.json)$#', $asset)) {
|
||||
if (!preg_match('#^(?:nextfloor-(?:designer|3d|editor|card-editor|trend|hydronics)\\.js|lang/[a-z]{2}\\.json)$#', $asset)) {
|
||||
$this->sendError(404, 'asset_not_found');
|
||||
return;
|
||||
}
|
||||
|
||||
+32
-1
@@ -16,7 +16,7 @@ In **Kerninstanzen → Modules** wird dieses Repository verwendet:
|
||||
|
||||
Im Zahnrad des Eintrags den Branch **`symcon`** wählen und auf Aktualisierungen prüfen.
|
||||
`main` enthält die Quellen für die Entwicklung, `symcon` die installierbare Bibliothek.
|
||||
Nach der Aktualisierung auf **0.2.22 / Build 25** die Konsole neu laden. Unter
|
||||
Nach der Aktualisierung auf **0.2.23 / Build 26** die Konsole neu laden. Unter
|
||||
**Instanz hinzufügen → Hersteller NextFloor** erscheint **„NextFloor Designer und 3D-Kachel“**.
|
||||
|
||||
### Für die Entwicklung
|
||||
@@ -46,6 +46,37 @@ Die Dateien unter `NextFloor/assets/` und `NextFloor/packs/` werden durch
|
||||
Der Build prüft anschließend die Modulmetadaten und die installierbare Verzeichnisstruktur.
|
||||
Dieselbe Prüfung lässt sich separat mit `node symcon/tests/validate-package.mjs` ausführen.
|
||||
|
||||
## Änderungen in 0.2.23
|
||||
|
||||
- **Heiz-/Kühlkreisverteiler:** Neues 3D-Bauteil in der Möbelbibliothek mit bis zu
|
||||
32 frei benennbaren Kreisen. Heizkreise, Kühlkreise und umschaltbare Kreise
|
||||
unterstützen jeweils optionale Pumpen, Ventile, Vorlauf-/Rücklauffühler und
|
||||
Pumpenleistung. Einspeise- bzw. Vorschubpumpen sind eigene Kreise ohne Ventil.
|
||||
Eine gemeinsame Vorschubpumpe mit mehreren ventilbestückten Kreisen ist damit
|
||||
ebenfalls möglich. Umschaltbare Kreise verwenden einen explizit verknüpften
|
||||
Boolean-/Integer-Wert und den konfigurierten Wert für Kühlbetrieb.
|
||||
- **Pufferspeicher:** Neues 3D-Bauteil mit sieben Fühlerplätzen von oben nach
|
||||
unten sowie separatem Vorlauf und Rücklauf. Es können bis zu 64 Plätze angelegt,
|
||||
benannt, entfernt und frei in ihrer Höhe positioniert werden. Die Anzeige
|
||||
sortiert die verknüpften Fühler nach ihrer Höhe; unzugewiesene Plätze bleiben
|
||||
in der Werteliste ausgeblendet.
|
||||
- **Frischwasserstation:** Neues 3D-Bauteil mit Vorlauf, Rücklauf,
|
||||
Zirkulationstemperatur und Trinkwarmwasser. Lade- und Zirkulationspumpe lassen
|
||||
sich getrennt verknüpfen und bedienen.
|
||||
- Alle Datenpunkte werden aus dem echten Objektbaum ausgewählt, nach ihrem
|
||||
nativen Datentyp und ohne Namens-/Pfadfilter. Pumpen und Ventile haben getrennte
|
||||
Befehls- und Rückmeldevariablen. Eine zugewiesene Rückmeldung bestimmt die
|
||||
3D-Anzeige auch dann, wenn sie nicht verfügbar ist; nur ohne Rückmeldung wird
|
||||
der Sollwert verwendet. Ventilumkehrung gilt ausschließlich für die Darstellung.
|
||||
Zahlen und Befehle behalten ihren nativen Wert und Wertebereich.
|
||||
- Pumpenrotoren zeigen gemeldeten Betrieb, Ventilzeiger die gemeldete Position
|
||||
und Speicherfühler ihre Temperaturfarbe. Optionale schwebende Karten und ein
|
||||
Bedienfenster zeigen die Werte, geloggte Datenpunkte bieten Archivtrends.
|
||||
Die Spreizung wird als **Vorlauf minus Rücklauf** in Kelvin angezeigt.
|
||||
Nur Befehlsvariablen mit Symcon-Schaltaktion sind bedienbar; Rückmeldungen und
|
||||
historische Ansichten bleiben reine Anzeigen. Die Zusatzoberfläche lädt erst,
|
||||
wenn tatsächlich ein Hydraulikbauteil im Plan vorhanden ist.
|
||||
|
||||
## Änderungen in 0.2.22
|
||||
|
||||
- **Bereiche statt mehrfacher Raumkopien:** Die rechte Übersicht eines Stockwerks
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@
|
||||
"compatibility": {
|
||||
"version": "9.0"
|
||||
},
|
||||
"version": "0.2.22",
|
||||
"build": 25,
|
||||
"version": "0.2.23",
|
||||
"build": 26,
|
||||
"date": 1794441600
|
||||
}
|
||||
@@ -59,7 +59,7 @@ export function validateSymconPackage(root = fileURLToPath(new URL("../", import
|
||||
assert.match(php, new RegExp(`class\\s+${entry.name}\\s+extends\\s+IPSModuleStrict\\b`), "Module PHP class is missing or mismatched");
|
||||
const form = readJson(join(directory, "form.json"));
|
||||
assert.ok(Array.isArray(form.elements) && Array.isArray(form.actions), "Module form must contain elements and actions");
|
||||
for (const asset of ["nextfloor-designer.js", "nextfloor-3d.js", "nextfloor-editor.js", "nextfloor-card-editor.js", "nextfloor-trend.js"]) {
|
||||
for (const asset of ["nextfloor-designer.js", "nextfloor-3d.js", "nextfloor-editor.js", "nextfloor-card-editor.js", "nextfloor-trend.js", "nextfloor-hydronics.js"]) {
|
||||
assert.ok(readFileSync(join(directory, "assets", asset)).length > 0, `Missing build asset: ${asset}`);
|
||||
}
|
||||
modules.push(module);
|
||||
|
||||
@@ -207,6 +207,31 @@ def test_furniture_power_card() -> None:
|
||||
FURNITURE_SCHEMA({**FURN, "power_card": "yes"})
|
||||
|
||||
|
||||
def test_hydronic_circuits_buffer_probes_and_fresh_water_bindings() -> None:
|
||||
control = {"command": "cover.1", "feedback": "sensor.2", "inverted": True}
|
||||
circuit = {"id": "c1", "name": "Vorschub", "kind": "pump", "has_valve": False, "pump": control}
|
||||
hydronic = {
|
||||
"card": True,
|
||||
"circuits": [circuit],
|
||||
"sensors": [{"id": f"s{i}", "name": f"Fühler {i}", "entity": None, "level": i / 6} for i in range(7)],
|
||||
"flow": "light.3",
|
||||
"return": "climate.4",
|
||||
"circulation": control,
|
||||
"circulation_temperature": "sensor.5",
|
||||
"hot_water": "sensor.6",
|
||||
}
|
||||
assert FURNITURE_SCHEMA({**FURN, "type": "heating_manifold", "hydronic": hydronic})["hydronic"] == hydronic
|
||||
for bad in (
|
||||
{"circuits": [{**circuit, "kind": "guess_from_name"}]},
|
||||
{"circuits": [circuit] * 33},
|
||||
{"sensors": [{"id": "s", "name": "Fühler", "entity": None, "level": 1.01}]},
|
||||
{"pump": {"command": 12345}},
|
||||
{"card": "yes"},
|
||||
):
|
||||
with pytest.raises(vol.Invalid):
|
||||
FURNITURE_SCHEMA({**FURN, "hydronic": bad})
|
||||
|
||||
|
||||
def test_furniture_show_when() -> None:
|
||||
assert "show_when" not in FURNITURE_SCHEMA(FURN)
|
||||
cond = {"entity": "input_boolean.xmas", "state": "on, home", "invert": True}
|
||||
|
||||
Reference in new issue
Block a user