app-button
Description
The app-button block provides a virtual button in the mobile application and in the web interface, linked to the project logic.
When the user clicks this button, its state is not toggled permanently. Instead, the block generates a short logical pulse on its output. This allows app-button to be used as a button that triggers a scene, a one-time action, or another event in the logic.
The block has one input and one output. The input is used to set the state presented to the user as on or off. The output is used only to report clicks made in the mobile application or in the web interface.
After the block is added to the project, an associated virtual device representation is also created, so the button is visible outside the logic diagram itself.
Configuration parameters
| Parameter name | Value |
|---|---|
name |
Optional parameter. Defines the name visible to the user in the mobile application and in the web interface. The absence of this parameter does not prevent the block from working. |
default_on |
Required boolean parameter with values true or false. Defines the button state visible after the project starts, before the first valid boolean value reaches the block input. |
Input handling
The block reacts only to boolean values true and false delivered directly to its input. It does not use inputs labeled with the tag block.
Detailed operating rules:
- the value true sets the button state visible in the mobile application and in the web interface to
on - the value false sets the button state visible in the mobile application and in the web interface to
off - an input state change updates only the button state shown to the user and the description visible below the block
- an input state change does not send any event to the output
- values other than boolean ones, such as numbers, text, commands sent from the
commandblock, ornull, are ignored - after the project starts, the block takes the initial state defined by the
default_onparameter
The description visible below the block shows the current state and the number of clicks made by the user, for example off, clicks: 0 or on, clicks: 3.
The click counter increases only after the button is clicked in the mobile application or in the web interface. A change of the value at the block input does not increase this counter.
Block outputs
The block has one output.
Each click made by the user in the mobile application or in the web interface generates a short logical pulse:
- first, the output changes to true
- immediately afterwards, the block sends the value false
This means that a single button click causes the false -> true -> false sequence on the output. Such a signal may be used, for example, to trigger further one-time actions in the logic.
After the project starts, the block sets the output to false.
Errors returned by the block
The block can return the following errors:
| Error code | Error description |
|---|---|
Missing default_on configuration. |
The default_on parameter was not provided or has an invalid value. Without this configuration, the block does not know which initial state should be presented to the user. |
Usage examples
- If
default_on = false, after the project starts the button will be visible asoff, and the description below the block will showoff, clicks: 0. - If the value true is delivered to the block input, the button in the mobile application and in the web interface will change its state to
on, but no new signal will appear on the output. - If the user clicks the button visible in the mobile application or in the web interface, the block will send a short true pulse to the output, followed by false.
- If after three button clicks the input still has the value false, the description below the block will be
off, clicks: 3. - If a number, text, a command sent from the
commandblock, ornullreaches the input, the event will be ignored.