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
trigger:
  - 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: []
action:
  - repeat:
      sequence:
        - service: light.turn_on
          metadata: {}
          data: {}
          target:
            entity_id: light.bedroom_lights
        - delay:
            hours: 0
            minutes: 0
            seconds: 0
            milliseconds: 250
      until:
        - 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.)

I’ve put together this approach using the UI - sharing in it’s raw, relatively untested, state for info and critique
.
It’s for the 2-button version of the same switch but should be relevant to the bigger switches.

I (currently) have two automations per button - one for the short press (ON or OFF) and one (this code) for the brightness (Increase or Decrease) adjusting the options in the pull downs appropriately.

Also, substitute 002, 003, 004 etc for the other buttons where this code has 001.

alias: "Light Switch - Landing increase brightness "
description: ""
triggers:
  - device_id: c682fd7b10175ccc425dbb4c7e0acc7b
    domain: zwave_js
    type: event.value_notification.central_scene
    property: scene
    property_key: "001"
    endpoint: 0
    command_class: 91
    subtype: Endpoint 0 Scene 001
    trigger: device
    value: 2
conditions: []
actions:
  - repeat:
      sequence:
        - device_id: d338ba8c15df35150b99a5a28df08297
          domain: light
          entity_id: f75be534a80bba21b906cdf7621587ff
          type: brightness_increase
        - device_id: d70ca10b6804e9472420ec0474afa7ad
          domain: light
          entity_id: e71067341859af713797d140753d88e2
          type: brightness_increase
      until:
        - condition: state
          entity_id: event.light_switch_landing_1_scene_001
          attribute: event_type
          state: KeyReleased
mode: single