iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1,149 lines • 86.7 kB
JavaScript
/*! For license information please see chunk.8e0b06b0bfe2dbbf6984.js.LICENSE.txt */
(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([[9343],{39841:(e,t,i)=>{"use strict";i(43437),i(65660);var o=i(9672),s=i(87156),r=i(50856),a=i(44181);(0,o.k)({_template:r.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,s.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="")}}})},60458:(e,t,i)=>{"use strict";var o=i(15652),s=i(47181);i(98762);class r extends o.oi{render(){return o.dy`
<ha-progress-button
.progress="${this.progress}"
@click="${this._buttonTapped}"
?disabled="${this.disabled}"
><slot></slot
></ha-progress-button>
`}constructor(){super(),this.method="POST",this.data={},this.disabled=!1,this.progress=!1}static get properties(){return{hass:{},progress:Boolean,path:String,method:String,data:{},disabled:Boolean}}get progressButton(){return this.renderRoot.querySelector("ha-progress-button")}async _buttonTapped(){this.progress=!0;const e={method:this.method,path:this.path,data:this.data};try{const t=await this.hass.callApi(this.method,this.path,this.data);this.progress=!1,this.progressButton.actionSuccess(),e.success=!0,e.response=t}catch(t){this.progress=!1,this.progressButton.actionError(),e.success=!1,e.response=t}(0,s.B)(this,"hass-api-called",e)}}customElements.define("ha-call-api-button",r)},26765:(e,t,i)=>{"use strict";i.d(t,{Ys:()=>a,g7:()=>n,D9:()=>l});var o=i(47181);const s=()=>Promise.all([i.e(8941),i.e(879),i.e(6372),i.e(6547),i.e(6509),i.e(7230)]).then(i.bind(i,1281)),r=(e,t,i)=>new Promise((r=>{const a=t.cancel,n=t.confirm;(0,o.B)(e,"show-dialog",{dialogTag:"dialog-box",dialogImport:s,dialogParams:{...t,...i,cancel:()=>{r(!!(null==i?void 0:i.prompt)&&null),a&&a()},confirm:e=>{r(!(null==i?void 0:i.prompt)||e),n&&n(e)}}})})),a=(e,t)=>r(e,t),n=(e,t)=>r(e,t,{confirmation:!0}),l=(e,t)=>r(e,t,{prompt:!0})},27849:(e,t,i)=>{"use strict";i(39841);var o=i(50856);i(28426);class s 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",s)},62127:(e,t,i)=>{"use strict";i.r(t);i(53268),i(12730),i(8878),i(10983),i(30879),i(53973),i(51095);var o=i(50856),s=i(28426),r=i(22311),a=i(91741),n=i(47266),l=(i(54909),i(22098),i(48932),i(2315),i(67102),i(27849),i(11052)),c=i(1265);i(3426),i(88165),i(40138);class d extends((0,c.Z)(s.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],s=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}}),!s)return`Unknown Node (${i}: (${o} ? ${i}.${o} : ${i}))`;let r=this._computeSelectCaption(s);return o&&(r+="/ Instance: "+o),r})):["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 h=!1;class u extends((0,c.Z)((0,l.I)(s.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(),h||(h=!0,this.fire("register-dialog",{dialogShowEvent:"show-ozwlog-dialog",dialogTag:"zwave-log-dialog",dialogImport:()=>i.e(2794).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",u);var f=i(15652);i(60458),i(31206),i(16509);var m=i(11654),v=i(27322);function g(){g=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 s=t.placement;if(t.kind===o&&("static"===s||"prototype"===s)){var r="static"===s?e:i;this.defineClassElement(r,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=[],s={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,s)}),this),e.forEach((function(e){if(!w(e))return i.push(e);var t=this.decorateElement(e,s);i.push(t.element),i.push.apply(i,t.extras),o.push.apply(o,t.finishers)}),this),!t)return{elements:i,finishers:o};var r=this.decorateConstructor(i,t);return o.push.apply(o,r.finishers),r.finishers=o,r},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=[],s=e.decorators,r=s.length-1;r>=0;r--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var n=this.fromElementDescriptor(e),l=this.toElementFinisherExtras((0,s[r])(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 s=this.fromClassDescriptor(e),r=this.toClassDescriptor((0,t[o])(s)||s);if(void 0!==r.finisher&&i.push(r.finisher),void 0!==r.elements){e=r.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&&Symbol.iterator in Object(e))return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return x(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)?x(e,t):void 0}}(t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).map((function(e){var t=this.toElementDescriptor(e);return this.disallowProperty(e,"finisher","An element descriptor"),this.disallowProperty(e,"extras","An element descriptor"),t}),this)},toElementDescriptor:function(e){var t=String(e.kind);if("method"!==t&&"field"!==t)throw new TypeError('An element descriptor\'s .kind property must be either "method" or "field", but a decorator created an element descriptor with .kind "'+t+'"');var i=z(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 s=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var r={kind:t,key:i,placement:o,descriptor:Object.assign({},s)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(s,"get","The property descriptor of a field descriptor"),this.disallowProperty(s,"set","The property descriptor of a field descriptor"),this.disallowProperty(s,"value","The property descriptor of a field descriptor"),r.initializer=e.initializer),r},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:k(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=k(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 y(e){var t,i=z(e.key);"method"===e.kind?t={value:e.value,writable:!0,configurable:!0,enumerable:!1}:"get"===e.kind?t={get:e.value,configurable:!0,enumerable:!1}:"set"===e.kind?t={set:e.value,configurable:!0,enumerable:!1}:"field"===e.kind&&(t={configurable:!0,writable:!0,enumerable:!0});var 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 _(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function w(e){return e.decorators&&e.decorators.length}function b(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function k(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 z(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 x(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 C(e,t,i){return(C="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=E(e)););return e}(e,t);if(o){var s=Object.getOwnPropertyDescriptor(o,t);return s.get?s.get.call(i):s.value}})(e,t,i||e)}function E(e){return(E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}!function(e,t,i,o){var s=g();if(o)for(var r=0;r<o.length;r++)s=o[r](s);var a=t((function(e){s.initializeInstanceElements(e,n.elements)}),i),n=s.decorateClass(function(e){for(var t=[],i=function(e){return"method"===e.kind&&e.key===r.key&&e.placement===r.placement},o=0;o<e.length;o++){var s,r=e[o];if("method"===r.kind&&(s=t.find(i)))if(b(r.descriptor)||b(s.descriptor)){if(w(r)||w(s))throw new ReferenceError("Duplicated methods ("+r.key+") can't be decorated.");s.descriptor=r.descriptor}else{if(w(r)){if(w(s))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+r.key+").");s.decorators=r.decorators}_(r,s)}else t.push(r)}return t}(a.d.map(y)),e);s.initializeClassElements(a.F,n.elements),s.runClassFinishers(a.F,n.finishers)}([(0,f.Mo)("zwave-network")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,f.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,f.Cb)()],key:"isWide",value:void 0},{kind:"field",decorators:[(0,f.sz)()],key:"_showHelp",value:()=>!1},{kind:"field",decorators:[(0,f.sz)()],key:"_networkStatus",value:void 0},{kind:"field",decorators:[(0,f.sz)()],key:"_unsubs",value:()=>[]},{kind:"method",key:"disconnectedCallback",value:function(){this._unsubscribe()}},{kind:"method",key:"firstUpdated",value:function(e){C(E(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,v.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">
${0===this._networkStatus.state?f.dy`
<ha-icon icon="hass:close"></ha-icon>
${this.hass.localize("ui.panel.config.zwave.network_status.network_stopped")}
`:5===this._networkStatus.state?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>
`:7===this._networkStatus.state?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>
`:10===this._networkStatus.state?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>=7?f.dy`
${this._generateServiceButton("stop_network")}
${this._generateServiceButton("heal_network")}
${this._generateServiceButton("test_network")}
`:f.dy` ${this._generateServiceButton("start_network")} `}
</div>
${this._networkStatus.state>=7?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>=7?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(){var e;this._networkStatus=await(e=this.hass,e.callWS({type:"zwave/network_status"}))}},{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[m.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 S(){S=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 s=t.placement;if(t.kind===o&&("static"===s||"prototype"===s)){var r="static"===s?e:i;this.defineClassElement(r,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=[],s={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,s)}),this),e.forEach((function(e){if(!A(e))return i.push(e);var t=this.decorateElement(e,s);i.push(t.element),i.push.apply(i,t.extras),o.push.apply(o,t.finishers)}),this),!t)return{elements:i,finishers:o};var r=this.decorateConstructor(i,t);return o.push.apply(o,r.finishers),r.finishers=o,r},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=[],s=e.decorators,r=s.length-1;r>=0;r--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var n=this.fromElementDescriptor(e),l=this.toElementFinisherExtras((0,s[r])(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 s=this.fromClassDescriptor(e),r=this.toClassDescriptor((0,t[o])(s)||s);if(void 0!==r.finisher&&i.push(r.finisher),void 0!==r.elements){e=r.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&&Symbol.iterator in Object(e))return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return T(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)?T(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=I(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 s=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var r={kind:t,key:i,placement:o,descriptor:Object.assign({},s)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(s,"get","The property descriptor of a field descriptor"),this.disallowProperty(s,"set","The property descriptor of a field descriptor"),this.disallowProperty(s,"value","The property descriptor of a field descriptor"),r.initializer=e.initializer),r},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:D(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=D(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 P(e){var t,i=I(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 N(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function A(e){return e.decorators&&e.decorators.length}function $(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function D(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 I(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 T(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 O(e,t,i){return(O="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=j(e)););return e}(e,t);if(o){var s=Object.getOwnPropertyDescriptor(o,t);return s.get?s.get.call(i):s.value}})(e,t,i||e)}function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}!function(e,t,i,o){var s=S();if(o)for(var r=0;r<o.length;r++)s=o[r](s);var a=t((function(e){s.initializeInstanceElements(e,n.elements)}),i),n=s.decorateClass(function(e){for(var t=[],i=function(e){return"method"===e.kind&&e.key===r.key&&e.placement===r.placement},o=0;o<e.length;o++){var s,r=e[o];if("method"===r.kind&&(s=t.find(i)))if($(r.descriptor)||$(s.descriptor)){if(A(r)||A(s))throw new ReferenceError("Duplicated methods ("+r.key+") can't be decorated.");s.descriptor=r.descriptor}else{if(A(r)){if(A(s))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+r.key+").");s.decorators=r.decorators}N(r,s)}else t.push(r)}return t}(a.d.map(P)),e);s.initializeClassElements(a.F,n.elements),s.runClassFinishers(a.F,n.finishers)}([(0,f.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,f.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,f.Cb)()],key:"nodes",value:()=>[]},{kind:"field",decorators:[(0,f.Cb)()],key:"config",value:()=>[]},{kind:"field",decorators:[(0,f.Cb)()],key:"selectedNode",value:()=>-1},{kind:"field",decorators:[(0,f.sz)()],key:"_configItem",value:void 0},{kind:"field",decorators:[(0,f.sz)()],key:"_wakeupInput",value:()=>-1},{kind:"field",decorators:[(0,f.sz)()],key:"_selectedConfigParameter",value:()=>-1},{kind:"field",decorators:[(0,f.sz)()],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.value.help}</span>
</div>
${["Bool","Button","Byte","Short","Int","List"].includes(this._configItem.value.type)?f.dy`
<div class="card-actions">
<ha-call-service-button
.hass=${this.hass}
domain="zwave"
service="set_config_parameter"
.serviceData=${this._computeSetConfigParameterServiceData()}
>
${this.hass.localize("ui.panel.config.zwave.node_config.set_config_parameter")}
</ha-call-service-button>
</div>
`:""}
`:""}
</ha-card>
</div>
`}},{kind:"get",static:!0,key:"styles",value:function(){return[m.Qx,f.iv`
.content {
margin-top: 24px;
}
ha-card {
margin: 0 auto;
max-width: 600px;
}
.device-picker {
@apply --layout-horizontal;
@apply --layout-center-center;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-ms-flex-direction: row;
-webkit-flex-direction: row;
flex-direction: row;
-ms-flex-align: center;
-webkit-align-items: center;
align-items: center;
padding-left: 24px;
padding-right: 24px;
padding-bottom: 24px;
}
.help-text {
padding-left: 24px;
padding-right: 24px;
}
.flex {
-ms-flex: 1 1 0.000000001px;
-webkit-flex: 1;
flex: 1;
-webkit-flex-basis: 0.000000001px;
flex-basis: 0.000000001px;
}
`]}},{kind:"method",key:"firstUpdated",value:function(e){O(j(i.prototype),"firstUpdated",this).call(this,e),this.addEventListener("hass-service-called",(e=>this.serviceCalled(e)))}},{kind:"method",key:"updated",value:function(e){O(j(i.prototype),"updated",this).call(this,e),e.has("selectedNode")&&this._nodesChanged()}},{kind:"method",key:"serviceCalled",value:function(e){e.detail.success&&setTimeout((()=>{this._refreshConfig(this.selectedNode)}),5e3)}},{kind:"method",key:"_nodesChanged",value:function(){this.nodes&&(this._configItem=void 0,this._wakeupInput=this.nodes[this.selectedNode].attributes.wake_up_interval||-1)}},{kind:"method",key:"_onWakeupIntervalChanged",value:function(e){this._wakeupInput=e.detail.value}},{kind:"method",key:"_computeWakeupServiceData",value:function(e){return{node_id:this.nodes[this.selectedNode].attributes.node_id,value:e}}},{kind:"method",key:"_computeSetConfigParameterServiceData",value:function(){if(-1===this.selectedNode||void 0===this._configItem)return!1;let e="";return["Short","Byte","Int"].includes(this._configItem.value.type)&&(e="string"==typeof this._selectedConfigValue?parseInt(this._selectedConfigValue,10):this._selectedConfigValue),["Bool","Button","List"].includes(this._configItem.value.type)&&(e=this._selectedConfigValue),{node_id:this.nodes[this.selectedNode].attributes.node_id,parameter:this._configItem.key,value:e}}},{kind:"method",key:"_selectedConfigParameterChanged",value:function(e){-1!==e.target.selected&&(this._selectedConfigParameter=e.target.selected,this._configItem=this.config[e.target.selected])}},{kind:"method",key:"_configValueSelectChanged",value:function(e){-1!==e.target.selected&&(this._selectedConfigValue=e.target.selectedItem.textContent)}},{kind:"method",key:"_configValueInputChanged",value:function(e){this._selectedConfigValue=e.detail.value}},{kind:"method",key:"_refreshConfig",value:async function(e){const t=[],i=await(o=this.hass,s=this.nodes[e].attributes.node_id,o.callApi("GET","zwave/config/"+s));var o,s;Object.keys(i).forEach((e=>{t.push({key:parseInt(e,10),value:i[e]})})),this.config=t,this._configItem=this.config[this._selectedConfigParameter]}}]}}),f.oi);class G extends((0,c.Z)(s.H3)){static get template(){return o.d`
<style include="iron-flex ha-style">
.card-actions.warning ha-call-api-button {
color: var(--error-color);
}
.content {
margin-top: 24px;
}
ha-card {
margin: 0 auto;
max-width: 600px;
}
.device-picker {
@apply --layout-horizontal;
@apply --layout-center-center;
padding: 0 24px 24px 24px;
}
</style>
<div class="content">
<ha-card header="[[localize('ui.panel.config.zwave.node_management.node_protection')]]">
<div class="device-picker">
<paper-dropdown-menu label="[[localize('ui.panel.config.zwave.node_management.protection')]]" dynamic-align class="flex" placeholder="{{_loadedProtectionValue}}">
<paper-listbox slot="dropdown-content" selected="{{_selectedProtectionParameter}}">
<template is="dom-repeat" items="[[_protectionOptions]]" as="state">
<paper-item>[[state]]</paper-item>
</template>
</paper-listbox>
</paper-dropdown-menu>
</div>
<div class="card-actions">
<ha-call-api-button
hass="[[hass]]"
path="[[_nodePath]]"
data="[[_protectionData]]">
[[localize('ui.panel.config.zwave.node_management.set_protection')]]
</ha-call-service-button>
</div>
</ha-card>
</div>
`}static get properties(){return{hass:Object,nodes:Array,selectedNode:{type:Number,value:-1},protectionNode:{type:Boolean,value:!1},_protectionValueID:{type:Number,value:-1},_selectedProtectionParameter:{type:Number,value:-1,observer:"_computeProtectionData"},_protectionOptions:Array,_protection:{type:Array,value:()=>[]},_loadedProtectionValue:{type:String,value:""},_protectionData:{type:Object,value:{}},_nodePath:String}}static get observers(){return["_nodesChanged(nodes, selectedNode)"]}ready(){super.ready(),this.addEventListener("hass-api-called",(e=>this.apiCalled(e)))}apiCalled(e){e.detail.success&&setTimeout((()=>{this._refreshProtection(this.selectedNode)}),5e3)}_nodesChanged(){if(this.nodes&&this.protection){if(0===this.protection.length)return;this.setProperties({protectionNode:!0,_protectionOptions:this.protection[0].value,_loadedProtectionValue:this.protection[1].value,_protectionValueID:this.protection[2].value})}}async _refreshProtection(e){const t=[],i=await this.hass.callApi("GET","zwave/protection/"+this.nodes[e].attributes.node_id);Object.keys(i).forEach((e=>{t.push({key:e,value:i[e]})})),this.setProperties({_protection:t,_selectedProtectionParameter:-1,_loadedProtectionValue:this.protection[1].value})}_computeProtectionData(e){-1!==this.selectedNode&&-1!==e&&(this._protectionData={selection:this._protectionOptions[e],value_id:this._protectionValueID},this._nodePath="zwave/protection/"+this.nodes[this.selectedNode].attributes.node_id)}}customElements.define("zwave-node-protection",G);class L extends s.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;
}
pre {
font-family: var(--code-font-family, monospace);
}
</style>
<div class="content">
<ha-card header="Node user codes">
<div class="device-picker">
<paper-dropdown-menu
label="Code slot"
dynamic-align=""
class="flex"
>
<paper-listbox
slot="dropdown-content"
selected="{{_selectedUserCode}}"
>
<template is="dom-repeat" items="[[userCodes]]" as="state">
<paper-item
>[[_computeSelectCaptionUserCodes(state)]]</paper-item
>
</template>
</paper-listbox>
</paper-dropdown-menu>
</div>
<template is="dom-if" if="[[_isUserCodeSelected(_selectedUserCode)]]">
<div class="card-actions">
<paper-input
label="User code"
type="text"
allowed-pattern="[0-9,a-f,x,\\\\]"
maxlength="40"
minlength="16"
value="{{_selectedUserCodeValue}}"
>
</paper-input>
<pre>Ascii: [[_computedCodeOutput]]</pre>
</div>
<div class="card-actions">
<ha-call-service-button
hass="[[hass]]"
domain="lock"
service="set_usercode"
service-data='[[_computeUserCodeServiceData(_selectedUserCodeValue, "Add")]]'
>
Set Usercode
</ha-call-service-button>
<ha-call-service-button
hass="[[hass]]"
domain="lock"
service="clear_usercode"
service-data='[[_computeUserCodeServiceData(_selectedUserCode, "Delete")]]'
>
Delete Usercode
</ha-call-service-button>
</div>
</template>
</ha-card>
</div>
`}static get properties(){return{hass:Object,nodes:Array,selectedNode:{type:Number,observer:"_selectedNodeChanged"},userCodes:Object,_selectedUserCode:{type:Number,value:-1,observer:"_selectedUserCodeChanged"},_selectedUserCodeValue:String,_computedCodeOutput:{type:String,value:""}}}ready(){super.ready(),this.addEventListener("hass-service-called",(e=>this.serviceCalled(e)))}serviceCalled(e){e.detail.success&&setTimeout((()=>{this._refreshUserCodes(this.selectedNode)}),5e3)}_isUserCodeSelected(e){return-1!==e}_computeSelectCaptionUserCodes(e){return`${e.key}: ${e.value.label}`}_selectedUserCodeChanged(e){if(-1===this._selectedUserCode||-1===e)return;const t=this.userCodes[e].value.code;this.setProperties({_selectedUserCodeValue:this._a2hex(t),_computedCodeOutput:`[${this._hex2a(this._a2hex(t))}]`})}_computeUserCodeServiceData(e,t){if(-1===this.selectedNode||!e)return-1;let i=null,o=null;return"Add"===t&&(o=this._hex2a(e),this._computedCodeOutput=`[${o}]`,i={node_id:this.nodes[this.selectedNode].attributes.node_id,code_slot:this._selectedUserCode,usercode:o}),"Delete"===t&&(i={node_id:this.nodes[this.selectedNode].attributes.node_id,code_slot:this._selectedUserCode}),i}async _refreshUserCodes(e){this.setProperties({_selectedUserCodeValue:""});const t=[],i=await this.hass.callApi("GET","zwave/usercodes/"+this.nodes[e].attributes.node_id);Object.keys(i).forEach((e=>{t.push({key:e,value:i[e]})})),this.setProperties({userCodes:t}),this._selectedUserCodeChanged(this._selectedUserCode)}_a2hex(e){const t=[];let i="";for(let o=0,s=e.length;o<s;o++){const s=Number(e.charCodeAt(o)).toString(16);i="0"===s?"00":s,t.push("\\x"+i)}return t.join("")}_hex2a(e){const t=e.toString().replace(/\\x/g,"");let i="";for(let o=0;o<t.length;o+=2)i+=String.fromCharCode(parseInt(t.substr(o,2),16));return i}_selectedNodeChanged(){-1!==this.selectedNode&&this.setProperties({_selecteduserCode:-1})}}function B(){B=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 s=t.placement;if(t.kind===o&&("static"===s||"prototype"===s)){var r="static"===s?e:i;this.defineClassElement(r,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=[],s={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,s)}),this),e.forEach((function(e){if(!F(e))return i.push(e);var t=this.decorateElement(e,s);i.push(t.element),i.push.apply(i,t.extras),o.push.apply(o,t.finishers)}),this),!t)return{elements:i,finishers:o};var r=this.decorateConstructor(i,t);return o.push.apply(o,r.finishers),r.finishers=o,r},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=[],s=e.decorators,r=s.length-1;r>=0;r--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var n=this.fromElementDescriptor(e),l=this.toElementFinisherExtras((0,s[r])(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 s=this.fromClassDescriptor(e),r=this.toClassDescriptor((0,t[o])(s)||s);if(void 0!==r.finisher&&i.push(r.finisher),void 0!==r.elements){e=r.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&&Symbol.iterator in Object(e))return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return M(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)?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 i=W(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 s=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var r={kind:t,key:i,placement:o,descriptor:Object.assign({},s)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(s,"get","The property descriptor of a field descriptor"),this.disallowProperty(s,"set","The property descriptor of a field descriptor"),this.disallowProperty(s,"value","The property descriptor of a field descriptor"),r.initializer=e.initializer),r},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:R(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=R(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 U(e){var t,i=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 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 H(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 V(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function R(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 W(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 M(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}customElements.define("zwave-usercodes",L);!function(e,t,i,o){var s=B();if(o)for(var r=0;r<o.length;r++)s=o[r](s);var a=t((function(e){s.initializeInstanceElements(e,n.elements)}),i),n=s.decorateClass(function(e){for(var t=[],i=function(e){return"method"===e.kind&&e.key===r.key&&e.placement===r.placement},o=0;o<e.length;o++){var s,r=e[o];if("method"===r.kind&&(s=t.find(i)))if(V(r.descriptor)||V(s.descriptor)){if(F(r)||F(s))throw new ReferenceError("Duplicated methods ("+r.key+") can't be decorated.");s.descriptor=r.descriptor}else{if(F(r)){if(F(s))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+r.key+").");s.decorators=r.decorators}H(r,s)}else t.push(r)}return t}(a.d.map(U)),e);s.initializeClassElements(a.F,n.elements),s.runClassFinishers(a.F,n.finishers)}([(0,f.Mo)("zwave-values")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,f.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,f.Cb)()],key:"values",value:()=>[]},{kind:"field",decorators:[(0,f.sz)()],key:"_selectedValue",value:()=>-1},{kind:"method",key:"render",value:function(){return f.dy`
<div class="content">
<ha-card
.header=${this.hass.localize("ui.panel.config.zwave.values.header")}
>
<div class="device-picker">
<paper-dropdown-menu
.label=${this.hass.localize("ui.panel.config.zwave.common.value")}
dynamic-align
class="flex"
>
<paper-listbox
slot="dropdown-content"
.selected=${this._selectedValue}
>
${this.values.map((e=>f.dy`
<paper-item>
${this._computeCaption(e)}
</paper-item>
`))}
</paper-listbox>
</paper-dropdown-menu>
</div>
</ha-card>
</div>
`}},{kind:"get",static:!0,key:"styles",value:function(){return[m.Qx,f.iv`
.content {
margin-top: 24px;
}
ha-card {
margin: 0 auto;
max-width: 600px;
}
.device-picker {
@apply --layout-horizontal;
@apply --layout-center-center;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-ms-flex-direction: row;
-webkit-flex-direction: row;
flex-direction: row;
-ms-flex-align: center;
-webkit-align-items: center;
align-items: center;
padding-left: 24px;
padding-right: 24px;
padding-bottom: 24px;
}
.flex {
-ms-flex: 1 1 0.000000001px;
-webkit-flex: 1;
flex: 1;
-webkit-flex-basis: 0.000000001px;
flex-basis: 0.000000001px;
}
.help-text {
padding-left: 24px;
padding-right: 24px;
}
`]}},{kind:"method",key:"_computeCaption",value:function(e){let t=""+e.value.label;return t+=` (${this.hass.localize("ui.panel.config.zwave.common.instance")}:`,t+=` ${e.value.instance},`,t+=` ${this.hass.localize("ui.panel.config.zwave.common.index")}:`,t+=` ${e.value.index})`,t}}]}}),f.oi);class q extends((0,c.Z)((0,l.I)(s.H3))){static get template(){return o.d`
<style include="iron-flex ha-style ha-form-style">
app-toolbar {
border-bottom: 1px solid var(--divider-color);
}
.content {
margin-top: 24px;
}
.sectionHeader {
position: relative;
padding-right: 40px;
}
.node-info {
margin-left: 16px;
}
.help-text {
padding-left: 24px;
padding-right: 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;
}
ha-service-description {
display: block;
color: grey;
}
ha-service-description[hidden] {
display: none;
}
.toggle-help-icon {
position: absolute;
top: -6px;
right: 0;
color: var(--primary-color);
}
</style>
<ha-app-layout>
<app-header slot="header" fixed="">
<app-toolbar>
<ha-icon-button-arrow-prev
on-click="_backTapped"
></ha-icon-button-arrow-prev>
<div main-title="">
[[localize('component.zwave.title')]]
</div>
</app-toolbar>
</app-header>
<zwave-network
id="zwave-network"
is-wide="[[isWide]]"
hass="[[hass]]"
></zwave-network>
<!-- Node card -->
<ha-config-section is-wide="[[isWide]]">
<div class="sectionHeader" slot="header">
<span
>[[localize('ui.panel.config.zwave.node_management.header')]]</span
>
<ha-icon-button
class="toggle-help-icon"
on-click="toggleHelp"
icon="hass:help-circle"
></ha-icon-button>
</div>
<span slot="introduction">
[[localize('ui.panel.config.zwave.node_management.introduction')]]
</span>
<ha-card class="content">
<div class="device-picker">
<paper-dropdown-menu
dynamic-align=""
label="[[localize('ui.panel.config.zwave.node_management.nodes')]]"
class="flex"
>
<paper-listbox
slot="dropdown-content"
selected="{{selectedNode}}"
>
<template is="dom-repeat" items="[[nodes]]" as="state">
<paper-item>[[computeSelectCaption(state)]]</paper-item>
</template>
</paper-listbox>
</paper-dropdown-menu>
</div>
<template is="dom-if" if="[[!computeIsNodeSelected(selectedNode)]]">
<template is="dom-if" if="[[showHelp]]">
<div style="color: grey; padding: 12px">
[[localize('ui.panel.config.zwave.node_management.introduction')]]
</div>
</template>
</template>
<template is="dom-if" if="[[computeIsNodeSelected(selectedNode)]]">
<div class="card-actions">
<ha-call-service-button
hass="[[hass]]"
domain="zwave"
service="refresh_node"
service-data="[[computeNodeServiceData(selectedNode)]]"
>
[[localize('ui.panel.config.zwave.services.refresh_node')]]
</ha-call-service-button>
<ha-service-description
hass="[[hass]]"
domain="zwave"
service="refresh_node"
hidden$="[[!showHelp]]"
>
</ha-service-description>
<template is="dom-if" if="[[nodeFailed]]">
<ha-call-service-button
hass="[[hass]]"
domain="zwave"
service="remove_failed_node"
service-data="[[computeNodeServiceData(selectedNode)]]"
>
[[localize('ui.panel.config.zwave.services.remove_failed_node')]]
</ha-call-service-button>
<ha-service-description
hass="[[hass]]"
domain="zwave"
service="remove_failed_node"
hidden$="[[!showHelp]]"
>
</ha-service-description>
<ha-call-service-button
hass="[[hass]]"
domain="zwave"
service="replace_failed_node"
service-data="[[computeNodeServiceData(selectedNode)]]"
>
[[localize('ui.panel.config.zwave.services.replace_failed_node')]]
</ha-call-service-button>
<ha-service-description
hass="[[hass]]"
domain="zwave"
service="replace_failed_node"
hidden$="[[!showHelp]]"
>
</ha-service-description>
</template>
<ha-call-service-button
hass="[[hass]]"
domain="zwave"
service="print_node"
service-data="[[computeNodeServiceData(selectedNode)]]"
>
[[localize('ui.panel.config.zwave.services.print_node')]]
</ha-call-service-button>
<ha-service-description
hass="[[hass]]"
domain="zwave"
service="print_node"
hidden$="[[!showHelp]]"
>
</ha-service-description>
<ha-call-service-button
hass="[[hass]]"
domain="zwave"
service="heal_node"
service-data="[[computeHealNodeServiceData(selectedNode)]]"
>
[[localize('ui.panel.config.zwave.services.heal_node')]]
</ha-call-service-button>
<ha-service-description
hass="[[hass]]"
domain="zwave"
service="heal_node"
hidden$="[[!showHelp]]"
>
</ha-service-description>
<ha-call-service-button
hass="[[hass]]"
domain="zwave"
service="test_node"
service-data="[[computeNodeServiceData(selectedNode)]]"
>
[[localize('ui.panel.config.zwave.services.test_node')]]
</ha-call-service-button>
<ha-service-description
hass="[[hass]]"
domain="zwave"
service="test_node"
hidden$="[[!showHelp]]"
>
</ha-service-description>
<mwc-button on-click="_nodeMoreInfo"
>[[localize('ui.panel.config.zwave.services.node_info')]]</mwc-button
>
</div>
<div class="device-picker">
<paper-dropdown-menu
label="[[localize('ui.panel.config.zwave.node_management.entities')]]"
dynamic-align=""
class="flex"
>
<paper-listbox
slot="dropdown-content"
selected="{{selectedEntity}}"
>
<template is="dom-repeat" items="[[entities]]" as="state">
<paper-item>[[state.entity_id]]</paper-item>
</template>
</paper-listbox>
</paper-dropdown-menu>
</div>
<template
is="dom-if"
if="[[!computeIsEntitySelected(selectedEntity)]]"
>
<div class="card-actions">
<ha-call-service-button
hass="[[hass]]"
domain="zwave"
service="refresh_entity"
service-data="[[computeRefreshEntityServiceData(selectedEntity)]]"
>
[[localize('ui.panel.config.zwave.services.refresh_entity')]]
</ha-call-service-button>
<ha-service-description
hass="[[hass]]"
domain="zwave"
service="refresh_entity"
hidden$="[[!showHelp]]"
>
</ha-service-description>
<mwc-button on-click="_entityMoreInfo"
>[[localize('ui.panel.config.zwave.node_management.entity_info')]]</mwc-button
>
</div>
<div class="form-group">
<paper-checkbox
checked="{{entityIgnored}}"
class="form-control"
>
[[localize('ui.panel.config.zwave.node_management.exclude_entity')]]
</paper-checkbox>
<paper-input
disabled="{{entityIgnored}}"
label="[[localize('ui.panel.config.zwave.node_management.pooling_intensity')]]"
type="number"
min="0"
value="{{entityPollingIntensity}}"
>
</paper-input>
</div>
<div class="card-actions">
<ha-call-service-button
hass="[[hass]]"
domain="zwave"
service="set_poll_intensity"
service-data="[[computePollIntensityServiceData(entityPollingIntensity)]]"
>
[[localize('ui.common.save')]]
</ha-call-service-button>
</div>
</template>
</template>
</ha-card>
<template is="dom-if" if="[[computeIsNodeSelected(selectedNode)]]">
<!-- Value card -->
<zwave-values
hass="[[hass]]"
nodes="[[nodes]]"
selected-node="[[selectedNode]]"
values="[[values]]"
></zwave-values>
<!-- Group card -->
<zwave-groups
hass="[[hass]]"
nodes="[[nodes]]"
selected-node="[[selectedNode]]"
groups="[[groups]]"
></zwave-groups>
<!-- Config card -->
<zwave-node-config
hass="[[hass]]"
nodes="[[nodes]]"
selected-node="[[selectedNode]]"
config="[[config]]"
></zwave-node-config>
</template>
<!-- Protection card -->
<template is="dom-if" if="{{_protectionNode}}">
<zwave-node-protection
hass="[[hass]]"
nodes="[[nodes]]"
selected-node="[[selectedNode]]"
protection="[[_protection]]"
></zwave-node-protection>
</template>
<!-- User Codes -->
<template is="dom-if" if="{{hasNodeUserCodes}}">
<zwave-usercodes
id="zwave-usercodes"
hass="[[hass]]"
nodes="[[nodes]]"
user-codes="[[userCodes]]"
selected-node="[[selectedNode]]"
></zwave-usercodes>
</template>
</ha-config-section>
<!-- Ozw log -->
<ozw-log is-wide="[[isWide]]" hass="[[hass]]"></ozw-log>
</ha-app-layout>
`}static get properties(){return{hass:Object,isWide:Boolean,nodes:{type:Array,computed:"computeNodes(hass)"},selectedNode:{type:Number,value:-1,observer:"selectedNodeChanged"},nodeFailed:{type:Boolean,value:!1},config:{type:Array,value:()=>[]},entities:{type:Array,computed:"computeEntities(selectedNode)"},selectedEntity:{type:Number,value:-1,observer:"selectedEntityChanged"},values:{type:Array},groups:{type:Array},userCodes:{type:Array,value:()=>[]},hasNodeUserCodes:{type:Boolean,value:!1},showHelp:{type:Boolean,value:!1},entityIgnored:Boolean,entityPollingIntensity:{type:Number,value:0},_protection:{type:Array,value:()=>[]},_protectionNode:{type:Boolean,value:!1}}}ready(){super.ready(),this.addEventListener("hass-service-called",(e=>this.serviceCalled(e)))}serviceCalled(e){e.detail.success&&"set_poll_intensity"===e.detail.service&&this._saveEntity()}computeNodes(e){return Object.keys(e.states).map((t=>e.states[t])).filter((e=>e.entity_id.match("zwave[.]"))).sort(n.y)}computeEntities(e){if(!this.nodes||-1===e)return-1;const t=this.nodes[this.selectedNode].attributes.node_id,i=this.hass;return Object.keys(this.hass.states).map((e=>i.states[e])).filter((e=>void 0!==e.attributes.node_id&&("node_id"in e.attributes&&e.attributes.node_id===t&&!e.entity_id.match("zwave[.]")))).sort(n.y)}selectedNodeChanged(e){-1!==e&&(this.selectedEntity=-1,this.hass.callApi("GET","zwave/config/"+this.nodes[e].attributes.node_id).then((e=>{this.config=this._objToArray(e)})),this.hass.callApi("GET","zwave/values/"+this.nodes[e].attributes.node_id).then((e=>{this.values=this._objToArray(e)})),this.hass.callApi("GET","zwave/groups/"+this.nodes[e].attributes.node_id).then((e=>{this.groups=this._objToArray(e)})),this.hasNodeUserCodes=!1,this.notifyPath("hasNodeUserCodes"),this.hass.callApi("GET","zwave/usercodes/"+this.nodes[e].attributes.node_id).then((e=>{this.userCodes=this._objToArray(e),this.hasNodeUserCodes=this.userCodes.length>0,this.notifyPath("hasNodeUserCodes")})),this.hass.callApi("GET","zwave/protection/"+this.nodes[e].attributes.node_id).then((e=>{if(this._protection=this._objToArray(e),this._protection){if(0===this._protection.length)return;this._protectionNode=!0}})),this.nodeFailed=this.nodes[e].attributes.is_failed)}selectedEntityChanged(e){if(-1===e)return;this.hass.callApi("GET","zwave/values/"+this.nodes[this.selectedNode].attributes.node_id).then((e=>{this.values=this._objToArray(e)}));const t=this.entities[e].attributes.value_id,i=this.values.find((e=>e.key===t)),o=this.values.indexOf(i);this.hass.callApi("GET","config/zwave/device_config/"+this.entities[e].entity_id).then((e=>{this.setProperties({entityIgnored:e.ignored||!1,entityPollingIntensity:this.values[o].value.poll_intensity})})).catch((()=>{this.setProperties({entityIgnored:!1,entityPollingIntensity:this.values[o].value.poll_intensity})}))}computeSelectCaption(e){return(0,a.C)(e)+" (Node:"+e.attributes.node_id+" "+e.attributes.query_stage+")"}computeSelectCaptionEnt(e){return(0,r.N)(e)+"."+(0,a.C)(e)}computeIsNodeSelected(){return this.nodes&&-1!==this.selectedNode}computeIsEntitySelected(e){return-1===e}computeNodeServiceData(e){return{node_id:this.nodes[e].attributes.node_id}}computeHealNodeServiceData(e){return{node_id:this.nodes[e].attributes.node_id,return_routes:!0}}computeRefreshEntityServiceData(e){return-1===e?-1:{entity_id:this.entities[e].entity_id}}computePollIntensityServiceData(e){return-1===!this.selectedNode||-1===this.selectedEntity?-1:{node_id:this.nodes[this.selectedNode].attributes.node_id,value_id:this.entities[this.selectedEntity].attributes.value_id,poll_intensity:parseInt(e)}}_nodeMoreInfo(){this.fire("hass-more-info",{entityId:this.nodes[this.selectedNode].entity_id})}_entityMoreInfo(){this.fire("hass-more-info",{entityId:this.entities[this.selectedEntity].entity_id})}_saveEntity(){const e={ignored:this.entityIgnored,polling_intensity:parseInt(this.entityPollingIntensity)};return this.hass.callApi("POST","config/zwave/device_config/"+this.entities[this.selectedEntity].entity_id,e)}toggleHelp(){this.showHelp=!this.showHelp}_objToArray(e){const t=[];return Object.keys(e).forEach((i=>{t.push({key:i,value:e[i]})})),t}_backTapped(){history.back()}}customElements.define("ha-config-zwave",q)}}]);
//# sourceMappingURL=chunk.8e0b06b0bfe2dbbf6984.js.map