mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 19:56:42 +00:00
Allow for removal of broadcast node in UI (#2390)
* allow for removal of broadcast * prettier * prettier
This commit is contained in:
parent
adf0c6d891
commit
c2a57099d3
@ -108,6 +108,16 @@ class ZwaveGroups extends PolymerElement {
|
||||
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]]"
|
||||
>
|
||||
Remove Broadcast
|
||||
</ha-call-service-button>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
</paper-card>
|
||||
@ -165,6 +175,16 @@ class ZwaveGroups extends PolymerElement {
|
||||
type: String,
|
||||
value: "",
|
||||
},
|
||||
|
||||
_removeBroadcastNodeServiceData: {
|
||||
type: String,
|
||||
value: "",
|
||||
},
|
||||
|
||||
_isBroadcastNodeInGroup: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@ -201,6 +221,7 @@ class ZwaveGroups extends PolymerElement {
|
||||
|
||||
_computeOtherGroupNodes(selectedGroup) {
|
||||
if (selectedGroup === -1) return -1;
|
||||
this.setProperties({ _isBroadcastNodeInGroup: false });
|
||||
const associations = Object.values(
|
||||
this.groups[selectedGroup].value.association_instances
|
||||
);
|
||||
@ -212,6 +233,17 @@ class ZwaveGroups extends PolymerElement {
|
||||
const id = assoc[0];
|
||||
const instance = assoc[1];
|
||||
const node = this.nodes.find((n) => n.attributes.node_id === id);
|
||||
if (id === 255) {
|
||||
this.setProperties({
|
||||
_isBroadcastNodeInGroup: true,
|
||||
_removeBroadcastNodeServiceData: {
|
||||
node_id: this.nodes[this.selectedNode].attributes.node_id,
|
||||
association: "remove",
|
||||
target_node_id: 255,
|
||||
group: this.groups[selectedGroup].key,
|
||||
},
|
||||
});
|
||||
}
|
||||
if (!node) {
|
||||
return `Unknown Node (${id}: (${instance} ? ${id}.${instance} : ${id}))`;
|
||||
}
|
||||
@ -288,6 +320,7 @@ class ZwaveGroups extends PolymerElement {
|
||||
_otherGroupNodes: Object.values(
|
||||
groupData[this._selectedGroup].value.associations
|
||||
),
|
||||
_isBroadcastNodeInGroup: false,
|
||||
});
|
||||
const oldGroup = this._selectedGroup;
|
||||
this.setProperties({ _selectedGroup: -1 });
|
||||
|
Loading…
x
Reference in New Issue
Block a user