UNPKG

iobroker.lovelace

Version:

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

47 lines 20.1 kB
(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([[4820],{49706:(e,t,r)=>{"use strict";r.d(t,{Rb:()=>s,Zy:()=>a,h2:()=>i,PS:()=>n,l:()=>o,ht:()=>c,f0:()=>l,tj:()=>h,uo:()=>d,lC:()=>u,Kk:()=>p,ot:()=>f,gD:()=>m,a1:()=>b,AZ:()=>g});const s="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",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"},i={current:"hass:current-ac",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"},n=["climate","cover","configurator","input_select","input_number","input_text","lock","media_player","scene","script","timer","vacuum","water_heater"],o=["alarm_control_panel","automation","camera","climate","configurator","counter","cover","fan","group","humidifier","input_datetime","light","lock","media_player","person","script","sun","timer","vacuum","water_heater","weather"],c=["input_number","input_select","input_text","scene"],l=["camera","configurator","scene"],h=["closed","locked","off"],d="on",u="off",p=new Set(["fan","input_boolean","light","switch","group","automation","humidifier"]),f="°C",m="°F",b="group.default_view",g=["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"]},44634:(e,t,r)=>{"use strict";r.d(t,{M:()=>s});const s=(e,t)=>{const r=Number(e.state),s=t&&"on"===t.state;if(isNaN(r))return"hass:battery-unknown";let a="hass:battery";const i=10*Math.round(r/10);return s&&r>10?a+="-charging-"+i:s?a+="-outline":r<=5?a+="-alert":r>5&&r<95&&(a+="-"+i),a}},22311:(e,t,r)=>{"use strict";r.d(t,{N:()=>a});var s=r(58831);const a=e=>(0,s.M)(e.entity_id)},76151:(e,t,r)=>{"use strict";r.d(t,{K:()=>i});var s=r(49706);var a=r(44634);const i=(e,t,r)=>{const i=void 0!==r?r:null==t?void 0:t.state;switch(e){case"alarm_control_panel":switch(i){case"armed_home":return"hass:bell-plus";case"armed_night":return"hass:bell-sleep";case"disarmed":return"hass:bell-outline";case"triggered":return"hass:bell-ring";default:return"hass:bell"}case"binary_sensor":return((e,t)=>{const r="off"===e;switch(null==t?void 0:t.attributes.device_class){case"battery":return r?"hass:battery":"hass:battery-outline";case"battery_charging":return r?"hass:battery":"hass:battery-charging";case"cold":return r?"hass:thermometer":"hass:snowflake";case"connectivity":return r?"hass:server-network-off":"hass:server-network";case"door":return r?"hass:door-closed":"hass:door-open";case"garage_door":return r?"hass:garage":"hass:garage-open";case"power":return r?"hass:power-plug-off":"hass:power-plug";case"gas":case"problem":case"safety":case"smoke":return r?"hass:check-circle":"hass:alert-circle";case"heat":return r?"hass:thermometer":"hass:fire";case"light":return r?"hass:brightness-5":"hass:brightness-7";case"lock":return r?"hass:lock":"hass:lock-open";case"moisture":return r?"hass:water-off":"hass:water";case"motion":return r?"hass:walk":"hass:run";case"occupancy":return r?"hass:home-outline":"hass:home";case"opening":return r?"hass:square":"hass:square-outline";case"plug":return r?"hass:power-plug-off":"hass:power-plug";case"presence":return r?"hass:home-outline":"hass:home";case"sound":return r?"hass:music-note-off":"hass:music-note";case"vibration":return r?"hass:crop-portrait":"hass:vibrate";case"window":return r?"hass:window-closed":"hass:window-open";default:return r?"hass:radiobox-blank":"hass:checkbox-marked-circle"}})(i,t);case"cover":return((e,t)=>{const r="closed"!==e;switch(null==t?void 0:t.attributes.device_class){case"garage":switch(e){case"opening":return"hass:arrow-up-box";case"closing":return"hass:arrow-down-box";case"closed":return"hass:garage";default:return"hass:garage-open"}case"gate":switch(e){case"opening":case"closing":return"hass:gate-arrow-right";case"closed":return"hass:gate";default:return"hass:gate-open"}case"door":return r?"hass:door-open":"hass:door-closed";case"damper":return r?"hass:circle":"hass:circle-slice-8";case"shutter":switch(e){case"opening":return"hass:arrow-up-box";case"closing":return"hass:arrow-down-box";case"closed":return"hass:window-shutter";default:return"hass:window-shutter-open"}case"blind":case"curtain":switch(e){case"opening":return"hass:arrow-up-box";case"closing":return"hass:arrow-down-box";case"closed":return"hass:blinds";default:return"hass:blinds-open"}case"window":switch(e){case"opening":return"hass:arrow-up-box";case"closing":return"hass:arrow-down-box";case"closed":return"hass:window-closed";default:return"hass:window-open"}}switch(e){case"opening":return"hass:arrow-up-box";case"closing":return"hass:arrow-down-box";case"closed":return"hass:window-closed";default:return"hass:window-open"}})(i,t);case"humidifier":return r&&"off"===r?"hass:air-humidifier-off":"hass:air-humidifier";case"lock":return"unlocked"===i?"hass:lock-open":"hass:lock";case"media_player":return"playing"===i?"hass:cast-connected":"hass:cast";case"zwave":switch(i){case"dead":return"hass:emoticon-dead";case"sleeping":return"hass:sleep";case"initializing":return"hass:timer-sand";default:return"hass:z-wave"}case"sensor":{const e=(e=>{const t=null==e?void 0:e.attributes.device_class;if(t&&t in s.h2)return s.h2[t];if("battery"===t)return e?(0,a.M)(e):"hass:battery";const r=null==e?void 0:e.attributes.unit_of_measurement;return r===s.ot||r===s.gD?"hass:thermometer":void 0})(t);if(e)return e;break}case"input_datetime":if(!(null==t?void 0:t.attributes.has_date))return"hass:clock";if(!t.attributes.has_time)return"hass:calendar"}return e in s.Zy?s.Zy[e]:(console.warn("Unable to find icon for domain "+e+" ("+t+")"),s.Rb)}},94458:(e,t,r)=>{"use strict";r.d(t,{T:()=>a,R:()=>n});var s=r(47181);const a=()=>Promise.all([r.e(6372),r.e(6547),r.e(5324),r.e(4077),r.e(6614)]).then(r.bind(r,49499)),i=()=>document.querySelector("home-assistant").shadowRoot.querySelector("dialog-entity-editor"),n=(e,t)=>((0,s.B)(e,"show-dialog",{dialogTag:"dialog-entity-editor",dialogImport:a,dialogParams:t}),i)},18690:(e,t,r)=>{"use strict";r.r(t),r.d(t,{HaConfigHelpers:()=>E});r(29119);var s=r(55317),a=(r(32296),r(8878),r(25782),r(51095),r(54444),r(15652)),i=r(14516),n=r(22311),o=r(76151),c=(r(7164),r(16509),r(52039),r(15291),r(96551),r(94458)),l=r(29311);const h=["input_boolean","input_text","input_number","input_datetime","input_select","counter","timer"];var d=r(47181);const u=()=>Promise.all([r.e(6372),r.e(6547),r.e(7992),r.e(4684)]).then(r.bind(r,33142));function p(){p=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(s){t.forEach((function(t){var a=t.placement;if(t.kind===s&&("static"===a||"prototype"===a)){var i="static"===a?e:r;this.defineClassElement(i,t)}}),this)}),this)},defineClassElement:function(e,t){var r=t.descriptor;if("field"===t.kind){var s=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===s?void 0:s.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[],s=[],a={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,a)}),this),e.forEach((function(e){if(!b(e))return r.push(e);var t=this.decorateElement(e,a);r.push(t.element),r.push.apply(r,t.extras),s.push.apply(s,t.finishers)}),this),!t)return{elements:r,finishers:s};var i=this.decorateConstructor(r,t);return s.push.apply(s,i.finishers),i.finishers=s,i},addElementPlacement:function(e,t,r){var s=t[e.placement];if(!r&&-1!==s.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");s.push(e.key)},decorateElement:function(e,t){for(var r=[],s=[],a=e.decorators,i=a.length-1;i>=0;i--){var n=t[e.placement];n.splice(n.indexOf(e.key),1);var o=this.fromElementDescriptor(e),c=this.toElementFinisherExtras((0,a[i])(o)||o);e=c.element,this.addElementPlacement(e,t),c.finisher&&s.push(c.finisher);var l=c.extras;if(l){for(var h=0;h<l.length;h++)this.addElementPlacement(l[h],t);r.push.apply(r,l)}}return{element:e,finishers:s,extras:r}},decorateConstructor:function(e,t){for(var r=[],s=t.length-1;s>=0;s--){var a=this.fromClassDescriptor(e),i=this.toClassDescriptor((0,t[s])(a)||a);if(void 0!==i.finisher&&r.push(i.finisher),void 0!==i.elements){e=i.elements;for(var n=0;n<e.length-1;n++)for(var o=n+1;o<e.length;o++)if(e[n].key===e[o].key&&e[n].placement===e[o].placement)throw new TypeError("Duplicated element ("+e[n].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&&Symbol.iterator in Object(e))return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return v(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)?v(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=w(e.key),s=String(e.placement);if("static"!==s&&"prototype"!==s&&"own"!==s)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 "'+s+'"');var a=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var i={kind:t,key:r,placement:s,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"),i.initializer=e.initializer),i},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:y(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=y(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:r}},runClassFinishers:function(e,t){for(var r=0;r<t.length;r++){var s=(0,t[r])(e);if(void 0!==s){if("function"!=typeof s)throw new TypeError("Finishers must return a constructor.");e=s}}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 f(e){var t,r=w(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 s={kind:"field"===e.kind?"field":"method",key:r,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(s.decorators=e.decorators),"field"===e.kind&&(s.initializer=e.value),s}function m(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function b(e){return e.decorators&&e.decorators.length}function g(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function y(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 w(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,t||"default");if("object"!=typeof s)return s;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 v(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,s=new Array(t);r<t;r++)s[r]=e[r];return s}function k(e,t,r){return(k="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var s=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_(e)););return e}(e,t);if(s){var a=Object.getOwnPropertyDescriptor(s,t);return a.get?a.get.call(r):a.value}})(e,t,r||e)}function _(e){return(_=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}let E=function(e,t,r,s){var a=p();if(s)for(var i=0;i<s.length;i++)a=s[i](a);var n=t((function(e){a.initializeInstanceElements(e,o.elements)}),r),o=a.decorateClass(function(e){for(var t=[],r=function(e){return"method"===e.kind&&e.key===i.key&&e.placement===i.placement},s=0;s<e.length;s++){var a,i=e[s];if("method"===i.kind&&(a=t.find(r)))if(g(i.descriptor)||g(a.descriptor)){if(b(i)||b(a))throw new ReferenceError("Duplicated methods ("+i.key+") can't be decorated.");a.descriptor=i.descriptor}else{if(b(i)){if(b(a))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+i.key+").");a.decorators=i.decorators}m(i,a)}else t.push(i)}return t}(n.d.map(f)),e);return a.initializeClassElements(n.F,o.elements),a.runClassFinishers(n.F,o.finishers)}([(0,a.Mo)("ha-config-helpers")],(function(e,t){class r extends t{constructor(...t){super(...t),e(this)}}return{F:r,d:[{kind:"field",decorators:[(0,a.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,a.Cb)()],key:"isWide",value:void 0},{kind:"field",decorators:[(0,a.Cb)()],key:"narrow",value:void 0},{kind:"field",decorators:[(0,a.Cb)()],key:"route",value:void 0},{kind:"field",decorators:[(0,a.sz)()],key:"_stateItems",value:()=>[]},{kind:"field",key:"_columns",value(){return(0,i.Z)(((e,t)=>{const r={icon:{title:"",type:"icon",template:(e,t)=>a.dy` <ha-icon .icon=${e||(0,o.K)(t.type)}></ha-icon> `},name:{title:this.hass.localize("ui.panel.config.helpers.picker.headers.name"),sortable:!0,filterable:!0,grows:!0,direction:"asc",template:(t,r)=>a.dy` ${t} ${e?a.dy` <div class="secondary"> ${r.entity_id} </div> `:""} `}};return e||(r.entity_id={title:this.hass.localize("ui.panel.config.helpers.picker.headers.entity_id"),sortable:!0,filterable:!0,width:"25%"}),r.type={title:this.hass.localize("ui.panel.config.helpers.picker.headers.type"),sortable:!0,width:"25%",filterable:!0,template:e=>a.dy` ${this.hass.localize("ui.panel.config.helpers.types."+e)||e} `},r.editable={title:"",type:"icon",template:e=>a.dy` ${e?"":a.dy` <div tabindex="0" style="display:inline-block; position: relative;" > <ha-icon icon="hass:pencil-off"></ha-icon> <paper-tooltip animation-delay="0" position="left"> ${this.hass.localize("ui.panel.config.entities.picker.status.readonly")} </paper-tooltip> </div> `} `},r}))}},{kind:"field",key:"_getItems",value:()=>(0,i.Z)((e=>e.map((e=>({id:e.entity_id,icon:e.attributes.icon,name:e.attributes.friendly_name||"",entity_id:e.entity_id,editable:e.attributes.editable,type:(0,n.N)(e)})))))},{kind:"method",key:"render",value:function(){return this.hass&&void 0!==this._stateItems?a.dy` <hass-tabs-subpage-data-table .hass=${this.hass} .narrow=${this.narrow} back-path="/config" .route=${this.route} .tabs=${l.configSections.automation} .columns=${this._columns(this.narrow,this.hass.language)} .data=${this._getItems(this._stateItems)} @row-click=${this._openEditDialog} hasFab clickable .noDataText=${this.hass.localize("ui.panel.config.helpers.picker.no_helpers")} > <mwc-fab slot="fab" title="${this.hass.localize("ui.panel.config.helpers.picker.add_helper")}" @click=${this._createHelpler} > <ha-svg-icon slot="icon" .path=${s.qX5}></ha-svg-icon> </mwc-fab> </hass-tabs-subpage-data-table> `:a.dy` <hass-loading-screen></hass-loading-screen> `}},{kind:"method",key:"firstUpdated",value:function(e){k(_(r.prototype),"firstUpdated",this).call(this,e),this._getStates()}},{kind:"method",key:"updated",value:function(e){k(_(r.prototype),"updated",this).call(this,e);const t=e.get("hass");t&&this._stateItems&&this._getStates(t)}},{kind:"method",key:"_getStates",value:function(e){let t=!1;const r=Object.values(this.hass.states).filter((r=>!!h.includes((0,n.N)(r))&&((null==e?void 0:e.states[r.entity_id])!==r&&(t=!0),!0)));(t||this._stateItems.length!==r.length)&&(this._stateItems=r)}},{kind:"method",key:"_openEditDialog",value:async function(e){const t=e.detail.id;(0,c.R)(this,{entity_id:t})}},{kind:"method",key:"_createHelpler",value:function(){var e;e=this,(0,d.B)(e,"show-dialog",{dialogTag:"dialog-helper-detail",dialogImport:u,dialogParams:{}})}}]}}),a.oi)}}]); //# sourceMappingURL=chunk.e923667d3986eddd92c1.js.map