Set "Scene" from a dashboard button

Hi,

I would like to set a “scene” triggered by a dashboard button, more precisely:

  1. Set a Hue scene (“bright”)
  2. Turn on the wardrobe light (regular switch)

I can achieve this with an automation, which is bound to a hardware button, no issues. But somehow, I am to stupid to do the same from the dashboard.

I tried two approaches:

  1. Trigger the automation
    I added the entity representation automation “Set bright”, which would achieve the two things above. However, the automation is not triggered when I press the dashboard button. Also the button has an “on/off” state then, which does not make sense in this variant.

  2. Create a Home Assistant Scene
    This would be my preferred variant, as it seems very clean and in the existing automation, I could then just set the same scene. However, I could not figure out how to set a Hue scene as part of a scene. Is it true that I can set details of a scene in Yaml only?

Thanks for any hints

Best regards,
Jonas

square: false
type: grid
cards:
  - show_name: true
    show_icon: true
    type: button
    tap_action:
      action: toggle
    entity: scene.let_there_be_light
    show_state: false

Thank you. This shows how to activate a scene, but it does not really solve my issue or am I missing something? I use exactly this in other rooms, where I have Hue lights only and therefore can only set a scene, but as I tried to describe, I have to control a switch, too.

I guess I’m missing something, as I understand your question as “how to activate a scene from the dashboard button” [?]


EDIT: OK, I see this \/ but don’t know the answer:

However, I could not figure out how to set a Hue scene as part of a scene.

If you know how to do that from a script → then just call the script from the dasboard button:

  - show_name: true
    show_icon: true
    type: button
    tap_action:
      action: toggle
    entity: script.bedtime
    show_state: false

Thank you, but this somehow does not work.

It has to work → it’s working for me :wink:

Maybe your script is not working properly? Run it “manually” to see, check out the logs.

Just create a script (not an automation) and call your actions there. Then, from your dashboard button, just call the script. As for your button, you’ll probably want to use a Tile instead as it can be set to be momentary.

As for your Hue scenes, you can just call it using the scene.turn_on service like any other scene. You cannot use scenes within scenes though (that was removed from HA a long time ago). But, you can create a script that will call scene.turn_on multiple times, thus giving the illusion of a single scene.

1 Like

Ah, this is likely the thing I missed. Thanks to both of you!!

2 Likes

Just in case:

alias: Activate Multiple Scenes
sequence:
  - service: scene.turn_on
    metadata: {}
    target:
      entity_id: scene.attic_lights_off
  - service: scene.turn_on
    metadata: {}
    target:
      entity_id: scene.attic_lights_on
  - service: scene.turn_on
    metadata: {}
    target:
      entity_id: scene.bathroom_afternoon
mode: single
1 Like

perfect thank you!

1 Like