I'm using quite a lot of UI switches using the "switch" node.
I was able to successfully connect all of them to a template node for a vibrating effect whenever the buttons are clicked, like this:
Now, what I want to achieve is to add an option where "long" press (I'm using mobile phone touchscreen interface, the mouse part is less important for me). A long press needs to change the state of the switch without resending its payload - that's extremely useful in cases where the UI switch is wrong - for example it shows "on", when the light switch it controls is in fact "off". So having the option to "correct" a switch is important for me.
Is there perhaps an option to add something to the template node? Something with "touchtart\touchend"? I'm a bit of a newbie here, so any help will be greatly appreciated.
Possibly better to avoid that situation. Can you not feed the current state of the actual switch into the ui_switch so that it always shows the correct state?
I'm also doing that, but it's not enough. In light switches that are based on RF technology, you often don't know the actual state the switch is in without physically looking. So in most cases I don't have a reliable information that could toggle the switch for me, it needs a manual "correction".
I saw here an example that binds scope.click
Can something similar be done to bind longpress?
Perhaps something similar to the discussion here?
Hi @moryoav!
Here's a quick hack that hopefully works for you, if you press on it (either mobile or desktop) for more than 1 second, the toggle switch will change but not output back to Node-Red: