Checking in a automation if a Hue scene ist ON

Hi,
I’ve a group of lights to light up plants with a specific color. The scene is called in a Hue bridge. For other automations I need to know if this scene is ON. So I implemented a helper: input.boolean.hue_scene.Plantlight.

I thought, that I can set this helper to ON, when I get the state of the Hue scene. But sadly the Hue bridge doesn’t send the status of any scene.

How can a automation in home assistant recognize if this scene is called from a hue bridge?

I can’t code in Jinja2 at this moment. I found this code, that doesn’t work. The helper have to set ON when all lights of the group are ON and have a brightness of 255 and a xy-color (0.1896, 0.0652).

    {% set plant_lights = expand('light.wohnzimmer_pflanzen') %}
    {% set all_correct = true %}
    {% for light in plant_lights %}
      {% if not (
        is_state(light.entity_id, 'on') and
        light.attributes.xy_color[0] == 0.1896 and
        light.attributes.xy_color[1] == 0.0652
      ) %}
        {% set all_correct = false %}
      {% endif %}
    {% endfor %}
    {{ all_correct }}

Can someone help me?

Copy-paste the following template into the Template Editor and confirm it reports truewhen the scene is turned on from the Hue app.

{% set lights = state_attr('light.wohnzimmer_pflanzen', 'entity_id') | expand | list %}
{{ lights
  | selectattr('attributes.brightness', 'eq', 255)
  | selectattr('attributes.xy_color', 'eq', (0.1896, 0.0652))
  | map(attribute='entity_id')
  | list | count == lights | count }}

The template selects all of the members of light.wohnzimmer_pflanzen and counts how many have a brightness of 255 and xy_color of (0.1896, 0.0652). It compares the count to the total number of members. If they’re equal then it reports true (otherwise false).