Frontend mode light / dark vs. theme light / dark confusion

Since 0.114 we have dark mode support in the frontend. But to be honest, I think it’s getting very complicated.

I can still use automation to set any browser that is dark mode agnostic (like Chrome on my Mac) to a light or dark theme. No probleme here. Works like it did before.

But I simply cant find a reliable way to force the HA frontend on Android devices to use a light or dark mode since the new dark mode option exists in HA.

Yes, I know that the set_theme service call now supports a mode:dark / mode:light option. But this option does NOT change the frontend to dark or to light mode on Android devices. Instead it only defines, which theme the Android device uses if it switches itself (!) into light mode or dark mode!
So the Android device decides which mode it is in. I have no way to control that from HA.
If I want to force dark mode from HA (e.g. on sunset) there seems to be no way to do so for Androids.

IMHO we should have an additional selection in the user settings that allows not only to make the theme “backend selected” but also one that makes dark mode “backend selected”.

Am I overlooking something here?

With more experimenting, I think I found the solution:

When a theme is set with frontend.set_theme including the mode parameter “dark” or “light”,
then this theme overrides any theme that is set without a mode parameter, but only on devices that support dark/light mode (i.e. Android).

Devices that do NOT have a dark/light mode will never use the themes that are set with mode parameters. They will only use themes that are set without (!) the mode parameter.

If you did never issue a set_theme with mode:dark or mode:light parameter, then there is no override information and Android devices will directly follow all normal set_theme calls that do not contain a mode parameter.

If a theme has already been set with a mode parameter, you can undo that by setting the “none” theme with the same mode parameter.

Bottom line:

If you want to make sure that your Android devices follow the same HA theme changes as your desktop browser, then you best send a series of set_themes like this:

  1. name:none, mode:light # remove any theme that would override when devices are in light mode
  2. name:none, mode:dark # remove any theme that would override when devices are in dark mode
  3. name:YOUR THEME NAME HERE # set your desired theme (light or dark, whatever you just need - now all devices will follow). NO mode parameter in this call!

Step 1. of the series above can be skipped!
This was pointed out by @KTibow in another thread.

The reason for this is, that setting a theme without any mode parameter does the same thing as with mode:light. So the only important thing is to set name:none, mode dark. Then you can simply set your theme (without mode parameter) and Android will follow.

New bottom line:

If you want to make sure that your Android devices follow the same HA theme changes as your desktop browser, then you best send two set_themes like this:

  1. name:none, mode:dark # remove any theme that would override when devices are in dark mode, now Android will always use the light mode setting
  2. name:YOUR THEME NAME HERE # set your desired theme (light or dark, whatever you just need - now all devices will follow). NO mode parameter in this call!

THe Dark/Lihgt support is very confusing to say the least. Your late steps work, mostly; the MAP view does not comply with the mode setting (keeps showing light on a dark theme). And if you set a dark mode with the mode setting (mode: dark) then Supervisor and HACS will also do not change from light. That is using Backend Selected and calling the Service.