LAN Control
LAN Control (direct local-network communication between the dashboard and devices without cloud routing) is not currently supported.
All device communication goes through the Vwire cloud over MQTT/TLS. This ensures reliable connectivity regardless of network topology and does not require devices to expose any local HTTP or WebSocket server.
If you have a requirement for air-gapped or low-latency local control, please contact support.
LAN Control
LAN Control lets the VWire dashboard communicate directly with devices on the same local network — without going through the cloud server. This is useful when:
- Internet connectivity is unavailable or unreliable
- You need sub-100 ms command latency
- You operate an air-gapped network
- You want to reduce cloud bandwidth costs
How it works
Dashboard (browser) ──HTTP/WS──▶ Device (local IP:port)
↕
(also connected to VWire cloud)
The device runs a local HTTP + WebSocket server. The dashboard detects the device's local IP (reported via cloud), connects directly over LAN, and sends commands without round-tripping through the cloud.
Enable LAN Control in firmware
#include <VWire.h>
#include <VWireLAN.h>
VWireLAN lan(vwire, 7777); // port 7777
void setup() {
Vwire.begin(SSID, PASSWORD);
lan.begin(); // start local HTTP + WS server
// Advertise local IP to VWire cloud (for dashboard auto-discovery)
char localIp[20];
WiFi.localIP().toString().toCharArray(localIp, 20);
vwire.setDeviceInfo("lan_ip", localIp);
vwire.setDeviceInfo("lan_port", "7777");
}
void loop() {
Vwire.run();
lan.run(); // handle local HTTP/WS requests
// ...
}
Dashboard configuration
- Go to Device → Settings → LAN Control.
- Toggle Enable LAN Control.
- The dashboard will attempt to connect via LAN when both browser and device are on the same subnet.
The status indicator shows:
- 🟢 LAN — connected locally (fast)
- 🔵 Cloud — connected via VWire cloud (normal)
- 🔴 Offline — no connection
Command routing priority
LAN available?
YES → send command via LAN WebSocket (< 5 ms latency)
NO → fallback to VWire cloud MQTT (< 200 ms latency)
The dashboard switches automatically — no user action needed.
LAN API endpoints (on device)
When LAN Control is enabled, the device exposes:
| Endpoint | Method | Description |
|---|---|---|
/status | GET | Device status, uptime, firmware version |
/v/{pin} | GET | Read current pin value |
/v/{pin} | POST | Write value to pin |
/ws | WS | Subscribe to real-time pin updates |
Example:
# Read V0 over LAN
curl http://192.168.1.105:7777/v/0
# Write 1 to V1
curl -X POST http://192.168.1.105:7777/v/1 -d '{"value":"1"}'
Security on LAN
By default, LAN Control uses no authentication (LAN is considered trusted).
To enable token-based auth on local requests:
lan.setAuthToken(DEVICE_TOKEN); // require X-VWire-Token header
Notes
If the device's IP changes (DHCP lease renewal), the dashboard may need a manual refresh or enable mDNS:
#include <ESPmDNS.h>
MDNS.begin("greenhouse-sensor"); // accessible at greenhouse-sensor.local