Repository navigation
Control edit
Control catalogue · Documentation home

Minimal field JSON:
{
"id": "label",
"type": "edit",
"name": "Label"
}Full field JSON:
{
"id": "label",
"type": "edit",
"name": "Label",
"default": "Room"
}Properties in the full example:
| Property | Required? | Meaning / default |
|---|---|---|
id |
Required | Stable application key; unique across registered pages. |
type |
Required | Enabled field type. |
name |
Required title¹ | Display title; may be replaced by a nonempty names object. |
default |
Optional | Omit to use the built-in initial value. |
¹ name can be replaced by names. Other shared optional properties are listed in the catalogue.
Appearance: Rounded editable text input
Value: String, at most 128 bytes
Changes are sent automatically; MQTT accepts the text directly. Embedded NUL bytes are rejected.
MQTT component: text. Requires the control’s feature flag, dynamic pages, MQTT and HA support to be enabled. ArdPortal registers MQTT Discovery and routes state/commands; the sketch implements device behavior. Action callbacks acknowledge acceptance, not physical completion.
Supported by ArdPortal: Editable string state and commands; Discovery advertises a 0–128 length range and ArdPortal validates up to 128 UTF-8 bytes without embedded NULs.
Not provided by the built-in integration / limits: No built-in password mode, regular-expression pattern, multiline HA editor, or typed numeric measurement behavior. Additional ha metadata does not change the 128-byte application validation limit.
Explicit ha properties can override Discovery metadata. They do not create additional hardware behavior, application value properties or command handlers by themselves. See HA integration for the shared setup.
Status: not mapped by ArdPortal. Editable text/string writes are not mapped to a Zigbee cluster. Enabling Zigbee does not create an endpoint for this field. The field remains usable in the portal and through MQTT/HA when those features are enabled.
This describes the current ArdPortal implementation, not a claim that Zigbee cannot represent a similar device through a standard cluster or a gateway-specific converter.
Possible extension, not implemented: Writable ZCL character-string attribute. ZCL can carry a string, but there is no portable generic editable-text control from combining the existing On/Off/Analog/Multistate clusters. A manufacturer-specific attribute/model and gateway converter could preserve this value; bounds and read/write behavior must be defined. See the mapping feasibility table.
See Zigbee integration for pairing, endpoint lifecycle, gateway limitations and OTA requirements.
These examples use the field ID from the JSON above and an existing ArdPortal portal. Run them after page registration has finished and portal.portalAndAppConfigReady() is true. Call portal.loop() frequently. Register callbacks once in setup(); do not repeat setters on every loop iteration.
Set "persist": true on this field in its page JSON. It is optional for editable fields whose preset already persists settings, but required to override a RAM-only preset such as a sensor. Calling setAppConfigValue() sets the control value and ArdPortal automatically saves AppConfig through its integrated ArdFS storage. Do not create an ArdFS object or call a separate write/flush method. The automatic save is coalesced and advanced by subsequent portal.loop() calls.
// Use this path when the value is a setting that should survive restart.
ArdJSON::JSONVar next = "Room";
if (!next.isValid() || !portal.setAppConfigValue("label", next)) {
Serial.println("Setting rejected or storage temporarily unavailable");
}true from the setter means acceptance, not a completed flash write. Configure this callback once to observe the result:
portal.onPortalAndAppConfigSaved([](bool ok, const String& error) {
if (!ok) Serial.println(error);
});// Use this alternative for live readings/status; never writes ArdFS.
ArdJSON::JSONVar next = "Room";
if (!next.isValid() || !portal.setAppConfigStateValue("label", next, false)) {
Serial.println("Runtime value rejected");
}The third argument false avoids queuing an immediate MQTT publication. Use true or omit it to queue changed state. RAM updates work regardless of persist. Alternatively, with "persist": false, setAppConfigValue() also follows the RAM-only path.
const ArdJSON::JSONVar current = portal.getAppConfigValue("label");
if (!current.isUndefined() && current.isValid()) {
Serial.println(ArdJSON::JSON.stringify(current));
}The getter returns the effective field value: RAM override first, then saved AppConfig, then the definition default. A RAM-only update is lost on restart; the saved value/default becomes effective again. Choose the persistent or RAM path for a given value. A RAM override can mask a later persistent change for the same ID; there is no API to clear just that override. Prefer separate setting and telemetry IDs when both are needed.
ArdPortal · ArdFS · ArdJSON — Source · Releases · MIT license