Delay in activating a second command

Hi all,

I'm currently working on a flow which has a basic UI which allows you to activate a function with a on / off switch which is connected to a trigger function automatically turning it off again after x-seconds.
image
image

What I want to achieve is that it is not possible to activate two functions at the same time, could any of you give me a pointing in the right direction for this?

Lets say when I activate the "Vibration Main" function, the "Vibration Backup" function should not be possible to activate at the same time.

All help is appreciated.

Best regards
Alex

Setting msg.enabled to false will disable the switch widget. You can reset this after your timer expires.

Even with the button disabling suggested it may be possible to beat it by hitting the two buttons in quick succession, before the second one has been disabled (or possibly there are two instances of the the dashboard open on separate devices and the two users request the actions simultaneously) so if it would be serious if they somehow both got activated at the same time I would put some additional logic in that prevents them both happening. You could use node-red-contrib-semaphore to do that for example.

The tool would break if both were activated at the same time. I'll see what I can figure out with the semaphore. Thanks for recommending it!

If it is that serious then I suggest a completely independent mechanism around the machine itself. Possibly something like a changeover relay that selects one or the other then another relay in series that says on/off. Then on the pi (or whatever) have outputs that drive the enable and the selection relays.
[Edit] Otherwise you can never be certain that a problem with the pi (hardware or software) will not enable both at the same time.