Skip to content

Commit

Permalink
Revert "Use single category 'system' instead of 'config' and 'diagnos…
Browse files Browse the repository at this point in the history
…tic'"

This reverts commit 416dd9c.
  • Loading branch information
slugzero committed Jan 7, 2024
1 parent 416dd9c commit 18c5d1a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/extension/homeassistant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1039,11 +1039,12 @@ export default class HomeAssistant extends Extension {
throw new Error(`Unsupported exposes type: '${firstExpose.type}'`);
}

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

Check failure on line 1044 in lib/extension/homeassistant.ts

View workflow job for this annotation

GitHub Actions / ci

Property 'category' does not exist on type 'Expose'.

Check failure on line 1044 in lib/extension/homeassistant.ts

View workflow job for this annotation

GitHub Actions / tests (ubuntu-latest, 18)

Property 'category' does not exist on type 'Expose'.

Check failure on line 1044 in lib/extension/homeassistant.ts

View workflow job for this annotation

GitHub Actions / tests (ubuntu-latest, 20)

Property 'category' does not exist on type 'Expose'.

Check failure on line 1044 in lib/extension/homeassistant.ts

View workflow job for this annotation

GitHub Actions / tests (macos-latest, 18)

Property 'category' does not exist on type 'Expose'.

Check failure on line 1044 in lib/extension/homeassistant.ts

View workflow job for this annotation

GitHub Actions / tests (macos-latest, 20)

Property 'category' does not exist on type 'Expose'.

Check failure on line 1044 in lib/extension/homeassistant.ts

View workflow job for this annotation

GitHub Actions / tests (windows-latest, 18)

Property 'category' does not exist on type 'Expose'.

Check failure on line 1044 in lib/extension/homeassistant.ts

View workflow job for this annotation

GitHub Actions / tests (windows-latest, 20)

Property 'category' does not exist on type 'Expose'.
discoveryEntries.forEach((d) => d.discovery_payload.entity_category = 'config');
} else if(firstExpose.category === 'diagnostic') {

Check failure on line 1046 in lib/extension/homeassistant.ts

View workflow job for this annotation

GitHub Actions / ci

Property 'category' does not exist on type 'Expose'.

Check failure on line 1046 in lib/extension/homeassistant.ts

View workflow job for this annotation

GitHub Actions / tests (ubuntu-latest, 18)

Property 'category' does not exist on type 'Expose'.

Check failure on line 1046 in lib/extension/homeassistant.ts

View workflow job for this annotation

GitHub Actions / tests (ubuntu-latest, 20)

Property 'category' does not exist on type 'Expose'.

Check failure on line 1046 in lib/extension/homeassistant.ts

View workflow job for this annotation

GitHub Actions / tests (macos-latest, 18)

Property 'category' does not exist on type 'Expose'.

Check failure on line 1046 in lib/extension/homeassistant.ts

View workflow job for this annotation

GitHub Actions / tests (macos-latest, 20)

Property 'category' does not exist on type 'Expose'.

Check failure on line 1046 in lib/extension/homeassistant.ts

View workflow job for this annotation

GitHub Actions / tests (windows-latest, 18)

Property 'category' does not exist on type 'Expose'.

Check failure on line 1046 in lib/extension/homeassistant.ts

View workflow job for this annotation

GitHub Actions / tests (windows-latest, 20)

Property 'category' does not exist on type 'Expose'.
discoveryEntries.forEach((d) => d.discovery_payload.entity_category = 'diagnostic');
}

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

0 comments on commit 18c5d1a

Please sign in to comment.