Skip to content

Add new slave_wifi_rest_api example: REST Wi-Fi control based on original slave (IDFGH-16209) #860

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

glarionenko
Copy link

Changes in this PR

  • Added new example slave_wifi_rest_api based on the original slave example.
  • Implemented REST API for runtime Wi-Fi management:
    • GET /wifi/status — Wi-Fi connection state (connected/disconnected, SSID, RSSI)
    • GET /wifi/scan — scan for available Wi-Fi networks
    • POST /wifi/connect — connect to network with provided SSID/password (JSON)
    • POST /wifi/disconnect — disconnect from current Wi-Fi
    • Universal OPTIONS handler for CORS/browser compatibility
  • Added event group and logic for safe manual connect/disconnect and config changes.
  • Wi-Fi credentials and state can now be controlled at runtime via API without reflashing.
  • Added webPanel/ folder with a simple HTML+JS frontend (webPanel/README.md) for API demonstration and testing.
  • All API endpoints support CORS.
  • Added detailed usage and API docs in README.md.

No changes made to the original slave example; all modifications are in the new slave_wifi_rest_api directory.

Introduces a new example 'slave_wifi_rest_api' for the eppp_link component, providing a REST API for Wi-Fi management (status, scan, connect, disconnect) and a ready-to-use HTML web panel. Includes CMake, Kconfig, and configuration files for multiple transports, as well as implementation for both direct and channel-based Wi-Fi control. Enables dynamic Wi-Fi reconfiguration and CORS support for browser-based management.
Added a link to the original example and updated the web UI reference to point to the web panel documentation for better navigation and clarity.
Revised links in the main and webPanel README files to reference the correct documentation and improve navigation. This enhances clarity for users following setup and usage instructions.
Fixed and clarified relative links in the main and webPanel README files for better navigation and accuracy.
Revised the README title to clarify that the example is based on eppp_link/slave, improving documentation accuracy.
@CLAassistant
Copy link

CLAassistant commented Aug 7, 2025

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot changed the title Add new slave_wifi_rest_api example: REST Wi-Fi control based on original slave Add new slave_wifi_rest_api example: REST Wi-Fi control based on original slave (IDFGH-16209) Aug 7, 2025
@espressif-bot espressif-bot added the Status: Opened Issue is new label Aug 7, 2025
Copy link
Collaborator

@david-cermak david-cermak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent idea with the REST API! Thanks for adding this example (already thinking about some future improvements, e.g. https or running a client on the host side).

The only thing is that code duplication -- this is largely a copy of the original example, not sure how to handle it tho -- probably better to keep in a separate example (and suggested removal of that channel option)

Also, please update your commit history and use conventional-commit message format as described here: https://github.com/espressif/esp-protocols/blob/master/CONTRIBUTING.md
(or install the pre-commit hook and let it fix your commits and formatting for you)

Comment on lines +1 to +3
if(CONFIG_EXAMPLE_WIFI_OVER_EPPP_CHANNEL)
set(wifi_over_channels channel_wifi_station.c)
endif()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest removing this option in this example (just to simplify it and focus on what's important)

  • that would also remove the Kconfig option and the source channel_wifi_station.c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Opened Issue is new
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants