[codex] add web controls for wifi reconnect espnow on off and mqtt publish #8

Merged
electron-rare merged 2 commits from codex/web-network-controls-latest into audit/telephony-webserver 2026-02-20 22:58:43 +00:00
electron-rare commented 2026-02-20 22:50:01 +00:00 (Migrated from github.com)

Context

Continuing the web networking work (WiFi/ESP-NOW/MQTT), this PR adds missing runtime control actions that were available over serial but not exposed as dedicated web endpoints/actions.

What changed

Backend routes

In WebServerManager:

  • Added POST /api/network/wifi/reconnect -> WIFI_RECONNECT
  • Added POST /api/network/espnow/on -> ESPNOW_ON
  • Added POST /api/network/espnow/off -> ESPNOW_OFF

Web UI controls

In data/webui/:

  • Added WiFi reconnect button.
  • Added MQTT publish form (topic + payload).
  • Switched ESP-NOW ON/OFF buttons to use dedicated network endpoints (instead of generic control route).

Why

  • Improve operator workflow from the web UI for live bench tests.
  • Keep web controls aligned with existing firmware command capabilities.
  • Reduce friction when testing ESP-NOW/WiFi paths from browser only.

Validation

  • platformio run -e esp32dev -> SUCCESS
  • bash scripts/test_terminal.sh -> PASS

Notes

  • No protocol break introduced.
  • This PR only touches:
    • src/web/WebServerManager.cpp
    • data/webui/index.html
    • data/webui/script.js
## Context Continuing the web networking work (WiFi/ESP-NOW/MQTT), this PR adds missing runtime control actions that were available over serial but not exposed as dedicated web endpoints/actions. ## What changed ### Backend routes In `WebServerManager`: - Added `POST /api/network/wifi/reconnect` -> `WIFI_RECONNECT` - Added `POST /api/network/espnow/on` -> `ESPNOW_ON` - Added `POST /api/network/espnow/off` -> `ESPNOW_OFF` ### Web UI controls In `data/webui/`: - Added WiFi reconnect button. - Added MQTT publish form (topic + payload). - Switched ESP-NOW ON/OFF buttons to use dedicated network endpoints (instead of generic control route). ## Why - Improve operator workflow from the web UI for live bench tests. - Keep web controls aligned with existing firmware command capabilities. - Reduce friction when testing ESP-NOW/WiFi paths from browser only. ## Validation - `platformio run -e esp32dev` -> SUCCESS - `bash scripts/test_terminal.sh` -> PASS ## Notes - No protocol break introduced. - This PR only touches: - `src/web/WebServerManager.cpp` - `data/webui/index.html` - `data/webui/script.js`
electron-rare commented 2026-02-20 22:50:19 +00:00 (Migrated from github.com)

Cross-repo context:\n- Zacus coordination issue: https://github.com/electron-rare/le-mystere-professeur-zacus/issues/90\n- Zacus related PR: https://github.com/electron-rare/le-mystere-professeur-zacus/pull/92\n- Kill_LIFE route-parity gate proposal: https://github.com/electron-rare/Kill_LIFE/issues/1\n\nThis PR extends browser-side WiFi/ESP-NOW/MQTT operability without changing the existing interop contract.

