iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
572 lines (528 loc) • 90.1 kB
JavaScript
/*! For license information please see chunk.846eac8607369da53216.js.LICENSE.txt */
(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([[7370],{39841:(e,t,i)=>{"use strict";i(65233),i(65660);var o=i(9672),r=i(87156),s=i(50856),a=i(44181);(0,o.k)({_template:s.d`
<style>
:host {
display: block;
/**
* Force app-header-layout to have its own stacking context so that its parent can
* control the stacking of it relative to other elements (e.g. app-drawer-layout).
* This could be done using \`isolation: isolate\`, but that's not well supported
* across browsers.
*/
position: relative;
z-index: 0;
}
#wrapper ::slotted([slot=header]) {
@apply --layout-fixed-top;
z-index: 1;
}
#wrapper.initializing ::slotted([slot=header]) {
position: relative;
}
:host([has-scrolling-region]) {
height: 100%;
}
:host([has-scrolling-region]) #wrapper ::slotted([slot=header]) {
position: absolute;
}
:host([has-scrolling-region]) #wrapper.initializing ::slotted([slot=header]) {
position: relative;
}
:host([has-scrolling-region]) #wrapper #contentContainer {
@apply --layout-fit;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
:host([has-scrolling-region]) #wrapper.initializing #contentContainer {
position: relative;
}
:host([fullbleed]) {
@apply --layout-vertical;
@apply --layout-fit;
}
:host([fullbleed]) #wrapper,
:host([fullbleed]) #wrapper #contentContainer {
@apply --layout-vertical;
@apply --layout-flex;
}
#contentContainer {
/* Create a stacking context here so that all children appear below the header. */
position: relative;
z-index: 0;
}
@media print {
:host([has-scrolling-region]) #wrapper #contentContainer {
overflow-y: visible;
}
}
</style>
<div id="wrapper" class="initializing">
<slot id="headerSlot" name="header"></slot>
<div id="contentContainer">
<slot></slot>
</div>
</div>
`,is:"app-header-layout",behaviors:[a.Y],properties:{hasScrollingRegion:{type:Boolean,value:!1,reflectToAttribute:!0}},observers:["resetLayout(isAttached, hasScrollingRegion)"],get header(){return(0,r.vz)(this.$.headerSlot).getDistributedNodes()[0]},_updateLayoutStates:function(){var e=this.header;if(this.isAttached&&e){this.$.wrapper.classList.remove("initializing"),e.scrollTarget=this.hasScrollingRegion?this.$.contentContainer:this.ownerDocument.documentElement;var t=e.offsetHeight;this.hasScrollingRegion?(e.style.left="",e.style.right=""):requestAnimationFrame(function(){var t=this.getBoundingClientRect(),i=document.documentElement.clientWidth-t.right;e.style.left=t.left+"px",e.style.right=i+"px"}.bind(this));var i=this.$.contentContainer.style;e.fixed&&!e.condenses&&this.hasScrollingRegion?(i.marginTop=t+"px",i.paddingTop=""):(i.paddingTop=t+"px",i.marginTop="")}}})},27269:(e,t,i)=>{"use strict";i.d(t,{p:()=>o});const o=e=>e.substr(e.indexOf(".")+1)},22311:(e,t,i)=>{"use strict";i.d(t,{N:()=>r});var o=i(58831);const r=e=>(0,o.M)(e.entity_id)},91741:(e,t,i)=>{"use strict";i.d(t,{C:()=>r});var o=i(27269);const r=e=>void 0===e.attributes.friendly_name?(0,o.p)(e.entity_id).replace(/_/g," "):e.attributes.friendly_name||""},54909:(e,t,i)=>{"use strict";var o=i(50856),r=i(28426),s=i(26765),a=i(11052);i(98762);class n extends((0,a.I)(r.H3)){static get template(){return o.d`
<ha-progress-button
id="progress"
progress="[[progress]]"
on-click="buttonTapped"
tabindex="0"
><slot></slot
></ha-progress-button>
`}static get properties(){return{hass:{type:Object},progress:{type:Boolean,value:!1},domain:{type:String},service:{type:String},serviceData:{type:Object,value:{}},confirmation:{type:String}}}callService(){this.progress=!0;const e=this,t={domain:this.domain,service:this.service,serviceData:this.serviceData};this.hass.callService(this.domain,this.service,this.serviceData).then((function(){e.progress=!1,e.$.progress.actionSuccess(),t.success=!0}),(function(){e.progress=!1,e.$.progress.actionError(),t.success=!1})).then((function(){e.fire("hass-service-called",t)}))}buttonTapped(){this.confirmation?(0,s.g7)(this,{text:this.confirmation,confirm:()=>this.callService()}):this.callService()}}customElements.define("ha-call-service-button",n)},67102:(e,t,i)=>{"use strict";var o=i(50856),r=i(28426);class s extends r.H3{static get template(){return o.d` [[_getDescription(hass, domain, service)]] `}static get properties(){return{hass:Object,domain:String,service:String}}_getDescription(e,t,i){const o=e.services[t];if(!o)return"";const r=o[i];return r?r.description:""}}customElements.define("ha-service-description",s)},60633:(e,t,i)=>{"use strict";i.d(t,{N8:()=>o,E0:()=>r,PH:()=>s,BM:()=>a,HV:()=>n,MI:()=>l,qc:()=>c,fQ:()=>d});const o=0,r=5,s=7,a=10,n=e=>e.callWS({type:"zwave/network_status"}),l=e=>e.callWS({type:"zwave/start_ozw_config_flow"}),c=e=>e.callWS({type:"zwave/get_migration_config"}),d=(e,t)=>e.callApi("GET",`zwave/config/${t}`)},27849:(e,t,i)=>{"use strict";i(39841);var o=i(50856);i(28426);class r extends(customElements.get("app-header-layout")){static get template(){return o.d`
<style>
:host {
display: block;
/**
* Force app-header-layout to have its own stacking context so that its parent can
* control the stacking of it relative to other elements (e.g. app-drawer-layout).
* This could be done using \`isolation: isolate\`, but that's not well supported
* across browsers.
*/
position: relative;
z-index: 0;
}
#wrapper ::slotted([slot="header"]) {
@apply --layout-fixed-top;
z-index: 1;
}
#wrapper.initializing ::slotted([slot="header"]) {
position: relative;
}
:host([has-scrolling-region]) {
height: 100%;
}
:host([has-scrolling-region]) #wrapper ::slotted([slot="header"]) {
position: absolute;
}
:host([has-scrolling-region])
#wrapper.initializing
::slotted([slot="header"]) {
position: relative;
}
:host([has-scrolling-region]) #wrapper #contentContainer {
@apply --layout-fit;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
:host([has-scrolling-region]) #wrapper.initializing #contentContainer {
position: relative;
}
#contentContainer {
/* Create a stacking context here so that all children appear below the header. */
position: relative;
z-index: 0;
/* Using 'transform' will cause 'position: fixed' elements to behave like
'position: absolute' relative to this element. */
transform: translate(0);
margin-left: env(safe-area-inset-left);
margin-right: env(safe-area-inset-right);
}
@media print {
:host([has-scrolling-region]) #wrapper #contentContainer {
overflow-y: visible;
}
}
</style>
<div id="wrapper" class="initializing">
<slot id="headerSlot" name="header"></slot>
<div id="contentContainer"><slot></slot></div>
<slot id="fab" name="fab"></slot>
</div>
`}}customElements.define("ha-app-layout",r)},1265:(e,t,i)=>{"use strict";i.d(t,{Z:()=>o});const o=(0,i(76389).o)((e=>class extends e{static get properties(){return{hass:Object,localize:{type:Function,computed:"__computeLocalize(hass.localize)"}}}__computeLocalize(e){return e}}))},40138:()=>{const e=document.createElement("template");e.setAttribute("style","display: none;"),e.innerHTML='<dom-module id="ha-form-style">\n <template>\n <style>\n .form-group {\n @apply --layout-horizontal;\n @apply --layout-center;\n padding: 8px 16px;\n }\n\n .form-group label {\n @apply --layout-flex-2;\n }\n\n .form-group .form-control {\n @apply --layout-flex;\n }\n\n .form-group.vertical {\n @apply --layout-vertical;\n @apply --layout-start;\n }\n\n paper-dropdown-menu.form-control {\n margin: -9px 0;\n }\n </style>\n </template>\n</dom-module>',document.head.appendChild(e.content)},68888:(e,t,i)=>{"use strict";i.r(t);i(53268),i(12730),i(8878),i(30879),i(53973),i(51095);var o=i(50856),r=i(28426),s=i(22311),a=i(91741);const n=(e,t)=>{const i=(0,a.C)(e),o=(0,a.C)(t);return i<o?-1:i>o?1:0};i(54909),i(22098),i(10983),i(2315),i(48932),i(67102),i(27849);var l=i(11052),c=i(1265);i(3426),i(88165),i(40138);class d extends((0,c.Z)(r.H3)){static get template(){return o.d`
<style include="iron-flex ha-style">
.content {
margin-top: 24px;
}
ha-card {
margin: 0 auto;
max-width: 600px;
}
.device-picker {
@apply --layout-horizontal;
@apply --layout-center-center;
padding-left: 24px;
padding-right: 24px;
padding-bottom: 24px;
}
.help-text {
padding-left: 24px;
padding-right: 24px;
padding-bottom: 12px;
}
</style>
<ha-card
class="content"
header="[[localize('ui.panel.config.zwave.node_management.node_group_associations')]]"
>
<!-- TODO make api for getting groups and members -->
<div class="device-picker">
<paper-dropdown-menu
label="[[localize('ui.panel.config.zwave.node_management.group')]]"
dynamic-align=""
class="flex"
>
<paper-listbox
slot="dropdown-content"
selected="{{_selectedGroup}}"
>
<template is="dom-repeat" items="[[groups]]" as="state">
<paper-item>[[_computeSelectCaptionGroup(state)]]</paper-item>
</template>
</paper-listbox>
</paper-dropdown-menu>
</div>
<template is="dom-if" if="[[_computeIsGroupSelected(_selectedGroup)]]">
<div class="device-picker">
<paper-dropdown-menu
label="[[localize('ui.panel.config.zwave.node_management.node_to_control')]]"
dynamic-align=""
class="flex"
>
<paper-listbox
slot="dropdown-content"
selected="{{_selectedTargetNode}}"
>
<template is="dom-repeat" items="[[nodes]]" as="state">
<paper-item>[[_computeSelectCaption(state)]]</paper-item>
</template>
</paper-listbox>
</paper-dropdown-menu>
</div>
<div class="help-text">
<span
>[[localize('ui.panel.config.zwave.node_management.nodes_in_group')]]</span
>
<template is="dom-repeat" items="[[_otherGroupNodes]]" as="state">
<div>[[state]]</div>
</template>
</div>
<div class="help-text">
<span
>[[localize('ui.panel.config.zwave.node_management.max_associations')]]</span
>
<span>[[_maxAssociations]]</span>
</div>
</template>
<template
is="dom-if"
if="[[_computeIsTargetNodeSelected(_selectedTargetNode)]]"
>
<div class="card-actions">
<template is="dom-if" if="[[!_noAssociationsLeft]]">
<ha-call-service-button
hass="[[hass]]"
domain="zwave"
service="change_association"
service-data="[[_addAssocServiceData]]"
>
[[localize('ui.panel.config.zwave.node_management.add_to_group')]]
</ha-call-service-button>
</template>
<template
is="dom-if"
if="[[_computeTargetInGroup(_selectedGroup, _selectedTargetNode)]]"
>
<ha-call-service-button
hass="[[hass]]"
domain="zwave"
service="change_association"
service-data="[[_removeAssocServiceData]]"
>
[[localize('ui.panel.config.zwave.node_management.remove_from_group')]]
</ha-call-service-button>
</template>
<template is="dom-if" if="[[_isBroadcastNodeInGroup]]">
<ha-call-service-button
hass="[[hass]]"
domain="zwave"
service="change_association"
service-data="[[_removeBroadcastNodeServiceData]]"
>
[[localize('ui.panel.config.zwave.node_management.remove_broadcast')]]
</ha-call-service-button>
</template>
</div>
</template>
</ha-card>
`}static get properties(){return{hass:Object,nodes:Array,groups:Array,selectedNode:{type:Number,observer:"_selectedNodeChanged"},_selectedTargetNode:{type:Number,value:-1,observer:"_selectedTargetNodeChanged"},_selectedGroup:{type:Number,value:-1},_otherGroupNodes:{type:Array,value:-1,computed:"_computeOtherGroupNodes(_selectedGroup)"},_maxAssociations:{type:String,value:"",computed:"_computeMaxAssociations(_selectedGroup)"},_noAssociationsLeft:{type:Boolean,value:!0,computed:"_computeAssociationsLeft(_selectedGroup)"},_addAssocServiceData:{type:String,value:""},_removeAssocServiceData:{type:String,value:""},_removeBroadcastNodeServiceData:{type:String,value:""},_isBroadcastNodeInGroup:{type:Boolean,value:!1}}}static get observers(){return["_selectedGroupChanged(groups, _selectedGroup)"]}ready(){super.ready(),this.addEventListener("hass-service-called",(e=>this.serviceCalled(e)))}serviceCalled(e){e.detail.success&&setTimeout((()=>{this._refreshGroups(this.selectedNode)}),5e3)}_computeAssociationsLeft(e){return-1===e||this._maxAssociations===this._otherGroupNodes.length}_computeMaxAssociations(e){if(-1===e)return-1;const t=this.groups[e].value.max_associations;return t||"None"}_computeOtherGroupNodes(e){if(-1===e)return-1;this.setProperties({_isBroadcastNodeInGroup:!1});const t=Object.values(this.groups[e].value.association_instances);return t.length?t.map((t=>{if(!t.length||2!==t.length)return`Unknown Node: ${t}`;const i=t[0],o=t[1],r=this.nodes.find((e=>e.attributes.node_id===i));if(255===i&&this.setProperties({_isBroadcastNodeInGroup:!0,_removeBroadcastNodeServiceData:{node_id:this.nodes[this.selectedNode].attributes.node_id,association:"remove",target_node_id:255,group:this.groups[e].key}}),!r)return`Unknown Node (${i}: (${o} ? ${i}.${o} : ${i}))`;let s=this._computeSelectCaption(r);return o&&(s+=`/ Instance: ${o}`),s})):["None"]}_computeTargetInGroup(e,t){if(-1===e||-1===t)return!1;const i=Object.values(this.groups[e].value.associations);return!!i.length&&-1!==i.indexOf(this.nodes[t].attributes.node_id)}_computeSelectCaption(e){return`${(0,a.C)(e)}\n (Node: ${e.attributes.node_id}\n ${e.attributes.query_stage})`}_computeSelectCaptionGroup(e){return`${e.key}: ${e.value.label}`}_computeIsTargetNodeSelected(e){return this.nodes&&-1!==e}_computeIsGroupSelected(e){return this.nodes&&-1!==this.selectedNode&&-1!==e}_computeAssocServiceData(e,t){return-1===!this.groups||-1===e||-1===this.selectedNode||-1===this._selectedTargetNode?-1:{node_id:this.nodes[this.selectedNode].attributes.node_id,association:t,target_node_id:this.nodes[this._selectedTargetNode].attributes.node_id,group:this.groups[e].key}}async _refreshGroups(e){const t=[],i=await this.hass.callApi("GET",`zwave/groups/${this.nodes[e].attributes.node_id}`);Object.keys(i).forEach((e=>{t.push({key:e,value:i[e]})})),this.setProperties({groups:t,_maxAssociations:t[this._selectedGroup].value.max_associations,_otherGroupNodes:Object.values(t[this._selectedGroup].value.associations),_isBroadcastNodeInGroup:!1});const o=this._selectedGroup;this.setProperties({_selectedGroup:-1}),this.setProperties({_selectedGroup:o})}_selectedGroupChanged(){-1!==this._selectedGroup&&this.setProperties({_maxAssociations:this.groups[this._selectedGroup].value.max_associations,_otherGroupNodes:Object.values(this.groups[this._selectedGroup].value.associations)})}_selectedTargetNodeChanged(){-1!==this._selectedGroup&&(this._computeTargetInGroup(this._selectedGroup,this._selectedTargetNode)?this.setProperties({_removeAssocServiceData:this._computeAssocServiceData(this._selectedGroup,"remove")}):this.setProperties({_addAssocServiceData:this._computeAssocServiceData(this._selectedGroup,"add")}))}_selectedNodeChanged(){-1!==this.selectedNode&&this.setProperties({_selectedTargetNode:-1,_selectedGroup:-1})}}customElements.define("zwave-groups",d);i(53918),i(32296);function p(){return window.matchMedia("(display-mode: standalone)").matches}let u=!1;class h extends((0,c.Z)((0,l.I)(r.H3))){static get template(){return o.d`
<style include="iron-flex ha-style">
.content {
margin-top: 24px;
}
ha-card {
margin: 0 auto;
max-width: 600px;
}
.device-picker {
padding-left: 24px;
padding-right: 24px;
padding-bottom: 24px;
}
</style>
<ha-config-section is-wide="[[isWide]]">
<span slot="header">
[[localize('ui.panel.config.zwave.ozw_log.header')]]
</span>
<span slot="introduction">
[[localize('ui.panel.config.zwave.ozw_log.introduction')]]
</span>
<ha-card class="content">
<div class="device-picker">
<paper-input label="[[localize('ui.panel.config.zwave.ozw_log.last_log_lines')]]" type="number" min="0" max="1000" step="10" value="{{numLogLines}}">
</paper-input>
</div>
<div class="card-actions">
<mwc-button raised="true" on-click="_openLogWindow">[[localize('ui.panel.config.zwave.ozw_log.load')]]</mwc-button>
<mwc-button raised="true" on-click="_tailLog" disabled="{{_completeLog}}">[[localize('ui.panel.config.zwave.ozw_log.tail')]]</mwc-button>
</ha-card>
</ha-config-section>
`}static get properties(){return{hass:Object,isWide:{type:Boolean,value:!1},_ozwLogs:String,_completeLog:{type:Boolean,value:!0},numLogLines:{type:Number,value:0,observer:"_isCompleteLog"},_intervalId:String,tail:Boolean}}async _tailLog(){this.setProperties({tail:!0});const e=await this._openLogWindow();p()||this.setProperties({_intervalId:setInterval((()=>{this._refreshLog(e)}),1500)})}async _openLogWindow(){const e=await this.hass.callApi("GET","zwave/ozwlog?lines="+this.numLogLines);if(this.setProperties({_ozwLogs:e}),p())return this._showOzwlogDialog(),-1;const t=open("","ozwLog","toolbar");return t.document.body.innerHTML=`<pre>${this._ozwLogs}</pre>`,t}async _refreshLog(e){if(!0===e.closed)clearInterval(this._intervalId),this.setProperties({_intervalId:null});else{const t=await this.hass.callApi("GET","zwave/ozwlog?lines="+this.numLogLines);this.setProperties({_ozwLogs:t}),e.document.body.innerHTML=`<pre>${this._ozwLogs}</pre>`}}_isCompleteLog(){"0"!==this.numLogLines?this.setProperties({_completeLog:!1}):this.setProperties({_completeLog:!0})}connectedCallback(){super.connectedCallback(),u||(u=!0,this.fire("register-dialog",{dialogShowEvent:"show-ozwlog-dialog",dialogTag:"zwave-log-dialog",dialogImport:()=>i.e(5).then(i.bind(i,20005))}))}_showOzwlogDialog(){this.fire("show-ozwlog-dialog",{hass:this.hass,_numLogLines:this.numLogLines,_ozwLog:this._ozwLogs,_tail:this.tail,dialogClosedCallback:()=>this._dialogClosed()})}_dialogClosed(){this.setProperties({tail:!1})}}customElements.define("ozw-log",h);var f=i(50424),m=i(55358),v=(i(94132),i(31206),i(16509),i(60633)),g=i(11654),y=i(27322);function _(){_=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(o){t.forEach((function(t){var r=t.placement;if(t.kind===o&&("static"===r||"prototype"===r)){var s="static"===r?e:i;this.defineClassElement(s,t)}}),this)}),this)},defineClassElement:function(e,t){var i=t.descriptor;if("field"===t.kind){var o=t.initializer;i={enumerable:i.enumerable,writable:i.writable,configurable:i.configurable,value:void 0===o?void 0:o.call(e)}}Object.defineProperty(e,t.key,i)},decorateClass:function(e,t){var i=[],o=[],r={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,r)}),this),e.forEach((function(e){if(!k(e))return i.push(e);var t=this.decorateElement(e,r);i.push(t.element),i.push.apply(i,t.extras),o.push.apply(o,t.finishers)}),this),!t)return{elements:i,finishers:o};var s=this.decorateConstructor(i,t);return o.push.apply(o,s.finishers),s.finishers=o,s},addElementPlacement:function(e,t,i){var o=t[e.placement];if(!i&&-1!==o.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");o.push(e.key)},decorateElement:function(e,t){for(var i=[],o=[],r=e.decorators,s=r.length-1;s>=0;s--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var n=this.fromElementDescriptor(e),l=this.toElementFinisherExtras((0,r[s])(n)||n);e=l.element,this.addElementPlacement(e,t),l.finisher&&o.push(l.finisher);var c=l.extras;if(c){for(var d=0;d<c.length;d++)this.addElementPlacement(c[d],t);i.push.apply(i,c)}}return{element:e,finishers:o,extras:i}},decorateConstructor:function(e,t){for(var i=[],o=t.length-1;o>=0;o--){var r=this.fromClassDescriptor(e),s=this.toClassDescriptor((0,t[o])(r)||r);if(void 0!==s.finisher&&i.push(s.finisher),void 0!==s.elements){e=s.elements;for(var a=0;a<e.length-1;a++)for(var n=a+1;n<e.length;n++)if(e[a].key===e[n].key&&e[a].placement===e[n].placement)throw new TypeError("Duplicated element ("+e[a].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&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return E(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)?E(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=C(e.key),o=String(e.placement);if("static"!==o&&"prototype"!==o&&"own"!==o)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 "'+o+'"');var r=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var s={kind:t,key:i,placement:o,descriptor:Object.assign({},r)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(r,"get","The property descriptor of a field descriptor"),this.disallowProperty(r,"set","The property descriptor of a field descriptor"),this.disallowProperty(r,"value","The property descriptor of a field descriptor"),s.initializer=e.initializer),s},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:x(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=x(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:i}},runClassFinishers:function(e,t){for(var i=0;i<t.length;i++){var o=(0,t[i])(e);if(void 0!==o){if("function"!=typeof o)throw new TypeError("Finishers must return a constructor.");e=o}}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 w(e){var t,i=C(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 o={kind:"field"===e.kind?"field":"method",key:i,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(o.decorators=e.decorators),"field"===e.kind&&(o.initializer=e.value),o}function b(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function k(e){return e.decorators&&e.decorators.length}function z(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function x(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 C(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var o=i.call(e,t||"default");if("object"!=typeof o)return o;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 E(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,o=new Array(t);i<t;i++)o[i]=e[i];return o}function S(e,t,i){return(S="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var o=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=P(e)););return e}(e,t);if(o){var r=Object.getOwnPropertyDescriptor(o,t);return r.get?r.get.call(i):r.value}})(e,t,i||e)}function P(e){return(P=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}!function(e,t,i,o){var r=_();if(o)for(var s=0;s<o.length;s++)r=o[s](r);var a=t((function(e){r.initializeInstanceElements(e,n.elements)}),i),n=r.decorateClass(function(e){for(var t=[],i=function(e){return"method"===e.kind&&e.key===s.key&&e.placement===s.placement},o=0;o<e.length;o++){var r,s=e[o];if("method"===s.kind&&(r=t.find(i)))if(z(s.descriptor)||z(r.descriptor)){if(k(s)||k(r))throw new ReferenceError("Duplicated methods ("+s.key+") can't be decorated.");r.descriptor=s.descriptor}else{if(k(s)){if(k(r))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+s.key+").");r.decorators=s.decorators}b(s,r)}else t.push(s)}return t}(a.d.map(w)),e);r.initializeClassElements(a.F,n.elements),r.runClassFinishers(a.F,n.finishers)}([(0,m.Mo)("zwave-network")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,m.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,m.Cb)()],key:"isWide",value:void 0},{kind:"field",decorators:[(0,m.SB)()],key:"_showHelp",value:()=>!1},{kind:"field",decorators:[(0,m.SB)()],key:"_networkStatus",value:void 0},{kind:"field",decorators:[(0,m.SB)()],key:"_unsubs",value:()=>[]},{kind:"method",key:"disconnectedCallback",value:function(){this._unsubscribe()}},{kind:"method",key:"firstUpdated",value:function(e){S(P(i.prototype),"firstUpdated",this).call(this,e),this._getNetworkStatus(),this._subscribe()}},{kind:"method",key:"render",value:function(){return f.dy`
<ha-config-section .isWide="${this.isWide}">
<div class="sectionHeader" slot="header">
<span>
${this.hass.localize("ui.panel.config.zwave.network_management.header")}
</span>
<ha-icon-button
class="toggle-help-icon"
@click="${this._onHelpTap}"
icon="hass:help-circle"
></ha-icon-button>
</div>
<div slot="introduction">
${this.hass.localize("ui.panel.config.zwave.network_management.introduction")}
<p>
<a
href="${(0,y.R)(this.hass,"/docs/z-wave/control-panel/")}"
target="_blank"
rel="noreferrer"
>
${this.hass.localize("ui.panel.config.zwave.learn_more")}
</a>
</p>
</div>
${this._networkStatus?f.dy`
<ha-card class="content network-status">
<div class="details">
${this._networkStatus.state===v.N8?f.dy`
<ha-icon icon="hass:close"></ha-icon>
${this.hass.localize("ui.panel.config.zwave.network_status.network_stopped")}
`:this._networkStatus.state===v.E0?f.dy`
<ha-circular-progress active></ha-circular-progress>
${this.hass.localize("ui.panel.config.zwave.network_status.network_starting")}<br />
<small>
${this.hass.localize("ui.panel.config.zwave.network_status.network_starting_note")}
</small>
`:this._networkStatus.state===v.PH?f.dy`
<ha-icon icon="hass:checkbox-marked-circle"> </ha-icon>
${this.hass.localize("ui.panel.config.zwave.network_status.network_started")}<br />
<small>
${this.hass.localize("ui.panel.config.zwave.network_status.network_started_note_some_queried")}
</small>
`:this._networkStatus.state===v.BM?f.dy`
${this.hass.localize("ui.panel.config.zwave.network_status.network_started")}<br />
<small>
${this.hass.localize("ui.panel.config.zwave.network_status.network_started_note_all_queried")}
</small>
`:""}
</div>
<div class="card-actions">
${this._networkStatus.state>=v.PH?f.dy`
${this._generateServiceButton("stop_network")}
${this._generateServiceButton("heal_network")}
${this._generateServiceButton("test_network")}
`:f.dy` ${this._generateServiceButton("start_network")} `}
</div>
${this._networkStatus.state>=v.PH?f.dy`
<div class="card-actions">
${this._generateServiceButton("soft_reset")}
<ha-call-api-button
.hass=${this.hass}
path="zwave/saveconfig"
>
${this.hass.localize("ui.panel.config.zwave.services.save_config")}
</ha-call-api-button>
</div>
`:""}
</ha-card>
${this._networkStatus.state>=v.PH?f.dy`
<ha-card class="content">
<div class="card-actions">
${this._generateServiceButton("add_node_secure")}
${this._generateServiceButton("add_node")}
${this._generateServiceButton("remove_node")}
</div>
<div class="card-actions">
${this._generateServiceButton("cancel_command")}
</div>
</ha-card>
`:""}
`:""}
</ha-config-section>
`}},{kind:"method",key:"_getNetworkStatus",value:async function(){this._networkStatus=await(0,v.HV)(this.hass)}},{kind:"method",key:"_subscribe",value:function(){this._unsubs=["zwave.network_start","zwave.network_stop","zwave.network_ready","zwave.network_complete","zwave.network_complete_some_dead"].map((e=>this.hass.connection.subscribeEvents((e=>this._handleEvent(e)),e)))}},{kind:"method",key:"_unsubscribe",value:function(){for(;this._unsubs.length;)this._unsubs.pop().then((e=>e()))}},{kind:"method",key:"_handleEvent",value:function(e){"zwave.network_start"===e.event_type?(this._networkStatus&&(this._networkStatus={...this._networkStatus,state:5}),setTimeout((()=>this._getNetworkStatus),1e3)):this._getNetworkStatus()}},{kind:"method",key:"_onHelpTap",value:function(){this._showHelp=!this._showHelp}},{kind:"method",key:"_generateServiceButton",value:function(e){return f.dy`
<ha-call-service-button
.hass=${this.hass}
domain="zwave"
service="${e}"
>
${this.hass.localize("ui.panel.config.zwave.services."+e)}
</ha-call-service-button>
<ha-service-description
.hass=${this.hass}
domain="zwave"
service="${e}"
?hidden=${!this._showHelp}
>
</ha-service-description>
`}},{kind:"get",static:!0,key:"styles",value:function(){return[g.Qx,f.iv`
.content {
margin-top: 24px;
}
.sectionHeader {
position: relative;
padding-right: 40px;
}
.network-status {
text-align: center;
}
.network-status div.details {
font-size: 1.5rem;
padding: 24px;
}
.network-status ha-icon {
display: block;
margin: 0px auto 16px;
width: 48px;
height: 48px;
}
.network-status small {
font-size: 1rem;
}
ha-card {
margin: 0 auto;
max-width: 600px;
}
.card-actions.warning ha-call-service-button {
color: var(--error-color);
}
.toggle-help-icon {
position: absolute;
top: -6px;
right: 0;
color: var(--primary-color);
}
ha-service-description {
display: block;
color: grey;
padding: 0 8px 12px;
}
[hidden] {
display: none;
}
`]}}]}}),f.oi);function N(){N=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(o){t.forEach((function(t){var r=t.placement;if(t.kind===o&&("static"===r||"prototype"===r)){var s="static"===r?e:i;this.defineClassElement(s,t)}}),this)}),this)},defineClassElement:function(e,t){var i=t.descriptor;if("field"===t.kind){var o=t.initializer;i={enumerable:i.enumerable,writable:i.writable,configurable:i.configurable,value:void 0===o?void 0:o.call(e)}}Object.defineProperty(e,t.key,i)},decorateClass:function(e,t){var i=[],o=[],r={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,r)}),this),e.forEach((function(e){if(!D(e))return i.push(e);var t=this.decorateElement(e,r);i.push(t.element),i.push.apply(i,t.extras),o.push.apply(o,t.finishers)}),this),!t)return{elements:i,finishers:o};var s=this.decorateConstructor(i,t);return o.push.apply(o,s.finishers),s.finishers=o,s},addElementPlacement:function(e,t,i){var o=t[e.placement];if(!i&&-1!==o.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");o.push(e.key)},decorateElement:function(e,t){for(var i=[],o=[],r=e.decorators,s=r.length-1;s>=0;s--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var n=this.fromElementDescriptor(e),l=this.toElementFinisherExtras((0,r[s])(n)||n);e=l.element,this.addElementPlacement(e,t),l.finisher&&o.push(l.finisher);var c=l.extras;if(c){for(var d=0;d<c.length;d++)this.addElementPlacement(c[d],t);i.push.apply(i,c)}}return{element:e,finishers:o,extras:i}},decorateConstructor:function(e,t){for(var i=[],o=t.length-1;o>=0;o--){var r=this.fromClassDescriptor(e),s=this.toClassDescriptor((0,t[o])(r)||r);if(void 0!==s.finisher&&i.push(s.finisher),void 0!==s.elements){e=s.elements;for(var a=0;a<e.length-1;a++)for(var n=a+1;n<e.length;n++)if(e[a].key===e[n].key&&e[a].placement===e[n].placement)throw new TypeError("Duplicated element ("+e[a].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&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return j(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)?j(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=O(e.key),o=String(e.placement);if("static"!==o&&"prototype"!==o&&"own"!==o)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 "'+o+'"');var r=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var s={kind:t,key:i,placement:o,descriptor:Object.assign({},r)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(r,"get","The property descriptor of a field descriptor"),this.disallowProperty(r,"set","The property descriptor of a field descriptor"),this.disallowProperty(r,"value","The property descriptor of a field descriptor"),s.initializer=e.initializer),s},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:T(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=T(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:i}},runClassFinishers:function(e,t){for(var i=0;i<t.length;i++){var o=(0,t[i])(e);if(void 0!==o){if("function"!=typeof o)throw new TypeError("Finishers must return a constructor.");e=o}}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 $(e){var t,i=O(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 o={kind:"field"===e.kind?"field":"method",key:i,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(o.decorators=e.decorators),"field"===e.kind&&(o.initializer=e.value),o}function A(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 I(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function T(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 O(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var o=i.call(e,t||"default");if("object"!=typeof o)return o;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 j(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,o=new Array(t);i<t;i++)o[i]=e[i];return o}function G(e,t,i){return(G="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var o=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=L(e)););return e}(e,t);if(o){var r=Object.getOwnPropertyDescriptor(o,t);return r.get?r.get.call(i):r.value}})(e,t,i||e)}function L(e){return(L=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}!function(e,t,i,o){var r=N();if(o)for(var s=0;s<o.length;s++)r=o[s](r);var a=t((function(e){r.initializeInstanceElements(e,n.elements)}),i),n=r.decorateClass(function(e){for(var t=[],i=function(e){return"method"===e.kind&&e.key===s.key&&e.placement===s.placement},o=0;o<e.length;o++){var r,s=e[o];if("method"===s.kind&&(r=t.find(i)))if(I(s.descriptor)||I(r.descriptor)){if(D(s)||D(r))throw new ReferenceError("Duplicated methods ("+s.key+") can't be decorated.");r.descriptor=s.descriptor}else{if(D(s)){if(D(r))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+s.key+").");r.decorators=s.decorators}A(s,r)}else t.push(s)}return t}(a.d.map($)),e);r.initializeClassElements(a.F,n.elements),r.runClassFinishers(a.F,n.finishers)}([(0,m.Mo)("zwave-node-config")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,m.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,m.Cb)()],key:"nodes",value:()=>[]},{kind:"field",decorators:[(0,m.Cb)()],key:"config",value:()=>[]},{kind:"field",decorators:[(0,m.Cb)()],key:"selectedNode",value:()=>-1},{kind:"field",decorators:[(0,m.SB)()],key:"_configItem",value:void 0},{kind:"field",decorators:[(0,m.SB)()],key:"_wakeupInput",value:()=>-1},{kind:"field",decorators:[(0,m.SB)()],key:"_selectedConfigParameter",value:()=>-1},{kind:"field",decorators:[(0,m.SB)()],key:"_selectedConfigValue",value:()=>-1},{kind:"method",key:"render",value:function(){return f.dy`
<div class="content">
<ha-card
.header=${this.hass.localize("ui.panel.config.zwave.node_config.header")}
>
${"wake_up_interval"in this.nodes[this.selectedNode].attributes?f.dy`
<div class="card-actions">
<paper-input
.floatLabel="${this.hass.localize("ui.panel.config.zwave.common.wakeup_interval")}"
type="number"
.value=${-1!==this._wakeupInput?this._wakeupInput:this.hass.localize("ui.panel.config.zwave.common.unknown")}
@value-changed=${this._onWakeupIntervalChanged}
.placeholder=${this.nodes[this.selectedNode].attributes.wake_up_interval?this.nodes[this.selectedNode].attributes.wake_up_interval:this.hass.localize("ui.panel.config.zwave.common.unknown")}
>
<div suffix>
${this.hass.localize("ui.panel.config.zwave.node_config.seconds")}
</div>
</paper-input>
<ha-call-service-button
.hass=${this.hass}
domain="zwave"
service="set_wakeup"
.serviceData=${this._computeWakeupServiceData(this._wakeupInput)}
>
${this.hass.localize("ui.panel.config.zwave.node_config.set_wakeup")}
</ha-call-service-button>
</div>
`:""}
<div class="device-picker">
<paper-dropdown-menu
.label=${this.hass.localize("ui.panel.config.zwave.node_config.config_parameter")}
dynamic-align
class="flex"
>
<paper-listbox
slot="dropdown-content"
.selected=${this._selectedConfigParameter}
@iron-select=${this._selectedConfigParameterChanged}
>
${this.config.map((e=>f.dy`
<paper-item>
${e.key}: ${e.value.label}
</paper-item>
`))}
</paper-listbox>
</paper-dropdown-menu>
</div>
${this._configItem?f.dy`
${"List"===this._configItem.value.type?f.dy`
<div class="device-picker">
<paper-dropdown-menu
.label=${this.hass.localize("ui.panel.config.zwave.node_config.config_value")}
dynamic-align
class="flex"
.placeholder=${this._configItem.value.data}
>
<paper-listbox
slot="dropdown-content"
.selected=${this._configItem.value.data}
@iron-select=${this._configValueSelectChanged}
>
${this._configItem.value.data_items.map((e=>f.dy`
<paper-item>${e}</paper-item>
`))}
</paper-listbox>
</paper-dropdown-menu>
</div>
`:""}
${["Byte","Short","Int"].includes(this._configItem.value.type)?f.dy`
<div class="card-actions">
<paper-input
.label=${this._configItem.value.data_items}
type="number"
.value=${this._configItem.value.data}
.max=${this._configItem.value.max}
.min=${this._configItem.value.min}
@value-changed=${this._configValueInputChanged}
>
</paper-input>
</div>
`:""}
${["Bool","Button"].includes(this._configItem.value.type)?f.dy`
<div class="device-picker">
<paper-dropdown-menu
.label=${this.hass.localize("ui.panel.config.zwave.node_config.config_value")}
class="flex"
dynamic-align
.placeholder=${this._configItem.value.data}
>
<paper-listbox
slot="dropdown-content"
.selected=${this._configItem.value.data}
@iron-select=${this._configValueSelectChanged}
>
<paper-item>
${this.hass.localize("ui.panel.config.zwave.node_config.true")}
</paper-item>
<paper-item>
${this.hass.localize("ui.panel.config.zwave.node_config.false")}
</paper-item>
</paper-listbox>
</paper-dropdown-menu>
</div>
`:""}
<div class="help-text">
<span>${this._configItem.