Comments (4)
The AsyncWebServerRequest
is available as request
in a lambda. See https://github.com/me-no-dev/ESPAsyncWebServer#request-variables for details.
from esphome_components.
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.
Ive been able to access the AsyncWebServerRequest request fine in the function but as soon as I try the stream.print I get that issue. Using stream.print in the lambda itself in yaml also appears to work fine. I have the function in the .h file though as I want to re-use some existing logic.
in device.yaml
- 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;
}
from esphome_components.
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;
}
from esphome_components.
Works perfectly as mentioned
from esphome_components.
Related Issues (20)
- Feature Request: Desky | Support Height Decoder Variant HOT 42
- Wiegand : delete TAG after transmit HOT 7
- Component "serial" does not persiste value HOT 1
- ip5306 HOT 7
- VBUS: Questions and Warning regarding Resol Deltasol CS Plus HOT 5
- Wiegand: Invalid parity HOT 2
- Feature request: configurable line separator for serial text sensor
- ht16k33_alpha: SparkFun pinout support
- Debugging mode via uart_mitm does not work HOT 3
- ht16k33a needs to updated now that ESPTime namespace change (ESPHome 2023.6) HOT 1
- Uart_mitm usage question HOT 1
- Esmart3 HOT 18
- seesaw neopixel [Adafruit StemmaQT Rotary Encoder]
- Problem using magic_switch component HOT 5
- Esmart3 load On Load Off
- Problem with magic_switch pulse timing report HOT 2
- Could not find components folder for source. HOT 3
- Another problem with magic_switch component
- Failed to compile the firmware with Magic Switch for Sonoff Basic R4 HOT 2
- `serial_csv` text and binary sensor
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esphome_components.