#Script for changing between light and dark themes using browser mod

1 messages · Page 1 of 1 (latest)

gleaming valley
#

Hi all! I'm trying to create a script that I can activate via a button on my dashboard that will change my HA theme from dark to light and also change the theme itself.

  - if:
      - condition: state
        entity_id: binary_sensor.littlenovo_chrome_browser_dark_mode
        state: "on"
    then:
      - action: browser_mod.set_theme
        metadata: {}
        data:
          browser_id:
            - 5dd87f16e2d0618f88e852fb0d03685b
          theme: Catppuccin Latte
          dark: light
    else:
      - if:
          - condition: state
            entity_id: binary_sensor.littlenovo_chrome_browser_dark_mode
            state: "off"
        then:
          - action: browser_mod.set_theme
            metadata: {}
            data:
              browser_id:
                - 5dd87f16e2d0618f88e852fb0d03685b
              theme: Catppuccin Frappe
              dark: dark
alias: light to dark
description: ""```

This seems to work only one direction when I click on my button. I'm using a button that is doing Action->run this script.(I'm also wanting to make the script device agnostic and to activate the theme refresh service, but I just want to make sure it's working on one device initially before I modify it) 

This is my first script so apologies if I'm missing something obvious. I've tried searching around and couldn't find any examples of anyone trying to achieve the same goal. Thanks for reading!
fossil fjord
#

What is changing the state of that binary_sensor?