From 416dd9c56815147c9af7eea8de282159f1f40937 Mon Sep 17 00:00:00 2001 From: slugzero <2014249+slugzero@users.noreply.github.com> Date: Fri, 5 Jan 2024 20:15:13 +0100 Subject: [PATCH] Use single category 'system' instead of 'config' and 'diagnostic' --- lib/extension/homeassistant.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/extension/homeassistant.ts b/lib/extension/homeassistant.ts index b6eb35f306..7f21e29816 100644 --- a/lib/extension/homeassistant.ts +++ b/lib/extension/homeassistant.ts @@ -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) => {