Skip to content

Commit

Permalink
Use single category 'system' instead of 'config' and 'diagnostic'
Browse files Browse the repository at this point in the history
  • Loading branch information
slugzero committed Jan 5, 2024
1 parent eff7dd6 commit 416dd9c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/extension/homeassistant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1039,12 +1039,11 @@ export default class HomeAssistant extends Extension {
throw new Error(`Unsupported exposes type: '${firstExpose.type}'`);
}

// Exposes with category 'config' or 'diagnostic' are always added to the respective category.
// Exposes with category 'system' are added to entity categories 'config' or 'diagnostic' acccording to their access rights.
// This takes precedence over definitions in this file.
if(firstExpose.category === 'config') {
discoveryEntries.forEach((d) => d.discovery_payload.entity_category = 'config');
} else if(firstExpose.category === 'diagnostic') {
discoveryEntries.forEach((d) => d.discovery_payload.entity_category = 'diagnostic');
if(firstExpose.category === 'system') {
const category = firstExpose.access & ACCESS_SET ? 'config' : 'diagnostic';
discoveryEntries.forEach((d) => d.discovery_payload.entity_category = category);
}

discoveryEntries.forEach((d) => {
Expand Down

0 comments on commit 416dd9c

Please sign in to comment.