The logic module, by the elaboration of simplified logic circuits, is a powerful tool that lets you program the universal IoT gateway as a PLC (Programmable Logic Controller). There is no fixed hard limits in terms of logic gates and number of circuits. With the aid of our web interface, it is easy to construct circuits which perform complex operations / interactions between different IoT/building automation protocols. The example below ( Figure 1 ) illustrates how a simple task can be performed easily without requiring prior knowledge in computer programming.
Sending e-mail and SMS alerts. There is no dedicated alert gate: an alert is sent with a Write gate. The value received on its input is the text of the message and its address is the recipient:
- e-mail: an e-mail address such as
john@example.com(several recipients separated by commas; an optional subject can be appended after a colon, e.g.john@example.com:Storm alert). A gateway of type SMTP client must be configured and started, see the SMTP driver.- SMS:
%sms:followed by the phone number, e.g.%sms:+41791234567. An SMS gateway must be configured and started, see the SMS driver.
Main functionalities offered by the logic module :
The logic module is documented on four pages:
Table of content :
3. Troubleshooting (see also Running, monitoring and troubleshooting circuits)
The following series of steps and screenshots is a quick tutorial that shows how to use the interface to create a new logic circuit. In this tutorial a counter incrementing its value every 10 seconds is implemented. The counter value is stored in the internal address $counter, so to make the circuit work without errors it is necessary to first insert a gateway of type internal, and then start it (refer to the gateways introduction page for this preliminary step).
$counter in the Read and Write gates.1 on the second input of the Calcul gate and 0 on the input of the Write gate), or to set an Inversion (none / binary / additive / multiplicative).







Details on the Current status view, debug mode and breakpoints, export (.wbl, .svg, .png), import and the cluster option: Running, monitoring and troubleshooting circuits.
The Weble circuits are an extension of standard logic circuits. They take and extend their functionalities by using simple but effective mechanisms.
The circuits are composed of gates ( Section 2.1 ) connected together by directional links ( Section 2.2 ), carrying values ( Section 2.3 ) and hence triggering the execution.
The interaction with the field buses and devices (KNX, Modbus, BACnet, MQTT, the physical inputs/outputs of the device through the IO driver, internal addresses, ...) is done through an address system ( Section 2.4 ).
The advanced applications are showed on the last section of this chapter ( Section 2.5 ). Their utilization requires some programmation skills, but allows to solve any use case.
The circuits include around twenty different gates ( Table 1 ), each having several configurable parameters. This flexibility of configuration allows to easily create complex automatisms.
The gates are divided into the following categories :
Logic gates :
Triggers ( Section 2.1.3 ) : the triggers wait the realization of an event to start the execution of actions. Moreover, they allow to perform scheduled tasks or to capture telegrams passing on the KNX bus.
Actuators ( Section 2.1.4 ): the actuators allow performing concrete actions as writing on the KNX bus and sending SMS and/or emailing alerts.
Flow controllers ( Section 2.1.5 ) : the flow controllers act as referrals, helping to control and synchronize the execution flows on the circuit.
Other gates ( Section 2.1.6 ) : this last category includes annotations (visual and informative effects) and more advanced gates as the programmable gate.
| Gates by Groups | ||||
|---|---|---|---|---|
| Logic gates | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
||
| Triggers | ![]() |
![]() |
![]() |
|
| Actuators | ![]() |
![]() |
![]() |
|
| Flow Controllers | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
|
| Other Gates | ![]() |
![]() |
![]() |
![]() |
The parameters of every gate, with their default values, are described in the Gates reference. The sections below give an overview of each category with examples.
The AND, OR and XOR gates are the graphical representation of the basic boolean functions, in European or American style. They accept more than two inputs, and their inputs and outputs can be inverted ( Figure 2 ). Truth tables and the exact output value: AND, OR, XOR.

The extended logic gates handle numbers and texts as well as boolean values: NOT (binary, additive or multiplicative inversion), Constant (replaces the value by a fixed one), Calcul (sum, product, average, minimum, maximum, comparisons) and Expression (free formula, see Section 2.5.3). The + operation of the Calcul gate also concatenates texts ( Figure 3 ). Parameters: Logic gates.
Triggers start an execution when an event happens. They are drawn as circles: Address (a new value on an address), Timer (a period, a date or a cron schedule, see Section 2.5.2) and Receiver (a value sent by an Emitter gate, in the same circuit or in another one). Parameters: Triggers.
Actuators act on addresses, whatever the protocol. They are drawn as diamonds: Write (writes the value received to an address; an e-mail address or %sms: number sends an alert), Read (reads an address when a value arrives) and Emitter (sends the value to the Receiver gates of a channel). New Write gates have the options Retry on error (last value) and Write to all addresses with this name enabled. Parameters: Actuators.
Flow controllers route, filter and time the values in the circuit: Join, Split, Switch, Output selection, Input selection, Filter, Delay and Buffer. The figures below show practical examples. Parameters: Flow controllers.