Cross-repo context:\n- Zacus coordination issue: https://github.com/electron-rare/le-mystere-professeur-zacus/issues/90\n- Zacus related PR: https://github.com/electron-rare/le-mystere-professeur-zacus/pull/92\n- Kill_LIFE route-parity gate proposal: https://github.com/electron-rare/Kill_LIFE/issues/1\n\nThis PR extends browser-side WiFi/ESP-NOW/MQTT operability without changing the existing interop contract.
chatgpt-codex-connector[bot] (Migrated from github.com) reviewed 2026-02-20 22:51:08 +00:00
chatgpt-codex-connector[bot] (Migrated from github.com) left a comment

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0f71cf24b2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `0f71cf24b2` <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](http://chatgpt.com/codex/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". </details>
@@ -211,9 +225,32 @@ function bindEvents() {
}
chatgpt-codex-connector[bot] (Migrated from github.com) commented 2026-02-20 22:51:08 +00:00

P2 Badge Keep MQTT publish payload as raw text

When the payload starts with { or [, parsePayloadValue turns it into an object/array, but the server-side /api/network/mqtt/publish handler reads doc["payload"] into a String (const String payload = doc["payload"] | ""), which falls back to an empty string for non-string JSON values. In practice, submitting JSON payloads (including the default {"ping":true} shown in the new form) publishes an empty payload instead of the intended message.

Useful? React with 👍 / 👎.

**<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Keep MQTT publish payload as raw text** When the payload starts with `{` or `[`, `parsePayloadValue` turns it into an object/array, but the server-side `/api/network/mqtt/publish` handler reads `doc["payload"]` into a `String` (`const String payload = doc["payload"] | ""`), which falls back to an empty string for non-string JSON values. In practice, submitting JSON payloads (including the default `{"ping":true}` shown in the new form) publishes an empty payload instead of the intended message. Useful? React with 👍 / 👎.
electron-rare commented 2026-02-20 22:55:44 +00:00 (Migrated from github.com)

Coordination firmware ok: la PR Zacus https://github.com/electron-rare/le-mystere-professeur-zacus/pull/92 expose maintenant les endpoints /api/network/* + /api/control alignés avec ce que vous poussez ici. Contrat ESP-NOW status/payload inchangé côté interop.

Coordination firmware ok: la PR Zacus https://github.com/electron-rare/le-mystere-professeur-zacus/pull/92 expose maintenant les endpoints /api/network/* + /api/control alignés avec ce que vous poussez ici. Contrat ESP-NOW status/payload inchangé côté interop.
electron-rare commented 2026-02-20 22:58:19 +00:00 (Migrated from github.com)

Codex code review (latest head):

Findings:

  • One blocking issue was found and fixed in this PR branch:
    • MQTT publish UI previously sent parsed JSON object payloads, while firmware /api/network/mqtt/publish reads payload as string.
    • Fix pushed in commit 4f857b4: publish payload is now sent as raw string.

Validation rerun after fix:

  • platformio run -e esp32dev -> SUCCESS
  • bash scripts/test_terminal.sh -> PASS

Current review verdict:

  • No remaining blocking findings for PR #8.
Codex code review (latest head): Findings: - One blocking issue was found and fixed in this PR branch: - MQTT publish UI previously sent parsed JSON object payloads, while firmware `/api/network/mqtt/publish` reads `payload` as string. - Fix pushed in commit `4f857b4`: publish payload is now sent as raw string. Validation rerun after fix: - `platformio run -e esp32dev` -> SUCCESS - `bash scripts/test_terminal.sh` -> PASS Current review verdict: - No remaining blocking findings for PR #8.
electron-rare commented 2026-02-20 23:00:21 +00:00 (Migrated from github.com)

@codex review

@codex review
chatgpt-codex-connector[bot] commented 2026-02-20 23:02:38 +00:00 (Migrated from github.com)

Codex Review: Didn't find any major issues. More of your lovely PRs please.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Codex Review: Didn't find any major issues. More of your lovely PRs please. <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](http://chatgpt.com/codex/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". </details>
electron-rare (Migrated from github.com) reviewed 2026-02-20 23:11:44 +00:00
electron-rare (Migrated from github.com) left a comment

Codex review rapide du diff RTC #8: pas de régression bloquante détectée. Les endpoints ajoutés sont cohérents avec le WebServerManager et le script WebUI. Point de vigilance mineur: pas de checks CI attachés sur cette branche, donc validation à compléter par build/test RTC avant merge.

Codex review rapide du diff RTC #8: pas de régression bloquante détectée. Les endpoints ajoutés sont cohérents avec le WebServerManager et le script WebUI. Point de vigilance mineur: pas de checks CI attachés sur cette branche, donc validation à compléter par build/test RTC avant merge.
electron-rare commented 2026-02-20 23:18:32 +00:00 (Migrated from github.com)

Sync binôme: la PR firmware Zacus #95 couvre maintenant les endpoints web réseau manquants côté Freenove (wifi/reconnect, espnow/on, espnow/off) pour rester en phase avec cette PR RTC.

Sync binôme: la PR firmware Zacus #95 couvre maintenant les endpoints web réseau manquants côté Freenove (`wifi/reconnect`, `espnow/on`, `espnow/off`) pour rester en phase avec cette PR RTC.
Sign in to join this conversation.