Skip to content

Commit

Permalink
Handle disabled entities in multi select label (#20371)
Browse files Browse the repository at this point in the history
  • Loading branch information
bramkragten authored Apr 3, 2024
1 parent 1a6d96c commit 3b5b3f3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/panels/config/entities/ha-config-entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1029,14 +1029,18 @@ ${
const action = ev.currentTarget.action;
const promises: Promise<UpdateEntityRegistryEntryResult>[] = [];
this._selected.forEach((entityId) => {
const entityReg =
this.hass.entities[entityId] ||
this._entities.find((entReg) => entReg.entity_id === entityId);
if (!entityReg) {
return;
}
promises.push(
updateEntityRegistryEntry(this.hass, entityId, {
labels:
action === "add"
? this.hass.entities[entityId].labels.concat(label)
: this.hass.entities[entityId].labels.filter(
(lbl) => lbl !== label
),
? entityReg.labels.concat(label)
: entityReg.labels.filter((lbl) => lbl !== label),
})
);
});
Expand Down

0 comments on commit 3b5b3f3

Please sign in to comment.