Manage Frontend Themes
ha_manage_themeList installed Home Assistant themes and set the backend default theme for light or dark mode; also inspect or restore the screenshot account's per-user theme after a screenshot changes it.
Instructions
Manage Home Assistant frontend themes.
When NOT to use: themes are YAML files - Home Assistant has no API to create or edit them. Installing community themes goes through HACS (ha_manage_hacs); editing custom theme files goes through ha_config_set_yaml (beta, edits themes/.yaml keyed by theme name and attempts an automatic theme reload).
When to use: action='list' discovers installed theme names and the current defaults; action='set' selects the backend default theme (optionally per light/dark mode).
SCREENSHOT-ENGINE ACTIONS (per-user, not the backend default): Taking a dashboard screenshot makes the Puppet engine write the saved theme of the Home Assistant user its token belongs to, which also flips that user's live web and mobile sessions. The screenshot tools are read-only and only report this; use action='set_engine_theme' with the value quoted in their warning to put it back, and action='get_engine_theme' to inspect it. These act on that engine account's per-user profile via frontend/set_user_data, which is a different layer from the backend default that action='set' changes. Giving the engine its own dedicated user and token avoids the issue entirely.
Caveats: action='set' changes the backend-selected default only - users who explicitly picked a theme in their profile keep their choice. Theme names are validated by Home Assistant at call time.
EXAMPLES:
List themes: ha_manage_theme(action="list")
Set default theme: ha_manage_theme(action="set", theme_name="nord")
Set dark-mode theme: ha_manage_theme( action="set", theme_name="nord", mode="dark")
Restore built-in default: ha_manage_theme( action="set", theme_name="default")
Inspect the engine account's theme: ha_manage_theme( action="get_engine_theme")
Undo a screenshot's theme change (pass BOTH values from the warning, so a theme changed since then is not overwritten): ha_manage_theme(action="set_engine_theme", value={"theme": "", "dark": False}, expected_current={"theme": "default", "dark": True})
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | Which mode the theme applies to when action='set'. Defaults to light. | |
| force | No | action='set_engine_theme' only: skip the expected_current guard and overwrite unconditionally. Leave false unless you intend to discard whatever is stored. | |
| value | No | Frontend user-data theme object when action='set_engine_theme', e.g. {'theme': '', 'dark': False}. An empty dict restores default/auto behavior. Take this verbatim from the warning a screenshot tool emitted. | |
| action | Yes | Theme operation: 'list' installed themes, 'set' the backend default theme, or read/restore the screenshot engine account's own per-user theme with 'get_engine_theme' / 'set_engine_theme' (a different layer from the backend default). | |
| theme_name | No | Theme name when action='set'. Must be an installed theme; 'default' restores the built-in theme, 'none' resets the chosen mode to the built-in default. | |
| expected_current | No | Guard for action='set_engine_theme': the stored theme is read immediately before the write and the write is skipped if it no longer equals this. Omitting this value or passing null both mean 'expect no stored theme', enforced like any other value; the guard is always applied unless force is set. Best-effort, not atomic -- Home Assistant exposes no conditional write, so a change landing between that read and the write is not caught. Pass the expected_current value quoted in the screenshot tool's warning. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||