Skip to content
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

Solution for "Add sensor or other dynamic data to HTML or stream #114" #241

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

Conversation

hansju-11
Copy link

add a quick solution for add sensordata into the webpage by using ajax. I reloads the data inline without refresh the whole webpage. It is deactivate in the code. To test it you have the define HAS_BME280 in esp32-cam-webserver and in app_httpd.cpp.

precondition install the LIB https://github.com/finitespace/BME280

Add #define HAS_BME280 to activate this function

change in the code:
- add declaration for BME280
- add setup in void setup() for BMS280
add #define HAS_BME280 to activate the function

change in code:
add static esp_err_t readSensor_handler(httpd_req_t *req) to get the sensor data "inline"
depending on HAS_BME280, load specific data from index_other.h
add section for sensor data in simple view
add .card layout defition
fix build failer line 658  replace with HTTPD_RESP_USE_STRLEN
@easytarget
Copy link
Owner

Hi!
Great job 👍
I'm sorry I didn't respond immediately, busy with lots of things.

I've got a spare BME280 at home (and use another BME280 in my 'Pi OverWatch' project, so I'm familiar with them. I haven't done more than quick scanned your code, I'll try and sit down over the next week and do a more thorough job, hook up the BME to my test cam for a test, and look at how this could be extended to all pages seamlessly. Should be do-able via JS. Ideally I'd like to embed the data in the image but that is beyond the scope of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants