This page explains how to run a logic circuit, watch it live, debug it and find out why it does not behave as expected. To build a circuit, start with Logic circuits; the gates are described in the Gates reference.
Debugging is a real execution. A circuit started with Debug > Start runs on the device: Write gates write to the field buses, e-mails and SMS are sent. Test with harmless addresses (internal addresses such as
$test) before you connect real outputs.
Open Circuits in the left menu. The editor has two tabs:
The menu button at the top left lists all the circuits of the device, with their state and their CPU and memory use. The user menu offers New circuit and Import circuit.
| Action | Where | Effect |
|---|---|---|
| Save | toolbar | Opens the Save as dialog. Keep the name to update the circuit. If the circuit is running, a confirmation is asked and the circuit restarts with the new version. |
| Save under another name | toolbar, Save as | Typing a new name creates a new circuit (stopped) with the current content; the original circuit is unchanged. |
| Start / Stop | Current status tab, Status panel | Starts or stops the saved circuit. The state is stored: a started circuit starts again automatically after a reboot of the device; a stopped circuit stays stopped. |
| Remove | toolbar | Deletes the circuit after confirmation. |
| Export | toolbar | See Import and export. |
A new or imported circuit is always created stopped.
Every restart of a circuit (save of a running circuit, stop and start, reboot) resets the values held on the links, the timers, the delays and the memory of the programmable gates. Initial values are sent again. To keep a value across restarts, store it in an internal address.
The Current status tab shows the saved circuit while it runs:
Panels at the top:
| Panel | Content |
|---|---|
| Status | Start / Stop button. |
| Cluster | Cluster enabled and the cluster ID, see Cluster option. |
| System resource | Process used and Memory used by the circuit. |
| Informations | In function since (uptime) and Started at. |
The console icon above a programmable gate opens its console: messages written by console.log() and errors of that gate.
The Debug panel of the Edition tab runs the circuit being edited, even if it is not saved yet:
| Button | Effect |
|---|---|
| Start | Runs the edited circuit on the device. Values appear live on the links, as in the Current status view, and you can click a value to send another one. |
| Pause / Continue | Suspends the whole execution, timers and delays included, then resumes it. |
| Stop | Ends the debug session. |
| Breakpoints | Shows a marker on every link. Enable the marker of a link to pause the circuit each time a value passes on it; use Continue to go on. |
Points to keep in mind:
Export (toolbar) offers three formats:
| Format | Content | Options |
|---|---|---|
.wbl |
The circuit file, to load on another device with Import circuit. | Circuit to export: the circuit being edited or the saved circuit. |
.svg |
Picture of the circuit (vector). | Width in pixel, Height in pixel (default 1024 × 600, minimum 600). |
.png |
Picture of the circuit (bitmap). | Same as .svg. |
Import circuit (user menu) loads a .wbl file as a new circuit and opens the save dialog with the file name as proposed name. The addresses used by the circuit must exist on the new device, or be reached through aliases (see Aliases).
A single programmable gate can be exported and imported as a .bloc file from its Advanced tab, see Programmable gate.
A
.wblor.blocfile can contain JavaScript that runs on the device with its rights. Import only files from a source you trust.
By default each circuit runs in its own process. In the Cluster panel of the Current status tab, check Cluster enabled and enter a cluster ID (a number): all the circuits with the same ID run in a single process.
| Separate processes (default) | Cluster | |
|---|---|---|
| Memory | One process per circuit. | One process for all the circuits of the cluster: less memory on devices with many small circuits. |
| Faults | A circuit that stops does not affect the others. | A fault in one circuit stops all the circuits of the cluster. |
| Crash record | The last crash of each circuit is recorded. | Not available per circuit. |
The cluster can be changed only while the circuit is stopped. After changing it, save the circuit before starting it.
| Symptom | Cause and what to do |
|---|---|
| The circuit is started but no gate runs | A programmable gate contains a syntax error; the error is displayed on that gate. As long as it is not fixed, the whole circuit stays blocked. |
| A gate does not execute although a value arrives | The gate waits until all its inputs hold a value (see Synchronization). Check the empty inputs (∅), especially those connected by consumable links. Also check that the gate is active (Gate active). |
| A Read or Write gate shows an error | The driver refused the request or did not answer (unknown address, stopped gateway, timeout). Enable Advanced mode on the gate to receive the error on its error output and react to it in the circuit. |
A Read gate in Last known value mode returns the error null |
The address has never received a value. Use Driver query, or wait for a first value. |
| A command is written minutes after the event, or on several gateways | Options Retry on error and Write to all addresses with this name of the Write gate, see Write. |
| The same address is written twice while debugging | The saved circuit is running at the same time as the debug session. Stop one of them. |
| A Timer gate set with a date shows ∞ and never runs | The date is in the past and has no joker *. |
| Counters and memories are back to their initial value | The circuit restarted (save, stop/start, reboot). Store what must survive in an internal address ($name); enable Store value on that address if the value must also survive a reboot of the device. |
| The circuit stopped after an internal error | It is restarted automatically, no sooner than one minute after its previous start. Look at the console of the programmable gates and at the last crash (below) to find the cause. |
| The circuit does not start again after a reboot | It was stopped before the reboot: the state is stored. Start it in the Current status tab. |
| The circuit does not start and reports missing license | The device has no licence for the logic module. See Licences. |
When you contact support, give the name of the circuit and, if possible, an export of it (.wbl). The following information helps:
getCrashLog, getStats);