From e781be885d3695f088210a7592db603d06d2dbde Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 13 Apr 2023 10:56:52 +0200 Subject: [PATCH] Fix context provider not updated on initializing of hass object (#16159) --- src/state/context-mixin.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/state/context-mixin.ts b/src/state/context-mixin.ts index 9b8e2a8bb7..d3bbc3ead6 100644 --- a/src/state/context-mixin.ts +++ b/src/state/context-mixin.ts @@ -82,6 +82,15 @@ export const contextMixin = >( }), }; + protected hassConnected() { + super.hassConnected(); + for (const [key, value] of Object.entries(this.hass!)) { + if (key in this.__contextProviders) { + this.__contextProviders[key]!.setValue(value); + } + } + } + protected _updateHass(obj: Partial) { super._updateHass(obj); for (const [key, value] of Object.entries(obj)) {