“The Button” is a scene controller from https://www.fibaro.com/en/products/the-button/Fibaro. If you are running the new Vera interface then you can receive the central scene event with a different button value for each number of presses of “the button.” The original Vera interface to XTension does not support this device. As of 12/4/2018 the Vera itself will not handle the press and hold action, but the button presses from 1 to 5 times are supported.
After adding The Button to your Vera you will get a new unit in XTension that represents it. The type of this unit will be set to “Scene Controller.” The actual on/off state of the unit is not used, the events will be sent to a central scene handler which you need to create in the On script of the unit.
Open the edit unit dialog for the new unit and check the “Ignore Central Scene Gesture” checkbox in the Device Options panel. The Button sends a different button value with each number of clicks so it is not necessary to retrieve the gesture code as well. Since retrieving the gesture code is a separate request to the Vera you will get the script event faster without it having to make it.
Create an On script for The Button unit and use the “insert…” toolbar button to insert a central scene handler. You’ll get a generic central scene handler with some comments to explain what it does and a single write log line that shows what button was pushed and with what gesture. The gesture is normally where you would find information like, single click, double click, triple click, etc, but since The Button sends a different button code for each combination of clicks and we have checked the Ignore checkbox above that value will be empty.
In order to trap the different clicks you can check the button value in the script and perform whatever actions you like based on that value. The button parameter will contain the number of clicks 1 through 5.
on centralScene( theButton, theGesture) if theButton = “1” then write log “the button was pressed once" else if theButton = “2” then write log “the button was pressed twice" else if theButton = “3” then write log “the button was pressed three times" else if theButton = “4” then write log “the button was pressed four times" else if theButton = “5” then write log “the button was pressed five times” else write log “unknown Fibaro button code: “ & theButton end if end centralScene
Replace the write log commands in the script above with whatever actions you’d like to take in response to the clicking of the button.