From 93be70cee5452d421c1a3b4d3cb0f29f77bdb211 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 21 May 2019 12:48:42 -0700 Subject: [PATCH 1/2] Listen for core config updated events --- lib/config.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/config.ts b/lib/config.ts index 8b3748ab..6574ddeb 100644 --- a/lib/config.ts +++ b/lib/config.ts @@ -23,10 +23,16 @@ function processComponentLoaded( const fetchConfig = (conn: Connection) => getConfig(conn); const subscribeUpdates = (conn: Connection, store: Store) => - conn.subscribeEvents( - store.action(processComponentLoaded), - "component_loaded" - ); + Promise.all([ + conn.subscribeEvents( + store.action(processComponentLoaded), + "component_loaded" + ), + conn.subscribeEvents( + () => fetchConfig(conn).then(config => store.setState(config, true)), + "core_config_updated" + ) + ]).then(unsubs => () => unsubs.forEach(unsub => unsub())); const configColl = (conn: Connection) => getCollection(conn, "_cnf", fetchConfig, subscribeUpdates); From 8cf420f2d93740b1d9d20dba9acc94d7b5ae3133 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 21 May 2019 12:48:58 -0700 Subject: [PATCH 2/2] Version bump to 4.2.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fbd51260..cb6f01b3 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "home-assistant-js-websocket", "amdName": "HAWS", "sideEffects": false, - "version": "4.1.2", + "version": "4.2.0", "description": "Home Assistant websocket client", "source": "lib/index.ts", "types": "dist/index.d.ts",