Hi all,
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
button pushed
Or
button doubletapped
Or
button held
Do
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.
Hope this is helpful to somebody.