From cf6914ed498865ad6078d13114c9679a8a97a3e9 Mon Sep 17 00:00:00 2001 From: Adrian Jagielak Date: Thu, 24 Jul 2025 16:50:04 +0200 Subject: [PATCH] Override 'optimistic' for entities in demo mode --- futurehome/config.yaml | 2 +- futurehome/src/ha/publish_device.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/futurehome/config.yaml b/futurehome/config.yaml index e52c584..3c7b3cf 100644 --- a/futurehome/config.yaml +++ b/futurehome/config.yaml @@ -1,6 +1,6 @@ # https://developers.home-assistant.io/docs/add-ons/configuration#add-on-config name: Futurehome -version: "0.0.35" +version: "0.0.36" slug: futurehome description: Local Futurehome Smarthub integration url: "https://github.com/adrianjagielak/home-assistant-futurehome" diff --git a/futurehome/src/ha/publish_device.ts b/futurehome/src/ha/publish_device.ts index b33f3b5..e02399b 100644 --- a/futurehome/src/ha/publish_device.ts +++ b/futurehome/src/ha/publish_device.ts @@ -249,6 +249,15 @@ export function haPublishDevice(parameters: { Object.assign(handlers, result.commandHandlers); } + if (demoMode) { + // Apply optimistic override + for (const component of Object.values(components)) { + if ((component as any).optimistic === false) { + (component as any).optimistic = true; + } + } + } + const configTopic = `${topicPrefix}/config`; const stateTopic = `${topicPrefix}/state`; const availabilityTopic = `${topicPrefix}/availability`;