feat: add native Symcon room climate, schedules, weather and presence
This commit is contained in:
1 parent
510aece983
commit
18e73194e0
37 files changed
+2861
-2132
No files matched your search
@@ -6,6 +6,9 @@ All notable changes to NextFloor, newest first. Every release lists what is **Ad
|
|||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
- **Native Symcon room climate and clocks:** Select underfloor heating, supply/extract VSRs and temperatures, reheater and an aliased Integer room status from the object tree. The room menu displays and controls native writable values and shows multiple classic weekly schedules with day groups, switch points, action labels and activation controls.
|
||||||
|
- **Native Symcon weather and presence:** Link individual weather variables and arbitrary Boolean presence variables; weather data drives the 3D sky and rain warnings, while named people appear in the status bar and optionally in a chosen room.
|
||||||
|
|
||||||
- **Room-name toolbar switches:** The 3D view and editor expose a direct room-name switch at the top, sharing the remembered designer preference. Cards expose the same switch in their 3D top bar. Hiding room names keeps notes, devices and climate cards visible.
|
- **Room-name toolbar switches:** The 3D view and editor expose a direct room-name switch at the top, sharing the remembered designer preference. Cards expose the same switch in their 3D top bar. Hiding room names keeps notes, devices and climate cards visible.
|
||||||
|
|
||||||
- **Room illuminance and multiple device readings:** Rooms can link a brightness sensor and show lux with a sun symbol; CO₂ uses a cloud. A small + button adds device/furniture values with independent object-tree choices, custom symbols and optional labels, shown on device markers and in the room panel.
|
- **Room illuminance and multiple device readings:** Rooms can link a brightness sensor and show lux with a sun symbol; CO₂ uses a cloud. A small + button adds device/furniture values with independent object-tree choices, custom symbols and optional labels, shown on device markers and in the room panel.
|
||||||
@@ -18,6 +21,8 @@ All notable changes to NextFloor, newest first. Every release lists what is **Ad
|
|||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
- **Symcon interface:** Underfloor heating moves into room climate. The linked room-status alias replaces the calculated comfort value. Announcement, speaker, quiet-time and Bluetooth-location controls are removed from the Symcon interface.
|
||||||
|
|
||||||
- **Symcon view title and form:** The configured visualization name replaces the NextFloor header text; the explanatory paragraph in the instance form is removed.
|
- **Symcon view title and form:** The configured visualization name replaces the NextFloor header text; the explanatory paragraph in the instance form is removed.
|
||||||
|
|
||||||
- **Room climate cards in floor views:** The all-floors overview hides the floating room climate cards. Opening a floor or room shows its enabled cards again.
|
- **Room climate cards in floor views:** The all-floors overview hides the floating room climate cards. Opening a floor or room shows its enabled cards again.
|
||||||
|
|||||||
@@ -1,28 +1,28 @@
|
|||||||
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
|
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
|
||||||
var p={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",fr:"6312d0f61ebf",hu:"27ba348531dc",it:"1b705e76dd00",nb:"c5ea24fb9ef6",nl:"b64142c67c2e",pl:"8527a4930402",pt:"31857a2d2277",ro:"e3cb5f449f0f",sk:"320611594db0",sl:"8071691ceda3",sv:"711b911ec8da",tr:"7c83ce1c3372",zh:"50518d9f494e"};var M=globalThis,N=M.ShadowRoot&&(M.ShadyCSS===void 0||M.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,V=Symbol(),me=new WeakMap,R=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==V)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(N&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=me.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&me.set(t,e))}return e}toString(){return this.cssText}},pe=i=>new R(typeof i=="string"?i:i+"",void 0,V),U=(i,...e)=>{let t=i.length===1?i[0]:e.reduce((n,r,o)=>n+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+i[o+1],i[0]);return new R(t,i,V)},fe=(i,e)=>{if(N)i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),r=M.litNonce;r!==void 0&&n.setAttribute("nonce",r),n.textContent=t.cssText,i.appendChild(n)}},j=N?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return pe(t)})(i):i;var{is:Ke,defineProperty:Ge,getOwnPropertyDescriptor:Oe,getOwnPropertyNames:Ie,getOwnPropertySymbols:Ze,getPrototypeOf:Ve}=Object,C=globalThis,ge=C.trustedTypes,Ue=ge?ge.emptyScript:"",je=C.reactiveElementPolyfillSupport,F=(i,e)=>i,q={toAttribute(i,e){switch(e){case Boolean:i=i?Ue:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},we=(i,e)=>!Ke(i,e),be={attribute:!0,type:String,converter:q,reflect:!1,useDefault:!1,hasChanged:we};Symbol.metadata??=Symbol("metadata"),C.litPropertyMetadata??=new WeakMap;var b=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=be){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&&Ge(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:o}=Oe(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:r,set(a){let s=r?.call(this);o?.call(this,a),this.requestUpdate(e,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??be}static _$Ei(){if(this.hasOwnProperty(F("elementProperties")))return;let e=Ve(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(F("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(F("properties"))){let t=this.properties,n=[...Ie(t),...Ze(t)];for(let r of n)this.createProperty(r,t[r])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,r]of t)this.elementProperties.set(n,r)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let r=this._$Eu(t,n);r!==void 0&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let r of n)t.unshift(j(r))}else e!==void 0&&t.push(j(e));return t}static _$Eu(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return fe(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.Line truncated
|
var m={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",fr:"6312d0f61ebf",hu:"27ba348531dc",it:"1b705e76dd00",nb:"c5ea24fb9ef6",nl:"b64142c67c2e",pl:"8527a4930402",pt:"31857a2d2277",ro:"e3cb5f449f0f",sk:"320611594db0",sl:"8071691ceda3",sv:"711b911ec8da",tr:"7c83ce1c3372",zh:"50518d9f494e"};var M=globalThis,N=M.ShadowRoot&&(M.ShadyCSS===void 0||M.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,U=Symbol(),pe=new WeakMap,R=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==U)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(N&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=pe.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&pe.set(t,e))}return e}toString(){return this.cssText}},fe=i=>new R(typeof i=="string"?i:i+"",void 0,U),j=(i,...e)=>{let t=i.length===1?i[0]:e.reduce((n,r,o)=>n+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+i[o+1],i[0]);return new R(t,i,U)},ge=(i,e)=>{if(N)i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),r=M.litNonce;r!==void 0&&n.setAttribute("nonce",r),n.textContent=t.cssText,i.appendChild(n)}},q=N?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return fe(t)})(i):i;var{is:Ge,defineProperty:Oe,getOwnPropertyDescriptor:Ie,getOwnPropertyNames:Ze,getOwnPropertySymbols:Ve,getPrototypeOf:Ue}=Object,C=globalThis,be=C.trustedTypes,je=be?be.emptyScript:"",qe=C.reactiveElementPolyfillSupport,F=(i,e)=>i,J={toAttribute(i,e){switch(e){case Boolean:i=i?je:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},ke=(i,e)=>!Ge(i,e),we={attribute:!0,type:String,converter:J,reflect:!1,useDefault:!1,hasChanged:ke};Symbol.metadata??=Symbol("metadata"),C.litPropertyMetadata??=new WeakMap;var b=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=we){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&&Oe(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:o}=Ie(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:r,set(a){let s=r?.call(this);o?.call(this,a),this.requestUpdate(e,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??we}static _$Ei(){if(this.hasOwnProperty(F("elementProperties")))return;let e=Ue(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(F("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(F("properties"))){let t=this.properties,n=[...Ze(t),...Ve(t)];for(let r of n)this.createProperty(r,t[r])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,r]of t)this.elementProperties.set(n,r)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let r=this._$Eu(t,n);r!==void 0&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let r of n)t.unshift(q(r))}else e!==void 0&&t.push(q(e));return t}static _$Eu(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ge(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.Line truncated
|
||||||
\f\r]`,x=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ye=/-->/g,Se=/>/g,S=RegExp(`>|${J}(?:([^\\s"'>=/]+)(${J}*=${J}*(?:[^
|
\f\r]`,H=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Se=/-->/g,Ae=/>/g,S=RegExp(`>|${X}(?:([^\\s"'>=/]+)(${X}*=${X}*(?:[^
|
||||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ae=/'/g,De=/"/g,Re=/^(?:script|style|textarea|title)$/i,ie=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),l=ie(1),ct=ie(2),ut=ie(3),z=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),ze=new WeakMap,A=D.createTreeWalker(D,129);function Fe(i,e){if(!re(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return ve!==void 0?ve.createHTML(e):e}var Xe=(i,e)=>{let t=i.length-1,n=[],r,o=e===2?"<svg>":e===3?"<math>":"",a=x;for(let s=0;s<t;s++){let h=i[s],u,m,_=-1,g=0;for(;g<h.length&&(a.lastIndex=g,m=a.exec(h),m!==null);)g=a.lastIndex,a===x?m[1]==="!--"?a=ye:m[1]!==void 0?a=Se:m[2]!==void 0?(Re.test(m[2])&&(r=RegExp("</"+m[2],"g")),a=S):m[3]!==void 0&&(a=S):a===S?m[0]===">"?(a=r??x,_=-1):m[1]===void 0?_=-2:(_=a.lastIndex-m[2].length,u=m[1],a=m[3]===void 0?S:m[3]==='"'?De:Ae):a===De||a===Ae?a=S:a===ye||a===Se?a=x:(a=S,r=void 0);let k=a===S&&i[s+1].startsWith("/>")?" ":"";o+=a===x?h+qe:_>=0?(n.push(u),h.slice(0,_)+Ee+h.slice(_)+v+k):h+v+(_===-2?s:k)}return[Fe(i,o+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},B=class i{constructor({strings:e,_$litType$:t},n){let r;this.parts=[];let o=0,a=0,s=e.length-1,h=this.parts,[u,m]=Xe(e,t);if(this.el=i.createElement(u,n),A.currentNode=this.el.content,t===2||t===3){let _=this.el.content.firstChild;_.replaceWith(..._.childNodes)}for(;(r=A.nextNode())!==null&&h.length<s;){if(r.nodeType===1){if(r.hasAttributes())for(let _ of r.getAttributeNames())if(_.endsWith(Ee)){let g=m[a++],k=r.getAttribute(_).split(v),L=/([.?@])?(.*)/.exec(g);h.push({type:1,index:o,name:L[2],strings:k,ctor:L[1]==="."?Y:L[1]==="?"?Q:L[1]==="@"?ee:T}),r.removeAttribute(_)}else _.startsWith(v)&&(h.push({type:6,index:o}),r.removeAttribute(_));if(Re.test(r.tagName)){let _=r.textContent.split(v),g=_.length-1;if(g>0){r.textContent=K?K.emptyScript:"";for(let k=0;k<g;k++)r.append(_[k],H()),A.nextNode(),h.push({type:2,index:++o});r.append(_[g],H())}}}else if(r.nodeType===8)if(r.data===Te)h.push({type:2,index:o});else{let _=-1;for(;(_=r.data.indexOf(v,_+1))!==-1;)h.push({type:7,index:o}),_+=v.length-1}o++}}static createElement(e,t){let n=D.createElement("template");return n.innerHTML=e,n}};function E(i,e,t=i,n){if(e===z)return e;let r=n!==void 0?t._$Co?.[n]:t._$Cl,o=W(e)?void 0:e._$litDirective$;return r?.constructor!==o&&(r?._$AO?.(!1),o===void 0?r=void 0:(r=new o(i),r._$AT(i,t,n)),n!==void 0?(t._$Co??=[])[n]=r:t._$Cl=r),r!==void 0&&(e=E(i,r._$AS(i,e.values),r,n)),e}var X=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??D).importNode(t,!0);A.currentNode=r;let o=A.nextNode(),a=0,s=0,h=n[0];for(;h!==void 0;){if(a===h.index){let u;h.type===2?u=new P(o,o.nextSibling,this,e):h.type===1?u=new h.ctor(o,h.name,h.strings,this,e):h.type===6&&(u=new te(o,this,e)),this._$AV.push(u),h=n[++s]}a!==h?.index&&(o=A.nextNode(),a++)}return A.currentNode=D,r}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},P=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=E(this,e,t),W(e)?e===d||e==null||e===""?(this._$AH!==d&&this._$AR(),this._$AH=d):e!==this._$AH&&e!==z&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Je(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==d&&W(this._$AH)?this._$AA.nextSibling.data=e:this.T(D.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,r=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=B.createElement(Fe(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{let o=new X(r,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=ze.get(e.strings);return t===void 0&&ze.set(e.strings,t=new B(e)),t}k(e){re(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,r=0;for(let o of e)r===t.length?t.push(n=new i(this.O(H()),this.O(H()),this,this.options)):n=t[r],n._$AI(o),r++;r<t.length&&(this._$AR(n&&n._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=ke(e).nextSibling;ke(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},T=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,o){this.type=1,this._$AH=d,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=o,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):thiLine truncated
|
\f\r"'\`<>=]|("|')|))|$)`,"g"),De=/'/g,ze=/"/g,Fe=/^(?:script|style|textarea|title)$/i,oe=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),l=oe(1),ut=oe(2),mt=oe(3),z=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),Ee=new WeakMap,A=D.createTreeWalker(D,129);function He(i,e){if(!ie(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return ye!==void 0?ye.createHTML(e):e}var Ye=(i,e)=>{let t=i.length-1,n=[],r,o=e===2?"<svg>":e===3?"<math>":"",a=H;for(let s=0;s<t;s++){let h=i[s],u,p,_=-1,g=0;for(;g<h.length&&(a.lastIndex=g,p=a.exec(h),p!==null);)g=a.lastIndex,a===H?p[1]==="!--"?a=Se:p[1]!==void 0?a=Ae:p[2]!==void 0?(Fe.test(p[2])&&(r=RegExp("</"+p[2],"g")),a=S):p[3]!==void 0&&(a=S):a===S?p[0]===">"?(a=r??H,_=-1):p[1]===void 0?_=-2:(_=a.lastIndex-p[2].length,u=p[1],a=p[3]===void 0?S:p[3]==='"'?ze:De):a===ze||a===De?a=S:a===Se||a===Ae?a=H:(a=S,r=void 0);let k=a===S&&i[s+1].startsWith("/>")?" ":"";o+=a===H?h+Je:_>=0?(n.push(u),h.slice(0,_)+Te+h.slice(_)+v+k):h+v+(_===-2?s:k)}return[He(i,o+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},B=class i{constructor({strings:e,_$litType$:t},n){let r;this.parts=[];let o=0,a=0,s=e.length-1,h=this.parts,[u,p]=Ye(e,t);if(this.el=i.createElement(u,n),A.currentNode=this.el.content,t===2||t===3){let _=this.el.content.firstChild;_.replaceWith(..._.childNodes)}for(;(r=A.nextNode())!==null&&h.length<s;){if(r.nodeType===1){if(r.hasAttributes())for(let _ of r.getAttributeNames())if(_.endsWith(Te)){let g=p[a++],k=r.getAttribute(_).split(v),L=/([.?@])?(.*)/.exec(g);h.push({type:1,index:o,name:L[2],strings:k,ctor:L[1]==="."?Q:L[1]==="?"?ee:L[1]==="@"?te:T}),r.removeAttribute(_)}else _.startsWith(v)&&(h.push({type:6,index:o}),r.removeAttribute(_));if(Fe.test(r.tagName)){let _=r.textContent.split(v),g=_.length-1;if(g>0){r.textContent=K?K.emptyScript:"";for(let k=0;k<g;k++)r.append(_[k],x()),A.nextNode(),h.push({type:2,index:++o});r.append(_[g],x())}}}else if(r.nodeType===8)if(r.data===Re)h.push({type:2,index:o});else{let _=-1;for(;(_=r.data.indexOf(v,_+1))!==-1;)h.push({type:7,index:o}),_+=v.length-1}o++}}static createElement(e,t){let n=D.createElement("template");return n.innerHTML=e,n}};function E(i,e,t=i,n){if(e===z)return e;let r=n!==void 0?t._$Co?.[n]:t._$Cl,o=W(e)?void 0:e._$litDirective$;return r?.constructor!==o&&(r?._$AO?.(!1),o===void 0?r=void 0:(r=new o(i),r._$AT(i,t,n)),n!==void 0?(t._$Co??=[])[n]=r:t._$Cl=r),r!==void 0&&(e=E(i,r._$AS(i,e.values),r,n)),e}var Y=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??D).importNode(t,!0);A.currentNode=r;let o=A.nextNode(),a=0,s=0,h=n[0];for(;h!==void 0;){if(a===h.index){let u;h.type===2?u=new P(o,o.nextSibling,this,e):h.type===1?u=new h.ctor(o,h.name,h.strings,this,e):h.type===6&&(u=new ne(o,this,e)),this._$AV.push(u),h=n[++s]}a!==h?.index&&(o=A.nextNode(),a++)}return A.currentNode=D,r}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},P=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=E(this,e,t),W(e)?e===d||e==null||e===""?(this._$AH!==d&&this._$AR(),this._$AH=d):e!==this._$AH&&e!==z&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Xe(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==d&&W(this._$AH)?this._$AA.nextSibling.data=e:this.T(D.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,r=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=B.createElement(He(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{let o=new Y(r,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=Ee.get(e.strings);return t===void 0&&Ee.set(e.strings,t=new B(e)),t}k(e){ie(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,r=0;for(let o of e)r===t.length?t.push(n=new i(this.O(x()),this.O(x()),this,this.options)):n=t[r],n._$AI(o),r++;r<t.length&&(this._$AR(n&&n._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=ve(e).nextSibling;ve(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},T=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,o){this.type=1,this._$AH=d,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=o,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):thLine truncated
|
||||||
<input type="checkbox" .checked=${e} @change=${o=>r(nt(o))} />
|
<input type="checkbox" .checked=${e} @change=${o=>r(rt(o))} />
|
||||||
<span>${i.t(t)}${n?l`<small>${i.t(n)}</small>`:d}</span>
|
<span>${i.t(t)}${n?l`<small>${i.t(n)}</small>`:d}</span>
|
||||||
</label>`}var c=(i,e,t,n)=>f(i,i.value[e],t,n,r=>i.set(e,r)),se=(i,e,t,n)=>f(i,i.value[e],t,n,r=>i.set(e,r||void 0));function w(i,e,t,n,r){return l`<label class="field"
|
</label>`}var c=(i,e,t,n)=>f(i,i.value[e],t,n,r=>i.set(e,r)),le=(i,e,t,n)=>f(i,i.value[e],t,n,r=>i.set(e,r||void 0));function w(i,e,t,n,r){return l`<label class="field"
|
||||||
>${i.t(t)}
|
>${i.t(t)}
|
||||||
<select @change=${o=>i.set(e,O(o))}>
|
<select @change=${o=>i.set(e,O(o))}>
|
||||||
${n.map(([o,a])=>l`<option value=${o} ?selected=${o===r}>${i.t(a)}</option>`)}
|
${n.map(([o,a])=>l`<option value=${o} ?selected=${o===r}>${i.t(a)}</option>`)}
|
||||||
</select>
|
</select>
|
||||||
</label>`}function le(i,e,t,n){return l`<label class="field"
|
</label>`}function he(i,e,t,n){return l`<label class="field"
|
||||||
>${i.t(t)}
|
>${i.t(t)}
|
||||||
<select @change=${r=>i.set(e,Number(O(r))||void 0)}>
|
<select @change=${r=>i.set(e,Number(O(r))||void 0)}>
|
||||||
${n.map(r=>l`<option value=${r.value} ?selected=${i.value[e]===r.value}>${r.text}</option>`)}
|
${n.map(r=>l`<option value=${r.value} ?selected=${i.value[e]===r.value}>${r.text}</option>`)}
|
||||||
</select>
|
</select>
|
||||||
</label>`}function I(i,e,t,n=""){return l`<label class="field wide"
|
</label>`}function I(i,e,t,n=""){return l`<label class="field wide"
|
||||||
>${i.t(t)}
|
>${i.t(t)}
|
||||||
<input type="text" placeholder=${n} .value=${i.value[e]??""} @change=${r=>i.set(e,tt(r).trim()||void 0)} />
|
<input type="text" placeholder=${n} .value=${i.value[e]??""} @change=${r=>i.set(e,nt(r).trim()||void 0)} />
|
||||||
</label>`}function he(i,e,t,n){let r=n===void 0?"switch":n?"on":"off",o=[["switch","card_flows_switch"],["on","card_flows_on"],["off","card_flows_off"]];return l`<label class="field wide"
|
</label>`}function de(i,e,t,n){let r=n===void 0?"switch":n?"on":"off",o=[["switch","card_flows_switch"],["on","card_flows_on"],["off","card_flows_off"]];return l`<label class="field wide"
|
||||||
>${i.t(t)}
|
>${i.t(t)}
|
||||||
<select @change=${a=>i.set(e,O(a)==="switch"?void 0:O(a)==="on")}>
|
<select @change=${a=>i.set(e,O(a)==="switch"?void 0:O(a)==="on")}>
|
||||||
${o.map(([a,s])=>l`<option value=${a} ?selected=${r===a}>${i.t(s)}</option>`)}
|
${o.map(([a,s])=>l`<option value=${a} ?selected=${r===a}>${i.t(s)}</option>`)}
|
||||||
</select>
|
</select>
|
||||||
</label>`}var Pe=U`
|
</label>`}var $e=j`
|
||||||
:host {
|
:host {
|
||||||
display: block;
|
display: block;
|
||||||
color: var(--primary-text-color);
|
color: var(--primary-text-color);
|
||||||
@@ -115,7 +115,7 @@ var p={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",f
|
|||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;var ce=globalThis,de=ce.__nextfloorBuiltin?.de??{},_e=ce.__nextfloorBuiltin?.en??{};ce.__nextfloorBuiltin??={de,en:_e};var $e=()=>typeof p=="object"&&p||{},rt=globalThis,Z=rt.__nextfloorTexts??=new Map;function Le(i){let e=i.toLowerCase().split("-")[0];return e!=="de"&&e!=="en"&&e in $e()?e:void 0}function it(i){let e=Le(i),t=e===void 0?void 0:Z.get(e);return t instanceof Promise?void 0:t}function Me(i,e){let t=Le(i?.language??navigator.language);if(t===void 0)return!1;let n=Z.get(t);return n===void 0&&(n=fetch(new URL(`./lang/${t}.json?v=${$e()[t]}`,import.meta.url)).then(r=>r.ok?r.json():{}).catch(()=>({})).then(r=>{Z.set(t,r&&typeof r=="object"?r:{})}),Z.set(t,n)),n instanceof Promise?(n.then(()=>e.requestUpdate()),!0):!1}function Ne(i,e,t={}){let n=i?.language??navigator.language,r=n.startsWith("de"),o=(r?void 0:it(n)?.[e])??(r?de:_e)[e]??_e[e]??de[e]??e;for(let[a,s]of Object.entries(t))o=o.replace(`{${a}}`,String(s));return o}var ue=class extends y{static properties={hass:{attribute:!1},_config:{state:!0},_floors:{state:!0},_rooms:{state:!0},_templates:{state:!0}};loading=!1;form;constructor(){super(),this._config={type:"custom:nextfloor-card"},this._floors=[],this._rooms=[],this._templates=[];let e=this;this.form={get value(){return{...ae,...e._config}},t:(t,n)=>Ne(e.hass,t,n),set:(t,n)=>e.write(t,n)}}setConfig(e){this._config=e}willUpdate(){this.hass&&!this.loading&&this._floors.length===0&&(this.loading=!0,He(this.hass).then(e=>{this._floors=e.building.floors.map(t=>({id:t.id,name:t.name})),this._templates=Object.keys(e.building.settings.card_templates??{}),this._rooms=e.building.floors.flatMap(t=>t.rooms.map(n=>({id:n.id,name:n.name,floor:t.name})))},()=>{}))}write(e,t){let n={...this._config};t===void 0||t===""||ae[e]===t?delete n[e]:n[e]=t,this.publish(n)}publish(e){this._config=e,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:e},bubbles:!0,composed:!0}))}roomsChoice(){if(this._rooms.length===0)return l``;let e=new Set(this._config.rooms??[]),t=(n,r)=>{let o=this._rooms.map(a=>a.id).filter(a=>a===n?r:e.has(a));this.form.set("rooms",o.length?o:void 0)};return l`<fieldset class="rooms">
|
`;var ue=globalThis,_e=ue.__nextfloorBuiltin?.de??{},ce=ue.__nextfloorBuiltin?.en??{};ue.__nextfloorBuiltin??={de:_e,en:ce};var Le=()=>typeof m=="object"&&m||{},it=globalThis,Z=it.__nextfloorTexts??=new Map;function Me(i){let e=i.toLowerCase().split("-")[0];return e!=="de"&&e!=="en"&&e in Le()?e:void 0}function ot(i){let e=Me(i),t=e===void 0?void 0:Z.get(e);return t instanceof Promise?void 0:t}function Ne(i,e){let t=Me(i?.language??navigator.language);if(t===void 0)return!1;let n=Z.get(t);return n===void 0&&(n=fetch(new URL(`./lang/${t}.json?v=${Le()[t]}`,import.meta.url)).then(r=>r.ok?r.json():{}).catch(()=>({})).then(r=>{Z.set(t,r&&typeof r=="object"?r:{})}),Z.set(t,n)),n instanceof Promise?(n.then(()=>e.requestUpdate()),!0):!1}function Ce(i,e,t={}){let n=i?.language??navigator.language,r=n.startsWith("de"),o=(r?void 0:ot(n)?.[e])??(r?_e:ce)[e]??ce[e]??_e[e]??e;for(let[a,s]of Object.entries(t))o=o.replace(`{${a}}`,String(s));return o}var V=i=>i?.symconObjects!==void 0;var me=class extends y{static properties={hass:{attribute:!1},_config:{state:!0},_floors:{state:!0},_rooms:{state:!0},_templates:{state:!0}};loading=!1;form;constructor(){super(),this._config={type:"custom:nextfloor-card"},this._floors=[],this._rooms=[],this._templates=[];let e=this;this.form={get value(){return{...se,...e._config}},t:(t,n)=>Ce(e.hass,t,n),set:(t,n)=>e.write(t,n)}}setConfig(e){this._config=e}willUpdate(){this.hass&&!this.loading&&this._floors.length===0&&(this.loading=!0,We(this.hass).then(e=>{this._floors=e.building.floors.map(t=>({id:t.id,name:t.name})),this._templates=Object.keys(e.building.settings.card_templates??{}),this._rooms=e.building.floors.flatMap(t=>t.rooms.map(n=>({id:n.id,name:n.name,floor:t.name})))},()=>{}))}write(e,t){let n={...this._config};t===void 0||t===""||se[e]===t?delete n[e]:n[e]=t,this.publish(n)}publish(e){this._config=e,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:e},bubbles:!0,composed:!0}))}roomsChoice(){if(this._rooms.length===0)return l``;let e=new Set(this._config.rooms??[]),t=(n,r)=>{let o=this._rooms.map(a=>a.id).filter(a=>a===n?r:e.has(a));this.form.set("rooms",o.length?o:void 0)};return l`<fieldset class="rooms">
|
||||||
<legend>${this.form.t("card_rooms")}</legend>
|
<legend>${this.form.t("card_rooms")}</legend>
|
||||||
<small>${this.form.t("card_rooms_hint")}</small>
|
<small>${this.form.t("card_rooms_hint")}</small>
|
||||||
${this._rooms.map(n=>l`<label class="toggle"><input type="checkbox" .checked=${e.has(n.id)} @change=${r=>t(n.id,r.target.checked)} /><span>${this._floors.length>1?`${n.floor} \xB7 `:""}${n.name}</span></label>`)}
|
${this._rooms.map(n=>l`<label class="toggle"><input type="checkbox" .checked=${e.has(n.id)} @change=${r=>t(n.id,r.target.checked)} /><span>${this._floors.length>1?`${n.floor} \xB7 `:""}${n.name}</span></label>`)}
|
||||||
@@ -124,8 +124,8 @@ var p={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",f
|
|||||||
${f(e,e.value.lock_button!==!1,"card_lock_button",void 0,s=>e.set("lock_button",s?void 0:!1))}
|
${f(e,e.value.lock_button!==!1,"card_lock_button",void 0,s=>e.set("lock_button",s?void 0:!1))}
|
||||||
${f(e,e.value.walk_button!==!1,"card_walk_button",void 0,s=>e.set("walk_button",s?void 0:!1))}
|
${f(e,e.value.walk_button!==!1,"card_walk_button",void 0,s=>e.set("walk_button",s?void 0:!1))}
|
||||||
${f(e,e.value.time_travel!==!1,"card_travel_button",void 0,s=>e.set("time_travel",s?void 0:!1))}
|
${f(e,e.value.time_travel!==!1,"card_travel_button",void 0,s=>e.set("time_travel",s?void 0:!1))}
|
||||||
${se(e,"marker_names","card_marker_names","card_marker_names_hint")} ${se(e,"controls_hidden","card_controls_hidden","card_controls_hidden_hint")}
|
${le(e,"marker_names","card_marker_names","card_marker_names_hint")} ${le(e,"controls_hidden","card_controls_hidden","card_controls_hidden_hint")}
|
||||||
${le(e,"controls_hide_after","card_controls_hide_after",a)}
|
${he(e,"controls_hide_after","card_controls_hide_after",a)}
|
||||||
${n?l`<div class="sub">
|
${n?l`<div class="sub">
|
||||||
${$.map(s=>l`<label class="chip">
|
${$.map(s=>l`<label class="chip">
|
||||||
<input
|
<input
|
||||||
@@ -137,7 +137,7 @@ var p={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",f
|
|||||||
</label>`)}
|
</label>`)}
|
||||||
</div>`:d}`}kioskSection(){let e=this.form,{night:t}=e.value,n=t==="off"||t==="sun"?t:"time",r=[0,1,2,5,10].map(a=>({value:a*60,text:a?e.t("card_idle_min",{n:a}):e.t("card_idle_off")})),o=[["off","card_night_off"],["sun","card_night_sun"],["time","card_night_time"]];return l`<h3>${e.t("card_section_kiosk")}</h3>
|
</div>`:d}`}kioskSection(){let e=this.form,{night:t}=e.value,n=t==="off"||t==="sun"?t:"time",r=[0,1,2,5,10].map(a=>({value:a*60,text:a?e.t("card_idle_min",{n:a}):e.t("card_idle_off")})),o=[["off","card_night_off"],["sun","card_night_sun"],["time","card_night_time"]];return l`<h3>${e.t("card_section_kiosk")}</h3>
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
${le(e,"idle_return","card_idle_return",r)}
|
${he(e,"idle_return","card_idle_return",r)}
|
||||||
<label class="field"
|
<label class="field"
|
||||||
>${e.t("card_night")}
|
>${e.t("card_night")}
|
||||||
<select @change=${a=>e.set("night",{off:void 0,sun:"sun",time:"22:00-06:00"}[a.target.value])}>
|
<select @change=${a=>e.set("night",{off:void 0,sun:"sun",time:"22:00-06:00"}[a.target.value])}>
|
||||||
@@ -169,17 +169,17 @@ var p={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",f
|
|||||||
${[.8,1,1.25,1.5,1.75,2,2.5].map(n=>l`<option value=${n} ?selected=${(e.value.zoom??1)===n}>${Math.round(n*100)} %</option>`)}
|
${[.8,1,1.25,1.5,1.75,2,2.5].map(n=>l`<option value=${n} ?selected=${(e.value.zoom??1)===n}>${Math.round(n*100)} %</option>`)}
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
${c(e,"announcements","card_announcements","card_announcements_hint")}
|
${V(this.hass)?d:c(e,"announcements","card_announcements","card_announcements_hint")}
|
||||||
${e.value.announcements!==!1?l`<div class="grid">${I(e,"screen_name","screen_name")}</div>`:d}
|
${!V(this.hass)&&e.value.announcements!==!1?l`<div class="grid">${I(e,"screen_name","screen_name")}</div>`:d}
|
||||||
${c(e,"weather","card_weather","card_weather_hint")}
|
${c(e,"weather","card_weather","card_weather_hint")}
|
||||||
${e.value.weather!==!1?l`<div class="grid">
|
${e.value.weather!==!1?l`<div class="grid">
|
||||||
<label class="field wide"
|
${V(this.hass)?d:l`<label class="field wide"
|
||||||
>${e.t("weather_entity")}
|
>${e.t("weather_entity")}
|
||||||
<select @change=${n=>e.set("weather_entity",n.target.value||void 0)}>
|
<select @change=${n=>e.set("weather_entity",n.target.value||void 0)}>
|
||||||
<option value="" ?selected=${!e.value.weather_entity}>${e.t("card_weather_plan")}</option>
|
<option value="" ?selected=${!e.value.weather_entity}>${e.t("card_weather_plan")}</option>
|
||||||
${t.map(n=>l`<option value=${n} ?selected=${n===e.value.weather_entity}>${String(this.hass?.states[n]?.attributes.friendly_name??n)}</option>`)}
|
${t.map(n=>l`<option value=${n} ?selected=${n===e.value.weather_entity}>${String(this.hass?.states[n]?.attributes.friendly_name??n)}</option>`)}
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>`}
|
||||||
<label class="field"
|
<label class="field"
|
||||||
>${e.t("card_weather_density")}
|
>${e.t("card_weather_density")}
|
||||||
<select @change=${n=>e.set("weather_density",Number(n.target.value))}>
|
<select @change=${n=>e.set("weather_density",Number(n.target.value))}>
|
||||||
@@ -190,9 +190,9 @@ var p={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",f
|
|||||||
</div>`:d}
|
</div>`:d}
|
||||||
<p class="hint">${e.t("card_pro_hint")}</p>`}furnitureColors(e){let t=this._config.furniture_colors??{},n=(r,o)=>{let a={...t,[r]:o};o||delete a[r],e.set("furniture_colors",Object.keys(a).length?a:void 0)};return l`<details class="field">
|
<p class="hint">${e.t("card_pro_hint")}</p>`}furnitureColors(e){let t=this._config.furniture_colors??{},n=(r,o)=>{let a={...t,[r]:o};o||delete a[r],e.set("furniture_colors",Object.keys(a).length?a:void 0)};return l`<details class="field">
|
||||||
<summary>${e.t("furn_colors_card")}${Object.keys(t).length?` (${Object.keys(t).length})`:""}</summary>
|
<summary>${e.t("furn_colors_card")}${Object.keys(t).length?` (${Object.keys(t).length})`:""}</summary>
|
||||||
${We.map(r=>l`<label class="field"
|
${Be.map(r=>l`<label class="field"
|
||||||
>${e.t(`furn_color_${r}`)}
|
>${e.t(`furn_color_${r}`)}
|
||||||
<input type="color" .value=${t[r]??Be[r]} @input=${o=>n(r,o.target.value)} />
|
<input type="color" .value=${t[r]??Pe[r]} @input=${o=>n(r,o.target.value)} />
|
||||||
${t[r]?l`<button type="button" class="link" @click=${()=>n(r,null)}>${e.t("furn_color_house")}</button>`:d}
|
${t[r]?l`<button type="button" class="link" @click=${()=>n(r,null)}>${e.t("furn_color_house")}</button>`:d}
|
||||||
</label>`)}
|
</label>`)}
|
||||||
</details>`}viewSection(){let e=this.form,t=e.value;return l`<h3>${e.t("card_section_view")}</h3>
|
</details>`}viewSection(){let e=this.form,t=e.value;return l`<h3>${e.t("card_section_view")}</h3>
|
||||||
@@ -263,11 +263,11 @@ var p={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",f
|
|||||||
<div class="grid">
|
<div class="grid">
|
||||||
${w(e,"markers","markers",[["none","markers_none"],["important","markers_important"],["all","markers_all"]],t.markers)}
|
${w(e,"markers","markers",[["none","markers_none"],["important","markers_important"],["all","markers_all"]],t.markers)}
|
||||||
${w(e,"heatmap","heatmap",[["none","heat_off"],["temperature","heat_temperature"],["humidity","heat_humidity"],["co2","heat_co2"],["mould","heat_mould"],["values","heat_values"],["wifi","heat_wifi"]],t.heatmap)}
|
${w(e,"heatmap","heatmap",[["none","heat_off"],["temperature","heat_temperature"],["humidity","heat_humidity"],["co2","heat_co2"],["mould","heat_mould"],["values","heat_values"],["wifi","heat_wifi"]],t.heatmap)}
|
||||||
${he(e,"flows","flows",t.flows)} ${he(e,"holograms","holos",t.holograms)}
|
${de(e,"flows","flows",t.flows)} ${de(e,"holograms","holos",t.holograms)}
|
||||||
</div>
|
</div>
|
||||||
${c(e,"tap_in_room","card_tap_in_room","card_tap_in_room_hint")} ${w(e,"room_double_tap","room_double_tap",[["auto","card_room_double_tap_auto"],["area","room_double_tap_area"],["plan","room_double_tap_plan"],["off","room_double_tap_off"]],t.room_double_tap)} ${this.markersOutside()} ${this.controlsSection()} ${this.floorThumbsToggle()} ${c(e,"room_names","card_room_names")} ${c(e,"energy","card_energy")}
|
${c(e,"tap_in_room","card_tap_in_room","card_tap_in_room_hint")} ${w(e,"room_double_tap","room_double_tap",[["auto","card_room_double_tap_auto"],["area","room_double_tap_area"],["plan","room_double_tap_plan"],["off","room_double_tap_off"]],t.room_double_tap)} ${this.markersOutside()} ${this.controlsSection()} ${this.floorThumbsToggle()} ${c(e,"room_names","card_room_names")} ${c(e,"energy","card_energy")}
|
||||||
${c(e,"room_buttons","card_room_buttons","card_room_buttons_hint")} ${c(e,"room_panel","card_room_panel","card_room_panel_hint")} ${c(e,"fullscreen_button","card_fullscreen_button","card_fullscreen_button_hint")}
|
${c(e,"room_buttons","card_room_buttons","card_room_buttons_hint")} ${c(e,"room_panel","card_room_panel","card_room_panel_hint")} ${c(e,"fullscreen_button","card_fullscreen_button","card_fullscreen_button_hint")}
|
||||||
${c(e,"explode","card_explode")} ${c(e,"roof_fade","card_roof_fade","card_roof_fade_hint")} ${c(e,"stats","card_stats","card_stats_hint")}`}render(){return this.hass&&Me(this.hass,this)?d:l`${this.viewSection()} ${this.showSection()} ${this.featuresSection()} ${this.kioskSection()}`}static styles=Pe};customElements.get("nextfloor-card-editor")||customElements.define("nextfloor-card-editor",ue);export{ue as NextFloorCardEditor};
|
${c(e,"explode","card_explode")} ${c(e,"roof_fade","card_roof_fade","card_roof_fade_hint")} ${c(e,"stats","card_stats","card_stats_hint")}`}render(){return this.hass&&Ne(this.hass,this)?d:l`${this.viewSection()} ${this.showSection()} ${this.featuresSection()} ${this.kioskSection()}`}static styles=$e};customElements.get("nextfloor-card-editor")||customElements.define("nextfloor-card-editor",me);export{me as NextFloorCardEditor};
|
||||||
/*! Bundled license information:
|
/*! Bundled license information:
|
||||||
|
|
||||||
@lit/reactive-element/css-tag.js:
|
@lit/reactive-element/css-tag.js:
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -73,6 +73,23 @@ ROOM_SCHEMA = vol.Schema(
|
|||||||
),
|
),
|
||||||
# underfloor heating: the entity whose heating makes the floor glow
|
# underfloor heating: the entity whose heating makes the floor glow
|
||||||
vol.Optional("floor_heating"): vol.Any(None, vol.All(str, vol.Length(max=255))),
|
vol.Optional("floor_heating"): vol.Any(None, vol.All(str, vol.Length(max=255))),
|
||||||
|
vol.Optional("hvac"): vol.Any(
|
||||||
|
None,
|
||||||
|
{
|
||||||
|
**{
|
||||||
|
vol.Optional(key): _ENTITY_REF
|
||||||
|
for key in (
|
||||||
|
"supply_vsr",
|
||||||
|
"extract_vsr",
|
||||||
|
"supply_temperature",
|
||||||
|
"extract_temperature",
|
||||||
|
"reheat",
|
||||||
|
"status",
|
||||||
|
)
|
||||||
|
},
|
||||||
|
vol.Optional("schedules"): vol.All([vol.All(str, vol.Length(max=255))], vol.Length(max=100)),
|
||||||
|
},
|
||||||
|
),
|
||||||
vol.Required("points"): vol.All([_POINT], vol.Length(min=3, max=MAX_POINTS)),
|
vol.Required("points"): vol.All([_POINT], vol.Length(min=3, max=MAX_POINTS)),
|
||||||
vol.Required("floor_material"): vol.All(str, vol.Length(max=32)),
|
vol.Required("floor_material"): vol.All(str, vol.Length(max=32)),
|
||||||
# the camera this room opens with when it is tapped (None = framed from above)
|
# the camera this room opens with when it is tapped (None = framed from above)
|
||||||
@@ -959,6 +976,7 @@ SETTINGS_SCHEMA = vol.Schema(
|
|||||||
vol.Optional("roof", default=lambda: {"type": "none", "pitch": 35, "overhang": 0.4}): ROOF_SCHEMA,
|
vol.Optional("roof", default=lambda: {"type": "none", "pitch": 35, "overhang": 0.4}): ROOF_SCHEMA,
|
||||||
# the weather entity for the weather outside (None = the first one)
|
# the weather entity for the weather outside (None = the first one)
|
||||||
vol.Optional("weather_entity", default=None): vol.Any(None, vol.All(str, vol.Length(max=255))),
|
vol.Optional("weather_entity", default=None): vol.Any(None, vol.All(str, vol.Length(max=255))),
|
||||||
|
vol.Optional("weather_variables"): vol.Any(None, {str: _ENTITY_REF}),
|
||||||
# which weather effects the 3D view shows (None = all but fog)
|
# which weather effects the 3D view shows (None = all but fog)
|
||||||
# warning for a window open while it rains
|
# warning for a window open while it rains
|
||||||
vol.Optional("rain_warning", default=True): bool,
|
vol.Optional("rain_warning", default=True): bool,
|
||||||
@@ -1074,6 +1092,7 @@ ENERGY_SCHEMA = vol.Schema(
|
|||||||
# Which sensor tells the room of a person (ESPresense, Bermuda: the state is a room or area name)
|
# Which sensor tells the room of a person (ESPresense, Bermuda: the state is a room or area name)
|
||||||
PRESENCE_SCHEMA = vol.Schema(
|
PRESENCE_SCHEMA = vol.Schema(
|
||||||
{
|
{
|
||||||
|
vol.Optional("name"): vol.Any(None, _NAME),
|
||||||
vol.Required("person"): vol.All(str, vol.Length(max=255)),
|
vol.Required("person"): vol.All(str, vol.Length(max=255)),
|
||||||
vol.Required("sensor"): vol.Any(None, _ENTITY),
|
vol.Required("sensor"): vol.Any(None, _ENTITY),
|
||||||
vol.Optional("room"): vol.Any(None, vol.All(str, vol.Length(max=64))),
|
vol.Optional("room"): vol.Any(None, vol.All(str, vol.Length(max=64))),
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { translate } from "./i18n.ts";
|
|||||||
import { pointInPolygon, type Building, type Opening, type OwnAlert } from "./model.ts";
|
import { pointInPolygon, type Building, type Opening, type OwnAlert } from "./model.ts";
|
||||||
import type { HomeAssistant } from "./types.ts";
|
import type { HomeAssistant } from "./types.ts";
|
||||||
import { weatherEntity } from "./weather.ts";
|
import { weatherEntity } from "./weather.ts";
|
||||||
|
import { nativeBool } from "./entities/symcon-values.ts";
|
||||||
|
|
||||||
export type AlertKind = "smoke" | "gas" | "co" | "water" | "alarm" | "alarm_pending" | "window_rain" | "power_outage" | "contact_lost" | "unlocked_night" | "own";
|
export type AlertKind = "smoke" | "gas" | "co" | "water" | "alarm" | "alarm_pending" | "window_rain" | "power_outage" | "contact_lost" | "unlocked_night" | "own";
|
||||||
|
|
||||||
@@ -157,6 +158,10 @@ export function isRaining(hass: HomeAssistant, sources: Pick<AlertSources, "weat
|
|||||||
if (sources.rain) {
|
if (sources.rain) {
|
||||||
const st = hass.states[sources.rain];
|
const st = hass.states[sources.rain];
|
||||||
if (!st || st.state === "unavailable" || st.state === "unknown") return false;
|
if (!st || st.state === "unavailable" || st.state === "unknown") return false;
|
||||||
|
if (st.attributes.symcon_id) {
|
||||||
|
const wet = nativeBool(st);
|
||||||
|
return wet === null ? false : sources.rainInverted ? !wet : wet;
|
||||||
|
}
|
||||||
const rate = Number(st.state);
|
const rate = Number(st.state);
|
||||||
const wet = Number.isFinite(rate) ? rate > 0 : st.state === "on" || /rain|regen|wet|nass/i.test(st.state);
|
const wet = Number.isFinite(rate) ? rate > 0 : st.state === "on" || /rain|regen|wet|nass/i.test(st.state);
|
||||||
return sources.rainInverted ? !wet : wet;
|
return sources.rainInverted ? !wet : wet;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { checkbox, choice, DEFAULTS, flagOption, followOrForce, numberChoice, sw
|
|||||||
import { editorStyles } from "./card-editor/styles.ts";
|
import { editorStyles } from "./card-editor/styles.ts";
|
||||||
import { awaitingLanguage, translate, type I18nKey } from "./i18n.ts";
|
import { awaitingLanguage, translate, type I18nKey } from "./i18n.ts";
|
||||||
import type { HomeAssistant } from "./types.ts";
|
import type { HomeAssistant } from "./types.ts";
|
||||||
|
import { isSymcon } from "./entities/symcon-values.ts";
|
||||||
|
|
||||||
export class NextFloorCardEditor extends LitElement {
|
export class NextFloorCardEditor extends LitElement {
|
||||||
static properties = {
|
static properties = {
|
||||||
@@ -188,18 +189,18 @@ export class NextFloorCardEditor extends LitElement {
|
|||||||
${[0.8, 1, 1.25, 1.5, 1.75, 2, 2.5].map((z) => html`<option value=${z} ?selected=${(f.value.zoom ?? 1) === z}>${Math.round(z * 100)} %</option>`)}
|
${[0.8, 1, 1.25, 1.5, 1.75, 2, 2.5].map((z) => html`<option value=${z} ?selected=${(f.value.zoom ?? 1) === z}>${Math.round(z * 100)} %</option>`)}
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
${switchOption(f, "announcements", "card_announcements", "card_announcements_hint")}
|
${isSymcon(this.hass) ? nothing : switchOption(f, "announcements", "card_announcements", "card_announcements_hint")}
|
||||||
${f.value.announcements !== false ? html`<div class="grid">${textField(f, "screen_name", "screen_name")}</div>` : nothing}
|
${!isSymcon(this.hass) && f.value.announcements !== false ? html`<div class="grid">${textField(f, "screen_name", "screen_name")}</div>` : nothing}
|
||||||
${switchOption(f, "weather", "card_weather", "card_weather_hint")}
|
${switchOption(f, "weather", "card_weather", "card_weather_hint")}
|
||||||
${f.value.weather !== false
|
${f.value.weather !== false
|
||||||
? html`<div class="grid">
|
? html`<div class="grid">
|
||||||
<label class="field wide"
|
${isSymcon(this.hass) ? nothing : html`<label class="field wide"
|
||||||
>${f.t("weather_entity")}
|
>${f.t("weather_entity")}
|
||||||
<select @change=${(e: Event) => f.set("weather_entity", (e.target as HTMLSelectElement).value || undefined)}>
|
<select @change=${(e: Event) => f.set("weather_entity", (e.target as HTMLSelectElement).value || undefined)}>
|
||||||
<option value="" ?selected=${!f.value.weather_entity}>${f.t("card_weather_plan")}</option>
|
<option value="" ?selected=${!f.value.weather_entity}>${f.t("card_weather_plan")}</option>
|
||||||
${weatherEntities.map((id) => html`<option value=${id} ?selected=${id === f.value.weather_entity}>${String(this.hass?.states[id]?.attributes.friendly_name ?? id)}</option>`)}
|
${weatherEntities.map((id) => html`<option value=${id} ?selected=${id === f.value.weather_entity}>${String(this.hass?.states[id]?.attributes.friendly_name ?? id)}</option>`)}
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>`}
|
||||||
<label class="field"
|
<label class="field"
|
||||||
>${f.t("card_weather_density")}
|
>${f.t("card_weather_density")}
|
||||||
<select @change=${(e: Event) => f.set("weather_density", Number((e.target as HTMLSelectElement).value))}>
|
<select @change=${(e: Event) => f.set("weather_density", Number((e.target as HTMLSelectElement).value))}>
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ import { roomsOnly } from "./rooms-only.ts";
|
|||||||
import { colorSchemeOf, controls, readableStyles, tokens } from "./styles.ts";
|
import { colorSchemeOf, controls, readableStyles, tokens } from "./styles.ts";
|
||||||
import type { HomeAssistant } from "./types.ts";
|
import type { HomeAssistant } from "./types.ts";
|
||||||
import { withCoverControls } from "./entities/cover-controls.ts";
|
import { withCoverControls } from "./entities/cover-controls.ts";
|
||||||
|
import { withSymconWeather } from "./symcon-weather.ts";
|
||||||
|
import { isSymcon } from "./entities/symcon-values.ts";
|
||||||
import type { WallMode } from "./viewer/viewer3d.ts";
|
import type { WallMode } from "./viewer/viewer3d.ts";
|
||||||
import { lookNow } from "./themes.ts";
|
import { lookNow } from "./themes.ts";
|
||||||
|
|
||||||
@@ -318,7 +320,7 @@ export class NextFloorCard extends LitElement {
|
|||||||
};
|
};
|
||||||
const eye = c?.controls_hidden !== undefined || (c?.controls_hide_after ?? 0) > 0;
|
const eye = c?.controls_hidden !== undefined || (c?.controls_hide_after ?? 0) > 0;
|
||||||
return html`<nf-view3d
|
return html`<nf-view3d
|
||||||
.hass=${withCoverControls(this.hass, b.floors)}
|
.hass=${withSymconWeather(withCoverControls(this.hass, b.floors), b.settings)}
|
||||||
.building=${b}
|
.building=${b}
|
||||||
.packs=${this.data.packs}
|
.packs=${this.data.packs}
|
||||||
.floorId=${s.floorId}
|
.floorId=${s.floorId}
|
||||||
@@ -364,7 +366,7 @@ export class NextFloorCard extends LitElement {
|
|||||||
.panelOpen=${!!this._roomId && c?.room_panel !== false}
|
.panelOpen=${!!this._roomId && c?.room_panel !== false}
|
||||||
.alerts=${c?.alerts !== false}
|
.alerts=${c?.alerts !== false}
|
||||||
.alertJump=${!!c?.alert_jump}
|
.alertJump=${!!c?.alert_jump}
|
||||||
.announcements=${c?.announcements !== false && !screenMuted()}
|
.announcements=${!isSymcon(this.hass) && c?.announcements !== false && !screenMuted()}
|
||||||
.sensorBar=${c?.sensor_bar !== false}
|
.sensorBar=${c?.sensor_bar !== false}
|
||||||
.glassWalls=${typeof c?.glass_walls === "number" ? Math.min(100, Math.max(0, c.glass_walls)) : null}
|
.glassWalls=${typeof c?.glass_walls === "number" ? Math.min(100, Math.max(0, c.glass_walls)) : null}
|
||||||
.screenName=${c?.screen_name ?? screenName()}
|
.screenName=${c?.screen_name ?? screenName()}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import { html, LitElement, nothing, svg, type PropertyValues, type TemplateResult } from "lit";
|
import { html, LitElement, nothing, svg, type PropertyValues, type TemplateResult } from "lit";
|
||||||
import { withCoverControls } from "../entities/cover-controls.ts";
|
import { withCoverControls } from "../entities/cover-controls.ts";
|
||||||
|
import { withSymconWeather } from "../symcon-weather.ts";
|
||||||
import { hint } from "./editor/fields.ts";
|
import { hint } from "./editor/fields.ts";
|
||||||
import { fetchImage, importPack, storeImage } from "../api.ts";
|
import { fetchImage, importPack, storeImage } from "../api.ts";
|
||||||
import { defaultHeight, entityName, kindOf, roomEntities } from "../devices.ts";
|
import { defaultHeight, entityName, kindOf, roomEntities } from "../devices.ts";
|
||||||
@@ -1049,7 +1050,7 @@ export class NfEditor extends LitElement {
|
|||||||
</div>`}
|
</div>`}
|
||||||
${this.render3dBar()}
|
${this.render3dBar()}
|
||||||
<nf-view3d
|
<nf-view3d
|
||||||
.hass=${this.hass ? withCoverControls(this.hass, this._doc3d.floors) : undefined}
|
.hass=${this.hass ? withSymconWeather(withCoverControls(this.hass, this._doc3d.floors), this._doc3d.settings) : undefined}
|
||||||
.building=${this._doc3d}
|
.building=${this._doc3d}
|
||||||
.floorId=${this.houseTool ? null : this._floorId}
|
.floorId=${this.houseTool ? null : this._floorId}
|
||||||
.roomId=${null}
|
.roomId=${null}
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import { pointInPolygon, type Room } from "../../../model.ts";
|
|||||||
import { entityOptions } from "../entities.ts";
|
import { entityOptions } from "../entities.ts";
|
||||||
import { checkField, deviceIcon, entityField, hint } from "../fields.ts";
|
import { checkField, deviceIcon, entityField, hint } from "../fields.ts";
|
||||||
import type { EditorHost } from "../host.ts";
|
import type { EditorHost } from "../host.ts";
|
||||||
|
import { isSymcon } from "../../../entities/symcon-values.ts";
|
||||||
|
import { renderSymconRoomHvac } from "../symcon-fields.ts";
|
||||||
import { matchesQuery, placedElsewhere, placedInRoom, rankedBy, takeFirst, withToggled } from "../ops/device-list.ts";
|
import { matchesQuery, placedElsewhere, placedInRoom, rankedBy, takeFirst, withToggled } from "../ops/device-list.ts";
|
||||||
import type { SideState } from "../side-state.ts";
|
import type { SideState } from "../side-state.ts";
|
||||||
|
|
||||||
@@ -126,7 +128,7 @@ export function renderDeviceList(host: EditorHost, state: SideState, room: Room,
|
|||||||
export function renderRoomClimate(host: EditorHost, room: Room, patch: (patch: Partial<Room>) => void): TemplateResult | typeof nothing {
|
export function renderRoomClimate(host: EditorHost, room: Room, patch: (patch: Partial<Room>) => void): TemplateResult | typeof nothing {
|
||||||
const { hass } = host;
|
const { hass } = host;
|
||||||
if (!hass) return nothing;
|
if (!hass) return nothing;
|
||||||
const chosen = !!room.climate && Object.values(room.climate).some((x) => x != null);
|
const chosen = !!room.floor_heating || !!room.hvac || (!!room.climate && Object.values(room.climate).some((x) => x != null));
|
||||||
const change = (key: ClimateKey, value: string | string[] | null) => {
|
const change = (key: ClimateKey, value: string | string[] | null) => {
|
||||||
const next = { ...(room.climate ?? {}), [key]: value };
|
const next = { ...(room.climate ?? {}), [key]: value };
|
||||||
patch({ climate: Object.values(next).every((x) => x == null) ? null : next });
|
patch({ climate: Object.values(next).every((x) => x == null) ? null : next });
|
||||||
@@ -148,7 +150,7 @@ export function renderRoomClimate(host: EditorHost, room: Room, patch: (patch: P
|
|||||||
};
|
};
|
||||||
return html`<details class="nf-points" ?open=${chosen || !!room.climate_card}>
|
return html`<details class="nf-points" ?open=${chosen || !!room.climate_card}>
|
||||||
<summary>${host.t("climate")}</summary>
|
<summary>${host.t("climate")}</summary>
|
||||||
<div class="nf-form">${field("temperature", host.t("climate_temperature"))} ${field("humidity", host.t("climate_humidity"))} ${field("co2", host.t("climate_co2"))} ${field("illuminance", host.t("climate_illuminance"))}</div>
|
<div class="nf-form">${field("temperature", host.t("climate_temperature"))} ${field("humidity", host.t("climate_humidity"))} ${field("co2", host.t("climate_co2"))} ${field("illuminance", host.t("climate_illuminance"))}${isSymcon(hass) ? renderSymconRoomHvac(host, room, patch) : nothing}</div>
|
||||||
${checkField(host, host.t("climate_card"), !!room.climate_card, (on) => patch({ climate_card: on || undefined }))}
|
${checkField(host, host.t("climate_card"), !!room.climate_card, (on) => patch({ climate_card: on || undefined }))}
|
||||||
${hint(host.t("climate_card_hint"))}
|
${hint(host.t("climate_card_hint"))}
|
||||||
${hint(host.t("climate_hint"))}
|
${hint(host.t("climate_hint"))}
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import { entityName, outsideEntities } from "../../../devices.ts";
|
|||||||
import type { I18nKey } from "../../../i18n.ts";
|
import type { I18nKey } from "../../../i18n.ts";
|
||||||
import { BUTTON_ACTIONS, uid, type ButtonAction, type Circuit, type CustomButton, type ForecastCard, type MediaPreset, type OwnAlert, type StartView } from "../../../model.ts";
|
import { BUTTON_ACTIONS, uid, type ButtonAction, type Circuit, type CustomButton, type ForecastCard, type MediaPreset, type OwnAlert, type StartView } from "../../../model.ts";
|
||||||
import { entityOptions, isNumeric } from "../entities.ts";
|
import { entityOptions, isNumeric } from "../entities.ts";
|
||||||
|
import { isSymcon } from "../../../entities/symcon-values.ts";
|
||||||
|
import { renderSymconPresence } from "../symcon-fields.ts";
|
||||||
import { actions, checkField, colorField, entityField, hint, iconField, selectField, textField } from "../fields.ts";
|
import { actions, checkField, colorField, entityField, hint, iconField, selectField, textField } from "../fields.ts";
|
||||||
import type { EditorHost } from "../host.ts";
|
import type { EditorHost } from "../host.ts";
|
||||||
import { likelyRoomSensors, parseButtonData, patchPresence, startViewYaml } from "../ops/house.ts";
|
import { likelyRoomSensors, parseButtonData, patchPresence, startViewYaml } from "../ops/house.ts";
|
||||||
@@ -267,6 +269,7 @@ export function renderStartView(host: EditorHost, paneView: () => StartView | nu
|
|||||||
|
|
||||||
/** Which room sensor says where each person is. */
|
/** Which room sensor says where each person is. */
|
||||||
export function renderPresence(host: EditorHost): TemplateResult {
|
export function renderPresence(host: EditorHost): TemplateResult {
|
||||||
|
if (isSymcon(host.hass)) return renderSymconPresence(host);
|
||||||
const linked = host.doc.presence.map((l) => l.person);
|
const linked = host.doc.presence.map((l) => l.person);
|
||||||
const persons = [...new Set([...Object.keys(host.hass?.states ?? {}).filter((id) => id.startsWith("person.")).sort(), ...linked])];
|
const persons = [...new Set([...Object.keys(host.hass?.states ?? {}).filter((id) => id.startsWith("person.")).sort(), ...linked])];
|
||||||
const numeric = entityOptions(host.hass, isNumeric);
|
const numeric = entityOptions(host.hass, isNumeric);
|
||||||
@@ -296,6 +299,7 @@ export function renderPresence(host: EditorHost): TemplateResult {
|
|||||||
|
|
||||||
/** Locating Bluetooth tags by room: pick a tag, walk through the rooms, record them (the element does the work). */
|
/** Locating Bluetooth tags by room: pick a tag, walk through the rooms, record them (the element does the work). */
|
||||||
export function renderBleLocate(host: EditorHost, doc: unknown): TemplateResult {
|
export function renderBleLocate(host: EditorHost, doc: unknown): TemplateResult {
|
||||||
|
if (isSymcon(host.hass)) return html``;
|
||||||
return html`<details class="nf-section">
|
return html`<details class="nf-section">
|
||||||
<summary>${host.t("ble")}</summary>
|
<summary>${host.t("ble")}</summary>
|
||||||
${hint(host.t("ble_hint"))}
|
${hint(host.t("ble_hint"))}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import { formatArea, formatLength } from "../../../units.ts";
|
|||||||
import { generateWalls, innerSize, type Wall } from "../../../geometry/walls.ts";
|
import { generateWalls, innerSize, type Wall } from "../../../geometry/walls.ts";
|
||||||
import { countsAsLiving, roomArea } from "../../../geometry/living-area.ts";
|
import { countsAsLiving, roomArea } from "../../../geometry/living-area.ts";
|
||||||
import { roomSpeaker } from "../../../live/announce.ts";
|
import { roomSpeaker } from "../../../live/announce.ts";
|
||||||
|
import { isSymcon } from "../../../entities/symcon-values.ts";
|
||||||
|
|
||||||
/** What the room form makes the editor do, and the parts of it that the editor still draws itself. */
|
/** What the room form makes the editor do, and the parts of it that the editor still draws itself. */
|
||||||
export interface RoomActions {
|
export interface RoomActions {
|
||||||
@@ -120,7 +121,7 @@ function ceilingField(host: EditorHost, room: Room, floor: Floor, actions: RoomA
|
|||||||
/** Announcements in the room: its speaker (automatic, chosen, or none) and a quiet time. */
|
/** Announcements in the room: its speaker (automatic, chosen, or none) and a quiet time. */
|
||||||
function announceFields(host: EditorHost, room: Room, floor: Floor | null, actions: RoomActions): TemplateResult {
|
function announceFields(host: EditorHost, room: Room, floor: Floor | null, actions: RoomActions): TemplateResult {
|
||||||
const t = host.t;
|
const t = host.t;
|
||||||
if (!host.hass) return html``;
|
if (!host.hass || isSymcon(host.hass)) return html``;
|
||||||
const auto = roomSpeaker(host.hass, floor, { ...room, announce_speaker: null });
|
const auto = roomSpeaker(host.hass, floor, { ...room, announce_speaker: null });
|
||||||
const speakers = entityOptions(host.hass, (id) => /^(media_player|assist_satellite)\./.test(id) || (id.startsWith("notify.") && id.endsWith("_announce")));
|
const speakers = entityOptions(host.hass, (id) => /^(media_player|assist_satellite)\./.test(id) || (id.startsWith("notify.") && id.endsWith("_announce")));
|
||||||
const quiet = room.announce_quiet ?? null;
|
const quiet = room.announce_quiet ?? null;
|
||||||
@@ -171,8 +172,8 @@ export function renderRoomForm(host: EditorHost, state: SideState, room: Room, a
|
|||||||
${hint(t("room_floor_offset_hint"), "nf-wide")}
|
${hint(t("room_floor_offset_hint"), "nf-wide")}
|
||||||
${entityField(host, t("room_clean"), room.clean_entity ?? null, undefined, entityOptions(host.hass, (id) => /^(script|button|input_button)\./.test(id)), (v) => actions.patch({ clean_entity: v && v !== "none" ? v : null }))}
|
${entityField(host, t("room_clean"), room.clean_entity ?? null, undefined, entityOptions(host.hass, (id) => /^(script|button|input_button)\./.test(id)), (v) => actions.patch({ clean_entity: v && v !== "none" ? v : null }))}
|
||||||
${room.clean_entity ? nothing : hint(t("room_clean_hint"), "nf-wide")}
|
${room.clean_entity ? nothing : hint(t("room_clean_hint"), "nf-wide")}
|
||||||
${entityField(host, t("floor_heating"), room.floor_heating ?? null, undefined, entityOptions(host.hass, (id) => /^(climate|switch|valve|binary_sensor|input_boolean)\./.test(id)), (v) => actions.patch({ floor_heating: v && v !== "none" ? v : null }))}
|
${isSymcon(host.hass) ? nothing : entityField(host, t("floor_heating"), room.floor_heating ?? null, undefined, entityOptions(host.hass, (id) => /^(climate|switch|valve|binary_sensor|input_boolean)\./.test(id)), (v) => actions.patch({ floor_heating: v && v !== "none" ? v : null }))}
|
||||||
${room.floor_heating ? hint(t("floor_heating_hint"), "nf-wide") : nothing}
|
${room.floor_heating && !isSymcon(host.hass) ? hint(t("floor_heating_hint"), "nf-wide") : nothing}
|
||||||
${announceFields(host, room, host.floor ?? null, actions)}
|
${announceFields(host, room, host.floor ?? null, actions)}
|
||||||
${inner ? html`<p class="nf-sub nf-wide" title=${t("room_inner_hint")}>${t("room_inner", { w: formatLength(host.hass, inner[0]), d: formatLength(host.hass, inner[1]) })}</p>` : nothing}
|
${inner ? html`<p class="nf-sub nf-wide" title=${t("room_inner_hint")}>${t("room_inner", { w: formatLength(host.hass, inner[0]), d: formatLength(host.hass, inner[1]) })}</p>` : nothing}
|
||||||
${livingLine(host, room, walls)}
|
${livingLine(host, room, walls)}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import { html, nothing, type TemplateResult } from "lit";
|
import { html, nothing, type TemplateResult } from "lit";
|
||||||
import { weatherEntity } from "../../../weather.ts";
|
import { weatherEntity } from "../../../weather.ts";
|
||||||
|
import { isSymcon } from "../../../entities/symcon-values.ts";
|
||||||
|
import { renderSymconWeather } from "../symcon-fields.ts";
|
||||||
import type { I18nKey } from "../../../i18n.ts";
|
import type { I18nKey } from "../../../i18n.ts";
|
||||||
import { DEFAULT_PAINT_INSIDE, DEFAULT_PAINT_OUTSIDE, DEFAULT_WEATHER_EFFECTS, WEATHER_EFFECTS, type Building, type RoofType } from "../../../model.ts";
|
import { DEFAULT_PAINT_INSIDE, DEFAULT_PAINT_OUTSIDE, DEFAULT_WEATHER_EFFECTS, WEATHER_EFFECTS, type Building, type RoofType } from "../../../model.ts";
|
||||||
import { entityName } from "../../../devices.ts";
|
import { entityName } from "../../../devices.ts";
|
||||||
@@ -91,14 +93,14 @@ export function renderSettings(host: EditorHost, actions: SettingsActions): Temp
|
|||||||
: nothing}
|
: nothing}
|
||||||
${gable ? numberField(host, t("roof_pitch"), s.roof.pitch, (v) => setRoof({ pitch: clamp(v, 5, 60) }), 1, 5) : nothing}
|
${gable ? numberField(host, t("roof_pitch"), s.roof.pitch, (v) => setRoof({ pitch: clamp(v, 5, 60) }), 1, 5) : nothing}
|
||||||
${s.roof.type !== "none" ? numberField(host, t("roof_overhang"), s.roof.overhang, (v) => setRoof({ overhang: clamp(v, 0, 2) }), 0.05, 0) : nothing}
|
${s.roof.type !== "none" ? numberField(host, t("roof_overhang"), s.roof.overhang, (v) => setRoof({ overhang: clamp(v, 0, 2) }), 0.05, 0) : nothing}
|
||||||
${host.hass ? entityField(host, t("weather_entity"), s.weather_entity ?? null, weatherEntity(host.hass, null), entityOptions(host.hass, (id) => id.startsWith("weather.")), (v) => set({ weather_entity: v })) : nothing}
|
${isSymcon(host.hass) ? renderSymconWeather(host, s, set) : host.hass ? entityField(host, t("weather_entity"), s.weather_entity ?? null, weatherEntity(host.hass, null), entityOptions(host.hass, (id) => id.startsWith("weather.")), (v) => set({ weather_entity: v })) : nothing}
|
||||||
<div class="nf-sub nf-wide">${t("weather_effects")}</div>
|
<div class="nf-sub nf-wide">${t("weather_effects")}</div>
|
||||||
${WEATHER_EFFECTS.map((effect) => checkField(host, t(`weather_effect_${effect}` as I18nKey), current.includes(effect), (on) => set({ weather_effects: withEffect(current, effect, on) }), { wide: false }))}
|
${WEATHER_EFFECTS.map((effect) => checkField(host, t(`weather_effect_${effect}` as I18nKey), current.includes(effect), (on) => set({ weather_effects: withEffect(current, effect, on) }), { wide: false }))}
|
||||||
${checkField(host, t("rain_warning"), s.rain_warning !== false, (on) => set({ rain_warning: on }))}
|
${checkField(host, t("rain_warning"), s.rain_warning !== false, (on) => set({ rain_warning: on }))}
|
||||||
${host.hass && s.rain_warning !== false
|
${host.hass && !isSymcon(host.hass) && s.rain_warning !== false
|
||||||
? entityField(host, t("rain_sensor"), s.rain_sensor ?? null, undefined, entityOptions(host.hass, (id) => /^(binary_sensor|sensor)\./.test(id)), (v) => set({ rain_sensor: v === "none" ? null : v }))
|
? entityField(host, t("rain_sensor"), s.rain_sensor ?? null, undefined, entityOptions(host.hass, (id) => /^(binary_sensor|sensor)\./.test(id)), (v) => set({ rain_sensor: v === "none" ? null : v }))
|
||||||
: nothing}
|
: nothing}
|
||||||
${host.hass && s.rain_warning !== false && s.rain_sensor && s.rain_sensor !== "none" ? checkField(host, t("rain_sensor_inverted"), !!s.rain_sensor_inverted, (on) => set({ rain_sensor_inverted: on || undefined }), { title: t("rain_sensor_inverted_hint") }) : nothing}
|
${host.hass && !isSymcon(host.hass) && s.rain_warning !== false && s.rain_sensor && s.rain_sensor !== "none" ? checkField(host, t("rain_sensor_inverted"), !!s.rain_sensor_inverted, (on) => set({ rain_sensor_inverted: on || undefined }), { title: t("rain_sensor_inverted_hint") }) : nothing}
|
||||||
${host.hass ? entityField(host, t("outage_sensor"), s.outage_sensor ?? null, undefined, entityOptions(host.hass, (id) => /^(binary_sensor|sensor)\./.test(id)), (v) => set({ outage_sensor: v === "none" ? null : v })) : nothing}
|
${host.hass ? entityField(host, t("outage_sensor"), s.outage_sensor ?? null, undefined, entityOptions(host.hass, (id) => /^(binary_sensor|sensor)\./.test(id)), (v) => set({ outage_sensor: v === "none" ? null : v })) : nothing}
|
||||||
${hint(t("outage_hint"), "nf-wide")}
|
${hint(t("outage_hint"), "nf-wide")}
|
||||||
${checkField(host, t("contact_warning"), !!s.contact_warning, (on) => set({ contact_warning: on || undefined }), { title: t("contact_warning_hint") })}
|
${checkField(host, t("contact_warning"), !!s.contact_warning, (on) => set({ contact_warning: on || undefined }), { title: t("contact_warning_hint") })}
|
||||||
@@ -106,7 +108,7 @@ export function renderSettings(host: EditorHost, actions: SettingsActions): Temp
|
|||||||
${selectField(host, t("room_double_tap"), s.room_double_tap ?? "area", [["area", t("room_double_tap_area")], ["plan", t("room_double_tap_plan")], ["off", t("room_double_tap_off")]] as const, (v) => set({ room_double_tap: v === "plan" || v === "off" ? v : null }), { title: t("room_double_tap_hint") })}
|
${selectField(host, t("room_double_tap"), s.room_double_tap ?? "area", [["area", t("room_double_tap_area")], ["plan", t("room_double_tap_plan")], ["off", t("room_double_tap_off")]] as const, (v) => set({ room_double_tap: v === "plan" || v === "off" ? v : null }), { title: t("room_double_tap_hint") })}
|
||||||
${checkField(host, t("motion_markers_active"), !!s.motion_markers_active, (on) => set({ motion_markers_active: on || undefined }), { title: t("motion_markers_active_hint") })}
|
${checkField(host, t("motion_markers_active"), !!s.motion_markers_active, (on) => set({ motion_markers_active: on || undefined }), { title: t("motion_markers_active_hint") })}
|
||||||
${host.hass ? statusFields(host, s.status_entities ?? [], (status_entities) => set({ status_entities: status_entities.length ? status_entities : null })) : nothing}
|
${host.hass ? statusFields(host, s.status_entities ?? [], (status_entities) => set({ status_entities: status_entities.length ? status_entities : null })) : nothing}
|
||||||
${host.hass ? entityField(host, t("announce_tts"), s.announce_tts ?? null, undefined, entityOptions(host.hass, (id) => id.startsWith("tts.")), (v) => set({ announce_tts: v === "none" ? null : v })) : nothing}
|
${isSymcon(host.hass) ? nothing : html`${host.hass ? entityField(host, t("announce_tts"), s.announce_tts ?? null, undefined, entityOptions(host.hass, (id) => id.startsWith("tts.")), (v) => set({ announce_tts: v === "none" ? null : v })) : nothing}
|
||||||
<label class="nf-field nf-wide"
|
<label class="nf-field nf-wide"
|
||||||
>${t("announce_phrases")}
|
>${t("announce_phrases")}
|
||||||
<textarea
|
<textarea
|
||||||
@@ -120,11 +122,11 @@ export function renderSettings(host: EditorHost, actions: SettingsActions): Temp
|
|||||||
}}
|
}}
|
||||||
></textarea>
|
></textarea>
|
||||||
</label>
|
</label>
|
||||||
${hint(t("announce_phrases_hint"), "nf-wide")}
|
${hint(t("announce_phrases_hint"), "nf-wide")}`}
|
||||||
${checkField(host, t("sun_patches"), s.sun_patches !== false, (on) => set({ sun_patches: on }), { title: t("sun_patches_hint") })}
|
${checkField(host, t("sun_patches"), s.sun_patches !== false, (on) => set({ sun_patches: on }), { title: t("sun_patches_hint") })}
|
||||||
${checkField(host, t("sun_arc"), s.sun_arc === true, (on) => set({ sun_arc: on }), { title: t("sun_arc_hint") })}
|
${checkField(host, t("sun_arc"), s.sun_arc === true, (on) => set({ sun_arc: on }), { title: t("sun_arc_hint") })}
|
||||||
${backdropFields(host, s.backdrop ?? null, (backdrop) => set({ backdrop }))}
|
${backdropFields(host, s.backdrop ?? null, (backdrop) => set({ backdrop }))}
|
||||||
</div>
|
</div>
|
||||||
${hint(`${t("north_hint")} ${t("weather_entity_hint")}`)}
|
${hint(isSymcon(host.hass) ? t("north_hint") : `${t("north_hint")} ${t("weather_entity_hint")}`)}
|
||||||
</details>`;
|
</details>`;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
import { html, nothing } from "lit";
|
||||||
|
import { WEATHER_VARIABLE_KEYS, type BuildingSettings, type PresenceLink, type Room, type RoomHvac } from "../../model.ts";
|
||||||
|
import { WEATHER_VARIABLE_LABELS } from "../../symcon-weather.ts";
|
||||||
|
import { ROOM_HVAC_FIELDS } from "../../entities/room-hvac.ts";
|
||||||
|
import { isSymconVariable } from "../../entities/symcon-values.ts";
|
||||||
|
import { entityName } from "../../devices.ts";
|
||||||
|
import { entityOptions } from "./entities.ts";
|
||||||
|
import { checkField, entityField, hint, textField } from "./fields.ts";
|
||||||
|
import type { EditorHost } from "./host.ts";
|
||||||
|
|
||||||
|
export function renderSymconRoomHvac(host: EditorHost, room: Room, patch: (change: Partial<Room>) => void) {
|
||||||
|
const set = (change: Partial<RoomHvac>) => patch({ hvac: { ...room.hvac, ...change } });
|
||||||
|
const schedules = room.hvac?.schedules ?? [];
|
||||||
|
const plans = entityOptions(host.hass, (id) => !!host.hass?.states[id]?.attributes.symcon_schedule);
|
||||||
|
return html`
|
||||||
|
${entityField(host, host.t("floor_heating"), room.floor_heating ?? null, undefined, entityOptions(host.hass, (id) => isSymconVariable(host.hass, id, [0, 1, 2])), (v) => patch({ floor_heating: v === "none" ? null : v }))}
|
||||||
|
${ROOM_HVAC_FIELDS.map((field) => entityField(host, field.label, room.hvac?.[field.key] ?? null, undefined, entityOptions(host.hass, (id) => isSymconVariable(host.hass, id, field.types)), (v) => set({ [field.key]: v === "none" ? null : v })))}
|
||||||
|
${hint("Raumstatus zeigt den in Symcon hinterlegten Alias der Integer-Variable. Beschreibbare Heizungs- und Lüftungswerte können im Raummenü bedient werden.", "nf-wide")}
|
||||||
|
${schedules.map((id, i) => entityField(host, `Schaltuhr ${i + 1}`, id, undefined, plans.filter((p) => p.id === id || !schedules.includes(p.id)), (v) => set({ schedules: v && v !== "none" ? schedules.map((old, j) => i === j ? v : old) : schedules.filter((_, j) => i !== j) })))}
|
||||||
|
${entityField(host, "Schaltuhr hinzufügen", null, undefined, plans.filter((p) => !schedules.includes(p.id)), (v) => v && v !== "none" && set({ schedules: [...schedules, v] }))}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function renderSymconWeather(host: EditorHost, settings: BuildingSettings, set: (change: Partial<BuildingSettings>) => void) {
|
||||||
|
return html`<details class="nf-wide nf-symcon-weather"><summary>Wettervariablen</summary><div class="nf-form">
|
||||||
|
${WEATHER_VARIABLE_KEYS.map((key) => entityField(host, WEATHER_VARIABLE_LABELS[key], settings.weather_variables?.[key] ?? null, undefined,
|
||||||
|
entityOptions(host.hass, (id) => isSymconVariable(host.hass, id, key === "condition" ? [0, 1, 2, 3] : key === "wind_bearing" ? [1, 2, 3] : ["snow", "fog", "lightning"].includes(key) ? [0, 1, 2] : [1, 2])),
|
||||||
|
(v) => set({ weather_variables: { ...settings.weather_variables, [key]: v === "none" ? null : v } })))}
|
||||||
|
${entityField(host, host.t("rain_sensor"), settings.rain_sensor ?? null, undefined, entityOptions(host.hass, (id) => isSymconVariable(host.hass, id, [0, 1, 2])), (v) => set({ rain_sensor: v === "none" ? null : v }))}
|
||||||
|
${settings.rain_sensor ? checkField(host, host.t("rain_sensor_inverted"), !!settings.rain_sensor_inverted, (on) => set({ rain_sensor_inverted: on || undefined })) : nothing}
|
||||||
|
${hint("Wähle die Wetterwerte einzeln aus dem Symcon-Objektbaum. Einheiten werden aus den Variablen übernommen. Der Regensensor kann Boolean oder eine numerische Regenrate sein.", "nf-wide")}
|
||||||
|
</div></details>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function renderSymconPresence(host: EditorHost) {
|
||||||
|
const links = host.doc.presence;
|
||||||
|
const replace = (next: PresenceLink[]) => host.replace({ ...structuredClone(host.doc), presence: next });
|
||||||
|
const patch = (i: number, change: Partial<PresenceLink>) => replace(links.map((link, j) => j === i ? { ...link, ...change, sensor: null } : link));
|
||||||
|
const rooms = host.doc.floors.flatMap((f) => f.rooms.map((r) => ({ id: r.id, name: `${f.name} · ${r.name}` })));
|
||||||
|
const options = entityOptions(host.hass, (id) => isSymconVariable(host.hass, id, [0]));
|
||||||
|
return html`<details class="nf-section nf-symcon-presence"><summary>${host.t("presence")}</summary>
|
||||||
|
${links.map((link, i) => html`<div class="nf-form">
|
||||||
|
${textField(host, "Person", link.name ?? entityName(host.hass, link.person), (name) => patch(i, { name }), { wide: true, maxlength: 100 })}
|
||||||
|
${entityField(host, "Anwesenheit (Boolean)", link.person, undefined, options.filter((o) => o.id === link.person || !links.some((l) => l.person === o.id)), (v) => v && v !== "none" ? patch(i, { person: v }) : replace(links.filter((_, j) => j !== i)))}
|
||||||
|
<label class="nf-field nf-wide">Raum für die 3D-Anzeige<select ?disabled=${!host.admin} .value=${link.room ?? ""} @change=${(e: Event) => patch(i, { room: (e.target as HTMLSelectElement).value || null })}><option value="">Kein Raum</option>${rooms.map((r) => html`<option value=${r.id}>${r.name}</option>`)}</select></label>
|
||||||
|
<button class="nf-link nf-wide" ?disabled=${!host.admin} @click=${() => replace(links.filter((_, j) => j !== i))}>× Person entfernen</button>
|
||||||
|
</div>`)}
|
||||||
|
<div class="nf-form">${entityField(host, "Person hinzufügen (Boolean)", null, undefined, options.filter((o) => !links.some((l) => l.person === o.id)), (v) => v && v !== "none" && replace([...links, { person: v, sensor: null }]))}</div>
|
||||||
|
${hint("Jede Person wird mit einer beliebigen Boolean-Variable verknüpft: true bedeutet anwesend, false abwesend. Ein Raum ist optional und bestimmt die Position der Person in 3D.")}
|
||||||
|
</details>`;
|
||||||
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
import { css, html, LitElement, nothing } from "lit";
|
||||||
|
import type { Room } from "../model.ts";
|
||||||
|
import type { HomeAssistant } from "../types.ts";
|
||||||
|
import { ROOM_HVAC_FIELDS } from "../entities/room-hvac.ts";
|
||||||
|
import { nativeBool, nativeNumber, nativeText, nativeValue } from "../entities/symcon-values.ts";
|
||||||
|
import { controls, tokens } from "../styles.ts";
|
||||||
|
|
||||||
|
interface SchedulePoint { hour: number; minute: number; second: number; action: number }
|
||||||
|
interface ScheduleGroup { id: number; days: number; points: SchedulePoint[] }
|
||||||
|
interface ScheduleAction { id: number; name: string; color: number }
|
||||||
|
|
||||||
|
export class NfRoomHvac extends LitElement {
|
||||||
|
static properties = { hass: { attribute: false }, room: { attribute: false }, _pending: { state: true }, _error: { state: true } };
|
||||||
|
declare hass: HomeAssistant;
|
||||||
|
declare room: Room;
|
||||||
|
private declare _pending: Set<string>;
|
||||||
|
private declare _error: string;
|
||||||
|
|
||||||
|
constructor() { super(); this._pending = new Set(); this._error = ""; }
|
||||||
|
|
||||||
|
private async send(id: string, domain: string, service: string, data: Record<string, unknown>) {
|
||||||
|
this._pending = new Set([...this._pending, id]);
|
||||||
|
this._error = "";
|
||||||
|
try { await this.hass.callService(domain, service, { entity_id: id, ...data }); }
|
||||||
|
catch (error) { this._error = error instanceof Error ? error.message : String(error); }
|
||||||
|
finally { this._pending = new Set([...this._pending].filter((x) => x !== id)); }
|
||||||
|
}
|
||||||
|
|
||||||
|
private value(label: string, id: string, control: boolean) {
|
||||||
|
const st = this.hass.states[id], value = nativeValue(st), a = st?.attributes;
|
||||||
|
const writable = control && !!a?.symcon_has_action && value !== null && !this._pending.has(id);
|
||||||
|
return html`<div class="value"><span>${label}</span><b>${nativeText(st)}</b>
|
||||||
|
${control && a?.symcon_has_action && a.symcon_variable_type === 0 ? html`<button class="nf-chip" aria-pressed=${nativeBool(st) === true} ?disabled=${!writable} @click=${() => void this.send(id, "symcon", "set_value", { value: !nativeBool(st) })}>${nativeBool(st) ? "Ein" : "Aus"}</button>`
|
||||||
|
: control && a?.symcon_has_action && [1, 2].includes(Number(a.symcon_variable_type)) ? html`<input type="number" aria-label=${label} .value=${String(nativeNumber(st) ?? "")} min=${String(a.symcon_min ?? 0)} max=${String(a.symcon_max ?? 100)} step=${String(a.symcon_step || (a.symcon_variable_type === 1 ? 1 : 0.1))} ?disabled=${!writable}
|
||||||
|
@change=${(event: Event) => { const input = event.target as HTMLInputElement; if (input.value.trim() && input.checkValidity()) void this.send(id, "symcon", "set_value", { value: Number(input.value) }); }} />` : nothing}
|
||||||
|
</div>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
private schedule(id: string) {
|
||||||
|
const st = this.hass.states[id];
|
||||||
|
if (!st?.attributes.symcon_schedule) return html`<p class="missing">Schaltuhr nicht verfügbar</p>`;
|
||||||
|
const actions = (st.attributes.actions ?? []) as ScheduleAction[];
|
||||||
|
const groups = (st.attributes.groups ?? []) as ScheduleGroup[];
|
||||||
|
const next = Number(st.attributes.next_run ?? 0);
|
||||||
|
const nextAction = actions.find((a) => a.id === st.attributes.next_action);
|
||||||
|
const days = ["Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"];
|
||||||
|
const time = (p: SchedulePoint) => `${String(p.hour).padStart(2, "0")}:${String(p.minute).padStart(2, "0")}${p.second ? `:${String(p.second).padStart(2, "0")}` : ""}`;
|
||||||
|
return html`<details class="schedule"><summary>${String(st.attributes.friendly_name ?? "Schaltuhr")}</summary>
|
||||||
|
<label class="nf-check"><input type="checkbox" .checked=${st.state === "on"} ?disabled=${this._pending.has(id)} @change=${(e: Event) => void this.send(id, "schedule", "set_active", { active: (e.target as HTMLInputElement).checked })} /> Aktiv</label>
|
||||||
|
${next > 0 ? html`<p class="next">Nächster Schaltpunkt: ${new Date(next * 1000).toLocaleString(this.hass.language)}${nextAction ? ` · ${nextAction.name}` : ""}</p>` : nothing}
|
||||||
|
${groups.length ? groups.map((group) => html`<div class="schedule-group"><b>${days.filter((_, i) => group.days & (1 << i)).join(" · ")}</b><div class="points">
|
||||||
|
${[...group.points].sort((a, b) => a.hour * 3600 + a.minute * 60 + a.second - (b.hour * 3600 + b.minute * 60 + b.second)).map((point) => {
|
||||||
|
const action = actions.find((a) => a.id === point.action);
|
||||||
|
return html`<span class="point"><time>${time(point)}</time><span class="dot" style=${`background:#${Number(action?.color ?? 0x8796a9).toString(16).padStart(6, "0").slice(-6)}`}></span>${action?.name || "Aktion"}</span>`;
|
||||||
|
})}
|
||||||
|
</div></div>`) : html`<p class="missing">Keine Schaltpunkte vorhanden.</p>`}
|
||||||
|
</details>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
if (!this.hass || !this.room) return nothing;
|
||||||
|
const rows = ROOM_HVAC_FIELDS.filter((field) => field.key !== "status" && this.room.hvac?.[field.key] && this.room.hvac[field.key] !== "none");
|
||||||
|
const plans = this.room.hvac?.schedules ?? [];
|
||||||
|
const heating = this.room.floor_heating && this.room.floor_heating !== "none" ? this.room.floor_heating : null;
|
||||||
|
return html`${heating || rows.length ? html`<section><h3>Raumklima</h3>${heating ? this.value("Fußbodenheizung", heating, true) : nothing}${rows.map((field) => this.value(field.label, this.room.hvac![field.key]!, !!field.control))}</section>` : nothing}
|
||||||
|
${plans.length ? html`<section><h3>Schaltuhren</h3>${plans.map((id) => this.schedule(id))}</section>` : nothing}
|
||||||
|
${this._error ? html`<p role="alert" class="error">${this._error}</p>` : nothing}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
static styles = [tokens, controls, css`
|
||||||
|
:host { display:block; }
|
||||||
|
section { margin:18px 0; }
|
||||||
|
h3 { font-size:12px; text-transform:uppercase; letter-spacing:.05em; color:var(--nf-muted); margin:0 0 8px; }
|
||||||
|
.value { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; align-items:center; padding:10px 0; border-bottom:1px solid var(--nf-line); }
|
||||||
|
.value b { font-size:13px; color:var(--nf-muted); }
|
||||||
|
.value input,.value button { grid-column:2; max-width:110px; min-width:0; }
|
||||||
|
input[type=number] { background:var(--nf-fill); color:var(--nf-text); border:1px solid var(--nf-line); border-radius:8px; padding:6px 8px; font:inherit; box-sizing:border-box; }
|
||||||
|
.schedule { margin:8px 0; padding:10px; border:1px solid var(--nf-line); border-radius:10px; }
|
||||||
|
summary { cursor:pointer; font-weight:600; }
|
||||||
|
.nf-check { margin-top:10px; }
|
||||||
|
.next,.missing { color:var(--nf-muted); font-size:12px; }
|
||||||
|
.schedule-group { padding:10px 0; border-top:1px solid var(--nf-line); font-size:12px; }
|
||||||
|
.points { display:flex; gap:6px 14px; flex-wrap:wrap; margin-top:8px; }
|
||||||
|
.point { display:inline-flex; align-items:center; gap:6px; }
|
||||||
|
.point time { font-variant-numeric:tabular-nums; }
|
||||||
|
.dot { width:8px; height:8px; border-radius:50%; }
|
||||||
|
.error { color:var(--nf-danger,#ff6b7a); font-size:12px; }
|
||||||
|
`];
|
||||||
|
}
|
||||||
|
if (!customElements.get("nf-room-hvac")) customElements.define("nf-room-hvac", NfRoomHvac);
|
||||||
@@ -8,6 +8,8 @@ import { iconPath } from "../icons.ts";
|
|||||||
import { openMoreInfo, stateText } from "../markers.ts";
|
import { openMoreInfo, stateText } from "../markers.ts";
|
||||||
import { pluginRoomSections } from "../plugins/registry.ts";
|
import { pluginRoomSections } from "../plugins/registry.ts";
|
||||||
import { canAnnounce, roomHasSpeaker } from "../live/announce.ts";
|
import { canAnnounce, roomHasSpeaker } from "../live/announce.ts";
|
||||||
|
import { isSymcon, nativeText } from "../entities/symcon-values.ts";
|
||||||
|
import "./room-hvac.ts";
|
||||||
import type { Building, Floor, LightMood, LightSetting, Room } from "../model.ts";
|
import type { Building, Floor, LightMood, LightSetting, Room } from "../model.ts";
|
||||||
import { roomPower, roomPowerSensors } from "../heatmap.ts";
|
import { roomPower, roomPowerSensors } from "../heatmap.ts";
|
||||||
import { energyCost, loadRoomEnergy, type RoomEnergy } from "../live/room-energy.ts";
|
import { energyCost, loadRoomEnergy, type RoomEnergy } from "../live/room-energy.ts";
|
||||||
@@ -451,7 +453,9 @@ export class NfRoomPanel extends LitElement {
|
|||||||
: (this.memo = { entities: this.hass.entities, floor: this.floor, room, ...(this.floor ? roomPanelEntities(this.hass, this.floor, room) : { shown: all, more: [] }) });
|
: (this.memo = { entities: this.hass.entities, floor: this.floor, room, ...(this.floor ? roomPanelEntities(this.hass, this.floor, room) : { shown: all, more: [] }) });
|
||||||
const extra = groupByDevice(this.hass, more).map((g) => g.primary);
|
const extra = groupByDevice(this.hass, more).map((g) => g.primary);
|
||||||
const hiddenCount = extra.length;
|
const hiddenCount = extra.length;
|
||||||
const ids = this._showAll ? [...shown, ...extra] : shown;
|
const hvacRefs = [room.floor_heating, ...Object.values(room.hvac ?? {}).flat()].filter((x): x is string => !!x && x !== "none");
|
||||||
|
const hvacNative = new Set(hvacRefs.map((id) => this.hass.states[id]?.attributes.symcon_id).filter(Boolean));
|
||||||
|
const ids = (this._showAll ? [...shown, ...extra] : shown).filter((id) => !isSymcon(this.hass) || !hvacNative.has(this.hass.states[id]?.attributes.symcon_id));
|
||||||
const by = (kinds: DeviceKind[]) => ids.filter((id) => kinds.includes(kindOf(id)!)).map((id) => this.hass.states[id]);
|
const by = (kinds: DeviceKind[]) => ids.filter((id) => kinds.includes(kindOf(id)!)).map((id) => this.hass.states[id]);
|
||||||
const lights = by(["light"]);
|
const lights = by(["light"]);
|
||||||
const covers = by(["cover"]);
|
const covers = by(["cover"]);
|
||||||
@@ -480,9 +484,9 @@ export class NfRoomPanel extends LitElement {
|
|||||||
<div class="nf-rp-body" ?hidden=${this._folded}>
|
<div class="nf-rp-body" ?hidden=${this._folded}>
|
||||||
${this.renderAllOff([...lights, ...media, ...switches])}
|
${this.renderAllOff([...lights, ...media, ...switches])}
|
||||||
${this.renderClean(room)}
|
${this.renderClean(room)}
|
||||||
${!room.area_id && !outside
|
${!room.area_id && !outside && !(isSymcon(this.hass) && hvacRefs.length)
|
||||||
? html`<p class="nf-rp-note">${this.t("panel_no_area")}</p>`
|
? html`<p class="nf-rp-note">${this.t("panel_no_area")}</p>`
|
||||||
: !ids.length
|
: !ids.length && !(isSymcon(this.hass) && hvacRefs.length)
|
||||||
? html`<p class="nf-rp-note">${this.t("panel_empty")}</p>`
|
? html`<p class="nf-rp-note">${this.t("panel_empty")}</p>`
|
||||||
: nothing}
|
: nothing}
|
||||||
${scenes.length
|
${scenes.length
|
||||||
@@ -531,12 +535,13 @@ export class NfRoomPanel extends LitElement {
|
|||||||
: nothing,
|
: nothing,
|
||||||
)
|
)
|
||||||
: nothing}
|
: nothing}
|
||||||
|
${isSymcon(this.hass) ? html`<nf-room-hvac .hass=${this.hass} .room=${room}></nf-room-hvac>` : nothing}
|
||||||
${climates.length ? this.section("panel_climate", climates.map((st) => this.climateRow(st))) : nothing}
|
${climates.length ? this.section("panel_climate", climates.map((st) => this.climateRow(st))) : nothing}
|
||||||
${media.length ? this.section("panel_media", media.map((st) => this.mediaRow(st))) : nothing}
|
${media.length ? this.section("panel_media", media.map((st) => this.mediaRow(st))) : nothing}
|
||||||
${switches.length ? this.section("panel_switches", switches.map((st) => this.switchRow(st))) : nothing}
|
${switches.length ? this.section("panel_switches", switches.map((st) => this.switchRow(st))) : nothing}
|
||||||
${sensors.length ? this.section("panel_sensors", sensors.map((st) => this.sensorRow(st))) : nothing}
|
${sensors.length ? this.section("panel_sensors", sensors.map((st) => this.sensorRow(st))) : nothing}
|
||||||
${this.extraValues(room)}
|
${this.extraValues(room)}
|
||||||
${canAnnounce(this.hass) && roomHasSpeaker(this.hass, this.floor, room) ? this.announceSection(room) : nothing}
|
${!isSymcon(this.hass) && canAnnounce(this.hass) && roomHasSpeaker(this.hass, this.floor, room) ? this.announceSection(room) : nothing}
|
||||||
${this.pluginSections(room, ids)}
|
${this.pluginSections(room, ids)}
|
||||||
${hiddenCount
|
${hiddenCount
|
||||||
? html`<button class="nf-btn nf-rp-small nf-rp-more" @click=${() => (this._showAll = !this._showAll)}>
|
? html`<button class="nf-btn nf-rp-small nf-rp-more" @click=${() => (this._showAll = !this._showAll)}>
|
||||||
@@ -621,7 +626,9 @@ export class NfRoomPanel extends LitElement {
|
|||||||
if (need && !off.includes("air")) out.push(`💨 ${this.t(`air_${need}`)}`);
|
if (need && !off.includes("air")) out.push(`💨 ${this.t(`air_${need}`)}`);
|
||||||
// how comfortable it is (0 … 100)
|
// how comfortable it is (0 … 100)
|
||||||
const comfort = comfortScore(t, h, roomClimateValue(this.hass, this.floor, room, "co2"), isSummer(new Date(), this.hass.config?.latitude));
|
const comfort = comfortScore(t, h, roomClimateValue(this.hass, this.floor, room, "co2"), isSummer(new Date(), this.hass.config?.latitude));
|
||||||
if (comfort !== null && (t !== null || h !== null) && !off.includes("comfort")) out.push(`😊 ${this.t("comfort_n", { n: comfort })}`);
|
const status = room.hvac?.status;
|
||||||
|
if (status && status !== "none") out.push(nativeText(this.hass.states[status]));
|
||||||
|
else if (comfort !== null && (t !== null || h !== null) && !off.includes("comfort")) out.push(`😊 ${this.t("comfort_n", { n: comfort })}`);
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ export class SymconObjectPicker extends LitElement {
|
|||||||
|
|
||||||
private variableNode(entity: string | null): SymconObject | undefined {
|
private variableNode(entity: string | null): SymconObject | undefined {
|
||||||
const source = this.allowed.get(entity ?? "")?.sourceEntity ?? entity;
|
const source = this.allowed.get(entity ?? "")?.sourceEntity ?? entity;
|
||||||
const native = this.objects.find((node) => node.entity_id === source && node.object_type === 2);
|
const native = this.objects.find((node) => node.entity_id === source && (node.object_type === 2 || node.object_type === 4));
|
||||||
return native ? this.tree.nodes.get(native.object_id) : undefined;
|
return native ? this.tree.nodes.get(native.object_id) : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,7 +216,7 @@ export class SymconObjectPicker extends LitElement {
|
|||||||
${!rows.length ? html`<p class="empty">${this.objects.length ? "Keine Objekte gefunden." : "Kein Objektbaum verfügbar. Bitte das Symcon-Modul aktualisieren und den Designer neu laden."}</p>` : nothing}
|
${!rows.length ? html`<p class="empty">${this.objects.length ? "Keine Objekte gefunden." : "Kein Objektbaum verfügbar. Bitte das Symcon-Modul aktualisieren und den Designer neu laden."}</p>` : nothing}
|
||||||
</div>
|
</div>
|
||||||
<footer><div class="selection"><strong>${pendingNode?.name ?? pending?.label ?? "Noch kein Datenpunkt ausgewählt"}</strong>
|
<footer><div class="selection"><strong>${pendingNode?.name ?? pending?.label ?? "Noch kein Datenpunkt ausgewählt"}</strong>
|
||||||
<small>${pendingNode?.path ?? "Nur passende Variablen können ausgewählt werden."}</small></div>
|
<small>${pendingNode?.path ?? "Nur passende Datenpunkte können ausgewählt werden."}</small></div>
|
||||||
<div class="actions"><button type="button" @click=${this.close}>Abbrechen</button>
|
<div class="actions"><button type="button" @click=${this.close}>Abbrechen</button>
|
||||||
<button class="apply" type="button" ?disabled=${this.disabled || !pending} @click=${this.commit}>Übernehmen</button></div>
|
<button class="apply" type="button" ?disabled=${this.disabled || !pending} @click=${this.commit}>Übernehmen</button></div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ import { scaleGlow, buildMarkers, openMoreInfo, stateText, toggleEntity, withPlu
|
|||||||
import { fanSpin } from "../entities/fans.ts";
|
import { fanSpin } from "../entities/fans.ts";
|
||||||
import { fixtureGlow } from "../entities/kinds.ts";
|
import { fixtureGlow } from "../entities/kinds.ts";
|
||||||
import { coverTiltEntity } from "../entities/covers.ts";
|
import { coverTiltEntity } from "../entities/covers.ts";
|
||||||
|
import { isSymcon, isSymconVariable, nativeBool, nativeText } from "../entities/symcon-values.ts";
|
||||||
|
import { WEATHER_VARIABLE_LABELS } from "../symcon-weather.ts";
|
||||||
import { deviceValuesText } from "../entities/device-values.ts";
|
import { deviceValuesText } from "../entities/device-values.ts";
|
||||||
import { furnitureShown, hiddenFurniture, withoutHidden } from "../entities/visibility.ts";
|
import { furnitureShown, hiddenFurniture, withoutHidden } from "../entities/visibility.ts";
|
||||||
import { pictureUrl } from "../entities/pictures.ts";
|
import { pictureUrl } from "../entities/pictures.ts";
|
||||||
@@ -1133,7 +1135,7 @@ export class NfView3d extends LitElement {
|
|||||||
for (const floor of b.floors)
|
for (const floor of b.floors)
|
||||||
for (const room of floor.rooms) {
|
for (const room of floor.rooms) {
|
||||||
const st = room.floor_heating ? hass.states[room.floor_heating] : undefined;
|
const st = room.floor_heating ? hass.states[room.floor_heating] : undefined;
|
||||||
const heats = st && (st.entity_id.startsWith("climate.") ? st.attributes.hvac_action === "heating" : st.state === "on" || st.state === "open");
|
const heats = st && (isSymcon(hass) ? nativeBool(st) === true : st.entity_id.startsWith("climate.") ? st.attributes.hvac_action === "heating" : st.state === "on" || st.state === "open");
|
||||||
if (heats) (tint ??= new Map()).set(room.id, [0.55, 0.24, 0.08]);
|
if (heats) (tint ??= new Map()).set(room.id, [0.55, 0.24, 0.08]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2742,13 +2744,18 @@ export class NfView3d extends LitElement {
|
|||||||
/** The plan's own sensors at the top (outside temperature, the alarm…): their name and state; a tap opens their details. */
|
/** The plan's own sensors at the top (outside temperature, the alarm…): their name and state; a tap opens their details. */
|
||||||
private ownSensors() {
|
private ownSensors() {
|
||||||
const ids = this.sensorBar && this.hass ? (this.building?.settings.status_entities ?? []) : [];
|
const ids = this.sensorBar && this.hass ? (this.building?.settings.status_entities ?? []) : [];
|
||||||
return ids
|
const people = isSymcon(this.hass) ? (this.building?.presence ?? []).filter((link) => isSymconVariable(this.hass, link.person, [0])).map((link) => html`<div class="nf-energy-item nf-presence-state"><span>${link.name || entityName(this.hass, link.person)}</span><b>${nativeBool(this.hass.states[link.person]) === null ? "–" : nativeBool(this.hass.states[link.person]) ? "Anwesend" : "Abwesend"}</b></div>`) : [];
|
||||||
|
const weather = isSymcon(this.hass) ? Object.entries(this.building?.settings.weather_variables ?? {}).filter((entry): entry is [keyof typeof WEATHER_VARIABLE_LABELS, string] => !!entry[1] && entry[1] !== "none").map(([key, id]) => [WEATHER_VARIABLE_LABELS[key] || key, id]) : [];
|
||||||
|
if (isSymcon(this.hass) && this.building?.settings.rain_sensor && this.building.settings.rain_sensor !== "none") weather.push(["Regensensor", this.building.settings.rain_sensor]);
|
||||||
|
const weatherValues = weather.length ? html`<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<HTMLDialogElement>(".nf-weather-dialog")?.showModal()}><span>Wetter</span><b aria-hidden="true">⛅</b></button>
|
||||||
|
<dialog class="nf-weather-dialog" aria-label="Wetterwerte" @keydown=${(event: KeyboardEvent) => event.stopPropagation()}><header><b>Wetter</b><button type="button" class="nf-chip" aria-label="Schließen" @click=${() => this.renderRoot.querySelector<HTMLDialogElement>(".nf-weather-dialog")?.close()}>×</button></header>${weather.map(([label, id]) => html`<p><span>${label}</span><b>${nativeText(this.hass.states[id])}</b></p>`)}</dialog>` : nothing;
|
||||||
|
return [...people, weatherValues, ...ids
|
||||||
.filter((id) => this.hass.states[id])
|
.filter((id) => this.hass.states[id])
|
||||||
.map(
|
.map(
|
||||||
(id) => html`<button class="nf-energy-item nf-own-sensor" title=${entityName(this.hass, id)} @click=${() => openMoreInfo(this, id)}>
|
(id) => html`<button class="nf-energy-item nf-own-sensor" title=${entityName(this.hass, id)} @click=${() => openMoreInfo(this, id)}>
|
||||||
<span>${entityName(this.hass, id)}</span><b>${stateText(this.hass, this.hass.states[id])}</b>
|
<span>${entityName(this.hass, id)}</span><b>${stateText(this.hass, this.hass.states[id])}</b>
|
||||||
</button>`,
|
</button>`,
|
||||||
);
|
)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The map's credit while a real map lies under the plan (OpenStreetMap asks for it). */
|
/** The map's credit while a real map lies under the plan (OpenStreetMap asks for it). */
|
||||||
@@ -4262,6 +4269,11 @@ export class NfView3d extends LitElement {
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
font: inherit;
|
font: inherit;
|
||||||
}
|
}
|
||||||
|
.nf-weather-dialog { pointer-events:auto; width:min(380px,calc(100vw - 32px)); max-height:75dvh; overflow:auto; box-sizing:border-box; padding:16px; background:var(--nf-chrome-solid); color:var(--nf-text); font:14px/1.5 system-ui,sans-serif; border:1px solid var(--nf-line); border-radius:12px; box-shadow:var(--nf-shadow); }
|
||||||
|
.nf-weather-dialog::backdrop { background:#0008; }
|
||||||
|
.nf-weather-dialog header,.nf-weather-dialog p { display:flex; justify-content:space-between; gap:16px; margin:8px 0; }
|
||||||
|
.nf-weather-dialog p span { color:var(--nf-muted); }
|
||||||
|
.nf-weather-dialog p b { font-size:13px; white-space:nowrap; }
|
||||||
.nf-own-sensor {
|
.nf-own-sensor {
|
||||||
pointer-events: auto;
|
pointer-events: auto;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|||||||
@@ -82,6 +82,8 @@ export function watchedEntities(inputs: WatchInputs): string[] {
|
|||||||
...b.presence.flatMap((p) => [p.person, p.sensor]),
|
...b.presence.flatMap((p) => [p.person, p.sensor]),
|
||||||
...lightsOfRooms,
|
...lightsOfRooms,
|
||||||
...roomsOf(b).map((r) => r.floor_heating),
|
...roomsOf(b).map((r) => r.floor_heating),
|
||||||
|
...roomsOf(b).flatMap((r) => Object.values(r.hvac ?? {}).flat()),
|
||||||
|
...Object.values(b.settings.weather_variables ?? {}),
|
||||||
...b.floors.flatMap((f) => (f.outdoor ?? []).flatMap((a) => [a.temp_entity, a.pump_entity])),
|
...b.floors.flatMap((f) => (f.outdoor ?? []).flatMap((a) => [a.temp_entity, a.pump_entity])),
|
||||||
...sensorsOfRooms,
|
...sensorsOfRooms,
|
||||||
...(inputs.alertSources ? alertEntities(inputs.alertSources) : []),
|
...(inputs.alertSources ? alertEntities(inputs.alertSources) : []),
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import type { RoomHvac } from "../model.ts";
|
||||||
|
|
||||||
|
export const ROOM_HVAC_FIELDS: readonly { key: Exclude<keyof RoomHvac, "schedules">; label: string; types: readonly number[]; control?: boolean }[] = [
|
||||||
|
{ key: "supply_vsr", label: "Zuluft-VSR", types: [0, 1, 2], control: true },
|
||||||
|
{ key: "extract_vsr", label: "Abluft-VSR", types: [0, 1, 2], control: true },
|
||||||
|
{ key: "supply_temperature", label: "Zulufttemperatur", types: [1, 2] },
|
||||||
|
{ key: "extract_temperature", label: "Ablufttemperatur", types: [1, 2] },
|
||||||
|
{ key: "reheat", label: "NHR (Nachheizregister)", types: [0, 1, 2], control: true },
|
||||||
|
{ key: "status", label: "Raumstatus", types: [1] },
|
||||||
|
];
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
import type { HassEntity, HomeAssistant } from "../types.ts";
|
||||||
|
|
||||||
|
export const isSymcon = (hass: HomeAssistant | undefined): boolean => hass?.symconObjects !== undefined;
|
||||||
|
|
||||||
|
/** Pick the original native variable, regardless of a guessed actuator domain. */
|
||||||
|
export function isSymconVariable(hass: HomeAssistant | undefined, id: string, types: readonly number[] = [0, 1, 2, 3]): boolean {
|
||||||
|
const a = hass?.states[id]?.attributes;
|
||||||
|
return !!a?.symcon_id && !a.symcon_source_entity && types.includes(Number(a.symcon_variable_type));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function nativeValue(st: HassEntity | undefined): unknown {
|
||||||
|
if (!st || st.state === "unknown" || st.state === "unavailable") return null;
|
||||||
|
return st.attributes.symcon_value ?? st.attributes.symcon_numeric_value ?? st.state;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function nativeNumber(st: HassEntity | undefined): number | null {
|
||||||
|
const value = nativeValue(st);
|
||||||
|
if (value === null || typeof value === "boolean" || value === "") return null;
|
||||||
|
const n = Number(value);
|
||||||
|
return Number.isFinite(n) ? n : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function nativeBool(st: HassEntity | undefined): boolean | null {
|
||||||
|
const value = nativeValue(st);
|
||||||
|
if (value === null) return null;
|
||||||
|
if (typeof value === "boolean") return value;
|
||||||
|
if (typeof value === "number") return value > 0;
|
||||||
|
const word = String(value).trim().toLowerCase();
|
||||||
|
if (["on", "true", "1", "home", "open", "an", "ein", "ja", "regen", "rain", "wet", "nass"].includes(word)) return true;
|
||||||
|
if (["off", "false", "0", "not_home", "closed", "aus", "nein", "trocken", "dry"].includes(word)) return false;
|
||||||
|
const n = Number(word);
|
||||||
|
return word !== "" && Number.isFinite(n) ? n > 0 : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function nativeText(st: HassEntity | undefined): string {
|
||||||
|
if (nativeValue(st) === null) return "–";
|
||||||
|
return String(st?.attributes.symcon_formatted ?? nativeValue(st));
|
||||||
|
}
|
||||||
@@ -62,8 +62,8 @@ export function bearing(v: unknown): number | null {
|
|||||||
/** The weather to draw from an entity, or null when it is missing or reports nothing usable. */
|
/** The weather to draw from an entity, or null when it is missing or reports nothing usable. */
|
||||||
export function readSkyWeather(hass: HomeAssistant, entity: string | null): SkyWeather | null {
|
export function readSkyWeather(hass: HomeAssistant, entity: string | null): SkyWeather | null {
|
||||||
const st = entity ? hass.states[entity] : undefined;
|
const st = entity ? hass.states[entity] : undefined;
|
||||||
if (!st || st.state === "unavailable" || st.state === "unknown") return null;
|
if (!st || st.state === "unavailable" || (st.state === "unknown" && !st.attributes.nf_symcon_weather)) return null;
|
||||||
const look = LOOK[st.state];
|
const look = LOOK[st.state] ?? (st.attributes.nf_symcon_weather ? {} : undefined);
|
||||||
if (!look) return null;
|
if (!look) return null;
|
||||||
const a = st.attributes as Record<string, unknown>;
|
const a = st.attributes as Record<string, unknown>;
|
||||||
const w: SkyWeather = {
|
const w: SkyWeather = {
|
||||||
|
|||||||
@@ -27,6 +27,19 @@ export interface DeviceValueLink {
|
|||||||
label?: string | null;
|
label?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface RoomHvac {
|
||||||
|
supply_vsr?: EntityRef;
|
||||||
|
extract_vsr?: EntityRef;
|
||||||
|
supply_temperature?: EntityRef;
|
||||||
|
extract_temperature?: EntityRef;
|
||||||
|
reheat?: EntityRef;
|
||||||
|
status?: EntityRef;
|
||||||
|
schedules?: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export const WEATHER_VARIABLE_KEYS = ["condition", "temperature", "humidity", "pressure", "wind_speed", "wind_gust_speed", "wind_bearing", "cloud_coverage", "precipitation", "precipitation_total", "illuminance", "uv_index", "visibility", "snow", "fog", "lightning"] as const;
|
||||||
|
export type WeatherVariableKey = typeof WEATHER_VARIABLE_KEYS[number];
|
||||||
|
|
||||||
/** A wall height on a room edge, or one per part of a split edge. */
|
/** A wall height on a room edge, or one per part of a split edge. */
|
||||||
export type WallHeight = number | null | (number | null)[];
|
export type WallHeight = number | null | (number | null)[];
|
||||||
|
|
||||||
@@ -35,6 +48,7 @@ export interface Room {
|
|||||||
climate?: RoomClimate | null;
|
climate?: RoomClimate | null;
|
||||||
/** Show temperature, humidity and CO2 in a floating glass card over this room. */
|
/** Show temperature, humidity and CO2 in a floating glass card over this room. */
|
||||||
climate_card?: boolean;
|
climate_card?: boolean;
|
||||||
|
hvac?: RoomHvac | null;
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
area_id: string | null;
|
area_id: string | null;
|
||||||
@@ -699,6 +713,7 @@ export interface BleTag {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface BuildingSettings {
|
export interface BuildingSettings {
|
||||||
|
weather_variables?: Partial<Record<WeatherVariableKey, EntityRef>> | null;
|
||||||
/** Bluetooth tags located by room (the sensor and the editor's learning by walking). */
|
/** Bluetooth tags located by room (the sensor and the editor's learning by walking). */
|
||||||
ble?: { tags: BleTag[] } | null;
|
ble?: { tags: BleTag[] } | null;
|
||||||
/** Stations and playlists for the speakers' quick menu (Klang). */
|
/** Stations and playlists for the speakers' quick menu (Klang). */
|
||||||
@@ -1060,6 +1075,7 @@ export interface Circuit {
|
|||||||
|
|
||||||
/** A person and the sensor whose state names the room they are in (ESPresense, Bermuda, …). */
|
/** A person and the sensor whose state names the room they are in (ESPresense, Bermuda, …). */
|
||||||
export interface PresenceLink {
|
export interface PresenceLink {
|
||||||
|
name?: string | null;
|
||||||
/** A person, or any entity that is "home" / "on" while someone is in (an input_boolean, a device tracker). */
|
/** A person, or any entity that is "home" / "on" while someone is in (an input_boolean, a device tracker). */
|
||||||
person: string;
|
person: string;
|
||||||
sensor: string | null;
|
sensor: string | null;
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ import { colorSchemeOf, controls, readableStyles, tokens } from "./styles.ts";
|
|||||||
import { LOOKS, lookNow, type Look } from "./themes.ts";
|
import { LOOKS, lookNow, type Look } from "./themes.ts";
|
||||||
import type { HomeAssistant } from "./types.ts";
|
import type { HomeAssistant } from "./types.ts";
|
||||||
import { withCoverControls } from "./entities/cover-controls.ts";
|
import { withCoverControls } from "./entities/cover-controls.ts";
|
||||||
|
import { withSymconWeather } from "./symcon-weather.ts";
|
||||||
|
import { isSymcon } from "./entities/symcon-values.ts";
|
||||||
import { allOffPlan, floorSwitchables, type ServiceCall } from "./live/all-off.ts";
|
import { allOffPlan, floorSwitchables, type ServiceCall } from "./live/all-off.ts";
|
||||||
import type { FloorStack, Quality, WallMode } from "./viewer/viewer3d.ts";
|
import type { FloorStack, Quality, WallMode } from "./viewer/viewer3d.ts";
|
||||||
|
|
||||||
@@ -331,7 +333,7 @@ export class NextFloorPanel extends LitElement {
|
|||||||
>${this.t("glass_walls")}
|
>${this.t("glass_walls")}
|
||||||
<input type="range" min="0" max="100" step="5" .value=${String(p.glassWalls)} aria-label=${this.t("glass_walls")} @input=${(e: Event) => this.setPref("glassWalls", Number((e.target as HTMLInputElement).value))} />
|
<input type="range" min="0" max="100" step="5" .value=${String(p.glassWalls)} aria-label=${this.t("glass_walls")} @input=${(e: Event) => this.setPref("glassWalls", Number((e.target as HTMLInputElement).value))} />
|
||||||
</label>
|
</label>
|
||||||
<details class="nf-seg nf-screen-pick">
|
${isSymcon(this.hass) ? nothing : html`<details class="nf-seg nf-screen-pick">
|
||||||
<summary title=${this.t(p.announceMuted ? "announce_muted" : "announce_on")} aria-label=${this.t(p.announceMuted ? "announce_muted" : "announce_on")}>${p.announceMuted ? "🔇" : "📢"}</summary>
|
<summary title=${this.t(p.announceMuted ? "announce_muted" : "announce_on")} aria-label=${this.t(p.announceMuted ? "announce_muted" : "announce_on")}>${p.announceMuted ? "🔇" : "📢"}</summary>
|
||||||
<div class="nf-screen-menu">
|
<div class="nf-screen-menu">
|
||||||
<label class="nf-check"><input type="checkbox" .checked=${!p.announceMuted} @change=${(e: Event) => this.setPref("announceMuted", !(e.target as HTMLInputElement).checked)} /> ${this.t("announce_on")}</label>
|
<label class="nf-check"><input type="checkbox" .checked=${!p.announceMuted} @change=${(e: Event) => this.setPref("announceMuted", !(e.target as HTMLInputElement).checked)} /> ${this.t("announce_on")}</label>
|
||||||
@@ -341,7 +343,7 @@ export class NextFloorPanel extends LitElement {
|
|||||||
</label>
|
</label>
|
||||||
<p class="nf-screen-hint">${this.t("screen_name_hint")}</p>
|
<p class="nf-screen-hint">${this.t("screen_name_hint")}</p>
|
||||||
</div>
|
</div>
|
||||||
</details>
|
</details>`}
|
||||||
<div class="nf-seg nf-quality">
|
<div class="nf-seg nf-quality">
|
||||||
<button aria-pressed=${p.timeSlider} title=${this.t("time_of_day_hint")} @click=${() => this.toggleTimeSlider(!p.timeSlider)}>☀ ${this.t("time_of_day")}</button>
|
<button aria-pressed=${p.timeSlider} title=${this.t("time_of_day_hint")} @click=${() => this.toggleTimeSlider(!p.timeSlider)}>☀ ${this.t("time_of_day")}</button>
|
||||||
<button aria-pressed=${p.menuOpen} title=${this.t("menu_open_hint")} @click=${() => this.setPref("menuOpen", !p.menuOpen)}>★ ${this.t("menu_open")}</button>
|
<button aria-pressed=${p.menuOpen} title=${this.t("menu_open_hint")} @click=${() => this.setPref("menuOpen", !p.menuOpen)}>★ ${this.t("menu_open")}</button>
|
||||||
@@ -585,7 +587,7 @@ export class NextFloorPanel extends LitElement {
|
|||||||
<div class="nf-stage-wrap ${this._roomId ? "nf-room-open" : ""}">
|
<div class="nf-stage-wrap ${this._roomId ? "nf-room-open" : ""}">
|
||||||
<nf-view3d
|
<nf-view3d
|
||||||
class="nf-body"
|
class="nf-body"
|
||||||
.hass=${withCoverControls(this.hass, building.floors)}
|
.hass=${withSymconWeather(withCoverControls(this.hass, building.floors), building.settings)}
|
||||||
.building=${building}
|
.building=${building}
|
||||||
.packs=${this.data.packs}
|
.packs=${this.data.packs}
|
||||||
.floorStack=${p.floorStack}
|
.floorStack=${p.floorStack}
|
||||||
@@ -607,7 +609,7 @@ export class NextFloorPanel extends LitElement {
|
|||||||
.theme=${lookNow(p.theme, this.sunState())}
|
.theme=${lookNow(p.theme, this.sunState())}
|
||||||
.timeOfDay=${this._timeOfDay}
|
.timeOfDay=${this._timeOfDay}
|
||||||
.clock=${p.clock === "none" ? null : p.clock}
|
.clock=${p.clock === "none" ? null : p.clock}
|
||||||
.announcements=${!p.announceMuted}
|
.announcements=${!isSymcon(this.hass) && !p.announceMuted}
|
||||||
.glassWalls=${p.glassWalls}
|
.glassWalls=${p.glassWalls}
|
||||||
.screenName=${p.screenName || null}
|
.screenName=${p.screenName || null}
|
||||||
.lockButton=${true}
|
.lockButton=${true}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { readPower } from "./energy.ts";
|
|||||||
import { formatNumber, translate } from "./i18n.ts";
|
import { formatNumber, translate } from "./i18n.ts";
|
||||||
import { centroid, type Building, type Floor, type Room } from "./model.ts";
|
import { centroid, type Building, type Floor, type Room } from "./model.ts";
|
||||||
import type { HomeAssistant } from "./types.ts";
|
import type { HomeAssistant } from "./types.ts";
|
||||||
|
import { isSymcon, nativeBool } from "./entities/symcon-values.ts";
|
||||||
|
|
||||||
export interface PersonMarker {
|
export interface PersonMarker {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -66,18 +67,18 @@ function spotInRoom(room: Room, n: number): [number, number] {
|
|||||||
export function personsInRooms(hass: HomeAssistant, building: Building): PersonMarker[] {
|
export function personsInRooms(hass: HomeAssistant, building: Building): PersonMarker[] {
|
||||||
const markers: PersonMarker[] = [];
|
const markers: PersonMarker[] = [];
|
||||||
const inRoom = new Map<string, number>();
|
const inRoom = new Map<string, number>();
|
||||||
for (const { person: personId, sensor: sensorId, room: defaultRoom } of building.presence) {
|
for (const { person: personId, sensor: sensorId, room: defaultRoom, name: ownName } of building.presence) {
|
||||||
const person = hass.states[personId];
|
const person = hass.states[personId];
|
||||||
const sensor = sensorId ? hass.states[sensorId] : undefined;
|
const sensor = sensorId ? hass.states[sensorId] : undefined;
|
||||||
// someone who is away is in no room, whatever the room sensor still says
|
// someone who is away is in no room, whatever the room sensor still says
|
||||||
if (!person || (person.state !== "home" && person.state !== "on")) continue;
|
if (!person || (isSymcon(hass) ? nativeBool(person) !== true : person.state !== "home" && person.state !== "on")) continue;
|
||||||
// the room sensor names the room; without one (or when it names none) the person's own room of the plan counts
|
// the room sensor names the room; without one (or when it names none) the person's own room of the plan counts
|
||||||
const found = (sensor ? roomForState(hass, building, sensor.state) : null) ?? roomById(building, defaultRoom);
|
const found = (!isSymcon(hass) && sensor ? roomForState(hass, building, sensor.state) : null) ?? roomById(building, defaultRoom);
|
||||||
if (!found) continue;
|
if (!found) continue;
|
||||||
const n = inRoom.get(found.room.id) ?? 0;
|
const n = inRoom.get(found.room.id) ?? 0;
|
||||||
inRoom.set(found.room.id, n + 1);
|
inRoom.set(found.room.id, n + 1);
|
||||||
const [x, z] = spotInRoom(found.room, n);
|
const [x, z] = spotInRoom(found.room, n);
|
||||||
const name = String(person.attributes.friendly_name ?? personId);
|
const name = ownName?.trim() || String(person.attributes.friendly_name ?? personId);
|
||||||
const picture = person.attributes.entity_picture;
|
const picture = person.attributes.entity_picture;
|
||||||
markers.push({ id: personId, name, initials: initials(name), picture: typeof picture === "string" ? picture : null, floorId: found.floorId, roomId: found.room.id, x, z });
|
markers.push({ id: personId, name, initials: initials(name), picture: typeof picture === "string" ? picture : null, floorId: found.floorId, roomId: found.room.id, x, z });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
import assert from "node:assert/strict";
|
||||||
|
import { test } from "node:test";
|
||||||
|
import { entity, floorWith, box, hassOf } from "./entities/fixtures.ts";
|
||||||
|
import { emptyBuilding } from "./model.ts";
|
||||||
|
import { isSymconVariable, nativeBool, nativeText } from "./entities/symcon-values.ts";
|
||||||
|
import { withSymconWeather, SYMCON_WEATHER } from "./symcon-weather.ts";
|
||||||
|
import { weatherEntity } from "./weather.ts";
|
||||||
|
import { readSkyWeather } from "./live/sky-weather.ts";
|
||||||
|
import { alertSources, isRaining } from "./alerts.ts";
|
||||||
|
import { personsInRooms } from "./presence.ts";
|
||||||
|
|
||||||
|
test("native datatype selection, boolean presence and formatted status ignore inferred actuator domains", () => {
|
||||||
|
const h = hassOf([
|
||||||
|
entity("light.present", "off", { symcon_id: 1, symcon_variable_type: 0, symcon_value: true }),
|
||||||
|
entity("cover.rain", "open", { symcon_id: 2, symcon_variable_type: 0, symcon_value: false }),
|
||||||
|
entity("climate.status", "heat", { symcon_id: 3, symcon_variable_type: 1, symcon_value: 2, symcon_formatted: "Besprechung" }),
|
||||||
|
entity("light.alias", "on", { symcon_id: 3, symcon_variable_type: 1, symcon_source_entity: "climate.status" }),
|
||||||
|
], {}, { symconObjects: [] });
|
||||||
|
assert.equal(isSymconVariable(h, "light.present", [0]), true);
|
||||||
|
assert.equal(isSymconVariable(h, "light.alias"), false);
|
||||||
|
assert.equal(isSymconVariable(h, "climate.status", [1]), true);
|
||||||
|
assert.equal(nativeBool(h.states["light.present"]), true);
|
||||||
|
assert.equal(nativeBool(h.states["cover.rain"]), false);
|
||||||
|
assert.equal(nativeText(h.states["climate.status"]), "Besprechung");
|
||||||
|
const b = emptyBuilding();
|
||||||
|
b.floors = [floorWith([box("r", 0, 0, 4, 4)])];
|
||||||
|
b.presence = [{ person: "light.present", sensor: "climate.status", name: "Hannes", room: "r" }];
|
||||||
|
assert.equal(personsInRooms(h, b)[0].name, "Hannes");
|
||||||
|
h.states["light.present"].attributes.symcon_value = false;
|
||||||
|
assert.deepEqual(personsInRooms(h, b), []);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("individual weather variables drive native rain warnings and 3D wind, clouds and rain", () => {
|
||||||
|
const raw = hassOf([
|
||||||
|
entity("cover.rain", "open", { symcon_id: 1, symcon_variable_type: 0, symcon_value: false }),
|
||||||
|
entity("climate.wind", "heat", { symcon_id: 2, symcon_numeric_value: 10, unit_of_measurement: "m/s" }),
|
||||||
|
entity("light.gust", "on", { symcon_id: 3, symcon_numeric_value: 72, unit_of_measurement: "km/h" }),
|
||||||
|
entity("sensor.cloud", "0.6", { symcon_id: 4, symcon_numeric_value: 0.6, symcon_max: 1 }),
|
||||||
|
entity("sensor.condition", "2", { symcon_id: 5, symcon_formatted: "Leichter Regen" }),
|
||||||
|
], {}, { symconObjects: [] });
|
||||||
|
const b = emptyBuilding();
|
||||||
|
b.settings.rain_sensor = "cover.rain";
|
||||||
|
b.settings.weather_variables = { wind_speed: "climate.wind", wind_gust_speed: "light.gust", cloud_coverage: "sensor.cloud", condition: "sensor.condition" };
|
||||||
|
const view = withSymconWeather(raw, b.settings);
|
||||||
|
assert.equal(withSymconWeather(raw, b.settings), view);
|
||||||
|
assert.equal(weatherEntity(view), SYMCON_WEATHER);
|
||||||
|
assert.equal(view.states[SYMCON_WEATHER].attributes.wind_speed, 36);
|
||||||
|
assert.equal(view.states[SYMCON_WEATHER].attributes.cloud_coverage, 60);
|
||||||
|
assert.equal(readSkyWeather(view, SYMCON_WEATHER)?.rain, 0, "a dry native rain sensor wins over a stale condition alias");
|
||||||
|
assert.equal(isRaining(view, alertSources(view, b)), false);
|
||||||
|
const wet = { ...raw, states: { ...raw.states, "cover.rain": { ...raw.states["cover.rain"], attributes: { ...raw.states["cover.rain"].attributes, symcon_value: true } } } };
|
||||||
|
const wetView = withSymconWeather(wet, b.settings);
|
||||||
|
assert.ok(readSkyWeather(wetView, SYMCON_WEATHER)!.rain > 0);
|
||||||
|
assert.equal(isRaining(wetView, alertSources(wetView, b)), true);
|
||||||
|
assert.equal(readSkyWeather(wetView, SYMCON_WEATHER)?.wind, 0.72);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("wind-only weather links work without inventing a condition or requiring a Home Assistant weather entity", () => {
|
||||||
|
const b = emptyBuilding();
|
||||||
|
b.settings.weather_variables = { wind_speed: "sensor.wind" };
|
||||||
|
const h = withSymconWeather(hassOf([entity("sensor.wind", "35", { symcon_numeric_value: 35, unit_of_measurement: "km/h" })], {}, { symconObjects: [] }), b.settings);
|
||||||
|
assert.equal(h.states[SYMCON_WEATHER].state, "unknown");
|
||||||
|
assert.equal(readSkyWeather(h, SYMCON_WEATHER)?.wind, 0.5);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("German weather aliases with umlauts are recognized", () => {
|
||||||
|
const b = emptyBuilding();
|
||||||
|
b.settings.weather_variables = { condition: "sensor.condition" };
|
||||||
|
const h = withSymconWeather(hassOf([entity("sensor.condition", "3", { symcon_formatted: "Stark bewölkt", symcon_value: 3 })], {}, { symconObjects: [] }), b.settings);
|
||||||
|
assert.equal(h.states[SYMCON_WEATHER].state, "cloudy");
|
||||||
|
});
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
import type { BuildingSettings, WeatherVariableKey } from "./model.ts";
|
||||||
|
import type { HassEntity, HomeAssistant } from "./types.ts";
|
||||||
|
import { isSymcon, nativeBool, nativeNumber, nativeText, nativeValue } from "./entities/symcon-values.ts";
|
||||||
|
import { windKmh } from "./live/sky-weather.ts";
|
||||||
|
|
||||||
|
export const SYMCON_WEATHER = "weather.nextfloor_symcon";
|
||||||
|
export const WEATHER_VARIABLE_LABELS: Record<WeatherVariableKey, string> = {
|
||||||
|
condition: "Wetterzustand", temperature: "Außentemperatur", humidity: "Außenluftfeuchte", pressure: "Luftdruck",
|
||||||
|
wind_speed: "Windgeschwindigkeit", wind_gust_speed: "Windböen", wind_bearing: "Windrichtung", cloud_coverage: "Bewölkung",
|
||||||
|
precipitation: "Niederschlagsrate", precipitation_total: "Niederschlagsmenge", illuminance: "Außenhelligkeit",
|
||||||
|
uv_index: "UV-Index", visibility: "Sichtweite", snow: "Schnee", fog: "Nebel", lightning: "Gewitter",
|
||||||
|
};
|
||||||
|
const cache = new WeakMap<HomeAssistant, WeakMap<BuildingSettings, HomeAssistant>>();
|
||||||
|
|
||||||
|
function condition(text: string): string | null {
|
||||||
|
const word = text.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").trim();
|
||||||
|
if (["sunny", "clear-night", "partlycloudy", "cloudy", "fog", "rainy", "pouring", "lightning-rainy", "lightning", "hail", "snowy", "snowy-rainy", "windy", "windy-variant"].includes(word)) return word;
|
||||||
|
if (/kein regen|trocken|wolkenlos|klar|sonnig/.test(word)) return "sunny";
|
||||||
|
if (/gewitter|blitz/.test(word)) return "lightning-rainy";
|
||||||
|
if (/schneeregen/.test(word)) return "snowy-rainy";
|
||||||
|
if (/schnee/.test(word)) return "snowy";
|
||||||
|
if (/hagel/.test(word)) return "hail";
|
||||||
|
if (/starkregen/.test(word)) return "pouring";
|
||||||
|
if (/regen|niesel/.test(word)) return "rainy";
|
||||||
|
if (/nebel/.test(word)) return "fog";
|
||||||
|
if (/teil.*wolk|heiter|leicht.*wolk/.test(word)) return "partlycloudy";
|
||||||
|
if (/wolk|bedeckt/.test(word)) return "cloudy";
|
||||||
|
if (/wind|sturm/.test(word)) return "windy";
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Build the existing weather rendering inputs from individually selected native variables. */
|
||||||
|
export function withSymconWeather(hass: HomeAssistant, settings: BuildingSettings): HomeAssistant {
|
||||||
|
if (!isSymcon(hass)) return hass;
|
||||||
|
const refs = settings.weather_variables ?? {};
|
||||||
|
if (!settings.rain_sensor && !Object.values(refs).some((id) => id && id !== "none")) return hass;
|
||||||
|
const memo = cache.get(hass) ?? new WeakMap<BuildingSettings, HomeAssistant>();
|
||||||
|
cache.set(hass, memo);
|
||||||
|
const previous = memo.get(settings);
|
||||||
|
if (previous) return previous;
|
||||||
|
const a: Record<string, unknown> = { friendly_name: "Wetter", nf_symcon_weather: true };
|
||||||
|
const read = (key: keyof typeof refs) => refs[key] && refs[key] !== "none" ? hass.states[refs[key]!] : undefined;
|
||||||
|
for (const key of ["temperature", "humidity", "pressure", "cloud_coverage", "precipitation", "precipitation_total", "illuminance", "uv_index", "visibility"] as const) {
|
||||||
|
const st = read(key), n = nativeNumber(st);
|
||||||
|
if (n !== null) a[key] = key === "cloud_coverage" && st?.attributes.symcon_max === 1 ? n * 100 : n;
|
||||||
|
if (st?.attributes.unit_of_measurement) a[`${key}_unit`] = st.attributes.unit_of_measurement;
|
||||||
|
}
|
||||||
|
for (const key of ["wind_speed", "wind_gust_speed"] as const) {
|
||||||
|
const st = read(key), n = nativeNumber(st);
|
||||||
|
if (n !== null) a[key] = windKmh(n, st?.attributes.unit_of_measurement);
|
||||||
|
}
|
||||||
|
a.wind_speed_unit = "km/h";
|
||||||
|
const bearing = nativeValue(read("wind_bearing"));
|
||||||
|
if (bearing !== null) a.wind_bearing = bearing;
|
||||||
|
let state = condition(nativeText(read("condition")));
|
||||||
|
const rainSource = settings.rain_sensor ? hass.states[settings.rain_sensor] : undefined;
|
||||||
|
let rain = nativeBool(rainSource);
|
||||||
|
if (rain !== null && settings.rain_sensor_inverted) rain = !rain;
|
||||||
|
if (rain === null && typeof a.precipitation === "number") rain = a.precipitation > 0;
|
||||||
|
if (nativeBool(read("lightning"))) state = rain ? "lightning-rainy" : "lightning";
|
||||||
|
else if (nativeBool(read("snow"))) state = rain ? "snowy-rainy" : "snowy";
|
||||||
|
else if (nativeBool(read("fog"))) state = "fog";
|
||||||
|
else if (rain === true) state = Number(a.precipitation ?? 0) >= 8 ? "pouring" : "rainy";
|
||||||
|
else if (rain === false && state && /rain|pouring/.test(state)) state = null;
|
||||||
|
if (!state && typeof a.cloud_coverage === "number") state = a.cloud_coverage > 70 ? "cloudy" : a.cloud_coverage > 20 ? "partlycloudy" : "sunny";
|
||||||
|
if (!state && rain === false) state = "sunny";
|
||||||
|
const st: HassEntity = { entity_id: SYMCON_WEATHER, state: state ?? "unknown", attributes: a };
|
||||||
|
const result = { ...hass, states: { ...hass.states, [SYMCON_WEATHER]: st } };
|
||||||
|
memo.set(settings, result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ import type { HomeAssistant } from "./types.ts";
|
|||||||
|
|
||||||
/** The weather entity to show: the preferred one when it exists, otherwise the first `weather.*`. */
|
/** The weather entity to show: the preferred one when it exists, otherwise the first `weather.*`. */
|
||||||
export function weatherEntity(hass: HomeAssistant, preferred?: string | null): string | null {
|
export function weatherEntity(hass: HomeAssistant, preferred?: string | null): string | null {
|
||||||
|
if (hass.states["weather.nextfloor_symcon"]) return "weather.nextfloor_symcon";
|
||||||
if (preferred && hass.states[preferred]) return preferred;
|
if (preferred && hass.states[preferred]) return preferred;
|
||||||
return (
|
return (
|
||||||
Object.keys(hass.states)
|
Object.keys(hass.states)
|
||||||
|
|||||||
@@ -30,14 +30,28 @@ try {
|
|||||||
await page.evaluate(async () => {
|
await page.evaluate(async () => {
|
||||||
window.humidityValue = 51.6;
|
window.humidityValue = 51.6;
|
||||||
window.bootstrapCalls = 0;
|
window.bootstrapCalls = 0;
|
||||||
const raw = (id, name, type, value, unit, domain = "sensor") => ({ entity_id: `${domain}.${id}`, name, path: `Haus / DP KNX / OG Allgemein / Heizen Kühlen / RAT Teeküche / Weiterer Unterordner / Messwerte / ${name}`, state: domain === "cover" ? "open" : String(value), attributes: { symcon_id: id, symcon_variable_type: type, symcon_numeric_value: value, unit_of_measurement: unit } });
|
window.nativeCalls = [];
|
||||||
|
window.presenceValue = true;
|
||||||
|
window.rainValue = false;
|
||||||
|
const raw = (id, name, type, value, unit, domain = "sensor") => ({ entity_id: `${domain}.${id}`, name, path: `Haus / DP KNX / OG Allgemein / Heizen Kühlen / RAT Teeküche / Weiterer Unterordner / Messwerte / ${name}`, state: domain === "cover" ? "open" : String(value), attributes: { symcon_id: id, symcon_variable_type: type, symcon_value: value, symcon_numeric_value: typeof value === "number" ? value : undefined, symcon_formatted: `${String(value).replace(".", ",")}${unit ? ` ${unit}` : ""}`, unit_of_measurement: unit } });
|
||||||
const originalFetch = window.fetch;
|
const originalFetch = window.fetch;
|
||||||
window.fetch = async (url, init) => {
|
window.fetch = async (url, init) => {
|
||||||
if (!String(url).includes("/hook/climate-fixture/")) return originalFetch(url, init);
|
if (!String(url).includes("/hook/climate-fixture/")) return originalFetch(url, init);
|
||||||
|
const request = JSON.parse(init.body);
|
||||||
|
if (request.action === "variables/action") { window.nativeCalls.push(request); return new Response("[]"); }
|
||||||
window.bootstrapCalls++;
|
window.bootstrapCalls++;
|
||||||
const variables = [raw(201, "Raumtemperatur", 2, 21.5, "°C"), raw(202, "Messwert Raumfeuchtigkeit", 2, window.humidityValue, "%", "cover"), raw(203, "CO₂", 1, 780, "ppm"), raw(204, "Raumhelligkeit", 2, 320.5, "lx"), raw(205, "Zusatztemperatur", 2, 21.5, "°C")];
|
const variables = [raw(201, "Raumtemperatur", 2, 21.5, "°C"), raw(202, "Messwert Raumfeuchtigkeit", 2, window.humidityValue, "%", "cover"), raw(203, "CO₂", 1, 780, "ppm"), raw(204, "Raumhelligkeit", 2, 320.5, "lx"), raw(205, "Zusatztemperatur", 2, 21.5, "°C")];
|
||||||
|
const heating = raw(206, "Fußbodenheizung Wert", 1, 35, "%", "sensor");
|
||||||
|
Object.assign(heating.attributes, { symcon_has_action: true, symcon_min: 0, symcon_max: 100, symcon_step: 1 });
|
||||||
|
const reheat = raw(211, "Nachheizregister Wert", 0, true, "", "light");
|
||||||
|
reheat.attributes.symcon_has_action = true;
|
||||||
|
const status = raw(212, "Raumstatus Alias", 1, 2, "", "climate");
|
||||||
|
status.attributes.symcon_formatted = "Besprechung";
|
||||||
|
variables.push(heating, raw(207, "Zuluft Volumenstrom", 2, 120, "m³/h"), raw(208, "Abluft Volumenstrom", 2, 110, "m³/h"), raw(209, "Zuluft Temperatur", 2, 19.6, "°C"), raw(210, "Abluft Temperatur", 2, 22.3, "°C"), reheat, status,
|
||||||
|
raw(213, "Hannes anwesend", 0, window.presenceValue, "", "light"), raw(214, "Regenkontakt", 0, window.rainValue, "", "cover"), raw(215, "Windmessung", 2, 8, "m/s", "climate"), raw(216, "Wolkenmessung", 1, 65, "%"));
|
||||||
|
for (const id of [217, 218]) variables.push({ entity_id: `schedule.${id}`, name: id === 217 ? "Heizzeiten" : "Lüftungszeiten", path: `Haus / Schaltuhren / ${id === 217 ? "Heizzeiten" : "Lüftungszeiten"}`, state: "on", attributes: { symcon_id: id, symcon_schedule: true, next_run: 1794387600, next_action: 2, actions: [{ id: 1, name: "Nacht", color: 255 }, { id: 2, name: "Tag", color: 16711680 }], groups: [{ id: 0, days: 31, points: [{ hour: 6, minute: 30, second: 0, action: 2 }, { hour: 20, minute: 0, second: 0, action: 1 }] }] } });
|
||||||
const objects = [{ object_id: 100, parent_id: 0, name: "Haus", path: "Haus", object_type: 0, position: 0, hidden: true, icon: "" },
|
const objects = [{ object_id: 100, parent_id: 0, name: "Haus", path: "Haus", object_type: 0, position: 0, hidden: true, icon: "" },
|
||||||
...variables.map((v) => ({ object_id: v.attributes.symcon_id, parent_id: 100, entity_id: v.entity_id, name: v.name, path: v.path, object_type: 2, position: 0, hidden: false, icon: "" }))];
|
...variables.map((v) => ({ object_id: v.attributes.symcon_id, parent_id: 100, entity_id: v.entity_id, name: v.name, path: v.path, object_type: v.attributes.symcon_schedule ? 4 : 2, position: 0, hidden: false, icon: "" }))];
|
||||||
return new Response(JSON.stringify({ state_revision: window.bootstrapCalls, building_revision: 1, variables, objects, areas: [] }));
|
return new Response(JSON.stringify({ state_revision: window.bootstrapCalls, building_revision: 1, variables, objects, areas: [] }));
|
||||||
};
|
};
|
||||||
window.__NEXTFLOOR_SYMCON__ = { endpoint: "/hook/climate-fixture", token: "fixture-only" };
|
window.__NEXTFLOOR_SYMCON__ = { endpoint: "/hook/climate-fixture", token: "fixture-only" };
|
||||||
@@ -47,7 +61,7 @@ try {
|
|||||||
const p = window.nfPanel;
|
const p = window.nfPanel;
|
||||||
const apply = () => {
|
const apply = () => {
|
||||||
const h = bridge.snapshot();
|
const h = bridge.snapshot();
|
||||||
p.hass = { ...p.hass, language: "de", states: h.states, entities: h.entities, symconObjects: h.symconObjects, symconRefresh: h.symconRefresh };
|
p.hass = { ...p.hass, language: "de", states: h.states, entities: h.entities, symconObjects: h.symconObjects, symconRefresh: h.symconRefresh, callService: h.callService };
|
||||||
};
|
};
|
||||||
apply();
|
apply();
|
||||||
bridge.onChange(apply);
|
bridge.onChange(apply);
|
||||||
@@ -66,8 +80,8 @@ try {
|
|||||||
const section = [...e.shadowRoot.querySelectorAll("details.nf-points")].find((d) => d.querySelector("summary").textContent === "Raumklima");
|
const section = [...e.shadowRoot.querySelectorAll("details.nf-points")].find((d) => d.querySelector("summary").textContent === "Raumklima");
|
||||||
section.open = true;
|
section.open = true;
|
||||||
window.climateSection = section;
|
window.climateSection = section;
|
||||||
window.pickClimate = async (label, id, name) => {
|
window.pickNative = async (scope, label, id, name) => {
|
||||||
const field = [...window.climateSection.querySelectorAll("label.nf-field")].find((el) => el.textContent.trim().startsWith(label));
|
const field = [...scope.querySelectorAll("label.nf-field")].find((el) => el.textContent.trim().startsWith(label));
|
||||||
const picker = field.querySelector("nf-entity-picker");
|
const picker = field.querySelector("nf-entity-picker");
|
||||||
await picker.updateComplete;
|
await picker.updateComplete;
|
||||||
const native = picker.shadowRoot.querySelector("nf-symcon-object-picker");
|
const native = picker.shadowRoot.querySelector("nf-symcon-object-picker");
|
||||||
@@ -84,11 +98,28 @@ try {
|
|||||||
await native.updateComplete;
|
await native.updateComplete;
|
||||||
native.shadowRoot.querySelector(".apply").click();
|
native.shadowRoot.querySelector(".apply").click();
|
||||||
await e.updateComplete;
|
await e.updateComplete;
|
||||||
|
await window.nfPanel.updateComplete;
|
||||||
|
await e.updateComplete;
|
||||||
};
|
};
|
||||||
|
window.pickClimate = (label, id, name) => window.pickNative(window.climateSection, label, id, name);
|
||||||
await window.pickClimate("Temperatur", 201, "Raumtemperatur");
|
await window.pickClimate("Temperatur", 201, "Raumtemperatur");
|
||||||
await window.pickClimate("Luftfeuchte", 202, "Messwert Raumfeuchtigkeit");
|
await window.pickClimate("Luftfeuchte", 202, "Messwert Raumfeuchtigkeit");
|
||||||
await window.pickClimate("CO₂", 203, "CO₂");
|
await window.pickClimate("CO₂", 203, "CO₂");
|
||||||
await window.pickClimate("Helligkeit", 204, "Raumhelligkeit");
|
await window.pickClimate("Helligkeit", 204, "Raumhelligkeit");
|
||||||
|
for (const [label, id, name] of [["Fußbodenheizung", 206, "Fußbodenheizung Wert"], ["Zuluft-VSR", 207, "Zuluft Volumenstrom"], ["Abluft-VSR", 208, "Abluft Volumenstrom"], ["Zulufttemperatur", 209, "Zuluft Temperatur"], ["Ablufttemperatur", 210, "Abluft Temperatur"], ["NHR", 211, "Nachheizregister Wert"], ["Raumstatus", 212, "Raumstatus Alias"], ["Schaltuhr hinzufügen", 217, "Heizzeiten"], ["Schaltuhr hinzufügen", 218, "Lüftungszeiten"]]) await window.pickClimate(label, id, name);
|
||||||
|
if (/Durchsagen|Ruhezeit für Durchsagen/.test(e.shadowRoot.textContent)) throw new Error("Announcement fields remain in the Symcon room form");
|
||||||
|
const panel = document.createElement("nf-room-panel");
|
||||||
|
Object.assign(panel, { hass: window.nfPanel.hass, building: e._doc, floor: e._doc.floors[0], room: e._doc.floors[0].rooms[0] });
|
||||||
|
panel.style = "position:fixed;right:0;top:0;width:390px;height:100vh;z-index:2000;background:#202020";
|
||||||
|
document.body.append(panel); await panel.updateComplete;
|
||||||
|
if (!panel.shadowRoot.querySelector(".nf-rp-facts").textContent.includes("Besprechung") || panel.shadowRoot.querySelector(".nf-rp-facts").textContent.includes("Komfort")) throw new Error("Native room status did not replace the calculated comfort score");
|
||||||
|
const hvac = panel.shadowRoot.querySelector("nf-room-hvac"); await hvac.updateComplete;
|
||||||
|
hvac.shadowRoot.querySelectorAll(".schedule").forEach((d) => d.open = true);
|
||||||
|
if (hvac.shadowRoot.querySelectorAll(".schedule").length !== 2 || !hvac.shadowRoot.textContent.includes("06:30") || !hvac.shadowRoot.textContent.includes("Zuluft-VSR")) throw new Error("Linked native HVAC values and schedules are missing in the room menu");
|
||||||
|
const input = hvac.shadowRoot.querySelector('input[type="number"]'); input.value = "25"; input.dispatchEvent(new Event("change", { bubbles: true }));
|
||||||
|
const clock = hvac.shadowRoot.querySelector('.schedule input[type="checkbox"]'); clock.click();
|
||||||
|
await hvac.updateComplete;
|
||||||
|
window.nativeRoomPanel = panel;
|
||||||
await window.pickClimate("… und noch ein Sensor", 205, "Zusatztemperatur");
|
await window.pickClimate("… und noch ein Sensor", 205, "Zusatztemperatur");
|
||||||
window.unlinkTemperature = async () => {
|
window.unlinkTemperature = async () => {
|
||||||
const field = [...window.climateSection.querySelectorAll("label.nf-field")].find((el) => el.textContent.trim().startsWith("Temperatur"));
|
const field = [...window.climateSection.querySelectorAll("label.nf-field")].find((el) => el.textContent.trim().startsWith("Temperatur"));
|
||||||
@@ -119,10 +150,37 @@ try {
|
|||||||
section2.open = true;
|
section2.open = true;
|
||||||
[...section2.querySelectorAll("label.nf-check")].find((el) => el.textContent.includes("schwebende Karte")).querySelector("input").click();
|
[...section2.querySelectorAll("label.nf-check")].find((el) => el.textContent.includes("schwebende Karte")).querySelector("input").click();
|
||||||
await e.updateComplete;
|
await e.updateComplete;
|
||||||
|
e.selectItem("room", null);
|
||||||
|
await e.updateComplete;
|
||||||
|
if (/Wetterentität|Bluetooth-Ortung|Durchsagen/.test(e.shadowRoot.textContent)) throw new Error("Home Assistant-only weather, Bluetooth or announcement fields remain in Symcon settings");
|
||||||
|
const weather = e.shadowRoot.querySelector(".nf-symcon-weather"); weather.open = true;
|
||||||
|
for (const [label, id, name] of [[e.t("rain_sensor"), 214, "Regenkontakt"], ["Windgeschwindigkeit", 215, "Windmessung"], ["Bewölkung", 216, "Wolkenmessung"]]) await window.pickNative(e.shadowRoot.querySelector(".nf-symcon-weather"), label, id, name);
|
||||||
|
const presence = e.shadowRoot.querySelector(".nf-symcon-presence"); presence.open = true;
|
||||||
|
await window.pickNative(presence, "Person hinzufügen", 213, "Hannes anwesend");
|
||||||
|
const currentPresence = e.shadowRoot.querySelector(".nf-symcon-presence");
|
||||||
|
const personRow = () => [...e.shadowRoot.querySelectorAll(".nf-symcon-presence .nf-form")].find((row) => row.querySelector("nf-entity-picker")?.value === "light.213");
|
||||||
|
const ownName = personRow().querySelector('input[type="text"]'); ownName.value = "Hannes"; ownName.dispatchEvent(new Event("change", { bubbles: true }));
|
||||||
|
await e.updateComplete; await window.nfPanel.updateComplete; await e.updateComplete;
|
||||||
|
const roomSelect = personRow().querySelector("select"); roomSelect.value = window.climateRoomId; roomSelect.dispatchEvent(new Event("change", { bubbles: true }));
|
||||||
|
await e.updateComplete; await window.nfPanel.updateComplete; await e.updateComplete;
|
||||||
[...window.nfPanel.shadowRoot.querySelectorAll("[role=tab]")].find((b) => b.textContent.trim() === "3D").click();
|
[...window.nfPanel.shadowRoot.querySelectorAll("[role=tab]")].find((b) => b.textContent.trim() === "3D").click();
|
||||||
});
|
});
|
||||||
|
await page.waitForFunction(() => window.nativeCalls.length === 2);
|
||||||
|
assert.deepEqual(await page.evaluate(() => window.nativeCalls.map((r) => [r.domain, r.service, r.data])), [["symcon", "set_value", { entity_id: "sensor.206", value: 25 }], ["schedule", "set_active", { entity_id: "schedule.217", active: false }]]);
|
||||||
|
const out = join(root, "preview/screenshots");
|
||||||
|
mkdirSync(out, { recursive: true });
|
||||||
|
await page.screenshot({ path: join(out, "symcon-native-room-hvac.png") });
|
||||||
|
await page.evaluate(() => window.nativeRoomPanel.remove());
|
||||||
await page.waitForFunction(() => window.nfPanel.shadowRoot.querySelector("nf-view3d")?.viewer);
|
await page.waitForFunction(() => window.nfPanel.shadowRoot.querySelector("nf-view3d")?.viewer);
|
||||||
await page.evaluate(() => { window.climateView = window.nfPanel.shadowRoot.querySelector("nf-view3d"); });
|
await page.evaluate(() => { window.climateView = window.nfPanel.shadowRoot.querySelector("nf-view3d"); });
|
||||||
|
assert.equal(await page.evaluate(() => window.nfPanel.data.building.presence.some((p) => p.person === "light.213" && p.name === "Hannes")), true, "an arbitrary native Boolean is a person presence source");
|
||||||
|
assert.match(await page.evaluate(() => [...window.climateView.shadowRoot.querySelectorAll(".nf-presence-state")].find((el) => el.textContent.includes("Hannes")).textContent), /Hannes.*Anwesend/s);
|
||||||
|
assert.equal(await page.evaluate(() => window.climateView.hass.states["weather.nextfloor_symcon"].attributes.wind_speed), 28.8);
|
||||||
|
assert.equal(await page.evaluate(() => window.climateView.shadowRoot.querySelectorAll(".nf-presence-state").length), 1, "only configured native Boolean sources appear in the presence bar");
|
||||||
|
await page.evaluate(() => window.climateView.shadowRoot.querySelector(".nf-weather-values").click());
|
||||||
|
assert.equal(await page.evaluate(() => window.climateView.shadowRoot.querySelector(".nf-weather-dialog").open), true);
|
||||||
|
assert.match(await page.evaluate(() => window.climateView.shadowRoot.querySelector(".nf-weather-dialog").textContent), /Windgeschwindigkeit.*8 m\/s/s);
|
||||||
|
await page.keyboard.press("Escape");
|
||||||
await page.waitForFunction(() => window.climateView.shadowRoot.querySelector(".nf-card-toggle"));
|
await page.waitForFunction(() => window.climateView.shadowRoot.querySelector(".nf-card-toggle"));
|
||||||
assert.equal(await page.evaluate(() => window.climateView.shadowRoot.querySelector(".nf-card-toggle").getAttribute("aria-pressed")), "false");
|
assert.equal(await page.evaluate(() => window.climateView.shadowRoot.querySelector(".nf-card-toggle").getAttribute("aria-pressed")), "false");
|
||||||
await page.evaluate(() => window.climateView.shadowRoot.querySelector(".nf-card-toggle").click());
|
await page.evaluate(() => window.climateView.shadowRoot.querySelector(".nf-card-toggle").click());
|
||||||
@@ -156,10 +214,10 @@ try {
|
|||||||
[...p.shadowRoot.querySelectorAll(".nf-nav button")].find((b) => b.textContent.trim() === name).click();
|
[...p.shadowRoot.querySelectorAll(".nf-nav button")].find((b) => b.textContent.trim() === name).click();
|
||||||
});
|
});
|
||||||
await page.waitForFunction(() => window.climateView.shadowRoot.querySelectorAll(".live-card-roomclimate").length === 2);
|
await page.waitForFunction(() => window.climateView.shadowRoot.querySelectorAll(".live-card-roomclimate").length === 2);
|
||||||
await page.evaluate(() => { window.humidityValue = 62.4; window.nfPanel.shadowRoot.querySelector(".nf-reload-variables").click(); });
|
await page.evaluate(() => { window.humidityValue = 62.4; window.presenceValue = false; window.rainValue = true; window.nfPanel.shadowRoot.querySelector(".nf-reload-variables").click(); });
|
||||||
await page.waitForFunction(() => window.climateView.shadowRoot.querySelector(`.live-card[data-room="${window.climateRoomId}"]`).textContent.includes("62 %"));
|
await page.waitForFunction(() => window.climateView.shadowRoot.querySelector(`.live-card[data-room="${window.climateRoomId}"]`).textContent.includes("62 %"));
|
||||||
const out = join(root, "preview/screenshots");
|
assert.match(await page.evaluate(() => [...window.climateView.shadowRoot.querySelectorAll(".nf-presence-state")].find((el) => el.textContent.includes("Hannes")).textContent), /Abwesend/);
|
||||||
mkdirSync(out, { recursive: true });
|
assert.equal(await page.evaluate(() => window.climateView.hass.states["weather.nextfloor_symcon"].state), "rainy");
|
||||||
await page.waitForFunction(() => [...window.climateView.shadowRoot.querySelectorAll(".live-card-roomclimate")].every((c) => c.style.visibility === "visible"));
|
await page.waitForFunction(() => [...window.climateView.shadowRoot.querySelectorAll(".live-card-roomclimate")].every((c) => c.style.visibility === "visible"));
|
||||||
await page.screenshot({ path: join(out, "symcon-climate-desktop.png") });
|
await page.screenshot({ path: join(out, "symcon-climate-desktop.png") });
|
||||||
await page.setViewport({ width: 390, height: 844 });
|
await page.setViewport({ width: 390, height: 844 });
|
||||||
|
|||||||
@@ -1,28 +1,28 @@
|
|||||||
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
|
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
|
||||||
var p={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",fr:"6312d0f61ebf",hu:"27ba348531dc",it:"1b705e76dd00",nb:"c5ea24fb9ef6",nl:"b64142c67c2e",pl:"8527a4930402",pt:"31857a2d2277",ro:"e3cb5f449f0f",sk:"320611594db0",sl:"8071691ceda3",sv:"711b911ec8da",tr:"7c83ce1c3372",zh:"50518d9f494e"};var M=globalThis,N=M.ShadowRoot&&(M.ShadyCSS===void 0||M.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,V=Symbol(),me=new WeakMap,R=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==V)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(N&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=me.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&me.set(t,e))}return e}toString(){return this.cssText}},pe=i=>new R(typeof i=="string"?i:i+"",void 0,V),U=(i,...e)=>{let t=i.length===1?i[0]:e.reduce((n,r,o)=>n+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+i[o+1],i[0]);return new R(t,i,V)},fe=(i,e)=>{if(N)i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),r=M.litNonce;r!==void 0&&n.setAttribute("nonce",r),n.textContent=t.cssText,i.appendChild(n)}},j=N?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return pe(t)})(i):i;var{is:Ke,defineProperty:Ge,getOwnPropertyDescriptor:Oe,getOwnPropertyNames:Ie,getOwnPropertySymbols:Ze,getPrototypeOf:Ve}=Object,C=globalThis,ge=C.trustedTypes,Ue=ge?ge.emptyScript:"",je=C.reactiveElementPolyfillSupport,F=(i,e)=>i,q={toAttribute(i,e){switch(e){case Boolean:i=i?Ue:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},we=(i,e)=>!Ke(i,e),be={attribute:!0,type:String,converter:q,reflect:!1,useDefault:!1,hasChanged:we};Symbol.metadata??=Symbol("metadata"),C.litPropertyMetadata??=new WeakMap;var b=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=be){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&&Ge(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:o}=Oe(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:r,set(a){let s=r?.call(this);o?.call(this,a),this.requestUpdate(e,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??be}static _$Ei(){if(this.hasOwnProperty(F("elementProperties")))return;let e=Ve(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(F("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(F("properties"))){let t=this.properties,n=[...Ie(t),...Ze(t)];for(let r of n)this.createProperty(r,t[r])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,r]of t)this.elementProperties.set(n,r)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let r=this._$Eu(t,n);r!==void 0&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let r of n)t.unshift(j(r))}else e!==void 0&&t.push(j(e));return t}static _$Eu(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return fe(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.Line truncated
|
var m={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",fr:"6312d0f61ebf",hu:"27ba348531dc",it:"1b705e76dd00",nb:"c5ea24fb9ef6",nl:"b64142c67c2e",pl:"8527a4930402",pt:"31857a2d2277",ro:"e3cb5f449f0f",sk:"320611594db0",sl:"8071691ceda3",sv:"711b911ec8da",tr:"7c83ce1c3372",zh:"50518d9f494e"};var M=globalThis,N=M.ShadowRoot&&(M.ShadyCSS===void 0||M.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,U=Symbol(),pe=new WeakMap,R=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==U)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(N&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=pe.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&pe.set(t,e))}return e}toString(){return this.cssText}},fe=i=>new R(typeof i=="string"?i:i+"",void 0,U),j=(i,...e)=>{let t=i.length===1?i[0]:e.reduce((n,r,o)=>n+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+i[o+1],i[0]);return new R(t,i,U)},ge=(i,e)=>{if(N)i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),r=M.litNonce;r!==void 0&&n.setAttribute("nonce",r),n.textContent=t.cssText,i.appendChild(n)}},q=N?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return fe(t)})(i):i;var{is:Ge,defineProperty:Oe,getOwnPropertyDescriptor:Ie,getOwnPropertyNames:Ze,getOwnPropertySymbols:Ve,getPrototypeOf:Ue}=Object,C=globalThis,be=C.trustedTypes,je=be?be.emptyScript:"",qe=C.reactiveElementPolyfillSupport,F=(i,e)=>i,J={toAttribute(i,e){switch(e){case Boolean:i=i?je:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},ke=(i,e)=>!Ge(i,e),we={attribute:!0,type:String,converter:J,reflect:!1,useDefault:!1,hasChanged:ke};Symbol.metadata??=Symbol("metadata"),C.litPropertyMetadata??=new WeakMap;var b=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=we){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&&Oe(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:o}=Ie(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:r,set(a){let s=r?.call(this);o?.call(this,a),this.requestUpdate(e,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??we}static _$Ei(){if(this.hasOwnProperty(F("elementProperties")))return;let e=Ue(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(F("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(F("properties"))){let t=this.properties,n=[...Ze(t),...Ve(t)];for(let r of n)this.createProperty(r,t[r])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,r]of t)this.elementProperties.set(n,r)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let r=this._$Eu(t,n);r!==void 0&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let r of n)t.unshift(q(r))}else e!==void 0&&t.push(q(e));return t}static _$Eu(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ge(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.Line truncated
|
||||||
\f\r]`,x=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ye=/-->/g,Se=/>/g,S=RegExp(`>|${J}(?:([^\\s"'>=/]+)(${J}*=${J}*(?:[^
|
\f\r]`,H=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Se=/-->/g,Ae=/>/g,S=RegExp(`>|${X}(?:([^\\s"'>=/]+)(${X}*=${X}*(?:[^
|
||||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ae=/'/g,De=/"/g,Re=/^(?:script|style|textarea|title)$/i,ie=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),l=ie(1),ct=ie(2),ut=ie(3),z=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),ze=new WeakMap,A=D.createTreeWalker(D,129);function Fe(i,e){if(!re(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return ve!==void 0?ve.createHTML(e):e}var Xe=(i,e)=>{let t=i.length-1,n=[],r,o=e===2?"<svg>":e===3?"<math>":"",a=x;for(let s=0;s<t;s++){let h=i[s],u,m,_=-1,g=0;for(;g<h.length&&(a.lastIndex=g,m=a.exec(h),m!==null);)g=a.lastIndex,a===x?m[1]==="!--"?a=ye:m[1]!==void 0?a=Se:m[2]!==void 0?(Re.test(m[2])&&(r=RegExp("</"+m[2],"g")),a=S):m[3]!==void 0&&(a=S):a===S?m[0]===">"?(a=r??x,_=-1):m[1]===void 0?_=-2:(_=a.lastIndex-m[2].length,u=m[1],a=m[3]===void 0?S:m[3]==='"'?De:Ae):a===De||a===Ae?a=S:a===ye||a===Se?a=x:(a=S,r=void 0);let k=a===S&&i[s+1].startsWith("/>")?" ":"";o+=a===x?h+qe:_>=0?(n.push(u),h.slice(0,_)+Ee+h.slice(_)+v+k):h+v+(_===-2?s:k)}return[Fe(i,o+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},B=class i{constructor({strings:e,_$litType$:t},n){let r;this.parts=[];let o=0,a=0,s=e.length-1,h=this.parts,[u,m]=Xe(e,t);if(this.el=i.createElement(u,n),A.currentNode=this.el.content,t===2||t===3){let _=this.el.content.firstChild;_.replaceWith(..._.childNodes)}for(;(r=A.nextNode())!==null&&h.length<s;){if(r.nodeType===1){if(r.hasAttributes())for(let _ of r.getAttributeNames())if(_.endsWith(Ee)){let g=m[a++],k=r.getAttribute(_).split(v),L=/([.?@])?(.*)/.exec(g);h.push({type:1,index:o,name:L[2],strings:k,ctor:L[1]==="."?Y:L[1]==="?"?Q:L[1]==="@"?ee:T}),r.removeAttribute(_)}else _.startsWith(v)&&(h.push({type:6,index:o}),r.removeAttribute(_));if(Re.test(r.tagName)){let _=r.textContent.split(v),g=_.length-1;if(g>0){r.textContent=K?K.emptyScript:"";for(let k=0;k<g;k++)r.append(_[k],H()),A.nextNode(),h.push({type:2,index:++o});r.append(_[g],H())}}}else if(r.nodeType===8)if(r.data===Te)h.push({type:2,index:o});else{let _=-1;for(;(_=r.data.indexOf(v,_+1))!==-1;)h.push({type:7,index:o}),_+=v.length-1}o++}}static createElement(e,t){let n=D.createElement("template");return n.innerHTML=e,n}};function E(i,e,t=i,n){if(e===z)return e;let r=n!==void 0?t._$Co?.[n]:t._$Cl,o=W(e)?void 0:e._$litDirective$;return r?.constructor!==o&&(r?._$AO?.(!1),o===void 0?r=void 0:(r=new o(i),r._$AT(i,t,n)),n!==void 0?(t._$Co??=[])[n]=r:t._$Cl=r),r!==void 0&&(e=E(i,r._$AS(i,e.values),r,n)),e}var X=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??D).importNode(t,!0);A.currentNode=r;let o=A.nextNode(),a=0,s=0,h=n[0];for(;h!==void 0;){if(a===h.index){let u;h.type===2?u=new P(o,o.nextSibling,this,e):h.type===1?u=new h.ctor(o,h.name,h.strings,this,e):h.type===6&&(u=new te(o,this,e)),this._$AV.push(u),h=n[++s]}a!==h?.index&&(o=A.nextNode(),a++)}return A.currentNode=D,r}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},P=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=E(this,e,t),W(e)?e===d||e==null||e===""?(this._$AH!==d&&this._$AR(),this._$AH=d):e!==this._$AH&&e!==z&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Je(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==d&&W(this._$AH)?this._$AA.nextSibling.data=e:this.T(D.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,r=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=B.createElement(Fe(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{let o=new X(r,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=ze.get(e.strings);return t===void 0&&ze.set(e.strings,t=new B(e)),t}k(e){re(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,r=0;for(let o of e)r===t.length?t.push(n=new i(this.O(H()),this.O(H()),this,this.options)):n=t[r],n._$AI(o),r++;r<t.length&&(this._$AR(n&&n._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=ke(e).nextSibling;ke(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},T=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,o){this.type=1,this._$AH=d,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=o,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):thiLine truncated
|
\f\r"'\`<>=]|("|')|))|$)`,"g"),De=/'/g,ze=/"/g,Fe=/^(?:script|style|textarea|title)$/i,oe=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),l=oe(1),ut=oe(2),mt=oe(3),z=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),Ee=new WeakMap,A=D.createTreeWalker(D,129);function He(i,e){if(!ie(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return ye!==void 0?ye.createHTML(e):e}var Ye=(i,e)=>{let t=i.length-1,n=[],r,o=e===2?"<svg>":e===3?"<math>":"",a=H;for(let s=0;s<t;s++){let h=i[s],u,p,_=-1,g=0;for(;g<h.length&&(a.lastIndex=g,p=a.exec(h),p!==null);)g=a.lastIndex,a===H?p[1]==="!--"?a=Se:p[1]!==void 0?a=Ae:p[2]!==void 0?(Fe.test(p[2])&&(r=RegExp("</"+p[2],"g")),a=S):p[3]!==void 0&&(a=S):a===S?p[0]===">"?(a=r??H,_=-1):p[1]===void 0?_=-2:(_=a.lastIndex-p[2].length,u=p[1],a=p[3]===void 0?S:p[3]==='"'?ze:De):a===ze||a===De?a=S:a===Se||a===Ae?a=H:(a=S,r=void 0);let k=a===S&&i[s+1].startsWith("/>")?" ":"";o+=a===H?h+Je:_>=0?(n.push(u),h.slice(0,_)+Te+h.slice(_)+v+k):h+v+(_===-2?s:k)}return[He(i,o+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},B=class i{constructor({strings:e,_$litType$:t},n){let r;this.parts=[];let o=0,a=0,s=e.length-1,h=this.parts,[u,p]=Ye(e,t);if(this.el=i.createElement(u,n),A.currentNode=this.el.content,t===2||t===3){let _=this.el.content.firstChild;_.replaceWith(..._.childNodes)}for(;(r=A.nextNode())!==null&&h.length<s;){if(r.nodeType===1){if(r.hasAttributes())for(let _ of r.getAttributeNames())if(_.endsWith(Te)){let g=p[a++],k=r.getAttribute(_).split(v),L=/([.?@])?(.*)/.exec(g);h.push({type:1,index:o,name:L[2],strings:k,ctor:L[1]==="."?Q:L[1]==="?"?ee:L[1]==="@"?te:T}),r.removeAttribute(_)}else _.startsWith(v)&&(h.push({type:6,index:o}),r.removeAttribute(_));if(Fe.test(r.tagName)){let _=r.textContent.split(v),g=_.length-1;if(g>0){r.textContent=K?K.emptyScript:"";for(let k=0;k<g;k++)r.append(_[k],x()),A.nextNode(),h.push({type:2,index:++o});r.append(_[g],x())}}}else if(r.nodeType===8)if(r.data===Re)h.push({type:2,index:o});else{let _=-1;for(;(_=r.data.indexOf(v,_+1))!==-1;)h.push({type:7,index:o}),_+=v.length-1}o++}}static createElement(e,t){let n=D.createElement("template");return n.innerHTML=e,n}};function E(i,e,t=i,n){if(e===z)return e;let r=n!==void 0?t._$Co?.[n]:t._$Cl,o=W(e)?void 0:e._$litDirective$;return r?.constructor!==o&&(r?._$AO?.(!1),o===void 0?r=void 0:(r=new o(i),r._$AT(i,t,n)),n!==void 0?(t._$Co??=[])[n]=r:t._$Cl=r),r!==void 0&&(e=E(i,r._$AS(i,e.values),r,n)),e}var Y=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??D).importNode(t,!0);A.currentNode=r;let o=A.nextNode(),a=0,s=0,h=n[0];for(;h!==void 0;){if(a===h.index){let u;h.type===2?u=new P(o,o.nextSibling,this,e):h.type===1?u=new h.ctor(o,h.name,h.strings,this,e):h.type===6&&(u=new ne(o,this,e)),this._$AV.push(u),h=n[++s]}a!==h?.index&&(o=A.nextNode(),a++)}return A.currentNode=D,r}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},P=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=E(this,e,t),W(e)?e===d||e==null||e===""?(this._$AH!==d&&this._$AR(),this._$AH=d):e!==this._$AH&&e!==z&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Xe(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==d&&W(this._$AH)?this._$AA.nextSibling.data=e:this.T(D.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,r=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=B.createElement(He(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{let o=new Y(r,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=Ee.get(e.strings);return t===void 0&&Ee.set(e.strings,t=new B(e)),t}k(e){ie(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,r=0;for(let o of e)r===t.length?t.push(n=new i(this.O(x()),this.O(x()),this,this.options)):n=t[r],n._$AI(o),r++;r<t.length&&(this._$AR(n&&n._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=ve(e).nextSibling;ve(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},T=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,o){this.type=1,this._$AH=d,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=o,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):thLine truncated
|
||||||
<input type="checkbox" .checked=${e} @change=${o=>r(nt(o))} />
|
<input type="checkbox" .checked=${e} @change=${o=>r(rt(o))} />
|
||||||
<span>${i.t(t)}${n?l`<small>${i.t(n)}</small>`:d}</span>
|
<span>${i.t(t)}${n?l`<small>${i.t(n)}</small>`:d}</span>
|
||||||
</label>`}var c=(i,e,t,n)=>f(i,i.value[e],t,n,r=>i.set(e,r)),se=(i,e,t,n)=>f(i,i.value[e],t,n,r=>i.set(e,r||void 0));function w(i,e,t,n,r){return l`<label class="field"
|
</label>`}var c=(i,e,t,n)=>f(i,i.value[e],t,n,r=>i.set(e,r)),le=(i,e,t,n)=>f(i,i.value[e],t,n,r=>i.set(e,r||void 0));function w(i,e,t,n,r){return l`<label class="field"
|
||||||
>${i.t(t)}
|
>${i.t(t)}
|
||||||
<select @change=${o=>i.set(e,O(o))}>
|
<select @change=${o=>i.set(e,O(o))}>
|
||||||
${n.map(([o,a])=>l`<option value=${o} ?selected=${o===r}>${i.t(a)}</option>`)}
|
${n.map(([o,a])=>l`<option value=${o} ?selected=${o===r}>${i.t(a)}</option>`)}
|
||||||
</select>
|
</select>
|
||||||
</label>`}function le(i,e,t,n){return l`<label class="field"
|
</label>`}function he(i,e,t,n){return l`<label class="field"
|
||||||
>${i.t(t)}
|
>${i.t(t)}
|
||||||
<select @change=${r=>i.set(e,Number(O(r))||void 0)}>
|
<select @change=${r=>i.set(e,Number(O(r))||void 0)}>
|
||||||
${n.map(r=>l`<option value=${r.value} ?selected=${i.value[e]===r.value}>${r.text}</option>`)}
|
${n.map(r=>l`<option value=${r.value} ?selected=${i.value[e]===r.value}>${r.text}</option>`)}
|
||||||
</select>
|
</select>
|
||||||
</label>`}function I(i,e,t,n=""){return l`<label class="field wide"
|
</label>`}function I(i,e,t,n=""){return l`<label class="field wide"
|
||||||
>${i.t(t)}
|
>${i.t(t)}
|
||||||
<input type="text" placeholder=${n} .value=${i.value[e]??""} @change=${r=>i.set(e,tt(r).trim()||void 0)} />
|
<input type="text" placeholder=${n} .value=${i.value[e]??""} @change=${r=>i.set(e,nt(r).trim()||void 0)} />
|
||||||
</label>`}function he(i,e,t,n){let r=n===void 0?"switch":n?"on":"off",o=[["switch","card_flows_switch"],["on","card_flows_on"],["off","card_flows_off"]];return l`<label class="field wide"
|
</label>`}function de(i,e,t,n){let r=n===void 0?"switch":n?"on":"off",o=[["switch","card_flows_switch"],["on","card_flows_on"],["off","card_flows_off"]];return l`<label class="field wide"
|
||||||
>${i.t(t)}
|
>${i.t(t)}
|
||||||
<select @change=${a=>i.set(e,O(a)==="switch"?void 0:O(a)==="on")}>
|
<select @change=${a=>i.set(e,O(a)==="switch"?void 0:O(a)==="on")}>
|
||||||
${o.map(([a,s])=>l`<option value=${a} ?selected=${r===a}>${i.t(s)}</option>`)}
|
${o.map(([a,s])=>l`<option value=${a} ?selected=${r===a}>${i.t(s)}</option>`)}
|
||||||
</select>
|
</select>
|
||||||
</label>`}var Pe=U`
|
</label>`}var $e=j`
|
||||||
:host {
|
:host {
|
||||||
display: block;
|
display: block;
|
||||||
color: var(--primary-text-color);
|
color: var(--primary-text-color);
|
||||||
@@ -115,7 +115,7 @@ var p={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",f
|
|||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;var ce=globalThis,de=ce.__nextfloorBuiltin?.de??{},_e=ce.__nextfloorBuiltin?.en??{};ce.__nextfloorBuiltin??={de,en:_e};var $e=()=>typeof p=="object"&&p||{},rt=globalThis,Z=rt.__nextfloorTexts??=new Map;function Le(i){let e=i.toLowerCase().split("-")[0];return e!=="de"&&e!=="en"&&e in $e()?e:void 0}function it(i){let e=Le(i),t=e===void 0?void 0:Z.get(e);return t instanceof Promise?void 0:t}function Me(i,e){let t=Le(i?.language??navigator.language);if(t===void 0)return!1;let n=Z.get(t);return n===void 0&&(n=fetch(new URL(`./lang/${t}.json?v=${$e()[t]}`,import.meta.url)).then(r=>r.ok?r.json():{}).catch(()=>({})).then(r=>{Z.set(t,r&&typeof r=="object"?r:{})}),Z.set(t,n)),n instanceof Promise?(n.then(()=>e.requestUpdate()),!0):!1}function Ne(i,e,t={}){let n=i?.language??navigator.language,r=n.startsWith("de"),o=(r?void 0:it(n)?.[e])??(r?de:_e)[e]??_e[e]??de[e]??e;for(let[a,s]of Object.entries(t))o=o.replace(`{${a}}`,String(s));return o}var ue=class extends y{static properties={hass:{attribute:!1},_config:{state:!0},_floors:{state:!0},_rooms:{state:!0},_templates:{state:!0}};loading=!1;form;constructor(){super(),this._config={type:"custom:nextfloor-card"},this._floors=[],this._rooms=[],this._templates=[];let e=this;this.form={get value(){return{...ae,...e._config}},t:(t,n)=>Ne(e.hass,t,n),set:(t,n)=>e.write(t,n)}}setConfig(e){this._config=e}willUpdate(){this.hass&&!this.loading&&this._floors.length===0&&(this.loading=!0,He(this.hass).then(e=>{this._floors=e.building.floors.map(t=>({id:t.id,name:t.name})),this._templates=Object.keys(e.building.settings.card_templates??{}),this._rooms=e.building.floors.flatMap(t=>t.rooms.map(n=>({id:n.id,name:n.name,floor:t.name})))},()=>{}))}write(e,t){let n={...this._config};t===void 0||t===""||ae[e]===t?delete n[e]:n[e]=t,this.publish(n)}publish(e){this._config=e,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:e},bubbles:!0,composed:!0}))}roomsChoice(){if(this._rooms.length===0)return l``;let e=new Set(this._config.rooms??[]),t=(n,r)=>{let o=this._rooms.map(a=>a.id).filter(a=>a===n?r:e.has(a));this.form.set("rooms",o.length?o:void 0)};return l`<fieldset class="rooms">
|
`;var ue=globalThis,_e=ue.__nextfloorBuiltin?.de??{},ce=ue.__nextfloorBuiltin?.en??{};ue.__nextfloorBuiltin??={de:_e,en:ce};var Le=()=>typeof m=="object"&&m||{},it=globalThis,Z=it.__nextfloorTexts??=new Map;function Me(i){let e=i.toLowerCase().split("-")[0];return e!=="de"&&e!=="en"&&e in Le()?e:void 0}function ot(i){let e=Me(i),t=e===void 0?void 0:Z.get(e);return t instanceof Promise?void 0:t}function Ne(i,e){let t=Me(i?.language??navigator.language);if(t===void 0)return!1;let n=Z.get(t);return n===void 0&&(n=fetch(new URL(`./lang/${t}.json?v=${Le()[t]}`,import.meta.url)).then(r=>r.ok?r.json():{}).catch(()=>({})).then(r=>{Z.set(t,r&&typeof r=="object"?r:{})}),Z.set(t,n)),n instanceof Promise?(n.then(()=>e.requestUpdate()),!0):!1}function Ce(i,e,t={}){let n=i?.language??navigator.language,r=n.startsWith("de"),o=(r?void 0:ot(n)?.[e])??(r?_e:ce)[e]??ce[e]??_e[e]??e;for(let[a,s]of Object.entries(t))o=o.replace(`{${a}}`,String(s));return o}var V=i=>i?.symconObjects!==void 0;var me=class extends y{static properties={hass:{attribute:!1},_config:{state:!0},_floors:{state:!0},_rooms:{state:!0},_templates:{state:!0}};loading=!1;form;constructor(){super(),this._config={type:"custom:nextfloor-card"},this._floors=[],this._rooms=[],this._templates=[];let e=this;this.form={get value(){return{...se,...e._config}},t:(t,n)=>Ce(e.hass,t,n),set:(t,n)=>e.write(t,n)}}setConfig(e){this._config=e}willUpdate(){this.hass&&!this.loading&&this._floors.length===0&&(this.loading=!0,We(this.hass).then(e=>{this._floors=e.building.floors.map(t=>({id:t.id,name:t.name})),this._templates=Object.keys(e.building.settings.card_templates??{}),this._rooms=e.building.floors.flatMap(t=>t.rooms.map(n=>({id:n.id,name:n.name,floor:t.name})))},()=>{}))}write(e,t){let n={...this._config};t===void 0||t===""||se[e]===t?delete n[e]:n[e]=t,this.publish(n)}publish(e){this._config=e,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:e},bubbles:!0,composed:!0}))}roomsChoice(){if(this._rooms.length===0)return l``;let e=new Set(this._config.rooms??[]),t=(n,r)=>{let o=this._rooms.map(a=>a.id).filter(a=>a===n?r:e.has(a));this.form.set("rooms",o.length?o:void 0)};return l`<fieldset class="rooms">
|
||||||
<legend>${this.form.t("card_rooms")}</legend>
|
<legend>${this.form.t("card_rooms")}</legend>
|
||||||
<small>${this.form.t("card_rooms_hint")}</small>
|
<small>${this.form.t("card_rooms_hint")}</small>
|
||||||
${this._rooms.map(n=>l`<label class="toggle"><input type="checkbox" .checked=${e.has(n.id)} @change=${r=>t(n.id,r.target.checked)} /><span>${this._floors.length>1?`${n.floor} \xB7 `:""}${n.name}</span></label>`)}
|
${this._rooms.map(n=>l`<label class="toggle"><input type="checkbox" .checked=${e.has(n.id)} @change=${r=>t(n.id,r.target.checked)} /><span>${this._floors.length>1?`${n.floor} \xB7 `:""}${n.name}</span></label>`)}
|
||||||
@@ -124,8 +124,8 @@ var p={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",f
|
|||||||
${f(e,e.value.lock_button!==!1,"card_lock_button",void 0,s=>e.set("lock_button",s?void 0:!1))}
|
${f(e,e.value.lock_button!==!1,"card_lock_button",void 0,s=>e.set("lock_button",s?void 0:!1))}
|
||||||
${f(e,e.value.walk_button!==!1,"card_walk_button",void 0,s=>e.set("walk_button",s?void 0:!1))}
|
${f(e,e.value.walk_button!==!1,"card_walk_button",void 0,s=>e.set("walk_button",s?void 0:!1))}
|
||||||
${f(e,e.value.time_travel!==!1,"card_travel_button",void 0,s=>e.set("time_travel",s?void 0:!1))}
|
${f(e,e.value.time_travel!==!1,"card_travel_button",void 0,s=>e.set("time_travel",s?void 0:!1))}
|
||||||
${se(e,"marker_names","card_marker_names","card_marker_names_hint")} ${se(e,"controls_hidden","card_controls_hidden","card_controls_hidden_hint")}
|
${le(e,"marker_names","card_marker_names","card_marker_names_hint")} ${le(e,"controls_hidden","card_controls_hidden","card_controls_hidden_hint")}
|
||||||
${le(e,"controls_hide_after","card_controls_hide_after",a)}
|
${he(e,"controls_hide_after","card_controls_hide_after",a)}
|
||||||
${n?l`<div class="sub">
|
${n?l`<div class="sub">
|
||||||
${$.map(s=>l`<label class="chip">
|
${$.map(s=>l`<label class="chip">
|
||||||
<input
|
<input
|
||||||
@@ -137,7 +137,7 @@ var p={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",f
|
|||||||
</label>`)}
|
</label>`)}
|
||||||
</div>`:d}`}kioskSection(){let e=this.form,{night:t}=e.value,n=t==="off"||t==="sun"?t:"time",r=[0,1,2,5,10].map(a=>({value:a*60,text:a?e.t("card_idle_min",{n:a}):e.t("card_idle_off")})),o=[["off","card_night_off"],["sun","card_night_sun"],["time","card_night_time"]];return l`<h3>${e.t("card_section_kiosk")}</h3>
|
</div>`:d}`}kioskSection(){let e=this.form,{night:t}=e.value,n=t==="off"||t==="sun"?t:"time",r=[0,1,2,5,10].map(a=>({value:a*60,text:a?e.t("card_idle_min",{n:a}):e.t("card_idle_off")})),o=[["off","card_night_off"],["sun","card_night_sun"],["time","card_night_time"]];return l`<h3>${e.t("card_section_kiosk")}</h3>
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
${le(e,"idle_return","card_idle_return",r)}
|
${he(e,"idle_return","card_idle_return",r)}
|
||||||
<label class="field"
|
<label class="field"
|
||||||
>${e.t("card_night")}
|
>${e.t("card_night")}
|
||||||
<select @change=${a=>e.set("night",{off:void 0,sun:"sun",time:"22:00-06:00"}[a.target.value])}>
|
<select @change=${a=>e.set("night",{off:void 0,sun:"sun",time:"22:00-06:00"}[a.target.value])}>
|
||||||
@@ -169,17 +169,17 @@ var p={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",f
|
|||||||
${[.8,1,1.25,1.5,1.75,2,2.5].map(n=>l`<option value=${n} ?selected=${(e.value.zoom??1)===n}>${Math.round(n*100)} %</option>`)}
|
${[.8,1,1.25,1.5,1.75,2,2.5].map(n=>l`<option value=${n} ?selected=${(e.value.zoom??1)===n}>${Math.round(n*100)} %</option>`)}
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
${c(e,"announcements","card_announcements","card_announcements_hint")}
|
${V(this.hass)?d:c(e,"announcements","card_announcements","card_announcements_hint")}
|
||||||
${e.value.announcements!==!1?l`<div class="grid">${I(e,"screen_name","screen_name")}</div>`:d}
|
${!V(this.hass)&&e.value.announcements!==!1?l`<div class="grid">${I(e,"screen_name","screen_name")}</div>`:d}
|
||||||
${c(e,"weather","card_weather","card_weather_hint")}
|
${c(e,"weather","card_weather","card_weather_hint")}
|
||||||
${e.value.weather!==!1?l`<div class="grid">
|
${e.value.weather!==!1?l`<div class="grid">
|
||||||
<label class="field wide"
|
${V(this.hass)?d:l`<label class="field wide"
|
||||||
>${e.t("weather_entity")}
|
>${e.t("weather_entity")}
|
||||||
<select @change=${n=>e.set("weather_entity",n.target.value||void 0)}>
|
<select @change=${n=>e.set("weather_entity",n.target.value||void 0)}>
|
||||||
<option value="" ?selected=${!e.value.weather_entity}>${e.t("card_weather_plan")}</option>
|
<option value="" ?selected=${!e.value.weather_entity}>${e.t("card_weather_plan")}</option>
|
||||||
${t.map(n=>l`<option value=${n} ?selected=${n===e.value.weather_entity}>${String(this.hass?.states[n]?.attributes.friendly_name??n)}</option>`)}
|
${t.map(n=>l`<option value=${n} ?selected=${n===e.value.weather_entity}>${String(this.hass?.states[n]?.attributes.friendly_name??n)}</option>`)}
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>`}
|
||||||
<label class="field"
|
<label class="field"
|
||||||
>${e.t("card_weather_density")}
|
>${e.t("card_weather_density")}
|
||||||
<select @change=${n=>e.set("weather_density",Number(n.target.value))}>
|
<select @change=${n=>e.set("weather_density",Number(n.target.value))}>
|
||||||
@@ -190,9 +190,9 @@ var p={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",f
|
|||||||
</div>`:d}
|
</div>`:d}
|
||||||
<p class="hint">${e.t("card_pro_hint")}</p>`}furnitureColors(e){let t=this._config.furniture_colors??{},n=(r,o)=>{let a={...t,[r]:o};o||delete a[r],e.set("furniture_colors",Object.keys(a).length?a:void 0)};return l`<details class="field">
|
<p class="hint">${e.t("card_pro_hint")}</p>`}furnitureColors(e){let t=this._config.furniture_colors??{},n=(r,o)=>{let a={...t,[r]:o};o||delete a[r],e.set("furniture_colors",Object.keys(a).length?a:void 0)};return l`<details class="field">
|
||||||
<summary>${e.t("furn_colors_card")}${Object.keys(t).length?` (${Object.keys(t).length})`:""}</summary>
|
<summary>${e.t("furn_colors_card")}${Object.keys(t).length?` (${Object.keys(t).length})`:""}</summary>
|
||||||
${We.map(r=>l`<label class="field"
|
${Be.map(r=>l`<label class="field"
|
||||||
>${e.t(`furn_color_${r}`)}
|
>${e.t(`furn_color_${r}`)}
|
||||||
<input type="color" .value=${t[r]??Be[r]} @input=${o=>n(r,o.target.value)} />
|
<input type="color" .value=${t[r]??Pe[r]} @input=${o=>n(r,o.target.value)} />
|
||||||
${t[r]?l`<button type="button" class="link" @click=${()=>n(r,null)}>${e.t("furn_color_house")}</button>`:d}
|
${t[r]?l`<button type="button" class="link" @click=${()=>n(r,null)}>${e.t("furn_color_house")}</button>`:d}
|
||||||
</label>`)}
|
</label>`)}
|
||||||
</details>`}viewSection(){let e=this.form,t=e.value;return l`<h3>${e.t("card_section_view")}</h3>
|
</details>`}viewSection(){let e=this.form,t=e.value;return l`<h3>${e.t("card_section_view")}</h3>
|
||||||
@@ -263,11 +263,11 @@ var p={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",f
|
|||||||
<div class="grid">
|
<div class="grid">
|
||||||
${w(e,"markers","markers",[["none","markers_none"],["important","markers_important"],["all","markers_all"]],t.markers)}
|
${w(e,"markers","markers",[["none","markers_none"],["important","markers_important"],["all","markers_all"]],t.markers)}
|
||||||
${w(e,"heatmap","heatmap",[["none","heat_off"],["temperature","heat_temperature"],["humidity","heat_humidity"],["co2","heat_co2"],["mould","heat_mould"],["values","heat_values"],["wifi","heat_wifi"]],t.heatmap)}
|
${w(e,"heatmap","heatmap",[["none","heat_off"],["temperature","heat_temperature"],["humidity","heat_humidity"],["co2","heat_co2"],["mould","heat_mould"],["values","heat_values"],["wifi","heat_wifi"]],t.heatmap)}
|
||||||
${he(e,"flows","flows",t.flows)} ${he(e,"holograms","holos",t.holograms)}
|
${de(e,"flows","flows",t.flows)} ${de(e,"holograms","holos",t.holograms)}
|
||||||
</div>
|
</div>
|
||||||
${c(e,"tap_in_room","card_tap_in_room","card_tap_in_room_hint")} ${w(e,"room_double_tap","room_double_tap",[["auto","card_room_double_tap_auto"],["area","room_double_tap_area"],["plan","room_double_tap_plan"],["off","room_double_tap_off"]],t.room_double_tap)} ${this.markersOutside()} ${this.controlsSection()} ${this.floorThumbsToggle()} ${c(e,"room_names","card_room_names")} ${c(e,"energy","card_energy")}
|
${c(e,"tap_in_room","card_tap_in_room","card_tap_in_room_hint")} ${w(e,"room_double_tap","room_double_tap",[["auto","card_room_double_tap_auto"],["area","room_double_tap_area"],["plan","room_double_tap_plan"],["off","room_double_tap_off"]],t.room_double_tap)} ${this.markersOutside()} ${this.controlsSection()} ${this.floorThumbsToggle()} ${c(e,"room_names","card_room_names")} ${c(e,"energy","card_energy")}
|
||||||
${c(e,"room_buttons","card_room_buttons","card_room_buttons_hint")} ${c(e,"room_panel","card_room_panel","card_room_panel_hint")} ${c(e,"fullscreen_button","card_fullscreen_button","card_fullscreen_button_hint")}
|
${c(e,"room_buttons","card_room_buttons","card_room_buttons_hint")} ${c(e,"room_panel","card_room_panel","card_room_panel_hint")} ${c(e,"fullscreen_button","card_fullscreen_button","card_fullscreen_button_hint")}
|
||||||
${c(e,"explode","card_explode")} ${c(e,"roof_fade","card_roof_fade","card_roof_fade_hint")} ${c(e,"stats","card_stats","card_stats_hint")}`}render(){return this.hass&&Me(this.hass,this)?d:l`${this.viewSection()} ${this.showSection()} ${this.featuresSection()} ${this.kioskSection()}`}static styles=Pe};customElements.get("nextfloor-card-editor")||customElements.define("nextfloor-card-editor",ue);export{ue as NextFloorCardEditor};
|
${c(e,"explode","card_explode")} ${c(e,"roof_fade","card_roof_fade","card_roof_fade_hint")} ${c(e,"stats","card_stats","card_stats_hint")}`}render(){return this.hass&&Ne(this.hass,this)?d:l`${this.viewSection()} ${this.showSection()} ${this.featuresSection()} ${this.kioskSection()}`}static styles=$e};customElements.get("nextfloor-card-editor")||customElements.define("nextfloor-card-editor",me);export{me as NextFloorCardEditor};
|
||||||
/*! Bundled license information:
|
/*! Bundled license information:
|
||||||
|
|
||||||
@lit/reactive-element/css-tag.js:
|
@lit/reactive-element/css-tag.js:
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -430,12 +430,41 @@ class NextFloor extends IPSModuleStrict
|
|||||||
$variables[] = $variable;
|
$variables[] = $variable;
|
||||||
$node['entity_id'] = $variable['entity_id'];
|
$node['entity_id'] = $variable['entity_id'];
|
||||||
}
|
}
|
||||||
|
if ($type === 4 && function_exists('IPS_GetEvent')) {
|
||||||
|
$event = IPS_GetEvent($objectID);
|
||||||
|
if ((int) ($event['EventType'] ?? -1) === 2) {
|
||||||
|
$schedule = $this->describeSchedule($objectID, $name, implode(' / ', $path), $event);
|
||||||
|
$variables[] = $schedule;
|
||||||
|
$node['entity_id'] = $schedule['entity_id'];
|
||||||
|
}
|
||||||
|
}
|
||||||
$nodes[] = $node;
|
$nodes[] = $node;
|
||||||
foreach (IPS_GetChildrenIDs($objectID) as $child) {
|
foreach (IPS_GetChildrenIDs($objectID) as $child) {
|
||||||
$this->collectObjects($child, $path, $nearestCategory, $variables, $areas, $nodes);
|
$this->collectObjects($child, $path, $nearestCategory, $variables, $areas, $nodes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function describeSchedule(int $eventID, string $name, string $path, array $event): array
|
||||||
|
{
|
||||||
|
// Export presentation only; action scripts and action parameters stay in Symcon.
|
||||||
|
$actions = array_map(static fn(array $action): array => [
|
||||||
|
'id' => (int) $action['ID'], 'name' => (string) $action['Name'], 'color' => (int) ($action['Color'] ?? 0)
|
||||||
|
], $event['ScheduleActions'] ?? []);
|
||||||
|
$groups = array_map(static fn(array $group): array => [
|
||||||
|
'id' => (int) $group['ID'], 'days' => (int) $group['Days'],
|
||||||
|
'points' => array_map(static fn(array $point): array => [
|
||||||
|
'id' => (int) $point['ID'], 'hour' => (int) $point['Start']['Hour'],
|
||||||
|
'minute' => (int) $point['Start']['Minute'], 'second' => (int) $point['Start']['Second'],
|
||||||
|
'action' => (int) $point['ActionID']
|
||||||
|
], $group['Points'] ?? [])
|
||||||
|
], $event['ScheduleGroups'] ?? []);
|
||||||
|
return ['entity_id' => 'schedule.' . $eventID, 'name' => $name, 'path' => $path,
|
||||||
|
'state' => ($event['EventActive'] ?? false) ? 'on' : 'off',
|
||||||
|
'attributes' => ['symcon_id' => $eventID, 'symcon_schedule' => true,
|
||||||
|
'groups' => $groups, 'actions' => $actions, 'next_run' => (int) ($event['NextRun'] ?? 0),
|
||||||
|
'next_action' => (int) ($event['NextActionID'] ?? 0), 'last_action' => (int) ($event['LastActionID'] ?? 0)]];
|
||||||
|
}
|
||||||
|
|
||||||
private function describeVariable(int $variableID, string $name, string $path, ?int $categoryID): array
|
private function describeVariable(int $variableID, string $name, string $path, ?int $categoryID): array
|
||||||
{
|
{
|
||||||
$variable = IPS_GetVariable($variableID);
|
$variable = IPS_GetVariable($variableID);
|
||||||
@@ -451,6 +480,7 @@ class NextFloor extends IPSModuleStrict
|
|||||||
'symcon_variable_type' => (int) $variable['VariableType'],
|
'symcon_variable_type' => (int) $variable['VariableType'],
|
||||||
'symcon_has_action' => ((int) ($variable['VariableCustomAction'] ?: $variable['VariableAction'])) !== 0,
|
'symcon_has_action' => ((int) ($variable['VariableCustomAction'] ?: $variable['VariableAction'])) !== 0,
|
||||||
'symcon_formatted' => GetValueFormatted($variableID),
|
'symcon_formatted' => GetValueFormatted($variableID),
|
||||||
|
'symcon_value' => $value,
|
||||||
'device_class' => $this->deviceClassFor($profile, $name, $unit)
|
'device_class' => $this->deviceClassFor($profile, $name, $unit)
|
||||||
];
|
];
|
||||||
if ($unit !== '') {
|
if ($unit !== '') {
|
||||||
@@ -814,6 +844,14 @@ class NextFloor extends IPSModuleStrict
|
|||||||
if (!is_string($entityID)) {
|
if (!is_string($entityID)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if ($domain === 'schedule' && $service === 'set_active') {
|
||||||
|
if (preg_match('/^schedule\.(\d+)$/', $entityID, $match) !== 1 || !IPS_EventExists((int) $match[1])
|
||||||
|
|| (int) IPS_GetEvent((int) $match[1])['EventType'] !== 2 || !is_bool($data['active'] ?? null)) {
|
||||||
|
throw new InvalidArgumentException('invalid_schedule');
|
||||||
|
}
|
||||||
|
if (!IPS_SetEventActive((int) $match[1], $data['active'])) throw new RuntimeException('schedule_update_failed');
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$variableID = $this->variableIdForEntity($entityID);
|
$variableID = $this->variableIdForEntity($entityID);
|
||||||
if ($variableID === null || !IPS_VariableExists($variableID)) {
|
if ($variableID === null || !IPS_VariableExists($variableID)) {
|
||||||
continue;
|
continue;
|
||||||
@@ -832,6 +870,20 @@ class NextFloor extends IPSModuleStrict
|
|||||||
{
|
{
|
||||||
$variable = IPS_GetVariable($variableID);
|
$variable = IPS_GetVariable($variableID);
|
||||||
$current = GetValue($variableID);
|
$current = GetValue($variableID);
|
||||||
|
if ($domain === 'symcon' && $service === 'set_value') {
|
||||||
|
if ((int) ($variable['VariableCustomAction'] ?: $variable['VariableAction']) === 0) throw new InvalidArgumentException('variable_readonly');
|
||||||
|
$type = (int) $variable['VariableType'];
|
||||||
|
$value = $data['value'] ?? null;
|
||||||
|
if ($type === 0 && !is_bool($value)) throw new InvalidArgumentException('invalid_boolean');
|
||||||
|
if (in_array($type, [1, 2], true)) {
|
||||||
|
$meta = $this->variableMetadata($variableID, $variable);
|
||||||
|
if (!is_numeric($value) || !is_finite((float) $value) || (float) $value < $meta['min'] || (float) $value > $meta['max']
|
||||||
|
|| ($type === 1 && (float) $value !== floor((float) $value))) throw new InvalidArgumentException('invalid_value');
|
||||||
|
}
|
||||||
|
if ($type === 3 && !is_string($value)) throw new InvalidArgumentException('invalid_string');
|
||||||
|
$this->setVariable($variableID, $variable, $value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if ($domain === 'cover' && $service === 'stop_cover') {
|
if ($domain === 'cover' && $service === 'stop_cover') {
|
||||||
throw new InvalidArgumentException('cover_stop_not_supported');
|
throw new InvalidArgumentException('cover_stop_not_supported');
|
||||||
}
|
}
|
||||||
|
|||||||
+27
-1
@@ -16,7 +16,7 @@ In **Kerninstanzen → Modules** wird dieses Repository verwendet:
|
|||||||
|
|
||||||
Im Zahnrad des Eintrags den Branch **`symcon`** wählen und auf Aktualisierungen prüfen.
|
Im Zahnrad des Eintrags den Branch **`symcon`** wählen und auf Aktualisierungen prüfen.
|
||||||
`main` enthält die Quellen für die Entwicklung, `symcon` die installierbare Bibliothek.
|
`main` enthält die Quellen für die Entwicklung, `symcon` die installierbare Bibliothek.
|
||||||
Nach der Aktualisierung auf **0.2.12 / Build 15** die Konsole neu laden. Unter
|
Nach der Aktualisierung auf **0.2.13 / Build 16** die Konsole neu laden. Unter
|
||||||
**Instanz hinzufügen → Hersteller NextFloor** erscheint **„NextFloor Designer und 3D-Kachel“**.
|
**Instanz hinzufügen → Hersteller NextFloor** erscheint **„NextFloor Designer und 3D-Kachel“**.
|
||||||
|
|
||||||
### Für die Entwicklung
|
### Für die Entwicklung
|
||||||
@@ -46,6 +46,32 @@ Die Dateien unter `NextFloor/assets/` und `NextFloor/packs/` werden durch
|
|||||||
Der Build prüft anschließend die Modulmetadaten und die installierbare Verzeichnisstruktur.
|
Der Build prüft anschließend die Modulmetadaten und die installierbare Verzeichnisstruktur.
|
||||||
Dieselbe Prüfung lässt sich separat mit `node symcon/tests/validate-package.mjs` ausführen.
|
Dieselbe Prüfung lässt sich separat mit `node symcon/tests/validate-package.mjs` ausführen.
|
||||||
|
|
||||||
|
## Änderungen in 0.2.13
|
||||||
|
|
||||||
|
- Im Raum liegt **Fußbodenheizung** unter **Raumklima**. Dort lassen sich auch
|
||||||
|
**Zuluft-VSR, Abluft-VSR, Zulufttemperatur, Ablufttemperatur, NHR (Nachheizregister)**
|
||||||
|
und ein **Raumstatus** verknüpfen. Die Auswahl richtet sich nach dem nativen
|
||||||
|
Variablentyp, unabhängig vom bisher vermuteten Gerätetyp.
|
||||||
|
- Das Raummenü zeigt die gewählten Werte mit den Symcon-Einheiten und formatierten
|
||||||
|
Anzeigen. Der Alias der Integer-Variable **Raumstatus** ersetzt den berechneten
|
||||||
|
Komfortwert. Beschreibbare Heizungs- und Lüftungsvariablen werden über ihre native
|
||||||
|
Aktion bedient; reine Messwerte bleiben Anzeigen.
|
||||||
|
- Eine oder mehrere klassische **Symcon-Schaltuhren (Wochenplan-Ereignisse)** lassen
|
||||||
|
sich aus dem Objektbaum zuordnen. Das Raummenü zeigt Wochentage, Schaltpunkte und
|
||||||
|
Aktionsnamen sowie den nächsten Schaltpunkt. Aktivieren und Deaktivieren erhält
|
||||||
|
den vollständigen Wochenplan; Aktionsskripte bleiben auf dem Symcon-Server.
|
||||||
|
- Unter **Wettervariablen** werden Wetterzustand, Außentemperatur, Luftfeuchte,
|
||||||
|
Luftdruck, Wind, Böen, Windrichtung, Bewölkung, Niederschlag, Helligkeit, UV,
|
||||||
|
Sichtweite, Schnee, Nebel und Gewitter einzeln verknüpft. Der **Regensensor**
|
||||||
|
akzeptiert Boolean- und numerische Variablen auch bei abweichendem Gerätetyp.
|
||||||
|
Die Quellen steuern die Wetterdarstellung und Regenwarnung. Oben in der 3D-Ansicht
|
||||||
|
öffnet **Wetter** die aktuellen verknüpften Werte mit ihren nativen Einheiten.
|
||||||
|
- **Anwesenheit** verwendet beliebige Boolean-Variablen mit eigenem Personennamen:
|
||||||
|
true = anwesend, false = abwesend. Ein Raum für den 3D-Marker ist optional;
|
||||||
|
der Anwesenheitsstatus wird auch ohne Raum in der oberen Leiste angezeigt.
|
||||||
|
- Durchsagen, Lautsprecherauswahl, Ruhezeiten, Durchsagetexte und Bluetooth-Ortung
|
||||||
|
sind aus der Symcon-Oberfläche entfernt.
|
||||||
|
|
||||||
## Änderungen in 0.2.12
|
## Änderungen in 0.2.12
|
||||||
|
|
||||||
- Der konfigurierte **Name der Visualisierung** erscheint oben links statt „NextFloor“,
|
- Der konfigurierte **Name der Visualisierung** erscheint oben links statt „NextFloor“,
|
||||||
|
|||||||
+3
-3
@@ -6,7 +6,7 @@
|
|||||||
"compatibility": {
|
"compatibility": {
|
||||||
"version": "9.0"
|
"version": "9.0"
|
||||||
},
|
},
|
||||||
"version": "0.2.12",
|
"version": "0.2.13",
|
||||||
"build": 15,
|
"build": 16,
|
||||||
"date": 1794297600
|
"date": 1794384000
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
// Native variables and classic weekly schedule events; no live Symcon system is modified.
|
||||||
|
class IPSModuleStrict {}
|
||||||
|
$objects = [
|
||||||
|
10 => ['ParentID' => 0, 'ObjectName' => 'Gebäude', 'ObjectType' => 0],
|
||||||
|
11 => ['ParentID' => 10, 'ObjectName' => 'Heizung Wochenplan', 'ObjectType' => 4],
|
||||||
|
12 => ['ParentID' => 10, 'ObjectName' => 'Zyklischer Timer', 'ObjectType' => 4],
|
||||||
|
13 => ['ParentID' => 10, 'ObjectName' => 'Verknüpfte Schaltuhr', 'ObjectType' => 6],
|
||||||
|
14 => ['ParentID' => 10, 'ObjectName' => 'Heizung', 'ObjectType' => 2],
|
||||||
|
15 => ['ParentID' => 10, 'ObjectName' => 'Raumstatus', 'ObjectType' => 2],
|
||||||
|
];
|
||||||
|
$events = [11 => ['EventType' => 2, 'EventActive' => true, 'NextRun' => 1794387600, 'NextActionID' => 2,
|
||||||
|
'ScheduleActions' => [['ID' => 1, 'Name' => 'Nacht', 'Color' => 255, 'ScriptText' => 'SECRET_SCRIPT', 'ActionParameters' => ['secret' => true]], ['ID' => 2, 'Name' => 'Tag', 'Color' => 16711680]],
|
||||||
|
'ScheduleGroups' => [['ID' => 0, 'Days' => 31, 'Points' => [['ID' => 0, 'Start' => ['Hour' => 6, 'Minute' => 30, 'Second' => 0], 'ActionID' => 2]]]]], 12 => ['EventType' => 1]];
|
||||||
|
$writes = [];
|
||||||
|
function check(bool $value, string $message): void { if (!$value) throw new RuntimeException($message); }
|
||||||
|
function IPS_GetChildrenIDs(int $id): array { global $objects; return array_keys(array_filter($objects, fn($o) => $o['ParentID'] === $id)); }
|
||||||
|
function IPS_ObjectExists(int $id): bool { global $objects; return isset($objects[$id]); }
|
||||||
|
function IPS_GetObject(int $id): array { global $objects; return [...$objects[$id], 'ObjectPosition' => 0, 'ObjectIsHidden' => false, 'ObjectIcon' => '']; }
|
||||||
|
function IPS_GetName(int $id): string { global $objects; return $objects[$id]['ObjectName']; }
|
||||||
|
function IPS_GetLink(int $id): array { return ['TargetID' => 11]; }
|
||||||
|
function IPS_GetEvent(int $id): array { global $events; return $events[$id]; }
|
||||||
|
function IPS_EventExists(int $id): bool { global $events; return isset($events[$id]); }
|
||||||
|
function IPS_SetEventActive(int $id, bool $active): bool { global $events; $events[$id]['EventActive'] = $active; return true; }
|
||||||
|
function IPS_VariableExists(int $id): bool { return in_array($id, [14, 15]); }
|
||||||
|
function IPS_GetVariable(int $id): array { return ['VariableType' => $id === 14 ? 0 : 1, 'VariableProfile' => '', 'VariableCustomProfile' => '', 'VariableAction' => $id === 14 ? 123 : 0, 'VariableCustomAction' => 0]; }
|
||||||
|
function GetValue(int $id): mixed { return $id === 14 ? false : 2; }
|
||||||
|
function GetValueFormatted(int $id): string { return $id === 14 ? 'Aus' : 'Besprechung'; }
|
||||||
|
function IPS_GetVariablePresentation(int $id): array { return []; }
|
||||||
|
function IPS_VariableProfileExists(string $profile): bool { return false; }
|
||||||
|
function RequestAction(int $id, mixed $value): void { global $writes; $writes[] = [$id, $value]; }
|
||||||
|
function SetValue(int $id, mixed $value): void { throw new LogicException('Native controls must never silently write read-only variables'); }
|
||||||
|
|
||||||
|
require __DIR__ . '/../NextFloor/module.php';
|
||||||
|
$module = new NextFloor();
|
||||||
|
$tree = (new ReflectionMethod($module, 'objectTree'))->invoke($module);
|
||||||
|
$states = array_column($tree['variables'], null, 'entity_id');
|
||||||
|
$nodes = array_column($tree['objects'], null, 'object_id');
|
||||||
|
check($nodes[11]['entity_id'] === 'schedule.11' && $nodes[13]['entity_id'] === 'schedule.11', 'Schedule events and their links are selectable in the original object tree');
|
||||||
|
check(!isset($nodes[12]['entity_id']), 'Ordinary timers must not be offered as weekly schedules');
|
||||||
|
check($states['schedule.11']['attributes']['groups'][0]['days'] === 31 && $states['schedule.11']['attributes']['groups'][0]['points'][0]['minute'] === 30, 'Native day masks and switch times must survive export');
|
||||||
|
check(!str_contains(json_encode($tree), 'SECRET_SCRIPT') && !str_contains(json_encode($tree), 'ActionParameters'), 'Action scripts and parameters must not be exported');
|
||||||
|
check($states[$nodes[14]['entity_id']]['attributes']['symcon_value'] === false, 'Native Boolean false is preserved');
|
||||||
|
check($states[$nodes[15]['entity_id']]['attributes']['symcon_formatted'] === 'Besprechung', 'Integer status retains its Symcon alias');
|
||||||
|
$action = new ReflectionMethod($module, 'variableAction');
|
||||||
|
$before = $events[11]['ScheduleGroups'];
|
||||||
|
$action->invoke($module, 'schedule', 'set_active', ['entity_id' => 'schedule.11', 'active' => false]);
|
||||||
|
check($events[11]['EventActive'] === false && $events[11]['ScheduleGroups'] === $before, 'Disabling a linked clock must retain every switch point');
|
||||||
|
$action->invoke($module, 'symcon', 'set_value', ['entity_id' => 'switch.14', 'value' => true]);
|
||||||
|
check($writes === [[14, true]], 'Writable native Boolean uses RequestAction');
|
||||||
|
foreach ([['schedule', 'set_active', ['entity_id' => 'schedule.12', 'active' => true]], ['symcon', 'set_value', ['entity_id' => 'sensor.15', 'value' => 3]], ['symcon', 'set_value', ['entity_id' => 'switch.14', 'value' => 'false']]] as $call) {
|
||||||
|
try { $action->invoke($module, ...$call); throw new LogicException('Invalid native action accepted'); }
|
||||||
|
catch (InvalidArgumentException) {}
|
||||||
|
}
|
||||||
|
echo "OK: selectable native schedules, protected action data, aliases, raw Boolean controls and read-only guards\n";
|
||||||
@@ -35,6 +35,19 @@ def test_room_start_view() -> None:
|
|||||||
assert room["start_view"]["radius"] == 4.0
|
assert room["start_view"]["radius"] == 4.0
|
||||||
|
|
||||||
|
|
||||||
|
def test_native_symcon_room_links_and_weather_survive_validation() -> None:
|
||||||
|
hvac = {
|
||||||
|
"status": "sensor.12",
|
||||||
|
"supply_vsr": "sensor.13",
|
||||||
|
"reheat": "switch.14",
|
||||||
|
"schedules": ["schedule.15", "schedule.16"],
|
||||||
|
}
|
||||||
|
room = ROOM_SCHEMA({**ROOM, "floor_heating": "sensor.11", "hvac": hvac})
|
||||||
|
assert room["hvac"] == hvac
|
||||||
|
weather = {"temperature": "climate.20", "wind_speed": "sensor.21", "snow": None}
|
||||||
|
assert SETTINGS_SCHEMA({**SETTINGS, "weather_variables": weather})["weather_variables"] == weather
|
||||||
|
|
||||||
|
|
||||||
def test_map_defaults_and_limits() -> None:
|
def test_map_defaults_and_limits() -> None:
|
||||||
result = MAP_SCHEMA({"on": True, "lat": 50.1, "lon": 8.6})
|
result = MAP_SCHEMA({"on": True, "lat": 50.1, "lon": 8.6})
|
||||||
assert (result["zoom"], result["opacity"], result["url"]) == (18, 0.5, None)
|
assert (result["zoom"], result["opacity"], result["url"]) == (18, 0.5, None)
|
||||||
|
|||||||
Reference in new issue
Block a user