UI Plugin - Hello World¶
A minimal demonstration of the ScriptO UI Plugin Architecture. This ScriptO registers an HTTP route on your device and displays a custom web interface in a modal window within ScriptO Studio.

Features¶
- Device-served UI - HTML/CSS/JS served directly from your ESP32
- Iframe integration - Studio displays the UI in a modal
- Zero Studio changes - No code changes needed in ScriptO Studio
- Full web capabilities - Use any web technologies in your plugin UI
How It Works¶
- The ScriptO registers an HTTP route (
/hello_ui) on the device - A
display_uicommand is sent to Studio via WebREPL - Studio opens an iframe modal pointing to the device's HTTP server
- The UI is served directly from the ESP32
Running the ScriptO¶
- Connect to your device in ScriptO Studio
- Open ScriptOs → UI Plugins → UI Plugin - Hello World
- (Optional) Customize the window title in the configuration
- Click Run
- The Hello World UI appears in a modal window
Configuration Parameters¶
| Parameter | Type | Default | Description |
|---|---|---|---|
ui_title |
string | "Hello World from ScriptO" | Title shown in the modal window |
Optional: Trust Device Certificate (macOS)¶
When running UI Plugins, Chrome may show a "Not Secure" warning in the URL bar because the device uses a self-signed HTTPS certificate. This is cosmetic and doesn't affect functionality, but you can eliminate it by trusting the device certificate:
- In ScriptO Studio, open Files and navigate to
/certs/ - Download
servercert.pemto your Mac - Double-click the
.pemfile → Opens Keychain Access - The certificate is added to your "login" keychain
- Find the cert in Keychain Access, double-click it
- Expand the Trust section
- Set "When using this certificate" to "Always Trust"
- Close the dialog (enter your password when prompted)
- Restart Chrome
[!NOTE] Each device has a unique self-signed certificate. You'll need to repeat this process for each device you want to permanently trust.
Creating Your Own UI Plugin¶
Use this ScriptO as a template for creating your own UI plugins:
import httpserver
import webrepl_binary as webrepl
import network
import json
from lib.sys.utils import getDeviceURL
def my_ui_handler(uri, post_data=None, remote_addr=None):
"""HTTP handler that returns your custom HTML."""
html = """<!DOCTYPE html>
<html>
<head>
<title>My Custom UI</title>
<style>
/* Your CSS here */
</style>
</head>
<body>
<h1>My Custom UI</h1>
<!-- Your content here -->
<script>
// Your JavaScript here
</script>
</body>
</html>"""
httpserver.send(html)
# Register the HTTP route
httpserver.on('/my_ui', my_ui_handler, 'GET')
# Tell Studio to display the UI
url = getDeviceURL('/my_ui')
webrepl.notify(json.dumps({
"display_ui": {
"url": url,
"title": "My Custom UI"
}
}))
Key Functions¶
| Function | Module | Purpose |
|---|---|---|
httpserver.on(path, handler, method) |
httpserver |
Register HTTP route |
httpserver.send(content) |
httpserver |
Send HTTP response |
getDeviceURL(path) |
lib.sys.utils |
Get device URL with correct protocol and hostname |
webrepl.notify(payload) |
webrepl_binary |
Send command to Studio |
Related¶
- Writing Extensions - Create full JS extensions with sidebar tabs
- WebREPL Binary Protocol - Protocol details