BTW I used a brighness script with my xiaomi buttons - hold to cycle brightness up and down and release to keep.
Actually its a bit unreliable, so does not get used much.
alias: "Brightness lights"
sequence:
- service: homeassistant.turn_on
entity_id: light.hallway
data_template:
transition: 1
brightness: '{% if states.light.hallway.attributes.brightness%}{{(states.light.hallway.attributes.brightness+25)|min(255)}}{% else %}25{% endif %}'
- service: script.turn_on
entity_id: script.brightness_lights_temp
brightness_lights_temp:
sequence:
- delay: '00:00:01'
- service: script.turn_on
entity_id: script.brightness_lights
This is the trigger:
# Click and hold dimmer
- alias: "Brightness Downstairs Lights Button"
trigger:
- platform: event
event_type: click
event_data:
entity_id: binary_sensor.switch_158d0000eff19a
click_type: long_click_press
condition:
- condition: state
entity_id: light.hall_by_front_door
state: 'off'
- condition: state
entity_id: light.hall_by_kitchen
state: 'off'
action:
- service: homeassistant.turn_on
entity_id: script.brightness_lights
- alias: "Brightness Downstairs Lights Button Stop"
trigger:
- platform: event
event_type: click
event_data:
entity_id: binary_sensor.switch_158d0000eff19a
click_type: hold
condition:
action:
- service: homeassistant.turn_off
entity_id: script.brightness_lights
- service: homeassistant.turn_off
entity_id: script.brightness_lights_temp