Annotation and Group document the circuit and have no effect on the execution. Fusion builds an array from several values and Scission splits an array into its elements (see Section 2.3.3). The Programmable gate runs your own JavaScript code (see Section 2.5.4). Parameters: Other gates.
The links connect the different ports and transmit the execution through the circuit. There are three kinds of links:
These three link types have different properties that can importantly impact the synchronization of the circuit execution flow ( Section 2.2.4 ).

The memory link stores always its current value. Once executed, the old value is overwritten by the new one.

The passive memory link is similar to the normal memory link, but it transmits the execution only if the new value received is different from the old one. For instance, switch of 0 → 1 (incremental flow) or of 1 → 0 (reducing flow) are executed, but repeated executions of the same value such as 1 → 1 are prevented.

The links connecting the gates can be empty. In this case, the absence of values is marked with the sign ∅. The consumable links, (contrary to the memory links), lose their value (it becomes ∅) when the value is consumed by the targeted gate (i.e. the gate receiving the link end on one of its inputs). A gate normally consumes its inputs when it gets executed and outputs a value, which resets all the consumable links connected to its inputs.
Before the execution, the gates have to wait for each of their inputs to have a defined value. In other words, if one of the inputs of a given gate is not defined (∅), then its output is not executed (the execution is not propagated to the output link). Figure 7 below shows the use of consumable links to implement a counter.

