feature-requests icon indicating copy to clipboard operation
feature-requests copied to clipboard

ESP-IDF web_server and captive_portal port (uses ESPAsyncWebServer and AsyncTCP)

Open grischard opened this issue 3 years ago • 4 comments

Describe the problem you have/What new integration you would like

Implement web_server and captive_portal to the ESP-IDF framework

Please describe your use case for this integration and alternatives you've tried:

The web_server and captive_portal features depend on ESPAsyncWebServer and AsyncTCP, which are arduino libraries not yet ported to the ESP-IDF framework.

Additional context

This is a follow-up from #1414

See also #1650 for mqtt.

grischard avatar Feb 22 '22 17:02 grischard

This feature would be greatly appreciated. I use web_server as an important component when bulk-flashing devices.

+1. I would like to use web_server with ESP-IDF.

codersaur avatar Apr 14 '22 14:04 codersaur

+1 I also really miss the web_server component with the ESP-IDF framework

the-smart-home-maker avatar Oct 16 '22 13:10 the-smart-home-maker

+1 Also would appreciate this one.

Malle355 avatar Oct 16 '22 13:10 Malle355

Web server for ESP-IDF is provided by PR 3500, https://github.com/esphome/esphome/pull/3500

For about six months I have had this in my esphome yaml files, and the webserver work fine on ESP-IDF:

external_components:
  - source: github://pr#3500
    components:
      # list all components modified by this Pull Request here
      - web_server
      - web_server_idf
      - web_server_base
      - captive_portal

No idea when it will be incorporated into a release unfortunately. It doesn't seem to be a priority at the moment.

marshn avatar Oct 17 '22 14:10 marshn

Sounds promising! Will try that out. Thank you!

the-smart-home-maker avatar Oct 19 '22 15:10 the-smart-home-maker

This solution worked for me up until today. now I get

Compiling /data/trapkast-light/.pioenvs/trapkast-light/src/esphome/components/web_server_idf/web_server_idf_ota.o
src/esphome/components/web_server/web_server.cpp: In lambda function:
src/esphome/components/web_server/web_server.cpp:107:40: error: 'class esphome::Application' has no member named 'get_friendly_name'
                    root["title"] = App.get_friendly_name().empty() ? App.get_name() : App.get_friendly_name();
                                        ^~~~~~~~~~~~~~~~~
src/esphome/components/web_server/web_server.cpp:107:91: error: 'class esphome::Application' has no member named 'get_friendly_name'
                    root["title"] = App.get_friendly_name().empty() ? App.get_name() : App.get_friendly_name();
                                                                                           ^~~~~~~~~~~~~~~~~
src/esphome/components/web_server/web_server.cpp:108:42: error: 'class esphome::Application' has no member named 'get_comment'; did you mean 'get_name'?
                    root["comment"] = App.get_comment();
                                          ^~~~~~~~~~~
                                          get_name
Compiling /data/trapkast-light/.pioenvs/trapkast-light/src/esphome/components/wifi/wifi_component.o
Compiling /data/trapkast-light/.pioenvs/trapkast-light/src/esphome/components/wifi/wifi_component_esp32_arduino.o
*** [/data/trapkast-light/.pioenvs/trapkast-light/src/esphome/components/web_server/web_server.o] Error 1
========================= [FAILED] Took 154.92 seconds =========================

esphome 2022.12.8 I guess some methods have been changed or renamed.

Is there another solution to get this to work?

bkbartk avatar Jan 29 '23 16:01 bkbartk

Same for me

nagyrobi avatar Jan 29 '23 16:01 nagyrobi

See the comments on https://github.com/esphome/esphome/pull/3500 for a temporary fix. Please help keep the signal/noise ratio high.

grischard avatar Jan 30 '23 18:01 grischard

+1 would appreciate integrating this PR for next release.

hlyi avatar Feb 07 '23 06:02 hlyi

`external_components:

  • source: github://pr#3500 components:
    • web_server
    • web_server_idf
    • web_server_base
    • captive_portal`

Whith last esphome update i get this errors:

`INFO Reading configuration /config/esphome/refrigerateur.yaml... ERROR Unexpected exception while reading configuration: Traceback (most recent call last):

File "/usr/local/bin/esphome", line 33, in sys.exit(load_entry_point('esphome', 'console_scripts', 'esphome')())

File "/esphome/esphome/main.py", line 963, in main return run_esphome(sys.argv)

File "/esphome/esphome/main.py", line 941, in run_esphome config = read_config(dict(args.substitution) if args.substitution else {})

File "/esphome/esphome/config.py", line 986, in read_config res = load_config(command_line_substitutions)

File "/esphome/esphome/config.py", line 840, in load_config return _load_config(command_line_substitutions)

File "/esphome/esphome/config.py", line 828, in _load_config result = validate_config(config, command_line_substitutions)

File "/esphome/esphome/config.py", line 756, in validate_config result.run_validation_steps()

File "/esphome/esphome/config.py", line 125, in run_validation_steps task.step.run(self)

File "/esphome/esphome/config.py", line 308, in run for load in component.auto_load:

TypeError: 'function' object is not iterable`

EMP83 avatar Feb 25 '23 22:02 EMP83

Same here

nagyrobi avatar Feb 26 '23 22:02 nagyrobi

Fixed in https://github.com/esphome/esphome/commit/7a551081ee5e08bf71bc52c2c30168992192bb89 and released in 2023.7.0. Thank you @dentra for your heroic efforts, and @jesserockz for helping get it over the finish line!

grischard avatar Jul 20 '23 13:07 grischard

See also the project board for "The road to ESP-IDF for any component": https://github.com/orgs/esphome/projects/5

grischard avatar Jul 20 '23 13:07 grischard

Hi all,

I came across this thread and i am having problems implementing the http request. I am using the seeed_ciao_esp32c3 board and framework: type esp-idf.

Can someone post a esphome code using this component and sending a post?

My error /config/esphome/windturbine-esp.yaml:52:7: error: 'http_request' was not declared in this scope

`external_components:

  • source: github://pr#3500 components:
    • web_server
    • web_server_idf
    • web_server_base
    • captive_portal

# I2C setup
i2c:
  sda: 6
  scl: 7
  frequency: 100kHz

script:
  - id: send_json
    then:
      - lambda: |-
          http_request.post:
              url: http://192.168.1.5:8081/windturbine
              verify_ssl: false
              json: |-
                root["key"] = "halkhdaih";
                root["greeting"] = "Hello World";`

I really appreciate any help to find a solution

Tietziano90 avatar Oct 24 '23 14:10 Tietziano90

no solution, but I think your are looking for this https://github.com/esphome/issues/issues/3426

bkbartk avatar Oct 24 '23 17:10 bkbartk

Thank you for your response.

I guess no solution at all or can it be done? Unfortunately I am not so experienced with esphome etc.

Would that be a fix? Any solution to just send 5 values will help me a lot

esphome: name: ${device_name} comment: ${device_description} platformio_options: platform_packages: - framework-arduinoespressif32 @ https://github.com/tasmota/arduino-esp32/releases/download/2.0.5/framework-arduinoespressif32-solo1.zip board_build.f_cpu: 160000000L project: name: "${project_name}" version: "${project_version}"

esp32: board: esp32doit-devkit-v1 variant: esp32 framework: type: arduino version: 2.0.5 platform_version: 5.2.0

Tietziano90 avatar Oct 24 '23 18:10 Tietziano90