Change Theme with Button

As it seems you cannot set a theme automation on a per device basis (unless I have missed something), I would like to be able to change the theme via a button. This is for a wall panel.

I have tried a button to call the theme set service, but this gives an error about access denied. I have also tried creating an automation and then calling that with a button. That simply doesn’t work.

Any other suggestions on how it can be done?

Many thanks.

Are you able to change the scene via the theme set service in developer tools? Or does this give the same error?

Yes, should have said. The Dev tools method does change the theme - but for every user. I really want to just change one device if I can.

Using the button and an attempt to directly call the service, I get failed to call service frontend\set_theme . Unauthorised. The user getting that error is not an admin. Using the admin account, nothing happens.

Ok, I suspected the error was that the button was on a non admin card, that was gonna be my next question.

It should work via a button on an admin page though, can you show the yaml?

Also are you running the wall panel device via the app as surely you can change the theme via the user settings?

I do find the whole theme thing a little restrictive as I recently installed several themes and changed several devices to have different themes as per the user settings so me and the Mrs had a different theme, only to find out that every single device reverts back to default theme on restart, slightly annoying particularly as there are still way to many changes in HA that still require a restart.

I ended up making an automation to change the theme on restart - but yes we are all left with the same theme as cleary changing it to personalised for each user is a waste of time based on having to do it again each and every time HA restart.

I am using a Raspberry PI with the touchscreen, not the app.
While it does work through the user profile screen, I didn’t really want to use that method for two reasons.

  1. I am using the display as a full kiosk with that side bar hidden away.
  2. It is a lot of clicks if you just want to change the theme quickly - particularly in the middle of the night!

Looks to me like what I want to do isn’t possible and the entire theming system needs an overhaul.

Back to plan A - changing the theme centrally for all devices between midnight and 6am!

frontend.set_theme service is not working for me as a tap_action. It also doesn’t work in any automation. It just doesn’t do anything. Nothing in the logs. The only way I can get this service to work is in the developer tools - services tab.

type: button
tap_action:
  action: call-service
  service: frontend.set_theme
  service_data:
    name: my_dark
    mode: dark

My automation to change the theme on restart doesn’t work. It doesn’t do anything. Can you share your automation that works?

id: '1634931760960'
alias: Load Theme At Startup
description: ''
trigger:
  - platform: homeassistant
    event: start
condition: []
action:
  - service: frontend.set_theme
    data:
      name: my_dark
      mode: dark
mode: single