Another Dark Theme

I have the following alternative to @ahs solution. I implemented an input_boolean to control enable/disable the automations (if auto_darktheme is off, the theme will not change automatically)

# Set dark theme for the night
- alias: 'Set dark theme for the night'
  initial_state: True
  trigger:
    - platform: sun
      event: sunset
  condition:
    - condition: state
      entity_id: input_boolean.auto_darktheme
      state: 'on'
  action:
    - service: frontend.set_theme
      data:
        name: 'dark_theme'
        
        
# Set default theme for the day
- alias: 'Set default theme for the day'
  initial_state: True
  trigger:
    - platform: sun
      event: sunrise
  condition:
    - condition: state
      entity_id: input_boolean.auto_darktheme
      state: 'on'
  action:
    - service: frontend.set_theme
      data:
        name: 'default'
2 Likes