frontend.set_theme will ONLY work, if you have chosen theme āBackend-selectedā under your profile in HA.
If you have selected any other theme there, it is NOT possible to change that theme through automations.
Thanks for clarifying that. I wish this was mentioned in the Frontend documentation.
However, I observe different behaviour (HA 0.112.1) between Firefox and Chrome. In Firefox indeed the theme should be set to āBackend-selectedā for frontend.set_theme to work but in Chrome that seems to work even if a specific theme is selected in your profile.
I cannot confirm that. For me Chrome behaves exactly as expected: Setting the userās theme to a dedicated theme forces that theme to be used. Setting the usersās theme to āBackend-selectedā activates the selection through automations.
Have you been using incognito mode when testing? Did you disable all cookies in chrome? Anything else that would impede the browser storing the needed data for your selection to become active?