Setting a default theme in Home Assistant for all users

Sometimes I come across some nice themes for Home Assistant, and when I have used them myself for a period of time, I like to push them to all users in our Home Assistant.

Default each user can change the theme in their user settings, and there is no general / default setup possibility to set a different default theme.

So… how do you do it then?

It’s actually quite easy. You can do it with an automation that triggers when Home Assistant starts up and with an action that sets the theme. If you want, you can deep dive into the documentation for the Frontend integration – just click here.

The code looks like this:

You can copy the code directly into your own configuration. You only need to change the [THEME_NAME] to the name of your theme. The theme name is the “user friendly name”, so if the theme is called “Metro Blue”, then you write “Metro Blue” as the name.

If you are unsure what the name of the theme is, you can go into the user settings/user profile and see the available themes in the Theme selector.

Setting different themes for light and dark mode

I like my phone and iPads to switch between light and dark mode depending on day and night. Not all custom themes for Home Assistant supports this, so instead you can set a light theme and a dark theme with the “frontend.set_theme” service, and by that differ the looks of the theme.

Here is an example:

Quite easy and very useful.

Leave a Reply

Your email address will not be published.