It now works, the “release_3” block can probely be made more simple, but it works.
A input_boolean must be created, named: dimming_occured
blueprint:
name: zigbee2mqtt - EnOcean PTM 215Z Switch On-Off-Dimming
description: Control on off and dimming switch
domain: automation
input:
switch:
name: switch
description: on/off/dimming switch
selector:
entity:
domain: sensor
light:
name: Light
description: The light to control with top buttons
selector:
target:
entity:
domain: light
mode: restart
max_exceeded: silent
trigger:
- platform: state
entity_id: !input "switch"
attribute: action
action:
- variables:
command: "{{ trigger.to_state.state }}"
- choose:
- conditions:
- "{{ command == 'release_3' }}"
sequence:
- choose:
- conditions:
- condition: state
entity_id: input_boolean.dimming_occured
state: "off"
sequence:
- service: light.turn_off
data: {}
target: !input "light"
- conditions:
- condition: state
entity_id: input_boolean.dimming_occured
state: "on"
sequence:
- service: input_boolean.turn_off
target:
entity_id: input_boolean.dimming_occured
data: {}
- conditions:
- "{{ command == 'press_3' }}"
sequence:
- delay: "0.5"
- service: input_boolean.turn_on
target:
entity_id: input_boolean.dimming_occured
data: {}
- repeat:
count: "15"
sequence:
- service: light.turn_on
data:
brightness_step_pct: -10
transition: 1
target: !input "light"
- delay: "0.5"
- conditions:
- "{{ command == 'press_1' }}"
sequence:
- service: light.turn_on
target: !input "light"
data: {}
- delay: "0.5"
- repeat:
count: "15"
sequence:
- service: light.turn_on
data:
brightness_step_pct: 10
transition: 1
target: !input "light"
- delay: "0.5"