The circuits are not only limited to Boolean values (0, 1). Three main types of values can transit through the links :
Numbers : binary (0, 1), integers, or real numbers such as -1.23 ( Section 2.3.1 )
Strings : textual values such as "example of string" ( Section 2.3.2 )
Arrays : JSON like objects (arrays and associative arrays) such as [0, 1, example of string] ( Section 2.3.3 )
As for the industry traditional logic circuits, these values can be reverted on the inputs and outputs of the ports ( Section 2.3.4 ).
The internal representation of the numbers is always in a double-precision binary floating-point format (64 bits) according to the international standard IEEE 754. In the UI, it is coloured in red.
Regarding the syntax, many different notations are possible :
Decimal numbers : 0.01, 10.00, -10.505
Integers (base 10) : 0, 1, 2, -2, 123456
Hexadecimal integers (base 16) : 0xFF ( = 255), 0x12 ( = 18), 0xA ( = 10), -0xA ( = -10)
Octal integers (base 8) : 001 ( = 1), 00100 ( = 64), 0077 ( = 63), -0077 ( = -63)
Scientific notation : 1e2 ( = 100), -1.2e-2 (= -0.012), 0.0023e+4 (= 23)
Special values : PI ( = 3.141…), E ( = 2.718…), ∞, Infinity, NaN (Not a Number)
Computational expressions : (sin(PI/4)+0.5)*2 ( = 2.414…), sqrt(5)+log(10) ( = 4.538…). Operators: + - * / % and ^ (power). Functions: sin cos tan asin acos atan atan2 sqrt exp log (natural logarithm) log10 or lg (base 10) abs ceil floor round min max pow random fac (factorial) pyt (hypotenuse). Constants: PI E SQRT2 SQRT1_2 LN2 LN10 LOG2E LOG10E. Other JavaScript functions are available only in the Expression gate ( Section 2.5.3 ).
Strings are used to represent textual values. In the UI, it is for most cases strings coloured in blue.
Strings representing system gateway (KNX, modbus, Bacnet, ...) addresses are coloured in green such as the KNX group address 3/2/1 or the modbus register %M1 (see Section Section 2.4 for more information about addresses).
The date format used for the planification of the tasks ( Section 2.5.2 ) is also a string. Those dates are coloured in violet such as 14:00 7.09.2023.
When a string can be mistaken for a number, it is necessary to encompass it between quotation marks (" or ') in order to avoid ambiguities: PI vs "PI", 1.23 vs '1.23', sqrt(5)+log(10) vs 'sqrt(5)+log(10)'.
Strings, using the addition sign (+), can be concatenated to one another, or with numbers, in order to compose new dynamic strings ( Figure 3, Figure 5 ).
Arrays allow to transmit several values through the same link. There is two different kind of arrays :
Simple arrays : those are delimited by square brackets [ … ]. The value are separated by commas and each value is referenced according to its position on the table.
Example: [ 1, 2, %M2, [ 3, 4 ] ].
Associative arrays : those are delimited by curly brackets { … }. The values are separated by commas and referenced by keys.
Example : { n: 1, m: 2, modbusRegister: %M2, subArray: [ 3, 4 ] }.
By extension of the standard logic circuits, you can revert the values received as inputs of the ports as well as those sent as outputs.
There are three kinds of inversion :
Binary inversion : 1 → 0, 0 → 1. By extension a value that is defined and not empty or 0 is transformed to 1, and a value that is not defined or empty or 0 is transformed to 0.
Additive inversion : x → -x. Adds the minus sign in front of the number (only works with values of type number).
Multiplicative inversion : x → 1/x. Returns 1 divided by the value x (only works with values of type number).
| Value | Binary inversion | Additive inversion | Multiplicative inversion |
|---|---|---|---|
The « Write » and « Read » actuator gates allow to read and write on the addresses. Using logic module you can treat any address types (refer to the drivers page for the complete list). The Read, Write and Address gates accept any address of any started gateway: type the address exactly as it appears in the address table of the gateway (for example 1/2/3 for a KNX group address, %M1-2 for holding register 2 of Modbus slave 1, $counter for an internal address). The address syntax of each protocol is described on the page of its driver: KNX, Modbus, Internal, all drivers.
The following sections show simple examples using various kinds of addresses:
KNX addresses (Sections 2.4.1 and 2.4.2) : reads, writes, and captures KNX telegrams on the bus.
Modbus addresses ( Section 2.4.3 ) : supports modbus RTU, modbus ASCII, and modbus TCP, and both roles (slave or master).
Internal addresses ( Section 2.4.4 ) : permits to store any kind of values internally.
Finally the last section ( Section 2.4.5 ) describes how to give an address an alias (alternative name) and discusses the advantages of using aliases in place of raw address names.
KNX devices communicate through telegrams sent on group addresses. The logic module writes them with three levels, main/middle/sub, such as 1/2/3 ( Figure 9 ). The circuits can react to the telegrams flowing on the bus (Address gate), write telegrams (Write gate) and send a read request and receive the answer (Read gate). The other notations accepted and the configuration of the gateway are described on the KNX driver page.
The participants (sensors and actuators) communicating on the KNX bus always have a physical address. A physical address is of the type n.n.n (such as 1.2.3) where the number usually represents a real topology of the building. A physical address is assigned to each device during the configuration / integration phase of the project. Restarting (reboot) a participant can be done from a circuit using its physical address ( Figure 11 ).
Modbus has 4 types of addresses (the complete syntax, including bit access, is on the Modbus driver page):
%M followed by the register number such as %M0, %M1, %M2, ..., %M65535. If we act as the master, the slave number can be specified in the address such as %M1-1 is the register 1 of the slave number 1, and %M2-1 is the register 1 of the slave number 2.%Q followed by the register number such as %Q0, %Q1, %Q2, ..., %Q65535. If we act as the master, the slave number can be specified followed by the register number: %Q1-1, %Q2-1, ...%MX followed by the coil number such as %MX0, %MX1, %MX2, ..., %MX65535. In the same way as for registers, the slave number can be added in the address.%QX followed by the input number such as %QX0, %QX1, %QX2, ..., %QX65535. In the same way as for registers, the slave number can be added in the address.
Conversely to the other addresses, the virtual addresses are not transmitted on a field bus. These addresses are only for internal uses. They are useful internally to store values, computations, and transmit values between different logic circuits. The internal addresses start with a $ sign, such as $x, $y, or $test123.
No matter the nature of an address (KNX, Modbus, internal, ...), it is possible to define an arbitrary alias (alternative name) for each address. (Note that two or more different addresses can share the same alias for grouped actions.) The rules for aliases are described in Addresses › Aliases.
Aliases are running on Views, which is an advanced system that permits to design dynamic alternative address names. Figures 13, 14, and 15 show how to activate and configure the aliases (here the example is on a gateway of type internal, but it could have been of any types (KNX, Modbus, Bacnet, ...).



Setting up aliases adds an extra level of indirection/abstraction to the addressing scheme. It presents the following advantages for your logic circuits:
Clarity: allows to explicit the meaning of an address on the logic circuit. For instance if the KNX group address 1/1/1 is configured to turn on or off the lights of a room, for readability it is clearer to refer to it by using an alias light_room_1 which conveys more information to the user / technician.
Portability: allows to transfer the logic circuits from one location to another, even if the KNX addresses used are different. For instance, if the wind speed measured by an anemometer is transmitted on 0/2/0 to the location A and on 0/2/3 to the location B, then for portability reasons it is more practical, on the two cases, to access to it by using the common alias wind (see Figure 16 below).

A, and gateway B), and in each of the two buses the wind speed is measured and communicated on the group address 0/2/0, then it is possible to distinguish the addresses by assigning to each a different alias, as shown in Figure 17. (Note that it is also possible to solve a name conflict without aliases. With the special character ¬ it is possible to define the gateway name in the address name, such as A¬0/2/0 is the knx group address 0/2/0 of the gateway named A, and B¬0/2/0 is the same address, but the one used on the KNX line B).
gatewayName¬address. Note that a single address can have several aliases, separated by the character ¬ in the alias column (the alias X¬Y¬Z gives the three aliases X, Y and Z).
The command of the advanced features requires more skills but allows to operate in all kinds of situations. The following topics will be covered :
The advanced mode ( Section 2.5.1 ), which is present on some of the gates, displays previously hidden advanced inputs/outputs. The advanced mode enables more features and dynamic control of some gate parameters.
The tasks scheduling ( Section 2.5.2 ), which explains how to schedule unique or periodic tasks.
The advanced expressions ( Section 2.5.3 ). This section shows more powerful ways of using the « Expression » gate.
The programmable gate ( Section 2.5.4 ), with which you can create your own custom gates in JavaScript.
The advanced mode, when it is activated on a gate, adds inputs/output to the gate. It lets you dynamically control the gate during the circuit execution : enable it, disable it, pause it, or change its parameters. The following gates support the advanced mode :



The task scheduling can be done by using the « timer » gate. The timer gate includes different kinds of values ( Figure 22 ) :
A number: repeats the action every x seconds / minutes / hours / days, according to the Time unit parameter. The Timer gate has no millisecond unit; use a Delay gate for sub-second timing.
The dates ( Table 11 ), allowing the scheduling of a task at a defined date.
The cron format ( Figure 23, Table 10 ), which is the format used by UNIX OS for scheduling recurring tasks.
A date in which every field is fixed and which is already in the past is never executed (the gate displays ∞). Use the joker
*for recurring schedules, for example12:00 25.12.*for every 25th of December at midday.
The expression gate is not limited only to simple formulas as (a+b)/2. An expression is first evaluated by the built-in math parser and, when it is not a pure mathematical formula, by the JavaScript engine. This gate makes possible a number of operations on the values :
Logic operations and comparisons. For instance : (a > b && a > c) || a == 0 returns 1 if a is bigger than b and c, or if a equals 0. Otherwise it returns 0.
Ternary operator: a == b ? 10 : -10 returns 10 if a equals b, and otherwise -10
Call native JavaScript mathematical functions such as : acos(x) asin(x) atan(x) atan2(y,x) ceil(x) cos(x) exp(x) floor(x) log(x) max(x,y,z,...,n) min(x,y,z,...,n) pow(x,y) random() round(x) sin(x) sqrt(x) tan(x)
Call string functions such as : charAt() concat() indexOf() lastIndexOf() match() replace() search() slice() split() substr() substring() toLowerCase() toUpperCase() trim()
Use regular expressions : /eat.*cheese/.test("I eat swiss cheese") returns 1.
Call functions to work on arrays : concat() every() filter() join() map() reduce() reduceRight() reverse() slice() some() sort() …
Figure 24 shows how to work on an array of values using expressions.
And many other applications...

The programmable gate lets you create your own gates in JavaScript: any number of inputs, outputs and parameters, a code run at start and a code per input, access to every address of the device through Gateways, timers, and a set of Node.js modules. Gates can be exported and imported as .bloc files. Figure 25 shows a counter.

The complete reference, with the available objects, the rules of execution, the allowed modules and examples (counter, hysteresis, PID, PWM, sun gate, watchdog), is on the page Programmable gate: JavaScript reference.
The code of a programmable gate runs on the device with the rights of the device. Only import gates from a source you trust, and give the right to create or modify circuits only to trusted accounts.
The most frequent cases:
The complete troubleshooting table is on the page Running, monitoring and troubleshooting circuits.