Change with automation between light and dark mode

I am using the default HA theme and can change the mode between auto, light and dark and that works

I want to do this with an automation but here it doesnt switch.

alias: Umschalten Theme light/dark
description: ''
triggers:
  - trigger: state
    entity_id: input_boolean.light_dark
conditions: []
actions:
  - if:
      - condition: switch.is_off
        target:
          entity_id: input_boolean.light_dark
        options:
          behavior: any
          for: '00:00:00'
    then:
      - action: frontend.set_theme
        metadata: {}
        data:
          name: default
          mode: dark
    else:
      - action: frontend.set_theme
        metadata: {}
        data:
          name: default
          mode: light
mode: single


Based on the action docs, mode is not a supported configuration variable. I think you would need to add standalone light and dark versions of the theme so you could call them with just name.

Yes not being able to use an automation to change the theme mode has been a long standing issue - pretty much since dark/light mode were introduced. We were told on discord at least a year ago that there were plans to update this. Haven’t heard anything since.

So I found a soloution by using HACS browser_mod.

You have to register your browsers on the different devices and then you can use the aktion:

Browser mod: set_theme

  • you can select target users
  • theme: default
  • Mode: light or dark