UNPKG

iobroker.lovelace

Version:

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

248 lines (233 loc) 29.6 kB
(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([[3312],{49706:(e,t,r)=>{"use strict";r.d(t,{Rb:()=>i,Zy:()=>a,h2:()=>o,PS:()=>s,l:()=>n,ht:()=>l,f0:()=>c,tj:()=>d,uo:()=>u,lC:()=>h,Kk:()=>p,iY:()=>m,ot:()=>f,gD:()=>y,AZ:()=>b});const i="hass:bookmark",a={alert:"hass:alert",alexa:"hass:amazon-alexa",air_quality:"hass:air-filter",automation:"hass:robot",calendar:"hass:calendar",camera:"hass:video",climate:"hass:thermostat",configurator:"hass:cog",conversation:"hass:text-to-speech",counter:"hass:counter",device_tracker:"hass:account",fan:"hass:fan",google_assistant:"hass:google-assistant",group:"hass:google-circles-communities",homeassistant:"hass:home-assistant",homekit:"hass:home-automation",image_processing:"hass:image-filter-frames",input_boolean:"hass:toggle-switch-outline",input_datetime:"hass:calendar-clock",input_number:"hass:ray-vertex",input_select:"hass:format-list-bulleted",input_text:"hass:form-textbox",light:"hass:lightbulb",mailbox:"hass:mailbox",notify:"hass:comment-alert",number:"hass:ray-vertex",persistent_notification:"hass:bell",person:"hass:account",plant:"hass:flower",proximity:"hass:apple-safari",remote:"hass:remote",scene:"hass:palette",script:"hass:script-text",sensor:"hass:eye",simple_alarm:"hass:bell",sun:"hass:white-balance-sunny",switch:"hass:flash",timer:"hass:timer-outline",updater:"hass:cloud-upload",vacuum:"hass:robot-vacuum",water_heater:"hass:thermometer",weather:"hass:weather-cloudy",zone:"hass:map-marker-radius"},o={current:"hass:current-ac",carbon_dioxide:"mdi:molecule-co2",carbon_monoxide:"mdi:molecule-co",energy:"hass:flash",humidity:"hass:water-percent",illuminance:"hass:brightness-5",temperature:"hass:thermometer",pressure:"hass:gauge",power:"hass:flash",power_factor:"hass:angle-acute",signal_strength:"hass:wifi",timestamp:"hass:clock",voltage:"hass:sine-wave"},s=["climate","cover","configurator","input_select","input_number","input_text","lock","media_player","number","scene","script","timer","vacuum","water_heater"],n=["alarm_control_panel","automation","camera","climate","configurator","counter","cover","fan","group","humidifier","input_datetime","light","lock","media_player","person","remote","script","sun","timer","vacuum","water_heater","weather"],l=["input_number","input_select","input_text","number","scene"],c=["camera","configurator","scene"],d=["closed","locked","off"],u="on",h="off",p=new Set(["fan","input_boolean","light","switch","group","automation","humidifier"]),m=new Set(["camera","media_player"]),f="°C",y="°F",b=["ff0029","66a61e","377eb8","984ea3","00d2d5","ff7f00","af8d00","7f80cd","b3e900","c42e60","a65628","f781bf","8dd3c7","bebada","fb8072","80b1d3","fdb462","fccde5","bc80bd","ffed6f","c4eaff","cf8c00","1b9e77","d95f02","e7298a","e6ab02","a6761d","0097ff","00d067","f43600","4ba93b","5779bb","927acc","97ee3f","bf3947","9f5b00","f48758","8caed6","f2b94f","eff26e","e43872","d9b100","9d7a00","698cff","d9d9d9","00d27e","d06800","009f82","c49200","cbe8ff","fecddf","c27eb6","8cd2ce","c4b8d9","f883b0","a49100","f48800","27d0df","a04a9b"]},43274:(e,t,r)=>{"use strict";r.d(t,{Sb:()=>i,BF:()=>a,Op:()=>o});const i=function(){try{(new Date).toLocaleDateString("i")}catch(e){return"RangeError"===e.name}return!1}(),a=function(){try{(new Date).toLocaleTimeString("i")}catch(e){return"RangeError"===e.name}return!1}(),o=function(){try{(new Date).toLocaleString("i")}catch(e){return"RangeError"===e.name}return!1}()},44583:(e,t,r)=>{"use strict";r.d(t,{o:()=>l,E:()=>d});var i=r(68928),a=r(14516),o=r(43274),s=r(65810);const n=(0,a.Z)((e=>new Intl.DateTimeFormat(e.language,{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"2-digit",hour12:(0,s.y)(e)}))),l=o.Op?(e,t)=>n(t).format(e):(e,t)=>(0,i.WU)(e,((0,s.y)(t)," A")),c=(0,a.Z)((e=>new Intl.DateTimeFormat(e.language,{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",hour12:(0,s.y)(e)}))),d=o.Op?(e,t)=>c(t).format(e):(e,t)=>(0,i.WU)(e,((0,s.y)(t)," A"))},65810:(e,t,r)=>{"use strict";r.d(t,{y:()=>a});var i=r(66477);const a=e=>{if(e.time_format===i.zt.language||e.time_format===i.zt.system){const t=e.time_format===i.zt.language?e.language:void 0,r=(new Date).toLocaleString(t);return r.includes("AM")||r.includes("PM")}return e.time_format===i.zt.am_pm}},22311:(e,t,r)=>{"use strict";r.d(t,{N:()=>a});var i=r(58831);const a=e=>(0,i.M)(e.entity_id)},50577:(e,t,r)=>{"use strict";r.d(t,{v:()=>i});const i=async e=>{if(navigator.clipboard)try{return void await navigator.clipboard.writeText(e)}catch{}const t=document.createElement("textarea");t.value=e,document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}},53822:(e,t,r)=>{"use strict";var i=r(50424),a=r(55358),o=r(47181);let s;function n(){n=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(r){t.forEach((function(t){t.kind===r&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach((function(i){t.forEach((function(t){var a=t.placement;if(t.kind===i&&("static"===a||"prototype"===a)){var o="static"===a?e:r;this.defineClassElement(o,t)}}),this)}),this)},defineClassElement:function(e,t){var r=t.descriptor;if("field"===t.kind){var i=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===i?void 0:i.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[],i=[],a={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,a)}),this),e.forEach((function(e){if(!d(e))return r.push(e);var t=this.decorateElement(e,a);r.push(t.element),r.push.apply(r,t.extras),i.push.apply(i,t.finishers)}),this),!t)return{elements:r,finishers:i};var o=this.decorateConstructor(r,t);return i.push.apply(i,o.finishers),o.finishers=i,o},addElementPlacement:function(e,t,r){var i=t[e.placement];if(!r&&-1!==i.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");i.push(e.key)},decorateElement:function(e,t){for(var r=[],i=[],a=e.decorators,o=a.length-1;o>=0;o--){var s=t[e.placement];s.splice(s.indexOf(e.key),1);var n=this.fromElementDescriptor(e),l=this.toElementFinisherExtras((0,a[o])(n)||n);e=l.element,this.addElementPlacement(e,t),l.finisher&&i.push(l.finisher);var c=l.extras;if(c){for(var d=0;d<c.length;d++)this.addElementPlacement(c[d],t);r.push.apply(r,c)}}return{element:e,finishers:i,extras:r}},decorateConstructor:function(e,t){for(var r=[],i=t.length-1;i>=0;i--){var a=this.fromClassDescriptor(e),o=this.toClassDescriptor((0,t[i])(a)||a);if(void 0!==o.finisher&&r.push(o.finisher),void 0!==o.elements){e=o.elements;for(var s=0;s<e.length-1;s++)for(var n=s+1;n<e.length;n++)if(e[s].key===e[n].key&&e[s].placement===e[n].placement)throw new TypeError("Duplicated element ("+e[s].key+")")}}return{elements:e,finishers:r}},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 m(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?m(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 r=p(e.key),i=String(e.placement);if("static"!==i&&"prototype"!==i&&"own"!==i)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 "'+i+'"');var a=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:t,key:r,placement:i,descriptor:Object.assign({},a)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(a,"get","The property descriptor of a field descriptor"),this.disallowProperty(a,"set","The property descriptor of a field descriptor"),this.disallowProperty(a,"value","The property descriptor of a field descriptor"),o.initializer=e.initializer),o},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:h(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 r=h(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:r}},runClassFinishers:function(e,t){for(var r=0;r<t.length;r++){var i=(0,t[r])(e);if(void 0!==i){if("function"!=typeof i)throw new TypeError("Finishers must return a constructor.");e=i}}return e},disallowProperty:function(e,t,r){if(void 0!==e[t])throw new TypeError(r+" can't have a ."+t+" property.")}};return e}function l(e){var t,r=p(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 i={kind:"field"===e.kind?"field":"method",key:r,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(i.decorators=e.decorators),"field"===e.kind&&(i.initializer=e.value),i}function c(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function d(e){return e.decorators&&e.decorators.length}function u(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function h(e,t){var r=e[t];if(void 0!==r&&"function"!=typeof r)throw new TypeError("Expected '"+t+"' to be a function");return r}function p(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}function f(e,t,r){return(f="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var i=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=y(e)););return e}(e,t);if(i){var a=Object.getOwnPropertyDescriptor(i,t);return a.get?a.get.call(r):a.value}})(e,t,r||e)}function y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}const b={key:"Mod-s",run:e=>((0,o.B)(e.dom,"editor-save"),!0)};!function(e,t,r,i){var a=n();if(i)for(var o=0;o<i.length;o++)a=i[o](a);var s=t((function(e){a.initializeInstanceElements(e,h.elements)}),r),h=a.decorateClass(function(e){for(var t=[],r=function(e){return"method"===e.kind&&e.key===o.key&&e.placement===o.placement},i=0;i<e.length;i++){var a,o=e[i];if("method"===o.kind&&(a=t.find(r)))if(u(o.descriptor)||u(a.descriptor)){if(d(o)||d(a))throw new ReferenceError("Duplicated methods ("+o.key+") can't be decorated.");a.descriptor=o.descriptor}else{if(d(o)){if(d(a))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+o.key+").");a.decorators=o.decorators}c(o,a)}else t.push(o)}return t}(s.d.map(l)),e);a.initializeClassElements(s.F,h.elements),a.runClassFinishers(s.F,h.finishers)}([(0,a.Mo)("ha-code-editor")],(function(e,t){class n extends t{constructor(...t){super(...t),e(this)}}return{F:n,d:[{kind:"field",key:"codemirror",value:void 0},{kind:"field",decorators:[(0,a.Cb)()],key:"mode",value:()=>"yaml"},{kind:"field",decorators:[(0,a.Cb)({type:Boolean})],key:"autofocus",value:()=>!1},{kind:"field",decorators:[(0,a.Cb)({type:Boolean})],key:"readOnly",value:()=>!1},{kind:"field",decorators:[(0,a.Cb)()],key:"error",value:()=>!1},{kind:"field",decorators:[(0,a.SB)()],key:"_value",value:()=>""},{kind:"field",key:"_loadedCodeMirror",value:void 0},{kind:"set",key:"value",value:function(e){this._value=e}},{kind:"get",key:"value",value:function(){return this.codemirror?this.codemirror.state.doc.toString():this._value}},{kind:"get",key:"hasComments",value:function(){if(!this.codemirror||!this._loadedCodeMirror)return!1;const e=this._loadedCodeMirror.HighlightStyle.get(this.codemirror.state,this._loadedCodeMirror.tags.comment);return!!this.shadowRoot.querySelector(`span.${e}`)}},{kind:"method",key:"connectedCallback",value:function(){f(y(n.prototype),"connectedCallback",this).call(this),this.codemirror&&!1!==this.autofocus&&this.codemirror.focus()}},{kind:"method",key:"update",value:function(e){f(y(n.prototype),"update",this).call(this,e),this.codemirror&&(e.has("mode")&&this.codemirror.dispatch({effects:this._loadedCodeMirror.langCompartment.reconfigure(this._mode)}),e.has("readOnly")&&this.codemirror.dispatch({effects:this._loadedCodeMirror.readonlyCompartment.reconfigure(this._loadedCodeMirror.EditorView.editable.of(!this.readOnly))}),e.has("_value")&&this._value!==this.value&&this.codemirror.dispatch({changes:{from:0,to:this.codemirror.state.doc.length,insert:this._value}}),e.has("error")&&this.classList.toggle("error-state",this.error))}},{kind:"method",key:"firstUpdated",value:function(e){f(y(n.prototype),"firstUpdated",this).call(this,e),this._blockKeyboardShortcuts(),this._load()}},{kind:"get",key:"_mode",value:function(){return this._loadedCodeMirror.langs[this.mode]}},{kind:"method",key:"_load",value:async function(){this._loadedCodeMirror=await(async()=>(s||(s=Promise.all([r.e(2118),r.e(9649),r.e(2914)]).then(r.bind(r,92914))),s))(),this.codemirror=new this._loadedCodeMirror.EditorView({state:this._loadedCodeMirror.EditorState.create({doc:this._value,extensions:[this._loadedCodeMirror.lineNumbers(),this._loadedCodeMirror.EditorState.allowMultipleSelections.of(!0),this._loadedCodeMirror.history(),this._loadedCodeMirror.highlightSelectionMatches(),this._loadedCodeMirror.highlightActiveLine(),this._loadedCodeMirror.drawSelection(),this._loadedCodeMirror.rectangularSelection(),this._loadedCodeMirror.keymap.of([...this._loadedCodeMirror.defaultKeymap,...this._loadedCodeMirror.searchKeymap,...this._loadedCodeMirror.historyKeymap,...this._loadedCodeMirror.tabKeyBindings,b]),this._loadedCodeMirror.langCompartment.of(this._mode),this._loadedCodeMirror.theme,this._loadedCodeMirror.Prec.fallback(this._loadedCodeMirror.highlightStyle),this._loadedCodeMirror.readonlyCompartment.of(this._loadedCodeMirror.EditorView.editable.of(!this.readOnly)),this._loadedCodeMirror.EditorView.updateListener.of((e=>this._onUpdate(e)))]}),root:this.shadowRoot,parent:this.shadowRoot})}},{kind:"method",key:"_blockKeyboardShortcuts",value:function(){this.addEventListener("keydown",(e=>e.stopPropagation()))}},{kind:"method",key:"_onUpdate",value:function(e){if(!e.docChanged)return;const t=this.value;t!==this._value&&(this._value=t,(0,o.B)(this,"value-changed",{value:this._value}))}},{kind:"get",static:!0,key:"styles",value:function(){return i.iv` :host(.error-state) div.cm-wrap .cm-gutters { border-color: var(--error-state-color, red); } `}}]}}),i.fl)},26765:(e,t,r)=>{"use strict";r.d(t,{Ys:()=>s,g7:()=>n,D9:()=>l});var i=r(47181);const a=()=>Promise.all([r.e(8200),r.e(3967),r.e(879),r.e(7895),r.e(6509),r.e(7818)]).then(r.bind(r,1281)),o=(e,t,r)=>new Promise((o=>{const s=t.cancel,n=t.confirm;(0,i.B)(e,"show-dialog",{dialogTag:"dialog-box",dialogImport:a,dialogParams:{...t,...r,cancel:()=>{o(!(null==r||!r.prompt)&&null),s&&s()},confirm:e=>{o(null==r||!r.prompt||e),n&&n(e)}}})})),s=(e,t)=>o(e,t),n=(e,t)=>o(e,t,{confirmation:!0}),l=(e,t)=>o(e,t,{prompt:!0})},11052:(e,t,r)=>{"use strict";r.d(t,{I:()=>o});var i=r(76389),a=r(47181);const o=(0,i.o)((e=>class extends e{fire(e,t,r){return r=r||{},(0,a.B)(r.node||this,e,t,r)}}))},1265:(e,t,r)=>{"use strict";r.d(t,{Z:()=>i});const i=(0,r(76389).o)((e=>class extends e{static get properties(){return{hass:Object,localize:{type:Function,computed:"__computeLocalize(hass.localize)"}}}__computeLocalize(e){return e}}))},75531:(e,t,r)=>{"use strict";r.r(t);r(53918);var i=r(68546),a=(r(32296),r(30879),r(50856)),o=r(28426),s=r(98595),n=r(44583),l=r(87744);const c=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");var d=r(50577),u=(r(74535),r(53822),r(52039),r(26765)),h=r(11052),p=r(1265);r(3426);const m={};class f extends((0,h.I)((0,p.Z)(o.H3))){static get template(){return a.d` <style include="ha-style"> :host { -ms-user-select: initial; -webkit-user-select: initial; -moz-user-select: initial; display: block; padding: 16px; } .inputs { width: 100%; max-width: 400px; } .info { padding: 0 16px; } .button-row { display: flex; margin-top: 8px; align-items: center; } .table-wrapper { width: 100%; overflow: auto; } .entities th { padding: 0 8px; text-align: left; font-size: var( --paper-input-container-shared-input-style_-_font-size ); } :host([rtl]) .entities th { text-align: right; } .entities tr { vertical-align: top; direction: ltr; } .entities tr:nth-child(odd) { background-color: var(--table-row-background-color, #fff); } .entities tr:nth-child(even) { background-color: var(--table-row-alternative-background-color, #eee); } .entities td { padding: 4px; min-width: 200px; word-break: break-word; } .entities ha-svg-icon { --mdc-icon-size: 20px; padding: 4px; cursor: pointer; flex-shrink: 0; margin-right: 8px; } .entities td:nth-child(1) { min-width: 300px; width: 30%; } .entities td:nth-child(3) { white-space: pre-wrap; word-break: break-word; } .entities a { color: var(--primary-color); } .entities .id-name-container { display: flex; flex-direction: column; } .entities .id-name-row { display: flex; align-items: center; } :host([narrow]) .state-wrapper { flex-direction: column; } :host([narrow]) .info { padding: 0; } </style> <p> [[localize('ui.panel.developer-tools.tabs.states.description1')]]<br /> [[localize('ui.panel.developer-tools.tabs.states.description2')]] </p> <div class="state-wrapper flex layout horizontal"> <div class="inputs"> <ha-entity-picker autofocus hass="[[hass]]" value="{{_entityId}}" on-change="entityIdChanged" allow-custom-entity ></ha-entity-picker> <paper-input label="[[localize('ui.panel.developer-tools.tabs.states.state')]]" required autocapitalize="none" autocomplete="off" autocorrect="off" spellcheck="false" value="{{_state}}" class="state-input" ></paper-input> <p> [[localize('ui.panel.developer-tools.tabs.states.state_attributes')]] </p> <ha-code-editor mode="yaml" value="[[_stateAttributes]]" error="[[!validJSON]]" on-value-changed="_yamlChanged" ></ha-code-editor> <div class="button-row"> <mwc-button on-click="handleSetState" disabled="[[!validJSON]]" raised >[[localize('ui.panel.developer-tools.tabs.states.set_state')]]</mwc-button > <mwc-icon-button on-click="entityIdChanged" label="[[localize('ui.common.refresh')]]" ><ha-svg-icon path="[[refreshIcon()]]"></ha-svg-icon ></mwc-icon-button> </div> </div> <div class="info"> <template is="dom-if" if="[[_entity]]"> <p> <b >[[localize('ui.panel.developer-tools.tabs.states.last_changed')]]:</b ><br />[[lastChangedString(_entity)]] </p> <p> <b >[[localize('ui.panel.developer-tools.tabs.states.last_updated')]]:</b ><br />[[lastUpdatedString(_entity)]] </p> </template> </div> </div> <h1> [[localize('ui.panel.developer-tools.tabs.states.current_entities')]] </h1> <div class="table-wrapper"> <table class="entities"> <tr> <th>[[localize('ui.panel.developer-tools.tabs.states.entity')]]</th> <th>[[localize('ui.panel.developer-tools.tabs.states.state')]]</th> <th hidden$="[[narrow]]"> [[localize('ui.panel.developer-tools.tabs.states.attributes')]] <paper-checkbox checked="{{_showAttributes}}" on-change="saveAttributeCheckboxState" ></paper-checkbox> </th> </tr> <tr> <th> <paper-input label="[[localize('ui.panel.developer-tools.tabs.states.filter_entities')]]" type="search" value="{{_entityFilter}}" ></paper-input> </th> <th> <paper-input label="[[localize('ui.panel.developer-tools.tabs.states.filter_states')]]" type="search" value="{{_stateFilter}}" ></paper-input> </th> <th hidden$="[[!computeShowAttributes(narrow, _showAttributes)]]"> <paper-input label="[[localize('ui.panel.developer-tools.tabs.states.filter_attributes')]]" type="search" value="{{_attributeFilter}}" ></paper-input> </th> </tr> <tr hidden$="[[!computeShowEntitiesPlaceholder(_entities)]]"> <td colspan="3"> [[localize('ui.panel.developer-tools.tabs.states.no_entities')]] </td> </tr> <template is="dom-repeat" items="[[_entities]]" as="entity"> <tr> <td> <div class="id-name-container"> <div class="id-name-row"> <ha-svg-icon on-click="copyEntity" alt="[[localize('ui.panel.developer-tools.tabs.states.copy_id')]]" title="[[localize('ui.panel.developer-tools.tabs.states.copy_id')]]" path="[[clipboardOutlineIcon()]]" ></ha-svg-icon> <a href="#" on-click="entitySelected" >[[entity.entity_id]]</a > </div> <div class="id-name-row"> <ha-svg-icon on-click="entityMoreInfo" alt="[[localize('ui.panel.developer-tools.tabs.states.more_info')]]" title="[[localize('ui.panel.developer-tools.tabs.states.more_info')]]" path="[[informationOutlineIcon()]]" ></ha-svg-icon> <span class="secondary"> [[entity.attributes.friendly_name]] </span> </div> </div> </td> <td>[[entity.state]]</td> <template is="dom-if" if="[[computeShowAttributes(narrow, _showAttributes)]]" > <td>[[attributeString(entity)]]</td> </template> </tr> </template> </table> </div> `}static get properties(){return{hass:{type:Object},parsedJSON:{type:Object,computed:"_computeParsedStateAttributes(_stateAttributes)"},validJSON:{type:Boolean,computed:"_computeValidJSON(parsedJSON)"},_entityId:{type:String,value:""},_entityFilter:{type:String,value:""},_stateFilter:{type:String,value:""},_attributeFilter:{type:String,value:""},_entity:{type:Object},_state:{type:String,value:""},_stateAttributes:{type:String,value:""},_showAttributes:{type:Boolean,value:JSON.parse(localStorage.getItem("devToolsShowAttributes")||!0)},_entities:{type:Array,computed:"computeEntities(hass, _entityFilter, _stateFilter, _attributeFilter)"},narrow:{type:Boolean,reflectToAttribute:!0},rtl:{reflectToAttribute:!0,computed:"_computeRTL(hass)"}}}copyEntity(e){e.preventDefault(),(0,d.v)(e.model.entity.entity_id)}entitySelected(e){const t=e.model.entity;this._entityId=t.entity_id,this._entity=t,this._state=t.state,this._stateAttributes=(0,s.$w)(t.attributes),e.preventDefault()}entityIdChanged(){if(""===this._entityId)return this._entity=void 0,this._state="",void(this._stateAttributes="");const e=this.hass.states[this._entityId];e&&(this._entity=e,this._state=e.state,this._stateAttributes=(0,s.$w)(e.attributes))}entityMoreInfo(e){e.preventDefault(),this.fire("hass-more-info",{entityId:e.model.entity.entity_id})}handleSetState(){this._entityId?this.hass.callApi("POST","states/"+this._entityId,{state:this._state,attributes:this.parsedJSON}):(0,u.Ys)(this,{text:this.hass.localize("ui.panel.developer-tools.tabs.states.alert_entity_field")})}informationOutlineIcon(){return i.EaN}clipboardOutlineIcon(){return i.Wte}refreshIcon(){return i.jcD}computeEntities(e,t,r,i){const a=t&&RegExp(c(t).replace(/\\\*/g,".*"),"i"),o=r&&RegExp(c(r).replace(/\\\*/g,".*"),"i");let s,n,l=!1;if(i){const e=i.indexOf(":");l=-1!==e;const t=l?i.substring(0,e).trim():i,r=l?i.substring(e+1).trim():i;s=RegExp(c(t).replace(/\\\*/g,".*"),"i"),n=l?RegExp(c(r).replace(/\\\*/g,".*"),"i"):s}return Object.values(e.states).filter((e=>{if(a&&!a.test(e.entity_id)&&(void 0===e.attributes.friendly_name||!a.test(e.attributes.friendly_name)))return!1;if(o&&!o.test(e.state))return!1;if(s&&n){for(const[t,r]of Object.entries(e.attributes)){const e=s.test(t);if(e&&!l)return!0;if((e||!l)&&(void 0!==r&&n.test(JSON.stringify(r))))return!0}return!1}return!0})).sort((function(e,t){return e.entity_id<t.entity_id?-1:e.entity_id>t.entity_id?1:0}))}computeShowEntitiesPlaceholder(e){return 0===e.length}computeShowAttributes(e,t){return!e&&t}attributeString(e){let t,r,i,a,o="";for(t=0,r=Object.keys(e.attributes);t<r.length;t++)i=r[t],a=this.formatAttributeValue(e.attributes[i]),o+=`${i}: ${a}\n`;return o}lastChangedString(e){return(0,n.E)(new Date(e.last_changed),this.hass.locale)}lastUpdatedString(e){return(0,n.E)(new Date(e.last_updated),this.hass.locale)}formatAttributeValue(e){return Array.isArray(e)&&e.some((e=>e instanceof Object))||!Array.isArray(e)&&e instanceof Object?`\n${(0,s.$w)(e)}`:Array.isArray(e)?e.join(", "):e}saveAttributeCheckboxState(e){try{localStorage.setItem("devToolsShowAttributes",e.target.checked)}catch(e){}}_computeParsedStateAttributes(e){try{return e.trim()?(0,s.zD)(e):{}}catch(e){return m}}_computeValidJSON(e){return e!==m}_yamlChanged(e){this._stateAttributes=e.detail.value}_computeRTL(e){return(0,l.HE)(e)}}customElements.define("developer-tools-state",f)},3426:(e,t,r)=>{"use strict";r(21384);var i=r(11654);const a=document.createElement("template");a.setAttribute("style","display: none;"),a.innerHTML=`<dom-module id="ha-style">\n <template>\n <style>\n ${i.Qx.cssText}\n </style>\n </template>\n</dom-module>`,document.head.appendChild(a.content)}}]); //# sourceMappingURL=chunk.503eb1d565b958ce5494.js.map