-
Notifications
You must be signed in to change notification settings - Fork 118
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
web_handler Can URL params be accessed in the automation? #14
Comments
The |
Thanks that gets me on the right track. Any idea why they below seems to crash the esp? Basically the server response is empty, the log shows "Got to end of req" but the ESP then drops the connection for a few seconds then reconnects. - path: /setConfigItem
on_request:
- lambda: |-
gotWebReq(request, stream);
ESP_LOGD("web_req", "Got to end of req"); in includedFile.h void gotWebReq(AsyncWebServerRequest request, AsyncResponseStream stream)
{
stream.print("{\"success\": true}");
return;
} |
By updating the includedFile.h to use refs with & instead it works. My lack of C++ knowledge doesn't help me understand why. void gotWebReq(AsyncWebServerRequest &request, AsyncResponseStream &stream)
{
stream.print("{\"success\": true}");
return;
} |
Works perfectly as mentioned |
Hi Ssieb, Is it possible to access url params e.g /setval?value=100 from within the automation linked to web_handler?
Use case is I have a template sensor that I want set the of via the web server e.g not using Home Assistant.
I've been able to increment the value by 1 each time the URL is called but I'd like to be able to set the value to a specific value if possible.
Thanks
The text was updated successfully, but these errors were encountered: