device editor working with special caps

This commit is contained in:
ari committed 2022-06-18 23:23:08 -04:00
1 parent debe48f2b4
commit 1496bc66ad
7 files changed
+233 -34

No files matched your search

+11 -7
View File
@@ -31,12 +31,16 @@ export const useHAEntities = () => {
}
let state: Set<string> = new Set();
entityIds.forEach((entityId) => {
if (!attribute) {
state.add(entities.collection.state[entityId].state);
} else {
const val = entities.collection.state[entityId].attributes[attribute];
if (val) {
state.add(val);
if (entities.collection.state[entityId]) {
if (!attribute) {
state.add(entities.collection.state[entityId].state);
} else {
const val = (entities.collection.state[entityId]?.attributes ?? {})[
attribute
];
if (val) {
state.add(val);
}
}
}
});
@@ -55,7 +59,7 @@ export const useHAEntities = () => {
let attributes: Set<string> = new Set();
entityIds.forEach((entityId) => {
const thisAttrs = new Set(
Object.keys(entities.collection.state[entityId].attributes)
Object.keys(entities.collection.state[entityId]?.attributes ?? {})
);
if (attributes.size === 0) {
attributes = thisAttrs;