Turn volume up .. problem

why does this not work ? I want the volume turn up up up when i hold the button down
it only turn the volume up once.

alias: test knap volume
description: ""
trigger:
  - device_id: 52b5d39251f373fd62616819ec5466bf
    domain: deconz
    platform: device
    type: remote_button_long_press
    subtype: button_4
condition: []
action:
  - service: media_player.volume_set
    data:
      volume_level: "{{ state_attr('media_player.kokken', 'volume_level') + 0.1 }}"
    target:
      entity_id: media_player.kokken
mode: restart

The automation triggers when it detects a long press and calls the volume up service once. It does not continue to trigger while you are holding the button.

ok, thanks

is it possible to make it?

Only if your button has a release event or state.

Then you can repeat the actions in a loop until a release event occurs. You will need a delay in the loop of actions as home assistant can repeat them extremely quickly. It is also wise to include a default repeat length just in case the release is missed for some reason.

https://www.home-assistant.io/docs/scripts/#repeat-a-group-of-actions

1 Like

cant get it to work :-/

My button has this

device_id: 52b5d39251f373fd62616819ec5466bf
domain: deconz
platform: device
type: remote_button_long_release
subtype: button_4

I cant pick the option button_4_long press

repeat:
  until:
    - device_id: 52b5d39251f373fd62616819ec5466bf
      condition: device
      domain: ""
      entity_id: ""
  sequence:
    - service: media_player.volume_set
      data:
        volume_level: "{{ state_attr('media_player.kokken', 'volume_level') + 0.1 }}"
      target:
        entity_id: media_player.kokken
    - delay:
        hours: 0
        minutes: 0
        seconds: 0
        milliseconds: 200
enabled: true

Hello, I want to turn up the volume when I press and hold the button, is it solved?

No, I did not get it to work

Dashboard buttons do not.

1 Like