Increase/Decrease Volume on KeyHeldDown Event

Hey community,

I would like to build an automation that when I hold down a button, the volume increases until I release the button. I wanna use the Aeotec WallMote Quad for that.

I’m able to listen to the event zwave_js_value_notification event for that, like this:

platform: event
event_type: zwave_js_value_notification
event_data:
  node_id: 7
  property_key: '004'
  value: KeyHeldDown

There is another event KeyReleased, which is triggered when I release the button again.
I now want to increase the volume by one step per second (for example) until I the release event got triggered.
I tried to use the repeat action, but there is no option to stop on event. I’m only able to chose state, value etc. But thats not correct here.

Do you have any other idea, how I could handle that?

I had the idea of using a boolean value, which I set to true on KeyHeldDown and back to false on KeyReleased. This boolean value I than could use to stop the while loop. But that feels very complicated and like a dirty workaround for me. Maybe there is a simpler and smoother solution?

Thanks very much in advande!

Best regards.

I was looking to do something similar. What I ended up doing is adding a second automation that triggered a helper. Then use the helper in the “Until” condition of the Repeat action. I’m not sure if that’s better than what you had in mind, but I figured it could help anyone else looking for a solution.