diff --git a/dist/versatile-thermostat-ui-card.js b/dist/versatile-thermostat-ui-card.js index 14713c8..963a13e 100644 --- a/dist/versatile-thermostat-ui-card.js +++ b/dist/versatile-thermostat-ui-card.js @@ -404,7 +404,7 @@ const qn=270;const Yn=new Set(["ArrowRight","ArrowUp","ArrowLeft","ArrowDown","P .high { stroke: var(--state-climate-cool-color); } - `}};t([dt({type:Boolean,reflect:!0})],Xn.prototype,"disabled",void 0),t([dt({type:Boolean})],Xn.prototype,"dual",void 0),t([dt({type:String})],Xn.prototype,"mode",void 0),t([dt({type:Boolean})],Xn.prototype,"inactive",void 0),t([dt({type:String})],Xn.prototype,"label",void 0),t([dt({type:String,attribute:"low-label"})],Xn.prototype,"lowLabel",void 0),t([dt({type:String,attribute:"high-label"})],Xn.prototype,"highLabel",void 0),t([dt({type:Number})],Xn.prototype,"value",void 0),t([dt({type:Number})],Xn.prototype,"low",void 0),t([dt({type:Number})],Xn.prototype,"high",void 0),t([dt({type:Number})],Xn.prototype,"current",void 0),t([dt({type:Number})],Xn.prototype,"step",void 0),t([dt({type:Number})],Xn.prototype,"min",void 0),t([dt({type:Number})],Xn.prototype,"max",void 0),t([pt()],Xn.prototype,"_localValue",void 0),t([pt()],Xn.prototype,"_localLow",void 0),t([pt()],Xn.prototype,"_localHigh",void 0),t([pt()],Xn.prototype,"_activeSlider",void 0),t([pt()],Xn.prototype,"_lastSlider",void 0),t([mt("#slider")],Xn.prototype,"_slider",void 0),t([mt("#interaction")],Xn.prototype,"_interaction",void 0),Xn=t([ct("vt-ha-control-circular-slider")],Xn);const Kn={auto:"M18,11V12.5C21.19,12.5 23.09,16.05 21.33,18.71L20.24,17.62C21.06,15.96 19.85,14 18,14V15.5L15.75,13.25L18,11M18,22V20.5C14.81,20.5 12.91,16.95 14.67,14.29L15.76,15.38C14.94,17.04 16.15,19 18,19V17.5L20.25,19.75L18,22M19,3H18V1H16V3H8V1H6V3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H14C13.36,20.45 12.86,19.77 12.5,19H5V8H19V10.59C19.71,10.7 20.39,10.94 21,11.31V5A2,2 0 0,0 19,3Z",heat_cool:"M12,6V9L16,5L12,1V4A8,8 0 0,0 4,12C4,13.57 4.46,15.03 5.24,16.26L6.7,14.8C6.25,13.97 6,13 6,12A6,6 0 0,1 12,6M18.76,7.74L17.3,9.2C17.74,10.04 18,11 18,12A6,6 0 0,1 12,18V15L8,19L12,23V20A8,8 0 0,0 20,12C20,10.43 19.54,8.97 18.76,7.74Z",heat:"M17.66 11.2C17.43 10.9 17.15 10.64 16.89 10.38C16.22 9.78 15.46 9.35 14.82 8.72C13.33 7.26 13 4.85 13.95 3C13 3.23 12.17 3.75 11.46 4.32C8.87 6.4 7.85 10.07 9.07 13.22C9.11 13.32 9.15 13.42 9.15 13.55C9.15 13.77 9 13.97 8.8 14.05C8.57 14.15 8.33 14.09 8.14 13.93C8.08 13.88 8.04 13.83 8 13.76C6.87 12.33 6.69 10.28 7.45 8.64C5.78 10 4.87 12.3 5 14.47C5.06 14.97 5.12 15.47 5.29 15.97C5.43 16.57 5.7 17.17 6 17.7C7.08 19.43 8.95 20.67 10.96 20.92C13.1 21.19 15.39 20.8 17.03 19.32C18.86 17.66 19.5 15 18.56 12.72L18.43 12.46C18.22 12 17.66 11.2 17.66 11.2M14.5 17.5C14.22 17.74 13.76 18 13.4 18.1C12.28 18.5 11.16 17.94 10.5 17.28C11.69 17 12.4 16.12 12.61 15.23C12.78 14.43 12.46 13.77 12.33 13C12.21 12.26 12.23 11.63 12.5 10.94C12.69 11.32 12.89 11.7 13.13 12C13.9 13 15.11 13.44 15.37 14.8C15.41 14.94 15.43 15.08 15.43 15.23C15.46 16.05 15.1 16.95 14.5 17.5H14.5Z",cool:"M20.79,13.95L18.46,14.57L16.46,13.44V10.56L18.46,9.43L20.79,10.05L21.31,8.12L19.54,7.65L20,5.88L18.07,5.36L17.45,7.69L15.45,8.82L13,7.38V5.12L14.71,3.41L13.29,2L12,3.29L10.71,2L9.29,3.41L11,5.12V7.38L8.5,8.82L6.5,7.69L5.92,5.36L4,5.88L4.47,7.65L2.7,8.12L3.22,10.05L5.55,9.43L7.55,10.56V13.45L5.55,14.58L3.22,13.96L2.7,15.89L4.47,16.36L4,18.12L5.93,18.64L6.55,16.31L8.55,15.18L11,16.62V18.88L9.29,20.59L10.71,22L12,20.71L13.29,22L14.7,20.59L13,18.88V16.62L15.5,15.17L17.5,16.3L18.12,18.63L20,18.12L19.53,16.35L21.3,15.88L20.79,13.95M9.5,10.56L12,9.11L14.5,10.56V13.44L12,14.89L9.5,13.44V10.56Z",off:"M16.56,5.44L15.11,6.89C16.84,7.94 18,9.83 18,12A6,6 0 0,1 12,18A6,6 0 0,1 6,12C6,9.83 7.16,7.94 8.88,6.88L7.44,5.44C5.36,6.88 4,9.28 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12C20,9.28 18.64,6.88 16.56,5.44M13,3H11V13H13",fan_only:yt,dry:St,window_open:Lt,windowBypass:Et,presence:$t,motion:At,eco:"M17,8C8,10 5.9,16.17 3.82,21.34L5.71,22L6.66,19.7C7.14,19.87 7.64,20 8,20C19,20 22,3 22,3C21,5 14,5.25 9,6.25C4,7.25 2,11.5 2,13.5C2,15.5 3.75,17.25 3.75,17.25C7,8 17,8 17,8Z",comfort:"M12.5 7C12.5 5.89 13.39 5 14.5 5H18C19.1 5 20 5.9 20 7V9.16C18.84 9.57 18 10.67 18 11.97V14H12.5V7M6 11.96V14H11.5V7C11.5 5.89 10.61 5 9.5 5H6C4.9 5 4 5.9 4 7V9.15C5.16 9.56 6 10.67 6 11.96M20.66 10.03C19.68 10.19 19 11.12 19 12.12V15H5V12C5 10.9 4.11 10 3 10S1 10.9 1 12V17C1 18.1 1.9 19 3 19V21H5V19H19V21H21V19C22.1 19 23 18.1 23 17V12C23 10.79 21.91 9.82 20.66 10.03Z",boost:"M13.13 22.19L11.5 18.36C13.07 17.78 14.54 17 15.9 16.09L13.13 22.19M5.64 12.5L1.81 10.87L7.91 8.1C7 9.46 6.22 10.93 5.64 12.5M21.61 2.39C21.61 2.39 16.66 .269 11 5.93C8.81 8.12 7.5 10.53 6.65 12.64C6.37 13.39 6.56 14.21 7.11 14.77L9.24 16.89C9.79 17.45 10.61 17.63 11.36 17.35C13.5 16.53 15.88 15.19 18.07 13C23.73 7.34 21.61 2.39 21.61 2.39M14.54 9.46C13.76 8.68 13.76 7.41 14.54 6.63S16.59 5.85 17.37 6.63C18.14 7.41 18.15 8.68 17.37 9.46C16.59 10.24 15.32 10.24 14.54 9.46M8.88 16.53L7.47 15.12L8.88 16.53M6.24 22L9.88 18.36C9.54 18.27 9.21 18.12 8.91 17.91L4.83 22H6.24M2 22H3.41L8.18 17.24L6.76 15.83L2 20.59V22M2 19.17L6.09 15.09C5.88 14.79 5.73 14.47 5.64 14.12L2 17.76V19.17Z",frost:"M14.46 9.41L11 7.38V5.12L12.71 3.41L11.29 2L10 3.29L8.71 2L7.29 3.41L9 5.12V7.38L6.5 8.82L4.5 7.69L3.92 5.36L2 5.88L2.47 7.65L.7 8.12L1.22 10.05L3.55 9.43L5.55 10.56V13.45L3.55 14.58L1.22 13.96L.7 15.89L2.47 16.36L2 18.12L3.93 18.64L4.55 16.31L6.55 15.18L9 16.62V18.88L7.29 20.59L8.71 22L10 20.71L11.29 22L12.7 20.59L11 18.88V16.62L14.46 14.61M7.5 10.56L10 9.11L12.5 10.56V13.44L10 14.89L7.5 13.44M19 5C17.89 5 17 5.89 17 7V13.76C16.36 14.33 16 15.15 16 16C16 17.66 17.34 19 19 19S22 17.66 22 16C22 15.15 21.64 14.33 21 13.77V7C21 5.89 20.11 5 19 5M19 6C19.55 6 20 6.45 20 7V8H18V7C18 6.45 18.45 6 19 6",activity:At,power:"M12 3L2 12H5V20H19V12H22L12 3M11.5 18V14H9L12.5 7V11H15L11.5 18Z",flashAlert:wt,temperature:"M15 13V5A3 3 0 0 0 9 5V13A5 5 0 1 0 15 13M12 4A1 1 0 0 1 13 5V8H11V5A1 1 0 0 1 12 4Z",humidity:St,ok:bt,thermometerAlert:kt,none:"M23 17C23 20.31 20.31 23 17 23V21.5C19.5 21.5 21.5 19.5 21.5 17H23M1 7C1 3.69 3.69 1 7 1V2.5C4.5 2.5 2.5 4.5 2.5 7H1M8 4.32L3.41 8.92C.19 12.14 .19 17.37 3.41 20.59S11.86 23.81 15.08 20.59L22.15 13.5C22.64 13.03 22.64 12.24 22.15 11.75C21.66 11.26 20.87 11.26 20.38 11.75L15.96 16.17L15.25 15.46L21.79 8.92C22.28 8.43 22.28 7.64 21.79 7.15S20.5 6.66 20 7.15L14.19 13L13.5 12.27L20.37 5.38C20.86 4.89 20.86 4.1 20.37 3.61S19.09 3.12 18.6 3.61L11.71 10.5L11 9.8L16.5 4.32C17 3.83 17 3.04 16.5 2.55S15.22 2.06 14.73 2.55L7.11 10.17C8.33 11.74 8.22 14 6.78 15.45L6.07 14.74C7.24 13.57 7.24 11.67 6.07 10.5L5.72 10.15L9.79 6.08C10.28 5.59 10.28 4.8 9.79 4.31C9.29 3.83 8.5 3.83 8 4.32Z",auto_regulation_mode:Ct,power_percent:Ct,mean_power_cycle:"M7,2V13H10V22L17,10H13L17,2H7Z",valve_open_percent:"M22 13V21H20V19H16.58C15.81 20.76 14.05 22 12 22S8.19 20.76 7.42 19H4V21H2V13H4V15H7.43C7.93 13.85 8.85 12.93 10 12.42V11H8V9H16V11H14V12.42C15.15 12.93 16.07 13.85 16.57 15H20V13H22M17 2H7C6.45 2 6 2.45 6 3S6.45 4 7 4H10V5H11V8H13V5H14V4H17C17.55 4 18 3.55 18 3S17.55 2 17 2Z",regulated_target_temperature:"M12 14C11.7 13.6 11.4 13.3 11 13V5C11 3.3 9.7 2 8 2S5 3.3 5 5V13C2.8 14.7 2.3 17.8 4 20S8.8 22.7 11 21 13.7 16.2 12 14M9 8H7V5C7 4.5 7.5 4 8 4S9 4.5 9 5V8M18 3H16L12.8 12H14.7L15.4 10H18.6L19.3 12H21.2L18 3M15.8 8.7L17 5L18.2 8.7H15.8Z",auto_fan_mode:"M12.5 2C8.93 2 8.14 5.96 10.13 9.65C9.72 9.97 9.4 10.39 9.21 10.87C8.28 10.68 7.23 10.25 6.73 9.26C5.56 6.89 2 7 2 11.5C2 15.07 5.95 15.85 9.64 13.87C9.96 14.27 10.39 14.59 10.88 14.79C10.68 15.71 10.24 16.75 9.26 17.24C6.9 18.42 7 22 11.5 22C12.31 22 13 21.78 13.5 21.41C13.19 20.67 13 19.86 13 19C13 17.59 13.5 16.3 14.3 15.28C14.17 14.97 14.03 14.65 13.86 14.34C14.26 14 14.57 13.59 14.77 13.11C15.26 13.21 15.78 13.39 16.25 13.67C17.07 13.25 18 13 19 13C20.05 13 21.03 13.27 21.89 13.74C21.95 13.37 22 12.96 22 12.5C22 8.92 18.03 8.13 14.33 10.13C14 9.73 13.59 9.42 13.11 9.22C13.3 8.29 13.74 7.24 14.73 6.75C17.09 5.57 17 2 12.5 2M12 11C12.54 11 13 11.45 13 12C13 12.55 12.54 13 12 13C11.43 13 11 12.55 11 12C11 11.45 11.43 11 12 11M18 15C16.89 15 16 15.9 16 17V23H18V21H20V23H22V17C22 15.9 21.1 15 20 15M18 17H20V19H18Z",auto_fan_mode_off:"M12.5,2C9.64,2 8.57,4.55 9.29,7.47L15,13.16C15.87,13.37 16.81,13.81 17.28,14.73C18.46,17.1 22.03,17 22.03,12.5C22.03,8.92 18.05,8.13 14.35,10.13C14.03,9.73 13.61,9.42 13.13,9.22C13.32,8.29 13.76,7.24 14.75,6.75C17.11,5.57 17,2 12.5,2M3.28,4L2,5.27L4.47,7.73C3.22,7.74 2,8.87 2,11.5C2,15.07 5.96,15.85 9.65,13.87C9.97,14.27 10.4,14.59 10.89,14.79C10.69,15.71 10.25,16.75 9.27,17.24C6.91,18.42 7,22 11.5,22C13.8,22 14.94,20.36 14.94,18.21L18.73,22L20,20.72L3.28,4Z",fan_mode:yt,power_sleep:xt},Jn="none",Gn="auto_fan_none",Qn={auto_fan_none:"None",auto_fan_low:"Low",auto_fan_mid:"Medium",auto_fan_high:"High",auto_fan_turbo:"Turbo"};function ts(t){const e=window;e.customCards=e.customCards||[],e.customCards.push(Object.assign(Object.assign({},t),{preview:!0}))}function es(t){const e=(new Date).getTime()-t.getTime();return Math.floor(e/6e4)}function is(t,e){const i=Math.round(t*e)/e;return parseFloat(i.toFixed(e))}console.info("%c VersatileThermostatUI-CARD \n%c version: 1.1.0 ","color: orange; font-weight: bold; background: black","color: white; font-weight: bold; background: dimgray"),ts({type:"versatile-thermostat-ui-card",name:"Versatile Thermostat Climate Card",description:"Card for climate entity"});let os=class extends at{constructor(){super(),this.value={},this._selectTargetTemperature="low",this.current=0,this.humidity=0,this.min=7,this.max=35,this.step=.5,this.window=!1,this.windowByPass=!1,this.presence=!1,this.motion=!1,this.overpowering=!1,this.is_device_active=!1,this.status="loading",this.mode="off",this.preset=Jn,this.dragging=!1,this.name="",this.target="value",this._debouncedCallService=((t,e,i=!1)=>{let o;const n=(...n)=>{const s=i&&!o;clearTimeout(o),o=window.setTimeout((()=>{o=void 0,i||t(...n)}),e),s&&t(...n)};return n.cancel=()=>{clearTimeout(o)},n})((t=>this._callService(t)),1e3),this._init=!0,this._firstRender=!0,this._ignore=!1,this._hasWindow=!1,this._hasWindowByPass=!1,this._hasPresence=!1,this._hasMotion=!1,this._hasOverpowering=!1,this._hasAutoStartStop=!1,this._isAutoStartStopEnabled=!1,this._oldValueMin=0,this._oldValueMax=0,this._display_bottom=0,this._display_top=0,this.modes=[],this.presets=[],this.security_state={},this.powerInfos=[],this._externalPowerInfos=[],this.auto_fan_infos={},this.error=[],this.render=()=>{var t,e,i,o,n,s,r,a,l,c,h,u,d,p,_,m,v,f,g,b,y,w,$,C,A;return F` + `}};t([dt({type:Boolean,reflect:!0})],Xn.prototype,"disabled",void 0),t([dt({type:Boolean})],Xn.prototype,"dual",void 0),t([dt({type:String})],Xn.prototype,"mode",void 0),t([dt({type:Boolean})],Xn.prototype,"inactive",void 0),t([dt({type:String})],Xn.prototype,"label",void 0),t([dt({type:String,attribute:"low-label"})],Xn.prototype,"lowLabel",void 0),t([dt({type:String,attribute:"high-label"})],Xn.prototype,"highLabel",void 0),t([dt({type:Number})],Xn.prototype,"value",void 0),t([dt({type:Number})],Xn.prototype,"low",void 0),t([dt({type:Number})],Xn.prototype,"high",void 0),t([dt({type:Number})],Xn.prototype,"current",void 0),t([dt({type:Number})],Xn.prototype,"step",void 0),t([dt({type:Number})],Xn.prototype,"min",void 0),t([dt({type:Number})],Xn.prototype,"max",void 0),t([pt()],Xn.prototype,"_localValue",void 0),t([pt()],Xn.prototype,"_localLow",void 0),t([pt()],Xn.prototype,"_localHigh",void 0),t([pt()],Xn.prototype,"_activeSlider",void 0),t([pt()],Xn.prototype,"_lastSlider",void 0),t([mt("#slider")],Xn.prototype,"_slider",void 0),t([mt("#interaction")],Xn.prototype,"_interaction",void 0),Xn=t([ct("vt-ha-control-circular-slider")],Xn);const Kn={auto:"M18,11V12.5C21.19,12.5 23.09,16.05 21.33,18.71L20.24,17.62C21.06,15.96 19.85,14 18,14V15.5L15.75,13.25L18,11M18,22V20.5C14.81,20.5 12.91,16.95 14.67,14.29L15.76,15.38C14.94,17.04 16.15,19 18,19V17.5L20.25,19.75L18,22M19,3H18V1H16V3H8V1H6V3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H14C13.36,20.45 12.86,19.77 12.5,19H5V8H19V10.59C19.71,10.7 20.39,10.94 21,11.31V5A2,2 0 0,0 19,3Z",heat_cool:"M12,6V9L16,5L12,1V4A8,8 0 0,0 4,12C4,13.57 4.46,15.03 5.24,16.26L6.7,14.8C6.25,13.97 6,13 6,12A6,6 0 0,1 12,6M18.76,7.74L17.3,9.2C17.74,10.04 18,11 18,12A6,6 0 0,1 12,18V15L8,19L12,23V20A8,8 0 0,0 20,12C20,10.43 19.54,8.97 18.76,7.74Z",heat:"M17.66 11.2C17.43 10.9 17.15 10.64 16.89 10.38C16.22 9.78 15.46 9.35 14.82 8.72C13.33 7.26 13 4.85 13.95 3C13 3.23 12.17 3.75 11.46 4.32C8.87 6.4 7.85 10.07 9.07 13.22C9.11 13.32 9.15 13.42 9.15 13.55C9.15 13.77 9 13.97 8.8 14.05C8.57 14.15 8.33 14.09 8.14 13.93C8.08 13.88 8.04 13.83 8 13.76C6.87 12.33 6.69 10.28 7.45 8.64C5.78 10 4.87 12.3 5 14.47C5.06 14.97 5.12 15.47 5.29 15.97C5.43 16.57 5.7 17.17 6 17.7C7.08 19.43 8.95 20.67 10.96 20.92C13.1 21.19 15.39 20.8 17.03 19.32C18.86 17.66 19.5 15 18.56 12.72L18.43 12.46C18.22 12 17.66 11.2 17.66 11.2M14.5 17.5C14.22 17.74 13.76 18 13.4 18.1C12.28 18.5 11.16 17.94 10.5 17.28C11.69 17 12.4 16.12 12.61 15.23C12.78 14.43 12.46 13.77 12.33 13C12.21 12.26 12.23 11.63 12.5 10.94C12.69 11.32 12.89 11.7 13.13 12C13.9 13 15.11 13.44 15.37 14.8C15.41 14.94 15.43 15.08 15.43 15.23C15.46 16.05 15.1 16.95 14.5 17.5H14.5Z",cool:"M20.79,13.95L18.46,14.57L16.46,13.44V10.56L18.46,9.43L20.79,10.05L21.31,8.12L19.54,7.65L20,5.88L18.07,5.36L17.45,7.69L15.45,8.82L13,7.38V5.12L14.71,3.41L13.29,2L12,3.29L10.71,2L9.29,3.41L11,5.12V7.38L8.5,8.82L6.5,7.69L5.92,5.36L4,5.88L4.47,7.65L2.7,8.12L3.22,10.05L5.55,9.43L7.55,10.56V13.45L5.55,14.58L3.22,13.96L2.7,15.89L4.47,16.36L4,18.12L5.93,18.64L6.55,16.31L8.55,15.18L11,16.62V18.88L9.29,20.59L10.71,22L12,20.71L13.29,22L14.7,20.59L13,18.88V16.62L15.5,15.17L17.5,16.3L18.12,18.63L20,18.12L19.53,16.35L21.3,15.88L20.79,13.95M9.5,10.56L12,9.11L14.5,10.56V13.44L12,14.89L9.5,13.44V10.56Z",off:"M16.56,5.44L15.11,6.89C16.84,7.94 18,9.83 18,12A6,6 0 0,1 12,18A6,6 0 0,1 6,12C6,9.83 7.16,7.94 8.88,6.88L7.44,5.44C5.36,6.88 4,9.28 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12C20,9.28 18.64,6.88 16.56,5.44M13,3H11V13H13",fan_only:yt,dry:St,window_open:Lt,windowBypass:Et,presence:$t,motion:At,eco:"M17,8C8,10 5.9,16.17 3.82,21.34L5.71,22L6.66,19.7C7.14,19.87 7.64,20 8,20C19,20 22,3 22,3C21,5 14,5.25 9,6.25C4,7.25 2,11.5 2,13.5C2,15.5 3.75,17.25 3.75,17.25C7,8 17,8 17,8Z",comfort:"M12.5 7C12.5 5.89 13.39 5 14.5 5H18C19.1 5 20 5.9 20 7V9.16C18.84 9.57 18 10.67 18 11.97V14H12.5V7M6 11.96V14H11.5V7C11.5 5.89 10.61 5 9.5 5H6C4.9 5 4 5.9 4 7V9.15C5.16 9.56 6 10.67 6 11.96M20.66 10.03C19.68 10.19 19 11.12 19 12.12V15H5V12C5 10.9 4.11 10 3 10S1 10.9 1 12V17C1 18.1 1.9 19 3 19V21H5V19H19V21H21V19C22.1 19 23 18.1 23 17V12C23 10.79 21.91 9.82 20.66 10.03Z",boost:"M13.13 22.19L11.5 18.36C13.07 17.78 14.54 17 15.9 16.09L13.13 22.19M5.64 12.5L1.81 10.87L7.91 8.1C7 9.46 6.22 10.93 5.64 12.5M21.61 2.39C21.61 2.39 16.66 .269 11 5.93C8.81 8.12 7.5 10.53 6.65 12.64C6.37 13.39 6.56 14.21 7.11 14.77L9.24 16.89C9.79 17.45 10.61 17.63 11.36 17.35C13.5 16.53 15.88 15.19 18.07 13C23.73 7.34 21.61 2.39 21.61 2.39M14.54 9.46C13.76 8.68 13.76 7.41 14.54 6.63S16.59 5.85 17.37 6.63C18.14 7.41 18.15 8.68 17.37 9.46C16.59 10.24 15.32 10.24 14.54 9.46M8.88 16.53L7.47 15.12L8.88 16.53M6.24 22L9.88 18.36C9.54 18.27 9.21 18.12 8.91 17.91L4.83 22H6.24M2 22H3.41L8.18 17.24L6.76 15.83L2 20.59V22M2 19.17L6.09 15.09C5.88 14.79 5.73 14.47 5.64 14.12L2 17.76V19.17Z",frost:"M14.46 9.41L11 7.38V5.12L12.71 3.41L11.29 2L10 3.29L8.71 2L7.29 3.41L9 5.12V7.38L6.5 8.82L4.5 7.69L3.92 5.36L2 5.88L2.47 7.65L.7 8.12L1.22 10.05L3.55 9.43L5.55 10.56V13.45L3.55 14.58L1.22 13.96L.7 15.89L2.47 16.36L2 18.12L3.93 18.64L4.55 16.31L6.55 15.18L9 16.62V18.88L7.29 20.59L8.71 22L10 20.71L11.29 22L12.7 20.59L11 18.88V16.62L14.46 14.61M7.5 10.56L10 9.11L12.5 10.56V13.44L10 14.89L7.5 13.44M19 5C17.89 5 17 5.89 17 7V13.76C16.36 14.33 16 15.15 16 16C16 17.66 17.34 19 19 19S22 17.66 22 16C22 15.15 21.64 14.33 21 13.77V7C21 5.89 20.11 5 19 5M19 6C19.55 6 20 6.45 20 7V8H18V7C18 6.45 18.45 6 19 6",activity:At,power:"M12 3L2 12H5V20H19V12H22L12 3M11.5 18V14H9L12.5 7V11H15L11.5 18Z",flashAlert:wt,temperature:"M15 13V5A3 3 0 0 0 9 5V13A5 5 0 1 0 15 13M12 4A1 1 0 0 1 13 5V8H11V5A1 1 0 0 1 12 4Z",humidity:St,ok:bt,thermometerAlert:kt,none:"M23 17C23 20.31 20.31 23 17 23V21.5C19.5 21.5 21.5 19.5 21.5 17H23M1 7C1 3.69 3.69 1 7 1V2.5C4.5 2.5 2.5 4.5 2.5 7H1M8 4.32L3.41 8.92C.19 12.14 .19 17.37 3.41 20.59S11.86 23.81 15.08 20.59L22.15 13.5C22.64 13.03 22.64 12.24 22.15 11.75C21.66 11.26 20.87 11.26 20.38 11.75L15.96 16.17L15.25 15.46L21.79 8.92C22.28 8.43 22.28 7.64 21.79 7.15S20.5 6.66 20 7.15L14.19 13L13.5 12.27L20.37 5.38C20.86 4.89 20.86 4.1 20.37 3.61S19.09 3.12 18.6 3.61L11.71 10.5L11 9.8L16.5 4.32C17 3.83 17 3.04 16.5 2.55S15.22 2.06 14.73 2.55L7.11 10.17C8.33 11.74 8.22 14 6.78 15.45L6.07 14.74C7.24 13.57 7.24 11.67 6.07 10.5L5.72 10.15L9.79 6.08C10.28 5.59 10.28 4.8 9.79 4.31C9.29 3.83 8.5 3.83 8 4.32Z",auto_regulation_mode:Ct,power_percent:Ct,mean_power_cycle:"M7,2V13H10V22L17,10H13L17,2H7Z",valve_open_percent:"M22 13V21H20V19H16.58C15.81 20.76 14.05 22 12 22S8.19 20.76 7.42 19H4V21H2V13H4V15H7.43C7.93 13.85 8.85 12.93 10 12.42V11H8V9H16V11H14V12.42C15.15 12.93 16.07 13.85 16.57 15H20V13H22M17 2H7C6.45 2 6 2.45 6 3S6.45 4 7 4H10V5H11V8H13V5H14V4H17C17.55 4 18 3.55 18 3S17.55 2 17 2Z",regulated_target_temperature:"M12 14C11.7 13.6 11.4 13.3 11 13V5C11 3.3 9.7 2 8 2S5 3.3 5 5V13C2.8 14.7 2.3 17.8 4 20S8.8 22.7 11 21 13.7 16.2 12 14M9 8H7V5C7 4.5 7.5 4 8 4S9 4.5 9 5V8M18 3H16L12.8 12H14.7L15.4 10H18.6L19.3 12H21.2L18 3M15.8 8.7L17 5L18.2 8.7H15.8Z",auto_fan_mode:"M12.5 2C8.93 2 8.14 5.96 10.13 9.65C9.72 9.97 9.4 10.39 9.21 10.87C8.28 10.68 7.23 10.25 6.73 9.26C5.56 6.89 2 7 2 11.5C2 15.07 5.95 15.85 9.64 13.87C9.96 14.27 10.39 14.59 10.88 14.79C10.68 15.71 10.24 16.75 9.26 17.24C6.9 18.42 7 22 11.5 22C12.31 22 13 21.78 13.5 21.41C13.19 20.67 13 19.86 13 19C13 17.59 13.5 16.3 14.3 15.28C14.17 14.97 14.03 14.65 13.86 14.34C14.26 14 14.57 13.59 14.77 13.11C15.26 13.21 15.78 13.39 16.25 13.67C17.07 13.25 18 13 19 13C20.05 13 21.03 13.27 21.89 13.74C21.95 13.37 22 12.96 22 12.5C22 8.92 18.03 8.13 14.33 10.13C14 9.73 13.59 9.42 13.11 9.22C13.3 8.29 13.74 7.24 14.73 6.75C17.09 5.57 17 2 12.5 2M12 11C12.54 11 13 11.45 13 12C13 12.55 12.54 13 12 13C11.43 13 11 12.55 11 12C11 11.45 11.43 11 12 11M18 15C16.89 15 16 15.9 16 17V23H18V21H20V23H22V17C22 15.9 21.1 15 20 15M18 17H20V19H18Z",auto_fan_mode_off:"M12.5,2C9.64,2 8.57,4.55 9.29,7.47L15,13.16C15.87,13.37 16.81,13.81 17.28,14.73C18.46,17.1 22.03,17 22.03,12.5C22.03,8.92 18.05,8.13 14.35,10.13C14.03,9.73 13.61,9.42 13.13,9.22C13.32,8.29 13.76,7.24 14.75,6.75C17.11,5.57 17,2 12.5,2M3.28,4L2,5.27L4.47,7.73C3.22,7.74 2,8.87 2,11.5C2,15.07 5.96,15.85 9.65,13.87C9.97,14.27 10.4,14.59 10.89,14.79C10.69,15.71 10.25,16.75 9.27,17.24C6.91,18.42 7,22 11.5,22C13.8,22 14.94,20.36 14.94,18.21L18.73,22L20,20.72L3.28,4Z",fan_mode:yt,power_sleep:xt},Jn="none",Gn="auto_fan_none",Qn={auto_fan_none:"None",auto_fan_low:"Low",auto_fan_mid:"Medium",auto_fan_high:"High",auto_fan_turbo:"Turbo"};function ts(t){const e=window;e.customCards=e.customCards||[],e.customCards.push(Object.assign(Object.assign({},t),{preview:!0}))}function es(t){const e=(new Date).getTime()-t.getTime();return Math.floor(e/6e4)}function is(t,e){const i=Math.round(t*e)/e;return parseFloat(i.toFixed(e))}console.info("%c VersatileThermostatUI-CARD \n%c version: 1.1.1 ","color: orange; font-weight: bold; background: black","color: white; font-weight: bold; background: dimgray"),ts({type:"versatile-thermostat-ui-card",name:"Versatile Thermostat Climate Card",description:"Card for climate entity"});let os=class extends at{constructor(){super(),this.value={},this._selectTargetTemperature="low",this.current=0,this.humidity=0,this.min=7,this.max=35,this.step=.5,this.window=!1,this.windowByPass=!1,this.presence=!1,this.motion=!1,this.overpowering=!1,this.is_device_active=!1,this.status="loading",this.mode="off",this.hvac_action="idle",this.preset=Jn,this.dragging=!1,this.name="",this.target="value",this._debouncedCallService=((t,e,i=!1)=>{let o;const n=(...n)=>{const s=i&&!o;clearTimeout(o),o=window.setTimeout((()=>{o=void 0,i||t(...n)}),e),s&&t(...n)};return n.cancel=()=>{clearTimeout(o)},n})((t=>this._callService(t)),1e3),this._init=!0,this._firstRender=!0,this._ignore=!1,this._hasWindow=!1,this._hasWindowByPass=!1,this._hasPresence=!1,this._hasMotion=!1,this._hasOverpowering=!1,this._hasAutoStartStop=!1,this._isAutoStartStopEnabled=!1,this._oldValueMin=0,this._oldValueMax=0,this._display_bottom=0,this._display_top=0,this.modes=[],this.presets=[],this.security_state={},this.powerInfos=[],this._externalPowerInfos=[],this.auto_fan_infos={},this.error=[],this.render=()=>{var t,e,i,o,n,s,r,a,l,c,h,u,d,p,_,m,v,f,g,b,y,w,$,C,A,x,k,S,L;return F` ${(null===(t=this._config)||void 0===t?void 0:t.disable_menu)?"":F` @@ -438,7 +438,7 @@ const qn=270;const Yn=new Set(["ArrowRight","ArrowUp","ArrowLeft","ArrowDown","P `:""} -
+
${(null===(o=this._config)||void 0===o?void 0:o.disable_circle)?F` `:null!=this.value.low&&null!=this.value.high&&"unavailable"!==this.stateObj.state?F` @@ -495,16 +495,16 @@ const qn=270;const Yn=new Set(["ArrowRight","ArrowUp","ArrowLeft","ArrowDown","P ${(null===($=this._config)||void 0===$?void 0:$.disable_circle)?B` - ${this._renderTemperature(this._display_top,!0,"55","60%")} - ${this._renderTemperature(this._display_bottom,!1,"90","60%")} + ${this._renderTemperature(this._display_top,!0,"55","60%",!(null===(C=null==this?void 0:this._config)||void 0===C?void 0:C.set_current_as_main))} + ${this._renderTemperature(this._display_bottom,!1,"90","60%",1==(null===(A=null==this?void 0:this._config)||void 0===A?void 0:A.set_current_as_main))} ${this._renderHVACAction()} `:B` - ${this._renderTemperature(this._display_top,!0,"50%","60%")} + ${this._renderTemperature(this._display_top,!0,"50%","60%",!(null===(x=null==this?void 0:this._config)||void 0===x?void 0:x.set_current_as_main))} - ${this._renderTemperature(this._display_bottom,!1,"-5%","0%")} + ${this._renderTemperature(this._display_bottom,!1,"-5%","0%",1==(null===(k=null==this?void 0:this._config)||void 0===k?void 0:k.set_current_as_main))} ${this._renderHVACAction()} `} @@ -512,7 +512,7 @@ const qn=270;const Yn=new Set(["ArrowRight","ArrowUp","ArrowLeft","ArrowDown","P
- ${(null===(C=this._config)||void 0===C?void 0:C.disable_window)?F``:F` + ${(null===(S=this._config)||void 0===S?void 0:S.disable_window)?F``:F` `}
@@ -520,7 +520,7 @@ const qn=270;const Yn=new Set(["ArrowRight","ArrowUp","ArrowLeft","ArrowDown","P ${this.modes.map((t=>{var e,i,o,n,s,r,a;return(null===(e=this._config)||void 0===e?void 0:e.disable_heat)&&"heat"===t||(null===(i=this._config)||void 0===i?void 0:i.disable_auto)&&"auto"===t||(null===(o=this._config)||void 0===o?void 0:o.disable_cool)&&"cool"===t||(null===(n=this._config)||void 0===n?void 0:n.disable_heat_cool)&&"heat_cool"===t||(null===(s=this._config)||void 0===s?void 0:s.disable_dry)&&"dry"===t||(null===(r=this._config)||void 0===r?void 0:r.disable_fan_only)&&"fan_only"===t||(null===(a=this._config)||void 0===a?void 0:a.disable_off)&&"off"===t?F``:this._renderIcon(t,this.mode)}))} `}
- ${(null===(A=null==this?void 0:this._config)||void 0===A?void 0:A.disable_buttons)?F``:F` + ${(null===(L=null==this?void 0:this._config)||void 0===L?void 0:L.disable_buttons)?F``:F`
- `}}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}static async getConfigElement(){return await Promise.resolve().then((function(){return hs})),document.createElement("versatile-thermostat-ui-card-editor")}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>["climate"].includes(t.split(".")[0]))),i=e.filter((e=>{var i;return null===(i=t.states[e].attributes)||void 0===i?void 0:i.call_for_heat}));return{type:"custom:versatile-thermostat-ui-card",entity:i[0]||e[0]}}_highChanged(t){const e=t.detail.value;if(isNaN(e))return;const i=t.type.replace("-changed","");this.value=Object.assign(Object.assign({},this.value),{[i]:e}),this._selectTargetTemperature=i,this._callService(i)}_highChanging(t){const e=t.detail.value;if(isNaN(e))return;const i=t.type.replace("-changing","");this.value=Object.assign(Object.assign({},this.value),{[i]:e}),this._selectTargetTemperature=i,this._updateDisplay(),this._vibrate(20)}_callService(t){"high"!==t&&"low"!==t?this.hass.callService("climate","set_temperature",{entity_id:this.stateObj.entity_id,temperature:this.value.value}):this.hass.callService("climate","set_temperature",{entity_id:this.stateObj.entity_id,target_temp_low:this.value.low,target_temp_high:this.value.high})}_handleButton(t){var e;const i=t.currentTarget.target,o=t.currentTarget.step,n="high"===i?this.max:this.min;let s=null!==(e=this.value[i])&&void 0!==e?e:n;s+=o,s=gi(s,this.min,this.max),"high"===i&&null!=this.value.low&&(s=gi(s,this.value.low,this.max)),"low"===i&&null!=this.value.high&&(s=gi(s,this.min,this.value.high)),this.value=Object.assign(Object.assign({},this.value),{[i]:s}),this._updateDisplay(),this._vibrate(40),this._debouncedCallService(i)}_handleSelectTemp(t){const e=t.currentTarget.target;this._selectTargetTemperature=e,this._updateDisplay(),this._vibrate(40)}setConfig(t){this._config=Object.assign({tap_action:{action:"toggle"},hold_action:{action:"more-info"}},t)}getCardSize(){return 1}_vibrate(t){try{navigator.vibrate(t)}catch(t){}}firstUpdated(t){this._init=!1}shouldUpdate(t){return void 0!==t.has("_config")&&void 0!==t.get("_config")&&(this._hasOverpowering=!1,this._hasWindow=!1,this._hasWindowByPass=!1,this._hasMotion=!1,this._hasPresence=!1,this._hasAutoStartStop=!1,this._isAutoStartStopEnabled=!1,this.humidity=0),void 0!==t.get("hass")&&(this._init=!1),!0}updated(t){var e,i;super.updated(t),this._firstRender=!1,null===(i=null===(e=null==this?void 0:this.shadowRoot)||void 0===e?void 0:e.querySelector(".security"))||void 0===i||i.addEventListener("click",(()=>{var t,e,i,o;null===(e=null===(t=null==this?void 0:this.shadowRoot)||void 0===t?void 0:t.querySelector(".security"))||void 0===e||e.remove(),null===(o=null===(i=null==this?void 0:this.shadowRoot)||void 0===i?void 0:i.querySelector(".content"))||void 0===o||o.classList.remove("security_msg"),this._vibrate(2)}))}_willUpdatePower(){let t,e,i;this._externalPowerInfos=[],this._config.powerEntity&&(t=this.hass.states[this._config.powerEntity],e=Number(t.state),i=t.attributes.unit_of_measurement),e&&this._externalPowerInfos.push({name:"mean_power_cycle",value:e,unit:i,class:"vt-power-color"})}willUpdate(t){var e,i,o,n,s,r;if(!this.hass||!this._config||!t.has("hass")&&!t.has("_config"))return;const a=this._config.entity;this._willUpdatePower();const l=this.hass.states[a];if(!l)return;const c=t.get("hass");if(!c||c.states[a]!==l){if(!this._config||!this.hass||!this._config.entity)return;console.log("Something may have change"),this.stateObj=l;const t=this.stateObj.attributes,a=this.stateObj.state;if(this.name="",(null===(e=this._config)||void 0===e?void 0:e.disable_name)||(this.name=this._config.name?this._config.name:t.friendly_name),this.mode=a||"off",t.hvac_modes&&(this.modes=Object.values(t.hvac_modes)),t.preset_modes&&(this.presets=Object.values(t.preset_modes.filter((t=>t!=Jn&&("cool"!=a||"frost"!=t))))),this.preset=t.preset_mode,this.value={value:(null==t?void 0:t.temperature)||0,low:(null==t?void 0:t.target_temp_low)||null,high:(null==t?void 0:t.target_temp_high)||null},t.target_temperature_step&&(this.step=t.target_temperature_step),t.min_temp&&(this.min=t.min_temp),t.max_temp&&(this.max=t.max_temp),t.current_temperature&&(this.current=t.current_temperature),void 0!==(null==t?void 0:t.humidity)&&(this.humidity=parseFloat(t.humidity)),"on"===(null==t?void 0:t.window_state)||"on"===(null==t?void 0:t.window_auto_state)?(this._hasWindow=!0,this.window=!0):(this._hasWindow=!1,this.window=!1),"on"===(null==t?void 0:t.overpowering_state)?(this._hasOverpowering=!0,this.overpowering=t.overpowering_state):(this._hasOverpowering=!1,this.overpowering=!1),"on"===(null==t?void 0:t.presence_state)?(this._hasPresence=!0,this.presence=t.presence_state):(this._hasPresence=!1,this.presence=!1),"on"===(null==t?void 0:t.motion_state)?(this._hasMotion=!0,this.motion=t.motion_state):(this._hasMotion=!1,this.motion=!1),(null==t?void 0:t.is_window_bypass)?(this._hasWindowByPass=!0,this.windowByPass=t.is_window_bypass):(this._hasWindowByPass=!1,this.windowByPass=!1),"on"!==(null==t?void 0:t.security_state)||(null===(i=null==this?void 0:this._config)||void 0===i?void 0:i.disable_security_warning))this.security_state=null;else{if(this.security_state=[],t.last_temperature_datetime){let e=es(new Date(t.last_temperature_datetime));e>0&&this.security_state.push({name:"Room temp.",security_msg:e+" min"})}if(t.last_ext_temperature_datetime){let e=es(new Date(t.last_ext_temperature_datetime));e>0&&this.security_state.push({name:"External temp.",security_msg:e+" min"})}}if(this.is_device_active=!0===(null==t?void 0:t.is_device_active),void 0!==(null==t?void 0:t.errors)){const e=JSON.parse(t.errors);e.length>0?this.error=e[0]:this.error=[]}else this.error=[];if(this.powerInfos=[],!(null===(o=this._config)||void 0===o?void 0:o.disable_power_infos)&&(null==t?void 0:t.is_on)&&((null==t?void 0:t.is_over_switch)&&((null==t?void 0:t.mean_cycle_power)&&!(null===(n=this._config)||void 0===n?void 0:n.powerEntity)&&this.powerInfos.push({name:"mean_power_cycle",value:is(null==t?void 0:t.mean_cycle_power,1),unit:(null==t?void 0:t.mean_cycle_power)<20?"kW":"W",class:"vt-power-color"}),this.powerInfos.push({name:"power_percent",value:null==t?void 0:t.power_percent,unit:"%",class:"vt-power-color"})),(null==t?void 0:t.is_over_valve)&&this.powerInfos.push({name:"valve_open_percent",value:null==t?void 0:t.valve_open_percent,unit:"%",class:"vt-power-color"}),(null==t?void 0:t.is_over_climate)&&((null==t?void 0:t.device_power)&&!(null===(s=this._config)||void 0===s?void 0:s.powerEntity)&&this.powerInfos.push({name:"mean_power_cycle",value:null==t?void 0:t.device_power,unit:(null==t?void 0:t.device_power)<20?"kW":"W",class:"vt-power-color"}),(null==t?void 0:t.is_regulated)&&(this.powerInfos.push({name:"regulated_target_temperature",value:null==t?void 0:t.regulated_target_temperature,unit:null==t?void 0:t.temperature_unit,class:"vt-temp-color"}),this.powerInfos.push({name:"auto_regulation_mode",value:ci({hass:this.hass,string:`extra_states.${null==t?void 0:t.auto_regulation_mode}`}),unit:"",class:"vt-label-color"})))),this.auto_fan_infos=[],!(null===(r=null==this?void 0:this._config)||void 0===r?void 0:r.disable_auto_fan_infos)&&(null==t?void 0:t.is_over_climate)){const e=(null==t?void 0:t.current_auto_fan_mode)!=Gn?"auto_fan_mode":"auto_fan_mode_off";this.auto_fan_infos.push({name:e,value:ci({hass:this.hass,string:`extra_states.${null==t?void 0:t.current_auto_fan_mode}`}),unit:"",class:"vt-label-color"}),(null==t?void 0:t.fan_mode)&&this.auto_fan_infos.push({name:"fan_mode",value:ci({hass:this.hass,string:`extra_states.fan_${null==t?void 0:t.fan_mode}`}),unit:"",class:"vt-label-color"})}this._hasAutoStartStop="auto_start_stop"===(null==t?void 0:t.hvac_off_reason),this._isAutoStartStopEnabled=!0===(null==t?void 0:t.auto_start_stop_enable),this._updateDisplay()}}_updateDisplay(){var t;(null===(t=null==this?void 0:this._config)||void 0===t?void 0:t.set_current_as_main)?(this._display_bottom=this._getCurrentSetpoint(),this._display_top=this.current):(this._display_bottom=this.current,this._display_top=this._getCurrentSetpoint())}_handleAction(t){this.hass.callService("climate","set_hvac_mode",{entity_id:this._config.entity,hvac_mode:t.currentTarget.mode})}_handlePreset(t){this.last_target_temperature=this.stateObj.attributes.temperature,this.hass.callService("climate","set_preset_mode",{entity_id:this._config.entity,preset_mode:t.currentTarget.preset})}_recordPreset(t){this.hass.callService("versatile_thermostat","set_preset_temperature",{entity_id:this._config.entity,preset:t.currentTarget.preset,temperature:this.last_target_temperature})}_handleClickOrDoubleClick(t){1===t.detail?this._handlePreset(t):2===t.detail&&this._recordPreset(t)}_handleClickInfo(t){this.hass.callService("versatile_thermostat","set_device_power",{entity_id:this._config.entity,preset_mode:t.currentTarget.preset})}_handleClickAutoFanInfo(){let t=Gn;this.stateObj.attributes.current_auto_fan_mode==Gn&&(t=this.stateObj.attributes.auto_fan_mode);const e=Qn[t];console.info(`VersatileThermostatUI-CARD changing auto_fan_mode to ${t} (mapped=$${e}`),this.hass.callService("versatile_thermostat","set_auto_fan_mode",{entity_id:this._config.entity,auto_fan_mode:e})}_handleClickAutoStartStopEnable(){let t=!this._isAutoStartStopEnabled;console.info(`VersatileThermostatUI-CARD changing auto_start_stop_enable to ${t}`),this.hass.callService("switch","toggle",{entity_id:this._config.autoStartStopEnableEntity})}_setTemperature(){this.hass.callService("climate","set_temperature",{entity_id:this._config.entity,temperature:this.value})}_getCurrentSetpoint(){var t,e,i,o,n,s,r,a;return null!==(null===(t=null==this?void 0:this.value)||void 0===t?void 0:t.high)&&null!==(null===(e=null==this?void 0:this.value)||void 0===e?void 0:e.low)?((null===(i=null==this?void 0:this.value)||void 0===i?void 0:i.low)||0)>=this.current?(null===(o=null==this?void 0:this.value)||void 0===o?void 0:o.low)||0:((null===(n=null==this?void 0:this.value)||void 0===n?void 0:n.high)||0)<=this.current?(null===(s=null==this?void 0:this.value)||void 0===s?void 0:s.high)||0:(null===(r=null==this?void 0:this.value)||void 0===r?void 0:r.low)||0:(null===(a=null==this?void 0:this.value)||void 0===a?void 0:a.value)||0}_renderHVACAction(){var t,e,i,o;return"heating"===(null===(t=this.stateObj)||void 0===t?void 0:t.attributes.hvac_action)||"heat"==(null===(e=this.stateObj)||void 0===e?void 0:e.attributes.hvac_mode)||"heat_cool"==(null===(i=this.stateObj)||void 0===i?void 0:i.attributes.hvac_mode)?B``:"cooling"===(null===(o=this.stateObj)||void 0===o?void 0:o.attributes.hvac_action)||"cool"==this.stateObj.attributes.hvac_mode?B``:B``}_renderIcon(t,e){if(!Kn[t])return F``;const i=this.hass.localize(`component.climate.state._.${t}`)||ci({hass:this.hass,string:`extra_states.${t}`});return F` + `}}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}static async getConfigElement(){return await Promise.resolve().then((function(){return hs})),document.createElement("versatile-thermostat-ui-card-editor")}static async getStubConfig(t){const e=Object.keys(t.states).filter((t=>["climate"].includes(t.split(".")[0]))),i=e.filter((e=>{var i;return null===(i=t.states[e].attributes)||void 0===i?void 0:i.call_for_heat}));return{type:"custom:versatile-thermostat-ui-card",entity:i[0]||e[0]}}_highChanged(t){const e=t.detail.value;if(isNaN(e))return;const i=t.type.replace("-changed","");this.value=Object.assign(Object.assign({},this.value),{[i]:e}),this._selectTargetTemperature=i,this._callService(i)}_highChanging(t){const e=t.detail.value;if(isNaN(e))return;const i=t.type.replace("-changing","");this.value=Object.assign(Object.assign({},this.value),{[i]:e}),this._selectTargetTemperature=i,this._updateDisplay(),this._vibrate(20)}_callService(t){"high"!==t&&"low"!==t?this.hass.callService("climate","set_temperature",{entity_id:this.stateObj.entity_id,temperature:this.value.value}):this.hass.callService("climate","set_temperature",{entity_id:this.stateObj.entity_id,target_temp_low:this.value.low,target_temp_high:this.value.high})}_handleButton(t){var e;const i=t.currentTarget.target,o=t.currentTarget.step,n="high"===i?this.max:this.min;let s=null!==(e=this.value[i])&&void 0!==e?e:n;s+=o,s=gi(s,this.min,this.max),"high"===i&&null!=this.value.low&&(s=gi(s,this.value.low,this.max)),"low"===i&&null!=this.value.high&&(s=gi(s,this.min,this.value.high)),this.value=Object.assign(Object.assign({},this.value),{[i]:s}),this._updateDisplay(),this._vibrate(40),this._debouncedCallService(i)}_handleSelectTemp(t){const e=t.currentTarget.target;this._selectTargetTemperature=e,this._updateDisplay(),this._vibrate(40)}setConfig(t){this._config=Object.assign({tap_action:{action:"toggle"},hold_action:{action:"more-info"}},t)}getCardSize(){return 1}_vibrate(t){try{navigator.vibrate(t)}catch(t){}}firstUpdated(t){this._init=!1}shouldUpdate(t){return void 0!==t.has("_config")&&void 0!==t.get("_config")&&(this._hasOverpowering=!1,this._hasWindow=!1,this._hasWindowByPass=!1,this._hasMotion=!1,this._hasPresence=!1,this._hasAutoStartStop=!1,this._isAutoStartStopEnabled=!1,this.humidity=0),void 0!==t.get("hass")&&(this._init=!1),!0}updated(t){var e,i;super.updated(t),this._firstRender=!1,null===(i=null===(e=null==this?void 0:this.shadowRoot)||void 0===e?void 0:e.querySelector(".security"))||void 0===i||i.addEventListener("click",(()=>{var t,e,i,o;null===(e=null===(t=null==this?void 0:this.shadowRoot)||void 0===t?void 0:t.querySelector(".security"))||void 0===e||e.remove(),null===(o=null===(i=null==this?void 0:this.shadowRoot)||void 0===i?void 0:i.querySelector(".content"))||void 0===o||o.classList.remove("security_msg"),this._vibrate(2)}))}_willUpdatePower(){let t,e,i;this._externalPowerInfos=[],this._config.powerEntity&&(t=this.hass.states[this._config.powerEntity],e=Number(t.state),i=t.attributes.unit_of_measurement),e&&this._externalPowerInfos.push({name:"mean_power_cycle",value:e,unit:i,class:"vt-power-color"})}willUpdate(t){var e,i,o,n,s,r;if(!this.hass||!this._config||!t.has("hass")&&!t.has("_config"))return;const a=this._config.entity;this._willUpdatePower();const l=this.hass.states[a];if(!l)return;const c=t.get("hass");if(!c||c.states[a]!==l){if(!this._config||!this.hass||!this._config.entity)return;console.log("Something may have change"),this.stateObj=l;const t=this.stateObj.attributes,a=this.stateObj.state;if(this.name="",(null===(e=this._config)||void 0===e?void 0:e.disable_name)||(this.name=this._config.name?this._config.name:t.friendly_name),this.mode=a||"off",this.hvac_action=null==t?void 0:t.hvac_action,(null==t?void 0:t.power_percent)>0&&(this.hvac_action="heat"==this.mode?"heating":"cooling"),this.is_device_active=!0===(null==t?void 0:t.is_device_active),t.hvac_modes&&(this.modes=Object.values(t.hvac_modes)),t.preset_modes&&(this.presets=Object.values(t.preset_modes.filter((t=>t!=Jn&&("cool"!=a||"frost"!=t))))),this.preset=t.preset_mode,this.value={value:(null==t?void 0:t.temperature)||0,low:(null==t?void 0:t.target_temp_low)||null,high:(null==t?void 0:t.target_temp_high)||null},t.target_temperature_step&&(this.step=t.target_temperature_step),t.min_temp&&(this.min=t.min_temp),t.max_temp&&(this.max=t.max_temp),t.current_temperature&&(this.current=t.current_temperature),void 0!==(null==t?void 0:t.humidity)&&(this.humidity=parseFloat(t.humidity)),"on"===(null==t?void 0:t.window_state)||"on"===(null==t?void 0:t.window_auto_state)?(this._hasWindow=!0,this.window=!0):(this._hasWindow=!1,this.window=!1),"on"===(null==t?void 0:t.overpowering_state)?(this._hasOverpowering=!0,this.overpowering=t.overpowering_state):(this._hasOverpowering=!1,this.overpowering=!1),"on"===(null==t?void 0:t.presence_state)?(this._hasPresence=!0,this.presence=t.presence_state):(this._hasPresence=!1,this.presence=!1),"on"===(null==t?void 0:t.motion_state)?(this._hasMotion=!0,this.motion=t.motion_state):(this._hasMotion=!1,this.motion=!1),(null==t?void 0:t.is_window_bypass)?(this._hasWindowByPass=!0,this.windowByPass=t.is_window_bypass):(this._hasWindowByPass=!1,this.windowByPass=!1),"on"!==(null==t?void 0:t.security_state)||(null===(i=null==this?void 0:this._config)||void 0===i?void 0:i.disable_security_warning))this.security_state=null;else{if(this.security_state=[],t.last_temperature_datetime){let e=es(new Date(t.last_temperature_datetime));e>0&&this.security_state.push({name:"Room temp.",security_msg:e+" min"})}if(t.last_ext_temperature_datetime){let e=es(new Date(t.last_ext_temperature_datetime));e>0&&this.security_state.push({name:"External temp.",security_msg:e+" min"})}}if(void 0!==(null==t?void 0:t.errors)){const e=JSON.parse(t.errors);e.length>0?this.error=e[0]:this.error=[]}else this.error=[];if(this.powerInfos=[],!(null===(o=this._config)||void 0===o?void 0:o.disable_power_infos)&&(null==t?void 0:t.is_on)&&((null==t?void 0:t.is_over_switch)&&((null==t?void 0:t.mean_cycle_power)&&!(null===(n=this._config)||void 0===n?void 0:n.powerEntity)&&this.powerInfos.push({name:"mean_power_cycle",value:is(null==t?void 0:t.mean_cycle_power,1),unit:(null==t?void 0:t.mean_cycle_power)<20?"kW":"W",class:"vt-power-color"}),this.powerInfos.push({name:"power_percent",value:null==t?void 0:t.power_percent,unit:"%",class:"vt-power-color"})),(null==t?void 0:t.is_over_valve)&&this.powerInfos.push({name:"valve_open_percent",value:null==t?void 0:t.valve_open_percent,unit:"%",class:"vt-power-color"}),(null==t?void 0:t.is_over_climate)&&((null==t?void 0:t.device_power)&&!(null===(s=this._config)||void 0===s?void 0:s.powerEntity)&&this.powerInfos.push({name:"mean_power_cycle",value:null==t?void 0:t.device_power,unit:(null==t?void 0:t.device_power)<20?"kW":"W",class:"vt-power-color"}),(null==t?void 0:t.is_regulated)&&(this.powerInfos.push({name:"regulated_target_temperature",value:null==t?void 0:t.regulated_target_temperature,unit:null==t?void 0:t.temperature_unit,class:"vt-temp-color"}),this.powerInfos.push({name:"auto_regulation_mode",value:ci({hass:this.hass,string:`extra_states.${null==t?void 0:t.auto_regulation_mode}`}),unit:"",class:"vt-label-color"})))),this.auto_fan_infos=[],!(null===(r=null==this?void 0:this._config)||void 0===r?void 0:r.disable_auto_fan_infos)&&(null==t?void 0:t.is_over_climate)){const e=(null==t?void 0:t.current_auto_fan_mode)!=Gn?"auto_fan_mode":"auto_fan_mode_off";this.auto_fan_infos.push({name:e,value:ci({hass:this.hass,string:`extra_states.${null==t?void 0:t.current_auto_fan_mode}`}),unit:"",class:"vt-label-color"}),(null==t?void 0:t.fan_mode)&&this.auto_fan_infos.push({name:"fan_mode",value:ci({hass:this.hass,string:`extra_states.fan_${null==t?void 0:t.fan_mode}`}),unit:"",class:"vt-label-color"})}this._hasAutoStartStop="auto_start_stop"===(null==t?void 0:t.hvac_off_reason),this._isAutoStartStopEnabled=!0===(null==t?void 0:t.auto_start_stop_enable),this._updateDisplay()}}_updateDisplay(){var t;(null===(t=null==this?void 0:this._config)||void 0===t?void 0:t.set_current_as_main)?(this._display_bottom=this._getCurrentSetpoint(),this._display_top=this.current):(this._display_bottom=this.current,this._display_top=this._getCurrentSetpoint())}_handleAction(t){this.hass.callService("climate","set_hvac_mode",{entity_id:this._config.entity,hvac_mode:t.currentTarget.mode})}_handlePreset(t){this.last_target_temperature=this.stateObj.attributes.temperature,this.hass.callService("climate","set_preset_mode",{entity_id:this._config.entity,preset_mode:t.currentTarget.preset})}_recordPreset(t){this.hass.callService("versatile_thermostat","set_preset_temperature",{entity_id:this._config.entity,preset:t.currentTarget.preset,temperature:this.last_target_temperature})}_handleClickOrDoubleClick(t){1===t.detail?this._handlePreset(t):2===t.detail&&this._recordPreset(t)}_handleClickInfo(t){this.hass.callService("versatile_thermostat","set_device_power",{entity_id:this._config.entity,preset_mode:t.currentTarget.preset})}_handleClickAutoFanInfo(){let t=Gn;this.stateObj.attributes.current_auto_fan_mode==Gn&&(t=this.stateObj.attributes.auto_fan_mode);const e=Qn[t];console.info(`VersatileThermostatUI-CARD changing auto_fan_mode to ${t} (mapped=$${e}`),this.hass.callService("versatile_thermostat","set_auto_fan_mode",{entity_id:this._config.entity,auto_fan_mode:e})}_handleClickAutoStartStopEnable(){let t=!this._isAutoStartStopEnabled;console.info(`VersatileThermostatUI-CARD changing auto_start_stop_enable to ${t}`),this.hass.callService("switch","toggle",{entity_id:this._config.autoStartStopEnableEntity})}_setTemperature(){this.hass.callService("climate","set_temperature",{entity_id:this._config.entity,temperature:this.value})}_getCurrentSetpoint(){var t,e,i,o,n,s,r,a;return null!==(null===(t=null==this?void 0:this.value)||void 0===t?void 0:t.high)&&null!==(null===(e=null==this?void 0:this.value)||void 0===e?void 0:e.low)?((null===(i=null==this?void 0:this.value)||void 0===i?void 0:i.low)||0)>=this.current?(null===(o=null==this?void 0:this.value)||void 0===o?void 0:o.low)||0:((null===(n=null==this?void 0:this.value)||void 0===n?void 0:n.high)||0)<=this.current?(null===(s=null==this?void 0:this.value)||void 0===s?void 0:s.high)||0:(null===(r=null==this?void 0:this.value)||void 0===r?void 0:r.low)||0:(null===(a=null==this?void 0:this.value)||void 0===a?void 0:a.value)||0}_renderHVACAction(){var t,e;return"heating"===this.hvac_action||"heat"==(null===(t=this.stateObj)||void 0===t?void 0:t.attributes.hvac_mode)||"heat_cool"==(null===(e=this.stateObj)||void 0===e?void 0:e.attributes.hvac_mode)?B``:"cooling"===this.hvac_action||"cool"==this.stateObj.attributes.hvac_mode?B``:B``}_renderIcon(t,e){if(!Kn[t])return F``;const i=this.hass.localize(`component.climate.state._.${t}`)||ci({hass:this.hass,string:`extra_states.${t}`});return F` ${e}
- `}_handleMoreInfo(){fi(this,"hass-more-info",{entityId:this._config.entity})}buildTitle(){var t,e,i;let o="";return this._hasWindow&&!(null===(t=this._config)||void 0===t?void 0:t.disable_window)&&(o+=ci({hass:this.hass,string:"extra_states.window_open"})+"\n"),this._hasWindowByPass&&(o+=ci({hass:this.hass,string:"extra_states.window_bypass"})+"\n"),this._hasOverpowering&&!(null===(e=this._config)||void 0===e?void 0:e.disable_overpowering)&&(o+=ci({hass:this.hass,string:"extra_states.overpowering"})+"\n"),this._hasPresence&&(o+=ci({hass:this.hass,string:"extra_states.presence"})+"\n"),this._hasAutoStartStop&&!(null===(i=this._config)||void 0===i?void 0:i.disable_autoStartStop)&&(o+=ci({hass:this.hass,string:"extra_states.auto_start_stop"})+"\n"),this._hasMotion&&(o+=ci({hass:this.hass,string:"extra_states.motion"})+"\n"),o}_renderTemperature(t,e,i,o){const n=e?15:6,s=e?-2:-1,r=e?-5.5:-2;let a;return a=t?bi(t,this.hass.locale,{minimumFractionDigits:1,maximumFractionDigits:1}):this.hass.localize("extra_states.temp_unavailable"),B` - - ${B`${a}`} - - ${B` - ${this.hass.config.unit_system.temperature} - `} - - + `}_handleMoreInfo(){fi(this,"hass-more-info",{entityId:this._config.entity})}buildTitle(){var t,e,i;let o="";return this._hasWindow&&!(null===(t=this._config)||void 0===t?void 0:t.disable_window)&&(o+=ci({hass:this.hass,string:"extra_states.window_open"})+"\n"),this._hasWindowByPass&&(o+=ci({hass:this.hass,string:"extra_states.window_bypass"})+"\n"),this._hasOverpowering&&!(null===(e=this._config)||void 0===e?void 0:e.disable_overpowering)&&(o+=ci({hass:this.hass,string:"extra_states.overpowering"})+"\n"),this._hasPresence&&(o+=ci({hass:this.hass,string:"extra_states.presence"})+"\n"),this._hasAutoStartStop&&!(null===(i=this._config)||void 0===i?void 0:i.disable_autoStartStop)&&(o+=ci({hass:this.hass,string:"extra_states.auto_start_stop"})+"\n"),this._hasMotion&&(o+=ci({hass:this.hass,string:"extra_states.motion"})+"\n"),o}_renderTemperature(t,e,i,o,n){const s=e?15:6,r=e?-2:-1,a=e?-5.5:-2;let l,c=74,h=57,u=.25;return l=t?bi(t,this.hass.locale,{minimumFractionDigits:1,maximumFractionDigits:1}):this.hass.localize("extra_states.temp_unavailable"),n&&e&&(c=25,h=54,u=.5),B` + ${n?B` + `:""} + + ${B`${l}`} + + ${B` + ${this.hass.config.unit_system.temperature} + `} + + `}};os.styles=r` :host { display: block; @@ -667,7 +674,7 @@ const qn=270;const Yn=new Set(["ArrowRight","ArrowUp","ArrowLeft","ArrowDown","P .disabled-circle-container{ height: 145px; width: 100%; - background: radial-gradient(var(--mode-color), transparent 50%); + background: radial-gradient(var(--hvac-mode-color), transparent 50%); } vt-ha-outlined-icon-button { @@ -816,7 +823,7 @@ const qn=270;const Yn=new Set(["ArrowRight","ArrowUp","ArrowLeft","ArrowDown","P --mode-color: var(--state-climate-dry-color); } .idle { - --mode-color: var(--state-climate-idle-color); + --mode-color: var(--state-climate-dry-color); } .unknown-mode { --mode-color: var(--state-unknown-color); @@ -830,6 +837,26 @@ const qn=270;const Yn=new Set(["ArrowRight","ArrowUp","ArrowLeft","ArrowDown","P --mode-color: var(--error-color) !important; } + .heat_heating { + --hvac-mode-color: var(--label-badge-red); + } + + .heat_idle { + --hvac-mode-color: var(--label-badge-yellow); + } + + .cool_cooling { + --hvac-mode-color: var(--label-badge-blue); + } + + .cool_idle { + --hvac-mode-color:rgb(125, 194, 225); + } + + .off_off { + --hvac-mode-color: var(--slider-track-color); + } + #modes { z-index: 3; position: relative; @@ -1049,7 +1076,7 @@ const qn=270;const Yn=new Set(["ArrowRight","ArrowUp","ArrowLeft","ArrowDown","P padding-top: 2em; } } - `,t([dt({attribute:!1})],os.prototype,"hass",void 0),t([dt({type:Number})],os.prototype,"value",void 0),t([pt()],os.prototype,"_selectTargetTemperature",void 0),t([dt({type:Number})],os.prototype,"current",void 0),t([dt({type:Number})],os.prototype,"humidity",void 0),t([dt({type:Number})],os.prototype,"min",void 0),t([dt({type:Number})],os.prototype,"max",void 0),t([dt({type:Number})],os.prototype,"step",void 0),t([dt({type:Boolean})],os.prototype,"window",void 0),t([dt({type:Boolean})],os.prototype,"windowByPass",void 0),t([dt({type:Boolean})],os.prototype,"presence",void 0),t([dt({type:Boolean})],os.prototype,"motion",void 0),t([dt({type:Boolean})],os.prototype,"overpowering",void 0),t([dt({type:Boolean})],os.prototype,"is_device_active",void 0),t([dt({type:String})],os.prototype,"status",void 0),t([dt({type:String})],os.prototype,"mode",void 0),t([dt({type:String})],os.prototype,"preset",void 0),t([dt({type:Boolean,reflect:!0})],os.prototype,"dragging",void 0),t([dt({type:String})],os.prototype,"name",void 0),t([pt()],os.prototype,"changingHigh",void 0),t([pt()],os.prototype,"_config",void 0),os=t([ct("versatile-thermostat-ui-card")],os);const ns=function(...t){const e="type"===t[0].type,i=t.map((t=>t.schema)),o=Object.assign({},...i);return e?Ni(o):Di(o)}(Di({index:Oi(Pi()),view_index:Oi(Pi()),view_layout:Vi("any",(()=>!0)),type:zi()}),Di({entity:Oi(zi()),name:Oi(zi()),icon:Oi(zi()),autoStartStopEnableEntity:Oi(zi()),powerEntity:Oi(zi())}),Di({disable_name:Oi(Ti()),disable_circle:Oi(Ti()),disable_window:Oi(Ti()),disable_autoStartStop:Oi(Ti()),disable_overpowering:Oi(Ti()),disable_heat:Oi(Ti()),disable_cool:Oi(Ti()),disable_heat_cool:Oi(Ti()),disable_auto:Oi(Ti()),disable_dry:Oi(Ti()),disable_fan_only:Oi(Ti()),disable_off:Oi(Ti()),disable_security_warning:Oi(Ti()),disable_power_infos:Oi(Ti()),disable_auto_fan_infos:Oi(Ti()),set_current_as_main:Oi(Ti()),eco_temperature:Oi(Pi()),disable_menu:Oi(Ti()),disable_buttons:Oi(Ti())})),ss=["icon_color","layout","fill_container","primary_info","secondary_info","icon_type","content_info","use_entity_picture","collapsible_controls","icon_animation"],rs=t=>{var e,i;customElements.get("ha-form")&&(customElements.get("hui-action-editor")||((t,e,i,o)=>{const[n,s,r]=t.split(".",3);return Number(n)>e||Number(n)===e&&(void 0===o?Number(s)>=i:Number(s)>i)||void 0!==o&&Number(n)===e&&Number(s)===i&&Number(r)>=o})(t,2022,11))||null===(e=customElements.get("hui-button-card"))||void 0===e||e.getConfigElement(),customElements.get("ha-entity-picker")||null===(i=customElements.get("hui-entities-card"))||void 0===i||i.getConfigElement()},as=["autoStartStopEnableEntity","powerEntity","disable_name","disable_circle","disable_window","disable_autoStartStop","disable_overpowering","disable_heat","disable_cool","disable_heat_cool","disable_auto","disable_dry","disable_fan_only","disable_off","disable_menu","disable_security_warning","disable_buttons","set_current_as_main","disable_power_infos","disable_auto_fan_infos"],ls=mi((()=>[{name:"entity",selector:{entity:{domain:["climate"]}}},{name:"name",selector:{text:{}}},{type:"grid",name:"",schema:[{name:"autoStartStopEnableEntity",selector:{entity:{domain:["switch"]}}},{name:"powerEntity",selector:{entity:{domain:["sensor","input_number"]}}}]},{type:"grid",name:"",schema:[{name:"disable_name",selector:{boolean:{}}},{name:"disable_circle",selector:{boolean:{}}},{name:"disable_window",selector:{boolean:{}}},{name:"disable_autoStartStop",selector:{boolean:{}}},{name:"disable_overpowering",selector:{boolean:{}}},{name:"disable_heat",selector:{boolean:{}}},{name:"disable_cool",selector:{boolean:{}}},{name:"disable_heat_cool",selector:{boolean:{}}},{name:"disable_auto",selector:{boolean:{}}},{name:"disable_dry",selector:{boolean:{}}},{name:"disable_fan_only",selector:{boolean:{}}},{name:"disable_off",selector:{boolean:{}}},{name:"disable_menu",selector:{boolean:{}}},{name:"disable_security_warning",selector:{boolean:{}}},{name:"disable_buttons",selector:{boolean:{}}},{name:"set_current_as_main",selector:{boolean:{}}},{name:"disable_power_infos",selector:{Boolean:{}}},{name:"disable_auto_fan_infos",selector:{Boolean:{}}}]}]));let cs=class extends at{constructor(){super(...arguments),this._computeLabel=t=>{const e=(i=this.hass,function(t){var e;let o=hi(t,null!==(e=null==i?void 0:i.locale.language)&&void 0!==e?e:li);return o||(o=hi(t,li)),null!=o?o:t});var i;return ss.includes(t.name)?e(`editor.card.generic.${t.name}`):as.includes(t.name)?e(`editor.card.climate.${t.name}`):this.hass.localize(`ui.panel.lovelace.editor.card.generic.${t.name}`)}}connectedCallback(){super.connectedCallback(),rs(this.hass.connection.haVersion)}setConfig(t){Li(t,ns),this._config=t}render(){if(!this.hass||!this._config)return F``;const t=ls();return F` + `,t([dt({attribute:!1})],os.prototype,"hass",void 0),t([dt({type:Number})],os.prototype,"value",void 0),t([pt()],os.prototype,"_selectTargetTemperature",void 0),t([dt({type:Number})],os.prototype,"current",void 0),t([dt({type:Number})],os.prototype,"humidity",void 0),t([dt({type:Number})],os.prototype,"min",void 0),t([dt({type:Number})],os.prototype,"max",void 0),t([dt({type:Number})],os.prototype,"step",void 0),t([dt({type:Boolean})],os.prototype,"window",void 0),t([dt({type:Boolean})],os.prototype,"windowByPass",void 0),t([dt({type:Boolean})],os.prototype,"presence",void 0),t([dt({type:Boolean})],os.prototype,"motion",void 0),t([dt({type:Boolean})],os.prototype,"overpowering",void 0),t([dt({type:Boolean})],os.prototype,"is_device_active",void 0),t([dt({type:String})],os.prototype,"status",void 0),t([dt({type:String})],os.prototype,"mode",void 0),t([dt({type:String})],os.prototype,"hvac_action",void 0),t([dt({type:String})],os.prototype,"preset",void 0),t([dt({type:Boolean,reflect:!0})],os.prototype,"dragging",void 0),t([dt({type:String})],os.prototype,"name",void 0),t([pt()],os.prototype,"changingHigh",void 0),t([pt()],os.prototype,"_config",void 0),os=t([ct("versatile-thermostat-ui-card")],os);const ns=function(...t){const e="type"===t[0].type,i=t.map((t=>t.schema)),o=Object.assign({},...i);return e?Ni(o):Di(o)}(Di({index:Oi(Pi()),view_index:Oi(Pi()),view_layout:Vi("any",(()=>!0)),type:zi()}),Di({entity:Oi(zi()),name:Oi(zi()),icon:Oi(zi()),autoStartStopEnableEntity:Oi(zi()),powerEntity:Oi(zi())}),Di({disable_name:Oi(Ti()),disable_circle:Oi(Ti()),disable_window:Oi(Ti()),disable_autoStartStop:Oi(Ti()),disable_overpowering:Oi(Ti()),disable_heat:Oi(Ti()),disable_cool:Oi(Ti()),disable_heat_cool:Oi(Ti()),disable_auto:Oi(Ti()),disable_dry:Oi(Ti()),disable_fan_only:Oi(Ti()),disable_off:Oi(Ti()),disable_security_warning:Oi(Ti()),disable_power_infos:Oi(Ti()),disable_auto_fan_infos:Oi(Ti()),set_current_as_main:Oi(Ti()),eco_temperature:Oi(Pi()),disable_menu:Oi(Ti()),disable_buttons:Oi(Ti())})),ss=["icon_color","layout","fill_container","primary_info","secondary_info","icon_type","content_info","use_entity_picture","collapsible_controls","icon_animation"],rs=t=>{var e,i;customElements.get("ha-form")&&(customElements.get("hui-action-editor")||((t,e,i,o)=>{const[n,s,r]=t.split(".",3);return Number(n)>e||Number(n)===e&&(void 0===o?Number(s)>=i:Number(s)>i)||void 0!==o&&Number(n)===e&&Number(s)===i&&Number(r)>=o})(t,2022,11))||null===(e=customElements.get("hui-button-card"))||void 0===e||e.getConfigElement(),customElements.get("ha-entity-picker")||null===(i=customElements.get("hui-entities-card"))||void 0===i||i.getConfigElement()},as=["autoStartStopEnableEntity","powerEntity","disable_name","disable_circle","disable_window","disable_autoStartStop","disable_overpowering","disable_heat","disable_cool","disable_heat_cool","disable_auto","disable_dry","disable_fan_only","disable_off","disable_menu","disable_security_warning","disable_buttons","set_current_as_main","disable_power_infos","disable_auto_fan_infos"],ls=mi((()=>[{name:"entity",selector:{entity:{domain:["climate"]}}},{name:"name",selector:{text:{}}},{type:"grid",name:"",schema:[{name:"autoStartStopEnableEntity",selector:{entity:{domain:["switch"]}}},{name:"powerEntity",selector:{entity:{domain:["sensor","input_number"]}}}]},{type:"grid",name:"",schema:[{name:"disable_name",selector:{boolean:{}}},{name:"disable_circle",selector:{boolean:{}}},{name:"disable_window",selector:{boolean:{}}},{name:"disable_autoStartStop",selector:{boolean:{}}},{name:"disable_overpowering",selector:{boolean:{}}},{name:"disable_heat",selector:{boolean:{}}},{name:"disable_cool",selector:{boolean:{}}},{name:"disable_heat_cool",selector:{boolean:{}}},{name:"disable_auto",selector:{boolean:{}}},{name:"disable_dry",selector:{boolean:{}}},{name:"disable_fan_only",selector:{boolean:{}}},{name:"disable_off",selector:{boolean:{}}},{name:"disable_menu",selector:{boolean:{}}},{name:"disable_security_warning",selector:{boolean:{}}},{name:"disable_buttons",selector:{boolean:{}}},{name:"set_current_as_main",selector:{boolean:{}}},{name:"disable_power_infos",selector:{Boolean:{}}},{name:"disable_auto_fan_infos",selector:{Boolean:{}}}]}]));let cs=class extends at{constructor(){super(...arguments),this._computeLabel=t=>{const e=(i=this.hass,function(t){var e;let o=hi(t,null!==(e=null==i?void 0:i.locale.language)&&void 0!==e?e:li);return o||(o=hi(t,li)),null!=o?o:t});var i;return ss.includes(t.name)?e(`editor.card.generic.${t.name}`):as.includes(t.name)?e(`editor.card.climate.${t.name}`):this.hass.localize(`ui.panel.lovelace.editor.card.generic.${t.name}`)}}connectedCallback(){super.connectedCallback(),rs(this.hass.connection.haVersion)}setConfig(t){Li(t,ns),this._config=t}render(){if(!this.hass||!this._config)return F``;const t=ls();return F` 0 + if (attributes?.power_percent > 0) { + this.hvac_action = this.mode == hvac_mode_HEAT ? hvac_action_heating : hvac_action_cooling + } + + // not-used anymore - handle is_device_active + this.is_device_active = (attributes?.is_device_active === true); + if (attributes.hvac_modes) { this.modes = Object.values(attributes.hvac_modes); } @@ -972,9 +1009,6 @@ export class VersatileThermostatUi extends LitElement implements LovelaceCard { this.security_state = null; } - // handle is_device_active - this.is_device_active = (attributes?.is_device_active === true) - // Build Errors if (attributes?.errors !== undefined) { const errors = JSON.parse(attributes.errors); @@ -1175,14 +1209,14 @@ export class VersatileThermostatUi extends LitElement implements LovelaceCard { } private _renderHVACAction(): TemplateResult { - if (this.stateObj?.attributes.hvac_action === 'heating' || + if (this.hvac_action === 'heating' || this.stateObj?.attributes.hvac_mode == "heat" || this.stateObj?.attributes.hvac_mode == "heat_cool") { - return svg``; + return svg``; } - else if (this.stateObj?.attributes.hvac_action === 'cooling' || + else if (this.hvac_action === 'cooling' || this.stateObj.attributes.hvac_mode == "cool") { - return svg``; + return svg``; } else return svg``; } @@ -1314,10 +1348,11 @@ export class VersatileThermostatUi extends LitElement implements LovelaceCard { return ret; } - private _renderTemperature(temperature, isMain: boolean, x: string, y: string) { + private _renderTemperature(temperature, isMain: boolean, x: string, y: string, isTarget: boolean) { const fontSize= isMain ? 15:6; const dx = isMain ? -2:-1; const dy = isMain ? -5.5:-2; + let targetPosX:number = 74, targetPosY: number = 57, targetScale=0.25; let value:string; @@ -1332,15 +1367,28 @@ export class VersatileThermostatUi extends LitElement implements LovelaceCard { ); } + if (isTarget && isMain) { + targetPosX = 25; + targetPosY = 54; + targetScale = 0.5 + } + return svg` - - ${svg`${value}`} - - ${svg` - ${this.hass.config.unit_system.temperature} - `} - - + ${isTarget ? svg` + ` : ''} + + ${svg`${value}`} + + ${svg` + ${this.hass.config.unit_system.temperature} + `} + + ` } @@ -1386,7 +1434,7 @@ export class VersatileThermostatUi extends LitElement implements LovelaceCard {
` : ``} -
+
${ this._config?.disable_circle ? html` @@ -1449,16 +1497,16 @@ export class VersatileThermostatUi extends LitElement implements LovelaceCard { ${ this._config?.disable_circle ? svg` - ${this._renderTemperature(this._display_top, true, "55", "60%")} - ${this._renderTemperature(this._display_bottom, false, "90", "60%")} + ${this._renderTemperature(this._display_top, true, "55", "60%", ! this?._config?.set_current_as_main)} + ${this._renderTemperature(this._display_bottom, false, "90", "60%", this?._config?.set_current_as_main == true)} ${this._renderHVACAction()} `: svg` - ${this._renderTemperature(this._display_top, true, "50%", "60%")} + ${this._renderTemperature(this._display_top, true, "50%", "60%", ! this?._config?.set_current_as_main)} - ${this._renderTemperature(this._display_bottom, false, "-5%", "0%")} + ${this._renderTemperature(this._display_bottom, false, "-5%", "0%", this?._config?.set_current_as_main == true)} ${this._renderHVACAction()} `}