EDIT: If your service call only turns on one scene the above edited template will work, but Petro’s template below is more robust because it allows for the option of having multiple scene entity’s activated in one service call.
It’s a bit tricky, what @Didgeridrew posted will not work, it will always fail because you can’t check a list in a tuple unless the tuple contains an exact copy of the list. This however should always work:
{% set my_scenes = 'scene.softlight', 'scene.2', 'scene.3' %}
{{ trigger.event.data.service_data.entity_id | select('in', my_scenes) | list | length > 0 }}
In case others run into this too and need an additional example.
Also, I think this could need some improvement in the visual editor for the automations.
I had tried all these triggers for an event, which all of the bellow did NOT work:
feeding the above into GPT will make it output the correct code if you give it my example.
And here another full working example with such an event as above, as GPT generated it after receiving the above example, the full json of the event and given the instruction
single press should toggle light.veranda
double press should toggle light.aussenlicht_sud
long press should toggle light.kueche_oberlicht
Please write the full automation
alias: Handle Veranda Taster Button Events
description: Automation for single, double, and long press actions on Veranda Taster
trigger:
- platform: state
entity_id: event.veranda_taster_button
condition: []
action:
- choose:
# Single Press - Toggle Veranda Light
- conditions:
- condition: template
value_template: >
{{ 'multi_press_1' in trigger.to_state.attributes.event_type }}
sequence:
- service: light.toggle
target:
entity_id: light.veranda
# Double Press - Toggle Außenlicht Süd
- conditions:
- condition: template
value_template: >
{{ 'multi_press_2' in trigger.to_state.attributes.event_type }}
sequence:
- service: light.toggle
target:
entity_id: light.aussenlicht_sud
# Long Press - Toggle Küche Oberlicht
- conditions:
- condition: template
value_template: >
{{ 'long_press' in trigger.to_state.attributes.event_type }}
sequence:
- service: light.toggle
target:
entity_id: light.kueche_oberlicht
default: []
mode: single