diff --git a/webapp/src/components/AutomationManager/index.tsx b/webapp/src/components/AutomationManager/index.tsx index dfe72e8..5cb63aa 100644 --- a/webapp/src/components/AutomationManager/index.tsx +++ b/webapp/src/components/AutomationManager/index.tsx @@ -264,7 +264,7 @@ export const AutomationManager: FC = ({ } ); } - // refreshAutomations(); + refreshAutomations(); }} onAutomationUpdate={(auto) => wrapApiPromise( diff --git a/webapp/src/components/Page/index.tsx b/webapp/src/components/Page/index.tsx index 6d6d93d..c16c683 100644 --- a/webapp/src/components/Page/index.tsx +++ b/webapp/src/components/Page/index.tsx @@ -58,12 +58,6 @@ export const InternalPage: FC<{ if (snackbarKeyHAConKey.current) { snackbar.closeSnackbar(snackbarKeyHAConKey.current); } - snackbarKeyHAConKey.current = snackbar.enqueueSnackbar( - `Connected to HA!`, - { - variant: "success", - } - ); } }, [conn, snackbar]); diff --git a/webapp/src/components/VersionBox/index.css b/webapp/src/components/VersionBox/index.css index 50f2c23..2371a2c 100644 --- a/webapp/src/components/VersionBox/index.css +++ b/webapp/src/components/VersionBox/index.css @@ -1,6 +1,21 @@ .version-box { position: absolute; - bottom: 0; + bottom: -0.5em; right: 0; font-size: 0.5em; +} + +.version-box #circle { + color: var(--mui-primary-main); + height: 1em; + width: 1em; +} + +.version-box #circle.error { + color: var(--mui-error-main); +} + + +.version-box #circle.loaded { + color: var(--mui-success-light); } \ No newline at end of file diff --git a/webapp/src/components/VersionBox/index.tsx b/webapp/src/components/VersionBox/index.tsx index 509fb93..24bd57d 100644 --- a/webapp/src/components/VersionBox/index.tsx +++ b/webapp/src/components/VersionBox/index.tsx @@ -1,9 +1,17 @@ import "./index.css"; import { FC } from "react"; +import { useHAConnection } from "haService/connection"; export const VersionBox: FC = () => { - const version = process.env.REACT_APP_BUILD_VERSION ?? "n/a"; - return
- version: {version} + const ha = useHAConnection(); + const version = process.env.REACT_APP_BUILD_VERSION ?? "n/a"; + + return ( +
+ version: {version} / HA Connection{" "} + + 🟢 +
-} \ No newline at end of file + ); +}; diff --git a/webapp/src/haService/index.ts b/webapp/src/haService/index.ts index 0547ca0..6b1a075 100644 --- a/webapp/src/haService/index.ts +++ b/webapp/src/haService/index.ts @@ -229,6 +229,9 @@ export const useHA = () => { callService, callHA, deviceExtras: getDeviceExtraWsCalls(callHA), - reloadAutomations: () => callService("automation", "reload"), + reloadAutomations: () => + conn.status === "loaded" + ? callService("automation", "reload") + : Promise.resolve(), }; }; diff --git a/webapp/src/routes/automation.tsx b/webapp/src/routes/automation.tsx index e6689ff..e2dadee 100644 --- a/webapp/src/routes/automation.tsx +++ b/webapp/src/routes/automation.tsx @@ -8,7 +8,7 @@ export const AutomationRoute: FC<{ api: ApiService }> = ({ api }) => { return ( ha.callService("automation", "reload")} + refreshAutomations={() => ha.reloadAutomations()} triggerAutomation={(entity_id) => ha.callService( "automation",