Skip to content

Commit

Permalink
Add exposes starting with 'config' or 'diagnosticÃ' to respective Hom…
Browse files Browse the repository at this point in the history
…e Assistant categories
  • Loading branch information
slugzero committed Jan 1, 2024
1 parent 84387b2 commit fff565a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/extension/homeassistant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,13 @@ export default class HomeAssistant extends Extension {
throw new Error(`Unsupported exposes type: '${firstExpose.type}'`);
}

// Exposes which start with 'config' or 'diagnostic' are always added to the respective category
if(firstExpose.name?.startsWith('config_')) {
discoveryEntries.forEach((d) => d.discovery_payload.entity_category = 'config');
} else if(firstExpose.name?.startsWith('diagnostic_')) {
discoveryEntries.forEach((d) => d.discovery_payload.entity_category = 'diagnostic');
}

discoveryEntries.forEach((d) => {
// If a sensor has entity category `config`, then change
// it to `diagnostic`. Sensors have no input, so can't be configured.
Expand Down

0 comments on commit fff565a

Please sign in to comment.