lovelace-mushroom-themes icon indicating copy to clipboard operation
lovelace-mushroom-themes copied to clipboard

Add ability to choose light or dark mode in automation

Open welcoMattic opened this issue 1 year ago • 4 comments

I would like to automatically switch from light to dark mode depending on the sun position, via an automation. But actually, there's no way to do it with this theme.

Could you consider adding such a feature?

welcoMattic avatar Sep 08 '22 10:09 welcoMattic

You can select "auto" in your profile and the theme will be automatically adapt with your mobile/computer. There is no service for now in Home Assistant to choose the theme mode (light or dark)

piitaya avatar Sep 08 '22 11:09 piitaya

I use an automation for it:

image

This automatically change the theme to use, depending on the sun position.

But in the "Set theme" service, there is an option to choose light or dark mode:

image

welcoMattic avatar Sep 08 '22 20:09 welcoMattic

The Blueprint needs to be adjusted to support modes. Contact the blueprint creator for that, or create the automation yourself using the state of sun.sun as the trigger and using the serivce call shown in your screenshot as an action.

TheFes avatar Oct 27 '22 07:10 TheFes

No, the mode option has no effect on Mushroom theme. This is exactly the issue.

welcoMattic avatar Oct 27 '22 08:10 welcoMattic

The "set theme" service is not to choose which mode to use. It set a theme for this mode. The mode is managed by your phone/computer, not home assistant. Documentation : https://www.home-assistant.io/integrations/frontend/#service-set_theme

piitaya avatar Oct 27 '22 09:10 piitaya

Well, it works on my desktop, If I use

service: browser_mod.set_theme
data:
  theme: Mushroom
  dark: dark

the Dark theme gets selected, when using dark: light the light theme gets selected.

However, it doesn't do anything on my mobile.

TheFes avatar Oct 27 '22 13:10 TheFes

@piitaya is there any workaround similar to what is proposed here? https://github.com/Madelena/Metrology-for-Hass/issues/5#issuecomment-1120463625

Is it possible to do the same for Mushroom themes?

sviperz avatar Apr 06 '23 10:04 sviperz

I think it should work but I can not confirm. Mushroom theme is like every other theme.

piitaya avatar Apr 06 '23 12:04 piitaya

OK, but what do I need to put instead of *metro-common-dark / *metro-common-light from the example above?

I've tried this, but it doesn't work, both themes still have Auto/Light/Dark modes:

Mushroom Dark:
  modes:
    dark: {}

Mushroom Light:
  modes:
    light: {}

sviperz avatar Apr 06 '23 15:04 sviperz