Local web, MQTT and Home Assistant
Control the board on your home network without the cloud, through its web page, HTTP API, MQTT and Home Assistant discovery.
Everything on this page works without the cloud and keeps working when the internet is down. These local controls are not affected by the dashboard's Allow AI control setting.
Local web page
From a device on the same network, open:
http://edextron-xxxx.local/(xxxx = the board's last four ID characters, lower case). This works on Windows, macOS and iPhone, but most Android phones cannot open.localnames.http://<board IP>/. Find the IP in your router's client list or in the serial log. A DHCP reservation in your router keeps the IP from changing.
The page shows both relays, the light sensor, the optional button, the board's Device ID (edx- plus 12 hex characters), firmware, Wi-Fi, IP and MAC, the MQTT settings, and the WiFi setup and Restart buttons.
The page has no password. Anyone on your Wi-Fi can use it. Only use the board on a network you trust.
Local HTTP API
| Method | Path | Purpose |
|---|---|---|
| GET | /api/state |
Full state as JSON |
| POST | /api/output?type=relay&index=N&state=ON |
Switch relay N (1 or 2): ON, OFF or TOGGLE |
| POST | /api/mqtt |
Save MQTT host, port, user, pass (form fields) |
| POST | /api/setup |
Open the setup hotspot |
| POST | /api/restart |
Restart the board |
Example:
curl -X POST "http://192.168.1.50/api/output?type=relay&index=1&state=TOGGLE"
curl http://192.168.1.50/api/state
ESP32 DevKit: every POST (/api/output, /api/mqtt, /api/setup, /api/restart) must carry the header X-EDX-Setup: 1 and use the board's IP or .local name as the host, otherwise it answers 403. A web page on another site cannot send that header. For Home Assistant REST use headers: {X-EDX-Setup: "1"}:
curl -X POST -H 'X-EDX-Setup: 1' "http://192.168.1.50/api/output?type=relay&index=1&state=TOGGLE"
/api/output answers {"on":true} or {"on":false} with the expected new state. /api/state includes device_id, fw, ip, rssi, outputs, ldr, button, mqtt and a cloud object with paired and status. It never contains the device key or the MQTT password.
MQTT
You need an MQTT broker, for example the Mosquitto broker add-on in Home Assistant.
Enter the broker either in the setup hotspot (MQTT broker host, MQTT port, MQTT user, MQTT password) or later in the MQTT / Home Assistant section of the local web page, then press Save MQTT · บันทึก. Leave the password empty to keep the saved one. Clear the host and save to turn MQTT off.
Topics (<id> is the Device ID, for example edx-a1b2c3d4e5f6):
| Topic | Direction | Payload |
|---|---|---|
edextron/<id>/relay/1/set |
to board | ON, OFF, TOGGLE |
edextron/<id>/relay/1/state |
from board | ON, OFF (retained) |
edextron/<id>/relay/2/set, .../relay/2/state |
same for Relay 2 | |
edextron/<id>/ldr/state |
from board | light 0–100 % |
edextron/<id>/ldr/raw |
from board | 0–4095 |
edextron/<id>/button/state |
from board | ON, OFF |
edextron/<id>/rssi |
from board | Wi-Fi signal in dBm |
edextron/<id>/status |
from board | online, offline (last will) |
Home Assistant
With the MQTT integration set up in Home Assistant, the board announces itself through MQTT discovery (prefix homeassistant). Go to Settings > Devices & services and look for EDEXTRON XXXX, with:
- switches Relay 1 and Relay 2
- sensor Light (%)
- binary sensor Button
- diagnostic sensor WiFi signal (dBm)
When Home Assistant restarts, the board sends discovery and its current states again.
Cloud and local together
Local, MQTT and cloud control all go through the same code on the board, so they never fight over the relay. Every change is reported to the cloud, and the dashboard shows it live. Relay changes made locally are not listed on the Activity page, which only shows commands sent from the web dashboard and by AI keys.