HTTP API
The web interface uses a small JSON API on port 80. You can use it for scripts and other home automation systems as well.
/events) requires HTTP basic authentication with user admin. The OTA page has its own login (admin / admin).Overview
| Route | Method | Purpose |
|---|---|---|
/ | GET | Web interface |
/status | GET | Door state, sensors, digital I/O |
/statush | GET | Raw door state |
/command | GET | Door and light commands |
/io | GET | Switch a digital output |
/config | GET / POST | Read / write the configuration |
/sysinfo | GET | Diagnostics |
/events | GET (SSE) | Live sensor and I/O changes |
/reset | GET | Factory reset: erases all settings and restarts |
/update | GET / POST | OTA firmware update page (ElegantOTA) |
GET /status
{
"doorstate": "open",
"valid": true,
"targetPosition": 100,
"currentPosition": 100,
"light": false,
"state": 0,
"busResponseAge": 0,
"lastModbusRespone": 123456,
"swversion": "1.1.0",
"sensors": { "_failed": [], "temp": "21.4 °C", "dist": "38 cm", "free": "false" },
"sensor_status": { "BME280": "active", "DS18X20": "off", "DHT22": "off",
"HC-SR04": "active", "HC-SR501": "off", "MQ4": "off" },
"io": { "in1": false, "out1": true },
"lastCommandTopic": "hormann/hcpbridge/command/door",
"lastCommandPayload": "open"
}
| Field | Meaning |
|---|---|
doorstate | Detailed state: open, closed, opening, closing, open h, opening h, opening v, venting, stopped |
valid | true once the operator has talked to the bridge |
currentPosition / targetPosition | 0 (closed) … 100 (open) |
light | Operator light on |
state | Numeric state: 0 open, 1 opening, 2 closed, 3 closing, 4 half open, 5 moving to vent, 6 vent, 7 moving to half, 8 stopped |
busResponseAge | Seconds since the last bus request (−1 = none yet) |
sensors | Values of the enabled sensors incl. unit; keys of failed sensors are listed in _failed. free: "true" = parking space available. |
sensor_status | active, disabled (failed) or off per sensor |
io | Only present when at least one channel is enabled |
lastCommandTopic / …Payload | Last MQTT command received |
GET /statush
Compact door state straight from the bus handler: valid ("true" if the last bus request is younger than 2 s), targetPosition, currentPosition, light, state (text) and busResponseAge.
GET /command
action | Effect |
|---|---|
| 0 | Close |
| 1 | Open |
| 2 | Stop (only while moving) |
| 3 | Ventilation position |
| 4 | Half-open position |
| 5 | Toggle light |
| 6 | Restart the bridge |
| 7 | Drive to position (0–100; ≤ 5 closes, ≥ 95 opens) |
| 8 | Toggle: open if not fully open, otherwise close |
curl "http://192.168.1.42/command?action=1"
curl "http://192.168.1.42/command?action=7&position=40"
curl -u admin:secret "http://192.168.1.42/command?action=5" # with web password
Returns OK (text/plain).
GET /io
Parameters output (1 or 2) and state (on/1/true, off, toggle). Returns 200 OK, 400 when a parameter is missing and 404 when the output is not enabled.
curl "http://192.168.1.42/io?output=1&state=toggle"
GET / POST /config
GET returns all settings as JSON (keys as in the configuration reference); passwords are returned as "*" when set.
POST with Content-Type: application/json saves settings and restarts the bridge. It behaves like the web forms:
- A group is only saved when its marker field is present:
device_id(basic),sen_StInterval(sensors),io_in1_pin(I/O),rs485_txd(expert). - Check boxes of a saved group are
trueonly with the value"on"; a missing check box is saved asfalse. - Password value
"*"keeps the stored password.
curl -X POST -H "Content-Type: application/json" \
-d '{"sen_StInterval":"30","sen_sr04_en":"on","sen_sr04trigpin":"5","sen_sr04echopin":"27"}' \
http://192.168.1.42/config
"on" is disabled and missing numeric fields keep their values. Read the configuration first and send the complete group.GET /sysinfo
{
"freemem": 187432, "hostname": "HCPBRIDGE", "ip": "192.168.1.42",
"wifistatus": 3, "rssi": -61, "mqttstatus": true, "restart_reason": 1,
"swversion": "1.1.0", "buildenv": "HCP_Giffordv3",
"sensors": { "BME280": "active", "DS18X20": "off", "DHT22": "off", "HC-SR04": "off", "HC-SR501": "off", "MQ4": "off" },
"io": { "in1": "active", "in2": "off", "out1": "off", "out2": "off" }
}
wifistatus 3 = connected; rssi is 0 when not connected.
GET /events (server-sent events)
The web interface subscribes to /events for instant updates:
| Event | Data |
|---|---|
sensor | One changed value incl. unit, e.g. {"temp":"21.6 °C"} or {"motion":"true"} |
io | Full I/O state, e.g. {"in1":"true","out1":"false"} |
curl -N http://192.168.1.42/events