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<HassConfig>) => - 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); 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",