Dim/Brighten Until z-wave KeyRelease event

I got a new Z-Wave remote (Versternet 12 Button Remote) and I have programmed all my KeyPress events to various lights etc but I want to look at using KeyHold to brighten/dim the lights but this is where I am getting confused.

I can trigger based on the KeyHold events and then I am using a Loop until building block but I can’t seem to get it to pickup the KeyRelease event so it just continually brightens/dims.

Firstly, am I going about this the right way and if so what am I doing wrong?

description: ""
mode: single
  - platform: device
    device_id: e5fa2a0594950a99b5d8002e76863ad7
    domain: zwave_js
    type: event.value_notification.central_scene
    property: scene
    property_key: "001"
    endpoint: 0
    command_class: 91
    subtype: Endpoint 0 Scene 001
    value: 2
condition: []
  - repeat:
        - service: light.turn_on
          metadata: {}
          data: {}
            entity_id: light.bedroom_lights
        - delay:
            hours: 0
            minutes: 0
            seconds: 0
            milliseconds: 250
        - condition: device
          device_id: e5fa2a0594950a99b5d8002e76863ad7
          domain: zwave_js
          type: value
          command_class: 91
          property: scene-001
          value: 1

If I watch the Z-wave debugging window this is the line I get when I release the key:

2024-01-16 22:02:53.936 INFO Z-WAVE: [Node 049] Value notification: 91-0-scene-001 1

Thanks so much in advance for any help, pulling my hair out trying to figure this one out.

There’s no device condition for scene events, did you generate the YAML from the UI, or create it yourself?

I used YAML and on the “Repeat an action” building block I add a condition and the first option is “device”

I did then tweak the Yaml after sorry to match the settings from the trigger to some extent.

You can’t really just “tweak” device actions/triggers/conditions manually. Generally the YAML they generate is for the UI, not for you to edit. What you’ve created is an invalid condition. The reason there’s no built-in condition for a scene event is because it’s impossible to do that, they are events, not state.

If you want to continue using device triggers, you would need a second trigger for the key release event, and then use that trigger to stop the automation.

Another approach is to use the event entities, assuming your device has those (it should have one for each scene). You can trigger off of those, and check their attributes values in a conditional. https://www.home-assistant.io/integrations/event/#event-types

A third approach is to use the zwave-js events directly as trigger, which is similar to the device triggers.

Is the target light also a z-wave device?

Thanks for the tips I will do some reading.

Unfortunately no the bulbs are on zigbee.

One other thing: you need your light.turn_on to increase or dim the brightness. (The one in the code above is just turning on the light.)