I don’t use WebCoRE yet, but isn’t this is just a case of what word is used when the button is pushed.
I think the device handler had to use a “released” event when in Momentary mode, because otherwise, the mobile app would just show “pushed” and stay stuck that way. But in Momentary mode, it also produces a “pushed” event first, and then “released”. Are you not seeing the “pushed” event?
Also, couldn’t you change the piston to say if Keypad 1's button #1 gets released
?
Just so everyone understands the limitations of these Xiaomi buttons on SmartThings:
Although the button device itself may send different messages on button push and button release, all we have to work with that SmartThings passes on to the device handler is a message that says “On/Off: 1” when you push the button. This is because the SmartThings ZigBee event parser removes the data that we could use to know when the button is pushed vs released. There’s nothing we can do about that, and if you want that feature, then send an email to ST support asking them to add endpoint data to the ZigBee event description parser. That would help for a lot more devices than just the Xiaomi Buttons.
So, again, all we get is “On/Off: 1” when the button is pushed. Then the device handler has to announce that as a SmartThings event so that it is recognized by SmartApps. In this case, the device handler now has two modes: Momentary, and Toggle. If it’s set to Momentary in the settings, then a button push produces a “pushed” event, with a delay (that you can set in the settings), followed by a “released” event.
This means if you’re using Momentary mode, whatever SmartApp you’re using to make things happen should be able to take action on a “pushed” or “released” event. The timing would depend on which one you use, and what delay you’ve set.
If you use Toggle mode, then the event for the button in SmartThings alternates between “pushed” and “released” every time you push the button. In that case, your SmartApp would have to be able to take different actions based on whether it sees a “pushed” or “released” event from your button.
If that isn’t going to work for WebCoRE or other SmartApps, then @ArstenA and us others helping to improve the device handlers will have to work out a different method for the device handler to provide a different labeled event, but also still have the same functionality (e.g., the virtual button tile). However, as far as I can tell, with the option of Momentary or Toggle modes, most people should be able to make use of the Xiaomi button.