iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
30 lines • 12.6 kB
JavaScript
(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([[722],{22383:(e,t,i)=>{"use strict";i.d(t,{$l:()=>r,VZ:()=>o,o5:()=>n,z3:()=>s,vn:()=>a,go:()=>c,mO:()=>l,iJ:()=>d,S_:()=>u,lR:()=>h,qm:()=>p,bt:()=>f,gg:()=>m,yi:()=>v,pT:()=>y,dy:()=>g,tz:()=>b,Rp:()=>k});const r=(e,t)=>e.callWS({type:"zha/devices/reconfigure",ieee:t}),o=(e,t,i,r,o)=>e.callWS({type:"zha/devices/clusters/attributes",ieee:t,endpoint_id:i,cluster_id:r,cluster_type:o}),n=(e,t)=>e.callWS({type:"zha/device",ieee:t}),s=(e,t)=>e.callWS({type:"zha/devices/bindable",ieee:t}),a=(e,t,i)=>e.callWS({type:"zha/devices/bind",source_ieee:t,target_ieee:i}),c=(e,t,i)=>e.callWS({type:"zha/devices/unbind",source_ieee:t,target_ieee:i}),l=(e,t,i,r)=>e.callWS({type:"zha/groups/bind",source_ieee:t,group_id:i,bindings:r}),d=(e,t,i,r)=>e.callWS({type:"zha/groups/unbind",source_ieee:t,group_id:i,bindings:r}),u=(e,t)=>e.callWS({...t,type:"zha/devices/clusters/attributes/value"}),h=(e,t,i,r,o)=>e.callWS({type:"zha/devices/clusters/commands",ieee:t,endpoint_id:i,cluster_id:r,cluster_type:o}),p=(e,t)=>e.callWS({type:"zha/devices/clusters",ieee:t}),f=e=>e.callWS({type:"zha/groups"}),m=(e,t)=>e.callWS({type:"zha/group/remove",group_ids:t}),v=(e,t)=>e.callWS({type:"zha/group",group_id:t}),y=e=>e.callWS({type:"zha/devices/groupable"}),g=(e,t,i)=>e.callWS({type:"zha/group/members/add",group_id:t,members:i}),b=(e,t,i)=>e.callWS({type:"zha/group/members/remove",group_id:t,members:i}),k=(e,t,i)=>e.callWS({type:"zha/group/add",group_name:t,members:i})},722:(e,t,i)=>{"use strict";i.r(t),i.d(t,{HaDeviceActionsZha:()=>b});var r=i(15652),o=i(11654),n=i(22383),s=i(83849),a=i(47181);const c=()=>Promise.all([i.e(5009),i.e(4358),i.e(8161),i.e(6372),i.e(3920),i.e(3822),i.e(315),i.e(7014)]).then(i.bind(i,2188));var l=i(26765);const d=()=>Promise.all([i.e(5009),i.e(4358),i.e(8161),i.e(6372),i.e(3920),i.e(3822),i.e(315),i.e(7014)]).then(i.bind(i,70935));function u(){u=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(i){t.forEach((function(t){t.kind===i&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var i=e.prototype;["method","field"].forEach((function(r){t.forEach((function(t){var o=t.placement;if(t.kind===r&&("static"===o||"prototype"===o)){var n="static"===o?e:i;this.defineClassElement(n,t)}}),this)}),this)},defineClassElement:function(e,t){var i=t.descriptor;if("field"===t.kind){var r=t.initializer;i={enumerable:i.enumerable,writable:i.writable,configurable:i.configurable,value:void 0===r?void 0:r.call(e)}}Object.defineProperty(e,t.key,i)},decorateClass:function(e,t){var i=[],r=[],o={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,o)}),this),e.forEach((function(e){if(!f(e))return i.push(e);var t=this.decorateElement(e,o);i.push(t.element),i.push.apply(i,t.extras),r.push.apply(r,t.finishers)}),this),!t)return{elements:i,finishers:r};var n=this.decorateConstructor(i,t);return r.push.apply(r,n.finishers),n.finishers=r,n},addElementPlacement:function(e,t,i){var r=t[e.placement];if(!i&&-1!==r.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");r.push(e.key)},decorateElement:function(e,t){for(var i=[],r=[],o=e.decorators,n=o.length-1;n>=0;n--){var s=t[e.placement];s.splice(s.indexOf(e.key),1);var a=this.fromElementDescriptor(e),c=this.toElementFinisherExtras((0,o[n])(a)||a);e=c.element,this.addElementPlacement(e,t),c.finisher&&r.push(c.finisher);var l=c.extras;if(l){for(var d=0;d<l.length;d++)this.addElementPlacement(l[d],t);i.push.apply(i,l)}}return{element:e,finishers:r,extras:i}},decorateConstructor:function(e,t){for(var i=[],r=t.length-1;r>=0;r--){var o=this.fromClassDescriptor(e),n=this.toClassDescriptor((0,t[r])(o)||o);if(void 0!==n.finisher&&i.push(n.finisher),void 0!==n.elements){e=n.elements;for(var s=0;s<e.length-1;s++)for(var a=s+1;a<e.length;a++)if(e[s].key===e[a].key&&e[s].placement===e[a].placement)throw new TypeError("Duplicated element ("+e[s].key+")")}}return{elements:e,finishers:i}},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 g(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?g(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 i=y(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 o=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var n={kind:t,key:i,placement:r,descriptor:Object.assign({},o)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(o,"get","The property descriptor of a field descriptor"),this.disallowProperty(o,"set","The property descriptor of a field descriptor"),this.disallowProperty(o,"value","The property descriptor of a field descriptor"),n.initializer=e.initializer),n},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 i=v(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:i}},runClassFinishers:function(e,t){for(var i=0;i<t.length;i++){var r=(0,t[i])(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,i){if(void 0!==e[t])throw new TypeError(i+" can't have a ."+t+" property.")}};return e}function h(e){var t,i=y(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:i,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 p(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function f(e){return e.decorators&&e.decorators.length}function m(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function v(e,t){var i=e[t];if(void 0!==i&&"function"!=typeof i)throw new TypeError("Expected '"+t+"' to be a function");return i}function y(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!=typeof r)return r;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 g(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=new Array(t);i<t;i++)r[i]=e[i];return r}let b=function(e,t,i,r){var o=u();if(r)for(var n=0;n<r.length;n++)o=r[n](o);var s=t((function(e){o.initializeInstanceElements(e,a.elements)}),i),a=o.decorateClass(function(e){for(var t=[],i=function(e){return"method"===e.kind&&e.key===n.key&&e.placement===n.placement},r=0;r<e.length;r++){var o,n=e[r];if("method"===n.kind&&(o=t.find(i)))if(m(n.descriptor)||m(o.descriptor)){if(f(n)||f(o))throw new ReferenceError("Duplicated methods ("+n.key+") can't be decorated.");o.descriptor=n.descriptor}else{if(f(n)){if(f(o))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+n.key+").");o.decorators=n.decorators}p(n,o)}else t.push(n)}return t}(s.d.map(h)),e);return o.initializeClassElements(s.F,a.elements),o.runClassFinishers(s.F,a.finishers)}([(0,r.Mo)("ha-device-actions-zha")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,r.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,r.Cb)()],key:"device",value:void 0},{kind:"field",decorators:[(0,r.sz)()],key:"_zhaDevice",value:void 0},{kind:"method",key:"updated",value:function(e){if(e.has("device")){const e=this.device.connections.find((e=>"zigbee"===e[0]));if(!e)return;(0,n.o5)(this.hass,e[1]).then((e=>{this._zhaDevice=e}))}}},{kind:"method",key:"render",value:function(){return this._zhaDevice?r.dy`
${"Coordinator"!==this._zhaDevice.device_type?r.dy`
<mwc-button @click=${this._onReconfigureNodeClick}>
${this.hass.localize("ui.dialogs.zha_device_info.buttons.reconfigure")}
</mwc-button>
`:""}
${"Mains"!==this._zhaDevice.power_source||"Router"!==this._zhaDevice.device_type&&"Coordinator"!==this._zhaDevice.device_type?"":r.dy`
<mwc-button @click=${this._onAddDevicesClick}>
${this.hass.localize("ui.dialogs.zha_device_info.buttons.add")}
</mwc-button>
`}
${"Coordinator"!==this._zhaDevice.device_type?r.dy`
<mwc-button @click=${this._handleZigbeeInfoClicked}>
${this.hass.localize("ui.dialogs.zha_device_info.buttons.zigbee_information")}
</mwc-button>
<mwc-button @click=${this._showClustersDialog}>
${this.hass.localize("ui.dialogs.zha_device_info.buttons.clusters")}
</mwc-button>
<mwc-button class="warning" @click=${this._removeDevice}>
${this.hass.localize("ui.dialogs.zha_device_info.buttons.remove")}
</mwc-button>
`:""}
`:r.dy``}},{kind:"method",key:"_showClustersDialog",value:async function(){var e,t;await(e=this,t={device:this._zhaDevice},void(0,a.B)(e,"show-dialog",{dialogTag:"dialog-zha-cluster",dialogImport:d,dialogParams:t}))}},{kind:"method",key:"_onReconfigureNodeClick",value:async function(){this.hass&&(0,n.$l)(this.hass,this._zhaDevice.ieee)}},{kind:"method",key:"_onAddDevicesClick",value:function(){(0,s.c)(this,"/config/zha/add/"+this._zhaDevice.ieee)}},{kind:"method",key:"_handleZigbeeInfoClicked",value:async function(){var e,t;e=this,t={device:this._zhaDevice},(0,a.B)(e,"show-dialog",{dialogTag:"dialog-zha-device-zigbee-info",dialogImport:c,dialogParams:t})}},{kind:"method",key:"_removeDevice",value:async function(){await(0,l.g7)(this,{text:this.hass.localize("ui.dialogs.zha_device_info.confirmations.remove")})&&(await this.hass.callService("zha","remove",{ieee:this._zhaDevice.ieee}),history.back())}},{kind:"get",static:!0,key:"styles",value:function(){return[o.Qx,r.iv`
:host {
display: flex;
flex-direction: column;
align-items: flex-start;
}
`]}}]}}),r.oi)}}]);
//# sourceMappingURL=chunk.c5c20d2e5941cb285d65.js.map