From e635f91eb380c2a028924fc91c26093d848284dd Mon Sep 17 00:00:00 2001 From: t0bst4r Date: Wed, 6 Nov 2024 20:01:15 +0100 Subject: [PATCH] fix: add silly logs for entity exclusion related to #40 --- .../src/home-assistant/home-assistant-client.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/backend/src/home-assistant/home-assistant-client.ts b/packages/backend/src/home-assistant/home-assistant-client.ts index 99ded93..73d3b68 100644 --- a/packages/backend/src/home-assistant/home-assistant-client.ts +++ b/packages/backend/src/home-assistant/home-assistant-client.ts @@ -88,10 +88,18 @@ export class HomeAssistantClient if (!this._registry) { throw new Error("Home Assistant Client is not yet initialized"); } - return _.pickBy( - this._registry, - (r) => isValidEntity(r) && matchEntityFilter(r, filter), - ); + return _.pickBy(this._registry, (r) => { + const isValid = isValidEntity(r); + if (!isValid) { + this.log.silly( + "Entity '%s' is excluded. Disabled by: %s, hidden by: %s", + r.entity_id, + r.disabled_by, + r.hidden_by, + ); + } + return isValid && matchEntityFilter(r, filter); + }); } initialStates(entityIds: string[]): Dictionary {