UNPKG

iobroker.lovelace

Version:

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

2 lines 20.7 kB
(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([[6684],{81303:function(e,t,n){"use strict";n(8878);function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t,n){return(a="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=u(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=u(e);if(t){var i=u(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return l(this,n)}}function l(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var d=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}(d,e);var t,n,r,l=c(d);function d(){return i(this,d),l.apply(this,arguments)}return t=d,(n=[{key:"ready",value:function(){var e=this;a(u(d.prototype),"ready",this).call(this),setTimeout((function(){"rtl"===window.getComputedStyle(e).direction&&(e.style.textAlign="right")}),100)}}])&&o(t.prototype,n),r&&o(t,r),d}(customElements.get("paper-dropdown-menu"));customElements.define("ha-paper-dropdown-menu",d)},24734:function(e,t,n){"use strict";n.d(t,{B:function(){return i}});var r=n(47181),i=function(e,t){(0,r.B)(e,"show-dialog",{dialogTag:"dialog-media-player-browse",dialogImport:function(){return Promise.all([n.e(8161),n.e(1041),n.e(3967),n.e(1657),n.e(4444),n.e(7724),n.e(2613),n.e(9799),n.e(6294),n.e(839),n.e(7909),n.e(4821),n.e(4535),n.e(5397),n.e(2809)]).then(n.bind(n,52809))},dialogParams:t})}},46684:function(e,t,n){"use strict";n.r(t);n(53918),n(25230);var r,i,o,a,s,c,l,u,d,f,p,h,m,y,v,b=n(68546),_=(n(30879),n(53973),n(51095),n(50424)),w=n(55358),g=n(7323),k=n(40095),E=n(87744),O=(n(16509),n(10983),n(81303),n(46998),n(52039),n(24734)),j=n(56007),S=n(69371);function P(e){return(P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function C(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function x(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function T(e,t){return(T=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function A(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=R(e);if(t){var i=R(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return D(this,n)}}function D(e,t){return!t||"object"!==P(t)&&"function"!=typeof t?z(e):t}function z(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function R(e){return(R=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function I(){I=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(n){t.forEach((function(t){t.kind===n&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var n=e.prototype;["method","field"].forEach((function(r){t.forEach((function(t){var i=t.placement;if(t.kind===r&&("static"===i||"prototype"===i)){var o="static"===i?e:n;this.defineClassElement(o,t)}}),this)}),this)},defineClassElement:function(e,t){var n=t.descriptor;if("field"===t.kind){var r=t.initializer;n={enumerable:n.enumerable,writable:n.writable,configurable:n.configurable,value:void 0===r?void 0:r.call(e)}}Object.defineProperty(e,t.key,n)},decorateClass:function(e,t){var n=[],r=[],i={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,i)}),this),e.forEach((function(e){if(!M(e))return n.push(e);var t=this.decorateElement(e,i);n.push(t.element),n.push.apply(n,t.extras),r.push.apply(r,t.finishers)}),this),!t)return{elements:n,finishers:r};var o=this.decorateConstructor(n,t);return r.push.apply(r,o.finishers),o.finishers=r,o},addElementPlacement:function(e,t,n){var r=t[e.placement];if(!n&&-1!==r.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");r.push(e.key)},decorateElement:function(e,t){for(var n=[],r=[],i=e.decorators,o=i.length-1;o>=0;o--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var s=this.fromElementDescriptor(e),c=this.toElementFinisherExtras((0,i[o])(s)||s);e=c.element,this.addElementPlacement(e,t),c.finisher&&r.push(c.finisher);var l=c.extras;if(l){for(var u=0;u<l.length;u++)this.addElementPlacement(l[u],t);n.push.apply(n,l)}}return{element:e,finishers:r,extras:n}},decorateConstructor:function(e,t){for(var n=[],r=t.length-1;r>=0;r--){var i=this.fromClassDescriptor(e),o=this.toClassDescriptor((0,t[r])(i)||i);if(void 0!==o.finisher&&n.push(o.finisher),void 0!==o.elements){e=o.elements;for(var a=0;a<e.length-1;a++)for(var s=a+1;s<e.length;s++)if(e[a].key===e[s].key&&e[a].placement===e[s].placement)throw new TypeError("Duplicated element ("+e[a].key+")")}}return{elements:e,finishers:n}},fromElementDescriptor:function(e){var t={kind:e.kind,key:e.key,placement:e.placement,descriptor:e.descriptor};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),"field"===e.kind&&(t.initializer=e.initializer),t},toElementDescriptors:function(e){var t;if(void 0!==e)return(t=e,function(e){if(Array.isArray(e))return e}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return X(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?X(e,t):void 0}}(t)||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(e){var t=this.toElementDescriptor(e);return this.disallowProperty(e,"finisher","An element descriptor"),this.disallowProperty(e,"extras","An element descriptor"),t}),this)},toElementDescriptor:function(e){var t=String(e.kind);if("method"!==t&&"field"!==t)throw new TypeError('An element descriptor\'s .kind property must be either "method" or "field", but a decorator created an element descriptor with .kind "'+t+'"');var n=Z(e.key),r=String(e.placement);if("static"!==r&&"prototype"!==r&&"own"!==r)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 "'+r+'"');var i=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:t,key:n,placement:r,descriptor:Object.assign({},i)};return"field"!==t?this.disallowProperty(e,"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=e.initializer),o},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:V(e,"finisher"),extras:this.toElementDescriptors(e.extras)}},fromClassDescriptor:function(e){var t={kind:"class",elements:e.map(this.fromElementDescriptor,this)};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),t},toClassDescriptor:function(e){var t=String(e.kind);if("class"!==t)throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator created a class descriptor with .kind "'+t+'"');this.disallowProperty(e,"key","A class descriptor"),this.disallowProperty(e,"placement","A class descriptor"),this.disallowProperty(e,"descriptor","A class descriptor"),this.disallowProperty(e,"initializer","A class descriptor"),this.disallowProperty(e,"extras","A class descriptor");var n=V(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:n}},runClassFinishers:function(e,t){for(var n=0;n<t.length;n++){var r=(0,t[n])(e);if(void 0!==r){if("function"!=typeof r)throw new TypeError("Finishers must return a constructor.");e=r}}return e},disallowProperty:function(e,t,n){if(void 0!==e[t])throw new TypeError(n+" can't have a ."+t+" property.")}};return e}function B(e){var t,n=Z(e.key);"method"===e.kind?t={value:e.value,writable:!0,configurable:!0,enumerable:!1}:"get"===e.kind?t={get:e.value,configurable:!0,enumerable:!1}:"set"===e.kind?t={set:e.value,configurable:!0,enumerable:!1}:"field"===e.kind&&(t={configurable:!0,writable:!0,enumerable:!0});var r={kind:"field"===e.kind?"field":"method",key:n,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(r.decorators=e.decorators),"field"===e.kind&&(r.initializer=e.value),r}function F(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function M(e){return e.decorators&&e.decorators.length}function N(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function V(e,t){var n=e[t];if(void 0!==n&&"function"!=typeof n)throw new TypeError("Expected '"+t+"' to be a function");return n}function Z(e){var t=function(e,t){if("object"!==P(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==P(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===P(t)?t:String(t)}function X(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}!function(e,t,n,r){var i=I();if(r)for(var o=0;o<r.length;o++)i=r[o](i);var a=t((function(e){i.initializeInstanceElements(e,s.elements)}),n),s=i.decorateClass(function(e){for(var t=[],n=function(e){return"method"===e.kind&&e.key===o.key&&e.placement===o.placement},r=0;r<e.length;r++){var i,o=e[r];if("method"===o.kind&&(i=t.find(n)))if(N(o.descriptor)||N(i.descriptor)){if(M(o)||M(i))throw new ReferenceError("Duplicated methods ("+o.key+") can't be decorated.");i.descriptor=o.descriptor}else{if(M(o)){if(M(i))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+o.key+").");i.decorators=o.decorators}F(o,i)}else t.push(o)}return t}(a.d.map(B)),e);i.initializeClassElements(a.F,s.elements),i.runClassFinishers(a.F,s.finishers)}([(0,w.Mo)("more-info-media_player")],(function(e,t){return{F:function(t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&T(e,t)}(r,t);var n=A(r);function r(){var t;x(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return t=n.call.apply(n,[this].concat(o)),e(z(t)),t}return r}(t),d:[{kind:"field",decorators:[(0,w.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,w.Cb)({attribute:!1})],key:"stateObj",value:void 0},{kind:"field",decorators:[(0,w.IO)("#ttsInput")],key:"_ttsInput",value:void 0},{kind:"method",key:"render",value:function(){var e,t,n=this;if(!this.stateObj)return(0,_.dy)(r||(r=C([""])));var v=this.stateObj,w=(0,S.xt)(v);return(0,_.dy)(i||(i=C(["\n ","\n ","\n ","\n ","\n ","\n "])),w?(0,_.dy)(o||(o=C(['\n <div class="controls">\n <div class="basic-controls">\n ',"\n </div>\n ","\n </div>\n "])),w.map((function(e){return(0,_.dy)(a||(a=C(["\n <ha-icon-button\n action=","\n .icon=","\n @click=","\n ></ha-icon-button>\n "])),e.action,e.icon,n._handleClick)})),(0,k.e)(v,S.pu)?(0,_.dy)(s||(s=C(["\n <mwc-icon-button\n .title=","\n @click=","\n ><ha-svg-icon .path=","></ha-svg-icon\n ></mwc-icon-button>\n "])),this.hass.localize("ui.card.media_player.browse_media"),this._showBrowseMedia,b.hBf):""):"",!(0,k.e)(v,S.X6)&&!(0,k.e)(v,S.B6)||[j.nZ,j.lz,"off"].includes(v.state)?"":(0,_.dy)(c||(c=C(['\n <div class="volume">\n ',"\n ","\n ","\n </div>\n "])),(0,k.e)(v,S.y)?(0,_.dy)(l||(l=C(["\n <ha-icon-button\n .icon=","\n @click=","\n ></ha-icon-button>\n "])),v.attributes.is_volume_muted?"hass:volume-off":"hass:volume-high",this._toggleMute):"",(0,k.e)(v,S.B6)?(0,_.dy)(u||(u=C(['\n <ha-icon-button\n action="volume_down"\n icon="hass:volume-minus"\n @click=','\n ></ha-icon-button>\n <ha-icon-button\n action="volume_up"\n icon="hass:volume-plus"\n @click=',"\n ></ha-icon-button>\n "])),this._handleClick,this._handleClick):"",(0,k.e)(v,S.X6)?(0,_.dy)(d||(d=C(['\n <ha-slider\n id="input"\n pin\n ignore-bar-touch\n .dir=',"\n .value=","\n @change=","\n ></ha-slider>\n "])),(0,E.Zu)(this.hass),100*Number(v.attributes.volume_level),this._selectedValueChanged):""),![j.nZ,j.lz,"off"].includes(v.state)&&(0,k.e)(v,S.Hy)&&null!==(e=v.attributes.source_list)&&void 0!==e&&e.length?(0,_.dy)(f||(f=C(['\n <div class="source-input">\n <ha-icon class="source-input" icon="hass:login-variant"></ha-icon>\n <ha-paper-dropdown-menu\n .label=','\n >\n <paper-listbox\n slot="dropdown-content"\n attr-for-selected="item-name"\n .selected=',"\n @iron-select=","\n >\n ","\n </paper-listbox>\n </ha-paper-dropdown-menu>\n </div>\n "])),this.hass.localize("ui.card.media_player.source"),v.attributes.source,this._handleSourceChanged,v.attributes.source_list.map((function(e){return(0,_.dy)(p||(p=C(["\n <paper-item .itemName=",">","</paper-item>\n "])),e,e)}))):"",(0,k.e)(v,S.Dh)&&null!==(t=v.attributes.sound_mode_list)&&void 0!==t&&t.length?(0,_.dy)(h||(h=C(['\n <div class="sound-input">\n <ha-icon icon="hass:music-note"></ha-icon>\n <ha-paper-dropdown-menu\n dynamic-align\n label-float\n .label=','\n >\n <paper-listbox\n slot="dropdown-content"\n attr-for-selected="item-name"\n .selected=',"\n @iron-select=","\n >\n ","\n </paper-listbox>\n </ha-paper-dropdown-menu>\n </div>\n "])),this.hass.localize("ui.card.media_player.sound_mode"),v.attributes.sound_mode,this._handleSoundModeChanged,v.attributes.sound_mode_list.map((function(e){return(0,_.dy)(m||(m=C(["\n <paper-item .itemName=",">","</paper-item>\n "])),e,e)}))):"",(0,g.p)(this.hass,"tts")&&(0,k.e)(v,S.WE)?(0,_.dy)(y||(y=C(['\n <div class="tts">\n <paper-input\n id="ttsInput"\n .disabled=',"\n .label=","\n @keydown=",'\n ></paper-input>\n <ha-icon-button\n icon="hass:send"\n .disabled=',"\n @click=","\n ></ha-icon-button>\n </div>\n </div>\n "])),j.V_.includes(v.state),this.hass.localize("ui.card.media_player.text_to_speak"),this._ttsCheckForEnter,j.V_.includes(v.state),this._sendTTS):"")}},{kind:"get",static:!0,key:"styles",value:function(){return(0,_.iv)(v||(v=C(['\n ha-icon-button[action="turn_off"],\n ha-icon-button[action="turn_on"],\n ha-slider,\n #ttsInput {\n flex-grow: 1;\n }\n\n .controls {\n display: flex;\n align-items: center;\n }\n\n .basic-controls {\n flex-grow: 1;\n }\n\n .volume,\n .source-input,\n .sound-input,\n .tts {\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n\n .source-input ha-icon,\n .sound-input ha-icon {\n padding: 7px;\n margin-top: 24px;\n }\n\n .source-input ha-paper-dropdown-menu,\n .sound-input ha-paper-dropdown-menu {\n margin-left: 10px;\n flex-grow: 1;\n }\n\n paper-item {\n cursor: pointer;\n }\n '])))}},{kind:"method",key:"_handleClick",value:function(e){this.hass.callService("media_player",e.currentTarget.getAttribute("action"),{entity_id:this.stateObj.entity_id})}},{kind:"method",key:"_toggleMute",value:function(){this.hass.callService("media_player","volume_mute",{entity_id:this.stateObj.entity_id,is_volume_muted:!this.stateObj.attributes.is_volume_muted})}},{kind:"method",key:"_selectedValueChanged",value:function(e){this.hass.callService("media_player","volume_set",{entity_id:this.stateObj.entity_id,volume_level:Number(e.currentTarget.getAttribute("value"))/100})}},{kind:"method",key:"_handleSourceChanged",value:function(e){var t=e.detail.item.itemName;t&&this.stateObj.attributes.source!==t&&this.hass.callService("media_player","select_source",{entity_id:this.stateObj.entity_id,source:t})}},{kind:"method",key:"_handleSoundModeChanged",value:function(e){var t,n=e.detail.item.itemName;n&&(null===(t=this.stateObj)||void 0===t?void 0:t.attributes.sound_mode)!==n&&this.hass.callService("media_player","select_sound_mode",{entity_id:this.stateObj.entity_id,sound_mode:n})}},{kind:"method",key:"_ttsCheckForEnter",value:function(e){13===e.keyCode&&this._sendTTS()}},{kind:"method",key:"_sendTTS",value:function(){var e=this._ttsInput;if(e){var t=this.hass.services.tts,n=Object.keys(t).sort().find((function(e){return-1!==e.indexOf("_say")}));n&&(this.hass.callService("tts",n,{entity_id:this.stateObj.entity_id,message:e.value}),e.value="")}}},{kind:"method",key:"_showBrowseMedia",value:function(){var e=this;(0,O.B)(this,{action:"play",entityId:this.stateObj.entity_id,mediaPickedCallback:function(t){return e._playMedia(t.item.media_content_id,t.item.media_content_type)}})}},{kind:"method",key:"_playMedia",value:function(e,t){this.hass.callService("media_player","play_media",{entity_id:this.stateObj.entity_id,media_content_id:e,media_content_type:t})}}]}}),_.oi)}}]); //# sourceMappingURL=chunk.a59b75d4ba5752cb41fa.js.map