UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

2 lines 16.2 kB
(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([[5642],{46131:function(t,e,r){"use strict";var n=r(50856),i=r(28426),o=r(74674);function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(){var t=function(t,e){e||(e=t.slice(0));return Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}(['\n <style>\n :host {\n display: flex;\n flex-direction: column;\n justify-content: center;\n white-space: nowrap;\n }\n\n .target {\n color: var(--primary-text-color);\n }\n\n .current {\n color: var(--secondary-text-color);\n }\n\n .state-label {\n font-weight: bold;\n text-transform: capitalize;\n }\n\n .unit {\n display: inline-block;\n direction: ltr;\n }\n </style>\n\n <div class="target">\n <template is="dom-if" if="[[_hasKnownState(stateObj.state)]]">\n <span class="state-label">\n [[_localizeState(localize, stateObj)]]\n <template is="dom-if" if="[[_renderPreset(stateObj.attributes)]]">\n - [[_localizePreset(localize, stateObj.attributes.preset_mode)]]\n </template>\n </span>\n </template>\n <div class="unit">[[computeTarget(hass, stateObj)]]</div>\n </div>\n\n <template is="dom-if" if="[[currentStatus]]">\n <div class="current">\n [[localize(\'ui.card.climate.currently\')]]:\n <div class="unit">[[currentStatus]]</div>\n </div>\n </template>\n ']);return c=function(){return t},t}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function l(t,e){return(l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function f(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=d(t);if(e){var i=d(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return p(this,r)}}function p(t,e){return!e||"object"!==a(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&l(t,e)}(p,t);var e,r,i,a=f(p);function p(){return s(this,p),a.apply(this,arguments)}return e=p,i=[{key:"template",get:function(){return(0,n.d)(c())}},{key:"properties",get:function(){return{hass:Object,stateObj:Object,currentStatus:{type:String,computed:"computeCurrentStatus(hass, stateObj)"}}}}],(r=[{key:"computeCurrentStatus",value:function(t,e){return t&&e?null!=e.attributes.current_temperature?"".concat(e.attributes.current_temperature," ").concat(t.config.unit_system.temperature):null!=e.attributes.current_humidity?"".concat(e.attributes.current_humidity," %"):null:null}},{key:"computeTarget",value:function(t,e){return t&&e?null!=e.attributes.target_temp_low&&null!=e.attributes.target_temp_high?"".concat(e.attributes.target_temp_low,"-").concat(e.attributes.target_temp_high," ").concat(t.config.unit_system.temperature):null!=e.attributes.temperature?"".concat(e.attributes.temperature," ").concat(t.config.unit_system.temperature):null!=e.attributes.target_humidity_low&&null!=e.attributes.target_humidity_high?"".concat(e.attributes.target_humidity_low,"-").concat(e.attributes.target_humidity_high,"%"):null!=e.attributes.humidity?"".concat(e.attributes.humidity," %"):"":null}},{key:"_hasKnownState",value:function(t){return"unknown"!==t}},{key:"_localizeState",value:function(t,e){var r=t("component.climate.state._.".concat(e.state));return e.attributes.hvac_action?"".concat(t("state_attributes.climate.hvac_action.".concat(e.attributes.hvac_action))," (").concat(r,")"):r}},{key:"_localizePreset",value:function(t,e){return t("state_attributes.climate.preset_mode.".concat(e))||e}},{key:"_renderPreset",value:function(t){return t.preset_mode&&t.preset_mode!==o.T1}}])&&u(e.prototype,r),i&&u(e,i),p}((0,r(1265).Z)(i.H3));customElements.define("ha-climate-state",h)},74674:function(t,e,r){"use strict";r.d(e,{T1:function(){return n},vz:function(){return i},xN:function(){return o},pD:function(){return a},LO:function(){return c},A7:function(){return s},Mu:function(){return u},zH:function(){return l},ZS:function(){return p}});var n="none",i=1,o=2,a=4,c=8,s=16,u=32,l=64,f={auto:1,heat_cool:2,heat:3,cool:4,dry:5,fan_only:6,off:7},p=function(t,e){return f[t]-f[e]}},35642:function(t,e,r){"use strict";r.r(e);var n=r(15652),i=(r(46131),r(53658)),o=(r(91476),r(75502));function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(){var t=f(["\n ha-climate-state {\n text-align: right;\n }\n "]);return c=function(){return t},t}function s(){var t=f(["\n <hui-generic-entity-row .hass="," .config=",">\n <ha-climate-state\n .hass=","\n .stateObj=","\n ></ha-climate-state>\n </hui-generic-entity-row>\n "]);return s=function(){return t},t}function u(){var t=f(["\n <hui-warning>\n ","\n </hui-warning>\n "]);return u=function(){return t},t}function l(){var t=f([""]);return l=function(){return t},t}function f(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function d(t,e){return(d=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function h(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=b(t);if(e){var i=b(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return m(this,r)}}function m(t,e){return!e||"object"!==a(e)&&"function"!=typeof e?y(t):e}function y(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function b(t){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function v(){v=function(){return t};var t={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(t,e){["method","field"].forEach((function(r){e.forEach((function(e){e.kind===r&&"own"===e.placement&&this.defineClassElement(t,e)}),this)}),this)},initializeClassElements:function(t,e){var r=t.prototype;["method","field"].forEach((function(n){e.forEach((function(e){var i=e.placement;if(e.kind===n&&("static"===i||"prototype"===i)){var o="static"===i?t:r;this.defineClassElement(o,e)}}),this)}),this)},defineClassElement:function(t,e){var r=e.descriptor;if("field"===e.kind){var n=e.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===n?void 0:n.call(t)}}Object.defineProperty(t,e.key,r)},decorateClass:function(t,e){var r=[],n=[],i={static:[],prototype:[],own:[]};if(t.forEach((function(t){this.addElementPlacement(t,i)}),this),t.forEach((function(t){if(!k(t))return r.push(t);var e=this.decorateElement(t,i);r.push(e.element),r.push.apply(r,e.extras),n.push.apply(n,e.finishers)}),this),!e)return{elements:r,finishers:n};var o=this.decorateConstructor(r,e);return n.push.apply(n,o.finishers),o.finishers=n,o},addElementPlacement:function(t,e,r){var n=e[t.placement];if(!r&&-1!==n.indexOf(t.key))throw new TypeError("Duplicated element ("+t.key+")");n.push(t.key)},decorateElement:function(t,e){for(var r=[],n=[],i=t.decorators,o=i.length-1;o>=0;o--){var a=e[t.placement];a.splice(a.indexOf(t.key),1);var c=this.fromElementDescriptor(t),s=this.toElementFinisherExtras((0,i[o])(c)||c);t=s.element,this.addElementPlacement(t,e),s.finisher&&n.push(s.finisher);var u=s.extras;if(u){for(var l=0;l<u.length;l++)this.addElementPlacement(u[l],e);r.push.apply(r,u)}}return{element:t,finishers:n,extras:r}},decorateConstructor:function(t,e){for(var r=[],n=e.length-1;n>=0;n--){var i=this.fromClassDescriptor(t),o=this.toClassDescriptor((0,e[n])(i)||i);if(void 0!==o.finisher&&r.push(o.finisher),void 0!==o.elements){t=o.elements;for(var a=0;a<t.length-1;a++)for(var c=a+1;c<t.length;c++)if(t[a].key===t[c].key&&t[a].placement===t[c].placement)throw new TypeError("Duplicated element ("+t[a].key+")")}}return{elements:t,finishers:r}},fromElementDescriptor:function(t){var e={kind:t.kind,key:t.key,placement:t.placement,descriptor:t.descriptor};return Object.defineProperty(e,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),"field"===t.kind&&(e.initializer=t.initializer),e},toElementDescriptors:function(t){var e;if(void 0!==t)return(e=t,function(t){if(Array.isArray(t))return t}(e)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(e)||function(t,e){if(t){if("string"==typeof t)return j(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?j(t,e):void 0}}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).map((function(t){var e=this.toElementDescriptor(t);return this.disallowProperty(t,"finisher","An element descriptor"),this.disallowProperty(t,"extras","An element descriptor"),e}),this)},toElementDescriptor:function(t){var e=String(t.kind);if("method"!==e&&"field"!==e)throw new TypeError('An element descriptor\'s .kind property must be either "method" or "field", but a decorator created an element descriptor with .kind "'+e+'"');var r=O(t.key),n=String(t.placement);if("static"!==n&&"prototype"!==n&&"own"!==n)throw new TypeError('An element descriptor\'s .placement property must be one of "static", "prototype" or "own", but a decorator created an element descriptor with .placement "'+n+'"');var i=t.descriptor;this.disallowProperty(t,"elements","An element descriptor");var o={kind:e,key:r,placement:n,descriptor:Object.assign({},i)};return"field"!==e?this.disallowProperty(t,"initializer","A method descriptor"):(this.disallowProperty(i,"get","The property descriptor of a field descriptor"),this.disallowProperty(i,"set","The property descriptor of a field descriptor"),this.disallowProperty(i,"value","The property descriptor of a field descriptor"),o.initializer=t.initializer),o},toElementFinisherExtras:function(t){return{element:this.toElementDescriptor(t),finisher:E(t,"finisher"),extras:this.toElementDescriptors(t.extras)}},fromClassDescriptor:function(t){var e={kind:"class",elements:t.map(this.fromElementDescriptor,this)};return Object.defineProperty(e,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),e},toClassDescriptor:function(t){var e=String(t.kind);if("class"!==e)throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator created a class descriptor with .kind "'+e+'"');this.disallowProperty(t,"key","A class descriptor"),this.disallowProperty(t,"placement","A class descriptor"),this.disallowProperty(t,"descriptor","A class descriptor"),this.disallowProperty(t,"initializer","A class descriptor"),this.disallowProperty(t,"extras","A class descriptor");var r=E(t,"finisher");return{elements:this.toElementDescriptors(t.elements),finisher:r}},runClassFinishers:function(t,e){for(var r=0;r<e.length;r++){var n=(0,e[r])(t);if(void 0!==n){if("function"!=typeof n)throw new TypeError("Finishers must return a constructor.");t=n}}return t},disallowProperty:function(t,e,r){if(void 0!==t[e])throw new TypeError(r+" can't have a ."+e+" property.")}};return t}function g(t){var e,r=O(t.key);"method"===t.kind?e={value:t.value,writable:!0,configurable:!0,enumerable:!1}:"get"===t.kind?e={get:t.value,configurable:!0,enumerable:!1}:"set"===t.kind?e={set:t.value,configurable:!0,enumerable:!1}:"field"===t.kind&&(e={configurable:!0,writable:!0,enumerable:!0});var n={kind:"field"===t.kind?"field":"method",key:r,placement:t.static?"static":"field"===t.kind?"own":"prototype",descriptor:e};return t.decorators&&(n.decorators=t.decorators),"field"===t.kind&&(n.initializer=t.value),n}function w(t,e){void 0!==t.descriptor.get?e.descriptor.get=t.descriptor.get:e.descriptor.set=t.descriptor.set}function k(t){return t.decorators&&t.decorators.length}function _(t){return void 0!==t&&!(void 0===t.value&&void 0===t.writable)}function E(t,e){var r=t[e];if(void 0!==r&&"function"!=typeof r)throw new TypeError("Expected '"+e+"' to be a function");return r}function O(t){var e=function(t,e){if("object"!==a(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!==a(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===a(e)?e:String(e)}function j(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}!function(t,e,r,n){var i=v();if(n)for(var o=0;o<n.length;o++)i=n[o](i);var a=e((function(t){i.initializeInstanceElements(t,c.elements)}),r),c=i.decorateClass(function(t){for(var e=[],r=function(t){return"method"===t.kind&&t.key===o.key&&t.placement===o.placement},n=0;n<t.length;n++){var i,o=t[n];if("method"===o.kind&&(i=e.find(r)))if(_(o.descriptor)||_(i.descriptor)){if(k(o)||k(i))throw new ReferenceError("Duplicated methods ("+o.key+") can't be decorated.");i.descriptor=o.descriptor}else{if(k(o)){if(k(i))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+o.key+").");i.decorators=o.decorators}w(o,i)}else e.push(o)}return e}(a.d.map(g)),t);i.initializeClassElements(a.F,c.elements),i.runClassFinishers(a.F,c.finishers)}([(0,n.Mo)("hui-climate-entity-row")],(function(t,e){return{F:function(e){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&d(t,e)}(n,e);var r=h(n);function n(){var e;p(this,n);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return e=r.call.apply(r,[this].concat(o)),t(y(e)),e}return n}(e),d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.sz)()],key:"_config",value:void 0},{kind:"method",key:"setConfig",value:function(t){if(!t||!t.entity)throw new Error("Invalid Configuration: 'entity' required");this._config=t}},{kind:"method",key:"shouldUpdate",value:function(t){return(0,i.G)(this,t)}},{kind:"method",key:"render",value:function(){if(!this.hass||!this._config)return(0,n.dy)(l());var t=this.hass.states[this._config.entity];return t?(0,n.dy)(s(),this.hass,this._config,this.hass,t):(0,n.dy)(u(),(0,o.i)(this.hass,this._config.entity))}},{kind:"get",static:!0,key:"styles",value:function(){return(0,n.iv)(c())}}]}}),n.oi)}}]); //# sourceMappingURL=chunk.b557093d8b5d0b3f3670.js.map