If there are other events from that same id, you may get some warnings from calling an invalid service. So, you may need to set a condition to avoid those triggers.
condition: "{{trigger.event.data.event in ['1002', '2002', '3002'] }}"
It would be easier to use a map and you’d want to ensure the type because a string and an int are not the same.
This defaults to stop if it get’s invalid commands, ensure’s that the incoming event data will pass an == or .get command, and is alittle easier to read than a single line nested if statements. Typically you don’t want to nest multiple if statements in a single line because it’s easy to misunderstand when you come back to it later.
if this were my automation, I’d do it this way so that debugging is easier in traces and you can view each step of automation from the trigger position.
- trigger:
platform: event
event_type: deconz_event
event_data:
id: osram_mini_wohnzimerrolladen
variables:
event: "{{ trigger.event.data.event }}"
events:
1002: open
2002: close
3002: stop
service: "{{ events.get(event) }}"
valid_event: "{{ service is not none }}"
condition:
- condition: template
value_template: "{{ valid_event }}"
action:
service: cover.{{ service }}_cover
target:
entity_id: cover.wohnzimmer_door_cover
EDIT: somehow I missed @WolfsW3lp3’s post. Disregard if this if you’re happy with what you have.