home-assistant / frontend

:lollipop: Frontend for Home Assistant
https://demo.home-assistant.io
Other
3.8k stars 2.6k forks source link

Misleading behaviour of frontend's theme change service #20977

Open cociweb opened 1 month ago

cociweb commented 1 month ago

Checklist

Describe the issue you are experiencing

service: frontend.set_theme
data:
  name: default
  mode: dark

should change current (=default) theme mode to dark, but it doesn't work - nothing happens (it doesn't work neither with mode: light)

Unfortunatelly, in the users's (GUI) profile only auto/light/dark modes are available. The light/dark options are a manual option to forcefully override the ha's default mode of default theme settings. In our case the 'auto' is based on the user's browser/OS settings and does not lies on the control of HA-core. (eg service call for automations)

Describe the behavior you expected

I would recommend to (re-)introduce/revert a 4th option, (eg the old "backend selected") where the theme mode is based on the ha-core (service call / automations) and not on the users/browser(/OS) preferences. Please note that the above mentioned service call was worked before the redesigned profile layout (years ago). [off] I don't really know which version, but it was years ago.... I don't think it does matter now...

Steps to reproduce the issue

  1. set the theme to default in the configuration.yaml.
  2. set the theme option to any in the user's profile
  3. set the opposite mode by a frontend.set_theme service call of the default theme as it is used currently. ...

What version of Home Assistant Core has the issue?

2020.01.0?

What was the last working version of Home Assistant Core?

No response

In which browser are you experiencing the issue with?

No response

Which operating system are you using to run this browser?

No response

State of relevant entities

No response

Problem-relevant frontend configuration

No response

Javascript errors shown in your browser console/inspector

No response

Additional information

This ticket is a frontend related successor of https://github.com/home-assistant/core/issues/106040 Also, there are many topics by the community, eg:

If this is considered as a 'Let's go' implementation, I would also suggest to rename the misleading 'auto' option something like 'browser/os select' option, since the behavior is not clear enough from it's name.

karwosts commented 1 month ago

There is feedback from multiple developers on that thread stating that the purpose of mode in set_theme is not to change the client's light/dark mode setting.

If what you're asking for here is a 4th "backend selected" darkmode, that is a new feature request.

Honestly I don't think that makes that much sense to have it. I could imagine wanting to have dynamic control over light/dark mode (e.g. a wallpanel in a room that could go to darkmode based on a lux sensor in the room), but that's not really scalable as you only have one backend selected mode which is shared by all your clients. If the backend was going to control the mode that would be something I think you'd want on a per-client level, not globally for everyone.

So I couldn't think of a good use case why you'd want to have backend switch light/dark mode that would make me want to suggest adding it.

cociweb commented 1 month ago

Actually, I'm the only one single user on my instance with multiple devices, with multiple usecases on bases of the time's plane... (Basically, the single user will stay until LDAP is not added....) Anyways, the 'backend selected' option should still be a user property but on lower level on the priority line, since the current user settings forcefully override everything according to the current working method.

Actually this is bug report, since it was a working feature in the past (and now it is not working) and furthermore there is an inbuilt service call in the core, which has no effect on this anymore according to it's documentation.

Honestly I don't think that makes that much sense to have it.

Personally.

As you can see on the attached links, not only I am the helicopter it's a very annoying bug for multiple users (so maybe there are other usefull usecases which was not questioned). - Of corse, there are workarounds with browser_mod, or multiple custom templates, but those are not the solutions and requires additional configurations/installations/maintenance. (Especially, I do not use browser_mod, because it makes my installation instable and significantly slow, but that's another user voice with another report....)

ncd7 commented 1 month ago

I second this. Being able to change the theme mode (light/dark/auto) is incredibly useful and the fact it has this odd behavior is very misleading. What are next steps? Do we need a feature request or this would be considered a bug?