From 00fca890de23045b141dc0d21591754ff73f4805 Mon Sep 17 00:00:00 2001 From: jhartworks Date: Tue, 10 Nov 2026 09:19:13 +0100 Subject: [PATCH] feat: improve Symcon controls, device readings and designer help --- CHANGELOG.md | 8 + .../frontend/nextfloor-card-editor.js | 10 +- .../nextfloor/frontend/nextfloor-editor.js | 1260 +++++++++-------- .../nextfloor/frontend/nextfloor.js | 411 +++--- custom_components/nextfloor/schema.py | 1 + frontend/src/card.ts | 5 +- frontend/src/components/editor.ts | 6 +- frontend/src/components/editor/ble-locate.ts | 7 +- .../src/components/editor/device-values.ts | 21 + frontend/src/components/editor/fields.ts | 7 +- .../src/components/editor/forms/compass.ts | 4 +- .../components/editor/forms/device-list.ts | 2 +- .../src/components/editor/forms/device.ts | 8 + .../editor/forms/furniture-links.ts | 2 + .../src/components/editor/forms/opening.ts | 8 +- frontend/src/components/editor/forms/room.ts | 2 +- .../components/editor/light-effect-fields.ts | 6 +- frontend/src/components/editor/styles.ts | 3 + frontend/src/components/editor/wall-view.ts | 3 +- frontend/src/components/help-popup.ts | 34 + frontend/src/components/model-upload.ts | 7 +- frontend/src/components/quick-menu.ts | 4 +- frontend/src/components/room-panel.ts | 14 +- frontend/src/components/view3d.ts | 13 +- .../src/components/view3d/watch-list.test.ts | 8 + frontend/src/components/view3d/watch-list.ts | 6 +- frontend/src/entities/cover-controls.test.ts | 58 + frontend/src/entities/cover-controls.ts | 84 ++ frontend/src/entities/covers.ts | 1 + frontend/src/entities/device-values.test.ts | 27 + frontend/src/entities/device-values.ts | 31 + frontend/src/entities/openings.ts | 44 +- frontend/src/entities/position-value.ts | 28 + frontend/src/entities/registry.ts | 5 +- frontend/src/i18n.ts | 24 + frontend/src/live/cards.ts | 20 +- frontend/src/live/room-climate-card.test.ts | 19 +- frontend/src/live/room-climate-card.ts | 23 +- frontend/src/markers.ts | 3 +- frontend/src/model.ts | 19 + frontend/src/panel.ts | 7 +- frontend/symcon-climate-smoke.mjs | 11 +- frontend/symcon-designer-smoke.mjs | 93 +- .../NextFloor/assets/nextfloor-card-editor.js | 10 +- symcon/NextFloor/assets/nextfloor-designer.js | 623 ++++---- symcon/NextFloor/assets/nextfloor-editor.js | 1260 +++++++++-------- symcon/NextFloor/module.php | 2 + symcon/README.md | 28 +- symcon/library.json | 6 +- symcon/tests/variables.php | 1 + 50 files changed, 2447 insertions(+), 1840 deletions(-) create mode 100644 frontend/src/components/editor/device-values.ts create mode 100644 frontend/src/components/help-popup.ts create mode 100644 frontend/src/entities/cover-controls.test.ts create mode 100644 frontend/src/entities/cover-controls.ts create mode 100644 frontend/src/entities/device-values.test.ts create mode 100644 frontend/src/entities/device-values.ts create mode 100644 frontend/src/entities/position-value.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 203055b..e4db549 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ All notable changes to NextFloor, newest first. Every release lists what is **Ad ### Added +- **Room illuminance and multiple device readings:** Rooms can link a brightness sensor and show lux with a sun symbol; CO₂ uses a cloud. A small + button adds device/furniture values with independent object-tree choices, custom symbols and optional labels, shown on device markers and in the room panel. + - **Floating room climate cards:** Each room can show temperature, humidity and CO₂ in a glass card above its own position, using its selected sensors. Cards follow live values and room/floor navigation and can be toggled without configuring an energy meter. - **IP-Symcon variable reload:** A button in the designer title bar reloads the complete object tree, variables and current presentation metadata without closing the plan, with progress, success and error feedback. @@ -14,12 +16,18 @@ All notable changes to NextFloor, newest first. Every release lists what is **Ad ### Changed +- **Designer help popups:** Explanations are opened through compact information symbols instead of occupying the forms. Keyboard and touch users can open and dismiss the dialogs. + +- **Compact room climate cards:** Floating cards show symbols and values without repeating the room name or labels. Unlinked metrics and entirely empty cards are hidden; linked unavailable sensors retain a dash. + - **Foldable wall menu:** The wall settings in the room sidebar can be collapsed using their heading. - **IP-Symcon picker main category:** Hidden categories and their variables always remain visible. I/O, splitter, core, configurator, discovery and visualization instances are grouped under a collapsed virtual “System” folder, with searchable/selectable descendants and no changes to the actual Symcon object tree. ### Fixed +- **IP-Symcon blind feedback and directions:** Numeric position feedback can be selected independently of inferred domains and is read using its native range. Blind and slat directions can be reversed separately across live readings, 3D geometry, sliders, buttons, swipes and grouped actions, without writing to feedback variables. + - **IP-Symcon room humidity selection:** Manual room-climate fields accept numeric Integer/Float variables even without inferred classes or profiles. German “Feuchtigkeit” and subscript “CO₂” names are recognized, and parent category names no longer override measurement classes. - **IP-Symcon dimmers and venetian blinds:** Numeric variables can be explicitly linked as dimmers or blind controls independently of inferred names. Native integer/float ranges and steps are respected in both directions. Separate blind-height and slat-position variables can be selected in the object tree and controlled independently in the room panel and quick menu; dimmer sliders stay available while off. diff --git a/custom_components/nextfloor/frontend/nextfloor-card-editor.js b/custom_components/nextfloor/frontend/nextfloor-card-editor.js index cbc922a..8fe3df9 100644 --- a/custom_components/nextfloor/frontend/nextfloor-card-editor.js +++ b/custom_components/nextfloor/frontend/nextfloor-card-editor.js @@ -1,7 +1,7 @@ /*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */ -var p={cs:"4be67fcd522e",da:"0fe66a82bf2a",es:"bd89dffd1355",fi:"9a17bc084f56",fr:"6312d0f61ebf",hu:"27ba348531dc",it:"1b705e76dd00",nb:"c5ea24fb9ef6",nl:"b64142c67c2e",pl:"8527a4930402",pt:"31857a2d2277",ro:"e3cb5f449f0f",sk:"320611594db0",sl:"8071691ceda3",sv:"711b911ec8da",tr:"7c83ce1c3372",zh:"50518d9f494e"};var M=globalThis,N=M.ShadowRoot&&(M.ShadyCSS===void 0||M.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,V=Symbol(),me=new WeakMap,R=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==V)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(N&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=me.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&me.set(t,e))}return e}toString(){return this.cssText}},pe=i=>new R(typeof i=="string"?i:i+"",void 0,V),U=(i,...e)=>{let t=i.length===1?i[0]:e.reduce((n,r,o)=>n+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+i[o+1],i[0]);return new R(t,i,V)},fe=(i,e)=>{if(N)i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),r=M.litNonce;r!==void 0&&n.setAttribute("nonce",r),n.textContent=t.cssText,i.appendChild(n)}},j=N?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return pe(t)})(i):i;var{is:Ke,defineProperty:Ge,getOwnPropertyDescriptor:Oe,getOwnPropertyNames:Ie,getOwnPropertySymbols:Ze,getPrototypeOf:Ve}=Object,C=globalThis,ge=C.trustedTypes,Ue=ge?ge.emptyScript:"",je=C.reactiveElementPolyfillSupport,F=(i,e)=>i,q={toAttribute(i,e){switch(e){case Boolean:i=i?Ue:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},we=(i,e)=>!Ke(i,e),be={attribute:!0,type:String,converter:q,reflect:!1,useDefault:!1,hasChanged:we};Symbol.metadata??=Symbol("metadata"),C.litPropertyMetadata??=new WeakMap;var b=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=be){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&&Ge(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:o}=Oe(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:r,set(a){let s=r?.call(this);o?.call(this,a),this.requestUpdate(e,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??be}static _$Ei(){if(this.hasOwnProperty(F("elementProperties")))return;let e=Ve(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(F("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(F("properties"))){let t=this.properties,n=[...Ie(t),...Ze(t)];for(let r of n)this.createProperty(r,t[r])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,r]of t)this.elementProperties.set(n,r)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let r=this._$Eu(t,n);r!==void 0&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let r of n)t.unshift(j(r))}else e!==void 0&&t.push(j(e));return t}static _$Eu(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return fe(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){let n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(r!==void 0&&n.reflect===!0){let o=(n.converter?.toAttribute!==void 0?n.converter:q).toAttribute(t,n.type);this._$Em=e,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(e,t){let n=this.constructor,r=n._$Eh.get(e);if(r!==void 0&&this._$Em!==r){let o=n.getPropertyOptions(r),a=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:q;this._$Em=r;let s=a.fromAttribute(t,o.type);this[r]=s??this._$Ej?.get(r)??s,this._$Em=null}}requestUpdate(e,t,n,r=!1,o){if(e!==void 0){let a=this.constructor;if(r===!1&&(o=this[e]),n??=a.getPropertyOptions(e),!((n.hasChanged??we)(o,t)||n.useDefault&&n.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,n))))return;this.C(e,t,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:r,wrapped:o},a){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),o!==!0||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),r===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[r,o]of this._$Ep)this[r]=o;this._$Ep=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[r,o]of n){let{wrapped:a}=o,s=this[r];a!==!0||this._$AL.has(r)||s===void 0||this.C(r,void 0,o,s)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(n=>n.hostUpdate?.()),this.update(t)):this._$EM()}catch(n){throw e=!1,this._$EM(),n}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};b.elementStyles=[],b.shadowRootOptions={mode:"open"},b[F("elementProperties")]=new Map,b[F("finalized")]=new Map,je?.({ReactiveElement:b}),(C.reactiveElementVersions??=[]).push("2.1.2");var ne=globalThis,ke=i=>i,K=ne.trustedTypes,ve=K?K.createPolicy("lit-html",{createHTML:i=>i}):void 0,Ee="$lit$",v=`lit$${Math.random().toFixed(9).slice(2)}$`,Te="?"+v,qe=`<${Te}>`,D=document,H=()=>D.createComment(""),W=i=>i===null||typeof i!="object"&&typeof i!="function",re=Array.isArray,Je=i=>re(i)||typeof i?.[Symbol.iterator]=="function",J=`[ -\f\r]`,x=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ye=/-->/g,Se=/>/g,S=RegExp(`>|${J}(?:([^\\s"'>=/]+)(${J}*=${J}*(?:[^ -\f\r"'\`<>=]|("|')|))|$)`,"g"),Ae=/'/g,De=/"/g,Re=/^(?:script|style|textarea|title)$/i,ie=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),l=ie(1),ct=ie(2),ut=ie(3),z=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),ze=new WeakMap,A=D.createTreeWalker(D,129);function Fe(i,e){if(!re(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return ve!==void 0?ve.createHTML(e):e}var Xe=(i,e)=>{let t=i.length-1,n=[],r,o=e===2?"":e===3?"":"",a=x;for(let s=0;s"?(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?"":e===3?"":"")),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.length0){r.textContent=K?K.emptyScript:"";for(let k=0;k2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=d}_$AI(e,t=this,n,r){let o=this.strings,a=!1;if(o===void 0)e=E(this,e,t,0),a=!W(e)||e!==this._$AH&&e!==z,a&&(this._$AH=e);else{let s=e,h,u;for(e=o[0],h=0;h{let n=t?.renderBefore??e,r=n._$litPart$;if(r===void 0){let o=t?.renderBefore??null;n._$litPart$=r=new P(e.insertBefore(H(),o),o,void 0,t??{})}return r._$AI(i),r};var oe=globalThis,y=class extends b{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=xe(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return z}};y._$litElement$=!0,y.finalized=!0,oe.litElementHydrateSupport?.({LitElement:y});var Qe=oe.litElementPolyfillSupport;Qe?.({LitElement:y});(oe.litElementVersions??=[]).push("4.2.2");var et=(i,e,t={})=>i.callWS({type:`nextfloor/${e}`,...t}),He=i=>et(i,"building/get");var G=["light","cover","climate","media","switch","fan","lock","binary","sensor","tap","other"];var We=["body","wood","fabric","white","metal","dark"],Be={body:"#172238",wood:"#19233c",fabric:"#1a2644",white:"#1d2946",metal:"#2a3a60",dark:"#0b111f"};var $=["walls","floors","temperature","humidity","co2"];var ae={height:420,walls:"auto",solid_walls:!1,explode:!0,roof_fade:!0,quality:"auto",stats:!1,markers:"important",heatmap:"none",theme:"neon",energy:!0,room_panel:!0,room_buttons:!1,fill:!1,controls:!1,fullscreen_button:!1,room_names:!0,floor_stack:"dim",alerts:!0,alert_jump:!1,scenes:!0,announcements:!0,sensor_bar:!0,weather:!0,weather_density:1,idle_return:0,controls_hidden:!1,controls_hide_after:0,marker_names:!1,tap_in_room:!1,room_double_tap:"auto",central:!0,central_open:!1,keep_camera:!1,readable:!1,plain:!1,right_back:!1,today:!0,night:"off",idle_orbit:!1},tt=i=>i.target.value,O=i=>i.target.value,nt=i=>i.target.checked;function f(i,e,t,n,r){return l`