Automation to change the Theme to dark

Hi Everyone,

I would like to ask for your assistance.

I set up a Fire HD Tablet with Fully Kiosk as a Dashboard.
I would like to change the profile’s mode to DARK when the sun goes down and LIGHT when the sun is up.
The AUTO mode does not work as it triggers only when the system on it runs dark mode as well. Unfortunately, the Fire HD Tablet has no Dark mode.

I wanted to do it with automation, but it doesn’t work.
I did the following, it runs without error, but it does not change the Theme to dark:

alias: auto dark
description: “”
trigger:

  • platform: state
    entity_id:
    • sun.sun
      from: below_horizon
      action:
  • service: frontend.set_theme
    data:
    name: minimalist-mobile
    mode: dark
    mode: single

Does anybody have a solution to change the Theme mode to dark every evening and back to light in the morning?

Thanks in advance

1 Like

Make sure to set Theme to “Backend Selected” in the user profile.

alias: auto light/dark
description: ''
trigger:
  - platform: sun
    event: 
      - sunset
      - sunrise
  - platform: homeassitant
    event: start
condition: []
action:
  - choose:
    - conditions:
        - condition: sun
          after: sunset
          before: sunrise  
      sequence:
        - service: frontend.set_theme
          data:
            name: minimalist-mobile
            mode: dark
    default:
      - service: frontend.set_theme
        data:
          name: minimalist-mobile
          mode: light
mode: single

Hi,

I replicated it, but unfortunately, it didn’t work.
It runs until the end but does not change the Theme, either for the TAB or the client in a browser.
I changed the Theme to “Backend Selected”

In the Developer Tools, nothing happens when i try to run the “frontend.set_theme” service.

Does it work for you?

Thanks

1 Like

Running the frontend.set_theme in the Services tool does work for me. I don’t use minimalist-mobile so that may be the source of your issue. The name value is case-sensitive, so make sure you are using capitals where appropriate.

I’m not 100% sure what you are saying here… If you have set a Dashboard View to a specific theme, that will override the global theme set by the service call.