I'm in the process of moving my webcore pistons from ST over to HE. So far things have been going smooth however I got a bit stumped by the different button handling on this platform, but I figured it out and wanted to share that:
The button is a samsung zigbee button, which supports those 3 states. It's paired nicely and the device has been made available in webcore. In the log it reports as expected:
On ST I would have created an expression as:
"If buttondevice's button gets <pushed|double|held> then do something."
However that doesn't work as the 'gets' comparison does not apply, as value of the button's attributes do not change, i.e. this won't work on HE:
So I had to change my pistons slightly to use the On Event item instead
Last, just to save you the trouble, I tried creating a combined statement as
On event from
some code to decipher/switch which event it was and do appropriate actions
I found out the only system variable which contains anything different between each button action is $currentEventDescription, but considering the string operations one has to do to drill down to what button was pushed, I think the easiest and most lean piston is just making 3 of these statements, one for each of the attributes (pushed button, double tapped button, held button):
Btw, one more thing, not sure if it's a bug in the Webcore IDE/frontend, however once an On-Event statement has been edited, the device cannot be edited, which is why I use a placeholder Device variable. This also goes if you duplicate already created on-event statements.
@nh.schottfam - thanks, yet curious - what physical button device(s) are you using? Something tells me that there's either multiple ways to skin this cat, or different buttons models may require different handling?
When you import a piston from ST (that was created on ST), there are some 'complier' differences that happened on ST that have to be change on HE. This is the reason for my statement of recreate the if statement (specifically the condition check). As it will then be 'compiled' correctly.
In ST, the button model used device sub-indexes (which do not exist in HE), so the 'compiler' in the IDE put them in automatically. They need to be removed and creating the if statement does this.
Thanks for clarifying, however try as I might I could not get your example working last night. Nothing happens when I do an IF check on 'gets', thus my previous presumotion on the handling. I'll give it another shot, yet so far only the On Event for each state seems to work for me.
Second, I understand Webcore is a community effort here on the HE platform. Could you share who on the forums are involved in said effort?
Thanks a bunch for the pointers Nh, I'll see if it makes a difference tonight when I get some tinkertime
Update: So it took a few to get around to testing this. @nh.schottfam - could you elaborate on what the significance of the 'gets' value is? Replicating your example above, I tried with 2 for doubletap and held, however they did not have any effect. Once I changed them to 1 it worked fine. Just trying to understand whats happening with the button?
I've been trying to figure out how to use WebCore with my button for a year or so now (first in ST and now in HE). Would love a helping hand. I see events exactly like the ones in the original post when I single, double, triple, etc tap on my button. How do I translate those to triggers in WebCore? I get the same comparison thing with a field to enter a value...I'm just struggling to wrap my head around how this works with these buttons. FWIW my button is a "Zooz Remote Switch Zen34". After trying in WebCore for a while back in the ST days, I was able to open the device in ST and program the taps using the ST UI. Can't find that sort of thing in HE either. Appreciate any help!