HUE Trigger

Hey,

I may have a stupid question, but I have it.

I try to set up automation that does the following:

When a certain scene for HUE is activated (either through the Hue App or HA) I want to play a certain music. Casting to Chromecast is not a problem, but what is the trigger I need to use. When I trace the commands with dev-tools I get a different ID every time.

Does anybody have a template that I can use?

Thanks in advance.
Frank

You can use Event Triggers to detect when Home Assistant is used to activate a Hue scene. Here’s a simple automation that reports the entity_id of the scene that was activated. There’s more than one way to turn on a scene in Home Assistant so that’s why the automation has two Event Triggers.

- alias: Monitor Hue Scene Events
  trigger:
  - platform: event
    event_type: call_service
    event_data:
      domain: hue
      service: activate_scene
  - platform: event
    event_type: call_service
    event_data:
      domain: scene
      service: turn_on
  action:
  - service: notify.persistent_notification
    data:
      message: "type: {{ trigger.event.data.service_data.entity_id | first }}"

When you use the Philips Hue app to turn on a Hue scene, Home Assistant does not detect the scene activation as a special event. It simply detects the state-changes of each light in the scene.


NOTE
The second Event Trigger listens for any scene activation, not just Hue scenes.

Thanks a lot. I did it a different way, but your input was very helpful.

How does this different way detect when the Hue app activates a Hue scene?

Not at all. I activate sound now with long push of a button on a Hue switch.