Apps meet the physical world: sensors, actuators and IoT

· Cosimo Luigi Manes

Until now a Reactive app worked on data typed in, imported, or fetched from the open-data service. From today it can listen to the physical world: a temperature sensor publishing over MQTT, a Bluetooth scale, an ESP32 plugged into USB, an NFC tag, the phone’s accelerometer. And it can command it too: a switch in the document that turns on a real light. As always, everything runs in the browser: no server to install, no account, data stays on the device.

The principle: readings are data like any other

Every IoT directive pours its readings into the reactive store — a key for the latest value, a collection for the history — and from there everything Reactive already does applies: tables, aggregations, conditionals, Python charts, even the AI directives that summarize or answer questions about the data. A thermometer becomes a chart in three lines of text:

::mqtt-sub[temp]{topic="home/living/temp" into="readings"}

Now: :value[temp] °C — average :avg[readings]{field="value"}

::python{data="readings"}
import matplotlib.pyplot as plt
plt.plot([float(r["value"]) for r in data["readings"]])
::/python

MQTT: the universal channel

MQTT is the lingua franca of IoT — Home Assistant, Tasmota, ESPHome and virtually every microcontroller speak it. Three directives bring it into documents, in every browser:

The broker is declared once in the frontmatter (mqttServer: wss://...) and only endpoints travel in the document — never credentials — the same principle as sync keys.

Bluetooth, serial, NFC: the device in front of you

For nearby objects you don’t even need a broker:

The browser acts as the guarantor: Bluetooth, serial and NFC start only from a user click, never automatically.

What about REST? ::iot-poll

For devices exposing an HTTP API (Shelly, Tasmota, or any JSON service) there’s ::iot-poll: it polls the endpoint at regular intervals and keeps the collection aligned with the current state. One practical caveat: the app is served over HTTPS, so local-network http:// endpoints are blocked by the browser — for local traffic the MQTT broker remains the main road.

What you can build

As with the rest of the platform, the editor helps: the new directives are in the autocomplete (with attributes and descriptions) and the AI assistant knows them and suggests them when you describe an app that talks to devices.

All the details are in the syntax guide and the directives guide.